Show all guards in planning, marking those already busy

Update the general planning view to display all guards, regardless of their current availability or contractual compatibility. Guards who are already assigned to a shift are now visually indicated in red but remain selectable for alternative shift assignments. This change involves modifying the guard filtering logic and adding visual cues for busy guards in the selection interface.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: e0b5b11c-5b75-4389-8ea9-5f3cd9332f88
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/6d543d2c-20b9-4ea6-93fe-70fe9b1d9f80/e0b5b11c-5b75-4389-8ea9-5f3cd9332f88/HjUaTbs
This commit is contained in:
marco370 2025-10-29 09:56:33 +00:00
parent fc6f5a39f8
commit ee5d1aaa24
2 changed files with 20 additions and 11 deletions

View File

@ -19,6 +19,10 @@ externalPort = 80
localPort = 33035 localPort = 33035
externalPort = 3001 externalPort = 3001
[[ports]]
localPort = 35979
externalPort = 6000
[[ports]] [[ports]]
localPort = 40417 localPort = 40417
externalPort = 8000 externalPort = 8000

View File

@ -8,7 +8,7 @@ import { Button } from "@/components/ui/button";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { Input } from "@/components/ui/input"; import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label"; import { Label } from "@/components/ui/label";
import { ChevronLeft, ChevronRight, Calendar, MapPin, Users, AlertTriangle, Car, Edit, CheckCircle2, Plus, Trash2, Clock, Copy } from "lucide-react"; import { ChevronLeft, ChevronRight, Calendar, MapPin, Users, AlertTriangle, Car, Edit, CheckCircle2, Plus, Trash2, Clock, Copy, Circle } from "lucide-react";
import { Badge } from "@/components/ui/badge"; import { Badge } from "@/components/ui/badge";
import { Skeleton } from "@/components/ui/skeleton"; import { Skeleton } from "@/components/ui/skeleton";
import { import {
@ -717,19 +717,19 @@ export default function GeneralPlanning() {
})()} })()}
</div> </div>
{/* Select guardia disponibile */} {/* Select guardia (tutte, evidenziate in rosso se impegnate) */}
{(() => { {(() => {
// Filtra guardie: mostra solo con ore ordinarie se toggle è off // Mostra TUTTE le guardie, ma filtra solo per ore ordinarie/straordinario
const filteredGuards = availableGuards?.filter(g => const filteredGuards = availableGuards?.filter(g =>
g.isAvailable && (showOvertimeGuards || !g.requiresOvertime) showOvertimeGuards || !g.requiresOvertime
) || []; ) || [];
const hasOvertimeGuards = availableGuards?.some(g => g.requiresOvertime && g.isAvailable) || false; const hasOvertimeGuards = availableGuards?.some(g => g.requiresOvertime) || false;
return ( return (
<div className="space-y-2"> <div className="space-y-2">
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<Label htmlFor="guard-select">Guardia Disponibile</Label> <Label htmlFor="guard-select">Guardia</Label>
{!isLoadingGuards && hasOvertimeGuards && ( {!isLoadingGuards && hasOvertimeGuards && (
<Button <Button
variant="outline" variant="outline"
@ -758,15 +758,20 @@ export default function GeneralPlanning() {
{filteredGuards.length > 0 ? ( {filteredGuards.length > 0 ? (
filteredGuards.map((guard) => ( filteredGuards.map((guard) => (
<SelectItem key={guard.guardId} value={guard.guardId}> <SelectItem key={guard.guardId} value={guard.guardId}>
{guard.guardName} ({guard.badgeNumber}) - {guard.ordinaryHoursRemaining}h ord. <div className={`flex items-center gap-1.5 ${guard.isAvailable ? "" : "text-destructive font-medium"}`}>
{guard.requiresOvertime && ` + ${guard.overtimeHoursRemaining}h strao.`} {!guard.isAvailable && <Circle className="h-3 w-3 fill-current" />}
{guard.requiresOvertime && " 🔸"} <span>
{guard.guardName} ({guard.badgeNumber}) - {guard.ordinaryHoursRemaining}h ord.
{guard.requiresOvertime && ` + ${guard.overtimeHoursRemaining}h strao.`}
{guard.requiresOvertime && " 🔸"}
</span>
</div>
</SelectItem> </SelectItem>
)) ))
) : ( ) : (
<SelectItem value="no-guards" disabled> <SelectItem value="no-guards" disabled>
{showOvertimeGuards {showOvertimeGuards
? "Nessuna guardia disponibile" ? "Nessuna guardia"
: "Nessuna guardia con ore ordinarie (prova 'Mostra Straordinario')"} : "Nessuna guardia con ore ordinarie (prova 'Mostra Straordinario')"}
</SelectItem> </SelectItem>
)} )}
@ -774,7 +779,7 @@ export default function GeneralPlanning() {
</Select> </Select>
{filteredGuards.length === 0 && !showOvertimeGuards && hasOvertimeGuards && ( {filteredGuards.length === 0 && !showOvertimeGuards && hasOvertimeGuards && (
<p className="text-xs text-muted-foreground"> <p className="text-xs text-muted-foreground">
Alcune guardie disponibili richiedono straordinario. Clicca "Mostra Straordinario" per vederle. Alcune guardie richiedono straordinario. Clicca "Mostra Straordinario" per vederle.
</p> </p>
)} )}
{filteredGuards.length > 0 && selectedGuardId && ( {filteredGuards.length > 0 && selectedGuardId && (