
<div class="modal fade" id="md_update_payment" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  {{ Form::open(array('route' => 'payment.update', 'class' => 'cls_form', 'id' => 'form_update_payment')) }}
  <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Update 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="{{$curr_payment->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>

                 @if($curr_payment->generic_type_id == EF::getGenericTableIndex()['Vendor Payment'])
                      @if(isset($vendor_payment->id))
                        <div class="col-sm-4">
                             <label class="label-color">Invoice No </label>
                          <small class="form-errors pull-right req" value="">{{ $errors->first('receipt',":message") }}</small>
                          <div class="input-group mb-3">
                           
                            {{Form::Text('invoice_no',$vendor_payment->invoice_no, ['class' => 'form-control form-control-sm  cls_required', 'placeholder' => 'Invoice No' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default', 'readonly' => 'true'])}}
                          </div>
                        </div>
                      @endif
                  <input type="hidden" name="receipt">
                @elseif($curr_payment->generic_type_id == EF::getGenericTableIndex()['Inventory Payable']) 
               
                        <div class="col-sm-4">
                             <label class="label-color">Invoice No </label>
                          <small class="form-errors pull-right req" value="">{{ $errors->first('receipt',":message") }}</small>
                          <div class="input-group mb-3">
                           
                            {{Form::Text('invoice_no',$invoice, ['class' => 'form-control form-control-sm  cls_required', 'placeholder' => 'Invoice No' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default', 'readonly' => 'true'])}}
                          </div>
                        </div>
                  <input type="hidden" name="receipt">

                @else
                  <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',$curr_payment->receipt_no, ['class' => 'form-control form-control-sm  cls_required', 'placeholder' => 'Receipt #' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default', 'readonly' => 'true'])}}
                    </div>
                  </div>
                @endif

                {{--
                <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',$curr_payment->receipt_no, ['class' => 'form-control form-control-sm  cls_required', 'placeholder' => 'Receipt #' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default'])}}
                  </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">

                    {{Form::date('date',(EF::dateHtml($curr_payment->created_at)), ['class' => 'form-control form-control-sm  cls_date', 'placeholder' => 'Date' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default'])}}
                  </div>
                </div>




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

                @if($curr_payment->generic_type_id == EF::getGenericTableIndex()['Vendor Payment'])
                
                @if(isset($vendor_payment->id))
                <div class="col-sm-6">
                     <label class="label-color">Vendor  </label>
                  <small class="form-errors pull-right req" value="">{{ $errors->first('vendor',":message") }}</small>
                  <div class="input-group mb-3">

                    <input type="text" readonly="" value="{{$vendor_payment->vendor->vendor_name}}" 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>


                @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="{{$curr_payment->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-12">
                     <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="{{$curr_payment->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="{{$curr_payment->role->name}}" 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="{{$curr_payment->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="{{$curr_payment->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="{{$curr_payment->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',$curr_payment->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($curr_payment->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">

                  <select onchange="checkPaymentMode(this,'bank_payment_section')" class="form-control form-control-sm" name="mode">
                      @foreach(EF::getPaymentMode() as $rows)
                          <option @if($curr_payment->mode == $rows) selected @endif value="{{$rows}}">{{$rows}}</option>
                      @endforeach
                  </select>

                </div>
              </div>


          <div class="col-sm-4 bank_payment_section" @if($curr_payment->mode === "Cash") style="display:none;" @endif>
               <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',$curr_payment->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" @if($curr_payment->mode === "Cash") style="display:none;" @endif>

               <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',$curr_payment->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" @if($curr_payment->mode === "Cash") style="display:none;" @endif>
                 <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',EF::dateHtml($curr_payment->created_at), ['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"> <input @if($curr_payment->post_dated == "1") checked @endif type="checkbox" name="pdc">&nbsp;PDC Amount</label>
          </div>

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

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

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

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

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

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




        </div>
          </div>
        </div>
      </div>
      <div class="modal-footer">
        <input type="hidden" name="payment" value="{{Crypt::encrypt($curr_payment->id)}}">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="submit" class="btn btn-primary cls_submit" content="add payment">Update Payment</button>
      </div>
    </div>
  </div>
  {{ Form::close() }}
</div>
