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


 	 <?PHP

		 
		    
$session_data = $this->session->userdata('logged_in');
 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
$data['smstype'] = $session_data['smstype'];
	 $smstype = $data['smstype'];	
$data['surname'] = $session_data['surname'];
$data['id'] = $session_data['id'];
 $data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
$surname=$data['surname'];
   $userid=$data['id'];

?>
<ul class="nav nav-tabs bordered">
			<li class="active">
            	<a href="#add" data-toggle="tab"><i class="entypo-menu"></i> 
				Add User
                    	</a></li>
			<li>
            	<a href="#list" data-toggle="tab"><i class="entypo-plus-circled"></i>
					
						All Users
                    	</a></li>
		</ul>
    	<!------CONTROL TABS END------>
        
		<div class="tab-content">
            <!----TABLE LISTING STARTS-->
            <div class="tab-pane box " id="list">
				
     


 <div class="panel panel-primary" data-collapsed="0">
	
 
<table id="example"  cellspacing="1" class="table  table" width="100%">
             <thead>
         <tr>
    
 <th> Name</th>

    <th>Email </th> 

	     <th>User Type </th>  
      <th>Date </th>  
    
    <th>Action</th>   

                 </tr>
             </thead>
<?php
echo $this->session->flashdata('msg'); 
 if(!is_array($allusers)) 

 {


   echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='1'>";
    
       echo '<div class="alert alert-warning text-center">There no user  found by now..</div>';
    echo "</td>";
   echo "</tr>";
    }else {
?>
    
             <?php 
  
  	foreach ($allusers as $c): 

		 

             ?>



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


?>

              





 
	  
	     <td><?php echo  $c->surname ." ".$c->firstname ; ?></td>
		    <td><?php echo $c->email ; ?></td>
                 
				  <td><?php echo $c->usertype ; ?></td>
				  <td><?php echo $c->createddate ; ?></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>
									<?php
										if($usertype=="admin"){
											
											?>
                                    <ul class="dropdown-menu dropdown-primary pull-right" role="menu">
                                        
                                        <!-- teacher EDITING LINK -->
                                      
										
											  <li> 
										 <a class="btn btn-danger managebtn" id="managebtndelete"		 data-id='<?php echo  $c->id;?>'     data-toggle='modal' data-target='#deltemyModal<?php  $c->id; ?>'>	 


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

										
										</li>
                                        
                                    						
											  <li> 
										                     <a  class="btn btn-primary"  id="more" href="<?php echo base_url();?>administrator/welcome?randomitemidentifier=<?php   {echo  $c->id;}  ?>">


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

             <?php endforeach; ?>

              <?php }?>

        </table>

</div>

</div>






		
 <div id="deltemyModal" 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="user">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="admin/displayallusers">
 <input type="hidden" id="itemid1"name="itemid" class="itemid" placeholder="itemid" value=""><br>
          <input type="hidden" id="plotno1"name="plotno" class="form-control" placeholder="plotno"  value="">
 <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 class="tab-pane box active " id="add" style="padding: 5px">




		
<div class="row">
	<div class="col-md-12">
		<div class="panel panel-primary" data-collapsed="0">
        	<div class="panel-heading">
            	<div class="panel-title" >
            		<i class="entypo-plus-circled"></i>
				Add new Users
            	</div>
            </div>
			<div class="panel-body">





				<?PHP
				echo $this->session->flashdata('msg'); 
		
                 echo form_open('admin/adduser' , 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-4 col-lg-2 col-md-2 col-xs-4 control-label">Surname</label>
    <div class="col-sm-10">
		  		<input type="text" name="surname" value="<?php echo set_value('surname'); ?>"id="surname" class="form-control" required placeholder="Enter your surname">
     <span class="text-danger"><?php echo form_error('surname'); ?></span>
   </div>
  </div>
    <div class="form-group">
    <label for="inputothername" class="col-sm-4 col-lg-2 col-md-2 col-xs-4 control-label">Other Name</label>
    <div class="col-sm-10">
		<input type="text" name="othername" value="<?php echo set_value('othername') ;?>" id="othername" class="form-control" required placeholder="Enter your Other Names">
       <span class="text-danger"><?php echo form_error('othername'); ?></span>
   </div>
  </div>
  
  
     <div class="form-group">
    <label for="inputphone" class="col-sm-4 col-lg-2 col-md-2 col-xs-4 control-label">Phone Number</label>
    <div class="col-sm-10">
		<input type="text" name="phone" value="<?php echo set_value('phone') ;?>" id="othername" class="form-control" required placeholder="Enter your phone Number e.g 25716567890">
       <span class="text-danger"><?php echo form_error('phone'); ?></span>
   </div>
  </div>
  
  
  
  
  
  
  
    <div class="form-group">
    <label for="inputemail" class="col-sm-4 col-lg-2 col-md-2 col-xs-4 control-label">Email</label>
    <div class="col-sm-10">
				<input type="email"  name="email" value="<?php echo set_value('email') ;?>" id="email" class="form-control" required placeholder="Enter Your email">
    <span class="text-danger"><?php echo form_error('email'); ?></span>
	</div>
  </div>


  
 
   <div class="form-group">
    <label for="inputpassword" class="col-sm-4 col-lg-2 col-md-2 col-xs-4 control-label"> Password </label>
    <div class="col-sm-10">
				<input type="password" name="password" value="<?php echo set_value('password'); ?>"id="password" class="form-control" required placeholder="Create your own password">
    <span class="text-danger"><?php echo form_error('password'); ?></span>
   </div>
  </div>
  
    <div class="form-group">
    <label for="inputcpassword" class="col-sm-4 col-lg-2 col-md-2 col-xs-4 control-label"> Confirm Password </label>
    <div class="col-sm-10">
				<input type="password" name="cpassword" value="<?php echo set_value('cpassword'); ?>"id="cpassword" class="form-control" required placeholder=" Confirm the same password">
    <span class="text-danger"><?php echo form_error('cpassword'); ?></span>
   </div>
  </div>
  
  		  <div class="form-group">
    <label for="inputgender" class="col-sm-2 control-label">	Gender	 </label>
    <div class="col-sm-10">
	
	<select class="form-control" name="gender" required>
	<option value="" selected="selected" >---SELECT---</option>
		<option  value="Male">Male</option>
		<option value="Female"  >Female</option>
	</select>		 
				
		<span class="text-danger"> <?php echo form_error('gender'); ?>
		
		</span>
	</div>
  </div>
   				<input type="hidden"  name="service" value="yes" id="service" class="form-control" required placeholder="Enter Your service">

			  
    
  <div class="form-group">
						<label for="field-2" class="col-sm-2 control-label">User Type</label>
		                    <div class="col-sm-7">
		                        <select name="usertype" required class="form-control" id="section_selector_holder">
		                            <option value="">--Select User Type--</option>
			                         <option value="admin">admin</option>
									   <option value="tenant">tenant</option>
									    <option value="agent">agent</option>
										<option value="staff">staff</option>

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

			                </div>
	</div>
    
  
  
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-7">
     
	       <button type="submit" name="btn_user"value="user" class="btn btn-primary">Add User</button>

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

  </div>
</div>





