Scheduled Inspection
View all
{% if sched_overdue_count %}
{{ sched_overdue_count }} scheduled inspection{{ 's' if sched_overdue_count != 1 }}
{{ 'are' if sched_overdue_count != 1 else 'is' }} overdue.
{% endif %}
{% if sched_upcoming %}
| Facility Name | Inspection Template | Inspector Name |
How Often? | Due | |
{% for s in sched_upcoming %}
| {{ s.facility.name if s.facility else '—' }} |
{{ s.template.name if s.template else '—' }} |
{{ s.inspector.display_name if s.inspector else '—' }} |
{{ s.recurrence_label }} |
{{ s.next_due_date.strftime('%b %d') }} |
{# Start is shown only to the assignee — the inspection is theirs to do. #}
{% if s.inspector_id and s.inspector_id == current_user.id %}
{# Receipt confirmation (phase47) — assignee confirms, or shows confirmed. #}
{% if s.is_acknowledged %}
Confirmed
{% else %}
{% endif %}
{% set open_id = sched_open_inspections.get(s.id) %}
{% if open_id %}
Continue
{% else %}
Start
{% endif %}
{% endif %}
|
{% endfor %}
{% else %}
No inspections due in the next 7 days.
{% endif %}
{% endif %}
{# ══════════════════════════════════════════════════════════════════════════
B. QUICK REVIEW (green)
══════════════════════════════════════════════════════════════════════════ #}
{% set G = '#4e8a2f' %}
Quick Review
{{ stat_tile('Submitted Today', completed_today, G,
url_for('inspections.index', status='completed', date_from=today_str, date_to=today_str),
'Completed & submitted today') }}
{{ stat_tile('Submitted This Week', submitted_this_week, G,
url_for('inspections.index', status='completed', date_from=week_start_str, date_to=today_str),
'Completed & submitted this week') }}
{% if current_user.role != 'customer' %}
{{ stat_tile('In Progress', in_progress_total, G,
url_for('inspections.index', status='in_progress'),
(stale_in_progress ~ ' stale >24h') if stale_in_progress else 'Started, not yet submitted') }}
{{ stat_tile('Pending Follow-ups', pending_followups, G,
url_for('inspections.index', status='follow_up'),
'Flagged for re-inspection') }}
{{ stat_tile('On Schedules', sched_total, G,
url_for('scheduled_inspections.index'),
'Active scheduled plans') }}
{% endif %}
{# ══════════════════════════════════════════════════════════════════════════
C. REVIEW ISSUES (orange)
══════════════════════════════════════════════════════════════════════════ #}
{% set O = '#d5761a' %}
Review Issues
{{ stat_tile('Open · Janitorial', handler_breakdown.internal, O,
url_for('issues.index', status='open', handler_type='internal'),
'Handled by our crew') }}
{{ stat_tile('Open · Facility Staff', handler_breakdown.facility, O,
url_for('issues.index', status='open', handler_type='facility'),
'Handled by facility staff') }}
{{ stat_tile('Open · Vendors', handler_breakdown.vendor, O,
url_for('issues.index', status='open', handler_type='vendor'),
'Handled by outside vendor') }}
{% if current_user.role != 'customer' %}
{{ stat_tile('Open · Unassigned', unassigned_open, O,
url_for('issues.index', status='open', unassigned='1'),
'No one assigned yet',
chips_bd=unassigned_handler, chips_base={'status': 'open', 'unassigned': '1'}) }}
{{ stat_tile('Pending · Verification', pending_verification, O,
url_for('issues.index', status='pending_verification'),
'Awaiting sign-off') }}
{% endif %}
{# All the original Issues cards are kept here in the same colored group. #}
{{ stat_tile('Issues Opened Today', issues_opened_today, O,
url_for('issues.index', date_from=today_str, date_to=today_str),
'New issues reported today',
chips_bd=opened_today_handler, chips_base={'date_from': today_str, 'date_to': today_str}) }}
{{ stat_tile('Resolved Today', resolved_today, O,
url_for('issues.index', status='resolved', date_from=today_str, date_to=today_str),
'Issues closed today') }}
{# ══════════════════════════════════════════════════════════════════════════
D. SLA ALERT (grey)
══════════════════════════════════════════════════════════════════════════ #}
{# Section D shows only when there is at least one at-risk or breached issue. #}
{% if sla_breached > 0 or sla_at_risk > 0 %}
{% set R = '#cc0000' %}
SLA Alert
{{ stat_tile('SLA At Risk', sla_at_risk, R,
url_for('issues.index', sla='at_risk'),
'Approaching their SLA deadline') }}
{{ stat_tile('SLA Alert', sla_breached, R,
url_for('issues.index', sla='breached'),
'Past their SLA deadline') }}
{% endif %}
{# ── Recent activity ─────────────────────────────────────────────────────── #}