<?php $__env->startSection('content'); ?>
    <!--begin::Card-->
    <div class="card card-custom gutter-b">
        <div class="card-header flex-wrap py-3">
            <div class="card-title">
                <h3 class="card-label"><?php echo e($title); ?></h3>
            </div>
            <div class="card-toolbar">
                <!--begin::Button-->
                <a href="<?php echo e(route('dashboard.product-categories.create')); ?>" class="btn btn-primary font-weight-bolder">
                    <span class="svg-icon svg-icon-md">
                        <!--begin::Svg Icon | path:assets/media/svg/icons/Design/Flatten.svg-->
                        <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 24 24" version="1.1">
                            <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
                                <rect x="0" y="0" width="24" height="24" />
                                <circle fill="#000000" cx="9" cy="15" r="6" />
                                <path d="M8.8012943,7.00241953 C9.83837775,5.20768121 11.7781543,4 14,4 C17.3137085,4 20,6.6862915 20,10 C20,12.2218457 18.7923188,14.1616223 16.9975805,15.1987057 C16.9991904,15.1326658 17,15.0664274 17,15 C17,10.581722 13.418278,7 9,7 C8.93357256,7 8.86733422,7.00080962 8.8012943,7.00241953 Z" fill="#000000" opacity="0.3" />
                            </g>
                        </svg>
                        <!--end::Svg Icon-->
                    </span>New Record
                </a>
                <!--end::Button-->
            </div>
        </div>
        <div class="card-body">
            <!--begin: Datatable-->
            <table class="table table-bordered table-checkable" id="datatable1">
                <thead>
                    <tr>
                        <th>#</th>
                        <th>Name</th>
                        <th>Actions</th>
                    </tr>
                </thead>
                <tbody></tbody>
            </table>
            <!--end: Datatable-->
        </div>
    </div>
    <!--end::Card-->
<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
    <script>
        $(function () {
            $('#datatable1').DataTable({
                processing: true,
                serverSide: true,
                responsive: true,
                aLengthMenu: [[10, 25, 50, 100, -1], [10, 25, 50, 100, 'All']],
                pageLength: 50,
                ajax: '<?php echo e(url()->current()); ?>',
                columns: [
                    {data: 'DT_RowIndex', name: 'DT_RowIndex', searchable: false, orderable: false},
                    {data: 'name', name: 'name'},
                    {data: 'action', name: 'action', searchable: false, orderable: false},
                ],
            });

            $('#datatable1').on('click', '.btn-delete', function(event) {
                let $confirm = confirm('Are you sure?');
                if ($confirm) {
                    $.ajax({
                        url: $(this).attr('href'),
                        type: 'POST',
                        data: {_method: 'DELETE'},
                    }).done(function(response) {
                        if (response.code === 200) {
                            location.reload();
                        }
                        else {
                            alert('Something when wrong, please refresh your browser');
                        }
                    }).fail(function() {
                        console.log("error");
                    }).always(function() {
                        console.log("complete");
                    });
                }
                return false;
            });
        });
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('dashboard.layout.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /Applications/MAMP/htdocs/beet_pos/resources/views/dashboard/catalog/product_categories/index.blade.php ENDPATH**/ ?>