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:
parent
fc6f5a39f8
commit
ee5d1aaa24
4
.replit
4
.replit
@ -19,6 +19,10 @@ externalPort = 80
|
||||
localPort = 33035
|
||||
externalPort = 3001
|
||||
|
||||
[[ports]]
|
||||
localPort = 35979
|
||||
externalPort = 6000
|
||||
|
||||
[[ports]]
|
||||
localPort = 40417
|
||||
externalPort = 8000
|
||||
|
||||
@ -8,7 +8,7 @@ import { Button } from "@/components/ui/button";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import { Input } from "@/components/ui/input";
|
||||
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 { Skeleton } from "@/components/ui/skeleton";
|
||||
import {
|
||||
@ -717,19 +717,19 @@ export default function GeneralPlanning() {
|
||||
})()}
|
||||
</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 =>
|
||||
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 (
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<Label htmlFor="guard-select">Guardia Disponibile</Label>
|
||||
<Label htmlFor="guard-select">Guardia</Label>
|
||||
{!isLoadingGuards && hasOvertimeGuards && (
|
||||
<Button
|
||||
variant="outline"
|
||||
@ -758,15 +758,20 @@ export default function GeneralPlanning() {
|
||||
{filteredGuards.length > 0 ? (
|
||||
filteredGuards.map((guard) => (
|
||||
<SelectItem key={guard.guardId} value={guard.guardId}>
|
||||
<div className={`flex items-center gap-1.5 ${guard.isAvailable ? "" : "text-destructive font-medium"}`}>
|
||||
{!guard.isAvailable && <Circle className="h-3 w-3 fill-current" />}
|
||||
<span>
|
||||
{guard.guardName} ({guard.badgeNumber}) - {guard.ordinaryHoursRemaining}h ord.
|
||||
{guard.requiresOvertime && ` + ${guard.overtimeHoursRemaining}h strao.`}
|
||||
{guard.requiresOvertime && " 🔸"}
|
||||
</span>
|
||||
</div>
|
||||
</SelectItem>
|
||||
))
|
||||
) : (
|
||||
<SelectItem value="no-guards" disabled>
|
||||
{showOvertimeGuards
|
||||
? "Nessuna guardia disponibile"
|
||||
? "Nessuna guardia"
|
||||
: "Nessuna guardia con ore ordinarie (prova 'Mostra Straordinario')"}
|
||||
</SelectItem>
|
||||
)}
|
||||
@ -774,7 +779,7 @@ export default function GeneralPlanning() {
|
||||
</Select>
|
||||
{filteredGuards.length === 0 && !showOvertimeGuards && hasOvertimeGuards && (
|
||||
<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>
|
||||
)}
|
||||
{filteredGuards.length > 0 && selectedGuardId && (
|
||||
|
||||
Loading…
Reference in New Issue
Block a user