{% extends "base.html" %}

{% load tags %}
{% load i18n %}
{% load staticfiles %}

{% block submenu %}
    {% url user_overview as url_users %}
    {% url user_new as url_usernew %}
    {% url user_group_overview as url_usergroups %}
    {% url user_import as url_userimport %}
    <h4 class="sectiontitle">{% trans "Participants" %}</h4>
    <ul>
        {% if perms.participant.can_see_participant %}
        <li class="{% if request.path == url_users %}selected{% endif %}"><a href="{% url user_overview %}">{% trans "All participants" %}</a></li>
        {% endif %}
        {% if perms.participant.can_manage_participant %}
        <li class="{% active request url_usernew %}"><a href="{%  url user_new %}">{% trans "New participant" %}</a></li>
        <li class="{% if request.path == url_usergroups %}selected{% endif %}"><a href="{%  url user_group_overview %}">{% trans "All groups" %}</a></li>
        <li class="{% active request '/participant/group/new' %}"><a href="{%  url user_group_new %}">{% trans "New group" %}</a></li>
        <li class="{% if request.path == url_userimport %}selected{% endif %}"><a href="{% url user_import %}"> {% trans 'Import participants' %}</a></li>
        {% endif %}
        {% if perms.participant.can_see_participant %}
        <li><a href="{% url user_print %}"><img src="{% static 'images/icons/pdf.png' %}"> {% trans 'List of participants as PDF' %}</a></li>
        {% endif %}
        {% if perms.participant.can_manage_participant %}
        <li><a href="{% url print_passwords %}"><img src="{% static 'images/icons/pdf.png' %}"> {% trans 'First time passwords as PDF' %}</a></li>
        {% endif %}
    </ul>

    {# second submenu #}
    {% if shown_user %}
        <br>
        <h3>{{ shown_user.clean_name }}</h3>
        <ul>
            {# view shown_user #}
            <li class="{% if request.path == 'foo' %}selected{% endif %}">
                <a href="{% model_url shown_user 'view' %}">{% trans 'View participant' %}</a>
            </li>

            {% if perms.participant.can_manage_participant %}

                {# edit shown_user #}
                <li class="{% if request.path ==  'foo' %}selected{% endif %}">
                    <a href="{% model_url shown_user 'edit' %}"><img src="{% static 'images/icons/edit.png' %}"> {% trans 'Edit participant' %}</a>
                </li>

                {# delete shown_user #}
                <li>
                    <a href="{% model_url shown_user 'delete'  %}"><img src="{% static 'images/icons/delete.png' %}"> {% trans 'Delete participant' %}</a>
                </li>
            {% endif %}
        </ul>
    {% elif group %}
        <br>
        <h3>{{ group.name }}</h3>
        <ul>
            {# view group #}
            <li class="{% if request.path == 'foo' %}selected{% endif %}">
                <a href="{% model_url group 'view' %}">{% trans 'View group' %}</a>
            </li>

            {# edit group #}
            <li class="{% if request.path ==  'foo' %}selected{% endif %}">
                <a href="{% model_url group 'edit' %}"><img src="{% static 'images/icons/edit.png' %}"> {% trans 'Edit group' %}</a>
            </li>

            {# delete group #}
            {% if group.name != 'Anonymous' %}
                <li>
                    <a href="{% model_url group 'delete'  %}"><img src="{% static 'images/icons/delete.png' %}"> {% trans 'Delete group' %}</a>
                </li>
            {% endif %}
        </ul>
    {% endif %}

{% endblock %}
