

<?php $__env->startSection('title'); ?>
    Add New Nominee
<?php $__env->stopSection(); ?>

<?php $__env->startSection('breadcrumb'); ?>
    <ol class="breadcrumb pull-right">
        <li><a href="<?php echo e(route('home')); ?>"><i class="fa fa-dashboard"></i> Home</a></li>

        <li class="active">Add Nominee</li>
    </ol>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>

    <div class="container-fluid">
        <!--.row-->
        <div class="row">

            <div class="col-md-12">

                <?php if($errors->any()): ?>
                    <div class="white-box">
                        <h2>Errors</h2>
                        <ul>
                            <?php echo implode('', $errors->all('<li><span class="help-block"><strong>:message</strong></span></li>')); ?>

                        </ul>
                    </div>
                <?php endif; ?>

                <div class="white-box">
                    <h3 class="box-title m-b-0"><i class="icon-user fa-fw"></i> Add Nominee</h3>
                    <p class="text-muted m-b-30 font-13" style="height: 0px;">Add Basic Information </p>
                    <hr>
                    <form class="form-horizontal" action="<?php echo e(route('nominee.insert')); ?>" enctype="multipart/form-data"
                        method="post">
                        <?php echo e(csrf_field()); ?>


                        <br>
                        <div class="form-group">
                            <label for="exampleInputuname" class="col-sm-2 control-label">Customer<span
                                    style="color: red">*</span></label>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <div class="input-group-addon"><i class="ti-user"></i></div>
                                    <select class="form-control chosen-select" name="customer_id">

                                    <option>None</option>
                                    <?php $__currentLoopData = $customer; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cus): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($cus->id); ?>"><?php echo e($cus->name); ?> -- <?php echo e($cus->cnic); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                   </select>
                                    <?php if($errors->has('customer_id')): ?>
                                        <span class="help-block">
                                            <strong><?php echo e($errors->first('customer_id')); ?></strong>
                                        </span>
                                    <?php endif; ?>
                                </div>
                            </div>
                           
                           
                            <div class='form-group'> 
                                <label for="exampleInputuname" class="col-sm-2 control-label">Name of Nominee<span
                                    style="color: red">*</span></label>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <div class="input-group-addon"><i class="ti-user"></i></div>
                                    <input type="text" class="form-control" name="nominee_name"
                                        value="<?php echo e(old('nominee_name')); ?>" placeholder="Enter Name">
                                    <?php if($errors->has('nominee_name')): ?>
                                        <span class="help-block">
                                            <strong><?php echo e($errors->first('nominee_name')); ?></strong>
                                        </span>
                                    <?php endif; ?>
                                </div>
                            </div>
                            </div>
                        </div>
                      

                        <div class="form-group">
                            <label for="cnic" class="col-sm-2 control-label"  >CNIC <span
                                    style="color: red">*</span></label>
                            <div class="col-sm-4">
                                <div class="input-group"  >

                                    <div class="input-group-addon"><i class="icon-credit-card"></i></div>
                                    <input type="text" class="form-control" value="<?php echo e(old('nominee_cnic')); ?>"
                                        name="nominee_cnic" id="nominee_cnic"
                                        onfocusout="return validateCnic(this)"data-inputmask="'mask': '9999999999999'"
                                        placeholder="XXXXXXXXXXXXX">
                                    <?php if(old('nominee_cnic_flag') == \App\Customer::locally): ?>
                                        <input type="radio" checked="" name="nominee_cnic_flag" value="1">
                                        Locally
                                        <input type="radio" name="nominee_cnic_flag" value="2"> Internationally
                                    <?php elseif(old('nominee_cnic_flag') == \App\Customer::internationally): ?>
                                        <input type="radio" name="nominee_cnic_flag" value="1"> Locally
                                        <input type="radio" checked="" name="nominee_cnic_flag" value="2">
                                        Internationally
                                    <?php else: ?>
                                        <input type="radio" name="nominee_cnic_flag" value="1"> Locally
                                        <input type="radio" name="nominee_cnic_flag" value="2"> Internationally
                                    <?php endif; ?>

                                    <div style="color: red;display: none;" id="cnic_error1">This Member cnic is found in
                                        list of DNFBP. You can't add this Nominee record. </div>

                                    <?php if($errors->has('nominee_cnic')): ?>
                                        <span class="help-block">
                                            <strong><?php echo e($errors->first('nominee_cnic')); ?></strong>
                                        </span>
                                    <?php endif; ?>
                                </div>
                            </div>
                             <div class="form-group">
                                <label for="exampleInputuname" class="col-sm-2 control-label">S/O, D/O, W/O <span
                                        style="color: red">*</span></label>
                                <div class="col-sm-4">
                                    <div class="input-group">
                                        <div class="input-group-addon"><i class="ti-user"></i></div>
                                        <input type="text" class="form-control" name="nominee_so_do_wo"
                                            value="<?php echo e(old('nominee_so_do_wo')); ?>" placeholder="Enter S/O - D/O - W/O ">
                                        <?php if(old('nominee_father_type') == 1): ?>
                                            <input checked="" type="radio" name="nominee_father_type"
                                                value="1">S/O
                                            <input type="radio" name="nominee_father_type" value="2">D/O
                                            <input type="radio" name="nominee_father_type" value="3"> W/O
                                        <?php elseif(old('nominee_father_type') == 2): ?>
                                            <input type="radio" name="nominee_father_type" value="1">S/O
                                            <input checked="" type="radio" name="nominee_father_type"
                                                value="2">D/O
                                            <input type="radio" name="nominee_father_type" value="3"> W/O
                                        <?php elseif(old('nominee_father_type') == 3): ?>
                                            <input type="radio" name="nominee_father_type" value="1">S/O
                                            <input type="radio" name="nominee_father_type" value="2">D/O
                                            <input checked="" type="radio" name="nominee_father_type" value="3">
                                            W/O
                                        <?php else: ?>
                                            <input type="radio" name="nominee_father_type" value="1">S/O
                                            <input type="radio" name="nominee_father_type" value="2">D/O
                                            <input type="radio" name="nominee_father_type" value="3"> W/O
                                        <?php endif; ?>
                                        <?php if($errors->has('nominee_so_do_wo')): ?>
                                            <span class="help-block">
                                                <strong><?php echo e($errors->first('nominee_so_do_wo')); ?></strong>
                                            </span>
                                        <?php endif; ?>
                                    </div>
                                </div>
                            </div>
                           
                        </div>

                        <div class="form-group">
                            <label for="cnic" class="col-sm-2 control-label">Passport No.</label>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <div class="input-group-addon"><i class="icon-book-open"></i></div>
                                    <input type="text" class="form-control" value="<?php echo e(old('nominee_passport_no')); ?>"
                                        name="nominee_passport_no" id="nominee_passport_no" placeholder="XXXXXXXXX">

                                    <?php if($errors->has('nominee_passport_no')): ?>
                                        <span class="help-block">
                                            <strong><?php echo e($errors->first('nominee_passport_no')); ?></strong>
                                        </span>
                                    <?php endif; ?>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="exampleInputEmail1" class="col-sm-2 control-label">Email </label>
                                <div class="col-sm-4">
                                    <div class="input-group">
                                        <div class="input-group-addon"><i class="ti-email"></i></div>
                                        <input type="text" class="form-control" name="nominee_email"
                                            value="<?php echo e(old('nominee_email')); ?>" placeholder="Enter Email">
                                        <?php if($errors->has('nominee_email')): ?>
                                            <span class="help-block">
                                                <strong><?php echo e($errors->first('nominee_email')); ?></strong>
                                            </span>
                                        <?php endif; ?>
                                    </div>
                                </div>
                            </div>
                        </div>


                        <div class="form-group">
                            <label for="exampleInputEmail1" class="col-sm-2 control-label">Mobile Number </label>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <div class="input-group-addon"><i class="icon-phone"></i></div>
                                    <input type="number" class="form-control" name="nominee_mobile_number"
                                        value="<?php echo e(old('nominee_mobile_number')); ?>" placeholder="Enter Mobile Number">
                                    <?php if($errors->has('nominee_mobile_number')): ?>
                                        <span class="help-block">
                                            <strong><?php echo e($errors->first('nominee_mobile_number')); ?></strong>
                                        </span>
                                    <?php endif; ?>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="exampleInputEmail1" class="col-sm-2 control-label">Residence Number
                                </label>
                                <div class="col-sm-4">
                                    <div class="input-group">
                                        <div class="input-group-addon"><i class="icon-phone"></i></div>
                                        <input class="form-control" type='number' name="nominee_res_number"
                                            value="<?php echo e(old('nominee_res_number')); ?>"
                                            placeholder="Enter Residence Number">
                                        <?php if($errors->has('nominee_res_number')): ?>
                                            <span class="help-block">
                                                <strong><?php echo e($errors->first('nominee_res_number')); ?></strong>
                                            </span>
                                        <?php endif; ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                           
                        <div class="form-group">
                            <label for="exampleInputEmail1" class="col-sm-2 control-label">Relation with Applicant
                            <span style="color: red">*</span></label>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <div class="input-group-addon"><i class="icon-link"></i></div>
                                    <select class="form-control chosen-select" name="nominee_relation">
                                        <option selected>Brother</option>
                                        <option selected>Father</option>
                                        <option selected>Sister</option>
                                        <option selected>Mother</option>
                                        <option selected>Friend</option>
                                        <option selected>Wife</option>
                                        <option selected>Husband</option>
                                        <option selected>Son</option>
                                        <option selected>Daughter</option>
                                        <option selected>Cousin</option>
                                    </select>
                                    <?php if($errors->has('nominee_relation')): ?>
                                        <span class="help-block">
                                            <strong><?php echo e($errors->first('nominee_relation')); ?></strong>
                                        </span>
                                    <?php endif; ?>
                                </div>
                            </div>
                            <div class="form-group" id="nominee_address">
                                <label for="address" class="col-sm-2 control-label" id="nominee_address">Nominee
                                    Address <span style="color: red">*</span></label>
                                <div class="col-sm-4">
                                    <div class="input-group">
                                        <div class="input-group-addon"><i class="icon-location-pin"></i></div>
                                        <textarea class="form-control" id="nominee_address"
                                            name="nominee_address"><?php echo e(old('nominee_address')); ?></textarea>
                                        <?php if($errors->has('nominee_address')): ?>
                                            <span class="help-block">
                                                <strong><?php echo e($errors->first('nominee_address')); ?></strong>
                                            </span>
                                        <?php endif; ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                            
                   
                        <div class="form-group m-b-0">
                            <div class="col-sm-offset-4 col-sm-4" style="margin-bottom: 25px;">
                                <button type="submit" class="btn btn-info waves-effect waves-light m-t-10"
                                    style="width: 100%; margin-left: 110px;">Save</button>
                            </div>
                        </div>

                </div>




                </form>

            </div>

        </div>

    </div>

    <!--./row-->

    </div>

    <!-- /.container-fluid -->

