From af453c93ed9654e21b927bd9a6c96f08b7fcff26 Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Mon, 28 Oct 2024 09:05:26 +0700 Subject: [PATCH] refactor: create submitAccepted --- src/pages/05_quotation/QuotationForm.vue | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/pages/05_quotation/QuotationForm.vue b/src/pages/05_quotation/QuotationForm.vue index c90a7a82..09cd491f 100644 --- a/src/pages/05_quotation/QuotationForm.vue +++ b/src/pages/05_quotation/QuotationForm.vue @@ -10,7 +10,12 @@ import { ProductTree, quotationProductTree } from './utils'; import { setLocale, dateFormat, calculateAge } from 'src/utils/datetime'; import { useEmployeeForm } from 'src/pages/03_customer-management/form'; import useProductServiceStore from 'stores/product-service'; -import { baseUrl, waitAll, calculateDaysUntilExpire } from 'src/stores/utils'; +import { + baseUrl, + waitAll, + calculateDaysUntilExpire, + dialog, +} from 'src/stores/utils'; import useCustomerStore from 'stores/customer'; import useOptionStore from 'stores/options'; import { useQuotationForm } from './form'; @@ -260,6 +265,23 @@ async function assignToProductServiceList() { } } +async function submitAccepted(id: string) { + dialog({ + color: 'info', + icon: 'mdi-account-check', + title: t('dialog.title.confirmQuotationAccept'), + actionText: t('general.confirm'), + persistent: true, + message: t('dialog.message.quotationAccept'), + action: async () => { + if (!quotationFormData.value.id) return; + + const rse = await quotationForm.accepted(quotationFormData.value.id); + }, + cancel: () => {}, + }); +} + async function convertDataToFormSubmit() { quotationFormData.value.productServiceList = JSON.parse( JSON.stringify(