@php
  if(!isset($menu) || ($menu=="")) $menu="";
  if(!isset($submenu) || ($submenu=="")) $submenu="";
@endphp

<ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false"> 
    <li class="nav-header">
         <a href="{!! url('home') !!}"> <i class="menu-icon fa fa-dashboard"></i>&nbsp;TABLEAU DE BORD</a>
    </li>
    <div class="dropdown-divider"></div>


    <li class="nav-item {!! ($menu=='structures')?'menu-open':''!!}">
        <a href="#" class="nav-link {!! ($menu=='structures')?'active':''!!}">
          <i class="nav-icon fa fa-sitemap text-info"></i>
          <p>Structures<i class="right fa fa-angle-left"></i></p>
        </a>
        <ul class="nav nav-treeview">

            <li class="nav-item {!! ($submenu=='secteurs')?'menu-is-opening menu-open':'' !!}">
                <a href="{!! url('secteurs') !!}" class="nav-link {!! ($submenu=='secteurs')?'active':'' !!}">
                    <i class="fa fa-circle-half-stroke"></i>
                    <p>Secteurs</p>
                </a>
            </li> 

            <li class="nav-item {!! ($submenu=='soussecteurs')?'menu-is-opening menu-open':'' !!}">
                <a href="{!! url('soussecteurs') !!}" class="nav-link {!! ($submenu=='soussecteurs')?'active':'' !!}">
                    <i class="fa fa-chart-pie"></i>
                    <p>Sous-secteurs</p>
                </a>
            </li> 
         
             <li class="nav-item {!! ($submenu=='niveaux')?'menu-is-opening menu-open':'' !!}">
                <a href="{!! url('niveaux') !!}" class="nav-link {!! ($submenu=='niveaux')?'active':'' !!}">
                    <i class="fa fa-layer-group"></i>
                    <p>Niveaux</p>
                </a>
            </li>

             <li class="nav-item {!! ($submenu=='diplomes')?'menu-is-opening menu-open':'' !!}">
                <a href="{!! url('diplomes') !!}" class="nav-link {!! ($submenu=='diplomes')?'active':'' !!}">
                    <i class="fa fa-user-graduate"></i>
                    <p>Diplômes</p>
                </a>
            </li>
        </ul>
    </li> 
    <div class="dropdown-divider"></div>
    <li class="nav-item {!! ($menu=='stages')?'menu-open':''!!}">
        <a href="#" class="nav-link {!! ($menu=='stages')?'active':''!!}">
          <i class="nav-icon fa fa-school"></i>
          <p>Etablissements<i class="right fa fa-angle-left"></i></p>
        </a>
        <ul class="nav nav-treeview">
            <!--
            <li class="nav-item {!! ($submenu=='sessions')?'menu-is-opening menu-open':'' !!}">
                <a href="{!! url('sessions_calendar') !!}" class="nav-link {!! ($submenu=='sessions')?'active':'' !!}">
                    <i class="far fa-circle"></i>
                    <p>Supérieur</p>
                </a>
            </li> 
            -->

            <li class="nav-item {!! ($submenu=='stagiaires')?'menu-is-opening menu-open':'' !!}">
                <a href="{!! url('/etablissements/lycees') !!}" class="nav-link {!! ($submenu=='stagiaires')?'active':'' !!}">
                    <i class="far fa-circle"></i>
                    <p>Lycées </p>
                </a>
            </li> 

            <li class="nav-item {!! ($submenu=='entreprises')?'menu-is-opening menu-open':'' !!}">
                <a href="{!! url('/etablissements/colleges') !!}" class="nav-link {!! ($submenu=='entreprises')?'active':'' !!}">
                    <i class="far fa-circle"></i>
                    <p>Collèges</p>
                </a>
            </li> 
            <!--
             <li class="nav-item {!! ($submenu=='offres')?'menu-is-opening menu-open':'' !!}">
                <a href="{!! url('offres') !!}" class="nav-link {!! ($submenu=='offres')?'active':'' !!}">
                    <i class="far fa-circle"></i>
                    <p>Ecoles</p>
                </a>
            </li>
            -->
        </ul>
    </li> 



    @if($user->hasRole("ADMINISTRATEUR") || $user->hasRole("ADMINISTRATEUR FONCTIONNEL") )
        <li class="nav-item {!! ($menu=='acces')?'menu-open':''!!}">
            <div class="dropdown-divider"></div>
            <a href="#" class="nav-link {!! ($menu=='acces')?'active':''!!}">
              <i class="nav-icon fa fa-user-lock text-danger"></i>
              <p>Accès<i class="right fa fa-angle-left"></i></p>
            </a>
            <ul class="nav nav-treeview">
                <li class="nav-item">
                    <a href="{!! url('users') !!}" class="nav-link {!! ($submenu=='utilisateurs')?'active':''!!}">
                        <i class="nav-icon fa fa-users text-danger"></i>
                        <p>Utilisateurs</p>
                    </a>
                </li>  
            </ul>
            <ul class="nav nav-treeview">
                <li class="nav-item">
                    <a href="{!! url('roles') !!}" class="nav-link {!! ($submenu=='roles')?'active':''!!}">
                        <i class="nav-icon fa fa-hat-cowboy text-danger"></i>
                        <p>Rôles</p>
                    </a>
                </li>  
            </ul>

            @if($user->hasRole("ADMINISTRATEUR"))
            <ul class="nav nav-treeview">
                <li class="nav-item">
                    <a href="{!! url('permissions') !!}" class="nav-link {!! ($submenu=='permissions')?'active':''!!}">
                        <i class="nav-icon fa fa-list-check text-danger"></i>
                        <p>Permissions</p>
                    </a>
                </li>  
            </ul>
            @endif
        </li>
    @endif

</ul>