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

{% block content %}
    {% set cfp = event.cfp %}
    {% set tz = event.tzinfo %}
    {% if not cfp.has_started %}
        {% include 'events/papers/management/cfp_actions/not_started.html' %}
    {% elif cfp.has_started and not cfp.has_ended %}
        {% include 'events/papers/management/cfp_actions/open.html' %}
    {% elif cfp.has_ended %}
        {% include 'events/papers/management/cfp_actions/ended.html' %}
    {% endif %}

    <div class="action-box">
        <div class="section semantic-text {{ 'highlight' if cfp.content_reviewing_enabled }}">
            <div class="icon icon-file-content"></div>
            <div class="text">
                <div class="label">{% trans %}Content reviewing{% endtrans %}</div>
                {% set deadline = cfp.content_reviewer_deadline %}
                {% if not cfp.content_reviewing_enabled %}
                    {%- trans %}The content reviewing process is disabled{% endtrans -%}
                {% elif deadline -%}
                    {% trans date=deadline|format_date(timezone=tz), time=deadline|format_time(timezone=tz) -%}
                        The content reviewing process ends on <strong>{{ date }}</strong> at <strong>{{ time }}</strong>.
                    {%- endtrans %}
                {% else %}
                    {%- trans %}The content reviewing process is enabled{% endtrans -%}
                {% endif -%}
            </div>
            <div class="toolbar hide-if-locked">
                {% if cfp.content_reviewing_enabled %}
                    <button class="i-button icon-time"
                            data-href="{{ url_for('.manage_deadline', event, role='content_reviewer') }}"
                            data-title="{% trans %}Set content reviewing deadline{% endtrans %}"
                            data-update="#paper-page"
                            data-replace-update
                            data-ajax-dialog>
                        {% trans %}Deadline{% endtrans %}
                    </button>
                    <button class="i-button icon-switchoff"
                            data-href="{{ url_for('papers.switch', event, reviewing_type='content') }}"
                            data-method="DELETE"
                            {% if cfp.is_open %}
                                data-confirm="{% trans %}The reviewing process has started. Are you sure you want to disable the content reviewing process?{% endtrans %}"
                            {% endif %}
                            data-update="#paper-page"
                            data-replace-update>
                        {%- trans %}Disable{% endtrans -%}
                    </button>
                    <button class="i-button icon-question"
                            data-href="{{ url_for('.manage_reviewing_questions', event, review_type='content') }}"
                            data-title="{% trans %}Configure content reviewing questions{% endtrans %}"
                            data-ajax-dialog>
                        {%- trans %}Questions{% endtrans -%}
                    </button>
                {% else %}
                    <button class="i-button icon-switchon"
                            data-href="{{ url_for('papers.switch', event, reviewing_type='content') }}"
                            data-method="PUT"
                            data-update="#paper-page"
                            data-replace-update>
                        {%- trans %}Enable{% endtrans -%}
                    </button>
                {% endif %}
            </div>
        </div>
        <div class="section semantic-text {{ 'highlight' if cfp.layout_reviewing_enabled }}">
            <div class="icon icon-layout"></div>
            <div class="text">
                <div class="label">{% trans %}Layout reviewing{% endtrans %}</div>
                {% set deadline = cfp.layout_reviewer_deadline %}
                {% if not cfp.layout_reviewing_enabled %}
                    {%- trans %}The layout reviewing process is disabled{% endtrans -%}
                {% elif deadline %}
                    {% trans date=deadline|format_date(timezone=tz), time=deadline|format_time(timezone=tz) -%}
                        The layout reviewing process ends on <strong>{{ date }}</strong> at <strong>{{ time }}</strong>.
                    {%- endtrans %}
                {% else %}
                    {%- trans %}The layout reviewing process is enabled{% endtrans -%}
                {% endif -%}
            </div>
            <div class="toolbar hide-if-locked">
                {% if cfp.layout_reviewing_enabled %}
                    <button class="i-button icon-time"
                            data-href="{{ url_for('.manage_deadline', event, role='layout_reviewer') }}"
                            data-title="{% trans %}Set layout reviewing deadline{% endtrans %}"
                            data-update="#paper-page"
                            data-replace-update
                            data-ajax-dialog>
                        {% trans %}Deadline{% endtrans %}
                    </button>
                    <button class="i-button icon-switchoff"
                            data-href="{{ url_for('papers.switch', event, reviewing_type='layout') }}"
                            data-method="DELETE"
                            {% if cfp.is_open %}
                                data-confirm="{% trans %}The reviewing process has started. Are you sure you want to disable the layout reviewing process?{% endtrans %}"
                            {% endif %}
                            data-update="#paper-page"
                            data-replace-update>
                        {%- trans %}Disable{% endtrans -%}
                    </button>
                    <button class="i-button icon-question"
                            data-href="{{ url_for('.manage_reviewing_questions', event, review_type='layout') }}"
                            data-title="{% trans %}Configure layout reviewing questions{% endtrans %}"
                            data-ajax-dialog>
                        {%- trans %}Questions{% endtrans -%}
                    </button>
                {% else %}
                    <button class="i-button icon-switchon"
                            data-href="{{ url_for('papers.switch', event, reviewing_type='layout') }}"
                            data-method="PUT"
                            data-update="#paper-page"
                            data-replace-update>
                        {%- trans %}Enable{% endtrans -%}
                    </button>
                {% endif %}
            </div>
        </div>
        <div class="section">
            <div class="icon icon-hammer"></div>
            <div class="text">
                <div class="label">{% trans %}Paper judging{% endtrans %}</div>
                {% set deadline = cfp.judge_deadline %}
                {% if deadline %}
                    {% trans date=deadline|format_date(timezone=tz), time=deadline|format_time(timezone=tz) -%}
                        Paper judging ends on <strong>{{ date }}</strong> at <strong>{{ time }}</strong>.
                    {%- endtrans %}
                {% else %}
                    {%- trans %}There is no deadline for paper judging.{% endtrans -%}
                {% endif %}
            </div>
            <div class="toolbar hide-if-locked">
                <button class="i-button icon-time"
                        data-href="{{ url_for('.manage_deadline', event, role='judge') }}"
                        data-title="{% trans %}Set paper judging deadline{% endtrans %}"
                        data-update="#paper-page"
                        data-replace-update
                        data-ajax-dialog>
                    {% trans %}Deadline{% endtrans %}
                </button>
            </div>
        </div>
    </div>

    <div class="action-box">
        <div class="section">
            <div class="icon icon-file-text"></div>
            <div class="text">
                <div class="label">{% trans %}Paper templates{% endtrans %}</div>
                {%- trans %}Manage paper templates that can be downloaded in the event area{% endtrans -%}
            </div>
            <div class="toolbar">
                <button class="i-button icon-settings"
                        data-href="{{ url_for('.manage_templates', event) }}"
                        data-title="{% trans %}Manage paper templates{% endtrans %}"
                        data-close-button
                        data-ajax-dialog>
                    {%- trans %}Manage{% endtrans -%}
                </button>
            </div>
        </div>
        <div class="section">
            <div class="icon icon-settings"></div>
            <div class="text">
                <div class="label">{% trans %}Reviewing settings{% endtrans %}</div>
                {%- trans %}Configure reviewing questions, email notifications, etc.{% endtrans -%}
            </div>
            <div class="toolbar">
                <button class="i-button icon-settings"
                        data-href="{{ url_for('.manage_reviewing_settings', event) }}"
                        data-title="{% trans %}Manage reviewing settings{% endtrans %}"
                        data-ajax-dialog>
                    {%- trans %}Settings{% endtrans -%}
                </button>
            </div>
        </div>
        <div class="section">
            <div class="icon icon-users"></div>
            <div class="text">
                <div class="label">{% trans %}Reviewing teams{% endtrans %}</div>
                {%- trans %}Configure teams and competences{% endtrans -%}
            </div>
            <div class="toolbar">
                <button class="i-button icon-mail hide-if-locked"
                        data-href="{{ url_for('.contact_staff', event) }}"
                        data-title="{% trans %}Send emails to paper reviewers and judges{% endtrans %}"
                        data-ajax-dialog>
                    {%- trans %}Contact{% endtrans -%}
                </button>
                <button class="i-button icon-users"
                        data-href="{{ url_for('.manage_teams', event) }}"
                        data-title="{% trans %}Manage paper reviewing managers, reviewers and judges{% endtrans %}"
                        data-ajax-dialog>
                    {%- trans %}Teams{% endtrans -%}
                </button>
                <button class="i-button icon-settings"
                        data-href="{{ url_for('.manage_competences', event) }}"
                        data-title="{% trans %}Competences{% endtrans %}"
                        data-ajax-dialog>
                    {%- trans %}Competences{% endtrans -%}
                </button>
            </div>
        </div>
        <div class="section">
            <div class="icon icon-file"></div>
            <div class="text">
                <div class="label">{% trans %}Paper assignment{% endtrans %}</div>
                {%- trans %}Assign reviewers and judges to papers{% endtrans -%}
            </div>
            <div class="toolbar">
                <a class="i-button icon-settings" href="{{ url_for('.papers_list', event) }}">
                    {%- trans %}Assign papers{% endtrans -%}
                </a>
            </div>
        </div>
    </div>
{% endblock %}
