{% from "macros/pagination.html" import pagination %}
<div class="wrapper" data-columns="{{ columns_values_joined }}">
{{ pagination(report_list, current_url, current_page, '#tab-reports') }}

<table class="data-table tablesorter " id="reportsList">
    <thead>
        <tr>
            {% for column in columns %}
            <th scope="col" class="header {% if sort==column.key %}headerSort{% if column.reverse %}Up{% else %}Down{% endif %}{% endif %}">
                <a href="{{ change_query_string(sort=column.key, reverse=column.reverse, _no_base=True) }}" class="sort-header" data-key="{{ column.key }}">{{ column.label }}</a>
            </th>
            {% endfor %}
        </tr>
    </thead>
    <tbody>
    {% for crash in report_list.hits %}
        <tr>
            {% for column in columns %}
              {% set value = read_crash_column(crash, column.key) %}
              {% if column.key == 'date_processed' %}
                <td class="report-date_processed">
                  <a href="{{ url('crashstats:report_index', crash.uuid) }}">{{ crash.date_processed }}</a>
                  <div class="hang-pair"></div>
                </td>
              {% elif column.key == 'duplicate_of' %}
                <td>
                  {% if crash.duplicate_of %}
                    <a href="{{ url('crashstats:report_index', crash.duplicate_of) }}">dup</a></td>
                  {% endif %}
                </td>
              {% elif column.key == 'os_and_version' %}
                <td>{{ crash.os_name }} {{ crash.os_version }}</td>
              {% elif column.key == 'comments' or column.key == 'Comments' %}
                <td class="comments">
                  {% if request.user.has_perm('crashstats.view_pii') %}
                    {{ value }}
                  {% else %}
                      {{ value | scrub_pii }}
                  {% endif %}
                </td>
              {% else %}
                <td>
                  {{ value }}
                </td>
              {% endif %}
            {% endfor %}
        </tr>
    {% endfor %}
    </tbody>
</table>

{{ pagination(report_list, current_url, current_page, '#tab-reports') }}
</div>
