Build Seth's changes C1 to C11 (Gitea issues 1, 8, 18, 23, 24, 25, 27, 31, 32, 33, 36)
- C1 (issue 1): over target follows VISUAL ticket hours, not the timer. - C2 (issue 24): a Q.C. reject always needs a reason; accept needs an NCR number after a reject without one. - C3 (issue 25): an incomplete unit ITP blocks filing. - C4 (issue 27): prints open the print dialog on the page, no new tab. - C5 (issue 31): filing is blocked while VISUAL shows a work order open; the feed sets vclosed on VISUAL packets. - C6 (issue 8): the data book leaves out the history pages. - C7 (issue 18): the supervisor approves each received short; accept and filing wait for it. - C8 (issue 23): per-department checklists, edited by the department supervisor or Admin, frozen at START. - C9 (issue 32): Q.C. and Clerical may run the stamp check. - C10 (issue 33): the PM screen and reports are for PS-ProjectMgmt and Admin only. - C11 (issue 36): the Stall screen lists the packets assigned to the welder, at the supervisor's stall. Migration 0011. Docs: PLAN (also issue 9 confirmed, issue 4 asked), POLICY, SECURITY, SCHEMA, FEED, README, CHANGELOG. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
import { fireEvent, screen, within } from "@testing-library/react";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { DEPARTMENTS, makeMe, renderApp } from "../../test/auth";
|
||||
import { callsTo, mockFetch } from "../../test/fetchMock";
|
||||
|
||||
const VALID = {
|
||||
found: true,
|
||||
valid: true,
|
||||
reason: null,
|
||||
print: { id: 5, at: "2026-10-20T10:00:00Z", by_name: "Clara Clerk", kind: "databook", what: "Data book", pages: 12, packet_id: 42, packet_label: "L662001/1" },
|
||||
};
|
||||
|
||||
function base(roles: string[], screens: string[]) {
|
||||
return {
|
||||
"/api/auth/me": { body: makeMe({ roles, screens }) },
|
||||
"/api/departments": { body: DEPARTMENTS },
|
||||
"POST /api/stamp-verify": { body: VALID },
|
||||
};
|
||||
}
|
||||
|
||||
describe("Stamp check screen", () => {
|
||||
it.each([
|
||||
["Clerical", ["clerical"], ["clerical"]],
|
||||
["Clerical supervisor", ["clerical_supervisor"], ["clerical"]],
|
||||
["Q.C.", ["qc"], ["qc"]],
|
||||
["Q.C. supervisor", ["qc_supervisor"], ["qc"]],
|
||||
["Admin", ["admin"], ["clerical", "warehouse", "supervisor", "stall", "qc", "pm", "admin"]],
|
||||
])("is open to %s from the top bar and checks on /api/stamp-verify", async (_name, roles, screens) => {
|
||||
const fetch = mockFetch(base(roles, screens));
|
||||
renderApp("/account");
|
||||
const link = await screen.findByRole("link", { name: "Stamp check" });
|
||||
expect(link).toHaveAttribute("href", "/stamp-check");
|
||||
fireEvent.click(link);
|
||||
expect(await screen.findByRole("heading", { name: "Stamp check" })).toBeInTheDocument();
|
||||
fireEvent.change(screen.getByLabelText("Stamp line or code"), { target: { value: "PS 0123456789abcdef" } });
|
||||
fireEvent.click(screen.getByRole("button", { name: "Check stamp" }));
|
||||
const result = await screen.findByRole("status", { name: "Stamp result" });
|
||||
expect(within(result).getByText("L662001/1")).toBeInTheDocument();
|
||||
expect(callsTo(fetch, "POST", "/api/stamp-verify")).toEqual([{ text: "PS 0123456789abcdef" }]);
|
||||
expect(callsTo(fetch, "POST", "/api/admin/stamp-verify")).toHaveLength(0);
|
||||
});
|
||||
|
||||
it.each([
|
||||
["Warehouse", ["warehouse"], ["warehouse"]],
|
||||
["a shop supervisor", ["shop:03:supervisor"], ["supervisor", "stall"]],
|
||||
["Project Management", ["pm"], ["pm"]],
|
||||
])("is not for %s", async (_name, roles, screens) => {
|
||||
mockFetch(base(roles, screens));
|
||||
renderApp("/stamp-check");
|
||||
expect(await screen.findByTestId("not-for-role")).toHaveTextContent("The Stamp check is not for your role. It is for Admin, Q.C. and Clerical.");
|
||||
expect(screen.queryByRole("link", { name: "Stamp check" })).not.toBeInTheDocument();
|
||||
expect(screen.queryByLabelText("Stamp line or code")).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
import { canStampCheck } from "../../lib/toolAccess";
|
||||
import { StampVerifyTab } from "../admin/StampVerifyTab";
|
||||
import { RequireRole } from "../tools/RequireRole";
|
||||
|
||||
/** /stamp-check: Admin, Q.C. and Clerical check a printed or saved copy against the print log (change C9). */
|
||||
export function StampCheckPage() {
|
||||
return (
|
||||
<RequireRole allow={canStampCheck} what="The Stamp check" who="It is for Admin, Q.C. and Clerical.">
|
||||
<header className="phead">
|
||||
<div style={{ minWidth: 0 }}>
|
||||
<div className="eyebrow">Controlled copies</div>
|
||||
<h1>Stamp check</h1>
|
||||
</div>
|
||||
</header>
|
||||
<StampVerifyTab />
|
||||
</RequireRole>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user