feat: add quotation form state

This commit is contained in:
Methapon Metanipat 2024-10-03 09:51:58 +07:00
parent 31fd37a503
commit 19825019bf

View file

@ -31,6 +31,11 @@ export const useQuotationForm = defineStore('form-quotation', () => {
let resetFormData = structuredClone(defaultFormData);
const currentFormData = ref<QuotationPayload>(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({