{% extends "ui/templates/base/layout.html" %} {% import "ui/templates/components/macros.html" as ui %} {% block content %}
{{ ui.page_shell('User Management', 'Audit Firm- and branch-scoped users with filters, pagination, lifecycle controls, role bindings, and invite actions.', 'Create user' if can_manage_users(current_user, current_user_permissions or []) else '') }} {% if flash %}{{ ui.alert(flash) }}{% endif %}
{{ ui.search_bar('/system-settings/users', filters.q, filters.per_page) }} {% if users %}
{% for row in users %} {% endfor %}
User Audit Firm / Branch Roles Lifecycle Action
{{ row.full_name or '-' }}
{{ row.email }}
{{ tenants[row.tenant_id].name if row.tenant_id in tenants else '-' }}
{{ branches[row.branch_id].name if row.branch_id in branches else '-' }}
{% for role_name in user_roles.get(row.id, []) %}{{ ui.badge(role_name, 'brand') }}{% else %}No roles{% endfor %}
{% if row.deleted_at %}{{ ui.badge('Deleted') }}{% endif %}{% if row.is_active %}{{ ui.badge('Active','emerald') }}{% else %}{{ ui.badge('Inactive','rose') }}{% endif %}{% if row.allow_login %}{{ ui.badge('Login enabled','sky') }}{% else %}{{ ui.badge('Login disabled','amber') }}{% endif %}{% if row.is_locked %}{{ ui.badge('Locked','amber') }}{% else %}{{ ui.badge('Unlocked') }}{% endif %}
{% if "users.manage" in current_user_permissions %}
Edit {% if row.deleted_at %}
{% else %} {% if row.is_active %}
{% else %}
{% endif %} {% if row.allow_login %}
{% else %}
{% endif %} {% if row.is_locked %}
{% else %}
{% endif %} {% if "users.invite" in current_user_permissions and row.allow_login and not row.deleted_at %}
{% endif %}
{% endif %}
{% endif %}
{{ ui.pagination(users_page, '/system-settings/users', request.url.query) }} {% else %}
{{ ui.empty_state('No users matched the current filter.', 'Try a different search term or create a new user.') }}
{% endif %}
{% endblock %}