{% load static %}

{% url 'BasicData:enseignant_list' as enseignant_list  %}
{% url 'BasicData:enseignant_add' as enseignant_add  %}
{% url 'BasicData:enseignant_edit' as enseignant_edit  %}
{% url 'BasicData:periode_list' as periode_list  %}

{% url 'BasicData:etudiant_list' as etudiant_list %}
{% url 'BasicData:etudiant_add' as etudiant_add %}
{% url 'BasicData:etudiant_edit' as etudiant_edit %}
{% url 'BasicData:ag_scolartie_list' as ag_scolartie_list %}


{% url 'BasicData:usp_admin' as usp_admin %}
{% url 'BasicData:personnel_list' as personnel_list %}

<aside class="main-sidebar sidebar-dark-primary elevation-4">
    <!-- Brand Logo -->
    <a href="#" class="brand-link">
        <img src="{% static 'ac-img/usp-logo.png' %}" alt="AdminLTE Logo"
            class="brand-image img-circle elevation-3" style="opacity: .8">
        <span class="brand-text font-weight-light">USP Pédagogie</span>
    </a>

    <!-- Sidebar -->
    <div class="sidebar">
        <!-- Sidebar user panel (optional) -->
        <div class="user-panel mt-3 pb-3 mb-3 d-flex">
            <div class="image">
                {% if enseignant.avatar %}
               <img src="{{ enseignant.avatar.url }}" class="img-circle elevation-2" alt="User Image">
                {% else %}
                <img src="{% static 'ac-img/user-default2.png' %}" class="img-circle elevation-2" alt="User Image">
                {% endif %}
            </div>
            <div class="info">
                <a class="d-block">{{user}}</a>
            </div>
        </div>

        <!-- Sidebar Menu -->
        <nav class="mt-2">
            <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">

            <li class="nav-item">
                <a href="{% url 'BasicData:usp_admin' %}" class="nav-link {% if request.path == usp_admin %} active {% endif %}">
                    <i class="nav-icon fas fa-home"></i>
                    <p>Tableau de Bord</p>
                </a>
            </li>
            <li class="nav-item has-treeview {% if request.path == enseignant_list or 'personnel_list' in request.path  or 'enseignant_ufr_list' in request.path or 'agent_ag_scolartie_add' in request.path or 'agent_scolartie_list' in request.path or request.path == enseignant_add or request.path in enseignant_edit or request.path == etudiant_list or request.path == etudiant_add or request.path in etudiant_edit %} menu-open {% endif %}">
                <a href="#" class="nav-link">
                    <i class="nav-icon fas fa-users"></i>
                    <p>Gestion des Comptes</p>
                </a>
                <ul class="nav nav-treeview">
                  <li class="nav-item">
                    <a href="{% url 'BasicData:enseignant_list' %}" class="nav-link {% if request.path == enseignant_list or 'enseignant_ufr_list' in request.path or request.path == enseignant_add or 'enseignant_edit' in request.path %} active {% endif %}">
                      <i class="fa fa-circle-o nav-icon"></i>
                      <p>Enseignant</p>
                    </a>
                  </li>
                  <li class="nav-item">
                    <a href="{% url 'BasicData:etudiant_list' %}" class="nav-link {% if request.path == etudiant_list or request.path == etudiant_add or request.path in etudiant_edit %} active {% endif %}">
                      <i class="fa fa-circle-o nav-icon"></i>
                      <p>Etudiant</p>
                    </a>
                  </li>
                <li class="nav-item">
                    <a href="{% url 'BasicData:ag_scolartie_list' %}" class="nav-link {% if request.path == ag_scolartie_list or 'agent_ag_scolartie_add' in request.path %} active {% endif %}">
                      <i class="fa fa-circle-o nav-icon"></i>
                      <p>Agent Scolarité</p>
                    </a>
                  </li>
                <li class="nav-item">
                    <a href="{% url 'BasicData:personnel_list' %}" class="nav-link {% if request.path == personnel_list or 'agent_ag_scolartie_add' in request.path %} active {% endif %}">
                      <i class="fa fa-circle-o nav-icon"></i>
                      <p>Personnel</p>
                    </a>
                  </li>
                </ul>

            </li>
            <li class="nav-item">
                <a href="{% url 'EspaceEnseignant:periode_list' %}" class="nav-link {% if request.path == periode_list %} active {% endif %}">
                    <i class="nav-icon fas fa-calendar"></i>
                    <p>Périodes</p>
                </a>
            </li>
            <li class="nav-item">
                <a href="{% url 'BasicData:logout' %}" class="nav-link">
                <i class="nav-icon fas fa-power-off"></i>
                <p>Quitter</p>
                </a>
            </li>

</ul>
</nav>
<!-- /.sidebar-menu -->
</div>
<!-- /.sidebar -->
</aside>