  <?php $__env->startSection('content'); ?>
     <?php echo $__env->make('administrator.sub_categories.form-delete-sub-category', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<?php Fun::lang()?>
<div class="title-page">
    <div class="page-bar">
        <ul class="page-breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Dashboard</a></li>
            <li><a href="#">Operation</a></li>
            <li><a href="#">Manage Product</a></li>
            <li><a href="#">Sub Category</a></li>
        </ul>
    </div>
</div>
    <div class="page">
        <div class="top-content">
            <div class="row">
                <div class="col-sm-12 col-xs-12">
                    <div class="title-page">
                        <div class="pull-left">
                            <h3>Sub Category</h3>
                        </div>
                    </div>
                    <div class="pull-right">
                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('Sub-Category-Create')): ?>
                        <a class="button_sm button_primary" href="<?php echo e(route('sub-categories.create')); ?>"><span class="fa fa-plus"></span>  Create New</a>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-12 col-xs-12">
                <div class="box-body table-responsive">
                    <table id="datatable_users" class="table table-striped table-bordered table-hover nowrap">
                        <thead>
                            <tr>
                                <th>NO</th>
                                <th>Code</th>
                                <th>Name</th>
                                <th>Maintenance Amount</th>
                                <th>Description</th>
                                <th>Action</th>
                            </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <?php $__env->stopSection(); ?> <?php $__env->startSection('js'); ?>

    <script type="text/javascript">
        $(document).ready(function() {
            $('#main-spinner').show();
            $('#datatable_users').DataTable({
                ordering: true,
                processing:true,
                "serverSide": true,
                "lengthMenu": [[20, 30, 50, 100,-1], [20, 30, 50, 100,'all']],
                ajax: "<?php echo e(route('datatable.get_sub_categories')); ?>",
                columns: 
                    [
                        {data: 'DT_RowIndex'}, 
                        {data: 'sub_category_code'},
                        {data: 'sub_category_name'},
                        {data: 'sub_category_amount'},
                        {data: 'sub_category_des'},
                        {data: 'action'},
                    ],
                    "initComplete": function(settings, json) {
                        $('#main-spinner').hide();
                    }

            });

            $.fn.dataTable.ext.errMode = 'throw';
        });
        $(document).on('click', '.btn_remove_sub_category', function() {
            var id = $(this).data('id');
            var route = "<?php echo e(route('sub-categories.destroy',':id')); ?>";
            route = route.replace(':id', id);
            $('#form-delete-sub-category').attr('action', route);
            $('#delete-sub-category').modal('show');
        });
    </script>
    <?php $__env->stopSection(); ?>
<?php echo $__env->make('adminlte::page', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>