{% extends "base.html" %} {% block title %}Scheduled Inspections{% endblock %} {% block content %}
Planned and recurring inspection assignments.
| Facility | Template | Inspector | Frequency | Next Due | Ends | Status | Confirmation | Created By | |
|---|---|---|---|---|---|---|---|---|---|
| {{ s.facility.name if s.facility else '—' }} | {{ s.template.name if s.template else '—' }} | {{ s.inspector.display_name if s.inspector else '— Unassigned —' }} | {{ s.recurrence_label }} | {{ s.next_due_date.strftime('%b %d, %Y') }} {% if overdue %} Overdue {% elif due_soon %} Due soon {% endif %} | {% if s.frequency == 'once' %} — {% elif s.end_date %} {{ s.end_date.strftime('%b %d, %Y') }} {% else %} No end {% endif %} | {# Three states, not two: "Ended" distinguishes a schedule that ran its course from one a manager switched off. #} {% if s.active %} Active {% elif s.is_expired %} Ended {% else %} Inactive {% endif %} |
{# Receipt confirmation by the assigned inspector (phase47). #}
{% if not s.inspector_id %}
—
{% elif s.is_acknowledged %}
Confirmed
{{ s.acknowledged_at.strftime('%b %d, %Y') }}
{% else %}
Awaiting
{# The assignee can confirm right here. #}
{% if s.inspector_id == current_user.id %}
{% endif %}
{% endif %}
|
{{ s.creator.display_name if s.creator else '—' }}
{{ s.created_at.strftime('%b %d, %Y') if s.created_at else '' }}
|
{# Start is shown only to the assignee — the inspection is theirs to do. #} {% if s.active and s.inspector_id and s.inspector_id == current_user.id %} {% set open_id = open_inspections.get(s.id) %} {% if open_id %} Continue {% else %} Start {% endif %} {% endif %} {% if current_user.role in ['admin','director','project_manager','auditor'] %} {% endif %} |