refactor: create submitAccepted

This commit is contained in:
Thanaphon Frappet 2024-10-28 09:05:26 +07:00
parent 2bd7ceca32
commit af453c93ed

View file

@ -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(