{% load event_extra %}
{% load messages_extra %}
{% load duplicated_extra %}
{% load utils_extra %}
<aside id="sidebar">
    <article>
        <header>
        <h2>Administration</h2>
        </header>
        <nav>
            <ul>
                <li><a {% if current == "administration" %}class="selected" {% endif %}href="{% url 'administration' %}">Administration</a></li>
            </ul>
        </nav>
        <h3>Événements</h3>
        <nav>
            <ul>
                {% if perms.agenda_culturel.change_event %}
                <li><a {% if current == "recent" %}class="selected" {% endif %}href="{% url 'recent' %}">Derniers événements</a>{% show_badges_events "left" %}</li>
                {% endif %}
                {% if perms.agenda_culturel.change_duplicatedevents %}
                <li><a {% if current == "duplicates" %}class="selected" {% endif %}href="{% url 'duplicates' %}">Gestion des doublons</a>{% show_badge_duplicated "left" %}</li>
                {% endif %}
                <li><a {% if current == "activite" %}class="selected" {% endif %}href="{% url 'activite' %}">Résumé des activités</a></li>
            </ul>
        </nav>
        {% if perms.agenda_culturel.change_place or perms.agenda_culturel.change_organisation %}
        <h3>Lieux et organisateurs</h3>
        <nav>
            <ul>
                {% if perms.agenda_culturel.change_place %}
                <li><a {% if current == "places" %}class="selected" {% endif %}href="{% url 'view_places_admin' %}">Liste des lieux</a></li>
                {% endif %}
                {% if perms.agenda_culturel.change_organisation %}
                <li><a {% if current == "organisations" %}class="selected" {% endif %}href="{% url 'view_organisations' %}">Liste des organisateurs</a></li>
                {% endif %}
                {% if perms.agenda_culturel.change_place and perms.agenda_culturel.change_event %}
                <li><a {% if current == "unknown_places" %}class="selected" {% endif %}href="{% url 'view_unknown_places' %}">Événements sans lieu</a>{% show_badge_unknown_places "left" %}</li>
                {% endif %}
            </ul>
        </nav>
        {% endif %}
        {% if perms.agenda_culturel.view_batchimportation or perms.agenda_culturel.view_recurrentimport or perms.agenda_culturel.view_categorisationrule%}
        <h3>Traitements automatiques</h3>
        <nav>
            <ul>            
                {% if perms.agenda_culturel.view_batchimportation %}
                <li><a {% if current == "imports" %}class="selected" {% endif %}href="{% url 'imports' %}">Historiques des importations</a></li>
                {% endif %}
                {% if perms.agenda_culturel.view_recurrentimport %}
                <li><a {% if current == "rimports" %}class="selected" {% endif %}href="{% url 'recurrent_imports' %}">Importations récurrentes</a></li>
                {% endif %}
                {% if perms.agenda_culturel.view_categorisationrule %}
                <li><a {% if current == "catrules" %}class="selected" {% endif %}href="{% url 'categorisation_rules' %}">Catégorisation automatique</a></li>
                {% endif %}
            </ul>
        </nav>
        {% endif %}
        {% if perms.agenda_culturel.view_message %}
        <h3>Messages</h3>
        <nav>
            <ul>
                <li><a {% if current == "contact_messages" %}class="selected" {% endif %}href="{% url 'messages' %}?message_type=contact_form">Messages de contact</a>{% show_badge_messages "left" %}</li>
                <li><a {% if current == "messages" %}class="selected" {% endif %}href="{% url 'messages' %}">Tous les messages</a></li>
            </ul>
        </nav>
        {% endif %}
        {% if user.is_staff %}
        <h3>Configuration interne</h3>
        <nav>
            <ul>
                <li><a href="{% url 'clear_cache' %}">Vider le cache</a></li>
                <li><a href="{% url 'admin:index' %}">Administration de django</a></li>
                <li><a href="{% url 'admin:auth_user_changelist' %}">Liste des utilisateurices</a></li>
                <li><a href="{% url 'admin:auth_user_add' %}">Ajouter un·e utilisateurice</a></li>
            </ul>
        </nav>
        {% endif %}
    </article>
    <article>
            <p>Vous êtes connecté(e) en tant que {{ user }}.</p>
        <a role="button" href="{% url 'logout' %}?next={% url 'home' %}">Déconnexion</a>
    </article>
</aside>
