<!-- Navbar -->
<nav class="main-header navbar navbar-expand navbar-white navbar-light">
    <!-- Left navbar links -->
    <ul class="navbar-nav">
      <li class="nav-item">
        <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
      </li>
      
      
    </ul>

    <!-- Right navbar links -->
    <ul class="navbar-nav ml-auto">
      <!-- Navbar Search -->

    <!--  <li class="nav-item">
      
      <i class="fa fa-bell" style="color: red; font-size: 30px" aria-hidden="true">0</i>
       
      </li> -->

      <li class="nav-item">
        <a class="nav-link" href="<?php echo base_url('gestion_document/Demande_Document/listejson')?>" role="button">
         <i class="fas fa-file-signature"></i>
         Demandes Externes 
         <?php
         $headdocument_externe=$this->Model->getRequeteOne("SELECT COUNT(*) NBRDOSSIER FROM doc_demande LEFT JOIN config_doc_profil_etape ON config_doc_profil_etape.STATUT_DOC_ID=doc_demande.STATUT_DOC_ID WHERE  (doc_demande.PROFIL_ID_DESIGNE IS NULL OR doc_demande.PROFIL_ID_DESIGNE=".$this->session->userdata('SOCAR_PROFIL_ID').") AND config_doc_profil_etape.PROFIL_ID=".$this->session->userdata('SOCAR_PROFIL_ID'));
           $headdocument_interne=$this->Model->getRequeteOne("SELECT COUNT(*) AS NOMBRE FROM `doc_interne_document` JOIN doc_interne_etape on doc_interne_etape.ID_ETAPE_DOC_INTERNE = doc_interne_document.ID_ETAPE_DOC_INTERNE WHERE ID_PROFIL = ".$this->session->userdata('SOCAR_PROFIL_ID')." OR ID_EMPLOYE_DESINGE = ".$this->session->userdata('SOCAR_ID_USER')."");
          if ($headdocument_externe['NBRDOSSIER'] == 0) {
            $btnext = '';
          }
          else{
            $btnext = 'badge-danger';
          }

          if ($headdocument_interne['NOMBRE'] == 0) {
            $btnint = '';
          }
          else{
            $btnint = 'badge-danger';
          }
         ?>
         <span class="badge <?php echo $btnext?>"><?php echo $headdocument_externe['NBRDOSSIER']?></span>
        </a>
      </li>

      <li class="nav-item">
        <a class="nav-link" href="<?php echo base_url('document_interne/Requisition/listing')?>" role="button">
         <i class="fas fa-gifts"></i>
         Demandes Internes 

         <span class="badge <?php echo $btnint?> "><?php echo $headdocument_interne['NOMBRE']?></span>
        </a>
      </li>

      <li class="nav-item">

        <a class="nav-link" href="<?php echo base_url('conge/Demande_Conge/listing')?>" role="button">
         <i class="nav-icon fas fa-holly-berry"></i> Congés
         <?php
         
         $membres=$this->Model->getRequeteOne("SELECT ID_SECTION, ID_SERVICE, ID_DIRECTION, ID_RESPONSABILITE FROM `rh_employe_affectation` WHERE `ID_EMPLOYE` = ".$this->session->userdata('ID_EMPLOYE')." AND STATUS_AFFECTATION = 1");
        if ($membres['ID_DIRECTION']>0) {
          
          if($membres['ID_DIRECTION']==3){
            $direc = '';
          }
          else{
            // $direc = '';
            $direc = ' AND ID_DIRECTION = '.$membres['ID_DIRECTION'].'' ;
          }

        }
        else{
          $direc = '';
        }


        if ($membres['ID_SERVICE']>0) {
          $serv = ' AND ID_SERVICE = '.$membres['ID_SERVICE'].'' ;
        }
        else{
          $serv = '';
        }

        if ($membres['ID_SECTION']>0) {
          $sect = ' AND ID_SECTION = '.$membres['ID_SECTION'].'' ;
        }
        else{
          $sect = '';
        }

         $headerconge=$this->Model->getRequeteOne("SELECT COUNT(ID_DEMANDE_CONGE) AS NOMBRE FROM `conge_demande_conge` WHERE STATUS_CONGE IN (1,2,5,4,7,8,13) ".$direc." ".$serv." ".$sect." ");
         
          if ($headerconge['NOMBRE'] == 0) {
            $btnconge = '';
          }
          else{
            $btnconge = 'badge-danger';
          }
         ?>
         <!-- navbar-badge -->
         <span class="badge <?php echo $btnconge?>"><?php echo $headerconge['NOMBRE']?></span>
        </a>
      </li>
        
      
      
      
      <li class="nav-item">
        <a class="nav-link" data-widget="fullscreen" href="#" role="button">
          <i class="fas fa-expand-arrows-alt"></i>
        </a>
      </li>

      <li class="nav-item dropdown">
        <a class="nav-link" data-toggle="dropdown" href="#">
          <i class="far fa-user"></i>
        </a>
        <div class="dropdown-menu dropdown-menu-lg dropdown-menu-right">
          <a href="<?=base_url('configuration/Change_Password')?>" class="dropdown-item dropdown-footer">Modification Mot de passe</a>
          <a href="<?=base_url('Login/do_logout')?>" class="dropdown-item dropdown-footer">Déconnexion</a>
        </div>
</li>
      
    </ul>
  </nav>
  <!-- /.navbar -->