<?php $__env->startSection('css'); ?>
<style>
  .select2 {
    width: 100% !important;
    padding-top: 10px;
    border: 1px solid #d2d6de;
    padding-left: 5px;
  }

  li[aria-disabled="true"] {
    background-color: gainsboro !important;
    font-weight: bold !important;
  }

  .center-div {
    width: 60%;
    margin: 0 auto
  }

  .step {
    border: none !important;
  }
</style>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<?php Fun::lang() ?>
<!--Model-->
<div class="modal fade bs-modal-lg" id="view-clientinstallment-info" tabindex="-1" role="dialog" aria-hidden="true">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
        <h3 class="modal-title">Client Information</h3>
      </div>
      <div id="_div_paymentPopup" style="display:none;" class="alert alert-block alert-danger fade in">
        <h4 class="alert-heading">Warning!</h4>
        <p id="_msg_paymentPopup"></p>
      </div>

      <div style="display:none;" class="alert-message alert-success" role="alert" id="done">
        <h4 class="alert-heading">Successfully!</h4>
        <hr>
        <p class="mb-0">Data has been saved successfully!</p>
      </div>
      <br />
      <div class="row" style="margin: 10px;">
        <div class="form-group col-sm-6 col-xs-12">
          <label class="required">Client Firstname</label>
          <?php echo Form::text('client_firstname', null, array('placeholder' => 'Client Fullname','class' => 'form-control','required','id'=>"client_firstname")); ?>

        </div>
        <div class="form-group col-sm-6 col-xs-12">

          <label>Client Lastname</label>
          <?php echo Form::text('client_lastname', null, array('placeholder' => 'Client Nickname','class' => 'form-control','id'=>"client_lastname")); ?>

        </div>
        <div class="form-group col-sm-6 col-xs-12">

          <label class="required">Gender</label>
          <select name="client_gender" id="client_gender" class="form-control">

          </select>

        </div>
        <div class="form-group col-sm-6 col-xs-12">

          <label class="required">Client DOB</label>
          <?php echo Form::text('client_dob', null, array('placeholder' => 'Client DOB','class' => 'form-control date_picker','required','id'=>"clientDOB")); ?>


        </div>
      </div>
      <div class="row" style="margin: 10px;">
        <div class="form-group col-sm-6 col-xs-12">

          <label>Job</label>
          <?php echo Form::text('client_job', null, array('placeholder' => 'Job','class' => 'form-control','id'=>"clientJOB")); ?>


        </div>
        <div class="form-group col-sm-6 col-xs-12">

          <label>Workplace</label>
          <?php echo Form::text('client_workplace', null, array('placeholder' => 'Workplace','class' => 'form-control','id'=>"clientworkplace")); ?>


        </div>
        <div class="form-group col-sm-6 col-xs-12">

          <label class="required">Nationality</label>
          <?php echo Form::text('client_national', null, array('placeholder' => 'Nationality','class' => 'form-control','required','id'=>'client_nate')); ?>


        </div>
        <div class="form-group col-sm-3 col-xs-12">

          <label class="required">Phone</label>
          <?php echo Form::text('client_phone1', null, array('placeholder' => 'Phone','class' => 'form-control number-only','required','id'=>'client_p1')); ?>


        </div>
        <div class="form-group col-sm-3 col-xs-12">

          <label for="">Phone 2</label>
          <?php echo Form::text('client_phone2', null, array('placeholder' => 'Phone 2','class' => 'form-control number-only','id'=>'client_p2')); ?>


        </div>
        <div class="form-group col-sm-6 col-xs-12">

          <label class="required">ID Card</label>
          <?php echo Form::text('client_cardid', null, array('placeholder' => 'ID Card','class' => 'form-control','required','id'=>'client_idcard')); ?>


        </div>
        <div class="form-group col-sm-6 col-xs-12">

          <label>ID Card Date</label>
          <?php echo Form::text('client_datecard', null, array('placeholder' => 'ID Card Date','class' => 'form-control date_picker','id'=>'client_date_card')); ?>


        </div>
        <div class="form-group col-sm-6 col-xs-12">

          <label for="">ID Card Date Valid</label>
          <?php echo Form::text('client_cardvalid', null, array('placeholder' => 'ID Card Date Valid','class' => 'form-control date_picker','id'=>'client_validcard')); ?>


        </div>

        <div class="form-group col-sm-6 col-xs-12">

          <label class="required">Address</label>
          <?php echo Form::textarea('client_address', null, array('placeholder' => 'Address','class' => 'form-control','rows'=>'2','required','id'=>'client_address')); ?>


        </div>
        <div class="col-sm-12 col-xs-12" style="margin-bottom: 20px;">
          <div class="form-group">
            <button type="button" class="button_sm button_primary pull-right" id="update-client" data-dismiss="modal"><span class="fa fa-save"></span> Update</button>
            <button type="button" class="button_danger button_sm button_warning pull-right" data-dismiss="modal">Close</button>

          </div>
        </div>
      </div>
    </div>
    <!-- /.modal-content -->
  </div>
  <!-- /.modal-dialog -->
