{% load i18n %}

<form class="form{% if classes %} {{ classes }}{% endif %}" method="{{ method|default:"post" }}" enctype="multipart/form-data">
  {% csrf_token %}

  {% if title %}
    {% include "components/header/header.html" with title=title only %}
  {% endif %}

  {% block intro %}
  {% endblock intro %}

  {% if form.non_field_errors %}
    {% include "components/form/errors.html" with errors=form.non_field_errors only %}
  {% endif %}

  {% block fields %}
    <section class="section form__section">
      {% for field in form.hidden_fields %}
        {{ field }}
      {% endfor %}

      {% for field in form.visible_fields %}
        <fieldset class="fieldset form__fieldset">
          {% include "components/form/label.html" %}

          {{ field.errors }}
          {{ field }}

          {% if field.help_text %}
            {% include "components/form/help-text.html" %}
          {% endif %}
        </fieldset>
      {% endfor %}
    </section>
  {% endblock fields %}

  {% block actions %}
    <section class="section form__section--last">
      <fieldset class="fieldset form__fieldset">
        {% include "components/form/cancel-button.html" %}
        {% include "components/form/confirm-button.html" %}
      </fieldset>
    </section>
  {% endblock actions %}
</form>
