From 978c338ca460f649631b2e8e52e672328c64969f Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Tue, 8 Oct 2024 14:05:43 +0700 Subject: [PATCH] refactor: delete quotation --- src/pages/05_quotation/MainPage.vue | 9 ++++++++- src/pages/05_quotation/form.ts | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/pages/05_quotation/MainPage.vue b/src/pages/05_quotation/MainPage.vue index a0c64787..cb98a314 100644 --- a/src/pages/05_quotation/MainPage.vue +++ b/src/pages/05_quotation/MainPage.vue @@ -198,6 +198,13 @@ async function submitCustomer() { // customerFormState.value.dialogType = 'info'; } +async function triggerDialogDeleteQuottaion(id: string) { + quotationFormStore.dialogDelete(async () => { + await quotationStore.deleteQuottaion(id); + await fetchQuotationList(); + }); +} + function triggerCreateCustomerd(opts: { type: 'CORP' | 'PERS' }) { setDefaultCustomerd(); customerFormState.value.dialogType = 'create'; @@ -610,7 +617,7 @@ watch(() => pageState.currentTab, fetchQuotationList); @edit="quotationFormStore.assignFormData(v.id, 'edit')" @link="console.log('link')" @upload="console.log('upload')" - @delete="console.log('delete')" + @delete="triggerDialogDeleteQuottaion(v.id)" @change-status="console.log('change')" /> diff --git a/src/pages/05_quotation/form.ts b/src/pages/05_quotation/form.ts index 392cd79c..7b168a2e 100644 --- a/src/pages/05_quotation/form.ts +++ b/src/pages/05_quotation/form.ts @@ -181,7 +181,7 @@ export const useQuotationForm = defineStore('form-quotation', () => { persistent: true, message: t('dialog.message.confirmDelete'), action: async () => { - callback; + callback(); }, cancel: () => {}, });