	      <script type="text/javascript">
  
		
		 $(document).on("click", "#managebtndelete", function()
        {
          var itemid = $(this).data('id');
		  $("#itemid1").val(itemid); 
		  
		  
		   
        });
		
		
		
    </script>  
<div class="row">
	<div class="col-md-12">
    
    	<!------CONTROL TABS START------>
		<ul class="nav nav-tabs bordered">
			<li class="active">
            	<a href="#list" data-toggle="tab"><i class="entypo-menu"></i> 
					All Managers
                    	</a></li>
			<li>
            	<a href="#add" data-toggle="tab"><i class="entypo-plus-circled"></i>
					Add Managers
                    	</a></li>
							<li>
            	
								 <a href="<?php echo base_url(); ?>admin/viewpallmyplots">Back</a>

				</li>					 

						
						
		</ul>
    	<!------CONTROL TABS END------>
        
		<div class="tab-content">
            <!----TABLE LISTING STARTS-->
            <div class="tab-pane box active" id="list">
				
     
		


  <div class="panel panel-primary" data-collapsed="0">
<table id="example"  cellspacing="1" class="table table-bordered datatable" width="100%">
             <thead>
		
         <tr>
    
    <th>agent Name </th>
	<th>Location</th>
	   <th>IDNO Number</th>
    <th>Phone Number</th>         
	<th>Country</th> 
	<th>Date created</th> 
	<th>Update</th> 

	<th>More</th> 


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

 {


    
       echo '<div class="alert alert-warning text-center">There is no agent found by now from system..</div>';

    }else {
?>
    
             <?php 
  
  	foreach ($agent as $c): 

		 

             ?>



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


?>

             <td><?php echo $c->firstname ;$c->lastname  ; ?></td> 
				<td><?php echo $c->location ; ?></td> 
	<td><?php echo $c->idno ; ?></td> 
					<td><?php echo $c->phone ; ?></td> 

                 <td><?php 
$countryid=  $c->country ;
$country = $this->accomodationmodel->getcountrybyid($countryid);


if(is_array($country)) {

   foreach($country as $countryrow){

 echo $countryrow->name;
}} else {
      echo $countryid;
}
	
 ?></td>
				 
				 
	
                     <td><?php echo $c->createdat; ?></td>   
                     <td>
                     <a  id="more" class="btn btn-primary"  href="<?php echo base_url();?>admin/editagent?randomitemidentifier=<?php   {echo  $id;}  ?>">Update  </a>
         </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='#myModal<?php  $c->id; ?>'>	 


                                                <i class="glyphicon glyphicon-pencil"></i>
																Delete
                                                </a>
                                                        </li>
									
									
                                        <li class="divider"></li>
                                        
                                        <!-- teacher DELETION LINK -->
                                        
                                    </ul>
											<?php
										}
										?>
                                </div>
</td>
             </tr>

             <?php endforeach; ?>

              <?php }?>

        </table>

