
<div class="modal fade" id="md_add_payment" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  {{ Form::open(array('route' => 'payment.pay', 'class' => 'cls_form', 'id' => 'form_add_payment')) }}
  <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Add Payment</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true"></span>
        </button>
      </div>
      <div class="modal-body ">
        <div class = "card">
          <div class ="card-body form-fieldset">
              <div class="row">

                <div class="col-sm-4">
                     <label class="label-color">{{ucwords(str_replace('_',' ',EF::branchWhiteLabel()['module']))}} </label>
                  <small class="form-errors pull-right req" value="">{{ $errors->first('branch',":message") }}</small>
                  <div class="input-group mb-3">

                    <input type="text" readonly="" value="{{$branch_name}}" class="form-control form-control-sm">

                    {{--Form::Text(EF::branchWhiteLabel()['module'], '', ['class' => 'form-control form-control-sm  cls_required', 'placeholder' => ucwords(str_replace('_',' ',EF::branchWhiteLabel()['module'])) , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default', 'disabled' => 'true'])--}}
                  </div>
                </div>

                 <!-- VENDOR PAYMENTS -->
                @if(Crypt::decrypt($generic_type) == EF::getGenericTableIndex()['Vendor Payment']) 
                <div class="col-sm-4">
                     <label class="label-color">Invoice # </label>
                  <small class="form-errors pull-right req" value="">{{ $errors->first('invoice',":message") }}</small>
                  <div class="input-group mb-3">
                   
                    {{Form::Text('invoice',$invoice, ['class' => 'form-control form-control-sm  cls_required', 'placeholder' => 'Invoice #' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default', 'readonly' => true])}}
                  </div>
                </div>

                <input type="hidden" name="receipt">
                <!-- END VENDOR PAYMENTS -->

                @elseif(Crypt::decrypt($generic_type) == EF::getGenericTableIndex()['Inventory Payable']) 

                <div class="col-sm-4">
                     <label class="label-color">Invoice # </label>
                  <small class="form-errors pull-right req" value="">{{ $errors->first('invoice',":message") }}</small>
                  <div class="input-group mb-3">
                   
                    {{Form::Text('invoice',$invoice, ['class' => 'form-control form-control-sm  cls_required', 'placeholder' => 'Invoice #' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default', 'readonly' => true])}}
                  </div>
                </div>

                <input type="hidden" name="receipt">

                @else
                <!-- RECEIPT -->
                <div class="col-sm-4">
                     <label class="label-color">Receipt # </label>
                  <small class="form-errors pull-right req" value="">{{ $errors->first('receipt',":message") }}</small>
                  <div class="input-group mb-3">
                   
                    {{Form::Text('receipt',$receipt, ['class' => 'form-control form-control-sm  cls_required', 'placeholder' => 'Receipt #' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default', 'readonly' => true])}}
                  </div>
                </div>
                @endif
                <!-- END Receipt -->

                {{--

                <div class="col-sm-4">
                     <label class="label-color">Receipt # </label>
                  <small class="form-errors pull-right req" value="">{{ $errors->first('receipt',":message") }}</small>
                  <div class="input-group mb-3">

                    {{Form::Text('receipt',$receipt, ['class' => 'form-control form-control-sm  cls_required', 'placeholder' => 'Receipt #' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default', 'readonly' => true])}}
                  </div>
                </div>
                --}}


                <div class="col-sm-4">
                     <label class="label-color">Date <i style = "color:red;">*</i></label>
                  <small class="form-errors pull-right req" value="*">{{ $errors->first('date',":message") }}</small>
                  <div class="input-group mb-3">
                    <input type="date" name="date" value="<?php echo date('Y-m-d'); ?>" class="form-control form-control-sm  cls_date auto_select_date" aria-label="Default"/>
                    {{--Form::date('date', '', ['class' => 'form-control form-control-sm  cls_date auto_select_date', 'placeholder' => 'Date' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default'])--}}
                  </div>
                </div>



                <div class="col-sm-12"><h5>{{$section}}</h5></div>

                @if(Crypt::decrypt($generic_type) == EF::getGenericTableIndex()['Vendor Payment']) 
                <div class="col-sm-6">
                     <label class="label-color">Payment Type  </label>
                  <small class="form-errors pull-right req" value="">{{ $errors->first('payment_type',":message") }}</small>
                  <div class="input-group mb-3">

                    <input type="text" readonly="" value="{{$payment_type}}" class="form-control form-control-sm">

                   
                    {{--Form::Text('payment_type', '', ['class' => 'form-control form-control-sm  cls_required', 'placeholder' => 'Payment Type' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default',  'disabled' => true])--}}
                  </div>
                </div>

                <div class="col-sm-6">
                     <label class="label-color">Description  </label>
                  <small class="form-errors pull-right req" value="">{{ $errors->first('description',":message") }}</small>
                  <div class="input-group mb-3">

                    <input type="text" readonly="" value="{{$description}}" class="form-control form-control-sm">

                   

                    {{--Form::Text('description', '', ['class' => 'form-control form-control-sm  cls_required', 'placeholder' => 'Description' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default',  'disabled' => true])--}}
                  </div>
                </div>



                @else
                 <div class="col-sm-6">
                     <label class="label-color">User Type  </label>
                  <small class="form-errors pull-right req" value="">{{ $errors->first('user_type',":message") }}</small>
                  <div class="input-group mb-3">

                    <input type="text" readonly="" value="{{$user_type}}" class="form-control form-control-sm">


                    {{--Form::Text('user_type', '', ['class' => 'form-control form-control-sm  cls_required', 'placeholder' => 'User Type' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default', 'disabled' => true])--}}
                  </div>
                </div>

                <div class="col-sm-6">
                     <label class="label-color">User </label>
                  <small class="form-errors pull-right req" value="">{{ $errors->first('user_name',":message") }}</small>
                  <div class="input-group mb-3">

                    <input type="text" readonly="" value="{{$user_name}}" class="form-control form-control-sm">


                    {{--Form::Text('user_name', '', ['class' => 'form-control form-control-sm  cls_required', 'placeholder' => 'Name' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default', 'disabled' => true])--}}
                  </div>
                </div>



                @if(strlen(trim($booking_name)) > 0)
                <div class="col-sm-6">
                     <label class="label-color">Booking Detail  </label>
                  <small class="form-errors pull-right req" value="">{{ $errors->first('booking_detail',":message") }}</small>
                  <div class="input-group mb-3">

                    <input type="text" readonly="" value="{{$booking_name}}" class="form-control form-control-sm">


                    {{--Form::Text('booking_detail', '', ['class' => 'form-control form-control-sm  cls_required', 'placeholder' => 'Booking Detail' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default', 'disabled' => true])--}}
                  </div>
                </div>
                @endif

                <div class="col-sm-6">
                     <label class="label-color">Payment Type  </label>
                  <small class="form-errors pull-right req" value="">{{ $errors->first('payment_type',":message") }}</small>
                  <div class="input-group mb-3">

                    <input type="text" readonly="" value="{{$payment_type}}" class="form-control form-control-sm">


                    {{--Form::Text('payment_type', '', ['class' => 'form-control form-control-sm  cls_required', 'placeholder' => 'Payment Type' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default',  'disabled' => true])--}}
                  </div>
                </div>

                <div class="col-sm-6">
                     <label class="label-color">Description  </label>
                  <small class="form-errors pull-right req" value="">{{ $errors->first('description',":message") }}</small>
                  <div class="input-group mb-3">

                    <input type="text" readonly="" value="{{$description}}" class="form-control form-control-sm">



                    {{--Form::Text('description', '', ['class' => 'form-control form-control-sm  cls_required', 'placeholder' => 'Description' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default',  'disabled' => true])--}}
                  </div>
                </div>
                @endif




                <div class="col-sm-6">
                     <label class="label-color">Amount  </label>
                  <small class="form-errors pull-right req" value="">{{ $errors->first('amount',":message") }}</small>
                  <div class="input-group mb-3">

                    {{Form::Text('amount',$amount, ['class' => 'form-control form-control-sm  cls_required', 'placeholder' => 'Amount' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default','onkeyup' => 'numberInWordsValue(this,"amount_in_words")'])}}
                  </div>
                </div>
                    <div class="@if(strlen(trim($booking_name)) > 0) col-sm-12 @else col-sm-6 @endif">
                     <label class="label-color">Amount In Words  </label>
                  <small class="form-errors pull-right req" value="">{{ $errors->first('amount_in_words',":message") }}</small>
                   <div class="input-group mb-3">

              <input placeholder="Amount In  Words" type="text" name= "amount_in_words" value="{{EF::numberToWords($amount)}}" readonly="" class="form-control-sm form-control amount_in_words" >
            </div>
                </div>

                <div class="col-sm-12"><h5>Payment Information</h5></div>


                <div class="col-sm-12">
                   <label class="label-color">Payment Mode: <i style = "color:red;">*</i></label>
                <small class="form-errors pull-right req" value="*">{{ $errors->first('mode',":message") }}</small>

                <div class="input-group mb-3">

                  @php($mode_list = [])

                  @foreach(EF::getPaymentMode() as $rows)
                    @php($mode_list += [$rows => $rows])
                  @endforeach

                 {{Form::select('mode', $mode_list, '' , array('class' => 'form-control form-control-sm  form-control form-control-sm -sm  cls_selection','onChange' => 'checkPaymentMode(this,"bank_payment_section")'))}}
                </div>
              </div>


          <div class="col-sm-4 bank_payment_section" style="display:none;">
               <label class="label-color">Drawn On:</label>
            <small class="form-errors pull-right req" value="">{{ $errors->first('drawn_on',":message") }}</small>

            <div class="input-group mb-3">

              {{Form::Text('drawn_on', '', ['class' => 'form-control form-control-sm  form-control form-control-sm -sm  cls_required', 'placeholder' => 'Bank Name ' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default'])}}
            </div>
          </div>

            <div class="col-sm-4 bank_payment_section" style="display:none;">

               <label class="label-color">Instrument:</label>
            <small class="form-errors pull-right req" value="">{{ $errors->first('instrument',":message") }}</small>

            <div class="input-group mb-3">

              {{Form::Text('instrument', '', ['class' => 'form-control form-control-sm  form-control form-control-sm -sm  cls_required', 'placeholder' => 'Instrument # ' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default'])}}
            </div>
          </div>
            <div class="col-sm-4 bank_payment_section" style="display:none;">
                 <label class="label-color">Instrument Date:</label>
            <small class="form-errors pull-right req" value="">{{ $errors->first('instument_date',":message") }}</small>

            <div class="input-group mb-3">

              {{Form::Date('instrument_date', '', ['class' => 'form-control form-control-sm  form-control form-control-sm -sm  cls_date' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default'])}}
            </div>

              <label class="label-color" style="display: none;"> <input  type="checkbox" name="pdc">&nbsp;PDC Amount</label>
          </div>





        </div>
          </div>
        </div>
      </div>
      <div class="modal-footer">
        <input type="hidden" name="generic" value="{{$generic}}">
        <input type="hidden" name="generic_type" value="{{$generic_type}}">
        @if(isset($role)) <input type="hidden" name="role"    value="{{$role}}"> @endif
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="submit" class="btn btn-primary cls_submit" content="add payment">Add Payment</button>
      </div>
    </div>
  </div>
  {{ Form::close() }}
</div>
 