

 <!-- sidebar menu -->
 
 
            <div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
			
              <div class="menu_section">
                <h3>User Permissions</h3>
				
               <ul class="nav side-menu">
			   
			   <?php
				include 'pendings.php';
				?>
				
				
				<li><a href="dashboard.php"><i class="fa fa-home"></i> HOME </a></li>
				
				<li><a> <!--<i class="fa fa-edit"></i>--> Leaves <span class="fa fa-chevron-down"></span></a>
                    <ul class="nav child_menu">
                      <li><a href="request_leave.php"> Request Leave </a></li>
					  <li><a href="staffLeaveRequests.php"> List Of Your Leave Requests </a></li>
					  <li><a href=".php"> List Of Your Granted Leaves </a></li>
                    </ul>
                </li>
				
				
				
				<?php
				if($role_id!=2){
				//$sqlRs = "SELECT perm_cate.perm_cate_id,perm_cate.name FROM assigned_permissions INNER JOIN perm_cate ON assigned_permissions.perm_cate_id=perm_cate.perm_cate_id where assigned_permissions.user_id='$user_id' and assigned_permissions.role_id='$role_id' group by assigned_permissions.perm_cate_id";
				$sqlRs = "SELECT perm_cate.perm_cate_id,perm_cate.name,assigned_permissions.user_id,assigned_permissions.permission_id FROM assigned_permissions INNER JOIN perm_cate ON assigned_permissions.perm_cate_id=perm_cate.perm_cate_id where assigned_permissions.user_id='$user_id' group by assigned_permissions.perm_cate_id";
                $Rs = $conn->query($sqlRs);
                while($rowRs = mysqli_fetch_assoc($Rs))
                  {
				$perm_cate_name = $rowRs['name'];
				$permission_cate_id = $rowRs['perm_cate_id'];
				$user_id = $rowRs['user_id'];
				?>
				
				
				
				<li>
				
				<a><?php//echo $cate_icon;?><?php echo $perm_cate_name;?><span class="fa fa-chevron-down"></span></a>
	
				<ul class="nav child_menu">
				<?php
				//$sqlRs22 = "SELECT permissions.url,permissions.permission_name FROM permissions INNER JOIN assigned_permissions ON assigned_permissions.permission_id=permissions.permission_id where assigned_permissions.user_id='$user_id' and assigned_permissions.role_id='$role_id' and assigned_permissions.perm_cate_id='$permission_cate_id'";
				$sqlRs22 = "SELECT permissions.url,permissions.permission_name FROM permissions INNER JOIN assigned_permissions ON assigned_permissions.permission_id=permissions.permission_id where assigned_permissions.user_id='$user_id' and assigned_permissions.perm_cate_id='$permission_cate_id' and (permissions.action!='foward')";
				$Rs22 = $conn->query($sqlRs22);
				while($rowRs22 = mysqli_fetch_assoc($Rs22))
                  {
				$perm_name = $rowRs22['permission_name'];
				$url = $rowRs22['url'];
				?>
				<li><a href="<?php echo $url;?>.php"> <?php echo $perm_name;?> </a></li>
				<?php
				  }
				 ?>
				</ul>	
                </li>
				 
				 <?php
				  }
				  }else{
				?>
				
				 
				
				 <li><a> <!--<i class="fa fa-edit"></i>--> Customer Files <span class="fa fa-chevron-down"></span></a>
                    <ul class="nav child_menu">
                      
					 <?php
				$sqlRs22 = "SELECT * FROM permissions where role_id=2";
				$Rs22 = $conn->query($sqlRs22);
				while($rowRs22 = mysqli_fetch_assoc($Rs22))
                  {
				$perm_name = $rowRs22['permission_name'];
				$url = $rowRs22['url'];
				?>
				<li><a href="<?php echo $url;?>.php"> <?php echo $perm_name;?> </a></li>
				<?php
				  }
				 ?> 
					  
					  
                    </ul>
                  </li>
			
			
			   <?php
			   }
			   ?>	
			<!--<li><a href="upload_documents.php"> Upload Documents </a></li>-->	
			<li><a href="change_password.php"><!--<i class="fa fa-home"></i>--> Change Your Password </a></li>	
			</ul>
            </div>
            </div>
   <!-- /sidebar menu -->               
				

                
            

            <!-- /menu footer buttons -->
            <div class="sidebar-footer hidden-small">
              
              <a data-toggle="tooltip" data-placement="top" title="Logout" href="logout.php">
                <span class="glyphicon glyphicon-off" aria-hidden="true"></span>
              </a>
            </div>
            <!-- /menu footer buttons -->
          </div>
        </div>
		
	

        <!-- top navigation -->
        <div class="top_nav">
		
          <div class="nav_menu">
		  
            <nav>
			
              <div class="nav toggle">
                <a id="menu_toggle"><i class="fa fa-bars"></i></a>
              </div>
			  
              <ul class="nav navbar-nav navbar-right">
                <li class="">
				
				<?php
if($role_id!=2){
	?>
				
                  <a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                   <?php   
				$sql3621 = "SELECT staff.firstname,staff.lastname,staff.staff_image FROM staff,users where (staff.staff_id = users.staff_id) and (users.user_id='$user_id')";
              $result3621 = $conn->query($sql3621);
			  $num3621 = mysqli_num_rows($result3621);
			          if($num3621>0){
               while ($row3621 = mysqli_fetch_array($result3621)){
			            $firstname51 = $row3621['firstname'];
						$lastname51 = $row3621['lastname'];
						$image_url = substr($row3621['staff_image'], 3);
					  echo "<img src = ".$image_url." class ='img-circle'>";
			                    }
                               }
			            print $firstname51.'&nbsp'.$lastname51;
						?>
                
                    <span class=" fa fa-angle-down"></span>
                  </a>
				  
				  <?php
}else{
				  ?>
			  
			<a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                   <?php   
				$sql3621 = "SELECT clients.client_fname,clients.client_lname FROM clients,users where (clients.client_id = users.staff_id) and (users.user_id='$user_id')";
              $result3621 = $conn->query($sql3621);
			  $num3621 = mysqli_num_rows($result3621);
			          if($num3621>0){
               while ($row3621 = mysqli_fetch_array($result3621)){
			            $firstname51 = $row3621['client_fname'];
						$lastname51 = $row3621['client_lname'];
						//$image_url = substr($row3621['staff_image'], 3);
					 // echo "<img src = ".$image_url." class ='img-circle'>";
			                    }
                               }
			            print $firstname51.'&nbsp'.$lastname51;
						?>
                
                    <span class=" fa fa-angle-down"></span>
                  </a>  
			  
			  <?php
			  }
			  ?>
				  
                  <ul class="dropdown-menu dropdown-usermenu pull-right">
                    <!--<li><a href="your_profile.php"> Profile</a></li>-->
                     <li><a href="change_password.php">Change Your Password</a></li>
                    
                    <li><a href="logout.php"><i class="fa fa-sign-out pull-right"></i> Log Out</a></li>
                  </ul>
				 
                </li>

               </ul>
            </nav>
          </div>
        </div>
        <!-- /top navigation -->