From 6248c25103defb60a842117cf837eb090325bece Mon Sep 17 00:00:00 2001 From: NguyenND Date: Tue, 17 Mar 2026 15:34:02 -0400 Subject: [PATCH] March 17 2026: form editor - update functions 2 --- app/templates/scheduled_reports/index.html | 523 +++------------------ 1 file changed, 68 insertions(+), 455 deletions(-) diff --git a/app/templates/scheduled_reports/index.html b/app/templates/scheduled_reports/index.html index 4685d47..80c3484 100644 --- a/app/templates/scheduled_reports/index.html +++ b/app/templates/scheduled_reports/index.html @@ -1,482 +1,95 @@ {% extends "base.html" %} -{% block title %}Dashboard{% endblock %} - +{% block title %}Scheduled Reports{% endblock %} {% block content %} -
-
-

Welcome, {{ current_user.username }}!

- - {{ current_user.role.replace('_',' ')|title }} - -
+
+

Scheduled Reports

+ + New Schedule +
-{# ── Top stat cards ─────────────────────────────────────────────────────── #} - - -{# ── Pending Follow-ups alert (non-customer) ────────────────────────────── #} -{% if pending_followups and pending_followups > 0 and current_user.role != 'customer' %} - -{% endif %} - -{# ── SLA Summary ─────────────────────────────────────────────────────────── #} -{% if sla_breached > 0 or sla_at_risk > 0 %} -
- {% if sla_breached > 0 %} - - {% endif %} - {% if sla_at_risk > 0 %} - - {% endif %} -
-{% endif %} - -{# ── Customer portal: scoped facilities panel ───────────────────────────── #} -{% if current_user.role == 'customer' %} -
-
-
-
- Your Facilities -
- {% if customer_facilities %} -
-
- - - - - - - - - - - {% for f in customer_facilities %} - - - - - - - {% endfor %} - -
FacilityAddressProject
{{ f.name }}{{ f.address or '—' }}{{ f.project.name if f.project else '—' }} - - View - - - Report - -
-
-
- {% else %} -
- - No facilities have been assigned to your account yet. Please contact your administrator. -
- {% endif %} -
-
-
-{% endif %} - -{# ── System quick stats (admin/supervisor) ──────────────────────────────── #} -{% if current_user.role in ['admin', 'supervisor'] %} -
-
-
-
- -
{{ total_facilities }}
-
Active Facilities
-
-
-
-
-
-
- -
{{ total_templates }}
-
Templates
-
-
-
- {% if current_user.role == 'admin' %} -
-
-
- -
{{ total_users }}
-
Users
-
-
-
- {% endif %} -
-{% endif %} - -{# ── Score trend chart + Facility performance ───────────────────────────── #} -
-
-
-
- Inspection Score Trend (Last 30 Days) -
-
- {% if trend_labels %} - - {% else %} -
- - No completed inspections with scores in the last 30 days. -
- {% endif %} -
-
-
- - {% if current_user.role in ['admin', 'supervisor'] and facility_perf %} -
-
-
- Facility Performance (30d) -
-
- - - - - - - - - - {% for f in facility_perf %} - - - - - - {% endfor %} - -
FacilityInspectionsAvg Score
{{ f.name }}{{ f.count }} - - {{ f.avg }}% - -
-
-
-
- {% endif %} -
- -{# ── Facility Score Trend (30/60/90 days) ─────────────────────────────────── #} -{% if all_facilities %} -
-
-
-
- Facility Score Trend -
- -
- - - -
-
-
-
-
- - Select a facility to view its score trend. -
- - - -
-
-
-
-{% endif %} - -{# ── Recent activity ─────────────────────────────────────────────────────── #} +{% if reports %}
-
- Recent Activity -
- {% if recent_inspections %}
- - - - {% if current_user.role != 'inspector' %}{% endif %} - - + + + - {% for insp in recent_inspections %} - - - - - {% if current_user.role != 'inspector' %}{% endif %} + {% for r in reports %} + + + + + + + + {% endfor %}
DateFacilityAreaInspectorScoreStatusNameTypeFrequencyFacilityRecipientsNext SendLast SentStatus
{{ insp.inspection_date.strftime('%Y-%m-%d %H:%M') }}{{ insp.facility.name }}{{ insp.area.name if insp.area else '—' }}{{ insp.inspector.username }}
{{ r.name }}{{ r.report_type|title }}{{ r.frequency|title }}{{ r.facility.name if r.facility else '— All —' }} - {% if insp.overall_score %} - - {{ insp.overall_score }}% + + {{ r.recipient_list()|length }} recipient{{ 's' if r.recipient_list()|length != 1 else '' }} - {% else %} - - {% endif %} + + {{ r.next_send_at.strftime('%Y-%m-%d %H:%M') if r.next_send_at else '—' }} + + {{ r.last_sent_at.strftime('%Y-%m-%d %H:%M') if r.last_sent_at else 'Never' }} - - {{ insp.status|title }} - + {% if r.active %}Active + {% else %}Paused{% endif %} + + + + + + + + + + +
+ + +
+
+ + +
- {% else %} -
- No recent inspections. -
- {% endif %}
- - - -{% if trend_labels %} - -{% endif %} - -{# ── Facility trend chart (AJAX-driven) ── #} -{% if all_facilities %} - +{% else %} +
+
+ +

No scheduled reports configured yet.

+ + Create First Schedule + +
+
{% endif %} {% endblock %} \ No newline at end of file