<?php $__env->startSection('title', 'Utilizadores'); ?>
<?php $__env->startSection('content'); ?>
    <div class="page-heading"><div><span class="eyebrow">ADMINISTRAÇÃO · IDENTIDADE</span><h1>Utilizadores</h1><p>Contas, afectações organizacionais, perfis e estados de segurança.</p></div><a class="primary-link" href="<?php echo e(route('admin.users.create')); ?>">+ Novo utilizador</a></div>
    <section class="panel"><div class="table-wrap"><table class="management-table"><thead><tr><th>Utilizador</th><th>Filial/Unidade</th><th>Perfis</th><th>Segurança</th><th></th></tr></thead><tbody>
        <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><tr class="<?php echo e($user->trashed() ? 'archived-row' : ''); ?>"><td><div class="table-user"><span class="avatar small"><?php echo e(mb_strtoupper(mb_substr($user->name,0,1))); ?></span><div><strong><?php echo e($user->name); ?></strong><small><?php echo e($user->username); ?> · <?php echo e($user->email); ?></small></div></div></td><td><strong><?php echo e($user->assignments->first()?->department?->name ?? 'Sem departamento'); ?></strong><small><?php echo e($user->assignments->first()?->branch?->name ?? 'Acesso global'); ?></small></td><td><div class="tag-row"><?php $__currentLoopData = $user->assignments->pluck('role.name')->filter()->unique(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $role): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><span class="tag"><?php echo e($role); ?></span><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></div></td><td><?php if($user->trashed()): ?><span class="status-badge">Arquivado</span><?php elseif($user->locked_until): ?><span class="status-badge danger">Bloqueado</span><?php elseif($user->is_active): ?><span class="status-badge active">Activo</span><?php else: ?><span class="status-badge">Inactivo</span><?php endif; ?><small><?php echo e($user->must_change_password ? 'Mudança de palavra-passe pendente' : 'Credencial definida'); ?></small></td><td class="row-actions"><?php if (! ($user->trashed())): ?><a href="<?php echo e(route('admin.users.edit', $user)); ?>">Editar</a><?php if($user->locked_until): ?><form method="POST" action="<?php echo e(route('admin.users.unlock', $user)); ?>"><?php echo csrf_field(); ?><button type="submit">Desbloquear</button></form><?php endif; ?> <?php if(!$user->is(auth()->user())): ?><form method="POST" action="<?php echo e(route('admin.users.destroy', $user)); ?>" data-confirm="Arquivar esta conta?"><?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?><button type="submit">Arquivar</button></form><?php endif; ?> <?php endif; ?></td></tr><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    </tbody></table></div></section>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\Joe B\.codex\.chatgpt-projects\g-p-6a6ce038586481919be04257dc687fef\nestab-ops\resources\views/admin/users/index.blade.php ENDPATH**/ ?>