diff --git a/src/app/(protected)/workorders/_components/list/table/wo-table-cols.ts b/src/app/(protected)/workorders/_components/list/table/wo-table-cols.ts
index 96b1caa2..2a47bce3 100644
--- a/src/app/(protected)/workorders/_components/list/table/wo-table-cols.ts
+++ b/src/app/(protected)/workorders/_components/list/table/wo-table-cols.ts
@@ -11,9 +11,10 @@ export const WO_TABLE_COLS = [
{ key: "vendor", label: "VENDOR", w: 184 },
{ key: "appt", label: "APPT TIME", w: 128 },
{ key: "status", label: "STATUS", w: 148 },
+ // SH-359: Completed Date gates the Completion Document, so it sits between Status and Comp Doc.
+ { key: "completed", label: "COMPLETED DATE", w: 130 },
{ key: "doc", label: "COMP DOC", w: 84 },
{ key: "uplift", label: "UPLIFT", w: 108 },
- { key: "completed", label: "COMPLETED DATE", w: 130 },
{ key: "actions", label: "", w: 100 },
] as const;
diff --git a/src/app/(protected)/workorders/_components/list/table/wo-table-row-service-cells.tsx b/src/app/(protected)/workorders/_components/list/table/wo-table-row-service-cells.tsx
index 0326f870..ad995968 100644
--- a/src/app/(protected)/workorders/_components/list/table/wo-table-row-service-cells.tsx
+++ b/src/app/(protected)/workorders/_components/list/table/wo-table-row-service-cells.tsx
@@ -105,6 +105,17 @@ export function WoTableRowServiceCells({
onRequestComplete={() => handlers.onRequestComplete?.(row)}
/>
+
e.stopPropagation()}
+ >
+ onPatchRow({ completedDate: date })}
+ />
+ |
e.stopPropagation()}>
|
- e.stopPropagation()}
- >
- onPatchRow({ completedDate: date })}
- />
- |
>
);
}
diff --git a/src/test/app/(protected)/workorders/wo-table-column-order.test.tsx b/src/test/app/(protected)/workorders/wo-table-column-order.test.tsx
new file mode 100644
index 00000000..d26d4359
--- /dev/null
+++ b/src/test/app/(protected)/workorders/wo-table-column-order.test.tsx
@@ -0,0 +1,116 @@
+import { screen, within } from "@testing-library/react";
+import { describe, expect, it, vi } from "vitest";
+import { WO_TABLE_COLS } from "@/app/(protected)/workorders/_components/list/table/wo-table-cols";
+import { WoTableHead } from "@/app/(protected)/workorders/_components/list/table/wo-table-head";
+import { WoTableRowServiceCells } from "@/app/(protected)/workorders/_components/list/table/wo-table-row-service-cells";
+import type { WoTableRowHandlers } from "@/app/(protected)/workorders/_components/list/table/wo-table-row";
+import type { WorkOrderTableRow } from "@/domain/work-orders/types/work-order-table-row";
+import { renderWithProviders } from "@/test/test-utils";
+
+vi.mock("@/app/(protected)/workorders/_components/list/table/cells/pm-type-cell", () => ({
+ PMTypeCell: () => cell:service,
+}));
+vi.mock("@/app/(protected)/workorders/_components/list/table/cells/vendor-cell", () => ({
+ VendorCell: () => cell:vendor,
+}));
+vi.mock("@/app/(protected)/workorders/_components/list/table/cells/appt-time-cell", () => ({
+ ApptTimeCell: () => cell:appt,
+}));
+vi.mock("@/app/(protected)/workorders/_components/list/table/cells/status-cell", () => ({
+ StatusCell: () => cell:status,
+}));
+vi.mock("@/app/(protected)/workorders/_components/list/table/cells/date-cell", () => ({
+ DateCell: () => cell:completed,
+}));
+vi.mock("@/app/(protected)/workorders/_components/list/table/cells/comp-doc-cell", () => ({
+ CompDocCell: () => cell:doc,
+}));
+vi.mock("@/app/(protected)/workorders/_components/list/table/cells/uplift-cell", () => ({
+ UpliftCell: () => cell:uplift,
+}));
+
+/** SH-359: documented left-to-right data column order for the Work Orders board. */
+const DOCUMENTED_ORDER = [
+ "SITE",
+ "WO",
+ "TYPE OF WO",
+ "ASSIGNED TO",
+ "SCHEDULE ON",
+ "DUE DATE",
+ "SERVICE",
+ "VENDOR",
+ "APPT TIME",
+ "STATUS",
+ "COMPLETED DATE",
+ "COMP DOC",
+ "UPLIFT",
+];
+
+describe("Work Orders board column order (SH-359)", () => {
+ it("renders the documented header order with grip/flag before Site and actions after Uplift", () => {
+ renderWithProviders(
+ ,
+ { withAuth: false },
+ );
+
+ const headers = screen.getAllByRole("columnheader").map((th) => th.textContent?.trim() ?? "");
+ expect(headers.filter(Boolean)).toEqual(expect.arrayContaining(DOCUMENTED_ORDER));
+ expect(WO_TABLE_COLS.map((col) => col.key)).toEqual([
+ "grip",
+ "flag",
+ "site",
+ "wo",
+ "type",
+ "assigned",
+ "sched",
+ "due",
+ "pm",
+ "vendor",
+ "appt",
+ "status",
+ "completed",
+ "doc",
+ "uplift",
+ "actions",
+ ]);
+ expect(WO_TABLE_COLS.map((col) => col.label).filter(Boolean)).toEqual(DOCUMENTED_ORDER);
+ });
+
+ it("renders row cells under the matching headers: Status, Completed Date, Comp Doc, Uplift", () => {
+ const row = {
+ id: 7,
+ upliftSummary: { hasUplift: false, pendingCount: 0 },
+ } as WorkOrderTableRow;
+ renderWithProviders(
+ ,
+ { withAuth: false },
+ );
+
+ const cells = within(screen.getByTestId("row"))
+ .getAllByRole("cell")
+ .map((td) => td.textContent);
+ expect(cells).toEqual([
+ "cell:service",
+ "cell:vendor",
+ "cell:appt",
+ "cell:status",
+ "cell:completed",
+ "cell:doc",
+ "cell:uplift",
+ ]);
+ });
+});
diff --git a/src/test/domain/work-orders/mappers/completed-date-board-column.test.ts b/src/test/domain/work-orders/mappers/completed-date-board-column.test.ts
index 9b74c71a..2a7b1bb4 100644
--- a/src/test/domain/work-orders/mappers/completed-date-board-column.test.ts
+++ b/src/test/domain/work-orders/mappers/completed-date-board-column.test.ts
@@ -4,10 +4,11 @@ import { expandScalarBoardOps } from "@/domain/work-orders/mappers/expand-scalar
import { mapWorkOrderTableRow } from "@/domain/work-orders/mappers/work-order-table-row-mapper";
describe("COMPLETED DATE board column wiring", () => {
- it("includes COMPLETED DATE column after COMP DOC", () => {
+ it("includes COMPLETED DATE column between STATUS and COMP DOC (SH-359)", () => {
const keys = WO_TABLE_COLS.map((col) => col.key);
expect(keys).toContain("completed");
- expect(keys.indexOf("completed")).toBeGreaterThan(keys.indexOf("doc"));
+ expect(keys.indexOf("completed")).toBe(keys.indexOf("status") + 1);
+ expect(keys.indexOf("completed")).toBeLessThan(keys.indexOf("doc"));
});
it("expands completedDate patch to board field op", () => {