</div>
<!--End-->
<div class="page">
  <div class="row" id="form_addnew">
    <div class="col-md-12">
      <div class="portlet box blue" id="form_wizard_1">
        <div class="portlet-title">
          <div class="caption">
            <i class="icon-reorder"></i>
            <span>Client Installment</span>
            
          </div>
          <div class="tools hidden-xs">
            <a href="javascript:;" class="collapse"></a>
            <a href="#portlet-config" data-toggle="modal" class="config"></a>
            <a href="javascript:;" class="reload"></a>
            <a href="javascript:;" class="remove"></a>
          </div>
        </div>
        <div class="portlet-body form">
          <form action="<?php echo e(route('payment-installment.store')); ?>" class="form-horizontal" id="submit_form" enctype="multipart/form-data" method="POST">
            <?php echo e(csrf_field()); ?>

            <div class="form-wizard">
              <div class="form-body">
                <ul class="nav nav-pills nav-justified steps">
                  <li>
                    <a href="#tab1" data-toggle="tab" class="step">
                      
                      <span class="desc"><i class="icon-ok"></i>
                        <h3 style="width: 200px;">Loan Information</h3>
                      </span>
                    </a>
                  </li>
                    <li>
                        <a>
                        <h4 style="width: 700px;color: #0000cc"><b>
                          <?php echo e((!empty($sale_policy_payment)?$sale_policy_payment->pa_po_name:"").(!empty($sale_policy_payment)?(!empty($sale_policy_payment->po_detail_name)?(""."(".$sale_policy_payment->po_detail_name.")".""):""):"")); ?></b></h4>
                        </a>
                    </li>
                    <li></li>
                </ul>
                <div id="bar" class="progress progress-striped" role="progressbar">
                  <div class="progress-bar progress-bar-success"></div>
                </div>
                <div class="tab-content">
                  <div class="tab-pane active" id="tab1">
                    <h3 class="block">Payment Info</h3>
                    <div class="form-group">
                      <div class="col-md-12">
                        <div class="col-md-4">
                          <div class="col-md-12 ">
                            <div class="form-group">
                              <label class="col-md-4  control-label">Sale Amount ($) </label>
                              <div class="col-md-8">
                                <input type="text" name="item_cost" readonly="" class="form-control  " id="item_cost" value="<?php echo e($data['data'][0]->sale_amount - $data['data'][0]->sale_discount); ?>" placeholder="" aria-invalid="false">
                              </div>
                            </div>
                          </div>
                        </div>
                        <div class="col-md-4">
                          <div class="col-md-12 ">
                            <div class="form-group">
                              <label class="col-md-4  control-label">Deposit Amount ($) </label>
                              <div class="col-md-8">
                                <input type="text" name="deposit_amount" readonly="" class="form-control  " id="deposit_amount" value="<?php echo e($data['data'][0]->sale_receive); ?>" placeholder="">
                              </div>
                            </div>
                          </div>
                        </div>
                        <div class="col-md-4">
                          <div class="col-md-12 ">
                            <div class="form-group">
                              <label class="col-md-4  control-label">Remain Amount ($) </label>
                              <div class="col-md-8">
                                <input type="text" name="loan_amount_payment" readonly="" class="form-control  " id="own_amount" value="<?php echo e($data['data'][0]->sale_remain); ?>" placeholder="">
                              </div>
                            </div>
                          </div>
                          <input type="hidden" name="salename_id" value="<?php echo e($data['sale_id']); ?>">
                          <input type="hidden" name="clientname_id" value="<?php echo e($data['client_id']); ?>" id="client_id">
                        </div>
                        <div class="col-md-4" style="display: none;">
                          <div class="col-md-12">
                            <div class="form-group">
                              <label class="col-md-4  control-label">Discount Amount ($) </label>
                              <div class="col-md-8">
                                <input type="text" name="sale_discount" class="form-control number-only discount-effect" id="sale_discount" value="0" placeholder="">
                              </div>
                            </div>
                          </div>
                        </div>
                        <div class="col-md-4" style="display: none;">
                          <div class="col-md-12 ">
                            <div class="form-group">
                              <label class="col-md-4  control-label">Discount Percent (%) </label>
                              <div class="col-md-8">
                                <input type="text" name="sale_discount_percent" class="form-control number-only discount-effect" id="sale_discount_percent" value="0" placeholder="">
                              </div>
                            </div>
                          </div>
                        </div>
                        <div class="col-md-4">
                          <div class="col-md-12 ">
                            <div class="form-group">
                              <label class="col-md-4 control-label">Discount Commis.</label>
                              <div class="col-md-8">
                                <input type="text" class="form-control number-only" id="discount_commis" name="discount_commis" value="0">
                              </div>
                            </div>
                          </div>
                        </div>
                        <div class="col-md-4">
                          <div class="col-md-12 ">
                            <div class="form-group">
                              <label class="col-md-4  control-label">Client<span class="required" aria-required="true">*</span></label>
                              <div class="col-md-8">
                                <input type="text" class="form-control" id="current_client" name="clientname" value="<?php echo e($data['client_name']->client_fullname); ?>" readonly="true">
                              </div>
                            </div>
                          </div>
                        </div>
                        <div class="col-md-4">
                          <div class="col-md-12 ">
                            <div class="form-group">
                              <label class="col-md-4 control-label">Agency</label>
                              <div class="col-md-8">
                                <?php echo Form::select('agencyname_id', $agency, $data['data'][0]->agency_id, ['class' => 'form-control select2','id'=>'p_province']); ?>

                              </div>
                            </div>
                          </div>
                        </div>

                        <div class="col-md-4">
                          <div class="col-md-12 ">
                            <div class="form-group">
                              <label class="col-md-4 control-label">Close Sale</label>
                              <div class="col-md-8">
                                <?php echo Form::select('loan_close_saleid', $closesale, $data['data'][0]->close_sale_id, ['class' => 'form-control select2']); ?>

                              </div>
                            </div>
                          </div>
                        </div>
                        <div class="col-md-4">
                          <div class="col-md-12 ">
                            <div class="form-group">
                              <div class="col-md-12" style="text-align:center;">
                                <a style="color:white;margin-left:0;" href="#" onclick="viewClientInfo(<?php echo e($data['client_id']); ?>)" data-toggle="modal" title="view client's information" class="button_success btn-circle btn-xs"><i>View Client Info</i></a>
                              </div>
                            </div>
                          </div>
                        </div>

                        <div class="col-md-4">
                          <div class="col-md-12 ">
                            <div class="form-group">
                              <label class="col-md-4  control-label">Disburment <span class="required" aria-required="true">*</span></label>
                              <div class="col-md-8">
                                <input class="form-control required date_picker" type="text" data-date-format="dd-mm-yyyy" name="loan_disbursement" id="loan_disbursement" value="<?php echo e(date('Y-m-d')); ?>" placeholder="Input date" required="" aria-required="true">
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                      <div class="col-sm-12">
                        <div class="col-md-4">
                          <div class="col-md-12 ">
                            <div class="form-group">
                              <label class="col-md-4 control-label">Member Discount</label>
                              <div class="col-md-8">
                                <?php echo Form::select('discount_type',$discount,null,['class'=>'form-control select2','id'=>'discount_type']); ?>

                              </div>
                            </div>
                          </div>
                        </div>
                        <div class="col-md-4">
                          <div class="col-md-12 ">
                            <div class="form-group">
                              <label class="col-md-4 control-label">Member Discount($)</label>
                              <div class="col-md-8">
                                <?php echo Form::text('member_discount_amount',0,['class'=>'form-control number-only','id'=>'member_discount_amount']); ?>

                              </div>
                            </div>
                          </div>
                        </div>
                        <div class="col-md-4">
                          <div class="col-md-12 ">
                            <div class="form-group">
                              <label class="col-md-4 control-label">Member Discount(%)</label>
                              <div class="col-md-8">
                                <?php echo Form::text('member_discount_percentage',0,['class'=>'form-control number-only','id'=>'member_discount_percentage']); ?>

                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                      <div class="row col-sm-12" style="margin-bottom: 30px" style="display: none;">
                        <div class="col-sm-12">
                          <div class="tab-pane" id="tab3">
                            <h3 class="block">Who Involved</h3>
                          </div>
                        </div>
                        <div class="center-div">
                          <div class="col-sm-6">
                            <label for="" class="control-label" style="float: right">Client Relationship</label>
                          </div>
                          <div class="col-sm-6">
                            <?php echo Form::select('', $relationship,null, ['class' => 'form-control select2','id'=>'ship_id']); ?>

                          </div>
                        </div>
                      </div>
                      <table class="table" id="relationship_table">
                        <thead>
                          <tr>
                            <th>No</th>
                            <th>Relationship Name</th>
                            <th>Phone Number</th>
                            <th>Status</th>
                            <th>Action</th>
                          </tr>
                        </thead>
                        <tbody id="ship_body">

                        </tbody>
                        <tfoot id="border_body">
                          <tr>
                            <td colspan="5"><button type="button" class="btn btn-warning fa fa-plus pull-right btn-add-border"> Add Border</button></td>
                          </tr>
                        </tfoot>
                      </table>
                      <!-- <table class="table table-striped table-bordered">
                        <thead>
                          <tr>
                            <th colspan="8">Down Payment</th>
                            <th>
                              <span class="pull-right button_primary btn-sm plus_ens fa fa-plus add_downpayment"></span>
                            </th>
                          </tr>
                        </thead>
                        <tbody class="downpaymenttbody">
                          <tr>
                            <td width="5%">
                              <label class="control-label"><strong> Step : </strong></label>
                            </td>
                            <td width="8%">
                              <input type="text" class="form-control" name="payment_no_dp[]" value="1" readonly="readonly">
                            </td>
                            <td width="8%">
                              <label class="control-label"><strong> Payment Date : </strong></label>
                            </td>
                            <td>
                              <input type="text" id="meng_dp" class="form-control date-picker-a date_picker auto_date" value="<?php echo e(date('d-m-Y')); ?>" name="itempro_date_dp[]">
                            </td>
                            <td width="9%">
                              <label class="control-label"><strong> Payment Amount : </strong></label>
                            </td>
                            <td>
                              <input type="text" name="itempro_payamount_dp[]" class="number-only form-control itempro_payamount_dp meng_payment_dp" placeholder="Pay Amount">
                            </td>
                            <td width="7%">
                              <label class="control-label"><strong> Percentage : </strong></label>
                            </td>
                            <td>
                              <input type="text" class="number-only form-control payPercentage_dp meng_percent_dp" placeholder="Pay Percentage">
                            </td>
                          </tr>
                        </tbody>
                        <tfoot>
                          <tr>
                            <td colspan="5" align="right">Total :</td>
                            <td>
                              <div class="row">
                                <input type="text" name="amount_payment_step_dp" class="form-control total_cost_dp" value="0" readonly="readonly">
                              </div>
                            </td>
                            <td width="9%">Percentage :</td>
                            <td>
                              <div class="row">
                                <input type="text" name="total_percent_dp" class="form-control total_percent_dp" value="0" readonly="readonly">
                              </div>
                            </td>
                          </tr>
                          <tr>
                            <td colspan="5" align="right">Remain :</td>
                            <td>
                              <div class="row">
                                <input type="text" name="main_amount_dp" class="form-control main_amount_dp" value="<?php echo e($data['data'][0]->sale_remain); ?>" readonly="readonly">
                              </div>
                            </td>
                            <td width="9%">Percentage :</td>
                            <td>
                              <div class="row">
                                <input type="text" name="main_percent_dp" class="form-control main_percent_dp" value="<?php echo e($data['data'][0]->sale_remain*100/$data['data'][0]->sale_amount); ?>" readonly="readonly">
                              </div>
                            </td>
                          </tr>
                        </tfoot>
                      </table> -->

                    </div>
                    <div class="row">
                      <h3>Loan Generating <span style="font-size: 60%;">( Remain Amount : <span id="remain-loan-amount-before-submit"><?php echo e($data['data'][0]->sale_remain); ?></span> $ )<span></h3><br/>

                      <ul class="nav nav-tabs">
                        <li class="active"><a data-toggle="tab" id="to-home" href="#home">Loan without interest</a></li>
                        <li><a data-toggle="tab" id="to-menu2" href="#menu2">Loan with interest</a></li>
                        <li><a data-toggle="tab" id="to-menu3" href="#menu3">Loan with interest and change interest</a></li>
                        <li><a data-toggle="tab" id="to-menu4" href="#menu4">Loan with bank</a></li>
                      </ul>

                      <div class="tab-content">
                        <div id="home" class="tab-pane fade in active">
                          <div class="row" style="padding-left: 15px;padding-right: 15px;">
                            <!--Payment Step(Payment with Interest)-->
                            <br/>
                              <table class="table table-striped table-bordered">
                                <thead>
                                  <tr>
                                    <th colspan="8">Payment Step</th>
                                    <th>
                                      <span class="pull-right button_primary btn-sm plus_ens fa fa-plus add"></span>
                                    </th>
                                  </tr>
                                </thead>
                                <tbody class="resultbody">
                                  <tr>
                                    <td width="5%">
                                      <label class="control-label"><strong> Step : </strong></label>
                                    </td>
                                    <td width="8%">
                                      <input type="text" class="form-control" name="payment_no[]" value="1" readonly="readonly">
                                    </td>
                                    <td width="8%">
                                      <label class="control-label"><strong> Payment Date : </strong></label>
                                    </td>
                                    <td>
                                      <input type="text" id="meng" class="form-control date-picker-a date_picker auto_date" value="<?php echo e(date('d-m-Y')); ?>" name="itempro_date[]">
                                    </td>
                                    <td width="9%">
                                      <label class="control-label"><strong> Payment Amount : </strong></label>
                                    </td>
                                    <td>
                                      <input type="text" name="itempro_payamount[]" class="number-only form-control itempro_payamount meng_payment" placeholder="Pay Amount">
                                    </td>
                                    <td width="7%">
                                      <label class="control-label"><strong> Percentage : </strong></label>
                                    </td>
                                    <td>
                                      <input type="text" class="number-only form-control payPercentage meng_percent" placeholder="Pay Percentage">
                                    </td>
                                  </tr>
                                </tbody>
                                <tfoot>
                                  <tr>
                                    <td colspan="5" align="right">Total :</td>
                                    <td>
                                      <div class="row">
                                        <input type="text" name="amount_payment_step" class="form-control total_cost" value="0" readonly="readonly">
                                      </div>
                                    </td>
                                    <td width="9%">Percentage :</td>
                                    <td>
                                      <div class="row">
                                        <input type="text" name="total_percent" class="form-control total_percent" value="0" readonly="readonly">
                                      </div>
                                    </td>
                                  </tr>
                                  <tr>
                                    <td colspan="5" align="right">Remain :</td>
                                    <td>
                                      <div class="row">
                                        <input type="text" name="main_amount" class="form-control main_amount" value="<?php echo e($data['data'][0]->sale_remain); ?>" readonly="readonly">
                                        <input type="hidden" name="loan_duration_total" class="form-control loan_duration_total" value="1" readonly="readonly">
                                      </div>
                                    </td>
                                    <td width="9%">Percentage :</td>
                                    <td>
                                      <div class="row">
                                        <input type="text" name="main_percent" class="form-control main_percent" value="<?php echo e($data['data'][0]->sale_remain*100/$data['data'][0]->sale_amount); ?>" readonly="readonly">
                                      </div>
                                    </td>
                                  </tr>
                                </tfoot>
                              </table>
                              <!--End-->
                          </div>
                        </div>
                        <div id="menu2" class="tab-pane fade">
                          <!-- <h3 class="block" style="background-color: #4CAF50;"></h3> -->
                          <div class="form-group first-loan-generate" style="padding-left: 15px;padding-right: 15px;">
                            <table class="table table-striped table-bordered">
                              <thead>
                                <tr>
                                  <th colspan="8">Loan Info</th>
                                </tr>
                              </thead>
                            </table>
                            <div class="col-md-12">
                              <div class="col-md-4">
                                <div class="col-md-12 ">
                                  <div class="form-group">
                                    <label class="col-md-4  control-label"> </label>
                                    <div class="col-md-8">
                                      <input type="hidden" name="loan_currency" readonly="" class="form-control  " id="loan_currency" value="1" placeholder="">
                                    </div>
                                  </div>
                                </div>
                                <div class="col-md-12 ">
                                  <div class="form-group">
                                    <label class="col-md-4  control-label">Remain <span class="required" aria-required="true">*</span></label>
                                    <div class="col-md-8">
                                      <input type="text" name="amount_installment1" class="form-control znumber number-only" readonly id="amount_installment1" value="<?php echo e($data['data'][0]->sale_remain); ?>" placeholder="">
                                    </div>
                                  </div>
                                </div>
                                <div class="col-md-12 ">
                                  <div class="form-group">
                                    <label class="col-md-4  control-label">Amount <span class="required" aria-required="true">*</span></label>
                                    <div class="col-md-8">
                                      <input type="text" name="loan_amount" class="form-control znumber number-only" id="loan_amount_main" value="<?php echo e($data['data'][0]->sale_remain); ?>" placeholder="">
                                    </div>
                                  </div>
                                </div>
                                <div class="col-md-12">
                                  <div class="form-group">
                                    <label class="col-md-4  control-label">Percent(%) <span class="required" aria-required="true">*</span></label>
                                    <div class="col-md-8">
                                      <input type="text" name="loan_amount_percent" class="form-control znumber  number-only" id="loan_amount_main_percent" value="<?php echo e(($data['data'][0]->sale_remain*100/($data['data'][0]->sale_amount - $data['data'][0]->sale_discount))); ?>" placeholder="">
                                    </div>
                                  </div>
                                </div>
                              </div>
                              <div class="col-md-4">
                                <div class="col-md-12 ">
                                  <div class="form-group">
                                    <label class="col-md-4  control-label"> </label>
                                    <div class="col-md-8">
                                      <input type="hidden" name="loan_payment_step" class="form-control  znumber" id="loan_payment_step" value="2" placeholder="">
                                    </div>
                                  </div>
                                </div>
                                <input type="hidden" name="first_loan_condition" id="first_loan_condition" value="0">
                                <div class="col-md-12 ">
                                  <div class="form-group">
                                    <label class="col-md-4  control-label">Type <span class="required" aria-required="true">*</span></label>
                                    <div class="col-md-8">
                                      <select name="loan_type" id="loan_type" class="form-control" data-placeholder="Select..." required="" tabindex="-1" aria-hidden="true">
                                        <option value="1">បង់រំលោះថេរ</option>
                                        <option value="2">បង់រំលោះថយ</option>
                                      </select>
                                    </div>
                                  </div>
                                </div>
                                <div class="col-md-12 ">
                                  <div class="form-group">
                                    <label class="col-md-4  control-label">Douration <span class="required" aria-required="true">*</span></label>
                                    <div class="col-md-8">
                                      <input type="text" name="loan_duration" class="form-control number-only" id="loan_duration" value="" placeholder="">
                                    </div>
                                  </div>
                                </div>
                                <div class="col-md-12 ">
                                  <div class="form-group">
                                    <label class="col-md-4  control-label">Interest <span class="required" aria-required="true">*</span></label>
                                    <div class="col-md-8">
                                      <input type="text" name="loan_interest" class="form-control number-only" id="loan_interest" value="" placeholder="">
                                    </div>
                                  </div>
                                </div>
                              </div>
                              <div class="col-md-4">
                                <div class="col-md-12 ">
                                  <div class="form-group">
                                    <label class="col-md-4  control-label"> </label>
                                    <div class="col-md-8">
                                      <input type="hidden" name="loan_currency" readonly="" class="form-control  " id="loan_currency" value="1" placeholder="">
                                    </div>
                                  </div>
                                </div>
                                <div class="col-md-12 ">
                                  <div class="form-group">
                                    <label class="col-md-4  control-label">Next Date Pay <span class="required" aria-required="true">*</span></label>
                                    <div class="col-md-8">
                                      <input class="form-control required date_picker auto_date" type="text" data-date-format="dd-mm-yyyy" name="loan_firstpaydate" id="firstpaydateloan" value="" placeholder="Input date" required="" aria-required="true">
                                    </div>
                                  </div>
                                </div>
                                <div class="col-md-12 ">
                                  <div class="form-group">
                                    <label class="col-md-4  control-label">Term <span class="required" aria-required="true">*</span></label>
                                    <div class="col-md-8">
                                      <input type="text" name="hidden" value="Month" class="form-control" readonly="">
                                      <input type="hidden" name="loan_term" id="loan_term" value="4" class="form-control" hidden>
                                    </div>
                                  </div>
                                </div>
                              </div>
                              <div class="tab-pane" id="tab2">
                                <h2 class="block">&nbsp;<br/><br/></h2>

                              </div>
                              <div class="first-loan-generate" style="border-bottom: 2px solid #4CAF50"><span style="margin-top: 20px;" class="pull-right btn btn-success btn-sm btn-generate">Generate</span>List Generate Loan</div><br /><br /><br />
                              <table class="table table-striped table-bordered first-loan-generate">
                                <tbody class="resultbody3">
                                </tbody>
                                <tfoot>
                                  <tr>
                                    <td colspan="6" align="right">Total :</td>
                                    <td>
                                      <div class="row">
                                        <input type="text" name="amount_payment_step1" class="form-control total_cost1" value="0" readonly="readonly">
                                      </div>
                                    </td>
                                  </tr>
                                  <tr>
                                    <td colspan="6" align="right">Remain :</td>
                                    <td>
                                      <div class="row">
                                        <input type="text" name="main_amount1" class="form-control main_amount1" value="0" readonly="readonly">
                                      </div>
                                    </td>
                                  </tr>
                                </tfoot>
                              </table>
                            </div>
                          </div>
                        </div>
                        <div id="menu3" class="tab-pane fade">
                          <!--Last Loan-->
                          <div class="tab-content" id="second-loan">
                            <div class="tab-pane active" id="tab1" style="padding-left: 15px;padding-right: 15px;">
                              <!-- <h3 class="block">Second Loan Info</h3> -->
                              <div class="form-group">
                                <table class="table table-striped table-bordered">
                                  <thead>
                                    <tr>
                                      <th colspan="8">Second Loan Info</th>
                                    </tr>
                                  </thead>
                                </table>
                                <div class="col-md-12">
                                  <div class="col-md-4">
                                    <div class="col-md-12 ">
                                      <div class="form-group">
                                        <label class="col-md-4  control-label"> </label>
                                        <div class="col-md-8">
                                          <input type="hidden" name="loan_currency_second" readonly="" class="form-control  " id="loan_currency_second" value="1" placeholder="">
                                        </div>
                                      </div>
                                    </div>
                                    <div class="col-md-12 ">
                                      <div class="form-group">
                                        <label class="col-md-4  control-label">Remain <span class="required" aria-required="true">*</span></label>
                                        <div class="col-md-8">
                                          <input type="text" name="amount_installment2" class="form-control znumber number-only" readonly id="amount_installment2" value="<?php echo e($data['data'][0]->sale_remain); ?>" placeholder="">
                                        </div>
                                      </div>
                                    </div>
                                    <div class="col-md-12 ">
                                      <div class="form-group">
                                        <label class="col-md-4  control-label">Amount <span class="required" aria-required="true">*</span></label>
                                        <div class="col-md-8">
                                          <input type="text" name="loan_amount_second" class="form-control znumber number-only" id="loan_amount_main_second" value="<?php echo e($data['data'][0]->sale_remain); ?>" placeholder="">
                                        </div>
                                      </div>
                                    </div>
                                    <div class="col-md-12 ">
                                      <div class="form-group">
                                        <label class="col-md-4  control-label">Percent(%) <span class="required" aria-required="true">*</span></label>
                                        <div class="col-md-8">
                                          <input type="text" name="loan_amount_main_percent_second" class="form-control znumber number-only" id="loan_amount_main_percent_second" value="<?php echo e(($data['data'][0]->sale_remain*100/($data['data'][0]->sale_amount - $data['data'][0]->sale_discount))); ?>" placeholder="">
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                  <div class="col-md-4">
                                    <div class="col-md-12 ">
                                      <div class="form-group">
                                        <label class="col-md-4  control-label"> </label>
                                        <div class="col-md-8">
                                          <input type="hidden" name="loan_payment_step_second" class="form-control  znumber" id="loan_payment_step_second" value="2" placeholder="">
                                        </div>
                                      </div>
                                    </div>
                                    <div class="col-md-12 ">
                                      <div class="form-group">
                                        <label class="col-md-4  control-label">Type <span class="required" aria-required="true">*</span></label>
                                        <div class="col-md-8">
                                          <select name="loan_type_second" id="loan_type_second" class="form-control" data-placeholder="Select..." required="" tabindex="-1" aria-hidden="true">
                                            <option value="1">បង់រំលោះថេរ</option>
                                            <option value="2">បង់រំលោះថយ</option>
                                          </select>
                                        </div>
                                      </div>
                                    </div>
                                    <div class="col-md-12 ">
                                      <div class="form-group">
                                        <label class="col-md-4  control-label">Douration <span class="required" aria-required="true">*</span></label>
                                        <div class="col-md-8">
                                          <input type="text" name="loan_duration_second" class="form-control number-only" id="loan_duration_second" value="" placeholder="">
                                        </div>
                                      </div>
                                    </div>
                                    <div class="col-md-12 ">
                                      <div class="form-group">
                                        <label class="col-md-4  control-label">Interest <span class="required" aria-required="true">*</span></label>
                                        <div class="col-md-8">
                                          <input type="text" name="loan_interest_second" class="form-control number-only" id="loan_interest_second" value="" placeholder="">
                                          <input type="hidden" name="change_rate_condition" id="change_rate_condition" value="0">
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                  <div class="col-sm-4">
                                    <div class="col-md-12 ">
                                      <div class="form-group">
                                        <label class="col-md-4  control-label"> </label>
                                        <div class="col-md-8">
                                          <input type="hidden" name="loan_currency_second" readonly="" class="form-control  " id="loan_currency_second" value="1" placeholder="">
                                        </div>
                                      </div>
                                    </div>
                                    <div class="col-md-12 ">
                                      <div class="form-group">
                                        <label class="col-md-4  control-label">Next Date Pay <span class="required" aria-required="true">*</span></label>
                                        <div class="col-md-8">
                                          <input class="form-control required date_picker auto_date" type="text" data-date-format="dd-mm-yyyy" name="loan_firstpaydate_second" id="firstpaydateloan_second" value="" placeholder="Input date" required="" aria-required="true">
                                        </div>
                                      </div>
                                    </div>
                                    <div class="col-md-12 ">
                                      <div class="form-group">
                                        <label class="col-md-4  control-label">Term <span class="required" aria-required="true">*</span></label>
                                        <div class="col-md-8">
                                          <input type="text" name="hidden" value="Month" class="form-control" readonly="">
                                          <input type="hidden" name="loan_term_second" id="loan_term_second" value="4" class="form-control" hidden>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                            <div class="tab-pane" id="tab2-second">
                              <h2 class="block">Loan Information</h2>
                            </div>
                            <div style="border-bottom: 2px solid #4CAF50">Change Rate Conditions<span class="pull-right button_primary btn-sm plus_ens fa fa-plus add-change-rate-option"></span></div>
                            <br />
                            <table class="table table-striped table-bordered">
                              <tbody class="rate-condition-appending">
                                <tr>
                                  <td width="8%">
                                    <label class="control-label"><strong> From Month: </strong></label>
                                  </td>
                                  <td>
                                    <input type="text" class="form-control number-only change_rate_from  number-only" name="change_rate_from[]" placeholder="Rank of Month">
                                  </td>
                                  <td width="9%">
                                    <label class="control-label"><strong> To Month: </strong></label>
                                  </td>
                                  <td>
                                    <input type="text" name="change_rate_to[]" class="number-only form-control change_rate_to  number-only" placeholder="Rank of Month">
                                  </td>
                                  <td width="7%">
                                    <label class="control-label"><strong> Rate : </strong></label>
                                  </td>
                                  <td>
                                    <input type="text" name="rate_condition[]" class="number-only form-control rate_condition" placeholder="Interest">
                                  </td>
                                  <td><button type="button" class="btn btn-sm btn-danger" disabled><i class="fa fa-trash-o"></i></button></td>
                                </tr>
                              </tbody>
                            </table><br><br />
                            <div style="border-bottom: 2px solid #4CAF50"><span style="margin-top: 20px;" class="pull-right btn btn-success btn-sm btn-generate-second">Generate</span>List Generate Loan</div>
                            <br /><br><br />
                            <table class="table table-striped table-bordered">
                              <tbody class="resultbody3-second">
                              </tbody>
                              <tfoot>
                                <tr>
                                  <td colspan="6" align="right">Total :</td>
                                  <td>
                                    <div class="row">
                                      <input type="text" name="amount_payment_step1_second" class="form-control total_cost1_second" value="0" readonly="readonly">
                                    </div>
                                  </td>
                                </tr>
                                <tr>
                                  <td colspan="6" align="right">Remain :</td>
                                  <td>
                                    <div class="row">
                                      <input type="text" name="main_amount1_second" class="form-control main_amount1-second" value="0" readonly="readonly">
                                    </div>
                                  </td>
                                </tr>
                              </tfoot>
                            </table>
                          </div>
                        </div>
                        <div id="menu4" class="tab-pane fade in active">
                          <div class="row" style="padding-left: 15px;padding-right: 15px;">
                            <table class="table table-striped table-bordered">
                              <thead>
                                <tr>
                                  <th colspan="8">Loan Record With Bank</th><br />
                                </tr>
                              </thead>
                              <tbody>
                                <tr>
                                  <td width="12%">
                                    <label class="control-label"><strong> Remain Amount : </strong></label>
                                  </td>
                                  <td>
                                    <input type="text" name="remain_for_bank[]" id="remaining_amount_for_bank" class="number-only form-control" placeholder="Remain Amount" value="<?php echo e($data['data'][0]->sale_remain); ?>" readonly>
                                  </td>
                                  <td width="10%">
                                    <label class="control-label"><strong> Payment Date : </strong></label>
                                  </td>
                                  <td>
                                    <input type="text" class="form-control date-picker-a date_picker auto_date" value="<?php echo e(date('d-m-Y')); ?>" name="itempro_date_bank[]">
                                  </td>
                                  <td width="12%">
                                    <label class="control-label"><strong> Payment Amount : </strong></label>
                                  </td>
                                  <td>
                                    <input type="text" name="itempro_payamount_bank[]" class="number-only form-control" id="payment-amount-bank" placeholder="Pay Amount">
                                  </td>
                                </tr>
                              </tbody>
                            </table>
                          </div><br/><br/><br/>
                        </div>
                      </div>
                    </div>
                    <br/>
                  </div>
                </div>
                
              </div>
              <div class="form-actions fluid">
                <div class="row">
                  <div class="col-md-12">
                    <div class="col-md-offset-5 col-md-7">
                      <a href="<?php echo e(route('items-deposit.index')); ?>" class="btn red"><i class="fa fa-reply" aria-hidden="true"></i> Cancel</a>
                      <a href="javascript:;" class="btn default button-previous">
                        <i class="m-icon-swapleft"></i> Back
                      </a>
                      <button type="button" class="btn green" onclick="check_amount(this)">Submit <i class="m-icon-swapright m-icon-white"></i></button>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('js'); ?>
