<div class="container-fluid py-5" style="background:rgb(244,244,244)">
    
     <h3 class="text-center py-2">Setting</h3>
    
         <?php 
	$success=$this->session->flashdata('message_name');
	$error=$this->session->flashdata('error');
	
	if(!empty($success)) { ?>

	<div class="alert alert-success col-md-6 mx-auto py-1 rounded-0 mb-3">
	<strong>Success!</strong> <?php echo $this->session->flashdata('message_name'); ?>
	</div>

	<?php } ?>
	<?php if(!empty($error)) { ?>

	<div class="alert alert-danger col-md-6 mx-auto py-1 rounded-0 mb-3">
	<strong>Error!</strong> <?php echo $this->session->flashdata('error'); ?>
	</div>

	<?php } ?>
	
	
	
	<div class="d-flex justify-content-end gap-3">
	   <!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#chargeModal">
  Add Charges
</button>

<div>
   
    <?php
      
      $sql = $this->Login_model->Select('tbl_cod_sts', '*', array());
  $st = '3' ;
   if(!empty($sql)){
       $st = $sql[0]->status;
  if($st == '0'){
      $clr = 'success';
      $contnet = 'COD ON' ;
  }else{
      $clr = 'danger';
      $contnet = 'COD OFF' ;
  }
   }else{
       
        $clr = 'danger';
      $contnet = 'ADD COD STATUS' ;
   }
      ?>
    
  
    <a role="button" href="<?=base_url()?>Admin/cod_status/<?=$st?>" class="btn btn-<?=$clr;?>" >
  <?=$contnet;?>
</a>
    
</div>

	</div>
	
 
<!-- Modal for add convence charge -->
<div class="modal fade" id="chargeModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Convenience Charge</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      	<form action="<?=base_url()?>Admin/conven_charge" method="post"  enctype="multipart/form-data" >
      <div class="modal-body">
        
        	    	<div class="form-group  ">
							<label for="input_first_name" class="col-sm-3 control-label">Enter Charge <em class="text-danger">*</em></label>
							<div class="col-sm-offset-1">
								<input class="form-control" id="input_first_name" placeholder="" name="charge" type="number"   required>
								
							</div>
						</div>
						
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
        <button type="submit" class="btn btn-primary">Submit</button>
      </div>
      </form>
    </div>
  </div>
</div>



<table class="table bg-white mt-2">
  <thead>
    <tr>
   
      <th scope="col">Date</th>
      <th scope="col">Convenince Charge</th>
      <th scope="col">Status</th>
      <th scope="col">Action</th>
    </tr>
  </thead>
  <tbody>
      <?php
      
      $sql = $this->Login_model->Select('tbl_conv_charge', '*', array());
   
      ?>
      <?php     foreach ($sql as $k) { ?>
    <tr>
      <td><?=$k->created_at?></td>
        <td><?=$k->amt?></td>
         <td><?php
         
         if($k->status == 0){
             echo '<span class="text-success">Active</span>';
         }else{
             echo '<span class="text-warning">InActive</span>';
         }
         
         
         
         
         ?></td>
         
         <td><a href="#" class="btn btn-secondary" role="button" data-bs-toggle="modal" data-bs-target="#staticBackdrop<?=$k->id?>">Edit</a>
         
         
         </td>
         
         
         <div class="modal fade" id="staticBackdrop<?=$k->id?>" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Convenience Charge</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      	<form action="<?=base_url()?>Admin/conven_charge" method="post"  enctype="multipart/form-data" >
      <div class="modal-body">
        
        	    	<div class="form-group  ">
							<label for="input_first_name" class=" fw-bold control-label">Enter Charge <em class="text-danger">*</em></label>
							<div class="col-sm-offset-1">
								<input class="form-control" id="input_first_name" placeholder="" name="charge" type="number"  value="<?=$k->amt?>"  required>
								<input type="hidden" name ="ch_id" value="<?=$k->id?>" > 
							</div>
						</div>
						
						
							<div class="form-group  ">
							<label for="input_first_name" class="fw-bold control-label">Change Status <em class="text-danger">*</em></label>
							<div class="col-sm-offset-1">
							<select class="form-control form-control-select" name="status" required>
							    
							    <option value="0" selected>Active</option>
							    <option value="1">InActive</option>
							</select>
							</div>
						</div>
						
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
        <button type="submit" class="btn btn-primary">Submit</button>
      </div>
      </form>
    </div>
  </div>
</div>
    </tr>
    
      <?php 

        
            } ?>
    
  
  </tbody>
</table>
    
    
    
    
    
    
    
</div>


