import { AlertTriangle, FileStack, FolderKanban, ShieldAlert, ShieldCheck, Shirt, } from "lucide-react" import { useSearchParams } from "react-router-dom" import { MetricCard } from "@/components/shared/MetricCard" import { Page, PageIntro, SectionCard } from "@/components/shared/Page" import { StatusBadge } from "@/components/shared/StatusBadge" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@/components/ui/table" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { COMPLIANCE_RISKS, STAFF } from "@/data/mockData" import { complianceFlagCount, staffWithComplianceIssues } from "@/data/selectors" import { useWorkforceRevision } from "@/data/store" const CATALOG = [ { name: "Right to Work", required: "All staff", holders: 44, of: 46, renewal: "On hire" }, { name: "Manual Handling", required: "Warehouse & Logistics", holders: 15, of: 16, renewal: "2 years" }, { name: "Forklift Licence", required: "Forklift Drivers", holders: 3, of: 4, renewal: "3 years" }, { name: "Food Hygiene L2", required: "Event & Hospitality", holders: 17, of: 18, renewal: "3 years" }, { name: "Personal Licence", required: "Bar Supervisors", holders: 2, of: 2, renewal: "10 years" }, { name: "COSHH Awareness", required: "Facilities & Cleaning", holders: 11, of: 12, renewal: "1 year" }, ] const DOCUMENTS = [ { staff: "Rosa Delgado", doc: "Right to Work", status: "Expired", updated: "Pending upload" }, { staff: "Aisha Patel", doc: "Policy Acknowledgement", status: "Warning", updated: "Awaiting signature" }, { staff: "Samuel Okoro", doc: "Manual Handling Certificate", status: "Expired", updated: "Expired 02 Sep 2025" }, { staff: "Tomas Ferreira", doc: "Forklift Licence", status: "Warning", updated: "Expires 17 Sep 2025" }, { staff: "Leila Haddad", doc: "Right to Work", status: "Verified", updated: "Verified 12 Jul 2025" }, { staff: "Marcus Vance", doc: "Supervisor Training", status: "Verified", updated: "Verified 03 Aug 2025" }, ] const ATTIRE = [ { staff: "Priya Raman", item: "Event uniform · size exchange", due: "05 Oct 2025", status: "Review" }, { staff: "Liam O'Connor", item: "Bar tunic · replacement", due: "05 Oct 2025", status: "Review" }, { staff: "Rosa Delgado", item: "Hi-vis & safety boots", due: "05 Oct 2025", status: "Review" }, { staff: "Owen Bradley", item: "Hi-vis · annual check", due: "18 Nov 2025", status: "Verified" }, ] export function CompliancePage() { useWorkforceRevision() const [params, setParams] = useSearchParams() const tab = params.get("tab") ?? "certificates" const high = COMPLIANCE_RISKS.filter((r) => r.severity === "High") const expiringSoon = STAFF.filter((s) => s.compliance === "Warning") return ( Export register} />
s + r.staffCount, 0))} sub="Block assignment until cleared" icon={AlertTriangle} badge="Urgent" badgeTone="bad" tone="bad" />
Risk Category Affected staff Severity Expires Action {COMPLIANCE_RISKS.map((r) => ( {r.risk} {r.category}
{r.staffCount}
{r.staffNames.join(", ")}
{r.expires.replace(" 2025", "")}
))}
setParams({ tab: v })}> Staff Certificates Employee Documents Attire Review Compliance Catalog Staff Role Standing Note {STAFF.map((s) => ( {s.name} {s.role} {s.complianceNote ?? "All certificates current"} ))}
Staff Document Status Last update {DOCUMENTS.map((d) => ( {d.staff} {d.doc} {d.updated} ))}
Staff Item Due Status {ATTIRE.map((a) => ( {a.staff} {a.item} {a.due} ))}
Requirement Applies to Coverage Renewal {CATALOG.map((c) => { const complete = c.holders === c.of return ( {c.name} {c.required} {c.holders}/{c.of} {c.renewal} ) })}
) }