<link rel="stylesheet" href="<?php echo e(asset('assets/scripts/installment/components.min.css')); ?>">
<link rel="stylesheet" href="<?php echo e(asset('assets/scripts/installment/plugins.min.css')); ?>">
<script type="text/javascript" src="<?php echo e(asset('assets/controller/installment-administrator.js')); ?>"></script>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

<script type="text/javascript" src="<?php echo e(asset('assets/scripts/installment/bootstrap-wizard/jquery.bootstrap.wizard.min.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/scripts/installment/table-advanced.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/scripts/installment/form-wizard.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/scripts/installment/jquery-validation/js/jquery.validate.min.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/scripts/installment/bootstrap-switch/js/bootstrap-switch.min.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/scripts/installment/app.min.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/scripts/installment/components-select2.min.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/scripts/installment/select2/js/select2.full.min.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/scripts/datepicker/bootstrap-datepicker.min.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/controller/loan-generator.js')); ?>"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.2/jquery-confirm.min.js"></script>


<script type="text/javascript">
  function check_amount (obj) {
    var value_remain = Number($("#remaining_amount_for_bank").val()) - Number($("#payment-amount-bank").val());
    if(value_remain>0){
      $.alert({
          title: 'Warning !',
          content: "Please remain amount. Remain Amount > 0 .",
      });
    }else if(value_remain<0){
      $.alert({
          title: 'Warning !',
          content: "Please check remain amount. Remain Amount < 0 .",
      });
    }else{
      $(obj).submit();
    }
  }
  $(document).on("keyup","#payment-amount-bank",function  () {
    var value_remain = Number($("#remaining_amount_for_bank").val())-Number($(this).val());
    $("#remain-loan-amount-before-submit").html(value_remain);
  });
  $('.date_picker').datepicker({
    yearRange: "-100:+0",
    dateFormat: "dd-mm-yy",
    changeMonth: true,
    changeYear: true
  });
  $(document).on("click","#to-home",function  () {
    $("#menu2").hide();
    $("#menu3").hide();
    $("#menu4").hide();
    $("#home").show();
  });
  $(document).on("click","#to-menu2",function  () {
    $("#menu2").show();
    $("#menu3").hide();
    $("#menu4").hide();
    $("#home").hide();
  });
  $(document).on("click","#to-menu3",function  () {
    $("#menu3").show();
    $("#menu4").hide();
    $("#menu2").hide();
    $("#home").hide();
  });
  $(document).on("click","#to-menu4",function  () {
    $("#menu4").show();
    $("#menu2").hide();
    $("#menu3").hide();
    $("#home").hide();
  });

  $(document).ready(function() {
    $("#menu2,#menu3,#menu4").hide();
    TableAdvanced.init();
    FormWizard.init();
    $(".button-start").hide();
    if ("<?php echo e($data['sale_id']); ?>" > 0) {
      $("#form_addnew").show();
    } else {
      $("#form_addnew").hide();
    }
    $("#addnew").click(function() {
      $("#form_addnew").slideToggle("show");
    });
  });
  $(document).on('click', '.btn-generate', function() {
    var amount = parseFloat($('#loan_amount_main').val());
    var amount_os = Number($(".main_amount").val());
    var type = $('#loan_type').val();
    var duration = $('#loan_duration').val();
    var interest = parseFloat($('#loan_interest').val());
    if (interest <= 0) type = 2;
    var start_date = $('#firstpaydateloan').val();
    var disbursement = $('#loan_disbursement').val();
    var row = loan_generator(amount, amount_os, type, duration, interest, start_date, disbursement);
    $("#first_loan_condition").val(1);
    $('.resultbody3').empty().append(row);
    var totalPrincipal = 0;
    $('.resultbody3 tr td:nth-child(6) .principal').each(function() {
      totalPrincipal += parseFloat($(this).val());
    });
    var remian = amount - totalPrincipal;
    if (remian < 1) {
      remian = 0;
    }
    var last_date = $('.resultbody3 tr td:nth-child(4) .loan-payment-date').last().val();

    $("#firstpaydateloan_second").val(Loan_date_generator(last_date));
    $('.total_cost1').val(totalPrincipal.toFixed(2));
    $('.main_amount1').val(remian);
    $('#loan_amount_main_second').val(loan_percent_input(Number($(".main_percent").val()) - Number($("#loan_amount_main_percent").val())));
    $("#loan_amount_main_percent_second").val(Number($(".main_percent").val()) - Number($("#loan_amount_main_percent").val()));

    var percent_second = Number($(".main_percent").val()) - loan_amount_input($("#loan_amount_main").val());
    $("#loan_amount_main_second,#amount_installment2,#remaining_amount_for_bank").val(Number($("#amount_installment1").val()) - Number($("#loan_amount_main").val()));
    $("#remain-loan-amount-before-submit").html(Number($("#amount_installment1").val()) - Number($("#loan_amount_main").val()));

  });
  $(document).on('click', '.btn-generate-second', function() {
    var amount = parseFloat($('#loan_amount_main_second').val());
    var type = $('#loan_type_second').val();
    var duration = $('#loan_duration_second').val();
    var interest = parseFloat($('#loan_interest_second').val());
    var start_date = $('#firstpaydateloan_second').val();
    var disbursement = $('#loan_disbursement').val();
    var option_change_rate = [];
    var change_rate_from = [];
    var index = 0;
    var check_rate_condition = false;
    $('.change_rate_from').each(function() {
      change_rate_from[index] = $(this).val();
      if ($(this).val() > 0) check_rate_condition = true;
      else check_rate_condition = false;
      index++;
    });
    var index = 0;
    var change_rate_to = [];
    $(".change_rate_to").each(function() {
      change_rate_to[index++] = $(this).val();
      if ($(this).val() > 0) check_rate_condition = true;
      else check_rate_condition = false;
    });
    var index = 0;
    var change_rate_condition = [];
    $(".rate_condition").each(function() {
      change_rate_condition[index++] = $(this).val();
      if ($(this).val() > 0) check_rate_condition = true;
      else check_rate_condition = false;
    });
    option_change_rate["from"] = change_rate_from;
    option_change_rate["to"] = change_rate_to;
    option_change_rate['condition'] = change_rate_condition;
    if (check_rate_condition == true) {
      var row = loan_generator(amount, amount, type, duration, interest, start_date, disbursement, option_change_rate, check_rate_condition);
    } else {
      var row = loan_generator(amount, amount, type, duration, interest, start_date, disbursement, option_change_rate, check_rate_condition);
    }
    $("#change_rate_condition").val(1);
    $('.resultbody3-second').empty().append(row);
    var totalPrincipal = 0;
    $('.resultbody3-second tr td:nth-child(6) .principal').each(function() {
      totalPrincipal += parseFloat($(this).val());
    });

    var remian = amount - totalPrincipal;
    if (remian < 1) {
      remian = 0;
    }
    $('.total_cost1_second').val(totalPrincipal.toFixed(2));
    $('.main_amount1-second').val(remian);

    $("#loan_amount_main_second").val(loan_percent_input($("#loan_amount_main_percent_second").val()));
    $("#remaining_amount_for_bank").val(Number($("#amount_installment2").val()) - Number($("#loan_amount_main_second").val()));
    $("#remain-loan-amount-before-submit").html(Number($("#amount_installment2").val()) - Number($("#loan_amount_main_second").val()));
  });
  $(document).on("click", "#update-client", function() {
    var client_firstname = $("#client_firstname").val();
    var client_id = $("#client_id").val();
    var client_lastname = $("#client_lastname").val();
    var client_gender = $("#client_gender").val();
    var clientDOB = $("#clientDOB").val();
    var clientJOB = $("#clientJOB").val();
    var clientworkplace = $("#clientworkplace").val();
    var client_nate = $("#client_nate").val();
    var client_p1 = $("#client_p1").val();
    var client_p2 = $("#client_p2").val();
    var client_idcard = $("#client_idcard").val();
    var client_date_card = $("#client_date_card").val();
    var client_validcard = $("#client_validcard").val();
    var client_address = $("#client_address").val();
    $.ajax({
      type: "POST",
      url: '<?php echo e(route("client-deposit.update_client")); ?>',
      data: {
        "_token": "<?php echo e(csrf_token()); ?>",
        "client_firstname": client_firstname,
        "client_id": client_id,
        "client_lastname": client_lastname,
        "client_gender": client_gender,
        "clientDOB": clientDOB,
        "clientJOB": clientJOB,
        "clientworkplace": clientworkplace,
        "client_nate": client_nate,
        "client_p1": client_p1,
        "client_p2": client_p2,
        "client_idcard": client_idcard,
        "client_date_card": client_date_card,
        "client_validcard": client_validcard,
        "client_address": client_address
      },
      success: function(data) {
        $('#current_client').val(client_firstname + " " + client_lastname);
      }
    });

  });

  function viewClientInfo(id) {
    var route = "<?php echo e(route('get-client-installment.info',':id')); ?>";
    route = route.replace(':id', id);
    $.ajax({
      type: "GET",
      url: route,
      data: {
        "_token": "<?php echo e(csrf_token()); ?>",
      },
      success: function(data) {
        data = JSON.parse(data);
        var gender = data.client_gender;
        var gender_content = `<option value="Male" ${data.client_gender=="Male"?'selected="true"':""}>Male</option>
                            <option value="Female" ${data.client_gender=="Female"?'selected="true"':""}>Female</option>`;
        $('#client_firstname').val(data.client_firstname);
        $('#client_lastname').val(data.client_lastname);
        $('#client_gender').empty().append(gender_content);
        $('#clientDOB').val(data.client_dob);
        $('#clientJOB').val(data.client_job);
        $('#clientworkplace').val(data.client_workplace);
        $('#client_nate').val(data.client_national);
        $("#client_p1").val(data.client_phone1);
        $("#client_p2").val(data.client_phone2);
        $("#client_idcard").val(data.client_cardid);
        $("#client_date_card").val(data.client_datecard);
        $("#client_validcard").val(data.client_cardvalid);
        $("#client_address").val(data.client_address);
        $('#view-clientinstallment-info').modal('show');
      }
    });
  }
  $(document).on('change', '#ship_id', function() {
    var id = $(this).find(':selected').val();
    var name_phone = $(this).find(':selected').text();
    var tr = '';
    var select = $(this);
    if (id != '') {
      namephone = name_phone.split('|');
      name = namephone[1];
      phone = namephone[0];
      tr = `<tr>
              <td><input type="text" class="form-control ship_no" name="ship_no[]" readonly><input type="hidden" class="form-control ship_id" name="ship_id[]" value="${id}"></td>
              <td><input type="text" class="form-control ship_name" name="ship_name[]" value="${name}" required readonly></td>
              <td><input type="text" class="form-control ship_phone" name="ship_phone[]" value="${phone}" required readonly></td>
              <td><input type="text" class="form-control ship_status" name="ship_status[]" placeholder="ប្តី/ប្រពន្ធ/មិត្តភក្តិ..." required></td>
              <td><button type="button" class="btn btn-danger btn-remove-ship"><i class="fa fa-trash"></i></button></td>
            </tr>`;
      $('#ship_body').append(tr);
      select.find(':selected').attr('disabled', true);
      reselect2(select);
      adjust_shipNo();
    }
  });

  $(document).on('click', '.btn-remove-ship', function() {
    var id = $(this).closest('tr').find('.ship_id').val();
    $('#ship_id option[value="' + id + '"]').attr('disabled', false);
    $(this).closest('tr').remove();
    adjust_shipNo();
    reselect2($('#ship_id'));
  });
  $(document).on('click', '.btn-add-border', function() {
    if ($('#relationship_table >tfoot >tr').length < 2) {
      var tr = `<tr id="border_row">
                  <td><input type="text" name="north_border" class="form-control" placeholder="North Border" required></td>
                  <td><input type="text" name="south_border" class="form-control" placeholder="South Border"  required></td>
                  <td><input type="text" name="east_border" class="form-control" placeholder="East Border" required></td>
                  <td><input type="text" name="west_border" class="form-control" placeholder="West Border" required></td>
                  <td><button type="button" class="btn btn-danger btn-remove-ship"><i class="fa fa-trash"></i></button></td>
                </tr>`;
      $('#border_body').append(tr);
    }
  });

  function reselect2(select) {
    select.select2('destroy');
    select.select2();
  }

  function adjust_shipNo() {
    var ship_no = 1;
    $('.ship_no').each(function() {
      $(this).val(ship_no);
      ship_no++;
    });
  }
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('adminlte::page', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>