{% load compress %}
{% load staticfiles %}
{% load i18n %}
{% load rules %}
<!DOCTYPE html>
<html>
<head>
    <title>{% block title %}{% endblock %} :: pretalx</title>
    {% if request.event.settings.orga_css_file %}
        <link rel="stylesheet" type="text/css" href="{{ request.event.settings.orga_css_file }}"/>
    {% else %}
        {% compress css %}
            <link rel="stylesheet" type="text/x-scss" href="{% static "orga/scss/main.scss" %}"/>
        {% endcompress %}
    {% endif %}
    <link rel="stylesheet" type="text/css" href="{% static "vendored/fullcalendar/fullcalendar.min.css" %}"/>
    <link rel="stylesheet" type="text/css" href="{% static "vendored/typeahead.css" %}"/>
    {% block stylesheets %}
    {% endblock %}
    {% if request.event and request.event.custom_css %}
        <link rel="stylesheet" type="text/css" href="{{ request.event.custom_css.url }}"/>
    {% endif %}
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="theme-color" content="#1C4A3B">

    <link rel="icon" type="image/png" sizes="32x32" href="{% static "common/img/favicon-32x32.png" %}">
    <link rel="icon" type="image/png" sizes="16x16" href="{% static "common/img/favicon-16x16.png" %}">

    {% block scripts %}
    {% endblock %}
    {% compress js %}
        <script type="text/javascript" src="{% static "vendored/jquery-3.1.1.js" %}"></script>
        <script type="text/javascript" src="{% static "vendored/tether/tether.min.js" %}"></script>
        <script type="text/javascript" src="{% static "vendored/popper.js" %}"></script>
        <script type="text/javascript" src="{% static "vendored/bootstrap/dist/js/bootstrap.js" %}"></script>
        <script type="text/javascript" src="{% static "vendored/moment-with-locales.js" %}"></script>
        <script type="text/javascript" src="{% static "vendored/moment-timezone-with-data-2012-2022.js" %}"></script>
        <script type="text/javascript" src="{% static "vendored/datetimepicker/bootstrap-datetimepicker.js" %}"></script>
        <script type="text/javascript" src="{% static "vendored/fullcalendar/fullcalendar.min.js" %}"></script>
        <script type="text/javascript" src="{% static "orga/js/main.js" %}"></script>
        <script type="text/javascript" src="{% static "common/js/availabilities.js" %}"></script>
    {% endcompress %}
