From 0fe9363aa9ace24631295d0488e3a3cf7d124c1d Mon Sep 17 00:00:00 2001 From: marco370 <48531002-marco370@users.noreply.replit.com> Date: Wed, 22 Oct 2025 08:45:18 +0000 Subject: [PATCH] Improve vehicle assignment logic in general planning Update the general planning page to correctly handle the "none" vehicle selection, ensuring that the vehicleId is only included in the assignment payload when a valid vehicle is chosen. 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/NB1Ej1f --- client/src/pages/general-planning.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/pages/general-planning.tsx b/client/src/pages/general-planning.tsx index 5e4b546..bf71929 100644 --- a/client/src/pages/general-planning.tsx +++ b/client/src/pages/general-planning.tsx @@ -98,7 +98,7 @@ export default function GeneralPlanning() { // Form state per assegnazione guardia const [selectedGuardId, setSelectedGuardId] = useState(""); - const [selectedVehicleId, setSelectedVehicleId] = useState(""); + const [selectedVehicleId, setSelectedVehicleId] = useState("none"); const [startTime, setStartTime] = useState("06:00"); const [durationHours, setDurationHours] = useState(8); const [consecutiveDays, setConsecutiveDays] = useState(1); @@ -244,7 +244,7 @@ export default function GeneralPlanning() { startTime, durationHours, consecutiveDays, - ...(selectedVehicleId && { vehicleId: selectedVehicleId }), + ...(selectedVehicleId && selectedVehicleId !== "none" && { vehicleId: selectedVehicleId }), }); }; @@ -738,7 +738,7 @@ export default function GeneralPlanning() { - Nessun veicolo + Nessun veicolo {availableVehicles && availableVehicles.length > 0 ? ( availableVehicles.map((vehicle) => (