a6f1059ddf
Uniform stock management for healthcare linen rooms: the coordinator app, the phone counter and the staff app, for your own server. Built from a113353 on 2026-09-15. Licensed under the Functional Source License (FSL-1.1-ALv2).
30 lines
1.3 KiB
TypeScript
30 lines
1.3 KiB
TypeScript
"use client";
|
|
import Link from "next/link";
|
|
import { useState } from "react";
|
|
import { ErrorLine } from "@/components/ui";
|
|
import { Seg } from "@/components/portal";
|
|
import RequestList, { requestCounts, type RequestsPayload } from "@/components/requests/RequestList";
|
|
import type { StaffRec } from "@/lib/compute";
|
|
|
|
export type RequestsHook = { data: RequestsPayload | null; error: string; loading: boolean; reload: () => Promise<void> };
|
|
|
|
export default function RequestsTab({ st, req }: { st: StaffRec; req: RequestsHook }) {
|
|
const [which, setWhich] = useState<"open" | "all">("open");
|
|
const counts = req.data ? requestCounts(req.data, { staffId: st.id }) : null;
|
|
return (
|
|
<div>
|
|
<div className="tc-people-filters">
|
|
<Seg label="Which requests" opts={["open", "all"] as const} value={which} onChange={setWhich}
|
|
labels={{ open: "Open", all: "All" }} counts={counts ? { open: counts.open, all: counts.all } : undefined} />
|
|
<div className="tc-people-right">
|
|
<Link href={`/app/requests?staff=${encodeURIComponent(st.id)}`} className="btn btn-secondary">Open in the queue</Link>
|
|
</div>
|
|
</div>
|
|
<ErrorLine msg={req.error} />
|
|
<div className="tc-pp">
|
|
<RequestList staffId={st.id} filter={which} hidePerson title={null} data={req.data} reload={req.reload} />
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|