

	 <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>
             <script type="text/javascript">
  
		
		 $(document).on("click", "#managebtndelete", function()
        {
          var itemid = $(this).data('id');
		  $("#itemid1").val(itemid); 
		  
		    var plotno = $(this).data('plotno');
		   $("#plotno1").val(plotno); 
		   
		   
        });
		
		
		
    </script>  

	</div>      
<ul class="nav nav-tabs bordered">
			<li class="active">
            	<a href="#list" data-toggle="tab"><i class="entypo-menu"></i> 
					All charges to this plot
                    	</a></li>
			<li>
            	<a href="#add" data-toggle="tab"><i class="entypo-plus-circled"></i>
					Add other charges

                    	</a></li>
						
						
							<li>
					                     <a class="btn btn-primary"  id="more" href="<?php echo base_url();?>admin/viewallpaymentcharge">View all charges available </a>


							</li>
						
						
						
							<li>
            									 <a href="<?php echo base_url(); ?>admin/viewpallmyplots">Back </a>


							</li>
						
						
						
		</ul>
    	<!------CONTROL TABS END------>
        
		<div class="tab-content">
		<?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'];	
				echo $this->session->flashdata('msg'); 
			?>
            <!----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" width="100%">
             <thead>
			
         <tr>
  
	<th>Plot Number</th>
	<th>Charge Name</th>
	<th>Charge Cost</th>
    <th>Status</th>         
	<th>Description</th> 
	<th>Date created</th> 
	<Th>Action</th>
		<Th>More</th>

                 </tr>
             </thead>
<?php

 if(!is_array($plotcharges)) 

 {



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

		 

             ?>



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

             
				<td><?php echo $c->plotno ; ?></td> 
				<td><?php  $chargeid=$c->chargeid ; 
				
$chargesbyid = $this->accomodationmodel->getchargesbyid($chargeid);
								


if(is_array($chargesbyid)) {

   foreach($chargesbyid as $chargesbyidrow){

   echo $chargesbyidrow->type ; 

}} else {
    echo 'There is no charge in the system.... try again.';
}
				
				
				?></td> 
				<td><?php echo $c->cost ; ?></td> 
					<td><?php echo $c->status ; ?></td> 

                 <td><?php echo $c->description ; ?></td>
                     <td><?php echo $c->createdat; ?></td>   
					   <td>
                     <a class="btn btn-primary"  id="more" href="<?php echo base_url();?>admin/edicharge?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-plotno='<?php echo  $c->plotno;?>'  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>
<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="plotcharges">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="admin/plotcharges?randomitemidentifier=<?php echo $plotno;?>">
 <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 Charge
            	</div>
            </div>
			<div class="panel-body">





				<?PHP
		
                 echo form_open('addplotcharge' , 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="inputhouseno" class="col-sm-2 control-label">Plot Number</label>
    <div class="col-sm-7">
			  		<input type="text" name="plotno" value="<?php  echo $plotno ; ?>"id="houseno" class="form-control" required placeholder="Enter plot number">

  		<input type="hidden" name="action" value="<?php echo set_value('action','insert'); ?>"id="action" class="form-control" required >

     <span class="text-danger"><?php echo form_error('plotno'); ?></span>
   </div>
  </div>
  
 
	  <div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">Charge Name</label>
    <div class="col-sm-7">
				    	
			  	<select name="chargeid" class="form-control" required>
<option value="" >---Select charges to Invoice---</option>

		<?php 

//$nation = $this->nationmodel->populatenation();


if(is_array($charges)) {

   foreach($charges as $chargesrow){

    ?>
	    <option value="<?php echo set_value('chargeid',$chargesrow->id); ?> "><?=$chargesrow->type?></option>

   
    <?php

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

?>
	</select>
				

	  <span class="text-danger"><?php echo form_error('amount'); ?></span>
	</div>
  </div>			
  
 <div class="form-group">
    <label for="inputcost" class="col-sm-2 control-label">Amount</label>
    <div class="col-sm-7">
				<input type="text" name="cost" value="<?php echo set_value('cost'); ?>" id="cost" class="form-control" required placeholder="Enter cost of the charge">
        <span class="text-danger"><?php echo form_error('cost'); ?></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" class="form-control" id="section_selector_holder">
		                            <option value="">--Select status--</option>
			                         <option selected="selected" value="active">active</option>
									   <option value="inactive">inactive</option>
			                    </select>
								     <span class="text-danger"><?php echo form_error('status'); ?></span>
			                </div>
	</div>
					
    <div class="form-group">
						<label for="field-2" class="col-sm-2 control-label">Activate All?</label>
		                    <div class="col-sm-7">
		                        <select name="bulkactivation" required class="form-control" id="section_selector_holder">
		                            <option selected="selected" value="">--Activate this charge in all rooms?--</option>
			                         <option  value="yes">Yes</option>
									   <option value="no">No</option>
			                    </select>
								     <span class="text-danger"><?php echo form_error('bulkactivation'); ?></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 Description" 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_charge"value="charge" class="btn btn-primary">Add Charge</button>

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


   </div>
</div>




			