mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-06 21:56:27 +00:00
Add assignment validation and attention alerts
Validate project years and Work Order code availability, confirm before discarding unsaved changes, and surface critical or behind-schedule assignments in dashboard warnings and stats. Also update assignment form and dashboard labels.
This commit is contained in:
@@ -11,7 +11,7 @@ import {
|
||||
Tooltip, TooltipContent, TooltipTrigger,
|
||||
} from '@/components/ui/tooltip';
|
||||
import { LazyImage } from '@/components/ui/lazy-image';
|
||||
import { Calendar, MoreVertical, ArrowUpRight, Clock } from 'lucide-react';
|
||||
import { Calendar, MoreVertical, ArrowUpRight, Clock, AlertTriangle } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
import { cn } from '@/lib/utils';
|
||||
import ConvertedAssignmentBadge from './ConvertedAssignmentBadge';
|
||||
@@ -289,9 +289,54 @@ export default function AssignmentGrid({
|
||||
<div className="space-y-2 pt-2 border-t border-border/60">
|
||||
{/* Actual Progress (Real Work) matching detail page styling */}
|
||||
<div className="flex items-center justify-between text-xs font-mono font-medium">
|
||||
<span className="text-[10px] tracking-wider font-semibold text-his bg-his/10 px-1.5 py-0.5 rounded font-sans shrink-0">
|
||||
Actual
|
||||
</span>
|
||||
<div className="flex items-center gap-1.5 shrink-0">
|
||||
<span className="text-[10px] tracking-wider font-semibold text-his bg-his/10 px-1.5 py-0.5 rounded font-sans shrink-0">
|
||||
Actual
|
||||
</span>
|
||||
{item.hasWarning && (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<span
|
||||
tabIndex={0}
|
||||
role="button"
|
||||
aria-label={item.warningTitle}
|
||||
className={cn(
|
||||
"cursor-help inline-flex items-center justify-center transition-all focus:outline-none",
|
||||
item.isCriticalOrOffTrack
|
||||
? "text-rose-500 hover:text-rose-600 dark:text-rose-400"
|
||||
: "text-amber-500 hover:text-amber-600 dark:text-amber-400"
|
||||
)}
|
||||
>
|
||||
<AlertTriangle className="w-3.5 h-3.5 animate-pulse" />
|
||||
</span>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top" className="max-w-xs p-3 space-y-1.5 text-xs shadow-lg border border-border/80">
|
||||
<div className={cn(
|
||||
"flex items-center gap-1.5 font-semibold",
|
||||
item.isCriticalOrOffTrack
|
||||
? "text-rose-600 dark:text-rose-400"
|
||||
: "text-amber-600 dark:text-amber-400"
|
||||
)}>
|
||||
<AlertTriangle className="w-4 h-4 shrink-0" />
|
||||
<span>{item.warningTitle}</span>
|
||||
</div>
|
||||
<p className="text-[11px] text-muted-foreground leading-relaxed">
|
||||
{item.warningReason}
|
||||
</p>
|
||||
{item.warningDetails.length > 0 && (
|
||||
<div className="pt-1.5 border-t border-border/50 space-y-0.5 text-[10px] text-foreground font-mono">
|
||||
{item.warningDetails.map((detail, idx) => (
|
||||
<div key={idx} className="flex items-center gap-1.5">
|
||||
<span className={item.isCriticalOrOffTrack ? "text-rose-500 font-bold" : "text-amber-500 font-bold"}>•</span>
|
||||
<span>{detail}</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
)}
|
||||
</div>
|
||||
<div className="h-1.5 rounded-full bg-zinc-200 dark:bg-zinc-700/60 flex-1 mx-2.5 overflow-hidden">
|
||||
<div
|
||||
className="h-full rounded-full bg-his transition-all duration-700 ease-out"
|
||||
@@ -322,13 +367,6 @@ export default function AssignmentGrid({
|
||||
{/* Footer: Delivery Health Badge, Schedule, Latest Activity & Team Avatars */}
|
||||
<div className="pt-3 border-t border-border/60 flex items-center justify-between gap-2 text-xs">
|
||||
<div className="space-y-1 min-w-0 flex-1">
|
||||
<span className={cn(
|
||||
"inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-[11px] font-medium",
|
||||
item.healthBadgeClass
|
||||
)}>
|
||||
<span className={cn("h-1.5 w-1.5 rounded-full", item.healthDotClass)} />
|
||||
<span>{item.healthStatus}</span>
|
||||
</span>
|
||||
<p className="text-[11px] text-muted-foreground truncate">{item.remainingText}</p>
|
||||
<p
|
||||
className="text-[10px] text-muted-foreground/75 truncate flex items-center gap-1 font-sans"
|
||||
|
||||
Reference in New Issue
Block a user