<?php $__env->startSection('title','Admin User Management'); ?>
<?php $__env->startSection('subtitle','Create and control access to the Desxpert administration portal.'); ?>
<?php $__env->startSection('content'); ?>
<div class="admin-user-toolbar">
    <form method="get" class="admin-user-filter">
        <div><i data-lucide="search"></i><input name="q" value="<?php echo e(request('q')); ?>" placeholder="Search administrator..."></div>
        <select name="status"><option value="">All statuses</option><?php $__currentLoopData = ['active','inactive','deactivated']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $status): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($status); ?>" <?php if(request('status')===$status): echo 'selected'; endif; ?>><?php echo e(ucfirst($status)); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select>
        <button>Apply</button>
    </form>
    <button class="new-admin-button" type="button" data-open-admin><i data-lucide="user-plus"></i>Add Administrator</button>
</div>
<div class="admin-user-stats">
    <article><i data-lucide="shield-check"></i><div><span>Total Administrators</span><strong><?php echo e(number_format($stats['total'])); ?></strong></div></article>
    <article><i data-lucide="activity"></i><div><span>Active Access</span><strong><?php echo e(number_format($stats['active'])); ?></strong></div></article>
    <article><i data-lucide="key-round"></i><div><span>System Admins</span><strong><?php echo e(number_format($stats['system'])); ?></strong></div></article>
</div>
<div class="admin-user-table">
    <div class="table-scroll"><table><thead><tr><th>Administrator</th><th>Access Level</th><th>Status</th><th>Created</th><th>Access Control</th></tr></thead>
        <tbody><?php $__empty_1 = true; $__currentLoopData = $admins; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $admin): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?><tr>
            <td><div class="user-cell"><div class="avatar user-avatar" style="--avatar-border:var(--lime)"><span><?php echo e(strtoupper(substr($admin->name,0,1))); ?></span></div><div><b><?php echo e($admin->name); ?></b><span><?php echo e($admin->email); ?></span></div></div></td>
            <td><span class="admin-role-badge <?php echo e($admin->isSystemAdmin()?'system':''); ?>"><i data-lucide="<?php echo e($admin->isSystemAdmin()?'crown':'shield'); ?>"></i><?php echo e($admin->roleLabel()); ?></span></td>
            <td><span class="admin-access-status <?php echo e($admin->status); ?>"><i></i><?php echo e(ucfirst($admin->status)); ?></span></td>
            <td><?php echo e($admin->created_at?->format('M d, Y')); ?></td>
            <td><form method="post" action="<?php echo e(route('admin-users.update',$admin)); ?>" class="user-action"><?php echo csrf_field(); ?> <?php echo method_field('patch'); ?><select name="status"><?php $__currentLoopData = ['active','inactive','deactivated']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $status): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($status); ?>" <?php if($admin->status===$status): echo 'selected'; endif; ?>><?php echo e(ucfirst($status)); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select><button>Save</button></form></td>
        </tr><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><tr><td colspan="5" class="empty">No administrator accounts found.</td></tr><?php endif; ?></tbody>
    </table></div>
    <div class="table-footer"><span>Showing <?php echo e($admins->firstItem()??0); ?> to <?php echo e($admins->lastItem()??0); ?> of <?php echo e(number_format($admins->total())); ?> administrators</span><?php echo e($admins->onEachSide(1)->links('vendor.pagination.default')); ?></div>
</div>
<dialog class="admin-user-dialog" id="admin-user-dialog">
    <form method="post" action="<?php echo e(route('admin-users.store')); ?>"><?php echo csrf_field(); ?>
        <div class="dialog-head"><div><small>ACCESS MANAGEMENT</small><h2>Add administrator</h2><p>Create secure access to the admin application.</p></div><button type="button" data-close-admin aria-label="Close"><i data-lucide="x"></i></button></div>
        <div class="dialog-fields">
            <label><span>Full name</span><input name="name" value="<?php echo e(old('name')); ?>" required autocomplete="name"></label>
            <label><span>Email address</span><input type="email" name="email" value="<?php echo e(old('email')); ?>" required autocomplete="email"></label>
            <label><span>Access level</span><select name="role" required><option value="Admin" <?php if(old('role')==='Admin'): echo 'selected'; endif; ?>>Admin</option><option value="System Admin" <?php if(old('role')==='System Admin'): echo 'selected'; endif; ?>>System Admin</option></select><small>System Admins can create and manage other administrators.</small></label>
            <p class="password-hint"><i data-lucide="shield-check"></i>A secure temporary password will be emailed to the administrator. They must replace it after their first sign-in.</p>
        </div>
        <footer><button type="button" data-close-admin>Cancel</button><button class="create-button"><i data-lucide="user-plus"></i>Create Administrator</button></footer>
    </form>
</dialog>
<?php if($errors->any() && old('email')): ?><script>document.addEventListener('DOMContentLoaded',()=>document.getElementById('admin-user-dialog')?.showModal())</script><?php endif; ?>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.admin', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/dev/desxpert-admin/resources/views/admin/admin-users.blade.php ENDPATH**/ ?>