Files
PacketStation/frontend/src/packet/HoldCallout.tsx
T

28 lines
935 B
TypeScript
Raw Normal View History

import { Link } from "react-router";
import type { PacketRead } from "../api/types";
import { holdItemsText, holdText } from "../lib/qc";
/**
* The open ITP hold, witness or rejected points for this packet's department (the old itpHoldNote). A warning
* only: nothing is blocked by it. Users with the Q.C. screen get a link to the ITP.
*/
export function HoldCallout({ p, qcScreen }: { p: PacketRead; qcScreen: boolean }) {
const hold = p.itp_hold;
if (!hold || p.status === "filed" || !hold.count) return null;
const items = holdItemsText(hold);
return (
<div className="callout warn itphold" role="note">
<b>{holdText(hold)}</b>
{items ? ` ${items}.` : ""} Check with Q.C. before moving past these points.
{qcScreen ? (
<>
{" "}
<Link className="lnk" to={`/qc/units/${p.unit.id}/itp`}>
Open ITP
</Link>
</>
) : null}
</div>
);
}