  <?php $__env->startSection('content'); ?>
<?php Fun::lang()?>
<?php echo $__env->make('administrator.construction.categories.create', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<?php echo $__env->make('administrator.construction.categories.edit', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<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="#">Categories</a></li>
            <li><a href="#">List</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>Categories List</h3>
                        </div>
                    </div>
                    <div class="pull-right">
                        <a class="button_sm button_primary" href="#create-categories" data-toggle="modal"><span class="fa fa-plus"></span>  Create New</a>
                    </div>
                </div>
            </div>
        </div>
        <div class="box-body table-responsive">
                        
            <table id="datatable_categories" class="table table-striped table-bordered table-hover nowrap">
                <thead>
                    <tr>
                        <th>NO</th>
                        <th>Name</th>
                        <th>Description</th>
                        <th>Action</th>
                    </tr>
                </thead>
                <tbody>
                   
                </tbody>
            </table>

        </div>
    </div>
    <?php $__env->stopSection(); ?>
    <?php $__env->startSection('js'); ?>
    <script type="text/javascript">
            function edit(obj)
            {
                $('#main-spinner').show();
                var id = $(obj).data("id");
                var route = "<?php echo e(route('edit_data_categories',':id')); ?>";
                route = route.replace(":id",id);
                $.ajax({
                    url: route,
                    type: 'get',
                    dataType: 'JSON',
                })
                .done(function(data) {
                    $('#main-spinner').hide();
                    $("#add-brand").modal("show");
                    $("#name").val(data.name);
                    $("#description").val(data.description);
                    $("#id").val(data.id);
                })
                .fail(function() {
                    console.log("error");
                })
                .always(function() {
                    console.log("complete");
                });
                
            }
            $(document).ready(function() {
                $('#main-spinner').show();
                $('#datatable_categories').DataTable({
                    ordering: false,
                    "serverSide": true,
                    "lengthMenu": [
                    [20, 25, 50, 100, 500],
                    [20, 25, 50, 100, 500]
                ],
                    ajax: "<?php echo e(route('data.categories')); ?>",
                    columns: [{
                        data: 'DT_RowIndex'
                    }, {
                        data: 'name'
                    },
                    {
                        data: 'description'
                    }
                    , {
                        data: 'action'
                    }, ],
                    "initComplete": function(settings, json) {
                        $('#main-spinner').hide();
                    }
                });

                $.fn.dataTable.ext.errMode = 'throw';
            });
    </script>
    <?php $__env->stopSection(); ?>
<?php echo $__env->make('adminlte::page', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>