{% load i18n %}
{% if result_hidden_fields %}
<div class="hiddenfields">{# DIV for HTML validation #}
  {% for item in result_hidden_fields %}{{ item }}{% endfor %}
</div>
{% endif %}
{% if results %}
<div class="results">
  <table id="datatables-reponsive" class="table table-striped dataTable no-footer dtr-inline" style="width: 100%;"
    aria-describedby="datatables-reponsive_info">
    <thead>
      <tr>
        {% for header in result_headers %}
        <th {{ header.class_attrib }} class="sorting sorting_asc" tabindex="0" aria-controls="datatables-reponsive" rowspan="1" colspan="1"
           aria-sort="ascending" aria-label="Name: activate to sort column descending">

          {% if header.sortable %}
              {% if header.sort_priority > 0 %}
              <div class="sortoptions">
                <a class="sortremove" href="{{ header.url_remove }}" title="{% translate "Remove from sorting" %}"></a>
                {% if num_sorted_fields > 1 %}<span class="sortpriority" title="{% blocktranslate with priority_number=header.sort_priority %}Sorting priority: {{ priority_number }}{% endblocktranslate %}">{{ header.sort_priority }}</span>{% endif %}
                <a href="{{ header.url_toggle }}" class="toggle {% if header.ascending %}ascending{% else %}descending{% endif %}" title="{% translate "Toggle sorting" %}"></a>
              </div>
            {% endif %}
          {% endif %}
          <div class="text">{% if header.sortable %}<a href="{{ header.url_primary }}">{{ header.text|capfirst }}</a>{% else %}<span>{{ header.text|capfirst }}</span>{% endif %}</div>
          <div class="clear"></div>
        </th>
        {% endfor %}
      </tr>
    </thead>
    <tbody>
      {% for result in results %}
        {% if result.form and result.form.non_field_errors %}
        <tr class="odd"><td colspan="{{ result|length }}" >{{ result.form.non_field_errors }}</td></tr>
        {% endif %}
        <tr>{% for item in result %}{{ item }}{% endfor %}</tr>
      {% endfor %}
    </tbody>
  </table>
  
</div>
{% endif %}