</head>
<body data-datetimeformat="{{ js_datetime_format }}" data-dateformat="{{ js_date_format }}" data-datetimelocale="{{ js_locale }}">
<div id="wrapper">
    <nav class="navbar navbar-expand-lg navbar-inverse navbar-static-top bg-primary">
        <a class="navbar-brand" href="/orga/">
            <img src="{% static "common/img/icon_white.svg" %}"> pretalx
        </a>
        <button class="navbar-toggler" type="button" data-toggle="collapse"
                data-target="#navbartoggle">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbartoggle">
            <ul class="navbar-nav mr-auto">
                <li class="nav-item dropdown active">
                    {% if request.orga_events.count > 1 %}
                        <a class="nav-link dropdown-toggle" id="eventDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            {% if request.event %}{{ request.event.name }}{% else %}{% trans "Events" %}{% endif %}
                        </a>
                        <div class="dropdown-menu" aria-labelledby="eventDropdown">
                            {% for e in request.orga_events %}
                                {% if not request.event == e %}
                                    <a class="dropdown-item" href="{{ e.orga_urls.base }}">{{ e.name }}</a>
                                {% endif %}
                            {% endfor %}
                            {% if request.user.is_superuser %}
                                <a class="dropdown-item" href="{% url "orga:event.create" %}">
                                    <span class="fa fa-plus"></span>
                                    {% trans "New event" %}
                                </a>
                            {% endif %}
                        </div>
                    {% elif request.event %}
                        <a class="nav-link">
                            {{ request.event.name }}
                        </a>
                    {% endif %}
                </li>
                {% if request.event %}
                    <li class="nav-item">
                        <a class="nav-link" href="{{ request.event.urls.base }}">
                            <span class="fa fa-eye"></span>
                        </a>
                    </li>
                {% endif %}
            </ul>
            <ul class="navbar-nav">
                <li class="nav-item">
                    <a class="nav-link active" href="{% url "orga:user.view" %}">
                        <span class="fa fa-user"></span>
                        {{ request.user.nick }}
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link active" href="{% url "orga:logout" %}">
                        <span class="fa fa-sign-out"></span>
                    </a>
                </li>
            </ul>
        </div>
    </nav>
    <div id="page-wrapper">
        <nav class="nav flex-column sidebar">

        {% if request.event %}
            {% has_perm 'orga.view_orga_area' request.user request.event as can_see_orga_area %}
            {% has_perm 'orga.change_settings' request.user request.event as can_see_orga_exclusive %}
            {% if can_see_orga_area %}
                <a class="nav-link {% if url_name == "event.dashboard" %}active{% endif %}" href="{{ request.event.orga_urls.base }}">
                    <span class="fa fa-dashboard"></span> {% trans "Dashboard" %}
                </a>
            {% endif %}
            {% if can_see_orga_exclusive %}
                <a class="nav-link {% if "settings." in url_name %}active{% endif %}" href="{{ request.event.orga_urls.settings }}">
                    <span class="fa fa-wrench"></span> {% trans "Settings" %}
                </a>
                <a class="nav-link {% if "cfp." in url_name %}active{% endif %}" href="{{ request.event.cfp.urls.text }}">
                    <span class="fa fa-bullhorn"></span> {% trans "CfP" %}
                </a>
            {% endif %}
            {% if can_see_orga_area %}
                <a class="nav-link {% if "submissions." in url_name %}active{% endif %}" href="{{ request.event.orga_urls.submissions }}">
                    <span class="fa fa-sticky-note-o"></span> {% trans "Submissions" %}
                </a>
                <a class="nav-link {% if "reviews." in url_name %}active{% endif %}" href="{% url "orga:reviews.dashboard" event=request.event.slug %}">
                    <span class="fa fa-eye"></span> {% trans "Review" %}
                </a>
            {% endif %}
            {% if can_see_orga_exclusive %}
                <a class="nav-link {% if "speakers." in url_name %}active{% endif %}" href="{{ request.event.orga_urls.speakers }}">
                    <span class="fa fa-address-card-o"></span> {% trans "Speakers" %}
                </a>
                <a class="nav-link {% if "schedule." in url_name %}active{% endif %}" href="{{ request.event.orga_urls.schedule }}">
                    <span class="fa fa-calendar-o"></span> {% trans "Schedule" %}</span>
                </a>
                <a class="nav-link {% if "mails." in url_name %}active{% endif %}" href="{{ request.event.orga_urls.outbox }}">
                    <span class="fa fa-envelope"></span> {% trans "Mails" %}
                    {% if request.event.pending_mails %}<span class="pending-mails">{{ request.event.pending_mails }}{% endif %}
                </a>
            {% endif %}
        {% endif %}
        </nav>
        <div id="page-content">
            <div class="container-fluid">
                {% if messages %}
                    {% for message in messages %}
                        <div class="alert alert-{{ message.tags }}">
                            {{ message }}
                        </div>
                    {% endfor %}
                {% endif %}

                <h3 class="orga-headline text-primary">
                    {% block headline %}
                    {% endblock %}
                </h3>

                {% block content %}
                {% endblock %}
                <footer>
                    {% with "href='http://pretalx.org'" as a_attr %}
                        {% blocktrans trimmed %}
                            powered by <a {{ a_attr }}>pretalx</a>
                        {% endblocktrans %}
                    {% endwith %}
                    {% if development_warning %}
                        <span class="text-warning">&middot; {% trans "running in development mode" %}</span>
                        {% if pretalx_version %}
                            <span>&middot; <a href="https://github.com/pretalx/pretalx/tree/{{ pretalx_version }}/">{{ pretalx_version }}</a></span>
                        {% endif %}
                    {% endif %}
                </footer>
            </div>
        </div>
    </div>
</div>
</body>
</html>
