feat: change tab on enter with query string

This commit is contained in:
Methapon Metanipat 2024-11-07 14:57:45 +07:00
parent 921b6c6106
commit 036f8c2891

View file

@ -82,6 +82,7 @@ import QuotationFormMetadata from './QuotationFormMetadata.vue';
import BadgeComponent from 'src/components/BadgeComponent.vue';
import PaymentForm from './PaymentForm.vue';
import { api } from 'src/boot/axios';
import { useRoute } from 'vue-router';
type Node = {
[key: string]: any;
@ -95,6 +96,7 @@ type Node = {
type ProductGroupId = string;
const route = useRoute();
const useReceiptStore = useReceipt();
const configStore = useConfigStore();
const productServiceStore = useProductServiceStore();
@ -531,6 +533,16 @@ async function convertDataToFormSubmit() {
if (res === true) {
quotationFormState.value.mode = 'info';
localStorage.setItem(
'new-quotation',
JSON.stringify({
quotationId: quotationFormData.value.id,
customerBranchId: quotationFormData.value.customerBranchId,
branchId: quotationFormData.value.registeredBranchId,
agentPrice: agentPrice.value,
statusDialog: 'info',
}),
);
await fetchQuotation();
}
}
@ -861,6 +873,17 @@ onMounted(async () => {
}
pageState.isLoaded = true;
if (route.query['tab'] === 'invoice') {
view.value =
quotationFormData.value.payCondition === 'Full' ||
quotationFormData.value.payCondition === 'BillFull'
? View.Invoice
: View.InvoicePre;
}
if (route.query['tab'] === 'receipt') {
view.value = View.Receipt;
}
});
watch(
@ -1006,7 +1029,6 @@ enum View {
Invoice,
PaymentPre,
Payment,
ReceiptPre,
Receipt,
Complete,
}
@ -1028,6 +1050,7 @@ const view = ref<View>(View.Quotation);
<q-img src="/icons/favicon-512x512.png" width="3rem" />
</a>
<span class="column text-h6 text-bold q-ml-md">
<!-- TODO: change by current view -->
{{ $t('quotation.title') }}
<span class="text-caption text-regular app-text-muted">
{{
@ -1484,11 +1507,7 @@ const view = ref<View>(View.Quotation);
<template v-else>
<PaymentForm
v-if="
view !== View.InvoicePre &&
view !== View.ReceiptPre &&
view !== View.Receipt
"
v-if="view !== View.InvoicePre && view !== View.Receipt"
:data="quotationFormState.source"
@fetch-status="
() => {
@ -1555,6 +1574,7 @@ const view = ref<View>(View.Quotation);
@click="
() => {
if (props.row.invoiceId) {
// TODO: get invoice code
selectedInstallmentNo =
quotationFormState.source?.paySplit
.filter(