Mar 04 2026: Implement some operational features: scheduled reports, issue resolution verification, etc - Phase 6
This commit is contained in:
@@ -79,6 +79,16 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('reports.index') }}">Reports</a>
|
||||
</li>
|
||||
{% if current_user.role in ['admin', 'supervisor'] %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('scheduled_reports.index') }}">Scheduled Reports</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if current_user.role in ['admin','supervisor'] %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('scheduled_reports.index') }}">Scheduled Reports</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('issues.index') }}">Issues</a>
|
||||
</li>
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
{# ── Top stat cards ─────────────────────────────────────────────────────── #}
|
||||
<div class="row g-3 mb-4">
|
||||
<div class="col-6 col-md-3">
|
||||
<a href="{{ url_for('inspections.index') }}" class="text-decoration-none">
|
||||
<div class="card text-white bg-primary h-100">
|
||||
<div class="card-body d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
@@ -23,8 +24,10 @@
|
||||
<i class="bi bi-clipboard-data" style="font-size:2.5rem;opacity:.25;"></i>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-6 col-md-3">
|
||||
<a href="{{ url_for('inspections.index', status='completed') }}" class="text-decoration-none">
|
||||
<div class="card text-white bg-success h-100">
|
||||
<div class="card-body d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
@@ -34,8 +37,10 @@
|
||||
<i class="bi bi-check-circle" style="font-size:2.5rem;opacity:.25;"></i>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-6 col-md-3">
|
||||
<a href="{{ url_for('issues.index', status='open') }}" class="text-decoration-none">
|
||||
<div class="card text-white bg-warning h-100">
|
||||
<div class="card-body d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
@@ -45,8 +50,10 @@
|
||||
<i class="bi bi-exclamation-triangle" style="font-size:2.5rem;opacity:.25;"></i>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-6 col-md-3">
|
||||
<a href="{{ url_for('reports.index') }}" class="text-decoration-none">
|
||||
<div class="card text-white bg-info h-100">
|
||||
<div class="card-body d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
@@ -56,9 +63,25 @@
|
||||
<i class="bi bi-graph-up" style="font-size:2.5rem;opacity:.25;"></i>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# ── Pending Follow-ups alert (non-customer) ────────────────────────────── #}
|
||||
{% if pending_followups and pending_followups > 0 and current_user.role != 'customer' %}
|
||||
<div class="row mb-3">
|
||||
<div class="col-12">
|
||||
<a href="{{ url_for('inspections.index', follow_up='1') }}" class="text-decoration-none">
|
||||
<div class="alert alert-warning d-flex align-items-center mb-0 py-2" role="alert">
|
||||
<i class="bi bi-arrow-repeat fs-5 me-2"></i>
|
||||
<strong>{{ pending_followups }}</strong> inspection{{ 's' if pending_followups != 1 else '' }} flagged as requiring a follow-up re-inspection.
|
||||
<span class="ms-2 text-muted small">Click to view →</span>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{# ── SLA Summary ─────────────────────────────────────────────────────────── #}
|
||||
{% if sla_breached > 0 or sla_at_risk > 0 %}
|
||||
<div class="row g-3 mb-4">
|
||||
|
||||
@@ -8,6 +8,12 @@
|
||||
<h2><i class="bi bi-building"></i> {{ facility.name }}</h2>
|
||||
</div>
|
||||
<div class="col-md-4 text-end d-flex gap-2 justify-content-end align-items-start">
|
||||
{% if current_user.role in ['admin', 'supervisor', 'project_manager', 'customer'] %}
|
||||
<a href="{{ url_for('reports.facility_report', facility_id=facility.id) }}"
|
||||
class="btn btn-outline-info">
|
||||
<i class="bi bi-graph-up-arrow"></i> Scorecard
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if current_user.role in ['admin', 'supervisor'] %}
|
||||
<a href="{{ url_for('facilities.edit_facility', facility_id=facility.id) }}" class="btn btn-outline-primary">
|
||||
<i class="bi bi-pencil"></i> Edit
|
||||
@@ -66,15 +72,29 @@
|
||||
<h5 class="mb-0">Statistics</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row text-center">
|
||||
<div class="col-6">
|
||||
<div class="row text-center g-2">
|
||||
<div class="col-4">
|
||||
<h3 class="text-primary">{{ areas|length }}</h3>
|
||||
<small class="text-muted">Areas</small>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="col-4">
|
||||
<h3 class="text-info">{{ facility.inspections.count() }}</h3>
|
||||
<small class="text-muted">Inspections</small>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
{%- set ns = namespace(open=0) -%}
|
||||
{%- for area in areas -%}
|
||||
{%- set ns.open = ns.open + area.issues.filter_by(status='open').count() + area.issues.filter_by(status='in_progress').count() -%}
|
||||
{%- endfor -%}
|
||||
<h3 class="text-{{ 'danger' if ns.open > 0 else 'success' }}">{{ ns.open }}</h3>
|
||||
<small class="text-muted">Open Issues</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center mt-3">
|
||||
<a href="{{ url_for('reports.facility_report', facility_id=facility.id) }}"
|
||||
class="btn btn-sm btn-outline-info">
|
||||
<i class="bi bi-graph-up-arrow me-1"></i>View Full Scorecard
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -71,6 +71,11 @@
|
||||
<span class="badge bg-{{ 'success' if ins.status == 'completed' else 'danger' if ins.status == 'flagged' else 'secondary' }}">
|
||||
{{ ins.status|replace('_',' ')|title }}
|
||||
</span>
|
||||
{% if ins.follow_up_required and not ins.follow_ups.count() %}
|
||||
<span class="badge bg-danger ms-1" title="Follow-up re-inspection required">
|
||||
<i class="bi bi-arrow-repeat"></i> Follow-up
|
||||
</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="text-nowrap">
|
||||
{% if ins.status == 'in_progress' or ins.status == 'flagged' %}
|
||||
|
||||
@@ -137,7 +137,30 @@
|
||||
<button onclick="window.print()" class="btn btn-sm btn-outline-secondary">
|
||||
<i class="bi bi-printer"></i> Print
|
||||
</button>
|
||||
{% if current_user.role not in ['customer'] %}
|
||||
<a href="{{ url_for('inspections.reinspect', inspection_id=inspection.id) }}"
|
||||
class="btn btn-sm btn-outline-primary"
|
||||
title="Start a follow-up re-inspection with the same template and facility">
|
||||
<i class="bi bi-arrow-repeat"></i> Re-inspect
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if current_user.role in ['admin','supervisor'] %}
|
||||
{% if not inspection.follow_up_required %}
|
||||
<button type="button" class="btn btn-sm btn-outline-warning"
|
||||
data-bs-toggle="modal" data-bs-target="#followupModal"
|
||||
title="Flag this inspection as requiring a follow-up">
|
||||
<i class="bi bi-flag"></i> Flag Follow-up
|
||||
</button>
|
||||
{% else %}
|
||||
<form method="post"
|
||||
action="{{ url_for('inspections.clear_followup', inspection_id=inspection.id) }}"
|
||||
class="d-inline">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
<button class="btn btn-sm btn-warning">
|
||||
<i class="bi bi-flag-fill"></i> Clear Follow-up
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
<form method="post" action="{{ url_for('inspections.delete', inspection_id=inspection.id) }}"
|
||||
onsubmit="return confirm('Delete this inspection permanently?')">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
@@ -147,6 +170,48 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# ── Follow-up required alert ── #}
|
||||
{% if inspection.follow_up_required %}
|
||||
<div class="alert alert-warning d-flex align-items-start gap-2 mb-3">
|
||||
<i class="bi bi-flag-fill mt-1"></i>
|
||||
<div>
|
||||
<strong>Follow-up Inspection Required</strong>
|
||||
{% if inspection.follow_up_note %}<br><span class="small">{{ inspection.follow_up_note }}</span>{% endif %}
|
||||
<div class="mt-2">
|
||||
<a href="{{ url_for('inspections.reinspect', inspection_id=inspection.id) }}"
|
||||
class="btn btn-sm btn-warning">
|
||||
<i class="bi bi-arrow-repeat me-1"></i>Start Re-inspection
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{# ── Parent/child inspection links ── #}
|
||||
{% if inspection.parent %}
|
||||
<div class="alert alert-info small mb-3">
|
||||
<i class="bi bi-arrow-up-circle me-1"></i>
|
||||
This is a re-inspection of
|
||||
<a href="{{ url_for('inspections.view', inspection_id=inspection.parent.id) }}"
|
||||
class="alert-link">Inspection #{{ inspection.parent.id }}</a>
|
||||
({{ inspection.parent.inspection_date.strftime('%Y-%m-%d') }},
|
||||
score: {{ inspection.parent.overall_score|round(1) if inspection.parent.overall_score else 'N/A' }}%).
|
||||
</div>
|
||||
{% endif %}
|
||||
{% set followups = inspection.follow_ups.all() %}
|
||||
{% if followups %}
|
||||
<div class="alert alert-secondary small mb-3">
|
||||
<i class="bi bi-arrow-down-circle me-1"></i>
|
||||
Follow-up inspection(s):
|
||||
{% for fu in followups %}
|
||||
<a href="{{ url_for('inspections.view', inspection_id=fu.id) }}" class="alert-link">
|
||||
#{{ fu.id }} ({{ fu.inspection_date.strftime('%Y-%m-%d') }},
|
||||
score: {{ fu.overall_score|round(1) if fu.overall_score else 'N/A' }}%)
|
||||
</a>{% if not loop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{# Header #}
|
||||
<div class="insp-header">
|
||||
<div>
|
||||
@@ -452,4 +517,30 @@ function closeMedia() {
|
||||
}
|
||||
document.addEventListener('keydown', e => { if (e.key === 'Escape') closeMedia(); });
|
||||
</script>
|
||||
|
||||
{# ── Flag follow-up modal ── #}
|
||||
<div class="modal fade" id="followupModal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<form method="POST" action="{{ url_for('inspections.flag_followup', inspection_id=inspection.id) }}">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="bi bi-flag me-2"></i>Flag Follow-up Required</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<label class="form-label fw-semibold">Reason / Notes <span class="text-muted small">(optional)</span></label>
|
||||
<textarea name="follow_up_note" class="form-control" rows="3"
|
||||
placeholder="Describe what needs to be addressed in the follow-up inspection…"></textarea>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-warning">
|
||||
<i class="bi bi-flag me-1"></i>Flag Follow-up
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -71,7 +71,7 @@
|
||||
</td>
|
||||
<td>{{ issue.description[:60] }}{% if issue.description|length > 60 %}…{% endif %}</td>
|
||||
<td>
|
||||
<span class="badge bg-{{ 'success' if issue.status == 'resolved' else 'warning text-dark' if issue.status == 'in_progress' else 'danger' }}">
|
||||
<span class="badge bg-{{ 'success' if issue.status == 'resolved' else 'info text-dark' if issue.status == 'pending_verification' else 'warning text-dark' if issue.status == 'in_progress' else 'danger' }}">
|
||||
{{ issue.status|replace('_',' ')|title }}
|
||||
</span>
|
||||
</td>
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
bg-{{ 'danger' if issue.severity in ['critical','high'] else 'warning' if issue.severity == 'medium' else 'secondary' }}
|
||||
text-{{ 'white' if issue.severity in ['critical','high','low'] else 'dark' }}">
|
||||
<h5 class="mb-0"><i class="bi bi-exclamation-triangle"></i> Issue #{{ issue.id }} — {{ issue.severity|title }} Severity</h5>
|
||||
<span class="badge bg-light text-dark">{{ issue.status|replace('_',' ')|title }}</span>
|
||||
<span class="badge bg-{{ 'info text-dark' if issue.status == 'pending_verification' else 'light text-dark' }}">
|
||||
{{ issue.status|replace('_',' ')|title }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<dl class="row mb-0">
|
||||
@@ -67,6 +69,35 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{# ── Verification panel ── #}
|
||||
{% if issue.verified_at %}
|
||||
<hr>
|
||||
<div class="alert alert-success py-2 mb-0">
|
||||
<i class="bi bi-patch-check-fill me-1"></i>
|
||||
<strong>Verified</strong> by {{ issue.verifier.username if issue.verifier else 'unknown' }}
|
||||
on {{ issue.verified_at.strftime('%Y-%m-%d %H:%M') }}.
|
||||
{% if issue.verification_note %}<br><span class="small">{{ issue.verification_note }}</span>{% endif %}
|
||||
</div>
|
||||
{% elif issue.status == 'pending_verification' %}
|
||||
<hr>
|
||||
<div class="alert alert-info py-2 mb-0">
|
||||
<i class="bi bi-hourglass-split me-1"></i>
|
||||
<strong>Awaiting supervisor verification.</strong>
|
||||
{% if current_user.role in ['admin','supervisor'] %}
|
||||
<form method="POST" action="{{ url_for('issues.verify', issue_id=issue.id) }}" class="mt-2">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
<div class="mb-2">
|
||||
<input type="text" name="verification_note" class="form-control form-control-sm"
|
||||
placeholder="Verification note (optional)">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-sm btn-success">
|
||||
<i class="bi bi-patch-check me-1"></i>Verify & Close
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -172,6 +203,17 @@
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary w-100">Save Update</button>
|
||||
</form>
|
||||
{% if issue.status in ['in_progress', 'resolved'] and current_user.role not in ['customer'] %}
|
||||
<form method="POST"
|
||||
action="{{ url_for('issues.request_verification', issue_id=issue.id) }}"
|
||||
class="mt-2">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
<button type="submit" class="btn btn-outline-info w-100"
|
||||
onclick="return confirm('Mark this issue as pending supervisor verification?')">
|
||||
<i class="bi bi-hourglass-split me-1"></i> Request Verification
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -0,0 +1,275 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}{{ facility.name }} — Scorecard{% endblock %}
|
||||
{% block extra_css %}
|
||||
<style>
|
||||
.kpi-card { border-left: 4px solid; }
|
||||
.kpi-blue { border-color: #2563eb; }
|
||||
.kpi-green { border-color: #16a34a; }
|
||||
.kpi-yellow { border-color: #d97706; }
|
||||
.kpi-red { border-color: #dc2626; }
|
||||
.chart-container { position: relative; height: 260px; }
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="d-flex justify-content-between align-items-start mb-4">
|
||||
<div>
|
||||
<h2><i class="bi bi-speedometer2 text-primary me-2"></i>{{ facility.name }}</h2>
|
||||
<p class="text-muted mb-0">Facility Scorecard — last {{ days }} days</p>
|
||||
</div>
|
||||
<div class="d-flex gap-2 align-items-center">
|
||||
{# Period selector #}
|
||||
<div class="btn-group btn-group-sm" role="group">
|
||||
{% for d, label in [(30,'30d'),(60,'60d'),(90,'90d'),(180,'180d'),(365,'1yr')] %}
|
||||
<a href="{{ url_for('reports.facility_scorecard', facility_id=facility.id, days=d) }}"
|
||||
class="btn btn-outline-secondary {{ 'active' if days == d else '' }}">{{ label }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<a href="{{ url_for('reports.facility_report', facility_id=facility.id) }}"
|
||||
class="btn btn-sm btn-outline-secondary">
|
||||
<i class="bi bi-file-text"></i> Full Report
|
||||
</a>
|
||||
<a href="{{ url_for('reports.index') }}" class="btn btn-sm btn-outline-secondary">
|
||||
<i class="bi bi-arrow-left"></i> Reports
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# ── KPI row ── #}
|
||||
<div class="row g-3 mb-4">
|
||||
<div class="col-6 col-md-3">
|
||||
<div class="card shadow-sm kpi-card kpi-blue h-100">
|
||||
<div class="card-body">
|
||||
<div class="text-muted small fw-semibold mb-1">Total Inspections</div>
|
||||
<div class="fs-2 fw-bold">{{ total_inspections }}</div>
|
||||
<div class="text-muted small">{{ completed_insp }} completed</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-3">
|
||||
<div class="card shadow-sm kpi-card {{ 'kpi-green' if avg_score and avg_score >= 80 else 'kpi-yellow' if avg_score and avg_score >= 60 else 'kpi-red' }} h-100">
|
||||
<div class="card-body">
|
||||
<div class="text-muted small fw-semibold mb-1">Avg Score</div>
|
||||
<div class="fs-2 fw-bold">{{ avg_score|round(1) if avg_score else '—' }}{% if avg_score %}%{% endif %}</div>
|
||||
<div class="text-muted small">{{ days }}-day average</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-3">
|
||||
<div class="card shadow-sm kpi-card {{ 'kpi-green' if sla_pct and sla_pct >= 90 else 'kpi-yellow' if sla_pct else 'kpi-red' }} h-100">
|
||||
<div class="card-body">
|
||||
<div class="text-muted small fw-semibold mb-1">SLA Compliance</div>
|
||||
<div class="fs-2 fw-bold">{{ sla_pct|round(1) if sla_pct is not none else '—' }}{% if sla_pct is not none %}%{% endif %}</div>
|
||||
<div class="text-muted small">{{ sla_met }}/{{ sla_total }} closed on time</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-3">
|
||||
<div class="card shadow-sm kpi-card {{ 'kpi-red' if open_issues|length > 0 else 'kpi-green' }} h-100">
|
||||
<div class="card-body">
|
||||
<div class="text-muted small fw-semibold mb-1">Open Issues</div>
|
||||
<div class="fs-2 fw-bold">{{ open_issues|length }}</div>
|
||||
<div class="text-muted small">
|
||||
{% if pending_verification > 0 %}
|
||||
<span class="text-warning">{{ pending_verification }} pending verification</span>
|
||||
{% else %}
|
||||
across all severities
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-4">
|
||||
|
||||
{# ── Score trend chart ── #}
|
||||
<div class="col-md-8">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-header bg-light fw-semibold">
|
||||
<i class="bi bi-graph-up me-1"></i> Score Trend
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{% if trend_labels %}
|
||||
<div class="chart-container">
|
||||
<canvas id="trendChart"></canvas>
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="text-muted text-center py-4 mb-0">No completed inspections in this period.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# ── Issue severity breakdown ── #}
|
||||
<div class="col-md-4">
|
||||
<div class="card shadow-sm h-100">
|
||||
<div class="card-header bg-light fw-semibold">
|
||||
<i class="bi bi-exclamation-triangle me-1"></i> Open Issues by Severity
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{% for sev, color in [('critical','danger'),('high','danger'),('medium','warning'),('low','secondary')] %}
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<span class="badge bg-{{ color }} {{ 'text-dark' if color == 'warning' else '' }}">
|
||||
{{ sev|title }}
|
||||
</span>
|
||||
<span class="fw-bold fs-5">{{ sev_counts.get(sev, 0) }}</span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if pending_verification > 0 %}
|
||||
<hr class="my-2">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<span class="badge bg-info text-dark">Pending Verification</span>
|
||||
<span class="fw-bold fs-5">{{ pending_verification }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# ── Area scores ── #}
|
||||
{% if area_scores %}
|
||||
<div class="col-md-6">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-header bg-light fw-semibold">
|
||||
<i class="bi bi-building me-1"></i> Score by Area
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<table class="table table-sm mb-0">
|
||||
<thead class="table-light">
|
||||
<tr><th>Area</th><th class="text-center">Avg Score</th><th class="text-center">Inspections</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for a in area_scores %}
|
||||
<tr>
|
||||
<td>{{ a.name }}</td>
|
||||
<td class="text-center">
|
||||
<span class="badge bg-{{ 'success' if a.avg >= 80 else 'warning text-dark' if a.avg >= 60 else 'danger' }}">
|
||||
{{ a.avg|round(1) }}%
|
||||
</span>
|
||||
</td>
|
||||
<td class="text-center text-muted small">{{ a.count }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{# ── Follow-up required ── #}
|
||||
{% if followup_required %}
|
||||
<div class="col-md-6">
|
||||
<div class="card shadow-sm border-warning">
|
||||
<div class="card-header bg-warning text-dark fw-semibold">
|
||||
<i class="bi bi-arrow-repeat me-1"></i> Follow-up Required
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<table class="table table-sm mb-0">
|
||||
<thead class="table-light">
|
||||
<tr><th>Inspection</th><th>Date</th><th>Score</th><th></th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for insp in followup_required %}
|
||||
<tr>
|
||||
<td>#{{ insp.id }} — {{ insp.template.name }}</td>
|
||||
<td class="text-muted small">{{ insp.inspection_date.strftime('%Y-%m-%d') }}</td>
|
||||
<td>
|
||||
{% if insp.overall_score %}
|
||||
<span class="badge bg-{{ 'success' if insp.overall_score >= 80 else 'warning text-dark' if insp.overall_score >= 60 else 'danger' }}">
|
||||
{{ insp.overall_score|round(1) }}%
|
||||
</span>
|
||||
{% else %}—{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ url_for('inspections.view', inspection_id=insp.id) }}"
|
||||
class="btn btn-xs btn-outline-secondary btn-sm">View</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{# ── Open issues list ── #}
|
||||
{% if open_issues %}
|
||||
<div class="col-12">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-header bg-light fw-semibold">
|
||||
<i class="bi bi-bug me-1"></i> Open Issues
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<table class="table table-sm table-hover mb-0">
|
||||
<thead class="table-light">
|
||||
<tr><th>ID</th><th>Severity</th><th>Area</th><th>Description</th><th>Status</th><th>Reported</th><th></th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for issue in open_issues %}
|
||||
<tr>
|
||||
<td class="text-muted small">#{{ issue.id }}</td>
|
||||
<td>
|
||||
<span class="badge bg-{{ 'danger' if issue.severity in ['critical','high'] else 'warning text-dark' if issue.severity == 'medium' else 'secondary' }}">
|
||||
{{ issue.severity|title }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="small">{{ issue.area.name }}</td>
|
||||
<td class="small">{{ issue.description[:80] }}{% if issue.description|length > 80 %}…{% endif %}</td>
|
||||
<td>
|
||||
<span class="badge bg-{{ 'info text-dark' if issue.status == 'pending_verification' else 'warning text-dark' if issue.status == 'in_progress' else 'secondary' }}">
|
||||
{{ issue.status|replace('_',' ')|title }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="text-muted small">{{ issue.reported_at.strftime('%Y-%m-%d') }}</td>
|
||||
<td>
|
||||
<a href="{{ url_for('issues.view', issue_id=issue.id) }}"
|
||||
class="btn btn-sm btn-outline-secondary">View</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_js %}
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
|
||||
<script>
|
||||
{% if trend_labels %}
|
||||
(function () {
|
||||
const ctx = document.getElementById('trendChart').getContext('2d');
|
||||
new Chart(ctx, {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: {{ trend_labels | tojson }},
|
||||
datasets: [{
|
||||
label: 'Avg Score (%)',
|
||||
data: {{ trend_data | tojson }},
|
||||
borderColor: '#2563eb',
|
||||
backgroundColor: 'rgba(37,99,235,.1)',
|
||||
fill: true,
|
||||
tension: 0.3,
|
||||
pointRadius: 3,
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
plugins: { legend: { display: false } },
|
||||
scales: {
|
||||
y: { min: 0, max: 100, ticks: { callback: v => v + '%' } }
|
||||
}
|
||||
}
|
||||
});
|
||||
}());
|
||||
{% endif %}
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,152 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body style="font-family:Arial,sans-serif;color:#333;max-width:640px;margin:auto;">
|
||||
<div style="background:#1a1d23;padding:20px 28px;border-radius:8px 8px 0 0;">
|
||||
<h2 style="color:#fff;margin:0;font-size:1.1rem;">
|
||||
<span style="color:#93c5fd;">📋</span>
|
||||
{{ report.frequency|title }} Report — {{ report.name }}
|
||||
</h2>
|
||||
<p style="color:#94a3b8;font-size:.8rem;margin:4px 0 0;">
|
||||
{{ start.strftime('%b %d, %Y') }} — {{ end.strftime('%b %d, %Y') }}
|
||||
{% if facility %} · {{ facility.name }}{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div style="background:#fff;border:1px solid #e2e8f0;border-top:none;
|
||||
border-radius:0 0 8px 8px;padding:24px;">
|
||||
|
||||
{# ── Summary / Facility type ── #}
|
||||
{% if report.report_type in ('summary','facility') %}
|
||||
|
||||
{# KPI row #}
|
||||
<table width="100%" cellspacing="0" cellpadding="0" style="margin-bottom:24px;">
|
||||
<tr>
|
||||
<td align="center" style="padding:12px;background:#f1f5f9;border-radius:8px;">
|
||||
<div style="font-size:1.6rem;font-weight:700;color:#1d4ed8;">{{ total_inspections }}</div>
|
||||
<div style="font-size:.75rem;color:#64748b;">Inspections</div>
|
||||
</td>
|
||||
<td width="12"></td>
|
||||
<td align="center" style="padding:12px;background:#f0fdf4;border-radius:8px;">
|
||||
<div style="font-size:1.6rem;font-weight:700;color:#15803d;">{{ completed }}</div>
|
||||
<div style="font-size:.75rem;color:#64748b;">Completed</div>
|
||||
</td>
|
||||
<td width="12"></td>
|
||||
<td align="center" style="padding:12px;background:#fef3c7;border-radius:8px;">
|
||||
<div style="font-size:1.6rem;font-weight:700;color:#b45309;">{{ open_issues }}</div>
|
||||
<div style="font-size:.75rem;color:#64748b;">Open Issues</div>
|
||||
</td>
|
||||
<td width="12"></td>
|
||||
<td align="center" style="padding:12px;background:#f0f9ff;border-radius:8px;">
|
||||
<div style="font-size:1.6rem;font-weight:700;color:#0369a1;">
|
||||
{{ '%.1f'|format(avg_score) ~ '%' if avg_score else '—' }}
|
||||
</div>
|
||||
<div style="font-size:.75rem;color:#64748b;">Avg Score</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
{% if facility_scores %}
|
||||
<h3 style="font-size:.9rem;border-bottom:1px solid #e2e8f0;padding-bottom:6px;">
|
||||
Facility Scores
|
||||
</h3>
|
||||
<table width="100%" style="border-collapse:collapse;font-size:.85rem;margin-bottom:20px;">
|
||||
<thead>
|
||||
<tr style="background:#f8fafc;">
|
||||
<th style="text-align:left;padding:6px 8px;">Facility</th>
|
||||
<th style="text-align:center;padding:6px 8px;">Inspections</th>
|
||||
<th style="text-align:center;padding:6px 8px;">Avg Score</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for row in facility_scores %}
|
||||
<tr style="border-bottom:1px solid #f1f5f9;">
|
||||
<td style="padding:6px 8px;">{{ row.name }}</td>
|
||||
<td style="padding:6px 8px;text-align:center;">{{ row.count }}</td>
|
||||
<td style="padding:6px 8px;text-align:center;">
|
||||
<span style="font-weight:600;color:{{ '#15803d' if row.avg >= 90 else '#b45309' if row.avg >= 70 else '#dc2626' }}">
|
||||
{{ '%.1f'|format(row.avg) }}%
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
{% if critical_issues %}
|
||||
<h3 style="font-size:.9rem;border-bottom:1px solid #e2e8f0;padding-bottom:6px;color:#dc2626;">
|
||||
⚠ Open Critical / High Issues
|
||||
</h3>
|
||||
<table width="100%" style="border-collapse:collapse;font-size:.82rem;margin-bottom:20px;">
|
||||
<thead>
|
||||
<tr style="background:#fef2f2;">
|
||||
<th style="text-align:left;padding:6px 8px;">Issue</th>
|
||||
<th style="text-align:left;padding:6px 8px;">Severity</th>
|
||||
<th style="text-align:left;padding:6px 8px;">Facility / Area</th>
|
||||
<th style="text-align:left;padding:6px 8px;">Reported</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for i in critical_issues %}
|
||||
<tr style="border-bottom:1px solid #fee2e2;">
|
||||
<td style="padding:6px 8px;">
|
||||
<a href="{{ base_url }}/issues/{{ i.id }}" style="color:#1d4ed8;">#{{ i.id }}</a>
|
||||
— {{ i.description[:60] }}{% if i.description|length > 60 %}…{% endif %}
|
||||
</td>
|
||||
<td style="padding:6px 8px;font-weight:600;color:#dc2626;">{{ i.severity|title }}</td>
|
||||
<td style="padding:6px 8px;">{{ i.area.facility.name }} / {{ i.area.name }}</td>
|
||||
<td style="padding:6px 8px;color:#64748b;">{{ i.reported_at.strftime('%b %d') }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
{% elif report.report_type == 'issues' %}
|
||||
|
||||
{% if issues %}
|
||||
<h3 style="font-size:.9rem;border-bottom:1px solid #e2e8f0;padding-bottom:6px;">
|
||||
Open Issues ({{ issues|length }})
|
||||
</h3>
|
||||
<table width="100%" style="border-collapse:collapse;font-size:.82rem;">
|
||||
<thead>
|
||||
<tr style="background:#f8fafc;">
|
||||
<th style="padding:6px 8px;">#</th>
|
||||
<th style="padding:6px 8px;">Severity</th>
|
||||
<th style="padding:6px 8px;">Facility / Area</th>
|
||||
<th style="padding:6px 8px;">Description</th>
|
||||
<th style="padding:6px 8px;">Status</th>
|
||||
<th style="padding:6px 8px;">Reported</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for i in issues %}
|
||||
<tr style="border-bottom:1px solid #f1f5f9;">
|
||||
<td style="padding:6px 8px;">
|
||||
<a href="{{ base_url }}/issues/{{ i.id }}" style="color:#1d4ed8;">#{{ i.id }}</a>
|
||||
</td>
|
||||
<td style="padding:6px 8px;font-weight:600;color:{{ '#dc2626' if i.severity in ['critical','high'] else '#b45309' if i.severity == 'medium' else '#64748b' }}">
|
||||
{{ i.severity|title }}
|
||||
</td>
|
||||
<td style="padding:6px 8px;">{{ i.area.facility.name }} / {{ i.area.name }}</td>
|
||||
<td style="padding:6px 8px;">{{ i.description[:80] }}{% if i.description|length > 80 %}…{% endif %}</td>
|
||||
<td style="padding:6px 8px;">{{ i.status|replace('_',' ')|title }}</td>
|
||||
<td style="padding:6px 8px;color:#64748b;">{{ i.reported_at.strftime('%b %d') }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p style="color:#64748b;">No open issues in this period.</p>
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
<hr style="border:none;border-top:1px solid #e2e8f0;margin:28px 0 16px;">
|
||||
<p style="font-size:.75rem;color:#94a3b8;">
|
||||
Janitorial QC System — scheduled report. Do not reply to this email.<br>
|
||||
<a href="{{ base_url }}/reports" style="color:#94a3b8;">View full reports dashboard</a>
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,44 @@
|
||||
{{ report.frequency|title }} Report — {{ report.name }}
|
||||
{{ start.strftime('%b %d, %Y') }} — {{ end.strftime('%b %d, %Y') }}{% if facility %} · {{ facility.name }}{% endif %}
|
||||
|
||||
{% if report.report_type in ('summary','facility') %}
|
||||
SUMMARY
|
||||
-------
|
||||
Inspections: {{ total_inspections }}
|
||||
Completed: {{ completed }}
|
||||
Open Issues: {{ open_issues }}
|
||||
Avg Score: {{ '%.1f'|format(avg_score) ~ '%' if avg_score else '—' }}
|
||||
|
||||
{% if facility_scores %}
|
||||
FACILITY SCORES
|
||||
---------------
|
||||
{% for row in facility_scores %}
|
||||
{{ row.name }}: {{ '%.1f'|format(row.avg) }}% ({{ row.count }} inspection{{ 's' if row.count != 1 else '' }})
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if critical_issues %}
|
||||
OPEN CRITICAL / HIGH ISSUES
|
||||
----------------------------
|
||||
{% for i in critical_issues %}
|
||||
#{{ i.id }} [{{ i.severity|title }}] {{ i.area.facility.name }} — {{ i.description[:80] }}
|
||||
Link: {{ base_url }}/issues/{{ i.id }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% elif report.report_type == 'issues' %}
|
||||
OPEN ISSUES ({{ issues|length }})
|
||||
{% if issues %}
|
||||
{% for i in issues %}
|
||||
#{{ i.id }} [{{ i.severity|title }}] {{ i.area.facility.name }} / {{ i.area.name }}
|
||||
Status: {{ i.status|replace('_',' ')|title }} | {{ i.description[:80] }}
|
||||
Link: {{ base_url }}/issues/{{ i.id }}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
No open issues.
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
--
|
||||
Janitorial QC System — automated scheduled report.
|
||||
View dashboard: {{ base_url }}/reports
|
||||
@@ -0,0 +1,102 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}{{ title }}{% endblock %}
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-md-8 offset-md-2">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-header bg-primary text-white">
|
||||
<h4 class="mb-0"><i class="bi bi-calendar-check me-2"></i>{{ title }}</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="POST">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-semibold">Report Name</label>
|
||||
<input type="text" name="name" class="form-control"
|
||||
value="{{ report.name if report else '' }}" required
|
||||
placeholder="e.g. Weekly Facility Summary">
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4 mb-3">
|
||||
<label class="form-label fw-semibold">Report Type</label>
|
||||
<select name="report_type" class="form-select">
|
||||
{% for val, label in [('summary','Summary KPIs'),('facility','Facility Detail'),('issues','Open Issues')] %}
|
||||
<option value="{{ val }}" {{ 'selected' if report and report.report_type == val else '' }}>
|
||||
{{ label }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-4 mb-3">
|
||||
<label class="form-label fw-semibold">Frequency</label>
|
||||
<select name="frequency" class="form-select">
|
||||
{% for val in ['daily','weekly','monthly'] %}
|
||||
<option value="{{ val }}" {{ 'selected' if report and report.frequency == val else '' }}>
|
||||
{{ val|title }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-4 mb-3">
|
||||
<label class="form-label fw-semibold">Facility <span class="text-muted small">(optional)</span></label>
|
||||
<select name="facility_id" class="form-select">
|
||||
<option value="">— All Facilities —</option>
|
||||
{% for f in facilities %}
|
||||
<option value="{{ f.id }}"
|
||||
{{ 'selected' if report and report.facility_id == f.id else '' }}>
|
||||
{{ f.name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div class="form-text">Leave blank to include all facilities.</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-semibold">Recipients</label>
|
||||
<input type="text" name="recipients" class="form-control"
|
||||
value="{{ report.recipient_list()|join(', ') if report else '' }}"
|
||||
placeholder="email1@example.com, email2@example.com"
|
||||
required>
|
||||
<div class="form-text">Comma-separated list of email addresses.</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-auto">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="include_csv"
|
||||
id="include_csv" value="1"
|
||||
{{ 'checked' if report and report.include_csv else '' }}>
|
||||
<label class="form-check-label" for="include_csv">Attach CSV export</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if report %}
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="active"
|
||||
id="active" value="1"
|
||||
{{ 'checked' if report.active else '' }}>
|
||||
<label class="form-check-label" for="active">Active (send on schedule)</label>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="d-flex gap-2 mt-3">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="bi bi-save me-1"></i>
|
||||
{{ 'Save Changes' if report else 'Create Schedule' }}
|
||||
</button>
|
||||
<a href="{{ url_for('scheduled_reports.index') }}" class="btn btn-secondary">
|
||||
<i class="bi bi-x-circle me-1"></i> Cancel
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,87 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Scheduled Reports{% endblock %}
|
||||
{% block content %}
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h2><i class="bi bi-calendar-check"></i> Scheduled Reports</h2>
|
||||
<a href="{{ url_for('scheduled_reports.create') }}" class="btn btn-primary">
|
||||
<i class="bi bi-plus-circle"></i> New Schedule
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{% if reports %}
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Name</th><th>Type</th><th>Frequency</th><th>Facility</th>
|
||||
<th>Recipients</th><th>Next Send</th><th>Last Sent</th>
|
||||
<th>Status</th><th width="160"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for r in reports %}
|
||||
<tr class="{{ 'text-muted' if not r.active else '' }}">
|
||||
<td><strong>{{ r.name }}</strong></td>
|
||||
<td><span class="badge bg-secondary">{{ r.report_type|title }}</span></td>
|
||||
<td>{{ r.frequency|title }}</td>
|
||||
<td>{{ r.facility.name if r.facility else '— All —' }}</td>
|
||||
<td>
|
||||
<span title="{{ r.recipient_list()|join(', ') }}">
|
||||
{{ r.recipient_list()|length }} recipient{{ 's' if r.recipient_list()|length != 1 else '' }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="small text-muted">
|
||||
{{ r.next_send_at.strftime('%Y-%m-%d %H:%M') if r.next_send_at else '—' }}
|
||||
</td>
|
||||
<td class="small text-muted">
|
||||
{{ r.last_sent_at.strftime('%Y-%m-%d %H:%M') if r.last_sent_at else 'Never' }}
|
||||
</td>
|
||||
<td>
|
||||
{% if r.active %}<span class="badge bg-success">Active</span>
|
||||
{% else %}<span class="badge bg-secondary">Paused</span>{% endif %}
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<a href="{{ url_for('scheduled_reports.edit', report_id=r.id) }}"
|
||||
class="btn btn-sm btn-outline-secondary" title="Edit">
|
||||
<i class="bi bi-pencil"></i>
|
||||
</a>
|
||||
<form method="POST"
|
||||
action="{{ url_for('scheduled_reports.send_now', report_id=r.id) }}"
|
||||
class="d-inline">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
<button type="submit" class="btn btn-sm btn-outline-primary" title="Send Now"
|
||||
onclick="return confirm('Send this report now?')">
|
||||
<i class="bi bi-send"></i>
|
||||
</button>
|
||||
</form>
|
||||
<form method="POST"
|
||||
action="{{ url_for('scheduled_reports.delete', report_id=r.id) }}"
|
||||
class="d-inline"
|
||||
onsubmit="return confirm('Delete this scheduled report?')">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
<button type="submit" class="btn btn-sm btn-outline-danger" title="Delete">
|
||||
<i class="bi bi-trash3"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body text-center py-5 text-muted">
|
||||
<i class="bi bi-calendar-x fs-1 d-block mb-3 opacity-25"></i>
|
||||
<p class="mb-3">No scheduled reports configured yet.</p>
|
||||
<a href="{{ url_for('scheduled_reports.create') }}" class="btn btn-primary">
|
||||
<i class="bi bi-plus-circle"></i> Create First Schedule
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user