<?php $__env->startSection('title', __('trans.admin.title')); ?>


<?php $__env->startSection('datatableCSS'); ?>
    <?php echo $__env->make('layouts.admin.datatables-css', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('datatablesJS'); ?>
    <?php echo $__env->make('layouts.admin.datatables-js', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>

    <div class="card">
        <h5 class="card-header"><?php echo $__env->yieldContent('title'); ?></h5>
        <div class="card-datatable">
            <table class="dt-complex-header table table-bordered table-hover table-responsive">
                <thead>
                    <tr>
                        <th class="exp-col"><?php echo e(__('trans.id')); ?></th>
                        <th class="exp-col"><?php echo e(__('trans.admin.name')); ?></th>
                        <th class="exp-col"><?php echo e(__('trans.email')); ?></th>
                        <th class="exp-col"><?php echo e(__('trans.admin.admin_type')); ?></th>
                        <th class="exp-col"><?php echo e(__('trans.created_at')); ?></th>
                        <th><?php echo e(__('trans.actions')); ?></th>
                    </tr>
                </thead>
                <tfoot>
                    <tr>
                        <th class="exp-col"><?php echo e(__('trans.id')); ?></th>
                        <th class="exp-col"><?php echo e(__('trans.admin.name')); ?></th>
                        <th class="exp-col"><?php echo e(__('trans.email')); ?></th>
                        <th class="exp-col"><?php echo e(__('trans.admin.admin_type')); ?></th>
                        <th class="exp-col"><?php echo e(__('trans.created_at')); ?></th>
                        <th><?php echo e(__('trans.actions')); ?></th>
                    </tr>
                </tfoot>
            </table>
        </div>
    </div>


<?php $__env->stopSection(); ?>

<?php $__env->startSection('js'); ?>
    <script>
        $(document).ready(function() {

            var table = $('.table').DataTable({
                processing: true,
                serverSide: true,
                orderCellsTop: true,
                scrollY: '400px',
                scrollCollapse: true,
                order: [
                    [0, 'desc']
                ],
                lengthMenu: lengthMenu("<?php echo e(__('trans.all')); ?>"),
                language: getlang(),
                dom: dom(),
                buttons: buttons("<?php echo e(__('trans.admin.add_new')); ?>",
                    "<?php echo e(url('admin/admins/create')); ?>"),
                ajax: "<?php echo e(url('/admin/admins')); ?>",
                columns: [{
                        data: 'id'
                    },
                    {
                        data: 'name'
                    },
                    {
                        data: 'email'
                    },
                    {
                        data: 'admin_type'
                    },
                    {
                        data: 'created_at'
                    },
                ],
                columnDefs: [{
                    targets: 5,
                    render: function(data, type, row, meta) {
                        return `
                            <a href="<?php echo e(url('/admin/admins/`+row.id+`/edit')); ?>" class="btn btn-sm rounded-pill btn-info"><i class="ti ti-edit"></i></a>
                            <form action="<?php echo e(url('/admin/admins')); ?>/` + row.id + `" style="display:inline-block" method="post"><?php echo csrf_field(); ?> <?php echo e(method_field('DELETE')); ?>

                                <button class="btn btn-sm rounded-pill btn-danger btn-delete"><i class="ti ti-trash"></i></button>
                            </form>
                        `;
                    }
                }, ],

                initComplete: function() {
                    this.api().columns().every(function() {
                        var that = this;
                        $('input', this.footer()).on('keyup change input clear', function() {
                            if (that.search() !== this.value) {
                                that.search(this.value).draw();
                            }
                        });
                    });
                },
            });

            $('.table tfoot th').each(function() {
                var title = $(this).text();
                var dataName = $(this).data('name');

                if ($(this).hasClass('exp-col')) {
                    $(this).html('<input type="text" class="form-control ' + dataName +
                        '" placeholder="<?php echo e(__('trans.search')); ?>: ' + title + '" />');
                }
            });
        });
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.admin.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH E:\projects\doctorito\resources\views/admin/admins/index.blade.php ENDPATH**/ ?>