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');
|
||||
}
|
||||
|
||||
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>
|
||||
<template>
|
||||
<div class="column surface-0 fullscreen" v-if="data">
|
||||
|
|
@ -503,7 +513,11 @@ function goToQuotation(
|
|||
icon="mdi-file-document-outline"
|
||||
:label="$t('requestList.quotationCode')"
|
||||
: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
|
||||
clickable
|
||||
|
|
@ -517,11 +531,17 @@ function goToQuotation(
|
|||
@label-click="
|
||||
(_: string, i: number) => {
|
||||
if (!data) return;
|
||||
goToQuotation(data.quotation, {
|
||||
tab: 'invoice',
|
||||
id: data.quotation.invoice?.[i]?.id,
|
||||
amount: data.quotation.invoice?.[i]?.amount,
|
||||
});
|
||||
|
||||
data.quotation.isDebitNote
|
||||
? goToDebitNote({
|
||||
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 || [],
|
||||
)
|
||||
"
|
||||
@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>
|
||||
|
|
|
|||
|
|
@ -879,6 +879,14 @@ onMounted(async () => {
|
|||
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();
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export type RequestData = {
|
|||
createdAt: string;
|
||||
updatedAt: string;
|
||||
|
||||
quotation: QuotationFull;
|
||||
quotation: QuotationFull & { isDebitNote: boolean };
|
||||
quotationId: string;
|
||||
|
||||
flow: Record<string, any>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue