"use client"; /* 1B — My kit. * * The linen room's record of what this person holds, shown to the person it is about, and a way * to say it is wrong. "This isn't right" is deliberately blunt and deliberately last: the record * is usually correct, and a dispute button placed first would invite one before anybody had read * the list. */ import { useState } from "react"; import { useRouter } from "next/navigation"; import { MBody, MError, MRule, MTop } from "@/components/m"; import { INK, N600, N700, SecondaryBar, Segments } from "@/components/staffui"; import StaffNav from "@/components/staffnav"; import { useStaff } from "@/lib/staffclient"; import { fmtDate } from "@/lib/compute"; type Held = { itemId: string; item: string; size: string; si: number; qty: number; last: string }; type Slip = { id: string; date: string; lines: { item: string; size: string }[]; signed: boolean }; type Data = { held: Held[]; total: number; handedBackThisYear: number; fyFrom: string; sizes: { top: string; pants: string }; slips?: Slip[] }; export default function KitScreen({ data }: { data: Data }) { const { mutate, busy } = useStaff(); const router = useRouter(); const [tab, setTab] = useState<"holding" | "sizes" | "slips">("holding"); const [disputing, setDisputing] = useState(false); const [body, setBody] = useState(""); const [err, setErr] = useState(""); const [sent, setSent] = useState(false); return ( <> {data.total} item{data.total === 1 ? "" : "s"}} /> {tab === "holding" ? ( <>
Uniform Issued
{data.held.length === 0 ? (
Nothing on your record. Anything the linen room issues you shows up here.
) : ( data.held.map((h) => (
{h.item} — {h.size}
{h.qty} held · last issued {fmtDate(h.last)}
{h.qty}
)) )}
Handed back this year

{data.handedBackThisYear === 0 ? `Nothing handed back since ${fmtDate(data.fyFrom)}.` : `${data.handedBackThisYear} garment${data.handedBackThisYear === 1 ? "" : "s"} handed back since ${fmtDate(data.fyFrom)}.`}

) : tab === "slips" ? ( (data.slips || []).length === 0 ? (
No signed slips
) : ( (data.slips || []).map((sl) => (
{fmtDate(sl.date)}
    {sl.lines.map((l, i) => (
  • {l.item} — {l.size}
  • ))}
{sl.signed && ( // eslint-disable-next-line @next/next/no-img-element Your signature )}
)) ) ) : ( <> {[["Top", data.sizes.top], ["Trouser", data.sizes.pants]].map(([label, value]) => (
{label} {value || "not recorded"}
))}

These are the sizes the linen room has on file, and what a new request starts from. If one is wrong, tell them — this page can’t be edited from your side.

)} {sent && (
Sent. The linen room will look at your record and come back to you.
)} {disputing && !sent && (