{% load i18n static pinmok_tags %} {% if result_hidden_fields %}
{# DIV for HTML validation #} {% for item in result_hidden_fields %}{{ item }}{% endfor %}
{% endif %} {% if results %}
{# Render table headers with sorting controls (toggle direction, remove sorting, multi-sort priority badge) #} {% for header in result_headers %} {% endfor %} {% for result in results %} {% if result.form and result.form.non_field_errors %} {% endif %} {% for item in result %} {{ item }} {% endfor %} {% endfor %}
{% if header.sortable %}
{# Sortable: clicking the title sets this column as primary sort #} {# Show priority badge only when multiple columns are being sorted #} {% if header.sort_priority > 0 and num_sorted_fields > 1 %} {{ header.sort_priority }} {% endif %} {{ header.text|capfirst }} {# Show toggle and remove controls only when this column is actively sorting #} {% if header.sort_priority > 0 %}
{# Toggle between ascending and descending order #} {# Remove this column from sorting #} {% icon 'tabler-filter-x' '' 14 %}
{% endif %}
{% else %} {# Not sortable: plain text only #} {{ header.text|capfirst }} {% endif %}
{{ result.form.non_field_errors }}
{% endif %}