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

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

{% load event_tags %}
{% load i18n %}
{% load phrases %}
{% load vite %}

{% block scripts %}
    {% vite_hmr %}
    {% vite_asset "src/main.js" %}
{% endblock scripts %}

{% block extra_title %}{{ phrases.schedule.schedule }} :: {% endblock extra_title %}

{% block navbar_right %}
    <li class="nav-item">
        <a class="nav-link text-danger">
            <i class="fa fa-clock-o"></i>
            {% phrase "phrases.schedule.timezone_hint" tz=request.event.timezone %}
        </a>
    </li>
{% endblock navbar_right %}

{% block schedule_content %}

    <div class="schedule-header">
        <div id="schedule-action-wrapper" class="align-items-center ml-auto d-print-none d-none">
            {% if not schedule_version %}
                <a id="schedule-release" href="{{ request.event.orga_urls.release_schedule }}" class="btn ml-2 btn-success"><i class="fa fa-plus"></i> {% translate "New release" %}</a>
            {% else %}
                <form method="post" action="{{ request.event.orga_urls.reset_schedule }}?{{ request.GET.urlencode }}">
                    {% csrf_token %}
                    <button type="submit" class="btn btn-outline-danger ml-2">{% translate "Override WIP schedule with this version" %}</button>
                </form>
            {% endif %}
            <details class="dropdown ml-2" aria-haspopup="menu" role="menu">
                <summary class="btn btn-info" id="schedule-actions">
                    {% translate "Actions" %} <i class="fa fa-caret-down"></i>
                </summary>

                <div class="dropdown-content dropdown-front dropdown-content-s{% if rtl %}e{% else %}w{% endif %}">
                    <a class="dropdown-item" href="{{ active_schedule.urls.public }}" target="_blank" rel="noopener" role="menuitem" tabindex="-1">
                        <i class="fa fa-link"></i> {% translate "View in frontend" %}
                    </a>
                    {% if request.event|get_feature_flag:"show_schedule" %}
                        <a class="dropdown-item role="menuitem" tabindex="-1""
                           href="{{ request.event.orga_urls.toggle_schedule }}">
                            <i class="fa fa-eye"></i> {% translate "Hide schedule" %}
                        </a>
                    {% else %}
                        <a class="dropdown-item" href="{{ request.event.orga_urls.toggle_schedule }}" role="menuitem" tabindex="-1">
                            <i class="fa fa-eye"></i> {% translate "Make schedule public" %}
                        </a>
                    {% endif %}
                    <a href="{{ request.event.orga_urls.submission_cards }}" class="dropdown-item" role="menuitem" tabindex="-1">
                        <i class="fa fa-print"></i> {% translate "Print cards" %}
                    </a>
                    <a href="resend_mails" class="dropdown-item" role="menuitem" tabindex="-1">
                        <i class="fa fa-envelope"></i> {% translate "Resend speaker notifications" %}
                    </a>
                </div>
            </details>
        </div>
    </div>
    {% if not request.event.rooms.count %}
        <div class="alert alert-warning schedule-alert">
            <span>
                {% translate "You can start planning your schedule once you have configured some rooms for sessions to take place in." %}
                <a href="{{ request.event.orga_urls.new_room }}">{% translate "Configure rooms" %}</a>
            </span>
        </div>
    {% else %}

        <div id="app" data-gettext="{{ gettext_language }}"></div>

    {% endif %}
{% endblock schedule_content %}
