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

    <div class="page">
        <div class=container-fluid>
            <div class="top-content">
                <div class="row">
                    <div class="col-sm-12 col-xs-12">
                        <div class="title-add">
                            <div class="pull-left">
                                <h3><?php echo e(__('administrator.'.$user_type)); ?></h3>
                            </div>
                            <div class="pull-right">
                                <a onclick="getHtmlForm('<?php echo e(route('users.create')); ?>?user_type=<?php echo e($user_type); ?>','<?php echo e(__('administrator.create')); ?> '+menu_name,'30%')" class=" button_info"><span class="fa fa-plus"></span> <?php echo e(__('administrator.create')); ?></a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="wrapper-table">
                <table id="datatable" class="table table-striped table-hover ">
                    <thead>
                    <tr>
                        <th>#</th>
                        <?php if($user_type==='user'): ?>
                        <th><?php echo e(__('administrator.branch')); ?></th>
                        <?php endif; ?>
                        <th><?php echo e(__('administrator.name')); ?></th>
                        <th><?php echo e(__('administrator.contact')); ?></th>
                        <th><?php echo e(__('administrator.email')); ?></th>
                        <?php if($user_type==='user'): ?>
                        <th><?php echo e(__('administrator.role')); ?></th>
                        <?php endif; ?>
                        <th><?php echo e(__('administrator.commission')); ?></th>
                        <th><?php echo e(__('administrator.status')); ?></th>
                        <th><?php echo e(__('administrator.action')); ?></th>
                    </tr>
                    </thead>
                    <tbody>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
 <?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
    <script type="text/javascript">
        let $table = $('#datatable');
        $(document).ready(function () {
            getTable();
            $table.on('click','.btn-edit',function () {
                let href = $(this).data('href');
                getHtmlForm(href,'<?php echo e(__('administrator.edit')); ?> '+menu_name,'30%')
            })
        });
        function getTable() {
            $table.DataTable().destroy();
            $table.DataTable({
                ordering: false,
                serverSide: true,
                lengthMenu: [20, 30, 50, 100, 200, 500, 1000],
                ajax: "<?php echo e(route('users.index')); ?>?user_type=<?php echo e($user_type); ?>",
                columns:
                    [
                        {data: 'DT_RowIndex', searchable:false},
                            <?php if($user_type==='user'): ?>
                        {data: 'branch_id',searchable:false},
                            <?php endif; ?>
                        {data: 'name','name': 'users.name'},
                        {data: 'phone', 'name': 'users.phone'},
                        {data: 'email', 'name': 'users.email'},
                        {data: 'commission'},
                        <?php if($user_type==='user'): ?>
                        {data: 'role', searchable:false},
                        <?php endif; ?>
                        {data: 'status',searchable:false},
                        {data: 'action',searchable:false},

                    ],
                "initComplete": function (settings, json) {
                }

            });

        }
    </script>
<?php $__env->stopSection(); ?>




<?php echo $__env->make(branchMenu(), \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/nsowos/public_html/shr-brand/resources/views/administrator/setup/users/index.blade.php ENDPATH**/ ?>