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


<?php if(session('success')): ?>

<div class="alert alert-success alert-dismissible fade show">

<?php echo e(session('success')); ?>


<button class="btn-close"
data-bs-dismiss="alert"></button>

</div>

<?php endif; ?>



<?php if(session('error')): ?>

<div class="alert alert-danger alert-dismissible fade show">

<?php echo e(session('error')); ?>


<button class="btn-close"
data-bs-dismiss="alert"></button>

</div>

<?php endif; ?>




<div class="container-fluid py-4">


<h3 class="text-center text-danger fw-bold mb-4">

<i class="bi bi-people"></i>

Registered Users

</h3>




<div class="card shadow">


<div class="card-body">


<div class="table-responsive">


<table class="table table-bordered table-hover align-middle">


<thead class="table-dark">


<tr>

<th>#</th>

<th>Name</th>

<th>Email</th>

<th>Role</th>

<th>Admin</th>

<th>Department / Section</th>

<th>Registered</th>

<th>Action</th>


</tr>


</thead>



<tbody>


<?php $__empty_1 = true; $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>


<tr>


<td>
<?php echo e($key+1); ?>

</td>



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

</td>



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

</td>




<td>


<?php if($user->role=="admin"): ?>

<span class="badge bg-danger">
Admin
</span>


<?php elseif($user->role=="coordinator"): ?>

<span class="badge bg-warning text-dark">
Coordinator
</span>


<?php elseif($user->role=="department"): ?>

<span class="badge bg-info">
Department
</span>


<?php else: ?>

<span class="badge bg-secondary">
Operator
</span>


<?php endif; ?>


</td>





<td>


<?php if($user->is_admin==1): ?>

<span class="badge bg-success">
YES
</span>


<?php else: ?>

<span class="badge bg-secondary">
NO
</span>


<?php endif; ?>


</td>





<td>


<?php if($user->complaintAgainst): ?>


<?php echo e($user->complaintAgainst->name); ?>



<?php else: ?>

<span class="text-muted">

N/A

</span>


<?php endif; ?>



</td>





<td>

<?php echo e($user->created_at 
? $user->created_at->format('d M Y')
: '-'); ?>



</td>




<td>


<?php if(auth()->user()->is_admin==1): ?>


<?php if($user->id != 1): ?>


<form action="<?php echo e(route('users.destroy',$user->id)); ?>"
method="POST"
onsubmit="return confirm('Delete this user?');">


<?php echo csrf_field(); ?>

<?php echo method_field('DELETE'); ?>


<button class="btn btn-danger btn-sm">

<i class="bi bi-trash"></i>

Delete

</button>



</form>


<?php else: ?>


<span class="badge bg-dark">
Protected Admin
</span>


<?php endif; ?>


<?php else: ?>


<span class="text-muted">

No Permission

</span>


<?php endif; ?>


</td>




</tr>


<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>


<tr>

<td colspan="8"
class="text-center">

No users found.

</td>

</tr>


<?php endif; ?>



</tbody>


</table>


</div>


</div>


</div>


</div>



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