From 127d8c0ebca293628035da36f0395eb91e1ceb94 Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Mon, 2 Dec 2024 17:47:53 +0700 Subject: [PATCH] fix: worker missing --- src/pages/05_quotation/QuotationForm.vue | 16 +--------------- src/pages/05_quotation/form.ts | 13 ++++++------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/src/pages/05_quotation/QuotationForm.vue b/src/pages/05_quotation/QuotationForm.vue index 10532548..8f379c6a 100644 --- a/src/pages/05_quotation/QuotationForm.vue +++ b/src/pages/05_quotation/QuotationForm.vue @@ -674,21 +674,7 @@ function toggleDeleteProduct(index: number) { } async function assignWorkerToSelectedWorker() { - if (quotationFormData.value.customerBranchId) { - const retEmp = await customerStore.fetchBranchEmployee( - quotationFormData.value.customerBranchId, - { passport: true }, - ); - if (retEmp) { - workerList.value = retEmp.data.result; - quotationFormData.value.worker.forEach((value) => { - const tempValue: Employee | undefined = retEmp.data.result.find( - (v) => v.id === value.id, - ); - if (tempValue !== undefined) selectedWorker.value.push(tempValue); - }); - } - } + selectedWorker.value = quotationFormData.value.worker; } function convertToTable(nodes: Node[]) { diff --git a/src/pages/05_quotation/form.ts b/src/pages/05_quotation/form.ts index 913858d8..319c9444 100644 --- a/src/pages/05_quotation/form.ts +++ b/src/pages/05_quotation/form.ts @@ -6,9 +6,10 @@ import { ref } from 'vue'; // NOTE: Import types import { QuotationPayload, - EmployeeWorker, QuotationFull, + EmployeeWorker, } from 'src/stores/quotations/types'; +import { Employee } from 'src/stores/employee/types'; import { InvoicePayload } from 'src/stores/payment/types'; @@ -139,15 +140,13 @@ export const useQuotationForm = defineStore('form-quotation', () => { name: p.name, amount: p.amount, })), - worker: data.worker.map((v) => - Object.assign(v.employee, { - dateOfBirth: new Date(v.employee.dateOfBirth), - }), - ), + worker: data.worker.map((v) => v.employee), }); currentFormData.value = structuredClone(resetFormData); + console.log(currentFormData.value); + currentFormState.value.createdBy = (locale) => locale === 'eng' ? data.createdBy.firstNameEN + ' ' + data.createdBy.lastNameEN @@ -203,7 +202,7 @@ export const useQuotationForm = defineStore('form-quotation', () => { function injectNewEmployee( obj: { - data: EmployeeWorker & { + data: Employee & { attachment?: { name?: string; group?: string;