@if(Auth::user()->hasAnyPermission(['All','Make Booking']))

@php($label_list = EF::getWhiteLabel())
<div class="modal fade" id="md_make_booking" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  {{ Form::open(array('route' => 'booking.store', 'id' => 'form_add_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">Make 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  req" value="*">{{ $errors->first('customer_cnic',":message") }} </small>
            <div class="input-group mb-3">

              {{Form::Text('customer_cnic', '', ['class' => 'form-control form-control-sm  cls_cnic' ,'data-mask' => '00000-0000000-0', 'data-mask-clearifnotmatch' => 'true' ,'placeholder' => '00000-0000000-0'  , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default','onchange' => 'validateCnic(event,this)'])}}
            </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', '', ['class' => 'form-control form-control-sm  form-control form-control-sm -sm  ', 'placeholder' => 'Name' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default', 'readonly' => 'true'])}}
            </div>

            <input type="hidden" name="user_id" >
          </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'], '', ['class' => 'form-control form-control-sm  form-control form-control-sm -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'], '', ['readonly' => 'true','class' => 'form-control form-control-sm  form-control form-control-sm -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'), ['class' => 'form-control form-control-sm  form-control form-control-sm -sm  cls_date', 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default'])}}
            </div>

          </div>
            @if(Auth::user()->hasAnyPermission(['All','Make Soft Booking']))
          <div class="col-sm-12" style="text-align: right;">
             <div class="form-check form-check-inline">
                  <input onchange="checkReserveBooking(event,this)" class="form-check-input" name="reserve_booking" type="checkbox" >
                <label  class="form-check-label">Soft Booking</label>
              </div>
          </div>


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

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

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

                                </div>--}}

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

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

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

          </div>
          @endif

          </div>
        </div>
      </div>
      <div class = "card">
        <div class = "card-header">

         <div class = "col-md-5">
    <strong class="strong-margin"> {{strtoupper(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">
              @if(Auth::user()->hasAnyPermission(['All','Store Inventory']))
             <div class="col-sm-12">
               <button onclick="requestOpenModal(event,'md_add_inventory','md_make_booking')" style="float:right; font-weight: bolder;" class="btn-primary btn-sm">Add {{strtoupper(str_replace('_',' ',$label_list['plot']))}}</button>
             </div>
             @endif
       <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">

                    @include('layouts.common.branch')
            </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">

              @php($plot_list = ['0' => 'Select Article'])



             {{Form::select($label_list['plot'], $plot_list, '' , array('class' => 'form-control form-control-sm   cls_selection plot_list fstdropdown-select', 'data-searchdisable' => 'false', 'onChange' => 'getPlotInfo(event,this)'))}}
            </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">
                <input class="form-control form-control-sm type" type="text" readonly="" name="{{$label_list['type']}}" placeholder="{{ucwords(str_replace('_',' ',$label_list['type']))}}">

              @php($type_list = ['selected' => 'Select Type'])
{{--
              {{Form::select($label_list['type'], $type_list, '' , array('class' => 'form-control form-control-sm  cls_selection type_list', 'onChange' => 'getCategoryList(event,this,"branch")'))}}
--}}

            </div>
          </div>
               <div class="col-sm-6">
              <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">
              <input class="form-control form-control-sm category" type="text" readonly="" name="{{$label_list['category']}}" placeholder="{{ucwords(str_replace('_',' ',$label_list['category']))}}">
   {{--
             @php($category_list = ['selected' => 'Select Category'])

           {{Form::select($label_list['category'], $category_list, '' , array('class' => 'form-control form-control-sm category_list cls_selection ', 'onChange' => 'getPlotList(event,this,"type_list","branch")'))}}
    --}}

            </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">

              @php($block_list = ['selected' => 'Select Block'])

              @foreach($block as $rows)
                @php($block_list += [Crypt::encrypt($rows->block_name) => $rows->block_name])
              @endforeach

             {{Form::select($label_list['block'], $block_list, '' , array('class' => 'form-control form-control-sm  form-control form-control-sm -sm  cls_selection block_list')}}

            </div>
          </div>
          --}}

            <div class="col-sm-6">
                 <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'], '', ['class' => 'form-control form-control-sm  form-control form-control-sm -sm  cls_date size','readonly' => 'true' , 'placeholder' => ucwords(str_replace('_',' ',$label_list['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'], '', ['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-8">
            <label class="label-color"> {{ucwords(str_replace('_',' ',$plot_labels['rate']))}} Into Words:</label>


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

              <input placeholder="{{ucwords(str_replace('_',' ',$plot_labels['rate']))}} In To Words" type="text" readonly="" class="form-control-sm form-control rate_into_words" >
            </div>

          </div>


             {{--
                  <div class="col-sm-4">
                <label class="label-color">{{ucwords(str_replace('_',' ',$label_list['total_amount']))}}:</label>

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

              {{Form::Text($label_list['total_amount'], '', ['class' => 'form-control form-control-sm total_amount','readonly' => 'true' , 'placeholder' => 'Total Price' , '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">

              {{Form::Text($label_list['feature_charges'], '', ['class' => 'form-control form-control-sm   cls_required feature_charges' , 'placeholder' => 'Feature Charges' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default', 'onkeyup' => 'calculateAgreed()','readonly' => 'true'])}}
            </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('', '', ['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">

              {{Form::Text($label_list['discount'], '', ['class' => 'form-control form-control-sm  discount', 'placeholder' => 'Discount' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default' , 'onkeyup' => 'calculateAgreed()'])}}
            </div>
          </div>

          <div class="col-sm-8">
              <label class="label-color">Discount In Words:</label>
            <div class="input-group mb-3">

              {{Form::Text('', '', ['class' => 'form-control form-control-sm  form-control form-control-sm -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'], '', ['class' => 'form-control form-control-sm  form-control form-control-sm -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:</label>
            <div class="input-group mb-3">

              {{Form::Text('', '', ['class' => 'form-control form-control-sm  form-control form-control-sm -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'], '', ['class' => 'form-control form-control-sm  form-control form-control-sm -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-6">
                 <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'], '', ['class' => 'form-control form-control-sm  form-control form-control-sm -sm  cls_required', 'placeholder' => 'Receipt # ' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default'])}}
            </div>
          </div>

           <div class="col-sm-6">
               <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">

              {{Form::Text($label_list['token_amount'], '', ['class' => 'form-control form-control-sm token cls_required', 'placeholder' => 'Token Amount' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default','onkeyup' => 'numberInWordsValue(this,"token_in_words")'])}}
            </div>
          </div>

           <div class="col-sm-6">
               <label class="label-color">{{ucwords(str_replace('_',' ',$label_list['token_amount']))}} Into Words:</label>


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


              {{Form::Text('token_in_words', '', ['class' => 'form-control form-control-sm   cls_required token_in_words', 'placeholder' => 'Token Amount In Words' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default','readonly' => 'true'])}}

            </div>
          </div>


           <div class="col-sm-6">
               <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, '' , array('class' => 'form-control form-control-sm  form-control form-control-sm -sm  cls_selection','onChange' => 'checkPaymentMode(this,"bank_section")'))}}
            </div>
          </div>
        </div>
          <div class ="bank_section row" style="display:none;">

          <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', '', ['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">
               <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' => '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', '', ['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 class = "card">
        <div class = "card-header">

         <div class = "col-md-5">
    <strong class="strong-margin">SALES DETAILS</strong>
     </div>
              <div class = "col-md-6">

     </div>
             <div class = "col-md-1">
           <img src = "{{asset('assets/images/icons/sales.png')}}"/>


     </div>

        </div>
        <div class = "card-body  form-fieldset">
          <div class = "row">



            <div class="col-sm-6">
                <label class="label-color">Select Salesperson :</label>


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


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


               @php($employee_list = [])
               @foreach($employee as $rows)
              @php($employee_list += [Crypt::encrypt($rows->id) => ucfirst($rows->name).' '.ucfirst($rows->designation->title)])
              @endforeach

            {{Form::select('employee[]', $employee_list, '' , array('class' => 'form-control form-control-sm  form-control form-control-sm -sm  employee_list cls_selection','multiple'=>'multiple'))}}

       @if(Auth::user()->hasAnyPermission(['All','Add Employee']))
            <small class="btn-sm btn-primary plus-button" onclick="showModal('form_add_employee','md_add_employee')"><i class="fa fa-plus"> </i></small>
            @endif
            </div>
          </div>
              <div class="col-sm-6">
               <label class="label-color">Select Dealer:</label>
            <small class="form-errors pull-right req" value="">{{ $errors->first('dealer',":message") }}</small>

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

               @php($dealer_list = [])
               @foreach($dealer as $rows)
              @php($dealer_list += [Crypt::encrypt($rows->id) => ucfirst($rows->name).' ('.ucfirst($rows->type).')'])
              @endforeach

            {{Form::select('dealer[]', $dealer_list, '' , array('class' => 'form-control form-control-sm  form-control form-control-sm -sm  dealer_list cls_selection', 'multiple'=>'multiple'))}}
                   @if(Auth::user()->hasAnyPermission(['All','Add Dealer']))
             <small class="btn-sm btn-primary plus-button" onclick="showModal('form_add_dealer','md_add_dealer')"><i class="fa fa-plus"> </i></small>
             @endif
            </div>
          </div>




          </div>
        </div>
      </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="submit" class="btn btn-primary cls_submit" content="make booking">Submit Booking</button>
      </div>
    </div>
  </div>
  {{ Form::close() }}
</div>
@endif

