<?php $request = app('Illuminate\Http\Request'); ?>


<?php $__env->startSection('content'); ?>
    <h3 class="page-title">
        <?php echo app('translator')->get('quickadmin.qa_list'); ?> користувачів
    </h3>

    <div class="panel panel-default users">
        <div class="panel-heading header-block">
            <div class="col-xs-12 col-lg-4">
                <div class="row">
                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('user_create')): ?>
                        <a href="<?php echo e(route('admin.users.create')); ?>"
                           class="btn btn-success"><?php echo app('translator')->get('quickadmin.qa_add_new'); ?></a>
                    <?php endif; ?>
                </div>
            </div>

            <?php if(request('show_deleted') != 1): ?>
                <div class="col-xs-12 col-lg-4">
                    <?php echo $__env->make('partials.main-search', [
                    'route' => route('admin.users.index'),
                    'search_id' => $search_id,
                    'listForSelect' => $usersFilter
                    ], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

                </div>
            <?php endif; ?>

            <div class="col-xs-12 col-lg-4">
                <div class="row">
                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('user_delete')): ?>
                        <ul class="list-inline">
                            <li><a href="<?php echo e(route('admin.users.index')); ?>"
                                   style="<?php echo e(request('show_deleted') == 1 ? '' : 'font-weight: 700'); ?>"><?php echo app('translator')->get('quickadmin.qa_all'); ?></a>
                            </li>
                            |
                            <li><a href="<?php echo e(route('admin.users.index')); ?>?show_deleted=1"
                                   style="<?php echo e(request('show_deleted') == 1 ? 'font-weight: 700' : ''); ?>"><?php echo app('translator')->get('quickadmin.qa_trash'); ?></a>
                            </li>
                        </ul>
                    <?php endif; ?>
                </div>
            </div>
        </div>

        <div class="panel-body table-responsive">
            <table class="table table-bordered table-striped <?php echo e(count($users) > 0 ? 'datatable' : ''); ?>

            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('user_delete')): ?>
            <?php if( request('show_deleted') != 1 ): ?>
                    dt-select
                    <?php endif; ?>
            <?php endif; ?>">
                <thead>
                <tr>
                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('user_delete')): ?>
                        <?php if( request('show_deleted') != 1 ): ?>
                            <th class="checkbox-input" style="text-align:center;">
                                
                            </th>
                        <?php endif; ?>

                    <?php endif; ?>

                    <th><?php echo app('translator')->get('quickadmin.users.fields.name'); ?></th>
                    <th><?php echo app('translator')->get('quickadmin.users.fields.email'); ?></th>
                    <th><?php echo app('translator')->get('quickadmin.users.fields.phone'); ?></th>
                    <th><?php echo app('translator')->get('quickadmin.users.fields.notification'); ?></th>
                    <th><?php echo app('translator')->get('quickadmin.users.fields.city'); ?></th>
                    <th><?php echo app('translator')->get('quickadmin.users.fields.role'); ?></th>
                    <th><?php echo app('translator')->get('quickadmin.qa_action'); ?></th>
                </tr>
                </thead>

                <tbody>
                <?php if(count($users) > 0): ?>
                    <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr data-entry-id="<?php echo e($user->id); ?>">
                            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('user_delete')): ?>
                                <?php if( request('show_deleted') != 1 ): ?>

                                    <?php if($user->name == 'Admin'): ?>
                                        <td class="visibility-hidden"></td>
                                    <?php else: ?>
                                        <td class="checkbox-input"></td>
                                    <?php endif; ?>
                                <?php endif; ?>
                            <?php endif; ?>

                            <td field-key='name'><?php echo e($user->name); ?></td>
                            <td field-key='email'><?php echo e($user->email); ?></td>
                            <td field-key='phone'><?php echo e($user->phone); ?></td>
                            <td field-key='notification'><?php echo e(Form::checkbox("notification", 1, $user->notification == 1 ? true : false, ["disabled"])); ?></td>
                            <td field-key='city'><?php echo e($user->city); ?></td>
                            <td field-key='role'><?php echo e($user->role->title ?? ''); ?></td>

                            <?php if($user->name == 'Admin'): ?>
                                <td></td>
                            <?php else: ?>
                                <?php if( request('show_deleted') == 1 ): ?>
                                    <td>
                                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('user_delete')): ?>
                                            <?php echo Form::open(array(
            'style' => 'display: inline-block;',
            'method' => 'POST',
            'onsubmit' => "return confirm('".trans("quickadmin.qa_are_you_sure")."');",
            'route' => ['admin.users.restore', $user->id])); ?>

                                            <?php echo Form::submit(trans('quickadmin.qa_restore'), array('class' => 'btn btn-xs btn-success')); ?>

                                            <?php echo Form::close(); ?>

                                        <?php endif; ?>
                                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('developer_delete')): ?>
                                            <?php echo Form::open(array(
            'style' => 'display: inline-block;',
            'method' => 'DELETE',
            'onsubmit' => "return confirm('".trans("quickadmin.qa_are_you_sure")."');",
            'route' => ['admin.users.perma_del', $user->id])); ?>

                                            <?php echo Form::submit(trans('quickadmin.qa_permadel'), array('class' => 'btn btn-xs btn-danger')); ?>

                                            <?php echo Form::close(); ?>

                                        <?php endif; ?>
                                    </td>

                                <?php else: ?>

                                    <td class="action">
                                        
                                        
                                        
                                        
                                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('user_edit')): ?>
                                            <a href="<?php echo e(route('admin.users.edit',[$user->id])); ?>"
                                               class="btn btn-xs btn-info"><?php echo app('translator')->get('quickadmin.qa_edit'); ?></a>
                                        <?php endif; ?>
                                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('user_delete')): ?>
                                            <?php echo Form::open(array(
                                                                                    'style' => 'display: inline-block;',
                                                                                    'method' => 'DELETE',
                                                                                    'onsubmit' => "return confirm('".trans("quickadmin.qa_are_you_sure")."');",
                                                                                    'route' => ['admin.users.destroy', $user->id])); ?>

                                            <?php echo Form::submit(trans('quickadmin.qa_delete'), array('class' => 'btn btn-xs btn-danger')); ?>

                                            <?php echo Form::close(); ?>

                                        <?php endif; ?>
                                    </td>
                                <?php endif; ?>
                            <?php endif; ?>

                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                <?php else: ?>
                    <tr>
                        <td colspan="10"><?php echo app('translator')->get('quickadmin.qa_no_entries_in_table'); ?></td>
                    </tr>
                <?php endif; ?>
                </tbody>
            </table>
            <?php if( !isset($search_id) && request('show_deleted') != 1): ?>
                <?php echo e($users->links()); ?>

            <?php endif; ?>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('javascript'); ?>
    <script>
        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('user_delete')): ?>
                <?php if( request('show_deleted') != 1 ): ?> window.route_mass_crud_entries_destroy = '<?php echo e(route('admin.users.mass_destroy')); ?>'; <?php endif; ?>
        <?php endif; ?>

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