{% extends 'base.html' %}
{% load static %}

{% block title %}
  Upload {{ verbose_name_plural }} {{ block.super }}
{% endblock %}

{% block content %}
  <div class="page-wrapper">
    {% if back_url %}
      <section>
        <div class="container">
          <a href="{{ back_url }}" class="btn btn-link text-decoration-none">
            <i class="fas fa-chevron-left"></i>
            Back
          </a>
        </div>
      </section>
    {% endif %}

    <section>
      <div class="container">
        <header class="section-header">
          <h2>Upload {{ verbose_name_plural }}</h2>
        </header>

        {% if errors %}
          {% block errors %}
            <div class="alert alert-danger">
              <h4 class="alert-heading">There were errors importing your data</h4>
              <ul class="list-unstyled">
                {% include 'django_io/components/errors.html' %}
              </ul>
            </div>
          {% endblock %}
        {% endif %}

        {% block form %}
          <form method="post" enctype='multipart/form-data'>
            {% csrf_token %}
            {{ form }}
            <div class="d-flex justify-content-end" style="gap: 0.5rem">
              <a href="{% static sample_sheet %}" class="btn btn-link text-decoration-none">
                Download sample
              </a>
              <button type="submit" class="btn btn-primary">
                Upload
              </button>
            </div>
          </form>
        {% endblock %}
      </div>
    </section>
  </div>
{% endblock %}
