"use client"; /* Record queries: somebody says their staff record is wrong. */ import Link from "next/link"; import { useSnap } from "@/lib/client"; import { Empty } from "@/components/ui"; import { MonoNum, Panel } from "@/components/portal"; import { formatInZone } from "@/lib/compute"; import type { DisputeRow } from "./RequestList"; export default function Queries({ rows, act }: { rows: DisputeRow[]; act: (op: "dispute.resolve", payload: Record) => Promise }) { const { s } = useSnap(); // A query carries the staff number, not the record id, so the link is found on the register. const idByNum = new Map(s.staff.map((st) => [st.num, st.id])); return ( {rows.length === 0 ? (
Nobody has queried their record.
) : rows.map((d) => { const sid = idByNum.get(d.staffNum); return (
{d.staffName} {d.staffNum} {d.ward ? ` · ${d.ward}` : ""} · {formatInZone(d.at, s.tz)}
{sid && Open record}

{d.body}

); })}
); }