<!--
SPDX-FileCopyrightText: 2017-present Tobias Kunze
SPDX-License-Identifier: AGPL-3.0-only WITH LicenseRef-Pretalx-AGPL-3.0-Terms
-->

{% extends "orga/base.html" %}

{% load event_tags %}
{% load i18n %}
{% load render_table from django_tables2 %}
{% load rules %}
{% load static %}

{% block stylesheets %}
    {% if timeline_data %}
        <link rel="alternate" hreflang="en" type="application/rss+xml" title="{% translate "Proposal feed" %}" href="{{ request.event.orga_urls.submission_feed }}">
    {% endif %}
    <link rel="stylesheet" href="{% static "orga/css/ui/featured.css" %}" />
    <link rel="stylesheet" href="{% static "orga/css/ui/submission.css" %}" />
{% endblock stylesheets %}

{% block scripts %}
    <script defer src="{% static "orga/js/ui/featured.js" %}"></script>
    <script defer src="{% static "orga/js/ui/dropdown-table-fix.js" %}"></script>
{% endblock %}

{% block extra_title %}{{ page_obj.paginator.count }} {% blocktranslate trimmed count count=page_obj.paginator.count %}session{% plural %}sessions{% endblocktranslate %} :: {% endblock extra_title %}

{% block content %}
    {% has_perm "submission.create_submission" request.user request.event as can_create_submission %}
    {% has_perm "submission.state_change_submission" request.user request.event as can_change_submission %}
    {% has_perm "person.orga_list_speakerprofile" request.user request.event as can_view_speakers %}
    {% has_perm "mail.send_queuedmail" request.user request.event as can_send_mails %}
    <h2 class="d-flex align-items-center">
        <span>
            {{ page_obj.paginator.count }}
            {% blocktranslate trimmed count count=page_obj.paginator.count %}
                session
            {% plural %}
                sessions
            {% endblocktranslate %}
        </span>
        <p class="flip ml-auto">
            {% if can_send_mails %}
                <a class="btn btn-outline-info mt-2" href="{{ request.event.orga_urls.compose_mails_sessions }}{% querystring page="" %}">
                    <i class="fa fa-envelope"></i>
                    {% translate "Send email" %}
                </a>
            {% endif %}
            {% if pending_changes and can_change_submission %}
                <a class="btn btn-info mt-2" href="{{ request.event.orga_urls.apply_pending }}{% querystring %}">
                    {% translate "Apply pending changes" %} ({{ pending_changes }})
                </a>
            {% endif %}
            {% if can_create_submission %}
                <a href="{{ request.event.orga_urls.new_submission }}" class="btn btn-info mt-2">
                    <i class="fa fa-plus"></i> {% translate "Add new session or proposal" %}
                </a>
                <a class="btn btn-link" href="{{ request.event.orga_urls.submission_feed }}" title="{% translate "Proposal feed" %}">
                    <i class="fa fa-feed"></i>
                </a>
            {% endif %}
        </p>
    </h2>

    {% include "orga/includes/submission_filter_form.html" %}

    {% render_table table %}

{% endblock %}
