{% extends "base.html" %}

{% block actions %}
  <a class="btn btn-danger" href="{% url 'evaluations:type_detail' evaluation_type_properties_id=evaluation_type_properties.id %}">Retour à l'évaluation</a>
{% endblock %}

{% block subtitle %}
  Modification d'un exercice de l'évaluation <span class="text-info">{{evaluation_type_properties.evaluation_type.name}}</span>
{% endblock %}

{% block main %}
  <form action="" method="post" enctype="multipart/form-data" >{% csrf_token %}
    <table class="table table-hover">
      <tbody>
        {% for field in eeForm %}
          <tr {% if field.errors %}class="error"{% endif %}>
            <td>
              {{ field.label_tag }}
            </td>
            <td>
              <div>{{field.errors}}</div>
              {{ field }}
            </td>
          </tr>
        {% endfor %}
      </tbody>
    </table>
    {% if num_formset %}
      <h5>Critère numérique</h5>
      <table class="table table-hover">
        <tbody>
          {{ num_formset.management_form }}
          {% for form in num_formset %}
            {% if forloop.first %}
              <tr>
                {% for field in form %}
                  <td> {% if not field.is_hidden %}{{field.label_tag}}{% endif %}</td>
                {% endfor %}
              </tr>
            {% endif %}
            <tr>
              {% for field in form %}
                <td {% if field.errors %}class="error"{% endif %}><div>{% if field.errors %}({{field.errors}}){% endif %} </div>{{field}}</td>
              {% endfor %}
            </tr>
          {% endfor %}
        </tbody>
      </table>
    {% endif %}

    {% if verb_formset %}
      <h5>Critère verbatim</h5>
      <table class="table table-hover">
        <tbody>
          {{ verb_formset.management_form }}
          {% for form in verb_formset %}
            {% if forloop.first %}
              <tr>
                {% for field in form %}
                  <td> {% if not field.is_hidden %}{{field.label_tag}}{% endif %}</td>
                {% endfor %}
              </tr>
            {% endif %}
            <tr>
              {% for field in form %}
                <td {% if field.errors %}class="error"{% endif %}><div>{% if field.errors %}({{field.errors}}){% endif %} </div>{{field}}</td>
              {% endfor %}
            </tr>
          {% endfor %}
        </tbody>
      </table>
    {% endif %}
    <div class="clearfix">
      <div class="pull-right">
        <input class="btn btn-primary" type="submit" value="Enregistrer" />
      </div>
    </div>
  </form>
{% endblock %}
