+ {primaryRequired && (
+
+ POC phone
+
+ )}
onPocPhoneChange(event.target.value)}
placeholder="POC phone"
diff --git a/src/app/(protected)/workorders/_components/wizard/wizard-step-location-poc-fields.tsx b/src/app/(protected)/workorders/_components/wizard/wizard-step-location-poc-fields.tsx
index 61bf4927..c7916686 100644
--- a/src/app/(protected)/workorders/_components/wizard/wizard-step-location-poc-fields.tsx
+++ b/src/app/(protected)/workorders/_components/wizard/wizard-step-location-poc-fields.tsx
@@ -26,6 +26,7 @@ export function WizardStepLocationPocFields({
onAdditionalContactsChange={(contacts) => onUpdate("additionalContacts", contacts)}
helperText="Auto-filled from records — edit if outdated"
showPrimaryErrors={showErrors && pocIncomplete}
+ primaryRequired
/>
);
}
diff --git a/src/test/app/(protected)/workorders/wo-table-inline-row-required-fields.test.tsx b/src/test/app/(protected)/workorders/wo-table-inline-row-required-fields.test.tsx
new file mode 100644
index 00000000..f5817e84
--- /dev/null
+++ b/src/test/app/(protected)/workorders/wo-table-inline-row-required-fields.test.tsx
@@ -0,0 +1,121 @@
+import { fireEvent, screen } from "@testing-library/react";
+import { describe, expect, it, vi } from "vitest";
+import { PocContactFields } from "@/app/(protected)/workorders/_components/poc/poc-contact-fields";
+import { WoTableInlineRow } from "@/app/(protected)/workorders/_components/list/table/wo-table-inline-row";
+import {
+ EMPTY_TABLE_DRAFT,
+ type WorkOrderTableDraft,
+} from "@/domain/work-orders/types/work-order-table-row";
+import { renderWithProviders } from "@/test/test-utils";
+
+vi.mock("@/app/(protected)/workorders/_components/list/table/cells/type-cell", () => ({
+ TypeCell: () => null,
+}));
+vi.mock("@/app/(protected)/workorders/_components/list/table/cells/assigned-to-cell", () => ({
+ AssignedToCell: () => null,
+}));
+vi.mock("@/app/(protected)/workorders/_components/list/table/cells/date-cell", () => ({
+ DateCell: () => null,
+}));
+vi.mock("@/app/(protected)/workorders/_components/list/table/cells/due-date-cell", () => ({
+ DueDateCell: () => null,
+}));
+vi.mock("@/app/(protected)/workorders/_components/list/table/cells/pm-type-cell", () => ({
+ PMTypeCell: () => null,
+}));
+vi.mock("@/app/(protected)/workorders/_components/list/table/cells/vendor-cell", () => ({
+ VendorCell: () => null,
+}));
+vi.mock("@/app/(protected)/workorders/_components/list/table/cells/appt-time-cell", () => ({
+ ApptTimeCell: () => null,
+}));
+vi.mock("@/app/(protected)/workorders/_components/list/table/cells/status-cell", () => ({
+ StatusCell: () => null,
+}));
+
+function renderInlineRow(draft: WorkOrderTableDraft, onSave = vi.fn()) {
+ const ui = (d: WorkOrderTableDraft) => (
+
+ );
+ const view = renderWithProviders(ui(draft), { withAuth: false });
+ return { ...view, rerenderDraft: (d: WorkOrderTableDraft) => view.rerender(ui(d)) };
+}
+
+const COMPLETE_DRAFT: WorkOrderTableDraft = {
+ ...EMPTY_TABLE_DRAFT,
+ site: "BK5",
+ locationId: 9,
+ woNumber: "12345678901",
+ pocName: "Dana",
+ pocPhone: "555-0100",
+};
+
+describe("WoTableInlineRow required fields", () => {
+ it("marks Site and WO # as required without showing errors before a Save attempt", () => {
+ renderInlineRow(EMPTY_TABLE_DRAFT);
+
+ expect(screen.getByRole("button", { name: /^Site \*$/ })).toBeInTheDocument();
+ expect(screen.getByText("Insert WO #")).toHaveTextContent("Insert WO # *");
+ expect(screen.queryByText("Site is required")).not.toBeInTheDocument();
+ expect(screen.queryByText("Work order number is required")).not.toBeInTheDocument();
+ });
+
+ it("reveals field errors only after Save is attempted, then clears them once corrected", () => {
+ const onSave = vi.fn();
+ const { rerenderDraft } = renderInlineRow(EMPTY_TABLE_DRAFT, onSave);
+
+ fireEvent.click(screen.getByRole("button", { name: "Save work order" }));
+
+ expect(onSave).not.toHaveBeenCalled();
+ expect(screen.getByText("Site is required")).toBeInTheDocument();
+ expect(screen.getByText("Work order number is required")).toBeInTheDocument();
+
+ rerenderDraft(COMPLETE_DRAFT);
+
+ expect(screen.queryByText("Site is required")).not.toBeInTheDocument();
+ expect(screen.queryByText("Work order number is required")).not.toBeInTheDocument();
+
+ fireEvent.click(screen.getByRole("button", { name: "Save work order" }));
+ expect(onSave).toHaveBeenCalledTimes(1);
+ });
+});
+
+describe("PocContactFields required primary contact", () => {
+ it("labels POC name and phone with a required asterisk when the contact is required", () => {
+ renderWithProviders(
+
,
+ { withAuth: false },
+ );
+
+ expect(screen.getByLabelText(/POC name/)).toHaveAttribute("placeholder", "POC name");
+ expect(screen.getByLabelText(/POC phone/)).toHaveAttribute("placeholder", "POC phone");
+ expect(screen.getByText("POC name").closest("label")).toHaveTextContent("POC name*");
+ expect(screen.getByText("POC phone").closest("label")).toHaveTextContent("POC phone*");
+ expect(screen.queryByText("Contact name is required")).not.toBeInTheDocument();
+ });
+});