mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-05 18:52:05 +00:00
17 lines
455 B
TypeScript
17 lines
455 B
TypeScript
|
|
import type { WorkOrderTableRow } from "@/domain/work-orders/types/work-order-table-row";
|
||
|
|
|
||
|
|
export function findDuplicateWoNumberRow(
|
||
|
|
woNumber: string,
|
||
|
|
rows: WorkOrderTableRow[],
|
||
|
|
excludeId?: string | number,
|
||
|
|
): WorkOrderTableRow | undefined {
|
||
|
|
const normalized = woNumber.trim();
|
||
|
|
if (normalized === "") {
|
||
|
|
return undefined;
|
||
|
|
}
|
||
|
|
|
||
|
|
return rows.find(
|
||
|
|
(row) => row.woNumber === normalized && String(row.id) !== String(excludeId ?? ""),
|
||
|
|
);
|
||
|
|
}
|