From c5b261ecb909d46eed9363b743e9835d4c37b945 Mon Sep 17 00:00:00 2001 From: ethanhawkes-gif Date: Mon, 17 Aug 2026 03:53:25 +0000 Subject: [PATCH 1/2] fix(situation): make live-GPS unit overlay toggleable in the layer control The EOC map draws units through two independent layers: the status- coloured roster layer (unitMarkers, the 'Units (EOC)' checkbox) and the real-time GPS overlay from unit-tracking.js. UnitTracking.init() adds its layer group straight to the map and situation.php never registered it in the Leaflet layer control, so unchecking 'Units (EOC)' only hid the green roster markers -- the orange live-GPS markers (coloured by unit.color) stayed on screen with no way to turn them off. Register the tracking group as its own toggleable overlay ('Units -- live GPS', default on so nothing changes unless the operator toggles it) and register it with MapLayerPrefs for per-user persistence like the other overlays. Reported by cbyrdmo on a live volunteer fire/EMS EOC deployment (openises/TicketsCAD#71). Adds tests/test_gh71_live_gps_layer_toggle.php (static guards, matching tests/test_situation_map_fixes.php). New: 6/6, existing situation suite: 34/34, php -l clean. --- situation.php | 22 +++++++ tests/test_gh71_live_gps_layer_toggle.php | 72 +++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 tests/test_gh71_live_gps_layer_toggle.php diff --git a/situation.php b/situation.php index 1e85110..eca0b15 100644 --- a/situation.php +++ b/situation.php @@ -2049,6 +2049,28 @@ function init() { } }); tracker.start(); + + // GH #71 follow-up (cbyrdmo, 2026-08-17) — the live-GPS tracking + // overlay was added straight to the map (UnitTracking.init does + // L.layerGroup().addTo(map)) and never registered in the layer + // control. The "Units (EOC)" checkbox only governs the status- + // coloured EOC roster layer (unitMarkers), so switching units off + // left the live-GPS markers on screen — drawn in each unit's + // configured tracking colour (e.g. orange) rather than the green + // status colour — and operators read that as "units won't turn + // off." Register the tracking group as its own toggleable overlay + // (default on, unchanged) so it can be hidden, and persist that + // choice per-user like the other overlays. + if (sitLayersControl && typeof tracker.getLayerGroup === 'function') { + var liveGpsLayer = tracker.getLayerGroup(); + if (liveGpsLayer) { + sitLayersControl.addOverlay(liveGpsLayer, + ' Units — live GPS'); + if (window.MapLayerPrefs && window.MapLayerPrefs.register) { + window.MapLayerPrefs.register(map, 'units_live', liveGpsLayer); + } + } + } } // Fallback polling every 15s for incidents (SSE handles real-time when available) diff --git a/tests/test_gh71_live_gps_layer_toggle.php b/tests/test_gh71_live_gps_layer_toggle.php new file mode 100644 index 0000000..4fc4b43 --- /dev/null +++ b/tests/test_gh71_live_gps_layer_toggle.php @@ -0,0 +1,72 @@ + Date: Mon, 17 Aug 2026 00:23:24 -0500 Subject: [PATCH 2/2] Move the live-GPS legend dot off an inline style (CI fix) The required "fresh install + test suite" check failed on tests/test_ui_consistency_audit.php: the new "Units - live GPS" overlay label used style="color:#fd7e14", which the project's UI-consistency audit flags -- an inline hex colour can't be overridden by a stylesheet without !important. The other four legend dots on this page (Units (EOC), Facilities (EOC), Event Zones, Weather Alerts) have the identical pattern and are pre-existing, baselined debt; this one is new code, so the audit is right to ask for better here rather than adding a fifth exception. Moved the colour into a new .sit-legend-live-gps CSS class in situation.php's own