
<?php $__env->startSection('content'); ?>
    <!-- begin::main content -->
    <main class="main-content">
        <div class="container">
            <!-- begin::page header -->
            <div class="page-header">
                <h3>Category List</h3>
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="<?php echo e(asset('dashboard')); ?>"><?php echo e(__('message.dashboard')); ?></a></li>
                        <li class="breadcrumb-item active" aria-current="page"><?php echo e(__('message.list')); ?></li>
                    </ol>
                </nav>
            </div>
            <!-- end::page header -->
            <div class="card">

                <div class="card-header">
                    <div class="row mb-2">
                        <div class="col-md-12">
                            <form action="filter-visitor-entry" method="post">
                                <?php echo csrf_field(); ?>
                                <div class="row justify-content-between">

                                    <div class="col-md-2">
                                        <select class="form-control" name="per_page" id="per_page">
                                            <option value="25">25</option>
                                            <option value="50">50</option>
                                            <option value="100">100</option>
                                            <option  value="200">200</option>
                                        </select>
                                    </div>
                                    <div class="col-md-3">
                                        <input placeholder="Seary By Name..." type="text" name="category_name" class="form-control">
                                    </div>
                                    

                                    <div class="col-md-3">
                                        <button data-toggle="tooltip" data-original-title="Search" type="submit"
                                            class="btn m-r-10 btn-primary pull-left"><i class="fa fa-search fa-lg"></i>
                                        </button>
                                        <a data-toggle="tooltip" data-original-title="Reset Filters"
                                            href="<?php echo e(asset('/category-list')); ?>" class="btn m-r-10 btn-warning pull-left text-white">
                                            <i class="fa fa-refresh fa-lg"></i>
                                        </a>
                                        
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                    <div class="row mb-2">
                        <div class="col-md-6 mb-2">
                            <a class="btn btn-primary text-white" href="<?php echo e(asset('add-category')); ?>">
                                <i class="fa fa-plus"></i> &nbsp Category
                            </a>
                        </div>
                        <div class="col-md-6 mb-2 d-flex justify-content-end">
                            <button class="btn btn-danger text-white multiple-delete-btn" >
                                <i class="fa fa-trash fa-lg"></i>
                            </button>
                        </div>
                    </div>

                <div class="card-body p-0 m-0">

                    <?php if(isset($category)): ?>

                        <div class="table-responsive">
                            <table class="table table-striped table-bordered text-center">
                                <thead>
                                    <tr>
                                        <th>
                                            <input type="checkbox" id="checkAll" />
                                        </th>
                                        <th>S.No</th>
                                       
                                        <th>Name</th>
                                                                              
                                        <th>Action</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php if(!empty($category)): ?>
                                        <?php $__currentLoopData = $category; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                           <tr>
                                                <td>
                                                    <input type="checkbox" class="checkid" value="<?php echo e($value->id); ?>" />
                                                </td>
                                                <td><?php echo e(++$key); ?></td>
                                                
                                                <td><?php echo e($value->category_name); ?></td>
                                                
                                                <td >
                                                    <div class="btn-group">
                                                        
                                                        <a class="btn btn-sm btn-success text-white" data-toggle="tooltip"
                                                            data-original-title="User Info"
                                                            href="<?php echo e(asset('category-edit/'.$value->id)); ?>"><i
                                                                class="fa fa-edit fa-lg"></i>
                                                        </a>
                                                        <a class="btn btn-sm btn-danger text-white" data-toggle="tooltip"
                                                            data-original-title="User Info"
                                                            href="<?php echo e(asset('category-delete/'.$value->id)); ?>"><i
                                                                class="fa fa-trash fa-lg"></i>
                                                        </a>
                                                        
                                                    </div>
                                                </td>
                                           </tr>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    <?php else: ?>
                                        <h1>No Record Found!!</h1>
                                    <?php endif; ?>
                                </tbody>
                            </table>
                        </div>


                        
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </main>
    <!-- end::main content -->
<?php $__env->stopSection(); ?>
<?php $__env->startPush('footer-script'); ?>
    <!-- begin::dataTable -->
    <script src="<?php echo e(asset('public/admin/js/examples/datatable.js')); ?>"></script>
    <!-- end::dataTable -->
    <script>
       $(document).ready(function() {
            $("#checkAll").click(function() {
                $('input:checkbox').not(this).prop('checked', this.checked);
            });


        // Delete Multiple
        $(".multiple-delete-btn").click(function() {
            var URL = "<?php echo e(asset('delete-multiple-category')); ?>";
            var user_ids = [];
            $('.checkid:checkbox:checked').each(function() {
                user_ids.push($(this).val());
            });
            
            swal({
                title: 'Are you sure?',
                text: 'Once deleted, you will not be recover!',
                icon: 'warning',
                dangerMode: true,
                buttons: ["Cancel", "Yes!"],
            }).then(function(value) {
                if (value) {
                    $.ajaxSetup({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                        }
                    });

                    $.ajax({
                        type: "post",
                        data: {
                            "ids": user_ids
                        },
                        url: URL,
                        dataType: "html",
                        success: function(result) {
                            console.log(result);
                        }
                    });
                    swal("success!", "Successfully deleted!", "success");
                    window.location.reload();
                }
            });

        });

           

        });
    </script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH F:\xampp\htdocs\visitor_management\resources\views/category/category-list.blade.php ENDPATH**/ ?>