{% extends "base.html" %} {% block title %}Customer Management{% endblock %} {% block content %}

Customer Management

Manage both customer-side roles — Customer Directors (portal access) and Customer Inspectors (perform inspections on their contracts).

Import CSV New Customer
{% if customers %} {% if expired_invitations %} {% endif %}
{% for customer in customers %} {# Inspectors are scoped by InspectorAssignment, directors by CustomerAssignment — read the map that matches the role. #} {% set assignments = inspector_assignment_map[customer.id] if customer.is_inspector else assignment_map[customer.id] %} {% set facility_ids = scope_map[customer.id] %} {% endfor %}
Username Full Name Role Email Status Assigned Contracts Accessible Facilities Created
{{ customer.username }} {{ customer.full_name or '—' }} {{ customer.role_label }} {{ customer.email }} {% if customer.active %} Active {% else %} Disabled {% endif %} {% if assignments %} {% set project_names = assignments | map(attribute='project') | map(attribute='name') | unique | list %} {% for pname in project_names %} {{ pname }} {% endfor %} {% else %} — None — {% endif %} {% if facility_ids %} {{ facility_ids|length }} facilit{{ 'y' if facility_ids|length == 1 else 'ies' }} {% else %} — None — {% endif %} {{ customer.created_at.strftime('%Y-%m-%d') }}
{# ── Summary footer ── #}
{{ customers|length }} customer account{{ 's' if customers|length != 1 else '' }} total · {{ customers|selectattr('active')|list|length }} active · {{ customers|rejectattr('is_inspector')|list|length }} director{{ 's' if customers|rejectattr('is_inspector')|list|length != 1 else '' }} · {{ customers|selectattr('is_inspector')|list|length }} inspector{{ 's' if customers|selectattr('is_inspector')|list|length != 1 else '' }}
{% else %}

No customer accounts have been created yet.

Create First Customer
{% endif %} {% endblock %}