diff --git a/src/domain/work-orders/types/work-order-board.ts b/src/domain/work-orders/types/work-order-board.ts index b9ad2110..9f86b153 100644 --- a/src/domain/work-orders/types/work-order-board.ts +++ b/src/domain/work-orders/types/work-order-board.ts @@ -162,8 +162,6 @@ export interface WorkOrderBoardRowApi { serviceNotes?: string | null; extraServices?: string[] | null; docStatus?: number | null; - /** Work completed date from board/detail contract. */ - completedDate?: string | null; primaryDispatchId?: number | null; rowVersion?: string | null; dispatchRowVersion?: string | null; diff --git a/src/domain/work-orders/utils/wo-closability.ts b/src/domain/work-orders/utils/wo-closability.ts index 388d0e02..f8ed2972 100644 --- a/src/domain/work-orders/utils/wo-closability.ts +++ b/src/domain/work-orders/utils/wo-closability.ts @@ -10,7 +10,7 @@ export type WoClosabilityInput = { dispatcherName: string; /** Vendor/company assignment on the board row. */ company: string; - /** Technician name is informational and does not satisfy the vendor requirement. */ + /** Technician assigned to the work order. */ tech: string; /** Work completed date (API CompletedDate). Empty until set. */ completedDate: string; @@ -70,6 +70,9 @@ export function getClosabilityGaps(row: WoClosabilityInput): string[] { if (!hasDispatcher(row)) { gaps.push("Dispatcher"); } + if (!row.tech.trim()) { + gaps.push("Technician"); + } if (!row.company.trim()) { gaps.push("Company / vendor"); } diff --git a/src/test/domain/work-orders/utils/wo-closability.test.ts b/src/test/domain/work-orders/utils/wo-closability.test.ts index ea06ad4d..228f3dbe 100644 --- a/src/test/domain/work-orders/utils/wo-closability.test.ts +++ b/src/test/domain/work-orders/utils/wo-closability.test.ts @@ -60,8 +60,8 @@ describe("getClosabilityGaps", () => { expect(getClosabilityGaps(makeInput())).toEqual([]); }); - it("accepts a company without a technician", () => { - expect(getClosabilityGaps(makeInput({ tech: "" }))).toEqual([]); + it("blocks Completed when technician is missing", () => { + expect(getClosabilityGaps(makeInput({ tech: "" }))).toEqual(["Technician"]); }); it("does not let a technician satisfy a missing company requirement", () => { @@ -86,6 +86,7 @@ describe("getClosabilityGaps", () => { ), ).toEqual([ "Dispatcher", + "Technician", "Company / vendor", "Completed Date", "WO number",