{% extends "isearch/sidebar.html" %}
{% import "isearch/include/macros.html" as macros %}

{% block title %}Проверка поиска{% endblock %}

{% block statistics_active %}active{% endblock %}

{% block sidebar %}
<ul class="nav nav-list">
    <li><a href="{{ url('push_dashbord') }}?organization_id={{ organization.id }}">Дашборд</a></li>
</ul>
{% endblock %}


{% block content %}
<h2 id="stat">Лог пушей по {{ search }} {% if organization %}({{ organization.label }}){% endif %}</h2>
{% if organization %}
    <p><a href="{{ url('push_log', search) }}?organization_id=">Лог по всем организациям</a></p>
{% endif %}
<table class="table table-bordered">
    <tr>
        <td><b>id</b></td>
        <td><b>Время</b></td>
        <td><b>Статус</b></td>
        <td><b>Индекс</b></td>
        <td><b>Тип</b></td>
        {% if not organization %}
            <th>Орг-ция</th>
        {% endif %}
        <td><b>Комментарий</b></td>
        <td></td>
    </tr>

    {% for record in records %}
    <tr>
        <td>
            {{ record.id }}
        </td>
        <td>
            {{ record.start_time }}
        </td>
        <td>
            {% call macros.render_status(record, record.get_status_display(), "push") %}{{ record.get_status_display() }}{% endcall %}
        </td>
        <td>
            {{ record.index or "(default)" }}
        </td>
        <td>
            {{ record.type }}
        </td>
        {% if not organization %}
            <td>
                {% if record.organization %}
                    {{ macros.admin_org_link(record.organization) }}
                {% endif %}
            </td>
        {% endif %}
        <td>
            {{ record.comment or "" }}
        </td>
    </tr>
    {% endfor %}

</table>

{% with objects=records %}
    {% include 'isearch/pager.html' %}
{% endwith %}

{% endblock %}
