



	
   	<div class="col-md-12">
  
										<?php
 
   $session_data = $this->session->userdata('logged_in');

      $mydate=date("Y-m-d H:i:s");
 $date = Date('Y-m-d') ;
		 	 $year = Date('Y') ;
		  $month = Date('m') ;
 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];
$data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
	         		$config = $this->usermodel->populateallarray('people','id',$userid);


 $names = $config[0]['firstname']." ".$config[0]['surname'];
	 
	  $contact = $config[0]['phone'];
	  
	  				
$finalsalesid ="EXP-".$userid.time();

 //$data['finalsalesid']="EXP-".$finalsalesid;

	  


    $leavesetup=$this->usermodel->populatuserpermissionsdataarray('humanresource','leavesetup',$userid);
			    $allleaves=$this->usermodel->populatuserpermissionsdataarray('humanresource','allleaves',$userid);
 
 
  $mydate=date("Y-m-d H:i:s");



  
  ?>
		
		
		
		
		
		
		<div class="panel panel-default" data-collapsed="0">
        	<div class="panel-heading">
            	<div class="panel-title" id="redcolor" >
            		<i class="entypo-plus-circled"></i>
				View my leave history	
				
	
	 
				
				                  <span class="pull-right">  

<a  id="more" class="btn btn-primary" href="<?php echo base_url();?>user/viewrequest">Go to HR  </a>
								  <a  class="btn btn-primary" href="<?php echo base_url();?>user/applyleave"> Apply leave  </a>

								  
								  </span> 


				</div>
            </div>
			<div class="panel-body">

			
										
					<div class="row">
					
					<div class="col-md-2">
				<div id="sidebar" class="hidden-print minibar ">
			
			<ul>
															<li ><a href="<?php echo base_url(); ?>user/myleaves"><span class="btn btn-info">My  leave balance</span></a></li>

								<li ><a href="<?php echo base_url(); ?>user/applyleave"><span class="btn btn-default">Apply leave</span></a></li>
							<li ><a href="<?php echo base_url(); ?>user/viewleaves"><span class="btn btn-default">My Leaves </span></a></li>
														<li ><a href="<?php echo base_url(); ?>user/viewotherleaves"><span class="btn btn-default">Pending Leaves</span></a></li>
																<?php  
													 
	
	 if($allleaves==TRUE){

	 ?>
															<li ><a href="<?php echo base_url(); ?>user/allleaves"><span class="btn btn-default">All Leaves</span></a></li>
 															<li ><a href="<?php echo base_url(); ?>user/leavebalance"><span class="btn btn-default">All Leaves Balance</span></a></li>
								<li ><a href="<?php echo base_url(); ?>user/applyleaveforothers"><span class="btn btn-info">Apply leave For Others</span></a></li>

	 
<?php 
		
	 }

	?>
									<li ><a href="<?php echo base_url(); ?>user/announcement"><span class="btn btn-default"> Notices</span></a></li>
																		<li ><a href="<?php echo base_url(); ?>user/suggestion"><span class="btn btn-default">Post Comments</span></a></li>

						
					
			</ul>
					<?php  
													 
	
	 if($leavesetup==TRUE){

	 ?>
	 

	 	<ul>

						<li ><a href="<?php echo base_url(); ?>user/addpost"><span class="btn btn-default">Create Post</span></a></li>

								<li ><a href="<?php echo base_url(); ?>user/department"><span class="btn btn-default">Add Department</span></a></li>
							<li ><a href="<?php echo base_url(); ?>user/leavegroup"><span class="btn btn-default">Leaves Groups </span></a></li>
														<li ><a href="<?php echo base_url(); ?>user/leavetypes"><span class="btn btn-default">Leaves Types </span></a></li>

														<li ><a href="<?php echo base_url(); ?>user/supervisor"><span class="btn btn-default">View Supervisors</span></a></li>

									
						
					
			</ul>
<?php 
		
	 }

	 ?>
		</div>
					
					</div>
					
					
					
					
					
					
						<div class="col-md-10">
								<div class="widget-content nopadding table_holder table-responsive" >				

							<div class="panel-body">
	
									
									
							
<table id="example"  cellspacing="1" border="1" class="table-striped" width="100%">
             <thead>
         <tr>
		 <th>Date applied</th> 
	 <th>Days</th> 
		 	  <th>Leave type</th>
		  <th>From</th>
    		  <th>To</th>
			    <th>Employee</th>
  <th>Reasons</th>
    <th>Comments</th>

 <th>Status</th>  	
 		 <th>Date updated</th> 






                 </tr>
             </thead>
<?php













echo $this->session->flashdata('msg');
 if(!is_array($report)) 

 {


   echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='8'>";
    
       echo '<div class="alert alert-warning text-center">There is no leave history to show for now.</div>';
    echo "</td>";
   echo "</tr>";
    }else {
?>
    
             <?php 
  
  	foreach ($report as $c): 

		 

             ?>



             <tr>
                
            <?php 
$id=$c->userid;
$createdat=$c->postedtime;
$myuserid=$c->id;


?>
 <td><?php echo $c->postedtime	; ?></td> 				   
 <td><?php echo $c->duration	; ?></td> 				   


  <td><?php 
	
								 
 
					// $branch="";
					 $mytype=$c->type;

					 $leavetype= $this->usermodel->populateall('leavegroup','id',$mytype);



if(is_array($leavetype)) {

   foreach($leavetype as $leavetyperow){

   echo $leavetyperow->name;
 
 
}} else {
    echo 'No type';
}
	
?>
	
	
</td>



 

 <td><?php echo $c->startdate	; ?></td> 	
               <td><?php echo $c->enddate; ?></td> 	

 
		   <td><?php 
	
								 
 
					// $branch="";
					 $myincharge=$c->incharge;

					 $myenployee= $this->usermodel->populateall('people','id',$myincharge);



if(is_array($myenployee)) {

   foreach($myenployee as $myenployeerow){

   echo $myenployeerow->lastname." ".$myenployeerow->firstname."(".$myenployeerow->number.")"; 
 
 
}} else {
    echo 'No Employee';
}
	
?>
	
	
</td>

          <td><?php echo $c->description; ?></td> 

      			 <td><?php echo $c->comments	; ?></td> 				   

        
   
				<td><?php 
	
								 
 
					// $branch="";
					 $mystatuse=$c->status;
					 $myleavename="";

					 $leavestatus= $this->usermodel->populateall('status','id',$mystatuse);



if(is_array($leavestatus)) {

   foreach($leavestatus as $leavestatusrow){

   echo $leavestatusrow->name;
 
 					 $myleavename=$leavestatusrow->name;

}} else {
    echo 'No Status';
}
	
	
	if($myleavename=="Returned"){
		?>
		
			<a  id="more" class="btn btn-info" href="<?php echo base_url();?>user/postmyleave?randomitemidentifier=<?php   {echo  $myuserid;}  ?>">  Submit </a>

		<?php
	}
?>
	
	
</td>
	 

			 <td><?php echo $c->updateddate	; ?></td> 				   
		 
					 
          
             </tr>

             <?php endforeach; ?>

              <?php }?>

        </table>

									
									
									
					</div>				
									
						</div>			
									
									
							</div>
						</div>
				

			
			</div>
		</div>
  
  </div>
			
			
			
		
		
  

 
</div>


















