<?php require_once('auth.php'); ?>
<aside class="main-sidebar sidebar-dark-primary elevation-4">
   <a href="#" class="brand-link text-center">
      <!--<img src="../../dist/img/AdminLTELogo.png" alt="Logo" class="brand-image img-circle elevation-3" style="opacity: .8">-->
      <span class="brand-text font-weight-light">
      <?php   $us_em_id= $_SESSION['USER']['us_em_id'];
         $employee_query= mysqli_query($conn,"SELECT em_dis_id FROM em_employee WHERE em_id='$us_em_id' LIMIT 1 ") or die(mysqli_error($conn));
         $rowem= mysqli_fetch_assoc($employee_query); ?>
      <?php   $designationid=$rowem['em_dis_id']; ?>
      <?php   
         $emdesig_query= mysqli_query($conn,"SELECT desig_name FROM em_designation WHERE em_desid='$designationid' LIMIT 1 ") or die(mysqli_error($conn));
         $rowemdesn= mysqli_fetch_assoc($emdesig_query); ?>
      <?php  echo $designationname=$rowemdesn['desig_name']; ?>
      </span>
   </a>

   <div class="sidebar">
      <!--<div class="form-inline pt-2">-->
      <!--   <div class="input-group" data-widget="sidebar-search">-->
      <!--      <input class="form-control form-control-sidebar" type="search" placeholder="Search" aria-label="Search">-->
      <!--      <div class="input-group-append">-->
      <!--         <button class="btn btn-sidebar">-->
      <!--            <i class="fas fa-search fa-fw"></i>-->
      <!--         </button>-->
      <!--      </div>-->
      <!--   </div>-->
      <!--</div>-->
      <nav class="mt-2">
         <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
           <?php if ($expiry_date > $date) { ?>
           <?php if(per('dash')==1) { ?>
            <li class="nav-item" onclick="pagecall('../auth/dashboard.php','#home');">
               <a href="#" class="nav-link ">
                  <i class="nav-icon fas fa-tachometer-alt"></i>
                  <p>
                     <?php echo language(1);?>
                  </p>
               </a>
            </li>
           <?php } if(per('ac_menu')==1){ ?>
            <li class="nav-item">
               <a href="#" class="nav-link" onclick="pagecall('../accounts/','#home');">
                  <i class="nav-icon fa fa-fw fa-calculator"></i>
                  <p>
                     <?php echo language(2);?>
                  </p>
               </a>
            </li>
           <?php } if(per('cus_menu')==1){ ?>
            <li class="nav-item">
               <a href="#" class="nav-link" onclick="pagecall('../customer/','#home');">
                  <i class="nav-icon fa fa-fw fa-users"></i>
                  <p>
                     <?php echo language(3);?>       
                  </p>
               </a>
            </li>
           <?php } if(per('sup_menu')==1){ ?>
            <li class="nav-item">
               <a href="#" class="nav-link" onclick="pagecall('../supplier/','#home');">
                  <i class="nav-icon fa fa-fw fa-users"></i>
                  <p>
                     <?php echo language(4);?>       
                  </p>
               </a>
            </li>
           <?php } if(per('hr_menu')==1){ ?>
            <li class="nav-item">
               <a href="#" class="nav-link" onclick="pagecall('../hr_manage/','#home');">
                  <i class="nav-icon fa fa-fw fa-user-secret"></i>
                  <p>
                     <?php echo language(5);?>
                  </p>
               </a>
            </li>
           <?php } if(per('vou_menu')==1){ ?>
            <li class="nav-item">
               <a href="#" class="nav-link" onclick="pagecall('../voucher/','#home')">
                  <i class="nav-icon fas fa-text-width"></i>
                  <p>
                     <?php echo language(6);?>
                  </p>
               </a>
            </li>
           <?php } if(per('pur_menu')==1){ ?>
            <li class="nav-item">
               <a href="#" class="nav-link" onclick="pagecall('../purchase/','#home');">
                  <i class="nav-icon fas fa-cart-plus"></i>
                  <p>
                     <?php echo language(7);?> 
                  </p>
               </a>
            </li>
           <?php } if(per('sale_menu')==1){ ?>
            <li class="nav-item">
               <a href="#" class="nav-link" onclick="pagecall('../sales/','#home');">
                  <i class="nav-icon fas fa-shopping-cart"></i>
                  <p>
                     <?php echo language(8);?>  
                  </p>
               </a>
            </li>
           <?php } if(per('item_menu')==1){ ?>
            <li class="nav-item">
               <a href="#" class="nav-link" onclick="pagecall('../itemstock/','#home');">
                  <i class="nav-icon fas fa-chart-pie"></i>
                  <p>
                     <?php echo language(9);?>
                  </p>
               </a>
            </li>
           <?php } if(per('rep_menu')==1){ ?>
            <li class="nav-item">
               <a href="#" class="nav-link"  onclick="pagecall('../display_report/','#home');">
                  <i class="nav-icon far fa-chart-bar"></i>
                  <p>
                     <?php echo language(10);?>
                     <span class="right badge badge-danger">35+</span>
                  </p>
               </a>
            </li>
           <?php } if(per('sett_menu')==1){ ?>
            <li class="nav-item">
               <a href="#" class="nav-link" onclick="pagecall('../company_setup/','#home');">
                  <i class="nav-icon fa-solid fa-gear"></i>
                  <p>
                     <?php echo language(11);?>  
                  </p>
               </a>
            </li>
              <?php } ?>
           <?php } if(per('doc_menu')==1){ ?>
            <li class="nav-item">
               <a href="#" class="nav-link" onclick="pagecall('../document/','#home');">
                  <i class="nav-icon fas fa-file"></i>
                  <p>
                     <?php echo language(12);?>   
                  </p>
               </a>
            </li>
      
           <?php } if(per('help_menu')==1){ ?>
            <li class="nav-item">
               <a href="#" class="nav-link" onclick="pagecall('../support_desk/','#home');">
                  <i class="nav-icon far fa-conf"></i>
                  <p>
                     <?php echo language(13);?>  
                  </p>
               </a>
            </li>
           <?php } ?> 
           
           

            
            <li class="nav-item">
               <a href="#" class="nav-link" onclick="pagecall('../bill_package/','#home');">
                  <i class="nav-icon far fa-calendar-alt"></i>
                  <p>
                     <?php echo language(14);?>
                  </p>
               </a>
            </li>
         </ul>
         
       

         <hr>

         <div class="nav-item text-white text-blod text-center mt-3"><span style="font-size:12px;"  >
               <?php
                     $datetime1 = date_create($date);
                     $datetime2 = date_create($expiry_date);
                     $interval = date_diff($datetime1, $datetime2);
                     $prev_date = date('Y-m-d', strtotime($expiry_date .' -1 day'));
                     $tt_date = date('Y-m-d', strtotime($expiry_date .' -2 day'));
                     ?>
                     <?php
                     if ($expiry_date==$date) {
                     echo" <span class='text-danger'> Expired Please Renew
                     </span> ";
                     }
                     else if ($date==$prev_date) {
                     echo" <span class='text-danger'>1 Day Left  </span> ";
                     }
                     else if ($date==$tt_date) {
                     echo" <span class='text-danger'>2 Day Left  </span> ";
                     }else{echo $interval->format('Remaning : %R%a Days') ;}
            ?> </span></div>

      </nav>
   </div>
</aside>
<div class="content-wrapper">