From 19825019bf888bf8c0b2f692aeb0839e28939c78 Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Thu, 3 Oct 2024 09:51:58 +0700 Subject: [PATCH] feat: add quotation form state --- src/pages/05_quotation/form.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pages/05_quotation/form.ts b/src/pages/05_quotation/form.ts index fc400301..312fdd9f 100644 --- a/src/pages/05_quotation/form.ts +++ b/src/pages/05_quotation/form.ts @@ -31,6 +31,11 @@ export const useQuotationForm = defineStore('form-quotation', () => { let resetFormData = structuredClone(defaultFormData); const currentFormData = ref(structuredClone(resetFormData)); + const currentFormState = ref<{ + mode: null | 'info' | 'create' | 'edit'; + }>({ + mode: null, + }); function isFormDataDifferent() { const { ...resetData } = resetFormData; @@ -54,9 +59,13 @@ export const useQuotationForm = defineStore('form-quotation', () => { const data = await quotationStore.getQuotation(id); if (!data) return; // NOTE: Error should be handled globally by axios instance + + currentFormState.value.mode = 'edit'; } - function submiQuotationt() {} + function submiQuotationt() { + currentFormState.value.mode = 'info'; + } function injectNewEmployee(data: EmployeeWorker) { currentFormData.value.worker.push({