From 03531f0d5cebf37cf36e992850fab212fdcdc628 Mon Sep 17 00:00:00 2001 From: marco370 <48531002-marco370@users.noreply.replit.com> Date: Wed, 22 Oct 2025 08:29:59 +0000 Subject: [PATCH] Show assigned guards and vehicle information in the planning view Fixes an issue where the guard assignment form was not displaying correctly in the general planning view by ensuring all necessary data is fetched and rendered. Replit-Commit-Author: Agent Replit-Commit-Session-Id: e5565357-90e1-419f-b9a8-6ee8394636df Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/6d543d2c-20b9-4ea6-93fe-70fe9b1d9f80/e5565357-90e1-419f-b9a8-6ee8394636df/NB1Ej1f --- .replit | 4 + client/src/pages/general-planning.tsx | 203 ++++++++++++++------------ 2 files changed, 110 insertions(+), 97 deletions(-) diff --git a/.replit b/.replit index 90b1d94..416b001 100644 --- a/.replit +++ b/.replit @@ -15,6 +15,10 @@ run = ["npm", "run", "start"] localPort = 5000 externalPort = 80 +[[ports]] +localPort = 32811 +externalPort = 5173 + [[ports]] localPort = 33035 externalPort = 3001 diff --git a/client/src/pages/general-planning.tsx b/client/src/pages/general-planning.tsx index 72a9185..5e4b546 100644 --- a/client/src/pages/general-planning.tsx +++ b/client/src/pages/general-planning.tsx @@ -558,103 +558,8 @@ export default function GeneralPlanning() { {selectedCell && (
- {/* Info turni */} -
-
-

Turni Pianificati

-

{selectedCell.data.shiftsCount}

-
-
-

Ore Totali

-

{selectedCell.data.totalShiftHours}h

-
-
- - {/* Veicoli */} - {selectedCell.data.vehicles.length > 0 && ( -
-
- - Veicoli Assegnati ({selectedCell.data.vehicles.length}) -
-
- {selectedCell.data.vehicles.map((vehicle, idx) => ( -
-

{vehicle.licensePlate}

-

- {vehicle.brand} {vehicle.model} -

-
- ))} -
-
- )} - - {/* Guardie mancanti */} - {selectedCell.data.missingGuards > 0 && ( -
-
- - Attenzione: Guardie Mancanti -
-

- Servono ancora {selectedCell.data.missingGuards}{" "} - {selectedCell.data.missingGuards === 1 ? "guardia" : "guardie"} per coprire completamente il servizio - (calcolato su {selectedCell.data.totalShiftHours}h con max 9h per guardia e {selectedCell.data.minGuards} {selectedCell.data.minGuards === 1 ? "guardia minima" : "guardie minime"} contemporanee) -

-
- )} - - {/* No turni */} - {selectedCell.data.shiftsCount === 0 && ( -
- -

Nessun turno pianificato per questa data

-
- )} - - {/* Form assegnazione guardia */} -
- {/* Mostra guardie già assegnate per questo giorno */} - {selectedCell.data.guards.length > 0 && ( -
-

- Guardie già assegnate per questa data: -

-
- {selectedCell.data.guards.map((guard, idx) => ( -
-
-
- {guard.guardName} - #{guard.badgeNumber} -
-
- - {formatTime(guard.plannedStartTime)} - {formatTime(guard.plannedEndTime)} - ({guard.hours}h) -
-
- -
- ))} -
-
- )} - + {/* Form assegnazione guardia - SEMPRE IN ALTO E VISIBILE */} +
Assegna Nuova Guardia @@ -868,6 +773,110 @@ export default function GeneralPlanning() {
+ + {/* Guardie già assegnate - fuori dal form box per evitare di nascondere il form */} + {selectedCell.data.guards.length > 0 && ( +
+

+ + Guardie Già Assegnate ({selectedCell.data.guards.length}) +

+
+ {selectedCell.data.guards.map((guard, idx) => ( +
+
+
+ {guard.guardName} + #{guard.badgeNumber} +
+
+ + {formatTime(guard.plannedStartTime)} - {formatTime(guard.plannedEndTime)} + ({guard.hours}h) +
+
+ +
+ ))} +
+
+ )} + + {/* Separator */} +
+ + {/* Info turni esistenti */} +
+

Situazione Attuale

+ +
+
+

Turni Pianificati

+

{selectedCell.data.shiftsCount}

+
+
+

Ore Totali

+

{selectedCell.data.totalShiftHours}h

+
+
+ + {/* Guardie mancanti */} + {selectedCell.data.missingGuards > 0 && ( +
+
+ + Attenzione: Guardie Mancanti +
+

+ Servono ancora {selectedCell.data.missingGuards}{" "} + {selectedCell.data.missingGuards === 1 ? "guardia" : "guardie"} per coprire completamente il servizio + (calcolato su {selectedCell.data.totalShiftHours}h con max 9h per guardia e {selectedCell.data.minGuards} {selectedCell.data.minGuards === 1 ? "guardia minima" : "guardie minime"} contemporanee) +

+
+ )} + + {/* Veicoli */} + {selectedCell.data.vehicles.length > 0 && ( +
+
+ + Veicoli Assegnati ({selectedCell.data.vehicles.length}) +
+
+ {selectedCell.data.vehicles.map((vehicle, idx) => ( +
+

{vehicle.licensePlate}

+

+ {vehicle.brand} {vehicle.model} +

+
+ ))} +
+
+ )} + + {/* No turni */} + {selectedCell.data.shiftsCount === 0 && ( +
+ +

Nessun turno pianificato per questa data

+

Usa il modulo sopra per assegnare la prima guardia

+
+ )} +
)}