Jul 9 - Update Dashboard separate open issue by Handled by

This commit is contained in:
2026-07-09 12:12:07 -04:00
parent 138e44c47d
commit 53ba27370d
3 changed files with 36 additions and 9 deletions
+1 -1
View File
@@ -1029,7 +1029,7 @@ The dashboard cards are organised into two labelled sections separated by a divi
4. Pending Follow-ups — inspections with `follow_up_required=True`; links to `inspections.index?status=follow_up` 4. Pending Follow-ups — inspections with `follow_up_required=True`; links to `inspections.index?status=follow_up`
**Issues section** (customers see first 3; staff see all 5): **Issues section** (customers see first 3; staff see all 5):
1. Open Issues — `status=open` with severity breakdown badges 1. Open Issues — `status=open` with severity breakdown badges (C/H/M/L) **and** a "Handled by" split (Janitorial Staff / Facility Staff / External Vendor) from `handler_breakdown`; each handler chip links to `issues.index?status=open&handler_type=...`. Both breakdowns are derived from the already-loaded `open_issues_all` list (no extra queries). The card is no longer a single wrapping anchor — the count and each handler chip are separate links (nested anchors are invalid).
2. Issues Opened Today — links to `issues.index` with `date_from=today&date_to=today` (uses the date filter added to `issues.index`) 2. Issues Opened Today — links to `issues.index` with `date_from=today&date_to=today` (uses the date filter added to `issues.index`)
3. Resolved Today — `status=resolved` + today's date range 3. Resolved Today — `status=resolved` + today's date range
4. Pending Verification — `status=pending_verification` 4. Pending Verification — `status=pending_verification`
+7
View File
@@ -95,6 +95,12 @@ def index():
'medium': sum(1 for i in open_issues_all if i.severity == 'medium'), 'medium': sum(1 for i in open_issues_all if i.severity == 'medium'),
'low': sum(1 for i in open_issues_all if i.severity == 'low'), 'low': sum(1 for i in open_issues_all if i.severity == 'low'),
} }
# Open issues split by who handles them (phase35) — same list, no extra query.
handler_breakdown = {
'internal': sum(1 for i in open_issues_all if (i.handler_type or 'internal') == 'internal'),
'facility': sum(1 for i in open_issues_all if i.handler_type == 'facility'),
'vendor': sum(1 for i in open_issues_all if i.handler_type == 'vendor'),
}
# ── Issues resolved today ───────────────────────────────────────────────── # ── Issues resolved today ─────────────────────────────────────────────────
resolved_today_q = Issue.query.filter( resolved_today_q = Issue.query.filter(
@@ -362,6 +368,7 @@ def index():
completed_today = completed_today, completed_today = completed_today,
open_issues = open_issues, open_issues = open_issues,
severity_breakdown = severity_breakdown, severity_breakdown = severity_breakdown,
handler_breakdown = handler_breakdown,
resolved_today = resolved_today, resolved_today = resolved_today,
pending_followups = pending_followups, pending_followups = pending_followups,
issues_opened_today = issues_opened_today, issues_opened_today = issues_opened_today,
+28 -8
View File
@@ -139,26 +139,46 @@
<div class="row g-3 mb-4"> <div class="row g-3 mb-4">
<div class="col-6 col-md"> <div class="col-6 col-md">
<a href="{{ url_for('issues.index', status='open') }}" class="text-decoration-none">
<div class="card text-white bg-warning h-100"> <div class="card text-white bg-warning h-100">
<div class="card-body"> <div class="card-body">
<div class="d-flex justify-content-between align-items-start mb-1"> <div class="d-flex justify-content-between align-items-start mb-1">
<span class="small text-white-50 fw-semibold">Open Issues</span> <span class="small text-white-50 fw-semibold">Open Issues</span>
<i class="bi bi-exclamation-triangle" style="font-size:1.4rem;opacity:.3;"></i> <i class="bi bi-exclamation-triangle" style="font-size:1.4rem;opacity:.3;"></i>
</div> </div>
<div class="fs-1 fw-bold lh-1">{{ open_issues }}</div> <a href="{{ url_for('issues.index', status='open') }}" class="text-white text-decoration-none">
<div class="mt-2" style="font-size:.72rem;opacity:.75;"> <div class="fs-1 fw-bold lh-1">{{ open_issues }}</div>
Active issues not yet resolved </a>
{% if open_issues > 0 %} {% if open_issues > 0 %}
· {% if severity_breakdown.critical > 0 %}<span class="badge bg-danger">{{ severity_breakdown.critical }}C</span> {% endif %} <div class="mt-2" style="font-size:.72rem;opacity:.85;">
{% if severity_breakdown.critical > 0 %}<span class="badge bg-danger">{{ severity_breakdown.critical }}C</span> {% endif %}
{% if severity_breakdown.high > 0 %}<span class="badge bg-danger">{{ severity_breakdown.high }}H</span> {% endif %} {% if severity_breakdown.high > 0 %}<span class="badge bg-danger">{{ severity_breakdown.high }}H</span> {% endif %}
{% if severity_breakdown.medium > 0 %}<span class="badge bg-dark">{{ severity_breakdown.medium }}M</span> {% endif %} {% if severity_breakdown.medium > 0 %}<span class="badge bg-dark">{{ severity_breakdown.medium }}M</span> {% endif %}
{% if severity_breakdown.low > 0 %}<span class="badge bg-secondary">{{ severity_breakdown.low }}L</span>{% endif %} {% if severity_breakdown.low > 0 %}<span class="badge bg-secondary">{{ severity_breakdown.low }}L</span>{% endif %}
{% endif %}
</div> </div>
{# ── Split by who handles it (click to drill in) ── #}
<div class="mt-1 d-flex flex-wrap align-items-center gap-1" style="font-size:.7rem;">
<span style="opacity:.75;">Handled by:</span>
{% if handler_breakdown.internal > 0 %}
<a href="{{ url_for('issues.index', status='open', handler_type='internal') }}"
class="badge bg-primary text-decoration-none" title="Janitorial Staff">
<i class="bi bi-people"></i> {{ handler_breakdown.internal }}
</a>{% endif %}
{% if handler_breakdown.facility > 0 %}
<a href="{{ url_for('issues.index', status='open', handler_type='facility') }}"
class="badge bg-info text-dark text-decoration-none" title="Facility Staff">
<i class="bi bi-building"></i> {{ handler_breakdown.facility }}
</a>{% endif %}
{% if handler_breakdown.vendor > 0 %}
<a href="{{ url_for('issues.index', status='open', handler_type='vendor') }}"
class="badge bg-light text-dark border text-decoration-none" title="External Vendor">
<i class="bi bi-person-gear"></i> {{ handler_breakdown.vendor }}
</a>{% endif %}
</div>
{% else %}
<div class="mt-2" style="font-size:.72rem;opacity:.75;">Active issues not yet resolved</div>
{% endif %}
</div> </div>
</div> </div>
</a>
</div> </div>
<div class="col-6 col-md"> <div class="col-6 col-md">