<?php echo $__env->make('admin.includes.errors', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<?php $__env->startSection('content'); ?>
<div class="container">
<h2 class="text-center">Users List</h2>
<div class="card">
<div class="card-body">
<table class="table table-hover">
    <thead>
        <th>
            Name
        </th>
        <th>
            Email ID
        </th>
        <th>
            Contact 
        </th>
        <th>
            Permission
        </th>
        <th>
            Delete
        </th>
    </thead>
    <?php if($users->count() > 0): ?>
        <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <tr>
                <td>
                <?php echo e($user->name); ?>

                </td>
                <td>
                <?php echo e($user->email); ?>

                </td>
                <td>
                <?php echo e($user->contact); ?>

                </td>
                <td>
                <?php if($user->admin): ?>
                    <a href="<?php echo e(route('user.not.admin', ['id' => $user->id])); ?>" class="btn btn-danger">Remove permissions</a>
                <?php else: ?>
                    <a href="<?php echo e(route('user.admin', ['id' => $user->id])); ?>" class="btn btn-success">Make admin</a>
                <?php endif; ?>
                </td>
                <td>
                <?php if(Auth::id() != $user->id): ?>
                    <a href="<?php echo e(route('user.delete', ['id' => $user->id])); ?>" class="btn btn-danger">Delete</a>
                <?php endif; ?>
                </td>
            </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        <?php else: ?>
        <tr>
            <th colspan="5" class="text-center">No Users Found</th>
        </tr>
    <?php endif; ?> 
</table>
</div>
    <div>
        <?php echo e($users->links()); ?>

    </div>
</div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>