<script type="text/javascript">
    function customerChanged()
    {
      var customers = $('#customers').val();
        $.ajax({ url: "<?php echo base_url('payment/payments/getcustpaymentdetails'); ?>",
           data:{customers: customers},
           dataType: "json",
           type: "POST",
           success: function(data){
                   $("#card").val(data.card);          
                   $("#maxdebt").val(data.maxdebt);
                   $("#debtcurrent").val(data.debtcurrent); 
                   $("#debtdate").val(data.debtdate);

            }
        });

    }
</script>

<!-- Page Content -->
<div class="page-content">

    <!-- Page Header -->
    <div class="page-header position-relative">
        <div class="header-title">
            <h1>
             Customer Payment
         </h1>
     </div>
     <!--Header Buttons-->
     <div class="header-buttons">
        <a class="sidebar-toggler" href="#">
            <i class="fa fa-arrows-h"></i>
        </a>
        <a class="refresh" id="refresh-toggler" href="">
            <i class="glyphicon glyphicon-refresh"></i>
        </a>
        <a class="fullscreen" id="fullscreen-toggler" href="#">
            <i class="glyphicon glyphicon-fullscreen"></i>
        </a>
    </div>
    <!--Header Buttons End-->
</div>
<!-- /Page Header -->
<!-- Page Body -->
<div class="page-body" id="resources">
  <div class="well with-header">  
            <form action="<?= base_url() . 'payment/payments/customerpay/' ?>" method="post">
                <div class="myform-controls" id="id-form">          
                    <div class="row form-group">
                        <div class="col-md-2">                        
                         <label><span style="color:red;">*</span>Customer</label>
                     </div>
                     <div class="col-md-10">      
                      <select name="customers" id="customers" onChange='customerChanged()' class="form-control">
                         <option value="">Please Select</option>
                          <?php foreach ($customers as $customers_list) { ?>
                  
                            <option value="<?php echo $customers_list->ID;?>"><?php echo $customers_list->NAME;?></option>
                          <?php } ?>
                      </select>
                        <?php echo form_error('customers');?>      
                  </div>
              </div>
              <div class="row form-group">
                <div class="col-md-2">                 
                 
                    <label>Card</label>
                </div>
                <div class="col-md-10">  
                    <input name="card" id="card" type="text" disabled="disabled" class="form-control"/>
                </div>
            </div>
            <div class="row form-group">
                <div class="col-md-2"> 
                  <label>Max debt</label>
              </div>
              <div class="col-md-10">  
                 <input name="maxdebt" id="maxdebt" type="text" disabled="disabled" class="form-control"/>
             </div>
         </div>
         <div class="row form-group">
            <div class="col-md-2"> 
                <label>Debt current</label>
            </div>
            <div class="col-md-10">  
                <input name="debtcurrent" id="debtcurrent" type="text" disabled="disabled" class="form-control"/>
            </div>
        </div>
        <div class="row form-group">
            <div class="col-md-2"> 
                <label>Debt date</label>
            </div>
            <div class="col-md-10">  
                <input name="debtdate" id="debtdate" type="text" disabled="disabled" class="form-control"/>
            </div>
        </div>
        

        


        <div class="row form-group">
            <div class="col-md-2">
              <label><span style="color:red;">*</span>Pay Account</label>
              
          </div>
          <div class="col-md-10">
              <input name="cashin" type="text" class="form-control" />
                <?php echo form_error('cashin');?>     
          </div>
      </div>
      <div class="row form-group">
        <div class="col-md-2">
          
            <label>Notes:</label>
        </div>
        <div class="col-md-10">
         <textarea name="notes" rows="" cols="" class="form-control"></textarea>
     </div>
     
 </div>
 <div class="row form-group">
     <div class="col-md-2">
     </div>
     <div class="col-md-10">
       <input type="hidden" name="addw" value="addw" />
       <input class="btn btn-primary" type="submit" value="Submit" name="submit">
       
   </div>
</div>

</div>
</form>
<!-- end id-form  -->

</div>
</div>
<!-- /Page Body -->
</div>
<!-- /Page Content -->

</div>
<!-- /Page Container -->
<!-- Main Container -->
    
</div>

