{% extends 'user/tabs.html' %}
{% load crispy_forms_filters %}

{% block title %}Puchar Dyrektora - zgłoś uczniów{% endblock %}

{% block tab %}
<form class="is-flex is-flex-direction-column" method="POST">
  <div class="my-6 has-text-centered is-flex is-flex-direction-column">
    <span class="title">
      {% if students %}
        Edytuj zgłoszenie
      {% else %}
        Zgłoś uczniów
      {% endif %}
    </span>
  </div>
  {% csrf_token %}
  {{ formset.management_form | crispy }}
  {% for form in formset %}
    <div class="columns">
      <div class="column is-5">{{ form.name | as_crispy_field }}</div>
      <div class="column is-5">{{ form.surname | as_crispy_field }}</div>
      <div class="column is-2">{{ form.grade | as_crispy_field }}</div>
    </div>
  {% endfor %}

  {% if students %}
    <button class="button is-info mx-auto" type="submit">Edytuj</button>
  {% else %}
    <button class="button is-link mx-auto" type="submit">Zgłoś</button>
  {% endif %}
</form>
{% endblock %}
