From 4e21ded2db86876e7f4c6a39f03165c6c1215309 Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Mon, 7 Oct 2024 13:53:43 +0700 Subject: [PATCH] fix: error types --- src/pages/05_quotation/form.ts | 7 +++++++ src/stores/quotations/types.ts | 1 + 2 files changed, 8 insertions(+) diff --git a/src/pages/05_quotation/form.ts b/src/pages/05_quotation/form.ts index 86d7bd65..11dfe0ff 100644 --- a/src/pages/05_quotation/form.ts +++ b/src/pages/05_quotation/form.ts @@ -69,6 +69,13 @@ export const useQuotationForm = defineStore('form-quotation', () => { if (!data) return; // NOTE: Error should be handled globally by axios instance resetFormData = Object.assign(data, { + productServiceList: data.productServiceList.map((v) => ({ + ...v, + worker: undefined, + workerIndex: v.worker.map((a) => + data.worker.findIndex((b) => b.employeeId === a.id), + ), + })), dueDate: new Date(data.dueDate), payBillDate: data.payBillDate ? new Date(data.payBillDate) : undefined, worker: data.worker.map((v) => diff --git a/src/stores/quotations/types.ts b/src/stores/quotations/types.ts index d5b948c8..9000bc4b 100644 --- a/src/stores/quotations/types.ts +++ b/src/stores/quotations/types.ts @@ -208,6 +208,7 @@ export type QuotationFull = { work: WorkRelation | null; serviceId: string | null; service: ServiceRelation | null; + worker: EmployeeRelation[]; }[]; id: string;