{% extends "base.html" %} {% block title %}{{ title }}{% endblock %} {% block content %} {% include '_quota_warning.html' %}
{# ── Account Status card (edit mode only, not own account) ── #} {% if user and user.id != current_user.id %}
Account Status: {{ 'Active' if user.active else 'Disabled' }}
{% if user.active %} Disabling this account will immediately prevent the user from logging in. {% else %} This account is currently disabled — the user cannot log in. {% endif %}
{% endif %} {# ── Edit form ── #}

{{ title }}

{{ form.hidden_tag() }}
{{ form.username.label(class="form-label") }} {{ form.username(class="form-control") }} {% if form.username.errors %}
{% for error in form.username.errors %}{{ error }}{% endfor %}
{% endif %}
{{ form.full_name.label(class="form-label") }} {{ form.full_name(class="form-control", placeholder="e.g. Jane Smith") }} {% if form.full_name.errors %}
{% for error in form.full_name.errors %}{{ error }}{% endfor %}
{% endif %}
{{ form.email.label(class="form-label") }} {{ form.email(class="form-control") }} {% if form.email.errors %}
{% for error in form.email.errors %}{{ error }}{% endfor %}
{% endif %}
{# phase51 — the email-invitation branch that used to live here moved to Customer Management along with the Customer Inspector role. Every role this form still offers is our own staff, created with an admin-set password. #}
{{ form.password.label(class="form-label") }} {{ form.password(class="form-control", placeholder="Leave blank to keep current" if user else "") }} {% if form.password.errors %}
{% for error in form.password.errors %}{{ error }}{% endfor %}
{% endif %}
{{ form.confirm_password.label(class="form-label") }} {{ form.confirm_password(class="form-control") }} {% if form.confirm_password.errors %}
{% for error in form.confirm_password.errors %}{{ error }}{% endfor %}
{% endif %}
{{ form.role.label(class="form-label") }} {% if director_editing %} {# Directors can see the current role but cannot change it #}
{{ (user.role if user else 'Inspector').replace('_', ' ')|title }}
Role assignment requires Administrator access.
{% else %} {{ form.role(class="form-select") }} {% endif %}
Cancel
{% endblock %}