{% extends "admin/base.html" %}

{% load i18n %}

{% block head_title %}
  {% trans "Preferences" %} - {{ section }}
{% endblock %}

{% block breadcrumb %}
    <div class="col-sm-12 pl-0">
      <a href="{% url 'admin:preferences' %}">{% trans "Preferences" %}</a>
      /
      {{ section }}
    </div><!-- /.col -->
{% endblock %}


{% block content %}
    <div class="p-1 p-md-3">
      <!-- form error messages -->
        {% if form.errors %}
          <ul class='form-errors text-danger list-unstyled'>
            {% for field in form %}
                {% for error in field.errors %}
                  <li><i class="fa fa-exclamation-triangle m-2"></i>{{ error|escape }}</li>
                {% endfor %}
            {% endfor %}
            {% for error in form.non_field_errors %}
                <li>{{ error|escape }}</li>
            {% endfor %}
          </ul>
        {% endif %}
        <!-- form error messages -->
        <form id="preferences_form" class="change_password" method="POST" action="{% url 'admin:preferences_section' section %}">
          {% csrf_token %}
          {% for field in form %}
            <div class="form-group">
                {{ field.errors }}
                {{ field.label_tag }}
                {{ field }}
                {% if field.help_text %}
                  <small class="form-text text-muted">{{ field.help_text|safe }}</small>
                {% endif %}
            </div>
          {% endfor %}
        </form>
    </div>
{% endblock %}


{% block widgetsbar %}
  <div class="card">
    <div class="card-body">
      <ul class="collection">
        <li class="collection-item d-flex flex-row-reverse mt-3">
            <button form="preferences_form" class="btn btn-primary btn-flat mx-1 btn-block" type="submit">
              <i class="fa fa-check"></i>
              {% trans "Save" %}
            </button>
        </li>
        <li class="collection-item d-flex flex-row-reverse mt-3">
          <a class="btn btn-flat btn-block btn-light" href="{% url 'admin:preferences' %}">{% trans "Cancel" %}</a>
        </li>
      </ul>
    </div>
  </div>
{% endblock %}