HEX
Server: Apache/2.4.41 (Amazon) OpenSSL/1.0.2k-fips PHP/5.6.40
System: Linux ip-172-31-40-18 4.14.146-93.123.amzn1.x86_64 #1 SMP Tue Sep 24 00:45:23 UTC 2019 x86_64
User: apache (48)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: /var/www/html/taxicamera/application/views/admin/driver_refund_settlement/bond_refund_procedure.php
<div class="main-content">
  <div class="content-wrapper">
    <div class="container-fluid">
    <?php if ($this->session->flashdata('success_msg')) : ?>
				<div class="alert alert-success">
					<a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">×</a>
					<?php echo $this->session->flashdata('success_msg') ?>
				</div>
			<?php endif ?>
			<?php if ($this->session->flashdata('error_msg')) : ?>
				<div class="alert alert-danger">
					<a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">×</a>
					<?php echo $this->session->flashdata('error_msg') ?>
				</div>
			<?php endif ?>
      <!-- Basic form layout section start -->
      <section id="basic-form-layouts">
      	<div class="row">
      		<div class="col-md-12">
      			<div class="card">
      				<div class="card-header">
      					<div class="page-title-wrap">
      						<h4 class="card-title">Bond Refund Procedure</h4>
      						<a class="title_btn t_btn_list" href="" data-toggle="modal" data-target="#default1"> Add Refund</a>
      					</div>
      				</div>
      				<div class="card-body">
      					<div class="px-3">
      						<form class="form custom_form_style">
      							<div class="form-body">      							
      								<div class="row">      									
      										<div class="table-responsive custom_table_area">
      											<table class="table table-striped table-bordered dom-jQuery-events c_table_style">
                                  <thead>
                                      <tr>
      																	<th>Sl. No</th>
      																	<th>DC</th>
      																	<th>Driver Name</th>
      																	<th>Total Bond Amount</th>
                                        <th>Bond Refund Remaining</th>
      																	<th>Refund Type </th>
      																	<th>Refund Amount</th>
      																	<th>Notice Date</th>
      																	<th>Bond Refund Due Date</th>
      																	<th>Settlement Date</th>
      																	<th>Action</th>
                                      </tr>
                                  </thead>
                                  <tbody>
                                  <?php if($driver_refund_settlement): ?>
                                  <?php   foreach($driver_refund_settlement as $key => $list): 
                                            if($list['middle_name']!=''){
                                              $middle_name  = $list['middle_name'].' ';
                                            }
                                            else{
                                              $middle_name  ='';
                                            }
                                  ?>
                                              <tr>
                                                  <td><?php echo $key+1; ?></td>
                                                  <td><?php echo $list['dc_no']; ?></td>
                                                  <td><?php echo $list['first_name'].' '.$middle_name.$list['last_name']; ?></td>
                                                  <td><?php echo $list['bond_amt']; ?></td>
                                                  <td><?php echo $list['bond_accumulated_amt']; ?></td>
                                                  <td><?php echo $list['refund_type']; ?></td>
                                                  <td><?php echo $list['refund_amt']; ?></td>
                                                  <td><?php echo $list['notice_dt']; ?></td>
                                                  <td><?php echo date('d/m/Y',strtotime($list['bond_refund_due_dt'])); ?></td>                                                  
                                                  <td><?=!empty($list['last_settlement_date'])?date('d/m/Y H:i:s',strtotime($list['last_settlement_date'])):'N/A' ?></td>                                                  
                                                  <td>
                                                    <?php if($list['refund_settlement_flag'] =='0'):?>
                                                      <a href="<?php echo base_url().'admin/DriverRefundSettlement/bondRefundSettle/'.$list['dr_refund_settlement_id']; ?>" id="<?php echo $list['dr_refund_settlement_id']; ?>" class="ser_book_btn">Settle</a>
                                                    <?php else: ?>
                                                      <a href="javascript:void(0);" class="ser_book_btn btn-info">Settled</a>  
                                                    <?php endif; ?>      
                                                  </td>  
                                              </tr>
                                  <?php   endforeach; ?>
                                  
                                  <?php endif; ?>    
                                  </tbody>
                              </table>
      									</div>
      								</div>
      							</div>
      						</form>
      					</div>                
      				</div>
      			</div>            
      		</div>
      	</div>
      </section>
      <!-- // Basic form layout section end -->      
    </div>
  </div>
</div>
<script>
$(document).on("change","#driver_list",function(){
    var driver_id = $(this).val();
    $.ajax({
        type: "POST",
        url: '<?php echo base_url('admin/DriverRefundSettlement/ajaxDriverSettlementData')?>',
        data:{driver_id : driver_id},
        dataType:'json',
        success: function(response){
          //alert(response['driver_id']);
          if(response['previous_refund_not_settle'] !='0'){
            $("#bond_amt").val(response['bond_amt']);
            $("#driver_id").val(response['driver_id']);
            // alert(Number(response['bond_amt']));
            // alert(Number(response['bond_accumulated_amt']));
             
            $("#bond_accumulated_amt").val(parseFloat(Number(response['bond_amt']) - Number(response['bond_accumulated_amt'])).toFixed(2));
          }
          else{
            
            $("#driver_list").val('').trigger('change');
            $("#driver_id").val('');
            $.alert({
              type: 'red',
              title: 'Alert!',
              content: 'Previous refund not settled.',
            });
            //$("#driver_refund_modal").html('Previous refund not settled.');
            //$("#driver_refund_modal").css('color','red');
          }        
        },
        error:function(response){
          alert("error");
        }
    });
})
$(document).ready(function(){
    
  var notice_date       = $('#notice_date').pickadate({format:'dd/mm/yyyy',autoclose:true,max: new Date()}),
  notice_dt_picker      = notice_date.pickadate('picker');

  var bond_refund_due_dt    = $('#bond_refund_due_dt').pickadate({format:'dd/mm/yyyy',autoclose:true}),
  bond_refund_due_dt_picker = bond_refund_due_dt.pickadate('picker');
    
  // Check if there’s a “from” or “to” date to start with.
  if ( notice_dt_picker.get('value') ) {
      bond_refund_due_dt_picker.set('min',notice_dt_picker.get('select'))
  }
  if ( bond_refund_due_dt_picker.get('value') ) {
      notice_dt_picker.set('max', bond_refund_due_dt_picker.get('select'))
  }

  // When something is selected, update the “from” and “to” limits.
  notice_dt_picker.on('set', function(event) {
  
    if ( event.select ) {
      bond_refund_due_dt_picker.set('min',notice_dt_picker.get('select'));    
    }
    else if ( 'clear' in event ) {
      bond_refund_due_dt_picker.set('min', false);
    }
  })

  bond_refund_due_dt_picker.on('set', function(event) {
  
    if ( event.select ) {
      notice_dt_picker.set('max', bond_refund_due_dt_picker.get('select'));    
    }
    else if ( 'clear' in event ) {
      notice_dt_picker.set('max', false);
    }
  })
  $(".js-select2").select2({
      dropdownParent: $('#default1')
  });
});
</script>

<style>
  #notice_date_table tr td, #bond_refund_due_dt_table tr td{
    padding: 0; 
  }
  .input-group, .select2.select2-container .select2-selection {
    margin-bottom: 0;
}
</style>
</body>
</html>