

	 <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 Advance
            	</div>
            </div>
			<div class="panel-body">

				 <a class="btn btn-info" href="<?php echo base_url(); ?>admin/viewalladvance">Go back</a>

				 <a class="btn btn-info" href="<?php echo base_url(); ?>admin/viewpallmyplots">Book A room</a>



				<?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('msg'); 
		
                 echo form_open('admin/addadvancebooking' , 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="myid"    value="<?php echo set_value('myid',$advance[0]['id']); ?>"  class="form-control">

					 <input type="hidden" name="action"    value="update"  class="form-control">


					 <input type="hidden" name="view"    value="admin/editadvance?randomitemidentifier=<?php echo$advance[0]['id']; ?>"  class="form-control">


	  <div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">Customer Name</label>
    <div class="col-sm-7">
				    	
			  	<select name="tenantid"  class="chzn-select" required>

		<?php 
$tenantid=$advance[0]['tenantid'];
//$nation = $this->nationmodel->populatenation();
	 					$mytenant = $this->usermodel->populateall('people', 'id',$tenantid);


if(is_array($mytenant)) {

   foreach($mytenant as $mytenantrow){

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

   
    <?php

}} else {
}
	
		 					$mytenant = $this->usermodel->populateall('people', 'companyid',$companyid);


if(is_array($mytenant)) {

   foreach($mytenant as $mytenantrow){

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

   
    <?php

}} else {
    echo 'There is no customer.';
}
	


?>
	</select>

   </div>
  </div>

  
   <div class="form-group">
    <label for="inputamount" class="col-sm-2 control-label">Cash Paid</label>
    <div class="col-sm-7">
				<input type="text" name="amount" value="<?php echo set_value('amount',$advance[0]['amount']); ?>" id="amount" class="form-control" required placeholder="Enter amount">
        <span class="text-danger"><?php echo form_error('amount'); ?></span>
	</div>
  </div>

	 
   <div class="form-group">
    <label for="inputbalance" class="col-sm-2 control-label">Balance so far</label>
    <div class="col-sm-7">
				<input type="text"    name="balance" value="<?php echo set_value('balance',$advance[0]['balance']); ?>" id="balance" class="form-control" required placeholder="Enter balance ">
        <span class="text-danger"><?php echo form_error('balance'); ?></span>
	</div>
  </div>

		  <div class="form-group">
						<label for="field-2" class="col-sm-2 control-label">Status</label>
		                    <div class="col-sm-7">
		                        <select name="status" required class="form-control" >
				 <option selected value="<?= $advance[0]['status']  ?>"><?= $advance[0]['status']  ?></option>

			                         <option value="active">active</option>
									   	 <option value="closed">closed</option>

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

			                </div>
	</div>			
  
   
			   <div class="form-group">
    <label for="inputphone3" class="col-sm-2 control-label">Start  Date </label>
    <div class="col-sm-7">
				<input type="phone" readonly name="startdate" value="<?php echo set_value('startdate',$advance[0]['startdate']); ?>" id="idno" class="form-control"  placeholder="Enter Entry date">
    <span class="text-danger"><?php echo form_error('startdate'); ?></span>
   </div>
  </div>
  	  

		
		
   <div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">Close Date</label>
    <div class="col-sm-7">
				<input type="text" name="closedate" value="<?php echo set_value('closedate',$advance[0]['closedate']); ?>" id="idno" class="form-control" required placeholder="Enter End  Date">
        <span class="text-danger"><?php echo form_error('closedate'); ?></span>
	</div>
  </div>
		
 
		

	  
	     <div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">Created Date</label>
    <div class="col-sm-7">
				<input type="text" name="createdat" value="<?php echo set_value('createdat',$advance[0]['createdat']); ?>" id="idno" class="form-control" required placeholder="Enter Start Date">
        <span class="text-danger"><?php echo form_error('createdat'); ?></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"><?php echo set_value('description',$advance[0]['description']); ?></textarea>
    <span class="text-danger"><?php echo form_error('description'); ?></span>
   </div>
  </div>
    
  
	   <div class="form-group">
   <label for="inputplotno" class="col-sm-2 control-label"> </label>

  
  <div class="col-sm-2">
					<div class="form-group">

                     		  		<input type="text" name="plotno" value="<?php echo set_value('plotno',$advance[0]['plotno']); ?>" class="form-control"  placeholder="Enter plot/House no ">

					</div>
				</div>
				<div class="col-sm-5">
					<div class="form-group">
					
                     		  		<input type="text" name="houseno" value="<?php echo set_value('houseno',$advance[0]['houseno']); ?>" class="form-control"  placeholder="Enter Rooms no ">


					</div>
				</div>
			
	</div>
			
  
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-7">
     
	       <button type="submit" name="btn_advance"value="advance" class="btn btn-primary">Update advance Booking</button>

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





