<script type="text/javascript">
        function supplierChanged()
          {
         var suppliers = $('#suppliers').val();
        $.ajax({ url: "<?php echo base_url('payment/payments/getsupplierpaymentdetails'); ?>",
             data:{suppliers: suppliers},
            dataType: "json",
            type: "POST",
            success: function(data){
                $("#card").val(data.card);          
                   $("#maxcredit").val(data.maxcredit);
                   $("#creditcurrent").val(data.creditcurrent); 
                   $("#creditdate").val(data.creditdate);
            }
        });

    }
</script>

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

    <!-- Page Header -->
    <div class="page-header position-relative">
        <div class="header-title">
            <h1>
             Supplier 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/supplierpay/' ?>" 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>Supplier</label>
                     </div>
                     <div class="col-md-10">            
                       <select name="suppliers" id="suppliers" onChange='supplierChanged()' class="form-control">
                           <option value="">Please Select</option>
                          <?php foreach ($supplier as $supplier_list) { ?>
                       
                            <option value="<?php echo $supplier_list->ID;?>"><?php echo $supplier_list->NAME;?></option>
                          <?php } ?>
                      </select> 
                      <?php echo form_error('suppliers');?>                                              
                  </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 credit</label>
              </div>
              <div class="col-md-10">  
                 <input name="maxcredit" id="maxcredit" type="text" disabled="disabled" class="form-control"/>
             </div>
         </div>
         <div class="row form-group">
            <div class="col-md-2"> 
                <label>Credit current</label>
            </div>
            <div class="col-md-10">  
                 <input name="creditcurrent" id="creditcurrent" type="text" disabled="disabled" class="form-control"/>
            </div>
        </div>
        <div class="row form-group">
            <div class="col-md-2"> 
                 <label>Credit date</label>
            </div>
            <div class="col-md-10">  
                  <input name="creditdate" id="creditdate" 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>

