<?php $__env->startSection('content'); ?>
    <div class="panel panel-default" id="table_<?php echo e($section); ?>">
        <div class="panel-heading">
            <ul class="nav nav-tabs nav-icons pull-right">
                <li role="presentation" class="">
                    <a href="javascript:" type="button" class="" data-modal="<?php echo e($section); ?>_create" data-url="<?php echo e(route("admin.{$section}.create")); ?>">
                        <i class="icon add" title="<?php echo e(trans('glogal.add')); ?>"></i>
                    </a>
                </li>

            </ul>

            <div class="panel-title"><i class="icon user"></i> <?php echo e(trans('admin.'.$section)); ?></div>
        </div>

        <div class="panel-body">
            <div data-table>
                <?php echo $__env->make('Admin.'.ucfirst($section).'.table', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('javascript'); ?>
    <script>
        tables.set_config('table_<?php echo e($section); ?>', {
            url: '<?php echo e(route("admin.{$section}.index")); ?>',
            delete_url:'<?php echo e(route("admin.{$section}.destroy")); ?>'
        });

        $(document).ready(function() {
            $(document).on('click', '.table-icon .controls a', function () {
                $.ajax({
                    type: 'POST',
                    url: '<?php echo e(route("admin.{$section}.destroy")); ?>',
                    data: {
                        _method: 'DELETE',
                        id: {0:$(this).data('id')}
                    },
                    success: function () {
                        tables.get('table_<?php echo e($section); ?>');
                    }
                });
            });
        });
    </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('Admin.Layouts.default', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>