{% extends "admin/base_site.html" %}
{% load adminmedia admin_list i18n autoreports_tags %}

{% block extrastyle %}
  {{ block.super }}
  <link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/changelists.css" />
  <link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}merengue/css/admin.css" />
  {% if cl.formset %}
    <link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />
  {% endif %}
  {% if not actions_on_top and not actions_on_bottom %}
    <style>
      #changelist table thead th:first-child {width: inherit}
    </style>
  {% endif %}
{% endblock %}

{% block extrahead %}
  {{ block.super }}
  {% if cl.formset %}
    <script type="text/javascript" src="../../jsi18n/"></script>
  {% endif %}
    <script type="text/javascript" src="{{ MEDIA_URL }}merengue/js/map/fade.in.googlemap.js"> </script>
  {{ media }}
{% endblock %}

{% block bodyclass %}change-list{% endblock %}

{% if not is_popup %}
{% block breadcrumbs %}
<div class="breadcrumbs">
      {% include "admin/breadcrumbs.html" %}
</div>
{% endblock %}
{% endif %}

{% block coltype %}flex{% endblock %}

{% block content %}
  <div id="content-main">
    {% block object-tools %}
        <ul class="object-tools">
          {% autoreports_admin %}
          {% if inside_basecontent %}
          {% include "admin/object_tools.html" %}
          {% endif %}
          {% if has_add_permission %}
          <li>
            <a href="add/{% if is_popup %}?_popup=1{% endif %}" class="addlink">
              {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
            </a>
          </li>
          {% endif %}
        </ul>
    {% endblock %}
    {% if cl.formset.errors %}
        <p class="errornote">
        {% blocktrans count cl.formset.errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
        </p>
        <ul class="errorlist">{% for error in cl.formset.non_field_errors %}<li>{{ error }}</li>{% endfor %}</ul>
    {% endif %}
    <div class="module{% if cl.has_filters %} filtered{% endif %}{% block module-extra-class %}{% endblock %}" id="changelist">
      {% block search %}{% search_form cl %}{% endblock %}
      {% block date_hierarchy %}{% date_hierarchy cl %}{% endblock %}

      {% block filters %}
        {% if cl.has_filters %}
          <div id="changelist-filter">
            <h2>{% trans 'Filter' %}</h2>
            {% for spec in cl.filter_specs %}{% admin_list_filter cl spec %}{% endfor %}
          </div>
        {% endif %}
      {% endblock %}

      <form action="" method="post"{% if cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %}>
      {% if cl.formset %}
        {{ cl.formset.management_form }}
      {% endif %}

      <span style="display: none" id="google-maps-api-key">{{ GOOGLE_MAPS_API_KEY }}</span>

      {% block result_list %}
          {% if action_form and actions_on_top and cl.full_result_count %}{% admin_actions %}{% endif %}
          {% result_list cl %}
          {% if action_form and actions_on_bottom and cl.full_result_count %}{% admin_actions %}{% endif %}
      {% endblock %}
      {% block pagination %}{% pagination cl %}{% endblock %}
      </form>
    </div>
  </div>
{% endblock %}
