{% extends "pretixcontrol/base.html" %}
{% load i18n %}
{% 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 "Dashboard" %}
        </a>
    </li>
    {% if request.eventperm.can_change_settings or request.eventperm.can_change_permissions %}
        <li>
            <a href="{% url 'control:event.settings' organizer=request.event.organizer.slug event=request.event.slug %}">
                <i class="fa fa-wrench fa-fw"></i>
                {% trans "Settings" %}
            </a>
        </li>
    {% endif %}
    {% if request.eventperm.can_change_items %}
        <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 request.eventperm.can_view_orders %}
        <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 %}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 request.eventperm.can_view_vouchers %}
        <li>
            <a href="{% url 'control:event.vouchers' organizer=request.event.organizer.slug event=request.event.slug %}"
                    {% if url_name == "event.vouchers" %}class="active"{% endif %}>
                <i class="fa fa-tags fa-fw"></i>
                {% trans "Vouchers" %}
            </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 %}
                    <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 %}
