<?php $__env->startSection('title', 'User Accounts'); ?>
<?php $__env->startSection('content'); ?>
<div class="card">
    <div class="card-header pb-0 d-flex justify-content-between align-items-center">
        <h6 class="mb-0">User Accounts</h6>
        <a href="<?php echo e(route('users.create')); ?>" class="btn btn-sm btn-primary mb-0"><i class="bi bi-plus-lg me-1"></i>New User</a>
    </div>
    <div class="card-body">
        <div class="table-responsive"><table class="table align-items-center mb-0">
            <thead><tr class="text-xxs text-uppercase text-secondary"><th class="ps-2">Name</th><th>Email</th><th>Role</th><th>Linked Staff</th><th></th></tr></thead>
            <tbody>
            <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <tr>
                    <td class="ps-2 font-weight-bold text-sm"><?php echo e($user->name); ?></td>
                    <td class="text-sm"><?php echo e($user->email); ?></td>
                    <td><?php $__currentLoopData = $user->roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $r): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><span class="badge bg-gradient-primary text-white"><?php echo e(ucfirst($r->name)); ?></span><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></td>
                    <td class="text-sm"><?php echo e($user->staff?->name ?? '—'); ?></td>
                    <td class="text-end pe-2">
                        <a href="<?php echo e(route('users.edit', $user)); ?>" class="text-secondary me-2"><i class="bi bi-pencil"></i></a>
                        <?php if($user->id !== auth()->id()): ?>
                        <form action="<?php echo e(route('users.destroy', $user)); ?>" method="POST" class="d-inline" onsubmit="return confirm('Delete this user?')"><?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?><button class="btn btn-link p-0 text-danger"><i class="bi bi-trash"></i></button></form>
                        <?php endif; ?>
                    </td>
                </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </tbody>
        </table></div>
        <div class="mt-3"><?php echo e($users->links()); ?></div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /Users/kalaiarasen/projects/myindependent-worker-management/resources/views/users/index.blade.php ENDPATH**/ ?>