{% import '_form_macros.html' as macros %}

{% if config["REGISTRATION_OPEN"] %}
<form action="{{ url_for('.root') }}?tab=register" method="post" novalidate>
  {{ register_form.csrf_token }}
  <div class="card-body">
    <div class="form-group">{{ macros.with_errors(register_form.username, tabindex="4") }}</div>
    <div class="form-row">
      <div class="form-group col">{{ macros.with_errors(register_form.firstname, tabindex="5") }}</div>
      <div class="form-group col">{{ macros.with_errors(register_form.lastname, tabindex="6") }}</div>
    </div>
    <div class="form-row">
      <div class="form-group col">{{ macros.with_errors(register_form.mail, tabindex="7") }}</div>
    </div>
    <div class="form-row form-check">
      <div class="form-group col">{{ macros.with_errors(register_form.underage, tabindex="8") }}</div>
    </div>
  </div>
  <div class="card-footer d-flex justify-content-between">
    <div>{{ macros.non_field_errors(register_form) }}</div>
    {{ register_form.submit(color="primary", tabindex="8") }}
  </div>
</form>
{% else %}
<div class="card-body">
  <div class="alert alert-info">
    {{ _("Registration is closed at the moment.") }}
  </div>
</div>
{% endif %}
