{#
  To make changes to the OpenCulturas Map styling, copy this template file to your theme folder
  Note: this is not a views tempate; views classes are re-used here for legacy reasons
#}

{% extends 'block.html.twig' %}

{% block content %}
  <div class="openculturas-map view" data-type="{{ configuration.type ?? 'locations' }}" data-identifier="{{ configuration.identifier }}">
    <div class="openculturas-map--container leaflet-container attachment-before">

      {% if configuration.show_filter %}
        <details class="openculturas-map--overlay">
          <summary class="openculturas-map--summary"><h4 class="visually-hidden">Filter</h4></summary>
          <div class="openculturas-map--filter openculturas-map--details">

            {{ content.filter }}
          </div>
        </details>
      {% endif %}

      {{ content.map }}

      {% if configuration.show_results and configuration.refresh_results_on_user_interaction %}
        <button class="openculturas-map--reload">
          {% trans %}
            Search in this area
          {% endtrans %}
        </button>
      {% endif %}
    </div>
    {% if configuration.show_results %}
      <div class="openculturas-map--results view-content">
        <div class="openculturas-map--results-header">
          <div class="openculturas-map--results-counter">
            {% trans %}
            Searching...
            {% endtrans %}
          </div>
          {% if content.filter.form['#pager'].options.expose.items_per_page %}
            <div class="openculturas-map--results-picker">
              <label for="openculturas-map--results-picker-select--{{ configuration.identifier }}">{{ content.filter.form['#pager'].options.expose.items_per_page_label ? content.filter.form['#pager'].options.expose.items_per_page_label|trans : 'Items per page'|trans }}:</label>
              <select id="openculturas-map--results-picker-select--{{ configuration.identifier }}">
                {% if content.filter.form['#pager'].options.expose.items_per_page_options %}
                  {% for amount in content.filter.form['#pager'].options.expose.items_per_page_options|split(', ') %}
                      <option value="{{ amount }}" {{ amount == content.filter.form['#pager'].options.items_per_page ? 'selected' : ''}} >{{ amount }}</option>
                  {% endfor %}
                {% else %}
                  <option>10</option>
                  <option>25</option>
                  <option>50</option>
                  <option>100</option>
                {% endif %}
              </select>
            </div>
          {% endif %}
        </div>
        <div class="calendar">
          {{ content.results }}
        </div>
        <div class="openculturas-map--results-footer view-footer">
          <div class="openculturas-map--results-pager pager"></div>
        </div>
      </div>
    {% endif %}
  </div>
{% endblock %}
