{% load url from future %}
{% load i18n pagination %}

<div class="advreport" 
        id="advreport_{{ advreport.slug }}" 
        data-slug="{{ advreport.slug }}" 
        data-animation="{{ advreport.animation }}"
        data-link="{% url 'advanced_reports_list' advreport.slug %}">
{% block include_header %}
{% if advreport.report_header_visible %}
    {% if inc_header_template_name %}
        {% include inc_header_template_name %}
    {% else %}
        {% include "advanced_reports/inc_header.html" %}
    {% endif %}
{% endif %}
{% endblock %}
{% paginate paginated %}
{% if advreport.header_visible %}
    <table class="data" style="table-layout: fixed;">
        <tr>
            {% if advreport.multiple_actions %}
            <th style="width: 32px;"><input type="checkbox" name="selector" id="selector"/></th>
            {% endif %}
            {% for column_header in advreport.column_headers %}
            <th{% if column_header.style %} style="{{ column_header.style }}"{% endif %}>
                {% if column_header.sortable %}
                    {% ifequal column_header.name order_field %}
                        <a class="underline" href="?q={{ request.GET.q }}&amp;from={{ request.GET.from }}&amp;to={{ request.GET.to }}{% if request.GET.exact %}&amp;exact=on{% endif %}&amp;order={% if ascending %}-{% endif %}{{ column_header.order_by }}">{{ column_header.verbose_name }}</a>
                        {% if ascending %}
                        <img src="{{ STATIC_URL }}img/arrow-up.gif" alt=""/>
                        {% else %}
                        <img src="{{ STATIC_URL }}img/arrow-down.gif" alt=""/>
                        {% endif %}
                    {% else %}
                        <a href="?q={{ request.GET.q }}{% if request.GET.exact %}&amp;exact=on{% endif %}&amp;order={{ column_header.order_by }}">{{ column_header.verbose_name }}</a>
                    {% endifequal %}
                {% else %}
                    {{ column_header.verbose_name }}
                {% endif %}
            </th>
            {% endfor %}
            <th/>
        </tr>
    </table>
{% endif %}

{% for object in paginated.object_list %}
    {% include "advanced_reports/searchitems_item_row.html" %}
{% empty %}
    <div class="alignCenter italic lighter">{{ advreport.get_empty_text }}</div>
{% endfor %}

{% endpaginate %}
</div>
