{% extends "base.html" %} {% block title %}{{ customer.username }} — Customer Portal{% endblock %} {% block content %}

{{ customer.display_name }} {% if not customer.active %} Disabled {% else %} Active {% endif %}

{{ customer.email }}{% if customer.full_name %} · @{{ customer.username }}{% endif %}

Edit Account
All Customers
{# ── Left column: account info + scoped facilities ── #}
Account Details
Full Name
{{ customer.full_name or '—' }}
Username
{{ customer.username }}
Email
{{ customer.email }}
Status
{{ 'Active' if customer.active else 'Disabled' }}
Password
{% if customer.password_set %} Set {% else %} Pending setup {% endif %}
Created
{{ customer.created_at.strftime('%Y-%m-%d') }}
Assignments
{{ assignments|length }}
Facilities
{{ facilities|length }}
{% if not customer.password_set %}
{% endif %}
{# ── Scoped facilities ── #}
Accessible Facilities
{% if facilities %}
    {% for f in facilities %}
  • {{ f.name }} {% if f.project %} {{ f.project.name }} {% endif %}
  • {% endfor %}
{% else %}
No facilities accessible yet — add an assignment below.
{% endif %}
{# ── Right column: assignments ── #}
{# ── Current assignments table ── #}
Contract Assignments
{% if assignments %}
{% for a in assignments %} {% endfor %}
Contract Facility Scope Assigned
{{ a.project.name }} {% if a.facility %} {{ a.facility.name }} {% else %} All facilities {% endif %} {{ a.created_at.strftime('%Y-%m-%d') }}
{% else %}
No assignments yet.
{% endif %}
{# ── Add assignment form ── #}
Add Assignment
Leave blank to grant access to all facilities in the contract.
{% endblock %} {% block extra_js %} {% endblock %}