refactor: fetch status
This commit is contained in:
parent
72fa68462e
commit
4fa0159c02
2 changed files with 18 additions and 12 deletions
|
|
@ -66,8 +66,9 @@ const state = reactive({
|
||||||
payExpansion: [] as boolean[],
|
payExpansion: [] as boolean[],
|
||||||
});
|
});
|
||||||
|
|
||||||
defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'view', id: string): void;
|
(e: 'view', id: string): void;
|
||||||
|
(e: 'fetchStatus'): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
function monthDisplay(date: Date | string) {
|
function monthDisplay(date: Date | string) {
|
||||||
|
|
@ -167,7 +168,12 @@ async function selectStatus(
|
||||||
date: new Date(payment.date),
|
date: new Date(payment.date),
|
||||||
amount: payment.amount,
|
amount: payment.amount,
|
||||||
};
|
};
|
||||||
await quotationPayment.updateQuotationPayment(payment.id, payload);
|
const res = await quotationPayment.updateQuotationPayment(
|
||||||
|
payment.id,
|
||||||
|
payload,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (res) emit('fetchStatus');
|
||||||
},
|
},
|
||||||
cancel: () => {},
|
cancel: () => {},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -295,7 +295,10 @@ async function fetchStatus() {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'ใบแจ้งหนี้',
|
title: 'ใบแจ้งหนี้',
|
||||||
status: getStatus(quotationFormData.value.quotationStatus, 4, 1),
|
status:
|
||||||
|
quotationFormData.value.payCondition === 'Full'
|
||||||
|
? getStatus(quotationFormData.value.quotationStatus, 3, 1)
|
||||||
|
: getStatus(quotationFormData.value.quotationStatus, 4, 1),
|
||||||
active: () =>
|
active: () =>
|
||||||
view.value === View.Invoice || view.value === View.InvoicePre,
|
view.value === View.Invoice || view.value === View.InvoicePre,
|
||||||
handler: () => {
|
handler: () => {
|
||||||
|
|
@ -1479,13 +1482,9 @@ const view = ref<View>(View.Quotation);
|
||||||
view !== View.Receipt
|
view !== View.Receipt
|
||||||
"
|
"
|
||||||
:data="quotationFormState.source"
|
:data="quotationFormState.source"
|
||||||
@view="
|
@fetch-status="
|
||||||
(invoiceId) => {
|
() => {
|
||||||
selectedInstallmentNo =
|
fetchQuotation();
|
||||||
quotationFormState.source?.paySplit
|
|
||||||
.filter((v) => v.invoiceId === invoiceId)
|
|
||||||
.map((v) => v.no) || [];
|
|
||||||
view = View.Receipt;
|
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
|
|
@ -1667,8 +1666,9 @@ const view = ref<View>(View.Quotation);
|
||||||
<div
|
<div
|
||||||
v-if="
|
v-if="
|
||||||
view === View.Invoice &&
|
view === View.Invoice &&
|
||||||
quotationFormData.quotationStatus !== 'PaymentPending' &&
|
((quotationFormData.quotationStatus !== 'PaymentPending' &&
|
||||||
quotationFormData.payCondition !== 'Full'
|
quotationFormData.payCondition !== 'Full') ||
|
||||||
|
quotationFormData.quotationStatus === 'Accepted')
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<MainButton
|
<MainButton
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue