{% load static %}
{% load custom_tag %}
{% load custom_tag_obj %}

{% url 'EspaceEtudiant:liste_etudiant_ue' as liste_etudiant_ue %}
{% url 'EspaceEtudiant:etudiant_change_password' as etudiant_change_password %}
{% url 'EspaceEtudiant:etudiant_profile' as etudiant_profile %}
{% url 'EspaceEtudiant:etudiant_edt' as etudiant_edt %}
{% url 'EspaceEtudiant:reclamation_home' as reclamation_home %}
{% url 'EspaceEtudiant:reclamation_list' as reclamation_list %}
{% url 'EspaceEtudiant:seance_etudiant' as seance_etudiant %}
{% url 'EspaceEtudiant:add_photo' as add_photo %}
{% url 'EspaceEtudiant:demande_actes_liste' as demande_actes_liste %}
{% url 'EspaceEtudiant:et_inscription_home' as et_inscription_home %}
{% url 'EspaceEtudiant:sondage_list' as sondage_list %}

<aside class="main-sidebar sidebar-dark-primary elevation-4">
    <!-- Brand Logo -->
    <a href="#" class="brand-link">
        <img src="{% static 'ac-img/IV.jpeg' %}" alt="AdminLTE Logo"
            class="brand-image img-circle elevation-3" style="opacity: .8">
        <span class="brand-text font-weight-light">IVESTP </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 request.user.avatar %}
               <img src="/media/{{ user.avatar }}" 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 href="#" class="d-block">{{user.nom}}</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 'EspaceEtudiant:liste_etudiant_ue' %}" class="nav-link {% if request.path == liste_etudiant_ue %} active {% endif %}">
                    <i class="nav-icon fas fa-home"></i>
                    <p>Tableau de Bord</p>
                </a>
            </li>

            {% if not request.user.email|check_inscription %}
            <li class="nav-item">
                <a href="{% url 'EspaceEtudiant:et_inscription_home' %}" class="nav-link {% if request.path == et_inscription_home %} active {% endif %}">
                    <i class="nav-icon fas fa-user-plus"></i>
                    <p>Inscription</p>
                </a>
            </li>
            {% endif %}


            <li class="nav-item">
                <a href="{% url 'EspaceEtudiant:etudiant_edt' %}" class="nav-link {% if request.path == etudiant_edt %} active {% endif %}">
                    <i class="nav-icon fas fa-calendar"></i>
                    <p>Emploi du Temps</p>
                </a>
            </li>
            {% if etudiant.role.libelle == 'délégué' %}
                <li class="nav-item">
                    <a href="{% url 'EspaceEtudiant:seance_etudiant' %}" class="nav-link {% if request.path == seance_etudiant %} active {% endif %}">
                        <i class="nav-icon fa fa-thumbs-up"></i>
                        <p>Marquer un cours</p>
                    </a>
                </li>
            {% endif %}
          <!--  <li class="nav-item">
                    <a href="{% url 'EspaceEtudiant:demande_actes_liste' %}" class="nav-link {% if request.path == demande_actes_liste %} active {% endif %}">
                        <i class="nav-icon fa fa-file"></i>
                        <p>Demande d'actes</p>
                    </a>
                </li> -->
            <li class="nav-item has-treeview {% if request.path == etudiant_profile or request.path == etudiant_change_password or request.path == add_photo %} menu-open {% endif %}">
                <a href="#" class="nav-link">
                    <i class="nav-icon fas fa-users"></i>
                    <p>Mon Compte</p>
                </a>
                <ul class="nav nav-treeview">
                  <li class="nav-item">
                    <a href="{% url 'EspaceEtudiant:add_photo' %}" class="nav-link {% if request.path == add_photo %} active {% endif %}">
                      <i class="fa fa-circle-o nav-icon"></i>
                      <p>Ma Photo</p>
                    </a>
                  </li>
                    <li class="nav-item">
                    <a href="{% url 'EspaceEtudiant:etudiant_profile' %}" class="nav-link {% if request.path == etudiant_profile %} active {% endif %}">
                      <i class="fa fa-circle-o nav-icon"></i>
                      <p>Mes Informations</p>
                    </a>
                  </li>
                  <li class="nav-item">
                    <a href="{% url 'EspaceEtudiant:etudiant_change_password' %}" class="nav-link {% if request.path == etudiant_change_password %} active {% endif %}">
                      <i class="fa fa-circle-o nav-icon"></i>
                      <p>Changer le Mot de passe</p>
                    </a>
                  </li>
                </ul>
            </li>
            <!--
            <li class="nav-item has-treeview {% if request.path == reclamation_home or request.path == reclamation_list %} menu-open {% endif %}">
                <a href="#" class="nav-link">
                    <i class="nav-icon fa fa-binoculars"></i>
                    <p>Réclamations</p>
                </a>
                <ul class="nav nav-treeview">
                  <li class="nav-item">
                    <a href="{% url 'EspaceEtudiant:reclamation_home' %}" class="nav-link {% if request.path == reclamation_home %} active {% endif %}">
                      <i class="fa  nav-icon"></i>
                      <p>Nouvelle Réclamation</p>
                    </a>
                  </li>
                  <li class="nav-item">
                    <a href="{% url 'EspaceEtudiant:reclamation_list' %}" class="nav-link {% if request.path == reclamation_list %} active {% endif %}">
                      <i class="fa fa-circle-o nav-icon"></i>
                      <p>Mes Réclamations</p>
                    </a>
                  </li>
                </ul>
            </li>
            -->
            <li class="nav-item">
                <a href="{% url 'EspaceEtudiant:sondage_list' %}" class="nav-link {% if request.path == sondage_list %} active {% endif %}">
                    <i class="nav-icon fa fa-file"></i>
                    <p>Sondage</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>