{% extends 'events/display/conference/base.html' %}

{% from 'events/abstracts/management/_abstract_list.html' import render_abstract_list %}
{% from 'events/management/_lists.html' import render_displayed_entries_fragment %}

{% block back_button_url -%}
    {{ url_for('.display_reviewable_tracks', event) }}
{%- endblock %}

{% block back_button_title -%}
    {%- trans %}Back to reviewing area{% endtrans -%}
{% endblock %}

{% block title %}
    {% trans track_title=track.title %}Abstracts from <span class="track-name">{{ track_title }}</span>{% endtrans %}
{% endblock %}

{% block content %}
    {% if not total_abstracts %}
        <div class="info-message-box">
            <span class="icon"></span>
            <div class="message-text">{% trans %}There are no abstracts in this track.{% endtrans %}</div>
        </div>
    {% else %}
        <div class="list abstracts">
            <div class="toolbars space-after">
                <div class="toolbar">
                    <button class="icon-checkbox-checked i-button arrow left icon-only"
                            aria-hidden="true" data-toggle="dropdown"></button>
                    <ul class="i-dropdown">
                        <li><a href="#" id="select-all">{% trans 'Selection' %}All{% endtrans %}</a></li>
                        <li><a href="#" id="select-none">{% trans 'Selection' %}None{% endtrans %}</a></li>
                    </ul>
                    <button class="i-button icon-settings js-dialog-action js-customize-list highlight"
                            data-href="{{ url_for('.display_customize_abstract_list', event, track) }}"
                            data-title="{% trans %}Abstract list configuration{% endtrans %}"
                            data-dialog-classes="list-filter-dialog"
                            data-update='{"html": "#abstract-list", "filter_statistics": "#filter-statistics"}'
                            data-ajax-dialog>
                        {%- trans %}Customize list{% endtrans -%}
                    </button>
                    {% if can_download_attachments %}
                        <button class="i-button icon-attachment js-requires-selected-row disabled js-submit-list-form"
                                data-href="{{ url_for('.display_download_attachments', track) }}">
                            {%- trans %}Download attachments{%- endtrans %}
                        </button>
                    {% endif %}
                    <button class="i-button arrow button js-requires-selected-row disabled"
                            data-toggle="dropdown">
                        {%- trans %}Export{% endtrans -%}
                    </button>
                    <ul class="i-dropdown">
                        {% if indico_config.LATEX_ENABLED %}
                            <li>
                                <a href="#"
                                   class="icon-file-pdf js-requires-selected-row disabled js-submit-list-form"
                                   data-href="{{ url_for('.display_abstracts_pdf_export', track) }}">
                                    PDF
                                </a>
                            </li>
                        {% endif %}
                        <li>
                            <a href="#"
                               class="icon-file-spreadsheet js-requires-selected-row disabled js-submit-list-form"
                               data-href="{{ url_for('.display_abstracts_csv_export', track) }}">
                                CSV
                            </a>
                        </li>
                        <li>
                            <a href="#"
                               class="icon-file-excel js-requires-selected-row disabled js-submit-list-form"
                               data-href="{{ url_for('.display_abstracts_xlsx_export', track) }}">
                                XLSX (Excel)
                            </a>
                        </li>
                    </ul>
                    <div class="group">
                        <button class="i-button button change-columns-width" title="{% trans %}Adapt columns width{% endtrans %}"></button>
                    </div>
                </div>
                <div class="toolbar">
                    <div class="group">
                        <div id="filter-statistics">
                            {{ render_displayed_entries_fragment(abstracts|length, total_abstracts) }}
                        </div>
                    </div>
                    <div class="group">
                        <div class="i-button label icon-search"></div>
                        <input type="text" id="search-input" placeholder="{% trans %}Search by #id or string{% endtrans %}">
                    </div>
                </div>
            </div>
            <div class="list-content" id="abstract-list">
                {{ render_abstract_list(abstracts, dynamic_columns, static_columns, total_abstracts, track, reviewed_abstracts) }}
            </div>
            <div id="filter-placeholder"></div>
            <script>
                setupAbstractList();
            </script>
        </div>
    {% endif %}
{% endblock %}
