From 2905a327bee93fca17ba8a055fbbede8247e85bf Mon Sep 17 00:00:00 2001 From: serversdown Date: Fri, 29 May 2026 01:06:44 +0000 Subject: [PATCH] admin_events: wire shared event-detail modal into the page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /admin/events previously rendered events as a flat table with no detail view — admins had to copy an event ID and open the standalone SFM webapp on port 8200 to see the chart, PDF, or sidecar metadata. Adds: - {% include 'partials/event_detail_modal.html' %} + script tag at the bottom of the page (mirrors the pattern in /sfm, /unit/{id}, /projects/.../nrl/...). - onclick on the table opens the modal via showEventDetail(id). - event.stopPropagation() on the checkbox so selection clicks don't also open the modal. - Listener for the 'sfm-event-review-saved' CustomEvent fired by event-modal.js — reloads the table so any FT-flag changes made in the modal's review form land on the row without a full reload. Also propagates the same listener pattern to the three other pages that already include the modal (sfm.html, unit_detail.html, vibration_location_detail.html) — they call their respective loadEvents / loadUnitEvents / loadLocationEvents on the fire. Keeps the refresh-on-save UX consistent across every page that hosts the modal. Phase 1 of the SFM-into-Terra-View integration is now complete: chart, PDF preview, .TXT download, review form, and per-unit + admin event browsing are all native in Terra-View. The standalone SFM webapp on port 8200 remains as a diagnostic fallback but operators no longer need to bounce to it for routine workflows. Co-Authored-By: Claude Opus 4.7 (1M context) --- templates/admin_events.html | 15 +++++++++++++-- templates/sfm.html | 7 +++++++ templates/unit_detail.html | 6 ++++++ templates/vibration_location_detail.html | 6 ++++++ 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/templates/admin_events.html b/templates/admin_events.html index 9f45799..729330d 100644 --- a/templates/admin_events.html +++ b/templates/admin_events.html @@ -192,8 +192,9 @@ function renderTable() { ? 'FT' : ''; const checked = _selected.has(ev.id) ? 'checked' : ''; - return ` - + return ` + ${_esc(ev.serial)} ${_esc(ts)} ${_fmtPpv(ev.tran_ppv)} @@ -355,5 +356,15 @@ async function flagSelected(value) { } // Initial empty state — let the user choose to load. + +// Refresh the events table when the modal's review form saves — keeps +// the FT badge in sync without a full page reload. +window.addEventListener('sfm-event-review-saved', () => { + if (_events.length) loadEvents(); +}); + +{# Shared event-detail modal — rendered by /static/event-modal.js #} +{% include 'partials/event_detail_modal.html' %} + {% endblock %} diff --git a/templates/sfm.html b/templates/sfm.html index bbb94e2..8f6283f 100644 --- a/templates/sfm.html +++ b/templates/sfm.html @@ -118,6 +118,13 @@ {# Shared event-detail modal — rendered by /static/event-modal.js #} {% include 'partials/event_detail_modal.html' %} +