<?php $__env->stopSection(); ?>

<?php $__env->startSection('js'); ?>

    <script src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/jquery.inputmask.bundle.js"></script>








    <script>
        function hideFields(self) {

            if (self === 'company') {
                $('#father_name').val('null');
                $('#father_name_parent').hide();
                $('#passport_no').hide()
                $('#date_of_birth').html('Date of Incorporation ')
                $('#cnic_no').html('Incorporation no <span style="color: red">*</span>')
                $('#mobile_number').html('Phone Number <span style="color: red">*</span>')
                $('#res_number').hide()
                $('#phone_number').hide()
                $('#photo_s').hide()
                $('#mailing_label').html('Company Registered Address <span style="color: red">*</span>')
                $('#permanent_address').val($('#mailing_address').val())
                $('#permanent_add').hide()
                $('#occupations').html('Type Of Company <span style="color: red">*</span>')
                $('#imgs_label').html('Certificate  ')
            }

            if (self === 'individual') {
                $('#father_name').val('');
                $('#father_name_parent').show();
                $('#passport_no').show()
                $('#date_of_birth').html('Date of Birth <span style="color: red">*</span>')
                $('#cnic_no').html('Cnic <span style="color: red">*</span>')
                $('#mobile_number').html('Mobile Number <span style="color: red">*</span>')
                $('#res_number').show()
                $('#photo_s').show()
                $('#phone_number').show()
                $('#mailing_label').html('Mailing Address <span style="color: red">*</span>')
                $('#permanent_add').show()
                $('#occupations').html('Occupation <span style="color: red">*</span>')
                $('#imgs_label').html('Passport size photo  <span style="color: red">*</span>')
            }


            return false;
        }

        function validateCnic(self) {
            var cnic = $(self).val();

            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                }
            });

            $.ajax({
                url: "<?php echo e(route('validate.dnfbp.cnic')); ?>",
                method: 'POST',
                dataType: 'json',
                data: {
                    cnic: cnic
                },
                success: function(data) {
                    if (data.response == 'invalid') {
                        $(self).closest('.input-group').find('#cnic_error1').show();
                    }

                }
            })



            return false;
        }


        $(":input").inputmask();



        // Function for copying mailing address to permanent address
        $('input#copy_to_permanent_address').click(function() {
            if ($(this).prop("checked") == true) {
                $('textarea#permanent_address').val($('textarea#mailing_address').val());
            } else if ($(this).prop("checked") == false) {
                $('textarea#permanent_address').val('');
            }
        });

        // Function for copying mailing address to nominee address
        $('input#copy_to_nominee_address').click(function() {
            if ($(this).prop("checked") == true) {
                $('textarea#nominee_address').val($('textarea#mailing_address').val());
            } else if ($(this).prop("checked") == false) {
                $('textarea#nominee_address').val('');
            }
        });
    </script>



<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\abudhabi\resources\views/nominee/add.blade.php ENDPATH**/ ?>