mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-03 04:33:23 +00:00
* docs(work-orders): add pending BE contract checklist for design parity gaps * feat(work-orders): add technician affordance in wo vendor dialog * fix(work-orders): defer technician create until vendor dialog save * docs(work-orders): align pr description with jira and qa residuals * fix(vendors): harden draft technician optional field typing * refactor(workorders): extract vendor dialog body footer and save hook * fix(work-orders): coerce null company vendor for add-technician prop * fix(work-orders): preserve draft technician staging on save [SH-193] * fix(work-orders): select technicians by stable id [SH-193] Keep selectedKey as explicit dialog state (SiteDialog pattern) so same-name drafts do not collide with existing vendors, and cover the regression with interaction tests. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Alexandre Brandizzi <alex_brandizzi@hotmail.com>
21 lines
799 B
TypeScript
21 lines
799 B
TypeScript
import type { VendorDropdownItem } from "@/domain/work-orders/types/work-order";
|
|
import type { VendorFormValues } from "@/domain/vendors/schemas/vendor-schema";
|
|
|
|
export const DRAFT_VENDOR_ID_PREFIX = "draft:";
|
|
|
|
export function isDraftVendorId(id: string | number | null | undefined): boolean {
|
|
return String(id ?? "").startsWith(DRAFT_VENDOR_ID_PREFIX);
|
|
}
|
|
|
|
export function createDraftVendorDropdownItem(payload: VendorFormValues): VendorDropdownItem {
|
|
const email = (payload.email ?? "").trim();
|
|
return {
|
|
id: `${DRAFT_VENDOR_ID_PREFIX}${crypto.randomUUID()}`,
|
|
companyName: payload.companyName,
|
|
contactName: payload.contactName,
|
|
tradeSpecialties: payload.tradeSpecialties ?? "",
|
|
address: payload.address ?? "",
|
|
distanceMiles: null,
|
|
email: email || undefined,
|
|
};
|
|
}
|