@php($label_list = EF::getWhiteLabel())
<div class="modal fade" id="md_update_booking" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  {{ Form::open(array('route' => 'booking.update', 'id' => 'form_update_booking', 'class' => 'cls_from')) }}
  <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Edit Booking</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-header">
               <div class = "col-md-5">
    <strong class="strong-margin">CUSTOMER DETAILS</strong>
     </div>
              <div class = "col-md-6">
               
   
     </div>
             <div class = "col-md-1">
           <img src = "{{asset('assets/images/icons/userinformation.png')}}"/>
               
   
     </div>
           </div>
           <div class="card-body  form-fieldset">
            <div class = "row">
                   <div class="col-sm-6">
                       <label class="label-color"> CNIC: <i style = "color:red;">*</i></label>
            <small class="form-errors pull-right req" value="*">{{ $errors->first('customer_cnic',":message") }}</small>
            <div class="input-group mb-3">
             
              {{Form::Text('customer_cnic',$user->cnic, ['class' => 'form-control form-control-sm  cls_cnic', 'placeholder' => 'Customer Cnic #' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default','readonly' => 'true'])}}
            </div>
          </div>

          <div class="col-sm-6">
               <label class="label-color"> Name: <i style = "color:red;">*</i></label>
            <div class="input-group mb-3">
           
              {{Form::Text('customer_name',$user->name, ['class' => 'form-control form-control-sm  ', 'placeholder' => 'Name' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default', 'readonly' => 'true'])}}
            </div> 

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

        <div class="card">
           <div class="card-header">
              <div class = "col-md-5">
    <strong class="strong-margin">BOOKING DETAILS</strong>
     </div>
              <div class = "col-md-6">
               
   
     </div>
             <div class = "col-md-1">
           <img src = "{{asset('assets/images/icons/booking.png')}}"/>
               
   
     </div>
             
           </div>
           <div class="card-body form-fieldset">
            <div class= "row">
                    <div class="col-sm-4">
                         <label class="label-color"> {{ucwords(str_replace('_',' ',$label_list['file']))}} # <i style = "color:red;">*</i></label>
            <small class="form-errors pull-right req" value="">{{ $errors->first($label_list['file'],":message") }}</small>

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

            <div class="input-group mb-3">
           
              {{Form::Text($label_list['reference'],$booking->reference_number, ['readonly' => 'true','class' => 'form-control form-control-sm  cls_required reference', 'placeholder' => 'Reference # ' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default'])}}
            </div>    
          </div>

          <div class="col-sm-4">
               <label class="label-color"> {{ucwords(str_replace('_',' ',$label_list['booking_date']))}}: <i style = "color:red;">*</i></label>
            <small class="form-errors pull-right req" value="*">{{ $errors->first($label_list['booking_date'],":message") }}</small>

            <div class="input-group mb-3">
             
              {{Form::Date($label_list['booking_date'],date('Y-m-d',strtotime($booking->created_at)), ['class' => 'form-control form-control-sm  cls_date', 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default'])}}
            </div>    
          </div>

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

                <div class="card">
                 <div class="card-header">
                  <div class = "col-md-5">
    <strong class="strong-margin">{{ucwords(str_replace('_',' ',$label_list['plot']))}} DETAILS</strong>
     </div>
              <div class = "col-md-6">
               
   
     </div>
             <div class = "col-md-1">
           <img src = "{{asset('assets/images/icons/branchinformation.png')}}"/>
               
   
     </div>
                 </div>
                 <div class="card-body  form-fieldset">
                  <div class = "row">
                     <div class="col-sm-4">
              <label class="label-color">{{ucwords(str_replace('_',' ',$label_list['branch']))}}: <i style = "color:red;">*</i></label>
            <small class="form-errors pull-right req" value="*">{{ $errors->first($label_list['branch'],":message") }}</small>

            <div class="input-group mb-3">
           
              @if($booking->status == 'Unapprove')
                    @include('layouts.common.branch')
                    
              @else
                <input type="hidden" name="{{$label_list['branch']}}" value="{{Crypt::encrypt($booking->branch_id)}}">
                    <input class="form-control form-control-sm" type="text" readonly="" value="{{$booking->branch->name}}">
              @endif
            </div>    
          </div>

          <div class="col-sm-4">
                 <label class="label-color"> {{ucwords(str_replace('_',' ',$label_list['plot']))}}: <i style = "color:red;">*</i></label>
            <small class="form-errors pull-right req" value="*">{{ $errors->first($label_list['plot'],":message") }}</small>

            <div class="input-group mb-3">
              
               @if($booking->status == 'Unapprove')
               <select name="{{$label_list['plot']}}" class="fstdropdown-select form-control form-control-sm  cls_selection plot_list"  onChange = "getPlotInfo(event,this)">

                
               
                  <option value="{{Crypt::encrypt($plot->id)}}" selected="true">{{$plot->plot_id}} {{$plot->category}}</option>
                  @foreach($plot_list as $rows)

                  <option  value="{{Crypt::encrypt($rows->id)}}" >{{$rows->plot_id}} {{$rows->category}}</option>
                
                  @endforeach
                  

                
              
              
              </select>
              @else
              <select readonly="true" name="{{$label_list['plot']}}" class="form-control form-control-sm  cls_selection plot_list"  onChange = "getPlotInfo(event,this)">

                
               
                  <option value="{{Crypt::encrypt($plot->id)}}" selected="true">{{$plot->plot_id}} {{$plot->category}}</option>
                

                
              
              
              </select>
              @endif
            </div>    
          </div>
          
             <div class="col-sm-4">
              <label class="label-color">{{ucwords(str_replace('_',' ',$label_list['type']))}}: <i style = "color:red;">*</i></label>
            <small class="form-errors pull-right req" value="*">{{ $errors->first($label_list['type'],":message") }}</small>

            <div class="input-group mb-3">
            @if($booking->status == 'Unapprove')

            <input value="{{$plot->type}}" class="form-control form-control-sm type" type="text" readonly="" name="{{$label_list['type']}}" placeholder="{{ucwords(str_replace('_',' ',$label_list['type']))}}">
             
              {{--
              <select name="{{$label_list['type']}}" class="form-control form-control-sm type_list cls_selection" onchange="getCategoryList(event,this,'branch')">
                <option value="{{Crypt::encrypt(0)}}">Select Type</option>

                 <option value="{{Crypt::encrypt($plot->type)}}" selected="true">{{$plot->type}}</option>

                @foreach($plot_type as $rows)
                  @if($rows->type != $plot->type)
                    <option  value="{{Crypt::encrypt($rows->type)}}" >{{$rows->type}}</option>
                  @endif
                @endforeach
              </select>
              --}}

              
               @else
                <input type="hidden" name="{{$label_list['type']}}" value="{{Crypt::encrypt($booking->plot->type)}}">
                    <input class="form-control form-control-sm" type="text" readonly="" value="{{$booking->plot->type}}">
              @endif
              
            </div>    
          </div>
                    <div class="col-sm-4">
              <label class="label-color">{{ucwords(str_replace('_',' ',$label_list['category']))}}: <i style = "color:red;">*</i></label>
            <small class="form-errors pull-right req" value="*">{{ $errors->first($label_list['category'],":message") }}</small>

            <div class="input-group mb-3">
            @if($booking->status == 'Unapprove')

            <input value="{{$plot->category}}" class="form-control form-control-sm category" type="text" readonly="" name="{{$label_list['category']}}" placeholder="{{ucwords(str_replace('_',' ',$label_list['category']))}}">

             {{--

              <select name="{{$label_list['category']}}" class="form-control form-control-sm category_list cls_selection" onchange="getPlotList(event,this,'type_list','branch')">
                <option value="{{Crypt::encrypt(0)}}">Select Category</option>

                  <option value="{{Crypt::encrypt($plot->category)}}" selected="true">{{$plot->category}}</option>
               
                @foreach($plot_category as $rows)
                  @if($rows->category != $plot->category)
                    <option  value="{{Crypt::encrypt($rows->category)}}" >{{$rows->category}}</option>
                  @endif
               @endforeach
              </select>

              --}}

              
               @else
                <input type="hidden" name="{{$label_list['type']}}" value="{{Crypt::encrypt($booking->plot->type)}}">
                    <input class="form-control form-control-sm" type="text" readonly="" value="{{$booking->plot->type}}">
              @endif
              
            
          
            </div>    
          </div>

        {{--
           <div class="col-sm-4">
               <label class="label-color"> {{ucwords(str_replace('_',' ',$label_list['block']))}}: <i style = "color:red;">*</i></label>
            <small class="form-errors pull-right req" value="*">{{ $errors->first($label_list['block'],":message") }}</small>

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

              <select name="{{$label_list['block']}}" class="form-control form-control-sm  cls_selection block_list" onChange = "getPlotList(event,this)">

              @if($booking->status == 'Unapprove')
                @foreach($block as $rows)
                <option @if($rows->block_name == $plot->block_name) selected="true" @endif value="{{Crypt::encrypt($rows->block_name)}}" >{{$rows->block_name}}</option>
                @endforeach
              @else
                <option value="{{Crypt::encrypt($plot->block_name)}}" >{{ucfirst($plot->block_name)}}</option>
              @endif
              </select>

            </div>    
          </div>
          --}} 
            
            <div class="col-sm-4">
                 <label class="label-color">{{ucwords(str_replace('_',' ',$label_list['size']))}} : <i style = "color:red;">*</i></label>

            <div class="input-group mb-3">
                          {{Form::Text($label_list['size'], $plot->size, ['class' => 'form-control form-control-sm  cls_date size','readonly' => 'true' , 'placeholder' => 'Size' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default'])}}
            </div>    
          </div>
                <div class="col-sm-4">
                   <label class="label-color">{{ucwords(str_replace('_',' ',$label_list['total_amount']))}}: </label>
            <small class="form-errors pull-right req" value="">{{ $errors->first($label_list['total_amount'],":message") }}</small>

            <div class="input-group mb-3">
         
              {{Form::Text($label_list['total_amount'],$plot->rate, ['class' => 'form-control form-control-sm cls_required rate' , 'placeholder' => 'Total Price' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default', 'onkeyup' => 'calculateAgreed()','readonly'=>'true'])}}
            </div>    
          </div>
            
          {{--
            <div class="col-sm-4">
                 <label class="label-color"> {{ucwords(str_replace('_',' ',$label_list['total_amount']))}}: <i style = "color:red;">*</i></label>

            <div class="input-group mb-3">
             
              {{Form::Text($label_list['total_amount'], $booking->rate_per_marla, ['class' => 'form-control form-control-sm  total_amount','readonly' => 'true' , 'placeholder' => 'Total Amount' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default'])}}
            </div>    
          </div>
            --}}  
         <div class="col-sm-4">
             <label class="label-color"> {{ucwords(str_replace('_',' ',$label_list['feature_charges']))}}:</label>
            <small class="form-errors pull-right req" value="">{{ $errors->first($label_list['feature_charges'],":message") }}</small>

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

                 <input placeholder="Feature Charges" value="{{$plot->featurecharges}}" type="text" name="{{$label_list['feature_charges']}}" class="form-control form-control-sm   cls_required feature_charges" onkeyup="calculateAgreed()" readonly >
            </div>    
          </div>
         <div class="col-sm-8">
              <label class="label-color">{{ucwords(str_replace('_',' ',$label_list['feature_description']))}}:</label>
            <div class="input-group mb-3">
            
              {{Form::Text($label_list['feature_description'],$plot->feature_description, ['class' => 'form-control form-control-sm   feature_description','readonly' => 'true' , 'placeholder' => 'Feature Description' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default' , 'onkeyup' => 'calculateAgreed()'])}}
            </div>    
          </div>

           <div class="col-sm-4">
               <label class="label-color"> {{ucwords(str_replace('_',' ',$label_list['discount']))}}:</label>
            <small class="form-errors pull-right req" value="">{{ $errors->first($label_list['discount'],":message") }}</small>

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


                 <input placeholder="Discount" value="{{$booking->discount}}" type="text" name="{{$label_list['discount']}}" class="form-control form-control-sm   cls_required discount" onkeyup="calculateAgreed()" @if($booking->status != "Unapprove") readonly @endif >
            </div>    
          </div>

          <div class="col-sm-8">
               <label class="label-color"> Discount In Words:</label>
            <div class="input-group mb-3">
             
              {{Form::Text('',EF::numberToWords($booking->discount), ['class' => 'form-control form-control-sm  discount_inwords','readonly' => 'true' , 'placeholder' => 'Discount In Words' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default' , 'onkeyup' => 'calculateAgreed()'])}}
            </div>    
          </div>


             <div class="col-sm-4">
                 <label class="label-color"> {{ucwords(str_replace('_',' ',$label_list['agreed_amount']))}} :<i style = "color:red;">*</i></label>
            <small class="form-errors pull-right req" value="">{{ $errors->first($label_list['agreed_amount'],":message") }}</small>

            <div class="input-group mb-3">
          
              {{Form::Text($label_list['agreed_amount'], $booking->agreed_amount, ['class' => 'form-control form-control-sm  agreed_amount', 'readonly' => 'true' , 'placeholder' => 'Agreed Amount' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default', 'onkeyup' => 'calculateAgreed()'])}}
            </div>    
          </div>

          <div class="col-sm-8">
               <label class="label-color"> Agreed Amount In Words: <i style = "color:red;">*</i></label>
            <div class="input-group mb-3">
           
              {{Form::Text('',EF::numberToWords($booking->agreed_amount), ['class' => 'form-control form-control-sm  agreed_inwords','readonly' => 'true' , 'placeholder' => 'Agreed Amount In Words' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default', 'onkeyup' => 'calculateAgreed()'])}}
            </div>    
          </div>


                <div class="col-sm-12">
                     <label class="label-color">{{ucwords(str_replace('_',' ',$label_list['remarks']))}} :</label>
                  {{Form::Textarea($label_list['remarks'],$booking->remarks, ['class' => 'form-control form-control-sm ', 'placeholder' => 'Remarks' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default','rows' => 2])}}
             </div>  
             
                  </div>
                   
                 </div>
                </div>
{{--
                   <div class="card">
                 <div class="card-header">
                  <div class = "col-md-5">
    <strong class="strong-margin">PAYMENT DETAILS</strong>
     </div>
              <div class = "col-md-6">
               
   
     </div>
             <div class = "col-md-1">
           <img src = "{{asset('assets/images/icons/payment.png')}}"/>
               
   
     </div>
                 </div>
                 <div class="card-body  form-fieldset">
                  <div class = "row">
                       <div class="col-sm-4">
                           <label class="label-color"> {{ucwords(str_replace('_',' ',$label_list['receipt']))}}  #</label>
            <small class="form-errors pull-right req" value="">{{ $errors->first($label_list['receipt'],":message") }}</small>

            <div class="input-group mb-3">
           
              {{Form::Text($label_list['receipt'], $booking->receipt_number, ['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">{{ucwords(str_replace('_',' ',$label_list['token_amount']))}}:</label>
            <small class="form-errors pull-right req" value="">{{ $errors->first($label_list['token_amount'],":message") }}</small>

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

              <input placeholder="Token Amount " value="{{$booking->token_amount}}"  type="text" name="{{$label_list['token_amount']}}" class="form-control form-control-sm   cls_required token_amount" @if($booking->status != "Unapprove") readonly @endif >
            </div>   
          </div>

           <div class="col-sm-4">
               <label class="label-color">{{ucwords(str_replace('_',' ',$label_list['payment_mode']))}}:</label>
            <small class="form-errors pull-right req" value="*">{{ $errors->first($label_list['payment_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($label_list['payment_mode'], $mode_list, $booking->mode , array('class' => 'form-control form-control-sm  cls_selection','onChange' => 'checkPaymentMode(this,"bank_section")'))}}
            </div>    
          </div>
        </div>

               <div class ="bank_section row" @if($booking->mode == 'Cash') style="display:none;" @endif >
          <div class="col-sm-4">
               <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', $booking->drawn_on, ['class' => 'form-control form-control-sm  cls_required', 'placeholder' => 'Bank Name ' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default'])}}
            </div>   
          </div>

           <div class="col-sm-4">
               <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',$booking->instrument, ['class' => 'form-control form-control-sm  cls_required', 'placeholder' => 'Cheque # ' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default'])}}
            </div>   
          </div>
            <div class="col-sm-4">
                 <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',str_replace('1970-01-01','',date('Y-m-d',strtotime($booking->instrument_date))), ['class' => 'form-control form-control-sm  cls_date' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default'])}}
            </div>    
          </div>
        </div>

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

   


