{% extends 'events/abstracts/management/_base.html' %}

{% block content %}
    {% if not notifications_configured %}
        <div class="warning-message-box fixed-width">
            <div class="message-box-content">
                <span class="icon"></span>
                <div class="message-text">
                    {% trans %}
                        No email notifications templates are configured for this event.
                        You can add the default templates using the button below and customize them, or
                        use the "Notifications" dialog to set up custom notification templates.
                    {% endtrans %}
                </div>
            </div>
            <div class="toolbar f-j-end" style="width: 100%; margin-top: 5px;">
                <div class="group">
                    <button class="i-button icon-settings highlight"
                            data-href="{{ url_for('.quick_setup_notifications', event) }}"
                            data-method="POST"
                            data-reload-after>
                        {% trans %}Setup default notifications{% endtrans %}
                    </button>
                </div>
            </div>
        </div>
    {% endif %}

    {% if not cfa.has_started %}
        {% include 'events/abstracts/management/cfa_actions/not_started.html' %}
    {% elif cfa.has_started and not cfa.has_ended %}
        {% include 'events/abstracts/management/cfa_actions/open.html' %}
    {% elif cfa.has_ended %}
        {% include 'events/abstracts/management/cfa_actions/ended.html' %}
    {% endif %}

    <div class="action-box">
        <div class="section">
            <div class="icon icon-upload"></div>
            <div class="text">
                <div class="label">
                    {%- trans %}Submission{% endtrans -%}
                </div>
                {%- trans %}Configure general submission settings and email notification templates.{% endtrans -%}
            </div>
            <div class="toolbar">
                <button class="i-button icon-mail"
                        data-href="{{ url_for('.email_tpl_list', event) }}"
                        data-title="{% trans %}Configure e-mail notifications{% endtrans %}"
                        data-ajax-dialog>
                    {%- trans %}Notifications{% endtrans -%}
                </button>
                <button class="i-button icon-settings"
                        data-href="{{ url_for('.manage_submission_settings', event) }}"
                        data-title="{% trans %}Configure abstract submission{% endtrans %}"
                        data-ajax-dialog>
                    {%- trans %}Settings{% endtrans -%}
                </button>
            </div>
        </div>

        {# Only show contribution settings if user can manage them #}
        {% if event.can_manage(session.user) %}
            <div class="section">
                <div class="icon icon-wrench"></div>
                <div class="text">
                    <div class="label">
                        {%- trans %}Fields and types{% endtrans -%}
                    </div>
                    {%- trans %}Configure the contribution types and abstract fields.{% endtrans -%}
                </div>
                <div class="toolbar">
                    <button class="i-button"
                            data-href="{{ url_for('contributions.manage_types', event) }}"
                            data-title="{% trans %}Manage contribution types{% endtrans %}"
                            data-ajax-dialog>
                        {%- trans %}Contribution types{% endtrans -%}
                    </button>
                    <button class="i-button js-dialog-action"
                            data-title="{% trans %}Manage fields{% endtrans %}"
                            data-href="{{ url_for('contributions.manage_fields', event) }}"
                            data-ajax-dialog>
                        {%- trans %}Abstract fields{% endtrans -%}
                    </button>
                </div>
            </div>
        {% endif %}

        <div class="section">
            <div class="icon icon-file-check"></div>
            <div class="text">
                <div class="label">
                    {%- trans %}Reviewing{% endtrans -%}
                </div>
                {%- trans %}Configure the reviewing questions and answers, the reviewing teams, etc.{% endtrans -%}
            </div>
            <div class="toolbar">
                <button class="i-button icon-users"
                        data-href="{{ url_for('.manage_reviewing_roles', event) }}"
                        data-title="{% trans %}Abstract Reviewing Roles{% endtrans %}"
                        data-ajax-dialog>
                    {%- trans %}Roles{% endtrans -%}
                </button>
                <button class="i-button icon-settings"
                        data-href="{{ url_for('.manage_reviewing_settings', event) }}"
                        data-title="{% trans %}Configure abstract reviewing{% endtrans %}"
                        data-ajax-dialog>
                    {%- trans %}Settings{% endtrans -%}
                </button>
                <button class="i-button icon-question"
                        data-href="{{ url_for('.manage_reviewing_questions', event) }}"
                        data-title="{% trans %}Configure abstract reviewing questions{% endtrans %}"
                        data-ajax-dialog>
                    {%- trans %}Questions{% endtrans -%}
                </button>
            </div>
        </div>

        <div class="section">
            <div class="icon icon-book"></div>
            <div class="text">
                <div class="label">
                    {%- trans %}Book of abstracts{% endtrans -%}
                </div>
                {% if indico_config.LATEX_ENABLED or event.has_custom_boa %}
                    {% set link_start %}<a class="arrow js-dropdown" data-toggle="dropdown">{% endset %}
                    {% set link_end %}</a>{% endset %}
                    {%- trans -%}
                        Customize and {{ link_start }}download{{ link_end }} the book of abstracts
                    {%- endtrans -%}
                    <ul class="i-dropdown">
                        {% if event.has_custom_boa %}
                            <li>
                                <a href="{{ url_for('.export_boa', event) }}">Custom PDF</a>
                            </li>
                        {% endif %}
                        {% if indico_config.LATEX_ENABLED %}
                            <li>
                                <a href="{{ url_for('.export_boa', event, latex='1') }}">PDF</a>
                            </li>
                        {% endif %}
                        <li>
                            <a href="{{ url_for('.export_boa_tex', event) }}">LaTeX</a>
                        </li>
                    </ul>
                {% else %}
                    {% set link_start %}<a href="{{ url_for('.export_boa_tex', event) }}">{% endset %}
                    {% set link_end %}</a>{% endset %}
                    {%- trans -%}
                        Customize and {{ link_start }}download{{ link_end }} the book of abstracts
                    {%- endtrans -%}
                {% endif %}
            </div>
            <div class="toolbar">
                <div id="boa-custom-upload"
                     data-event-id="{{ event.id }}"
                     data-file="{{ custom_boa|tojson|forceescape }}"
                     {{ 'data-has-latex' if indico_config.LATEX_ENABLED }}></div>
                <button class="i-button icon-settings"
                        data-href="{{ url_for('.manage_boa_settings', event) }}"
                        data-title="{% trans %}Configure the book of abstracts{% endtrans %}"
                        data-ajax-dialog>
                    {%- trans %}LaTeX Settings{% endtrans -%}
                </button>
            </div>
        </div>
    </div>

    <div class="action-box">
        <div class="section">
            <div class="icon icon-list"></div>
            <div class="text">
                <div class="label">
                    {%- trans %}List of abstracts{% endtrans -%}
                </div>
                {%- trans %}View and perform actions on abstracts{% endtrans -%}
            </div>
            <div class="toolbar">
                <a href="{{ url_for('.manage_abstract_list', event) }}" class="i-button icon-settings">
                    {%- trans %}Manage{% endtrans -%}
                    <span class="badge">{{ abstracts_count }}</span>
                </a>
            </div>
        </div>
    </div>
{% endblock %}
