
	 <link href="<?php echo base_url(); ?>assets/select/chosen.min.css" rel="stylesheet" media="screen">
	
		   
		   		   <script src="<?php echo base_url(); ?>assets/select/chosen.jquery.min.js"></script>

				   
	
        <script>
        $(function() {
<!--             $(".datepicker").datepicker(); -->
<!--             $(".uniform_on").uniform() -->;
            $(".chzn-select").chosen();
   <!--          $('.textarea').wysihtml5(); -->

        });
        </script>
                 
			 


		
<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>
				Update Plot
            	</div>
            </div>
			<div class="panel-body">
<?php
		echo $this->session->flashdata('deletemsg'); 
		   $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'];	
	      $updatehouse=$this->usermodel->populatuserpermissionsdataarray('accomodation','updatehouse',$userid);


		
				echo $this->session->flashdata('msg'); 
		
                 echo form_open('addplot' , 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">Plot Name</label>
    <div class="col-sm-7">
	<input type="hidden" name="action" value="<?php echo set_value('action','update'); ?>"id="action" class="form-control" required >

		<input type="hidden" name="id" value="<?php echo set_value('id',$plot[0]['id']); ?>"id="bookingno" class="form-control" required placeholder="Enter booking number">

		<input type="text" name="name" value="<?php echo set_value('name',$plot[0]['name']) ;?>" id="name" class="form-control" required placeholder="Enter name">
       <span class="text-danger"><?php echo form_error('name'); ?></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',$plot[0]['location']) ;?>" id="exampleInputlocation" class="form-control" required placeholder="Enter  location">
    <span class="text-danger"><?php echo form_error('location'); ?></span>
	</div>
  </div>
  
  
  
					 <div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">Agent Name</label>
    <div class="col-sm-7">
				    	
			  	<select name="agentid"  class="chzn-select" required>
<option value="" >---Select Agent for plot---</option>

	
		
	
					<?php echo $agentid=$plot[0]['agentid'];
	
$agent = $this->accomodationmodel->getagentid($agentid);

if(is_array($agent)) {

   foreach($agent as $agentrow){

    $names=$agentrow->lastname. "  ".$agentrow->firstname ; 
    ?>
	    <option  selected="selected" value="<?php echo set_value('agentid',$agentrow->id); ?> "><?=$agentrow->lastname." ".$agentrow->firstname." IDNO ".$agentrow->idno;?></option>

	
	<?php

}} else {
    ?>
	    <option   value="<?php echo set_value('agentid',$agentid); ?> "><?=$agentid?></option>

	
	<?php
}
						


$allagents = $this->accomodationmodel->populateallagent();


if(is_array($allagents)) {

   foreach($allagents as $agentrow){

    ?>
	    <option value="<?php echo set_value('agentid',$agentrow->id); ?> "><?=$agentrow->lastname." ".$agentrow->firstname;?></option>

   
    <?php

}} else {
    echo 'There is no other  agent for this house.... Please add landlord first.';
}
?>
	</select>
				

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

  
					 <div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">Landlord Name</label>
    <div class="col-sm-7">
				    	
			  	<select name="landlordid"  class="chzn-select" required>
<option value="" >---Select Landlord for plot---</option>

	
		
	
					<?php $landlordid=$plot[0]['landlordid'];
	
$landlords = $this->accomodationmodel->getlandlordid($landlordid);
								


if(is_array($landlords)) {

   foreach($landlords as $landlordsrow){

    $names=$landlordsrow->lastname. "  ".$landlordsrow->firstname ; 
    ?>
	    <option  selected="selected" value="<?php echo set_value('landlordid',$landlordsrow->id); ?> "><?=$landlordsrow->lastname." ".$landlordsrow->firstname." IDNO ".$landlordsrow->idno;?></option>

	
	<?php

}} else {
    ?>
	    <option   value="<?php echo set_value('landlordid',$landlordid); ?> "><?=$landlordid?></option>

	
	<?php
}
						

$landlord = $this->accomodationmodel->populatealllandlord();


if(is_array($landlord)) {

   foreach($landlord as $landlordrow){

    ?>
	    <option value="<?php echo set_value('landlord',$landlordrow->id); ?> "><?=$landlordrow->lastname." ".$landlordrow->firstname;?></option>

   
    <?php

}} else {
    echo 'There is no other  landlord for this house.... Please add landlord first.';
}
?>
	</select>
				

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

   <div class="form-group">
    <label for="inputphone3" class="col-sm-2 control-label">Total Houses </label>
    <div class="col-sm-7">
				<input type="phone" name="totalhouse" value="<?php echo set_value('totalhouse',$plot[0]['totalhouse']); ?>" id="totalhouse" class="form-control" required placeholder="Enter total house">
    <span class="text-danger"><?php echo form_error('totalhouse'); ?></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">

								  
								 
								  	<?php
									
									
												
 $countryid= $plot[0]['country'];
$country = $this->accomodationmodel->getcountrybyid($countryid);


if(is_array($country)) {

   foreach($country as $countryrow){

    ?>
	    <option 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.';
}
								
$country = $this->accomodationmodel->populateallcountries();


if(is_array($country)) {

   foreach($country as $countryrow){

    ?>
	    <option 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.';
}

?>
			  
		                            <option value="">--Select Country--</option>
			                        
			                    </select>
								     <span class="text-danger"><?php echo form_error('country'); ?></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',$plot[0]['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',$plot[0]['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="inputcommission" class="col-sm-2 control-label">Commission(%) </label>
    <div class="col-sm-7">
				<input type="commission" name="commission" value="<?php echo set_value('commission',$plot[0]['commission']); ?>" id="idno" class="form-control"  placeholder="Enter  commission (%)">
    <span class="text-danger"><?php echo form_error('commission'); ?></span>
   </div>
  </div>
  
   <div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">Description </label>
    <div class="col-sm-7">
	<textarea name="description" id="ttt" rows="5" placeholder="add Description" class="form-control"><?php echo set_value('description',$plot[0]['description']); ?></textarea>
    <span class="text-danger"><?php echo form_error('description'); ?></span>
   </div>
  </div>
    
  
  

                    
					
					<?php
					 if( $updatehouse==true){
	 ?>
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-7">
     
	       <button type="submit" name="btn_plot"value="plot" class="btn btn-primary">Update Plot</button>

    </div>
  </div>


	 	<?php	

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





