refactor: handle goTo DebitNote
This commit is contained in:
parent
b4a98ae283
commit
4aa27d834f
3 changed files with 43 additions and 8 deletions
|
|
@ -320,6 +320,16 @@ function goToQuotation(
|
||||||
|
|
||||||
window.open(url.toString(), '_blank');
|
window.open(url.toString(), '_blank');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function goToDebitNote(opt?: { tab?: string; id?: string }) {
|
||||||
|
const { tab, id } = opt || {};
|
||||||
|
const url = new URL(
|
||||||
|
`/debit-note/${id}?mode=info&tab=${tab}`,
|
||||||
|
window.location.origin,
|
||||||
|
);
|
||||||
|
|
||||||
|
window.open(url.toString(), '_blank');
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="column surface-0 fullscreen" v-if="data">
|
<div class="column surface-0 fullscreen" v-if="data">
|
||||||
|
|
@ -503,7 +513,11 @@ function goToQuotation(
|
||||||
icon="mdi-file-document-outline"
|
icon="mdi-file-document-outline"
|
||||||
:label="$t('requestList.quotationCode')"
|
:label="$t('requestList.quotationCode')"
|
||||||
:value="data.quotation.code || '-'"
|
:value="data.quotation.code || '-'"
|
||||||
@label-click="goToQuotation(data.quotation)"
|
@label-click="
|
||||||
|
data.quotation.isDebitNote
|
||||||
|
? goToDebitNote({ id: data.quotation.id, tab: 'title' })
|
||||||
|
: goToQuotation(data.quotation)
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
<DataDisplay
|
<DataDisplay
|
||||||
clickable
|
clickable
|
||||||
|
|
@ -517,11 +531,17 @@ function goToQuotation(
|
||||||
@label-click="
|
@label-click="
|
||||||
(_: string, i: number) => {
|
(_: string, i: number) => {
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
goToQuotation(data.quotation, {
|
|
||||||
tab: 'invoice',
|
data.quotation.isDebitNote
|
||||||
id: data.quotation.invoice?.[i]?.id,
|
? goToDebitNote({
|
||||||
amount: data.quotation.invoice?.[i]?.amount,
|
id: data.quotation.id,
|
||||||
});
|
tab: 'payment',
|
||||||
|
})
|
||||||
|
: goToQuotation(data.quotation, {
|
||||||
|
tab: 'invoice',
|
||||||
|
id: data.quotation.invoice?.[i]?.id,
|
||||||
|
amount: data.quotation.invoice?.[i]?.amount,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
|
|
@ -536,7 +556,14 @@ function goToQuotation(
|
||||||
(i: Invoice) => i.payment?.code || [],
|
(i: Invoice) => i.payment?.code || [],
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
@click="goToQuotation(data.quotation, { tab: 'receipt' })"
|
@click="
|
||||||
|
data.quotation.isDebitNote
|
||||||
|
? goToDebitNote({
|
||||||
|
id: data.quotation.id,
|
||||||
|
tab: 'receipt',
|
||||||
|
})
|
||||||
|
: goToQuotation(data.quotation, { tab: 'receipt' })
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
<div v-if="$q.screen.gt.sm" class="col"></div>
|
<div v-if="$q.screen.gt.sm" class="col"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -879,6 +879,14 @@ onMounted(async () => {
|
||||||
pageState.mode = route.query['mode'] as 'create' | 'edit' | 'info';
|
pageState.mode = route.query['mode'] as 'create' | 'edit' | 'info';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof route.query['tab'] === 'string') {
|
||||||
|
view.value =
|
||||||
|
{
|
||||||
|
payment: QuotationStatus.PaymentPending,
|
||||||
|
receipt: QuotationStatus.PaymentSuccess,
|
||||||
|
}[route.query['tab']] || null;
|
||||||
|
}
|
||||||
|
|
||||||
await useConfigStore().getConfig();
|
await useConfigStore().getConfig();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ export type RequestData = {
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
|
|
||||||
quotation: QuotationFull;
|
quotation: QuotationFull & { isDebitNote: boolean };
|
||||||
quotationId: string;
|
quotationId: string;
|
||||||
|
|
||||||
flow: Record<string, any>;
|
flow: Record<string, any>;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue