Merged
Conversation
Member
roncodes
commented
Apr 22, 2026
- Fixes the order import template download with correct template
This commit introduces full, industry-standard active geofencing capabilities to FleetOps, transforming Zones and Service Areas from passive visual/pricing constructs into live geofence triggers. ## Database Migrations (4 new) - add_geofence_config_to_zones_table: trigger_on_entry, trigger_on_exit, dwell_threshold_minutes, speed_limit_kmh columns - add_geofence_config_to_service_areas_table: same config columns - create_driver_geofence_states_table: per-driver/geofence state machine (is_inside, entered_at, exited_at, dwell_job_id) - create_geofence_events_log_table: persistent audit log with full indexing ## New Backend Classes - GeofenceIntersectionService: spatial intersection engine using MySQL MBRContains (index-assisted bounding box pre-filter) + ST_Contains (exact polygon check) with per-driver state tracking - GeofenceEntered / GeofenceExited / GeofenceDwelled: Laravel broadcast events with full industry-standard JSON webhook payloads - HandleGeofenceEntered / HandleGeofenceExited / HandleGeofenceDwelled: queued listeners that write to the event log and send notifications - CheckGeofenceDwell: delayed queue job that fires GeofenceDwelled if the driver is still inside after the configured threshold - DriverArrivedAtGeofence: multi-channel notification (database, broadcast, mail) for geofence arrival alerts - GeofenceController: REST API for event log, real-time inventory, dwell report, and per-driver history - GeofenceEventLog: Eloquent model for the events log table ## Modified Backend Files - DriverController@track: integrated GeofenceIntersectionService after every location ping; dispatches events and schedules dwell jobs - Zone / ServiceArea models: added geofence config fields to fillable/casts - EventServiceProvider: registered all three geofence event-listener pairs - FleetOpsServiceProvider: singleton binding for GeofenceIntersectionService, registered DriverArrivedAtGeofence notification - routes.php: added /geofences/* API route group ## New Frontend Files - addon/services/geofence-event-bus.js: singleton service that subscribes to the company WebSocket channel and maintains a live event feed; exposes on/off pub-sub API and emits on the universe event bus - addon/components/map/toolbar/geofence-events-panel.js/.hbs: live map toolbar panel showing a real-time stream of geofence events with colour-coded entry/exit/dwell badges ## Modified Frontend Files - addon/components/zone/form.hbs: added Geofence Triggers ContentPanel with entry/exit toggles, dwell threshold, and speed limit inputs - addon/components/service-area/form.hbs: same Geofence Triggers panel - addon/components/map/leaflet-live-map.js: injected geofenceEventBus, subscribed to geofence.entered/exited universe events, added #handleGeofenceEntered / #handleGeofenceExited private methods that flash the matching polygon layer green/red on the live map
feat: Implement Active Geofencing — Entry, Exit & Dwell Events
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.