

<?php $__env->startSection('title'); ?>
    All Nominees
<?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">All Nominee</li>
    </ol>
<?php $__env->stopSection(); ?>

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

    <link href="https://cdn.datatables.net/1.10.24/css/jquery.dataTables.min.css" rel="stylesheet">
    <link href="https://cdn.datatables.net/buttons/1.7.0/css/buttons.dataTables.min.css" rel="stylesheet">

    <style>
        table.dataTable thead .sorting_asc {
            background-image: none !important;
        }

        .table.dataTable,
        table.dataTable {
            width: 99.8% !important;
        }
    </style>

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

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


    <div class="container-fluid">

        <!--.row-->
        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-info">
                    <div class="panel-heading">Search Customer</div>
                    <div class="panel-wrapper collapse in" aria-expanded="true">
                        <div class="panel-body">
                            <form>
                                <div class="form-body">
                                    <div class="row">
                                        <div class="col-md-6">
                                            <div class="form-group has-success" style="margin-bottom: 15px">
                                                <label class="control-label">By Nominee Name</label>
                                                <select id="nominee_id" class="form-control chosen-select">
                                                    <option value="0">None</option>
                                                    <?php $__currentLoopData = $nominee; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $nomi): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <option value="<?php echo e($nomi->id); ?>"><?php echo e($nomi->nominee_name); ?> --
                                                            <?php echo e($nomi->nominee_cnic); ?></option>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </select>

                                            </div>
                                        </div>
                                        <!--/span-->
                                        <div class="col-md-6">
                                            <div class="form-group has-success" style="margin-bottom: 15px">
                                                <label class="control-label">By Customer Name</label>

                                                <select id="cus_id" class="form-control chosen-select">
                                                    <option value="0">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>
                                            </div>
                                        </div>
                                        <!--/span-->
                                    </div>

                                </div>
                                <div class="form-actions">
                                    <button type="button" class="btn btn-success search-customer"> <i
                                            class="fa fa-check"></i> Search</button>

                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--./row-->


        <!-- /row -->
        <div class="row" id="update-table">
            <div class="col-sm-12">
                <div class="white-box">
                    <div class="pull-right">

                    </div>
                    <h3 class="box-title">All Nominees (<b><?php echo e(count($nominee)); ?></b>)</h3>

                    <div class="table-responsive">
                        <table id="myTable" class="table table-striped">
                            <thead>
                                <tr>
                                    <th>#</th>

                                    <th>Nominee </th>
                                    <th>Customer </th>
                                    <th>Relation</th>
                                    <th>Action</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php $count = 1; ?>
                                <?php $__currentLoopData = $nominee; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $nomi): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                        <td><?php echo e($count++); ?></td>
                                        <td><?php echo e($nomi->nominee_name); ?> -- <?php echo e($nomi->nominee_cnic); ?></td>
                                        <td><?php echo e($nomi->customer->name); ?> -- <?php echo e($nomi->customer->cnic); ?></td>

                                        <td><?php echo e($nomi->nominee_relation); ?></td>




                                        <td class="text-nowrap">
                                            <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'view-customer')): ?>
                                            <a href="<?php echo e(route('nominee.detail',['id'=>$nomi->id])); ?>" data-toggle="tooltip" data-original-title="View"> <i class="fa fa-eye text-inverse m-r-10"></i> </a>
                                            <?php endif; ?>
                                            <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'edit-customer')): ?>
                                            <a href="<?php echo e(route('nominee.editView',['id'=>$nomi->id])); ?>" data-toggle="tooltip" data-original-title="Edit"> <i class="fa fa-pencil text-inverse m-r-10"></i> </a>
                                            <?php endif; ?>
                                            <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'delete-customer')): ?>
                                            
                                          
                                            
                                            <form action="<?php echo e(route('nominee.delete', [$nomi->id])); ?>" method="post"
                                                style='display: inline;'>
                                                <?php echo method_field('delete'); ?>

                                                <?php echo csrf_field(); ?>



                                                <button class="btn btn-link btn-s" style="color:red;" type="submit"
                                                    name="action" value="delete" data-toggle="confirmation"
                                                    data-title="Are you sure to delete?">
                                                    <i class="fa fa-trash-o" aria-hidden="true"></i>
                                                </button>
                                            </form>
                                        

                                          
                                            <?php endif; ?>
                                        </td>





                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                            </tbody>
                        </table>
                        <div style="float: right;"> </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- /.row -->
    </div>
    <!-- /.container-fluid -->

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

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

    <script src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.7.0/js/dataTables.buttons.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.7.0/js/buttons.html5.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.7.0/js/buttons.print.min.js"></script>


    <script>
        $(function() {
            $('#myTable').DataTable({
                'pageLength': 25,
                'paging': false,
                'searching': false,
                'info': true,
                'dom': 'Bfrtip',
                'buttons': [
                    'copy', 'csv', 'excel', 'pdf', 'print'
                ]
            });
        });

        $('.search-customer').on('click', function() {

            nomiId = $('#nominee_id').val();
            cusId = $('#cus_id').val();

            if (nomiId == 0 && cusId == 0) {
                toastr.warning("please select nominee name or customer name.");
                return false;
            }
            $('.preloader').fadeIn();
            var data = {
                'nomi': nomiId,
                'cus': cusId
            };
            $.get('<?php echo e(route('nominee.updatetable')); ?>', data, function(data) {
                document.getElementById('update-table').innerHTML = data;

                $(function() {
            $('#myTable').DataTable({
                'pageLength': 25,
                'paging': false,
                'searching': false,
                'info': true,
                'dom': 'Bfrtip',
                'buttons': [
                    'copy', 'csv', 'excel', 'pdf', 'print'
                ]
            });
        });

                toastr.success("Search updated.");
                $('.preloader').fadeOut();
            });
            $('.preloader').fadeOut();
        });
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/proje372/akram-city.projecterp.net/resources/views/nominee/index.blade.php ENDPATH**/ ?>