{% extends "orga/schedule/base.html" %}
{% load bootstrap4 %}
{% load compress %}
{% load i18n %}
{% load static %}

{% block scripts %}
    {% compress js %}
        <script defer src="{% static "vendored/moment-with-locales.js" %}"></script>
        <script defer src="{% static "vendored/moment-timezone-with-data-2012-2022.js" %}"></script>
        {% if debug %}
            <script defer src="{% static "vendored/vue.js" %}"></script>
        {% else %}
            <script defer src="{% static "vendored/vue.min.js" %}"></script>
        {% endif %}
        <script defer src="{% static "vendored/vue-async-computed.js" %}"></script>
        <script defer src="{% static "orga/js/schedule.js" %}"></script>
    {% endcompress %}
{% endblock %}

{% block navbar_right %}
    <li class="nav-item">
        <a class="nav-link text-danger">
            <i class="fa fa-clock-o"></i>
            {% blocktranslate with tz=request.event.timezone %}All times in {{ tz }}{% endblocktranslate %}
        </a>
    </li>
{% endblock %}

{% block schedule_content %}

    {% if schedule_version %}
        <div class="alert alert-warning schedule-alert">
            {% translate "You're currently viewing a released schedule version. Released versions cannot be edited directly." %}
        </div>
    {% endif %}
    <div class="schedule-header">
        <div id="schedule-choice">
            <form id="schedule-version">
                {% bootstrap_form schedule_version_form layout="inline" %}
            </form>
            <form id="schedule-rooms">
                {% bootstrap_form schedule_room_form layout="inline" %}
            </form>
        </div>

        <div id="schedule-action-wrapper">
            {% if not schedule_version %}
                <a id="schedule-release" href="{{ request.event.orga_urls.release_schedule }}" class="btn 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">{% translate "Override WIP schedule with this version" %}</button>
                </form>
            {% endif %}
            <details class="dropdown">
                <summary class="btn btn-info" id="schedule-actions">
                    {% translate "Actions" %} <i class="fa fa-caret-down"></i>
                </summary>

                <ul class="dropdown-content dropdown-front dropdown-content-s{% if rtl %}e{% else %}w{% endif %}">
                    <li><a class="dropdown-item" href="{{ active_schedule.urls.public }}" target="_blank" rel="noopener">
                        <i class="fa fa-link"></i> {% translate "View in frontend" %}
                    </a></li>
                    {% if request.event.feature_flags.show_schedule %}
                        <li><a class="dropdown-item" href="{{ request.event.orga_urls.toggle_schedule }}">
                            <i class="fa fa-eye"></i> {% translate "Hide schedule" %}
                        </a></li>
                    {% else %}
                        <li><a class="dropdown-item" href="{{ request.event.orga_urls.toggle_schedule }}">
                            <i class="fa fa-eye"></i> {% translate "Make schedule public" %}
                        </a></li>
                    {% endif %}
                    <li><a href="{{ request.event.orga_urls.submission_cards }}" class="dropdown-item">
                        <i class="fa fa-print"></i> {% translate "Print cards" %}
                    </a></li>
                    <li><a href="resend_mails" class="dropdown-item">
                        <i class="fa fa-envelope"></i> {% translate "Resend speaker notifications" %}
                    </a></li>
                </ul>
            </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="fahrplan">
        </div>

    {% endif %}
{% endblock %}
