{% extends "pretixcontrol/base.html" %}
{% load i18n %}
{% load staticfiles %}
{% block title %}{{ request.event.name }}{% endblock %}

{% block nav %}
    <li>
        <a href="{% url 'control:event.index' organizer=request.event.organizer.slug event=request.event.slug %}"
                {% if url_name == "event.index" %}class="active"{% endif %}>
            <i class="fa fa-dashboard fa-fw"></i>
            {% trans "Event dashboard" %}
        </a>
    </li>
    {% if 'can_change_event_settings' in request.eventpermset %}
        <li>
            <a href="{% url 'control:event.settings' organizer=request.event.organizer.slug event=request.event.slug %}"
                    {% if is_event_settings or "event.settings" == url_name or "event.settings." in url_name %}class="active"{% endif %}>
                <i class="fa fa-wrench fa-fw"></i>
                {% trans "Settings" %}
            </a>
        </li>
        {% if request.event.has_subevents %}
            <li>
                <a href="{% url 'control:event.subevents' organizer=request.event.organizer.slug event=request.event.slug %}"
                        {% if "event.subevent" in url_name %}class="active"{% endif %}>
                    <i class="fa fa-calendar fa-fw"></i>
                    {% trans "Dates" context "subevent" %}
                </a>
            </li>
        {% endif %}
    {% endif %}
    {% if 'can_change_items' in request.eventpermset %}
        <li>
            <a href="{% url 'control:event.items' organizer=request.event.organizer.slug event=request.event.slug %}"
                class="has-children">
                <i class="fa fa-ticket fa-fw"></i>
                {% trans "Products" %}
            </a>
            <a href="#" class="arrow">
                <span class="fa arrow"></span>
            </a>
            <ul class="nav nav-second-level">
                <li>
                    <a href="{% url 'control:event.items' organizer=request.event.organizer.slug event=request.event.slug %}"
                            {% if "event.items" == url_name or "event.item." in url_name or url_name == "event.item" %}class="active"{% endif %}>
                        {% trans "Products" %}</a>
                </li>
                <li>
                    <a href="{% url 'control:event.items.quotas' organizer=request.event.organizer.slug event=request.event.slug %}"
                            {% if "event.items.quotas" in url_name %}class="active"{% endif %}>
                        {% trans "Quotas" %}
                    </a>
                </li>
                <li>
                    <a href="{% url 'control:event.items.categories' organizer=request.event.organizer.slug event=request.event.slug %}"
                            {% if "event.items.categories" in url_name %}class="active"{% endif %}>
                        {% trans "Categories" %}
                    </a>
                </li>
                <li>
                    <a href="{% url 'control:event.items.questions' organizer=request.event.organizer.slug event=request.event.slug %}"
                            {% if "event.items.questions" in url_name %}class="active"{% endif %}>
                        {% trans "Questions" %}
                    </a>
                </li>
            </ul>
        </li>
    {% endif %}
    {% if 'can_view_orders' in request.eventpermset %}
        <li>
            <a href="{% url 'control:event.orders' organizer=request.event.organizer.slug event=request.event.slug %}"
                class="has-children">
                <i class="fa fa-shopping-cart fa-fw"></i>
                {% trans "Orders" %}
            </a>
            <a href="#" class="arrow">
                <span class="fa arrow"></span>
            </a>
            <ul class="nav nav-second-level">
                <li>
                    <a href="{% url 'control:event.orders' organizer=request.event.organizer.slug event=request.event.slug %}"
                            {% if url_name == "event.orders" or "event.order." in url_name or url_name == "event.order" %}class="active"{% endif %}>
                        {% trans "All orders" %}
                    </a>
                </li>
                <li>
                    <a href="{% url 'control:event.orders.overview' organizer=request.event.organizer.slug event=request.event.slug %}"
                            {% if url_name == "event.orders.overview" %}class="active"{% endif %}>
                        {% trans "Overview" %}
                    </a>
                </li>
                <li>
                    <a href="{% url 'control:event.orders.export' organizer=request.event.organizer.slug event=request.event.slug %}"
                            {% if url_name == "event.orders.export" %}class="active"{% endif %}>
                        {% trans "Export" %}
                    </a>
                </li>
                <li>
                    <a href="{% url 'control:event.orders.waitinglist' organizer=request.event.organizer.slug event=request.event.slug %}"
                       {% if url_name == "event.orders.waitinglist" %}class="active"{% endif %}>
                        {% trans "Waiting list" %}
                    </a>
                </li>
            </ul>
        </li>
    {% endif %}
    {% if 'can_view_vouchers' in request.eventpermset %}
        <li>
            <a href="{% url 'control:event.vouchers' organizer=request.event.organizer.slug event=request.event.slug %}"
                    {% if url_name == "event.voucher" %}class="active"{% endif %}>
                <i class="fa fa-tags fa-fw"></i>
                {% trans "Vouchers" %}
            </a>
        </li>
    {% endif %}
    {% if 'can_view_orders' in request.eventpermset %}
        <li>
            <a href="{% url 'control:event.orders.checkinlists' organizer=request.event.organizer.slug event=request.event.slug %}"
                    {% if "event.orders.checkin" in url_name %}class="active"{% endif %}>
                <i class="fa fa-check-square-o fa-fw"></i>
                {% trans "Check-in lists" %}
            </a>
        </li>
    {% endif %}
    {% for nav in nav_event %}
        <li>
            <a href="{{ nav.url }}" {% if nav.active %}class="active"{% endif %}
            {% if nav.children %}class="has-children"{% endif %}>
                {% if nav.icon and "." in nav.icon %}
                    <img src="{% static nav.icon %}" class="fa-img">
                {% elif nav.icon %}
                    <i class="fa fa-{{ nav.icon }} fa-fw"></i>
                {% endif %}
                {{ nav.label }}
            </a>
            {% if nav.children %}
                <a href="#" class="arrow">
                    <span class="fa arrow"></span>
                </a>
                <ul class="nav nav-second-level">
                {% for item in nav.children %}
                    <li>
                        <a href="{{ item.url }}"
                        {% if item.active %}class="active"{% endif %}>
                            {{ item.label }}
                        </a>
                    </li>
                {% endfor %}
                </ul>
            {% endif %}
        </li>
    {% endfor %}
{% endblock %}
