

      <script type="text/javascript">
  
		
		 $(document).on("click", "#managebtndelete", function()
        {
          var itemid = $(this).data('id');
		  $("#myitemid").val(itemid); 
		  
		  
		   
        });
		

    function selectAllCheckBoxes(obj){
        $('input:checkbox:not(:disabled).checkBoxInLoop').prop('checked', jQuery(obj).prop('checked'));
    }

    function unselectCheckBoxUnik(){

        /*first you verify if the quantity of checkboxes equals number of checkboxes*/
        a = $('input:checkbox:not(:disabled).checkBoxInLoop:checked').size();
        b = $('input:checkbox:not(:disabled).checkBoxInLoop').size();

        /*if equals, mark a checkBoxUnik*/
        ((a == b)? $('#checkBoxUnik').prop("checked", true) : $('#checkBoxUnik').prop("checked", false));
    }


		
    </script>  
 <div class="row">
  	<?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'];	
	 
	  $opencloseshift=$this->usermodel->populatuserpermissionsdataarray('members','opencloseshift',$userid);

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

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


		 <a href="<?php echo base_url();?>user/viewmember" class="btn btn-info">Go back </a>	 
            	</div>
            </div>
			<div class="panel-body">

			
	<div class="widget-content nopadding table_holder table-responsive">	






	
				
					<div class="row">
						<div class="col-md-12">
							
							<div class="panel-body">

		<?php
			
		
                 echo form_open('user/openemployeeshift' , 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;?>						
  <table cellpadding="0" cellspacing="0" border="0" class="table  table-striped" id="example" style="border-color:#CCCCCC; width:100%;"  >

             <thead>
         <tr>
 <th> <input type="checkbox" onclick="selectAllCheckBoxes(this)" id="checkBoxUnik"/>All
</th>
    
	     <th> Names</th>
		 	 
 <th>Username/Email</th>
<th>Phone</th>	
		 
		  
	    <th>Status
			<?php
									 if( $opencloseshift==true){
										 ?>
		
<select class="form-control" name="categoryid" required>
	
	<option value=""  >---Select Action---</option>
	<option value="0"  >Close employee shift</option>
	<option value="1"  >Open employee shift</option>

	
	
</select>


			         <button type="submit"  value="all" name="startemployeeshift" class="btn btn-info"> 	Save  </button>

	<?php

									 }
									 ?>

		</th>

	

                 </tr>
             </thead><tbody>
<?php

 if(!is_array($viewmember)) 

 {


   echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='8'>";
    
       echo '<div class="alert alert-warning text-center">There no records found..</div>';
    echo "</td>";
   echo "</tr>";
    }else {

    
				
             
  
  	foreach ($viewmember as $c): 

		 

             ?>

            <?php 
$id=$c->id;
//$myusertype=$c->usertype;
if(trim($c->usertype)=="user"){
	
	


?>


             <tr>
                

         <td>
			<input name="selector[]" type="checkbox" onclick="unselectCheckBoxUnik()" class="checkBoxInLoop" value="<?php echo $c->id ; ?>">
				</td>     

  <td><?php echo $c->firstname. " ". $c->usertype ; ?></td>

    <td><?php echo $c->email ; ?></td>
	  <td><?php echo $c->phone ; ?></td>

	  <td><?php 
	  if($c->status=="1"){
		  echo "Opened";
	  }else{
		  		  echo "Closed";

	  }
	  
	  
	  ?></td>
                </tr>

	<?php
}

	endforeach;} ?>
 
            
			  <?php echo form_close(); ?>

       <tbody> </table>
	   
        <div class="col-md-12 text-center">    <?php echo $links; ?>
					   		<span style="color:red; font-size:20px"><?php  echo $total_rows. "   Members. " ;?>   </span>

        
        </div>
   
			
	</div>
				
				<div id="addModal" 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">Add new  Member/ Contact</h4>
      </div>
      <div class="modal-body">
      
	  	

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/addmember' , 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;?>
<input type="hidden" name="status" value="1"id="status" class="form-control" required placeholder="Enter status">
				  		<input type="hidden" name="category" value="member" class="form-control" required placeholder="Enter member">
 

	


<div class="form-group">
    <label for="inputfirstname" class="col-sm-2 control-label">	First name<span style="color:red;">*</span></label>
    <div class="col-sm-10">
	
		  		<input type="text" name="firstname" value="<?php echo set_value('firstname'); ?>" class="form-control" required placeholder="Enter your first names">
		 
				
		<span class="text-danger"> <?php echo form_error('firstname'); ?>
		
		</span>
	</div>
  </div>

 <div class="form-group">

    <label for="inputlastname" class="col-sm-2 control-label">Last name<span style="color:red;">*</span></label>
    <div class="col-sm-10">

		  		<input type="text"  name="lastname" value="<?php echo set_value('lastname'); ?>"id="lastname" class="form-control"  placeholder="Enter your surname / lastname">
     <span class="text-danger"><?php echo form_error('lastname'); ?></span>
   </div>
  </div>

	

  
  	<div class="form-group">
    <label for="inputphone" class="col-sm-2 control-label">	Phone <span style="color:red;">*</span></label>
    <div class="col-sm-10">
	
		  		<input type="text" name="phone" value="<?php echo set_value('phone'); ?>" class="form-control" required placeholder="Enter phone e.g 254712345678">
		 
				
		<span class="text-danger"> e.g 254712345678 <?php echo form_error('phone'); ?>
		
		</span>
	</div>
  </div>
  	
  	<div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">		ID Number	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="idno" value="<?php echo set_value('idno'); ?>" class="form-control"  placeholder="Enter idno if any or Campany Pin">
		 
				
		<span class="text-danger"> <?php echo form_error('idno'); ?>
		
		</span>
	</div>
  </div>
  
  <div class="form-group">
    <label for="inputtitle" class="col-sm-2 control-label">Title (Optional)</label>
    <div class="col-sm-10">

	
	<select  class="form-control" name="title">
				<option value="">Please select  title/salutation</option>
					<option value="Professor">Professor </option>
				<option value="Dr" > Dr </option>
					<option value="Rev" > Rev </option>
						<option value="Mr"  > Mr </option>
							<option value="Mrs" > Mrs </option>
								<option value="Ms" > Ms </option>
									<option value="Other" > Other </option>
								
				
				</select>		  		
				
		<span class="text-danger"> <?php echo form_error('title'); ?>
		
		</span>
	</div>
  </div>
   	<div class="form-group">
    <label for="inputphoneaddress_1" class="col-sm-2 control-label">Phone 2	(Optional) </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="address_1" value="<?php echo set_value('address_1'); ?>" class="form-control"  placeholder="Enter other line e.g 254712345678(Optional)">
		 
				
		<span class="text-danger">Other Number e.g 254712345678 (Optional)<?php echo form_error('address_1'); ?>
		
		</span>
	</div>
  </div>
  
  
   	<div class="form-group">
    <label for="inputphonegender" class="col-sm-2 control-label">	Gender	(Optional) </label>
    <div class="col-sm-10">
	
	<select class="form-control" name="gender" >
	
	<option value=""  >---Select Gender---</option>
	<option value="female"  >female</option>
		<option value="male"  >male</option>
	</select>		 
				
		<span class="text-danger"> <?php echo form_error('gender'); ?>
		
		</span>
	</div>
  </div>
  <div class="form-group">
    <label for="inputcompany" class="col-sm-2 control-label">	Business  Name/Company</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="company" value="<?php echo set_value('company'); ?>" class="form-control"  placeholder="Enter company name if any">
		 
				
		<span class="text-danger"> <?php echo form_error('company'); ?>
		
		</span>
	</div>
  </div>
   <div class="form-group">
    <label for="inputcountry" class="col-sm-2 control-label">Country?</label>
    <div class="col-sm-10">
	<select class="form-control" name="country" >
	


	
	<?php 
					 
			$mycountry = $this->nationmodel->populatenation();
	


if(is_array($mycountry)) {

   foreach($mycountry as $mycountryrow){

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



	<?php

}} else {
    echo 'No country available.';
}
	
?>
	<option value=""  >---Select country---</option>
</select>
		
						<span class="text-danger"><?php echo form_error('country'); ?>

	</div>
  </div>
      <div class="form-group">
    <label for="inputcategoryid" class="col-sm-2 control-label">Group</label>
    <div class="col-sm-10">
	<select class="form-control" name="categoryid" required>
	
	<option value="" selected="selected">---Select Category/Group for this member---</option>
		<option value="no"  >--Does not Belongs to any Category/Group ---</option>
	
	<?php 
					 
			
	


if(is_array($mycategory)) {

   foreach($mycategory as $mycategoryrow){

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



	<?php

}} else {
    echo 'No category/ group available.';
}
	
?>
</select>
		
						<span class="text-danger"><?php echo form_error('categoryid'); ?>

	</div>
  </div>
  
  
  
    	<div class="form-group">
    <label for="inputemail" class="col-sm-2 control-label">	Email </label>
    <div class="col-sm-10">
	
		  		<input type="email" name="email" value="<?php echo set_value('email'); ?>" class="form-control"  placeholder="Enter Your email">
		 
				
		<span class="text-danger"> <?php echo form_error('email'); ?>
		
		</span>
	</div>
  </div>
  
  
  
     
  
  
  
  
    
  	<div class="form-group">
    <label for="inputcity" class="col-sm-2 control-label">	City 	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="city" value="<?php echo set_value('city'); ?>" class="form-control"  placeholder="Enter City or town">
		 
				
		<span class="text-danger"> <?php echo form_error('city'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  	<div class="form-group">
    <label for="inputzip" class="col-sm-2 control-label">	Zip Code 	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="zip" value="<?php echo set_value('zip'); ?>" class="form-control"  placeholder="Enter Zip Code">
		 
				
		<span class="text-danger"> <?php echo form_error('zip'); ?>
		
		</span>
	</div>
  </div>
  
  
  
 
  
  	
 
  
    	<div class="form-group">
    <label for="inputwebsite" class="col-sm-2 control-label">		Website/Link 	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="website" value="<?php echo set_value('website'); ?>" class="form-control"  placeholder="Enter website if any">
		 
				
		<span class="text-danger"> <?php echo form_error('website'); ?>
		
		</span>
	</div>
  </div>
  
 
  
  
  
  
	<div class="form-group">
    <label for="inputcomments" class="col-sm-2 control-label">	Description</label>
    <div class="col-sm-10">

				<textarea name="comments" value="<?php echo set_value('comments'); ?>"  class="form-control"  placeholder="Enter comments"></textarea>
			
		<span class="text-danger"> <?php echo form_error('comments'); ?>
		
		</span>
	</div>
  </div>
		

	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="member" name="btn_addmember" class="btn btn-primary"> Add Member   </button>

    </div>
  </div>
  					<?php echo form_close();?>
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

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




<div id="bulkGroupingModal" 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">All Grouping</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to add all members to one group?</h3>
      </div>
      <div class="modal-footer">
	  	

     
		<?PHP


				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/groupall' , 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;?>

     <div class="form-group">
    <label for="inputcategoryid" class="col-sm-2 control-label">Group?</label>
    <div class="col-sm-10">
	<select class="form-control" name="categoryid" required>
	
	<option value=""  >---Select Group---</option>

	
	<?php 
					$allcategory  = $this->usermodel->populateall('category', 'userid',$userid); 



if(is_array($allcategory)) {

   foreach($allcategory as $mycategoryrow){

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



	<?php

}} else {
    echo 'No category available.';
}
	
?>
</select>
		
						<span class="text-danger"><?php echo form_error('categoryid'); ?>

	</div>
  </div>
  	
 <input type="hidden" id="table"name="table" class="table" placeholder="view" value="people">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/viewmember">
 <input type="hidden" id="itemid1"name="itemid" class="itemid" placeholder="itemid" value=""><br>
 <button type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button>
 		  	         <button type="submit" name="btn_groupall" value="all" class="btn btn-primary"> Group All  </button>

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

  </div>

  </div>				











	
		<div id="deleteModal" 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 $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="people">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/viewmember">
 <input type="hidden" id="myitemid"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 id="uploadModal" 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">Upload Correct Members (CSV)</h4>
		
      </div>
      <div class="modal-body">
      
	  	

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/uploadmembers' , 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="inputsurname" class="col-sm-2 control-label">	CSV LIST</label>
    <div class="col-sm-10">
		
			<input type="file" name="file" width="400"  value="<?php echo set_value('file') ;?>" placeholder="Select EXCELL" class="form-control" required placeholder="Enter Surname"  >

		  		
				
		<span class="text-danger"> Upload correct format of CSV File  here..<?php echo form_error('file'); ?>
		
		</span>
	</div>
  </div>	
  
	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="member" name="btn_uploadmembers" class="btn btn-primary">Upload Members  </button>

    </div>
  </div>
  					<?php echo form_close();?>
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

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

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

 
</div>


















