{% load i18n admin_static material_admin %}
{% if results %}
{% if cl.model_admin.actions == None %}
<style>
    .fixedHeader-floating th:first-child,
    .fixedHeader-floating td:first-child,
    .results table tr th:first-child,
    .results table tr td:first-child {
        padding-left: 40px;
    }
</style>
{% endif %}
<div class="results">
    <table id="result_list" class="table bordered">
        <thead>
            <tr>
                {% for header in result_headers %}
                {% if 'action_checkbox' in cl.list_display and forloop.counter == 1 %}
                <th class="action-checkbox">
                    {{ header.text }}<label for="action-toggle">&nbsp;</label>
                </th>
                {% else %}
                <th scope="col" {{ header.class_attrib }}>
                    {% if header.sortable %}
                        {% if header.sort_priority == 0 %}
                            <a href="{{ header.url_primary }}">{{ header.text|capfirst }}</a>
                        {% elif header.ascending %}
                            <a href="{{ header.url_primary }}" title="{% trans "Toggle sorting" %}"><i class="material-icons">arrow_upward</i>{{ header.text|capfirst }}</a>
                        {% else %}
                            <a href="{{ header.url_remove }}" title="{% trans "Remove from sorting" %}"><i class="material-icons">arrow_downward</i>{{ header.text|capfirst }}</a>
                        {% endif %}
                    {% else %}
                        <span>{{ header.text|capfirst }}</span>
                    {% endif %}
                </th>{% endif %}{% endfor %}
            </tr>
        </thead>
        <tbody>                
            {% for result in results %}            
            {% if result.form.non_field_errors %}
            <tr><td colspan="{{ result|length }}">{{ result.form.non_field_errors }}</td></tr>
            {% endif %}
            <tr class="{% cycle 'row1' 'row2' %}">
                {% for item in result %}
                {% if 'action_checkbox' in cl.list_display and forloop.counter == 1 %}
                    <td class="action-checkbox">
                        <input class="action-select" name="_selected_action" id="_selected_action_{{ forloop.parentloop.counter }}" type="checkbox" value="{{ item|admin_change_list_value }}" />
                        <label for="_selected_action_{{ forloop.parentloop.counter }}">&nbsp;&nbsp;</label>
                    </td>
                {% else %}
                    {{ item }}
                {% endif %}{% endfor %}
            </tr>
            {% endfor %}
        </tbody>
    </table>
</div>
{% endif %}
