2026-10-17 23:49:14 -06:00
|
|
|
import { useId } from "react";
|
|
|
|
|
import type { PacketRead } from "../api/types";
|
|
|
|
|
import { Sheet } from "../components/Sheet";
|
|
|
|
|
import { openPrint, printRows } from "./closeUtil";
|
|
|
|
|
|
Build Seth's changes C1 to C11 (Gitea issues 1, 8, 18, 23, 24, 25, 27, 31, 32, 33, 36)
2026-10-30 13:33:51 -06:00
|
|
|
/** The print menu: one row per print kind. A row closes the sheet and opens the print dialog on the stamped copy. */
|
2026-10-17 23:49:14 -06:00
|
|
|
export function PrintMenu({ p, sub, onClose }: { p: PacketRead; sub: string; onClose: () => void }) {
|
|
|
|
|
const base = useId();
|
|
|
|
|
const rows = printRows(p);
|
|
|
|
|
return (
|
|
|
|
|
<Sheet title="Print" sub={sub} onClose={onClose}>
|
|
|
|
|
<div className="ck">
|
|
|
|
|
{rows.map((r) => (
|
|
|
|
|
<button
|
|
|
|
|
key={r.kind}
|
|
|
|
|
type="button"
|
|
|
|
|
className="ck-item prow"
|
|
|
|
|
aria-label={r.label}
|
|
|
|
|
aria-describedby={`${base}-${r.kind}`}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
onClose();
|
Build Seth's changes C1 to C11 (Gitea issues 1, 8, 18, 23, 24, 25, 27, 31, 32, 33, 36)
2026-10-30 13:33:51 -06:00
|
|
|
openPrint(p.id, r.kind);
|
2026-10-17 23:49:14 -06:00
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<span className="t">
|
|
|
|
|
<b>{r.label}</b>
|
|
|
|
|
<span className="small muted" id={`${base}-${r.kind}`}>
|
|
|
|
|
{r.desc}
|
|
|
|
|
</span>
|
|
|
|
|
</span>
|
|
|
|
|
</button>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
<div className="small muted">
|
|
|
|
|
Every printed page is stamped with who printed it and when, plus "verify revision before use". Printing is recorded.
|
|
|
|
|
</div>
|
|
|
|
|
<div className="sheet-acts start">
|
|
|
|
|
<button className="btn ghost" type="button" onClick={onClose}>
|
|
|
|
|
Cancel
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</Sheet>
|
|
|
|
|
);
|
|
|
|
|
}
|