From edbd1f1aae7531232fb11bb09a4d00e7f56943ad Mon Sep 17 00:00:00 2001 From: marco370 <48531002-marco370@users.noreply.replit.com> Date: Sat, 18 Oct 2025 07:27:10 +0000 Subject: [PATCH] Enhance planning features with multi-location support and weekly overview Add location-based resource isolation, a general weekly planning overview with missing guard calculation, and improve operational planning page integration. 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/uZXH8P1 --- .replit | 4 ---- replit.md | 11 ++++++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.replit b/.replit index 5283d85..c50bc15 100644 --- a/.replit +++ b/.replit @@ -31,10 +31,6 @@ externalPort = 3002 localPort = 43267 externalPort = 3003 -[[ports]] -localPort = 44791 -externalPort = 4200 - [env] PORT = "5000" diff --git a/replit.md b/replit.md index 83e2b03..c0c0e24 100644 --- a/replit.md +++ b/replit.md @@ -37,7 +37,7 @@ The database includes core tables for `users`, `guards`, `certifications`, `site - Sites now reference service types via `serviceTypeId` foreign key; `shiftType` is optional and can be derived from service type - **Multi-Location Support**: Added `location` field (enum: roccapiemonte, milano, roma) to `sites`, `guards`, and `vehicles` tables for complete multi-sede resource isolation -**Recent Features (October 17, 2025)**: +**Recent Features (October 17-18, 2025)**: - **Multi-Sede Operational Planning**: Redesigned operational planning workflow with location-first approach: 1. Select sede (Roccapiemonte/Milano/Roma) - first step with default value 2. Select date @@ -46,6 +46,15 @@ The database includes core tables for `users`, `guards`, `certifications`, `site 5. Assign resources and create shift - **Location-Based Filtering**: Backend endpoints use INNER JOIN with sites table to ensure complete resource isolation between locations - guards/vehicles in one sede remain available even when assigned to shifts in other sedi - **Site Management**: Added sede selection in site creation/editing forms with visual badges showing location in site listings +- **Planning Generale (October 18, 2025)**: New weekly planning overview feature showing all sites × 7 days in table format: + - Backend endpoint `/api/general-planning?weekStart=YYYY-MM-DD&location=sede` with complex joins and location filtering + - Automatic missing guards calculation: `ceil(totalShiftHours / maxHoursPerGuard) × minGuards - assignedGuards` (e.g., 24h shift, 2 guards min, 9h max = 6 total needed) + - Table cells display: assigned guards with hours, vehicles, missing guards badge (if any), shift count, total hours + - Interactive cells with click handler opening detail dialog + - Dialog shows: shift count, total hours, guard list with hours and badge numbers, vehicle list, missing guards warning with explanation + - "Modifica in Pianificazione Operativa" button in dialog navigates to operational planning page with pre-filled date/location parameters + - Week navigation (previous/next week) with location selector + - Operational planning page now supports query parameters (`?date=YYYY-MM-DD&location=sede`) for seamless integration **Recent Bug Fixes (October 17, 2025)**: - **Operational Planning Date Handling**: Fixed date sanitization in `/api/operational-planning/uncovered-sites` and `/api/operational-planning/availability` endpoints to handle malformed date inputs (e.g., "2025-10-17/2025-10-17"). Both endpoints now validate dates using `parseISO`/`isValid` and return 400 for invalid formats.