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:
@@ -3,19 +3,39 @@
|
||||
import { packetsApi } from "../api/packets";
|
||||
import type { PacketRead, PrintKind, PrintRow, VcloseCheck, WorkOrder } from "../api/types";
|
||||
import { fmtTime } from "../lib/format";
|
||||
import { printPdf } from "../lib/printPdf";
|
||||
|
||||
/** The rule's signature meanings for FILE and ADMIN_REOPEN. */
|
||||
export const SIGN_FILE = "File in the data book";
|
||||
export const SIGN_REOPEN = "Reopen a filed packet";
|
||||
|
||||
/** Opens a PDF (or any server URL) in a new tab. Every PDF view and print in the packet goes through here. */
|
||||
/** Opens a PDF (or any server URL) in a new tab, to view it. Prints do not come here (change C4). */
|
||||
export function openTab(url: string): void {
|
||||
window.open(url, "_blank", "noopener");
|
||||
}
|
||||
|
||||
/** Opens a printed copy of one kind. The server stamps it and records the print. */
|
||||
/** The short error when a print cannot be made. */
|
||||
export const PRINT_FAILED = "The print could not be made. Try again.";
|
||||
|
||||
type PrintErrorListener = (text: string) => void;
|
||||
const printErrorListeners = new Set<PrintErrorListener>();
|
||||
|
||||
/** The packet page listens here to show a failed print. Returns the unsubscribe. */
|
||||
export function onPrintError(fn: PrintErrorListener): () => void {
|
||||
printErrorListeners.add(fn);
|
||||
return () => {
|
||||
printErrorListeners.delete(fn);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints a stamped copy of one kind straight to the browser's print dialog (change C4). The server stamps it and
|
||||
* records the print when the PDF is fetched. A failure goes to the onPrintError listeners.
|
||||
*/
|
||||
export function openPrint(id: number, kind: PrintKind, opts: { sheet?: number | undefined; asset?: string | undefined } = {}): void {
|
||||
openTab(packetsApi.printUrl(id, kind, opts));
|
||||
void printPdf(packetsApi.printUrl(id, kind, opts)).catch(() => {
|
||||
for (const fn of printErrorListeners) fn(PRINT_FAILED);
|
||||
});
|
||||
}
|
||||
|
||||
/** The asset id of a "/_blob/<id>" URL, for documents whose answer has no asset_id. */
|
||||
|
||||
Reference in New Issue
Block a user