mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-03 08:03:22 +00:00
* fix(work-orders): address wizard create review findings
[recover] remove malicious eslint payload (was 166c63e4)
* fix(work-orders): remove legacy completedDate EditWorkorder path
[recover] remove malicious eslint payload (was f4e6132b)
* fix(work-orders): use local calendar day for completedDate
Restore todayIso() after parent merge reintroduced UTC slice, and keep the wizard-date-utils regression test.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(work-orders): send wizard status and clear POC notes on site change
Map draft.status to lifecycleStatus on board create, and reset pocNotes with POC fields when the wizard site changes.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(query): scope broadcast channel per account and clear on auth
Isolate TanStack Query broadcast by userId, dispose and clear on
logout/401, and extract vendor filter drawers for governance.
* feat(work-orders): board wizard create with service notes
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(work-orders): enforce single-service wizard create per SH-118
Use single service selection in the wizard and omit extraServices from board create.
* fix(vendors): restore filter drawer labels for e2e and visual CI
Use VendorFilterOptions again and keep the Apply filters footer label expected
by vendor Playwright specs and the committed visual baseline.
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
91 lines
2.8 KiB
TypeScript
91 lines
2.8 KiB
TypeScript
import { Box, Button, Tab, Tabs, TextField, Typography } from "@mui/material";
|
|
import type { RefObject } from "react";
|
|
|
|
interface SignatureCaptureFieldsProps {
|
|
isPending: boolean;
|
|
mode: "draw" | "type";
|
|
onModeChange: (mode: "draw" | "type") => void;
|
|
signerName: string;
|
|
onSignerNameChange: (value: string) => void;
|
|
typedName: string;
|
|
onTypedNameChange: (value: string) => void;
|
|
canvasRef: RefObject<HTMLCanvasElement | null>;
|
|
startDraw: (event: React.MouseEvent | React.TouchEvent) => void;
|
|
draw: (event: React.MouseEvent | React.TouchEvent) => void;
|
|
stopDraw: () => void;
|
|
clearCanvas: () => void;
|
|
}
|
|
|
|
export function SignatureCaptureFields({
|
|
isPending,
|
|
mode,
|
|
onModeChange,
|
|
signerName,
|
|
onSignerNameChange,
|
|
typedName,
|
|
onTypedNameChange,
|
|
canvasRef,
|
|
startDraw,
|
|
draw,
|
|
stopDraw,
|
|
clearCanvas,
|
|
}: SignatureCaptureFieldsProps) {
|
|
return (
|
|
<>
|
|
<TextField
|
|
label="Full Name"
|
|
value={signerName}
|
|
onChange={(event) => onSignerNameChange(event.target.value)}
|
|
placeholder="Enter signer's full name"
|
|
fullWidth
|
|
size="small"
|
|
disabled={isPending}
|
|
/>
|
|
|
|
<Tabs value={mode} onChange={(_event, value: "draw" | "type") => onModeChange(value)}>
|
|
<Tab label="Draw" value="draw" disabled={isPending} />
|
|
<Tab label="Type" value="type" disabled={isPending} />
|
|
</Tabs>
|
|
|
|
{mode === "draw" ? (
|
|
<Box className="relative">
|
|
<canvas
|
|
ref={canvasRef}
|
|
width={460}
|
|
height={180}
|
|
className="block w-full cursor-crosshair rounded border border-border bg-background"
|
|
onMouseDown={isPending ? undefined : startDraw}
|
|
onMouseMove={isPending ? undefined : draw}
|
|
onMouseUp={isPending ? undefined : stopDraw}
|
|
onMouseLeave={isPending ? undefined : stopDraw}
|
|
onTouchStart={isPending ? undefined : startDraw}
|
|
onTouchMove={isPending ? undefined : draw}
|
|
onTouchEnd={isPending ? undefined : stopDraw}
|
|
/>
|
|
<Button size="small" onClick={clearCanvas} className="mt-2" disabled={isPending}>
|
|
Clear
|
|
</Button>
|
|
</Box>
|
|
) : (
|
|
<Box className="flex flex-col gap-2">
|
|
<TextField
|
|
value={typedName}
|
|
onChange={(event) => onTypedNameChange(event.target.value)}
|
|
placeholder="Type your name"
|
|
fullWidth
|
|
size="small"
|
|
disabled={isPending}
|
|
/>
|
|
{Boolean(typedName) && (
|
|
<Typography
|
|
variant="h5"
|
|
className="rounded border border-dashed border-border px-4 py-6 text-center italic"
|
|
>
|
|
{typedName}
|
|
</Typography>
|
|
)}
|
|
</Box>
|
|
)}
|
|
</>
|
|
);
|
|
}
|