
<!-- Modal ADD NOMINEE-->
<div class="modal fade" id="md_add_nominee" tabindex="-1" role="dialog" aria-labelledby="exampleModallabel" aria-hidden="true">
  <?php echo e(Form::open(array('route' => 'nominee.store', 'id' => 'form_add_nominee', 'class' => 'cls_from', 'enctype' => 'multipart/form-data'))); ?>

  <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModallabel">Add Nominee/Co-Owner</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">NOMINEE/ CO-OWNER</strong>
     </div>
              <div class = "col-md-6">


     </div>
             <div class = "col-md-1">
           <img src = "<?php echo e(asset('assets/images/icons/userinformation.png')); ?>"/>


     </div>
        </div>
        <div class = "card-body form-fieldset">
          <div class ="row">
               <input type="hidden" name="<?php echo e($branch_labels['module']); ?>" value="<?php echo e(Crypt::encrypt($user->branch_id)); ?>" />
            <input type="hidden" name="booking_id" value="<?php echo e(Crypt::encrypt($booking->id)); ?>" />
            <input type="hidden" name="relation_id" value="<?php echo e(Crypt::encrypt($user->id)); ?>" />

           <div class="col-sm-6">
                <label class="label-color">Type: <i style = "color:red;">*</i></label>
            <small class="form-errors pull-right req" value="*"><?php echo e($errors->first('nok_type',":message")); ?></small>

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

              <?php ($type_list = []); ?>

              <?php $__currentLoopData = EF::getNomineeType(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $rows): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php ($type_list += [$rows => $rows]); ?>
              <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

             <?php echo e(Form::select('nok_type', $type_list, '' , array('class' => 'form-control form-control-sm  cls_selection'))); ?>

            </div>
          </div>

            <div class="col-sm-6">
                  <label class="label-color"> Relationship: <i style = "color:red;">*</i></label>
            <small class="form-errors pull-right req" value="*"><?php echo e($errors->first('relation_ship',":message")); ?></small>

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

              <?php echo e(Form::Text('relation_ship', '', ['class' => 'form-control form-control-sm  cls_required', 'placeholder' => 'Nominee Relation' , '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">PERSONAL INFORMATION</strong>
     </div>
              <div class = "col-md-6">


     </div>
             <div class = "col-md-1">
           <img src = "<?php echo e(asset('assets/images/icons/userinformation.png')); ?>"/>


     </div>

        </div>
        <div class = "card-body form-fieldset">
          <div class ="row">
            <div class="col-sm-12">
                  <label class="label-color"> CNIC: <i style = "color:red;">*</i></label>
            <small class="form-errors pull-right req" value="*"><?php echo e($errors->first('cnic',":message")); ?></small>
            <div class="input-group mb-3">

              <?php echo e(Form::Text('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' =>  'validateCnicFornominee(event,this)'])); ?>

            </div>
          </div>


          <div class="col-sm-6">
                <label class="label-color"> Name: <i style = "color:red;">*</i></label>
            <small class="form-errors pull-right req" value="*"><?php echo e($errors->first('full_name',":message")); ?></small>

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

              <?php echo e(Form::Text('full_name', '', ['class' => 'form-control form-control-sm  cls_fullname', 'placeholder' => 'Full name' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default'])); ?>

            </div>


          </div>



          <div class="col-sm-6">
                <label class="label-color"> Father Name: <i style = "color:red;">*</i></label>
            <small class="form-errors pull-right req" value="*"><?php echo e($errors->first('father_name',":message")); ?></small>

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

              <?php echo e(Form::Text('father_name', '', ['class' => 'form-control form-control-sm  cls_fullname', 'placeholder' => 'Father name' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default'])); ?>

            </div>
          </div>

          <div class="col-sm-6">
              <small class="form-errors pull-right req" value="*"><?php echo e($errors->first('gender',":message")); ?></small>
               <label class="radio-inline" >
                <strong>Gender </strong>
                      <input type="radio" name="gender" value="Male" checked> Male
                </label>
                <label class="radio-inline">
                  <input type="radio" name="gender" value="Female"> Female
                </label>
            </div>

            <div class="col-sm-6">
              <small class="form-errors pull-right req" value="*"><?php echo e($errors->first('relation',":message")); ?></small>
               <label class="radio-inline" >
                <strong>Relation </strong>
                      <input type="radio" name="relation" value="S/O" checked> S / O
                </label>

                <label class="radio-inline">
                  <input type="radio" name="relation" value="D/O"> D / O
                </label>

                <label class="radio-inline">
                  <input type="radio" name="relation" value="W/O"> W / O
                </label>
            </div>





          <div class="col-sm-6">
                <label class="label-color"> Nationality:</label>
            <small class="form-errors pull-right req" value=""><?php echo e($errors->first('nationality',":message")); ?></small>

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

              <?php echo e(Form::Text('nationality', '', ['class' => 'form-control form-control-sm  cls_fullname', 'placeholder' => 'Pakistani' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default'])); ?>


            </div>
          </div>
               <div class="col-sm-6">
               <label class="label-color">Passport:</label>
            <small class="form-errors pull-right req" value=""><?php echo e($errors->first('nationality',":message")); ?></small>

            <div class="input-group mb-3">
              <?php echo e(Form::Text('passport', '', ['class' => 'form-control form-control-sm cls_alpha_numeric', 'placeholder' => 'Passport' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default'])); ?>


            </div>
          </div>

          <div class="col-sm-6">
                <label class="label-color"> Occupation:</label>
            <small class="form-errors pull-right req" value=""><?php echo e($errors->first('occupation',":message")); ?></small>

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

              <?php echo e(Form::Text('occupation', '', ['class' => 'form-control form-control-sm  cls_fullname', 'placeholder' => 'Occupation' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default'])); ?>


            </div>
          </div>
               <div class="col-sm-6">
                <label class="label-color"> DOB:</label>
            <small class="form-errors pull-right req" value=""><?php echo e($errors->first('DOB',":message")); ?></small>

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

              <?php echo e(Form::Date('dob', '', ['class' => 'form-control form-control-sm  cls_date', 'placeholder' => 'Date of birth' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default'])); ?>

            </div>
          </div>

          <div class="col-sm-6">
                <label class="label-color"> Contact: <i style = "color:red;">*</i></label>
            <small class="form-errors pull-right req" value="*"><?php echo e($errors->first('contact',":message")); ?></small>

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

              <?php echo e(Form::Text('contact', '', ['class' => 'form-control form-control-sm  cls_contact', 'placeholder' => 'Contact no' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default','data-mask' => '0000-0000000', 'data-mask-clearifnotmatch' => 'true' ,'placeholder' => '0000-0000000'])); ?>

            </div>
          </div>

                  <div class="col-sm-6">
               <label class="label-color">Other Contact: </label>
            <small class="form-errors pull-right req" value=""><?php echo e($errors->first('other_contact',":message")); ?></small>

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

              <?php echo e(Form::Text('other_contact', '', ['class' => 'form-control form-control-sm cls_contact', 'placeholder' => 'Other Contact' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default'])); ?>

            </div>
          </div>




          <div class="col-sm-6">
                <label class="label-color"> Temporary Address:</label>
            <small class="form-errors pull-right req" value=""><?php echo e($errors->first('temporary_address',":message")); ?></small>

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

              <?php echo e(Form::Textarea('temporary_address', '', ['class' => 'form-control form-control-sm ', 'placeholder' => 'Temporary address' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default','rows' => 2])); ?>

            </div>
          </div>

           <div class="col-sm-6">
                <label class="label-color"> Permanent Address:</label>
            <small class="form-errors pull-right req" value=""><?php echo e($errors->first('permanent_address',":message")); ?></small>

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

              <?php echo e(Form::textarea('permanent_address', '', ['class' => 'form-control form-control-sm ', 'placeholder' => 'Permanent address' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default','rows' => 2])); ?>

            </div>
          </div>

           <div class="col-sm-12">
            <small class="form-errors pull-right req" value=""><?php echo e($errors->first('user_image',":message")); ?></small>

            <div class="input-group mb-3">
              <div class="input-group-prepend">
                <span class="input-group-text" id="inputGroup-sizing-default">
                  <i class="fa fa-camera "></i>
                </span>
              </div>
              <input type="file" name="user_image" class="form-control form-control-sm btn-sm">
             <div class="input-group-prepend">
                <span class="input-group-text" id="inputGroup-sizing-default">
                  <i class ="userimage">PNG,JPG,JPEG</i>
                </span>
              </div>

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

         <div class = "col-md-5">
    <strong class="strong-margin">ACCOUNT INFORMATION</strong>
     </div>
              <div class = "col-md-6">


     </div>
             <div class = "col-md-1">
           <img src = "<?php echo e(asset('assets/images/icons/accountinformation.png')); ?>"/>


     </div>
        </div>
        <div class = "card-body form-fieldset">
          <div class ="row">
                         <div class="col-sm-12">
                            <label class="label-color"> Email:</label>
                        <small class="form-errors pull-right req" value=""><?php echo e($errors->first('email',":message")); ?></small>

                        <div class="input-group mb-3">
                          <?php echo e(Form::Email('email', '', ['class' => 'form-control form-control-sm  cls_email', 'placeholder' => 'Email' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default'])); ?>


                        </div>
                      </div>
          </div>
        </div>
        </div>
      </div>
      <div class="modal-footer">
          <input type="hidden" name="user_id" value/>
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button onClick="storeUser(event,this)" type="submit"  class="btn btn-primary cls_submit " content="add nominee/ co-owner">Add Nominee</button>
      </div>
    </div>
  </div>
  <?php echo e(Form::close()); ?>

</div>

<!-- END MODAL ADD NOMINEE -->

<script type="text/javascript">

    function validateCnicFornominee(event,obj)
        {
			 event.preventDefault();

			 var valid =  validate_cnic($(obj));

			        if(valid == true)
			        {
			        	showLoader();

			        	 var route = "<?php echo e(url('usercnic')); ?>/"+$(obj).val();

			        	 $.get(route, function(data)
						 {

							if(data.new_id)
							{
						     	$("input[name=full_name]").val(data.name);
                                $("input[name=user_id]").val(data.new_id);
                                $("input[name=father_name]").val(data.fname);
                                $("input[name=nationality]").val(data.nationality);
                                $("input[name=passport]").val(data.passport);
                                $("input[name=occupation]").val(data.occupation);
                                $("input[name=gender][value=" + data.gender + "]").prop('checked', true);
                                $("input[name=relation][value='" + data.relation + "']").prop('checked', true);
                                $("input[name=dob]").val(getDateFormatForDateInput(data.dob));
                                $("input[name=contact]").val(data.contact);
                                $("input[name=other_contact]").val(data.other_contact);
                                $("textarea[name=temporary_address]").val(data.temp_address);
                                $("textarea[name=permanent_address]").val(data.per_address);

                                // Disabling Input and textarea fields

                                $("textarea").prop('disabled',true);

                                $("input[name=full_name]").prop('disabled',true);

                                $("input[name=father_name]").prop('disabled',true);
                                $("input[name=nationality]").prop('disabled',true);
                                $("input[name=passport]").prop('disabled',true);
                                $("input[name=occupation]").prop('disabled',true);
                                $("input[name=gender]").prop('disabled',true);
                                $("input[name=relation]").prop('disabled',true);
                                $("input[name=dob]").prop('disabled',true);
                                $("input[name=contact]").prop('disabled',true);
                                $("input[name=other_contact]").prop('disabled',true);
                                $("input[name=user_image]").prop('disabled',true);
                                $("textarea[name=temporary_address]").prop('disabled',true);
                                $("textarea[name=permanent_address]").prop('disabled',true);

                                

			        			messageToaster('success','User Found','Success');
							}
							else
							{
                                $("input").prop('disabled',false);
                                $("textarea").prop('disabled',false);

                                $("input[name=full_name]").val('');
                                $("input[name=user_id]").prop('disabled',true);
                                $("input[name=father_name]").val('');
                                $("input[name=nationality]").val('');
                                $("input[name=passport]").val('');
                                $("input[name=occupation]").val('');
                                $("input[name=gender][value=Male]").prop('checked', true);
                                $("input[name=relation][value='S/O']").prop('checked', true);
                                $("input[name=dob]").val('');
                                $("input[name=contact]").val('');
                                $("input[name=other_contact]").val('');
                                $("textarea[name=temporary_address]").val('');
                                $("textarea[name=permanent_address]").val('');

							}

                        removeLoader();
                    });
			        }
			        else
			        {
			        	messageToaster('error','Cnic' ,'Format not correct','Invalid Cnic');

			        }
    }

    function getDateFormatForDateInput(dateValue){
        if(dateValue != null){
            var d = new Date(dateValue);
            var formattedDate = d.getFullYear()
            + "-" + ("00" + (d.getMonth() + 1)).slice(-2)
            + "-" + ("00" + d.getDate()).slice(-2);

            return formattedDate;
        }
    }

</script>
<?php /**PATH /home/ubuntu/rebmgisplus/skylite/resources/views/user/modals/add_nominee.blade.php ENDPATH**/ ?>