</div>
			</div>
            <!----TABLE LISTING ENDS--->
            
                    <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 $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="agent">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="admin/viewallagents">
 <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>
			<!----CREATION FORM STARTS---->
			<div class="tab-pane box" 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 Manager
            	</div>
            </div>
			<div class="panel-body">





				<?PHP
				echo $this->session->flashdata('msg'); 
		
                 echo form_open('addagent' , 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">
<input type="hidden" name="action" value="<?php echo set_value('action','insert'); ?>"id="action" class="form-control" required placeholder="Enter action">


    <label for="inputfirstname" class="col-sm-2 control-label">First Name</label>
    <div class="col-sm-7">
		  		<input type="text" name="firstname" value="<?php echo set_value('firstname'); ?>"id="firstname" class="form-control" required placeholder="Enter firstname">
     <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</label>
    <div class="col-sm-7">
		<input type="text" name="lastname" value="<?php echo set_value('lastname') ;?>" id="lastname" class="form-control" required placeholder="Enter lastname">
       <span class="text-danger"><?php echo form_error('lastname'); ?></span>
   </div>
  </div>
    <div class="form-group">
    <label for="inputlocation" class="col-sm-2 control-label">Location</label>
    <div class="col-sm-7">
				<input type="text" name="location" value="<?php echo set_value('location') ;?>" id="exampleInputlocation" class="form-control"  placeholder="Enter Your location">
    <span class="text-danger"><?php echo form_error('location'); ?></span>
	</div>
  </div>
  <div class="form-group">
    <label for="inputphone" class="col-sm-2 control-label">Phone Number</label>
    <div class="col-sm-7">
				<input type="text" name="phone" value="<?php echo set_value('phone'); ?>" id="phone" class="form-control"  placeholder="Enter Your phone">
        <span class="text-danger"><?php echo form_error('phone'); ?></span>
	</div>
  </div>
   <div class="form-group">
    <label for="inputEmail" class="col-sm-2 control-label">Email</label>
    <div class="col-sm-7">
				<input type="email" name="email" value="<?php echo set_value('email') ;?>" id="exampleInputEmail" 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="inputphone3" class="col-sm-2 control-label">Id Number </label>
    <div class="col-sm-7">
				<input type="phone" name="idno" value="<?php echo set_value('idno'); ?>" id="idno" class="form-control"  placeholder="Enter IDNO">
    <span class="text-danger"><?php echo form_error('idno'); ?></span>
   </div>
  </div>
  <div class="form-group">
						<label for="field-2" class="col-sm-2 control-label">Country</label>
		                    <div class="col-sm-7">
		                        <select name="country" class="form-control" id="section_selector_holder">
		                            <option value="">--Select Country--</option>
									   <?php
									$country = $this->accomodationmodel->populateallcountries();


if(is_array($country)) {

   foreach($country as $countryrow){

    ?>
	    <option selected value="<?php echo set_value('country',$countryrow->id); ?> "><?=$countryrow->name;?></option>

   
    <?php

}} else {
    echo 'There is no other  country for this house.... Please add country first.';
}

?>
			                        
			                    </select>
								     <span class="text-danger"><?php echo form_error('country'); ?></span>
			                </div>
	</div>
	
	
	 <div class="form-group">
						<label for="field-2" class="col-sm-2 control-label">County</label>
		                    <div class="col-sm-7">
		                        <select name="county" class="form-control" id="section_selector_holder">
		                            <option selected="selected" value="">--Select County--</option>
									   <?php
									$county = $this->accomodationmodel->populateallallacounties();


if(is_array($county)) {

   foreach($county as $countyrow){

    ?>
	    <option selected value="<?php echo set_value('county',$countyrow->id); ?> "><?=$countyrow->name;?></option>

   
    <?php

}} else {
    echo 'There is no other  county for this house.... Please add county first.';
}

?>
			                        
			                    </select>
								     <span class="text-danger"><?php echo form_error('county'); ?></span>
			                </div>
	</div>
	
	
	
	
	
	
	
		  <div class="form-group">
						<label for="field-2" class="col-sm-2 control-label">Gender</label>
		                    <div class="col-sm-7">
		                        <select name="gender" class="form-control" id="section_selector_holder">
		                            <option value="">--Select Gender--</option>
			                         <option value="Male">Male</option>
									   <option value="Female">Female</option>
			                    </select>
							 <span class="text-danger"><?php echo form_error('gender'); ?></span>

			                </div>
	</div>			
     <div class="form-group">
    <label for="inputaccountname" class="col-sm-2 control-label">Account Name</label>
    <div class="col-sm-7">
				<input type="accountname" name="accountname" value="<?php echo set_value('accountname'); ?>" id="idno" class="form-control"  placeholder="Enter account name">
    <span class="text-danger"><?php echo form_error('accountname'); ?></span>
   </div>
  </div>
  
  
    
   <div class="form-group">
    <label for="inputaccountno" class="col-sm-2 control-label">Account Number</label>
    <div class="col-sm-7">
				<input type="accountno" name="accountno" value="<?php echo set_value('accountno'); ?>" id="idno" class="form-control"  placeholder="Enter  account number">
    <span class="text-danger"><?php echo form_error('accountno'); ?></span>
   </div>
  </div>
  
  
   <div class="form-group">
    <label for="inputphone3" class="col-sm-2 control-label">Description </label>
    <div class="col-sm-7">
	<textarea name="description" id="ttt" rows="5" placeholder="add message" class="form-control"></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-7">
     
	       <button type="submit" name="btn_agent"value="agent" class="btn btn-primary">Add Manager</button>

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



	</div>
</div>









