From 42cc0175f827d3b35c6eeff7de5268fe57234ef6 Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Fri, 18 Oct 2024 14:57:57 +0700 Subject: [PATCH] feat: store it full response as source --- src/pages/05_quotation/MainPage.vue | 1 + src/pages/05_quotation/QuotationForm.vue | 1 + src/pages/05_quotation/form.ts | 3 +++ 3 files changed, 5 insertions(+) diff --git a/src/pages/05_quotation/MainPage.vue b/src/pages/05_quotation/MainPage.vue index 8a76b618..5bf3bee1 100644 --- a/src/pages/05_quotation/MainPage.vue +++ b/src/pages/05_quotation/MainPage.vue @@ -284,6 +284,7 @@ async function storeDataLocal(id: string) { JSON.stringify({ data: quotationFormData.value, meta: { + source: quotationFormState.value.source, createdBy: quotationFormState.value.createdBy('tha'), }, }), diff --git a/src/pages/05_quotation/QuotationForm.vue b/src/pages/05_quotation/QuotationForm.vue index 2674d1b5..e05e31e3 100644 --- a/src/pages/05_quotation/QuotationForm.vue +++ b/src/pages/05_quotation/QuotationForm.vue @@ -637,6 +637,7 @@ function storeDataLocal() { JSON.stringify({ data: quotationFormData.value, meta: { + source: quotationFormState.value.source, createdBy: quotationFormState.value.createdBy('tha'), }, }), diff --git a/src/pages/05_quotation/form.ts b/src/pages/05_quotation/form.ts index e9e9374c..479e30b1 100644 --- a/src/pages/05_quotation/form.ts +++ b/src/pages/05_quotation/form.ts @@ -70,6 +70,7 @@ export const useQuotationForm = defineStore('form-quotation', () => { ); const currentFormState = ref<{ mode: null | 'info' | 'create' | 'edit'; + source?: QuotationFull; createdBy: (locale: string) => string; }>({ mode: null, @@ -105,6 +106,8 @@ export const useQuotationForm = defineStore('form-quotation', () => { if (!data) return; // NOTE: Error should be handled globally by axios instance + currentFormState.value.source = data; + quotationFull.value = data; resetFormData = Object.assign(data, { productServiceList: data.productServiceList.map((v) => ({