{% extends "base.html" %} {% block title %}{{ project.name }}{% endblock %} {% block content %}

{{ project.name }} {% if not project.active %} Inactive {% endif %}

{% if project.description %}

{{ project.description }}

{% endif %}
{% if current_user.role in ['admin', 'director'] %} Edit {% endif %} All Contracts
{# ── Contract Info ── #}
Contract Details
Status
{{ 'Active' if project.active else 'Inactive' }}
Contract Manager
{{ project.project_manager.display_name if project.project_manager else '—' }}
Created
{{ project.created_at.strftime('%Y-%m-%d') }}
Facilities
{{ facilities|length }}
{# ── Facilities ── #}
Facilities
{% if facilities %}
{% for f in facilities %} {% endfor %}
Name Address Status
{{ f.name }} {{ f.address or '—' }} {{ 'Active' if f.active else 'Inactive' }}
{% else %}
No facilities linked to this contract yet.
{% endif %}
{# ── Customer Assignments ── #} {% if current_user.role == 'admin' %}
Customer Assignments Add Customer
{% if assignments %}
{% for a in assignments %} {% endfor %}
Customer Username Email Facility Scope Assigned
{{ a.user.username }} {{ a.user.email }} {% if a.facility %} {{ a.facility.name }} {% else %} All facilities {% endif %} {{ a.created_at.strftime('%Y-%m-%d') }}
{% else %}
No customer users assigned yet. Add one now.
{% endif %}
{% endif %} {# ── Additional Notification Recipients ── #} {% if current_user.role == 'admin' %}
Additional Notification Recipients
{# Add form (collapsed by default) #}
{# Recipient type + target #}
External address — receives email only.
{# Event subscription #}
{% for ekey, elabel in matrix_events.items() %}
{% endfor %}
{# Existing recipients #}
{% if notify_recipients %}
{% for r in notify_recipients %} {% endfor %}
Recipient Type Notified Events
{% if r.user_id %} {{ r.user.display_name if r.user else '—' }}
{{ r.user.email if r.user else '' }}
{% else %} {{ r.email }} {% endif %}
{% if r.user_id %} Staff · in-app + email {% else %} External · email {% endif %} {% set ev = r.get_event_types() %} {% if ev %}
{% for e in ev %} {{ matrix_events.get(e, e) }} {% endfor %}
{% else %} None {% endif %}
{% else %}
No additional recipients. These are notified — for the events you pick — on top of the global Notification Matrix.
{% endif %}
{% endif %}
{% if current_user.role == 'admin' %} {% endif %} {% endblock %}