<?php $__env->startSection('title', 'Users'); ?>
<?php $__env->startSection('subtitle', 'Create accounts, assign roles, and keep your internal team access organized.'); ?>

<?php $__env->startSection('content'); ?>
    <div class="admin-grid">
        <div class="admin-card">
            <div class="admin-toolbar">
                <div>
                    <p class="admin-section-title">Team access</p>
                    <p class="admin-section-subtitle"><?php echo e($users->total()); ?> users can access this CMS workspace.</p>
                </div>
                <div class="flex flex-wrap gap-2">
                    <a href="<?php echo e(route('admin.roles.index')); ?>" class="admin-button admin-button--secondary">Manage roles</a>
                    <a href="<?php echo e(route('admin.users.create')); ?>" class="admin-button">New user</a>
                </div>
            </div>

            <div class="admin-response-table">
                <table>
                    <thead>
                        <tr>
                            <th>User</th>
                            <th>Role</th>
                            <th>Last active</th>
                            <th></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; ?>
                            <?php
                                $roleLabel = $user->roleModel?->name
                                    ?? \Illuminate\Support\Str::of($user->roleSlug() ?? 'user')->replace('-', ' ')->title();
                            ?>
                            <tr>
                                <td>
                                    <div class="admin-table-person">
                                        <strong><?php echo e($user->name); ?></strong>
                                        <span><?php echo e($user->email); ?></span>
                                    </div>
                                </td>
                                <td><span class="admin-badge admin-badge--read"><?php echo e($roleLabel); ?></span></td>
                                <td><?php echo e($user->updated_at?->diffForHumans() ?? 'Recently added'); ?></td>
                                <td>
                                    <div class="flex flex-wrap justify-end gap-2">
                                        <a href="<?php echo e(route('admin.users.edit', $user)); ?>" class="admin-button admin-button--ghost">Edit</a>
                                        <form method="POST" action="<?php echo e(route('admin.users.destroy', $user)); ?>" onsubmit="return confirm('Delete this user?');">
                                            <?php echo csrf_field(); ?>
                                            <?php echo method_field('DELETE'); ?>
                                            <button type="submit" class="admin-button admin-button--danger">Delete</button>
                                        </form>
                                    </div>
                                </td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <tr>
                                <td colspan="4" class="admin-empty">No users have been created yet.</td>
                            </tr>
                        <?php endif; ?>
                    </tbody>
                </table>
            </div>

            <div class="mt-6">
                <?php echo e($users->links()); ?>

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

<?php echo $__env->make('admin.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/xsoftdev/saleemsail.xsoftdevelop.com/resources/views/admin/users/index.blade.php ENDPATH**/ ?>