feat: preview route and trigger preview

This commit is contained in:
Methapon Metanipat 2024-10-18 10:56:10 +07:00
parent b74ff126e3
commit 8f880fd34d
5 changed files with 24 additions and 4 deletions

View file

@ -94,7 +94,10 @@ export const useQuotationForm = defineStore('form-quotation', () => {
currentFormData.value = structuredClone(resetFormData);
}
async function assignFormData(id: string, mode: 'info' | 'edit' = 'info') {
async function assignFormData(
id: string,
mode: 'info' | 'edit' | 'assign' = 'info',
) {
const data = await quotationStore.getQuotation(id);
if (!data) return; // NOTE: Error should be handled globally by axios instance
@ -127,6 +130,9 @@ export const useQuotationForm = defineStore('form-quotation', () => {
locale === 'eng'
? data.createdBy.firstNameEN + ' ' + data.createdBy.lastNameEN
: data.createdBy.firstName + ' ' + data.createdBy.lastName;
if (mode === 'assign') return;
currentFormState.value.mode = mode;
}