
			<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>			
		

				   	
 <script type="text/javascript">
        
        
		
		
				 $(document).on("click", "#managebtndelete", function()
        {
          var itemid = $(this).data('id');
		  $("#itemid1").val(itemid); 
		  
		  
		   
        });
          
        </script>	
  <div class="container-fluid">
 <div class="row">

  <div class="col-xs-12 col-sm-6 col-lg-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>
				Please Add New Leave group
				<span class="pull-right">  <a  id="more" class="btn btn-primary" href="<?php echo base_url();?>user/viewleaves">Go 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');

   
 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];

 $data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
	  echo $this->session->flashdata('deletemsg'); 

 echo $this->session->flashdata('msg'); 

		
                 echo form_open('user/addLeavegroup' , 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="inputname" class="col-sm-2 control-label">	Leave Group Name</label>
    <div class="col-sm-10">

		  		<input type="text" name="name" value="<?php echo set_value('name'); ?>"id="name" class="form-control"  placeholder="Enter Leave group name">
		 
				
		<span class="text-danger"> 	Enter Leave Group  here..<?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>	

	
  
	
  
  
  <div class="form-group">
    <label for="inputdefaultleavetype" class="col-sm-2 control-label">	Default Leave Type</label>
    <div class="col-sm-10">
	<select class="form-control" name="defaultleavetype" required>
	
	<option value=""  >---Select Leave Type---</option>

	
	<?php 
					 
			$leavetypes = $this->usermodel->populatealldata('leavetypes','id','DESC');

	


if(is_array($leavetypes)) {

   foreach($leavetypes as $leavetypesrow){

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



	<?php

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


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

	</div>
  </div>
  
  
    <div class="form-group">
    <label for="inputtotal" class="col-sm-2 control-label"> Default Annual leave days:   </label>
    <div class="col-sm-10">
		
				<input type="text" required name="total" value="<?php echo set_value('total') ;?>" id="dob" class="form-control" required  placeholder="Please enter total leave days for the post">

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

  
  
  

  
  <div class="form-group">
    <label for="inputstartdate" class="col-sm-2 control-label">	Start Date ?</label>
    <div class="col-sm-10">

	<input type="date" name="startdate" value="<?php echo set_value('startdate'); ?>"id="startdate" class="form-control" required placeholder="Enter specific date of payment(dd-mm-YYY) ">
			<span class="text-danger"> <?php echo form_error('startdate'); ?>
		
		</span>
	</div>
  </div>
  
  
    <div class="form-group">
    <label for="inputenddate" class="col-sm-2 control-label">	 To Date?</label>
    <div class="col-sm-10">

	<input type="date" name="enddate" value="<?php echo set_value('enddate'); ?>"id="enddate" class="form-control"  placeholder="Enter due date if possible ">
			<span class="text-danger"> <?php echo form_error('enddate'); ?>
		
		</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"></textarea>		
		<span class="text-danger"> Enter description if any<?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_Leavetgroup" class="btn btn-primary" value="Group">
                                <span class="glyphicon glyphicon-log-in"></span> Add Leave Group                           
								 </button>
								 

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

							
						</div>
					</div>
					
					
					
					
					
					
	
						<div id="myModal2" 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">Cancel</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to Cancel this item? </h3>
      </div>
      <div class="modal-footer">
	  	

     
		<?PHP
				$session_data = $this->session->userdata('logged_in');
 echo $this->session->flashdata('deletemsg'); 

		
                 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="leavegroup">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/leavegroup">
 <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"> Cancel Now  </button>

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

  </div>

  </div>
				
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					
					

					
			

  <table cellpadding="0" cellspacing="0" border="0" class="table  table" id="example" style="border-color:#CCCCCC; width:100%;"  >
<thead>

  <tr>
   <th>Leave id</th>

   

    <th>Leave Name</th>  
	    <th>Default Days</th> 
  <th>Default  Group</th>   	
    <th>Start Date</th>   
   
    <th>End Date</th>     
 <th>Description </th>
  <th>Assign Leave </th>
 
  </tr>
</thead>

<?php 

if(is_array($leavegroup)) {

   foreach($leavegroup as $row){
$id=$row->id ;
  echo "<tr>";

     echo "<td>". $row->id ."</td>";

   

    echo "<td>". $row->name ."</td>";
    echo "<td>". $row->total ."</td>";
	?>
	 <td><?php 
	
								 
 
					// $branch="";
					 $mytype=$row->defaultleavetype;

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



if(is_array($leavetype)) {

   foreach($leavetype as $leavetyperow){

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

	<?php
	
	
	  echo "<td>". $row->startdate ."</td>";
    echo "<td>". $row->enddate ."</td>";
    echo "<td>". $row->description ."</td>";

?>




 <td> 

 
 
  <div class="btn-group">
                                    <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown">
                                        More <span class="caret"></span>
                                    </button>
                                    <ul class="dropdown-menu dropdown-primary pull-right" role="menu">
                                        
                                        <!-- teacher EDITING LINK -->
                                        <li>  
										                     <a  id="more" class="btn btn-primary" href="<?php echo base_url();?>user/groupleavedays?randomitemidentifier=<?php   {echo  $id;}  ?>&type=group"> 


                                                <i class="glyphicon glyphicon-pencil"></i>
																Assign entitled days
                                                </a>
                                                        </li>
                                     
										    
                                        
                                        <li class="divider"></li>
                                        <li>
										                     <a  id="more" class="btn btn-primary" href="<?php echo base_url();?>user/groupoffdays?randomitemidentifier=<?php   {echo  $id;}  ?>&type=group"> 


                                                <i class="glyphicon glyphicon-education"></i>
                                                    Assign Off days </a>
                                               
                                                        </li>



	<?php
										if($usertype=="admin"){
											
											?>
											                                        <li class="divider"></li>

											  <li> 
										 <a class="btn btn-danger managebtn" id="managebtndelete"		 data-id='<?php echo  $row->id;?>'    data-toggle='modal' data-target='#myModal2<?php  $row->id; ?>'>	 


                                                <i class="glyphicon glyphicon-pencil"></i>
																Cancel
                                                </a>
                                                        </li>
											<?php
										}
										?>
									
                                    </ul>
                                </div>

 
 
 
 
 
 
 
 
 </td>








<?php
}} else {
    echo 'There is no any Leave data available.... try again.';
}

 echo "</tr>";   




?>

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






































			

















