diff --git a/src/pages/05_quotation/form.ts b/src/pages/05_quotation/form.ts index 4b7145ef..89432e1d 100644 --- a/src/pages/05_quotation/form.ts +++ b/src/pages/05_quotation/form.ts @@ -130,7 +130,6 @@ export const useQuotationForm = defineStore('form-quotation', () => { currentFormData.value = structuredClone(resetFormData); - console.log('ทำงาน'); currentFormState.value.mode = mode; } @@ -148,13 +147,20 @@ export const useQuotationForm = defineStore('form-quotation', () => { file: v.file, }); }); + return true; } } if (currentFormState.value.mode === 'edit' && currentFormData.value.id) { - await quotationStore.editQuotation({ + if (currentFormData.value.status === 'CREATED') { + delete currentFormData.value?.['status']; + } + + const res = await quotationStore.editQuotation({ ...currentFormData.value, id: currentFormData.value.id, }); + + if (res) return true; } currentFormState.value.mode = 'info';