refactor:set status dialog of quotation

This commit is contained in:
Thanaphon Frappet 2024-10-07 16:56:48 +07:00
parent 1d73d8084e
commit eb944bfafa

View file

@ -62,7 +62,10 @@ const flowStore = useFlowStore();
const userBranch = useMyBranch();
const ocrStore = useOcrStore();
const { currentFormData: quotationFormData } = storeToRefs(quotationFormStore);
const {
currentFormData: quotationFormData,
currentFormState: quotationFormState,
} = storeToRefs(quotationFormStore);
const { state: customerFormState, currentFormData: customerFormData } =
storeToRefs(customerFormStore);
const { currentMyBranch } = storeToRefs(userBranch);
@ -211,7 +214,7 @@ function triggerAddQuotationDialog() {
// TODO: form and state controll
}
function triggerQuotationDialog() {
function triggerQuotationDialog(statusDialog: 'info' | 'edit' | 'create') {
const url = new URL('/quotation/add-quotation', window.location.origin);
url.searchParams.set('branchId', branchId.value);
url.searchParams.set(
@ -220,6 +223,7 @@ function triggerQuotationDialog() {
);
url.searchParams.set('agentPrice', agentPrice.value.toString());
url.searchParams.set('special', special.value.toString());
url.searchParams.set('statusDialog', statusDialog);
window.open(url.toString(), '_blank');
}
@ -345,7 +349,7 @@ watch(() => pageState.currentTab, fetchQuotationList);
size="sm"
flat
dense
@click="triggerQuotationDialog"
@click="triggerQuotationDialog('create')"
:style="pageState.hideStat ? 'rotate: 90deg' : ''"
style="transition: 0.1s ease-in-out"
/>
@ -678,7 +682,12 @@ watch(() => pageState.currentTab, fetchQuotationList);
submit-icon="mdi-check"
height="auto"
width="60vw"
:submit="() => triggerQuotationDialog()"
:submit="
() => {
quotationFormState.mode = 'create';
triggerQuotationDialog('create');
}
"
:close="
() => {
branchId = '';
@ -755,14 +764,7 @@ watch(() => pageState.currentTab, fetchQuotationList);
]"
>
<template #top>
<AddButton
icon-only
@click="
() => {
triggerCreateEmployee();
}
"
/>
<AddButton icon-only @click="() => {}" />
</template>
<template #data="{ item }">
<PersonCard