mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-06 20:32:05 +00:00
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
|
|
import type { VendorDropdownItem } from "@/domain/work-orders/types/work-order";
|
||
|
|
import type { VendorFormValues } from "@/domain/vendors/schemas/vendor-schema";
|
||
|
|
|
||
|
|
type BuildTechnicianCreatePayloadInput = {
|
||
|
|
companyVendor: Pick<VendorDropdownItem, "companyName" | "email" | "address" | "tradeSpecialties">;
|
||
|
|
contactName: string;
|
||
|
|
phone?: string;
|
||
|
|
companyId?: string | number | null;
|
||
|
|
};
|
||
|
|
|
||
|
|
/** Builds a vendor create payload for a new technician under an existing company. */
|
||
|
|
export function buildTechnicianCreatePayload({
|
||
|
|
companyVendor,
|
||
|
|
contactName,
|
||
|
|
phone = "",
|
||
|
|
companyId = null,
|
||
|
|
}: BuildTechnicianCreatePayloadInput): VendorFormValues {
|
||
|
|
return {
|
||
|
|
companyName: companyVendor.companyName,
|
||
|
|
contactName: contactName.trim(),
|
||
|
|
email: companyVendor.email ?? "",
|
||
|
|
phone: phone.trim(),
|
||
|
|
companyPhone: "",
|
||
|
|
googleMapsUrl: "",
|
||
|
|
notes: "",
|
||
|
|
totalJobs: 0,
|
||
|
|
address: companyVendor.address ?? "",
|
||
|
|
city: "",
|
||
|
|
state: "",
|
||
|
|
zip: "",
|
||
|
|
tradeSpecialties: companyVendor.tradeSpecialties ?? "",
|
||
|
|
isActive: true,
|
||
|
|
companyId,
|
||
|
|
preferredContact: "Phone",
|
||
|
|
};
|
||
|
|
}
|