diff --git a/src/pages/05_quotation/form.ts b/src/pages/05_quotation/form.ts index a971e4c0..763c0982 100644 --- a/src/pages/05_quotation/form.ts +++ b/src/pages/05_quotation/form.ts @@ -4,6 +4,10 @@ import { ref } from 'vue'; // NOTE at type import { QuotationPayload, EmployeeWorker } from 'src/stores/quotations/types'; +import { useQuotationStore } from 'stores/quotations'; + +const quotationStore = useQuotationStore(); + export const useQuotationForm = defineStore('form-quotation', () => { const defaultFormData: QuotationPayload = { service: [ @@ -52,6 +56,21 @@ export const useQuotationForm = defineStore('form-quotation', () => { return JSON.stringify(resetData) !== JSON.stringify(currData); } + function resetForm(clean = false) { + if (clean) { + currentFormData.value = structuredClone(defaultFormData); + resetFormData = structuredClone(defaultFormData); + + return; + } + + currentFormData.value = structuredClone(resetFormData); + } + + async function assignFormData(id: string) {} + + function submiQuotationt() {} + function injectNewEmployee(data: EmployeeWorker) { currentFormData.value.worker.push({ alienReferencNumber: data.alienReferencNumber, @@ -73,5 +92,10 @@ export const useQuotationForm = defineStore('form-quotation', () => { currentFormData, injectNewEmployee, + isFormDataDifferent, + resetForm, + assignFormData, + + submiQuotationt, }; });