Improve map interactions for planning and guard assignment

Fix geocoding bug, implement map zooming to site, allow guard assignment to sites, and enable patrol route sequencing via map marker clicks.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: e5565357-90e1-419f-b9a8-6ee8394636df
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/6d543d2c-20b9-4ea6-93fe-70fe9b1d9f80/e5565357-90e1-419f-b9a8-6ee8394636df/ZaT6tFl
This commit is contained in:
marco370 2025-10-23 14:37:33 +00:00
parent 32e5647dd3
commit f05f05ca57
2 changed files with 26 additions and 5 deletions

View File

@ -21,7 +21,7 @@ externalPort = 3001
[[ports]] [[ports]]
localPort = 41295 localPort = 41295
externalPort = 6000 externalPort = 5173
[[ports]] [[ports]]
localPort = 41343 localPort = 41343
@ -43,10 +43,6 @@ externalPort = 5000
localPort = 43267 localPort = 43267
externalPort = 3003 externalPort = 3003
[[ports]]
localPort = 45047
externalPort = 5173
[env] [env]
PORT = "5000" PORT = "5000"

View File

@ -86,6 +86,31 @@ To prevent timezone-related bugs, especially when assigning shifts, dates should
- Graceful fallback for sites without coordinates - Graceful fallback for sites without coordinates
- **Impact**: Planning Mobile now fully functional with interactive map for patrol/inspection route planning - **Impact**: Planning Mobile now fully functional with interactive map for patrol/inspection route planning
### Planning Mobile - Interactive Features (October 23, 2025)
- **Issue**: Planning Mobile needed interactive map controls and patrol route sequencing workflow
- **Critical Bug Fix - Geocoding**:
- **Problem**: Toast showed "Indirizzo: undefined" when geocoding sites
- **Root Cause**: `apiRequest()` returns Response object, not parsed JSON
- **Fix**: Added `const result = await response.json()` after apiRequest in both handleGeocode() and handleGeocodeEdit()
- **Impact**: Geocoding now correctly displays full address from Nominatim (e.g., "Via Tiburtina, Roma, Lazio, Italia")
- **New Features**:
- **Zoom-to-Site**:
- MapController component with useMap() hook for programmatic map control
- Navigation button on each site card triggers flyTo() animation (zoom level 16)
- Toast feedback: "Mappa centrata - Visualizzazione di [nome sito]"
- **Guard Assignment**:
- "Assegna Guardia" button on site cards
- Validates guard selection from dropdown
- Toast feedback: "[Sito] assegnato a [Nome Cognome Guardia]"
- **Patrol Route Sequencing**:
- Click markers on map to build patrol route sequence
- Visual feedback: Green "Tappa N" badges on markers and site cards
- Dedicated UI section showing route in construction with numbered sequence
- Remove/clear/save route controls
- Auto-reset route when changing guard or location
- **Note**: Backend persistence (save to database) not yet implemented - marked as TODO for future development
- **Impact**: Operators can now interact with the map, assign guards to sites, and visually plan patrol routes by clicking sites in sequence
### Sites Form Fix - ServiceTypeId Integration (October 2025) ### Sites Form Fix - ServiceTypeId Integration (October 2025)
- **Issue**: Sites form used hardcoded `shiftType` enum values instead of dynamic service types from the database - **Issue**: Sites form used hardcoded `shiftType` enum values instead of dynamic service types from the database
- **Solution**: - **Solution**: