<?php $__env->startSection('title', __('User Management')); ?>



<?php $__env->startSection('content'); ?>
    <div class="card user-screen">
        <div class="card-body">
            <div class="text-center">
                <h3 class="card-title font-weight-bold"><?php echo e(__('string.user.search.title')); ?></h3>
                <p><?php echo e(__('string.user.search.description')); ?></p>
            </div><!--col-->
            <div class="row mt-4">
                <div class="col">
                    <?php echo Form::open(['route' => 'admin.user.index', 'method' => 'get', 'id' => 'form-search-user',
                        'class' => 'mb-3']); ?>

                        <div class="d-flex">
                                <?php echo Form::text('user_name', request()->get('user_name'),
                    ['class'=>'form-control input-control', 'placeholder'=>__('string.user.search.placeholder')]); ?>

                            <!-- <?php echo Form::text(
                                'classification_search',
                                request()->get('classification_search'),
                                ['class'=>'form-control input-control', 'placeholder'=>__('string.classification.search.placeholder')]
                            ); ?> -->
                            <?php echo Form::button( __('string.user.button.search'),
                            ['class' => 'btn btn-success ml-3 search-user']); ?>

                        </div>
                    <span class="error-search text-red"></span>
                    <?php echo Form::close(); ?>

                    <div class="table-responsive <?php echo e(!empty($users) && $users->count() > 10 ? 'scroll' : ''); ?>">
                        <table class="table" aria-label="list-user">
                            <thead>
                            <tr>
                                <th scope="col" class="w-20">
                                    <a href="<?php echo e(route('admin.user.index', [
                                        'user_name' => request()->get('user_name'),
                                        'classification_search' => request()->get('classification_search'),
                                        'id' => !empty($params['id']) && $params['id'] == 'asc' ? 'desc' : 'asc'
                                        ])); ?>"
                                    >
                                        <?php echo e(__('string.user.table.id')); ?>

                                        <?php if(empty(request()->get('name')) and empty(request()->get('classification'))): ?>
                                            <em class="<?php echo e(setIconSort($params['id'])); ?>"></em>
                                        <?php endif; ?>
                                    </a>
                                </th>
                                <th scope="col" class="w-30">
                                    <a href="<?php echo e(route('admin.user.index', [
                                        'user_name' => request()->get('user_name'),
                                        'classification_search' => request()->get('classification_search'),
                                        'name' => !empty($params['name']) && $params['name'] == 'asc' ? 'desc' : 'asc'
                                        ])); ?>"
                                    >
                                        <?php echo e(__('string.user.table.name')); ?>

                                        <?php if(!empty(request()->get('name'))): ?>
                                            <em class="<?php echo e(setIconSort($params['name'])); ?>"></em>
                                        <?php endif; ?>
                                    </a>
                                </th>
                                <th scope="col" class="w-30">
                                    <a href="<?php echo e(route('admin.user.index', [
                                        'user_name' => request()->get('user_name'),
                                        'classification_search' => request()->get('classification_search'),
                                        'classification' => !empty($params['classification']) && $params['classification'] == 'asc' ? 'desc' : 'asc'
                                        ])); ?>"
                                    >
                                        <!-- <?php echo e(__('string.user.table.classification')); ?>

                                        <?php if(!empty(request()->get('classification'))): ?>
                                            <em class="<?php echo e(setIconSort($params['classification'])); ?>"></em>
                                        <?php endif; ?> -->
                                    </a>
                                </th>
                                <th scope="col" class="text-center"><?php echo e(__('string.user.table.menu')); ?></th>
                            </tr>
                            </thead>
                            <tbody>
                                <?php $__empty_1 = true; $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                    <tr>
                                        <td><?php echo e($user->username); ?></td>
                                        <td><?php echo e($user->name); ?></td>
                                        <td><?php echo e($user->classification); ?></td>
                                        <td class="text-center">
                                            <div class="btn-group">
                                                <?php if(($user->id == auth()->id()) || auth()->user()->isAdmin): ?>
                                                <a href="<?php echo e(route('admin.checkin.history', ['user' => $user->id])); ?>"
                                                    class="btn btn-secondary btn-sm">
                                                    <?php echo e(__('string.user.button.history')); ?>

                                                </a>
                                                <?php endif; ?>
                                                <?php if(auth()->check() && auth()->user()->hasRole(config('boilerplate.access.role.admin'))): ?>
                                                <button type="button"
                                                class="btn btn-sm btn-secondary dropdown-toggle dropdown-toggle-split"
                                                        data-toggle="dropdown"
                                                        aria-expanded="false">
                                                </button>
                                                <div class="dropdown-menu">
                                                    <?php if(Storage::disk('public')->exists('images/face-capture/' . $user->id . '/center.png')
                                                        and Storage::disk('public')->exists('images/face-capture/' . $user->id . '/left.png')
                                                        and Storage::disk('public')->exists('images/face-capture/' . $user->id . '/right.png') ): ?>
                                                        <a href="<?php echo e(route('admin.user.capture-face.form', ['user' => $user->id])); ?>"
                                                            class="dropdown-item btn btn-dark btn-sm">
                                                            <?php echo e(__('string.user.button.camera')); ?>

                                                        </a>
                                                    <?php endif; ?>
                                                    <a href="<?php echo e(route('admin.user.edit', ['user' => $user->id])); ?>"
                                                       class="dropdown-item btn btn-primary btn-sm">
                                                        <?php echo e(__('string.user.button.edit')); ?>

                                                    </a>
                                                    <button type="submit"
                                                            class="dropdown-item btn btn-danger btn-sm btn-delete-user"
                                                            data-id="<?php echo e($user->id); ?>"
                                                            data-name="<?php echo e($user->name); ?>"
                                                            data-username="<?php echo e($user->username); ?>"
                                                            data-toggle="modal" data-target="#modalDeleteUser">
                                                        <?php echo e(__('string.user.button.delete')); ?>

                                                    </button>
                                                </div>
                                                <?php else: ?>
                                                    <?php if($user->id == auth()->id()): ?>
                                                        <button type="button"
                                                        class="btn btn-sm btn-secondary dropdown-toggle dropdown-toggle-split"
                                                                data-toggle="dropdown"
                                                                aria-expanded="false">
                                                        </button>
                                                        <div class="dropdown-menu">
                                                            <a href="<?php echo e(route('admin.user.capture-face.form', ['user' => $user->id])); ?>"
                                                                class="dropdown-item btn btn-dark btn-sm">
                                                                <?php echo e(__('string.user.button.camera')); ?>

                                                            </a>
                                                        </div>
                                                    <?php endif; ?>
                                                <?php endif; ?>
                                            </div>
                                        </td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <tr class="text-center">
                                        <td colspan="3"><?php echo e(__('string.user.search.no_data')); ?></td>
                                    </tr>
                                <?php endif; ?>
                            </tbody>
                        </table>
                    </div>
                    <!-- <?php if(auth()->check() && auth()->user()->hasRole(config('boilerplate.access.role.admin'))): ?>
                        <div class="text-right">
                            <a href='<?php echo e(route('admin.user.create')); ?>' class="btn btn-success btn-md">
                                <em class="fas fa-plus"></em> <?php echo e(__('string.user.button.add')); ?>

                            </a>
                        </div>
                    <?php endif; ?> -->
                </div><!--col-->
            </div><!--row-->
        </div><!--card-body-->
    </div><!--card-->
    <?php echo $__env->make('backend.user.modal_delete', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('after-scripts'); ?>
    <script src="<?php echo e(mix('js/user.js')); ?>"></script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('backend.layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/html/cc-faceeye-web/resources/views/backend/user/index.blade.php ENDPATH**/ ?>