<script type="text/javascript">
  
		
		 $(document).on("click", "#managebtndelete", function()
        {
          var itemid = $(this).data('id');
		  $("#itemid1").val(itemid); 
		  
		  
		   
        });
		
		
		
		
		
    </script>   
			<style>
			#mainbody{
	
	text-align: left;
		font-size: 12px;
		border-top: 1px solid #D0D0D0;
		
		
		 background-mage: #f4f4f4 url(../images/img/memberertificate.jpg);
		padding:5px;
		margin: 5px ;
		border-radius:10px 10px;

		border: 1px solid #D0D0D0;
		color: black;
		
	
	
	}

</style>			
				
				<div class="row">
  
   	<div class="col-md-12">
		<div class="panel panel-default" data-collapsed="0">
        	<div class="panel-heading">
            	<div class="panel-title" id="redcolor" >
            		<i class="entypo-plus-circled"></i>
				Assign branch to this employee
				
								                   <span class="pull-right">  <a  id="more" class="btn btn-primary" href="<?php echo base_url();?>user/viewemployee">Back  </a>

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

			
										
					<div class="row">
						<div class="col-md-12">
							
							<div class="panel-body">
					
	
				<?PHP
					$session_data = $this->session->userdata('logged_in');
$id = $session_data['id'];
 $companyid = $session_data['companyid'];

$mydate=date("d-m-Y");
$myear=date("Y");
$transactioncode = rand(1000, 99000).time();
$imgid = rand(100, 990000).time();
				echo $this->session->flashdata('msg'); 
				 echo $this->session->flashdata('deletemsg'); 

	
		
                 echo form_open('user/postassignbranches' , array('class' => 'form-horizontal form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
					
					
	
  
  		<div class="form-group">
    <label for="inputbranchid" class="col-sm-2 control-label">	Select Branch</label>
    <div class="col-sm-10">
	<select class="form-control" name="branchid" required>
	
	<option value=""  >---Select Branch to asign---</option>

	
	<?php 
					 

			$branch = $this->usermodel->populateall('branch','companyid',$companyid);



if(is_array($branch)) {

   foreach($branch as $branchrow){

   //echo $courserow->coursename;
    ?>
					<option value="<?=  $branchrow->id;   ?>"><?=  $branchrow->name; ?></option>



	<?php

}} else {
    echo 'No Leave type available.';
}
	
   


?>
			 
			
				
				</select>
		
						<span class="text-danger"><?php echo form_error('branchid'); ?>

	</div>
  </div>
  
	

    	<input type="hidden" name="itemid" value="<?php echo set_value('itemid',$itemid); ?>"id="itemid" class="form-control" required placeholder="Enter mytype ">

  
  
 
  
  

   <div class="form-group">
    <label for="inputstatus" class="col-sm-2 control-label">	Status	 </label>
    <div class="col-sm-10">
	
	<select class="form-control" name="status"  id="status"required>

	<option value=""  >---Select status---</option>
	<option value="1"  selected="selected" >active</option>
		<option value="0"  >inactive</option>
	</select>		 
				
		<span class="text-danger"> <?php echo form_error('gender'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  <div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">Description</label>
    <div class="col-sm-10">

	<textarea name="description" class="form-control" placeholder="You can describe the group leaves"><?php echo set_value('description'); ?></textarea> 
			<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  
  
  
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  name="btn_assignbranch"  value="branch"  class="btn btn-primary"> Assign Branch </button>

    </div>
  </div>
			</div>							   
									<?php echo form_close();?>
									
									
									
									
									
									
									
									
									<table id="example"  cellspacing="1" class="border  table" width="100%">
             <thead>
         <tr>
		 		   <th>Branch</th>

		   <th>Status</th>
		  <th> Date</th>
 	
<th>Description</th> 

<th>Delete</th> 




                 </tr>
				 </thead>
	<?php
	 if(!is_array($assignedleave)) 

	 {


	   echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
		  echo "<td colspan='6'>";
		
		   echo '<div class="alert alert-warning text-center">You have not posted  any payment please feel free to do so..</div>';
		echo "</td>";
	   echo "</tr>";
		}else {
	?>
		
             <?php 
  
  	foreach ($assignedleave as $c): 

		 

             ?>



             <tr>
                
            <?php 
$id=$c->id;


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

					 $leavetype= $this->usermodel->populateall('branch','id',$branchid);



if(is_array($leavetype)) {

   foreach($leavetype as $leavetyperow){

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


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


 <td>
   
										 <a class="btn btn-danger managebtn" id="managebtndelete"		 data-id='<?php echo  $c->id;?>'    data-toggle='modal' data-target='#myModal<?php  $c->id; ?>'>	 


                                                <i class="glyphicon glyphicon-pencil"></i>
																Delete
                                                </a>
                                                        
 </td>

					 
   

             </tr>

             <?php endforeach; ?>

              <?php }?>

        </table>

									
									
									
									
									
									
									
									
					<div id="myModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Delete</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to delete this item? </h3>
      </div>
      <div class="modal-footer">
	  	

     
		<?PHP
				$session_data = $this->session->userdata('adminlogged_in');

		
                 echo form_open('user/deletebyid' , array('class' => 'form-horizontal ', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
 <input type="hidden" id="table"name="table" class="table" placeholder="view" value="assignbranches">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/assignbranches?randomitemidentifier=<?php echo $itemid; ?>">
 <input type="hidden" id="itemid1"name="itemid" class="itemid" placeholder="itemid" value=""><br>
 <button type="button" class="btn btn-success" data-dismiss="modal">No</button>
 		  	         <button type="submit" name="btn_delete" value="deletebyid" class="btn btn-danger"> Delete  </button>

	<?php echo form_close();?>
      </div>
    </div>

  </div>

  </div>

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

								
			
			
			
			
			
			
		
		</div>
  
  </div>

</div>
















