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[],
|
||||
});
|
||||
|
||||
defineEmits<{
|
||||
const emit = defineEmits<{
|
||||
(e: 'view', id: string): void;
|
||||
(e: 'fetchStatus'): void;
|
||||
}>();
|
||||
|
||||
function monthDisplay(date: Date | string) {
|
||||
|
|
@ -167,7 +168,12 @@ async function selectStatus(
|
|||
date: new Date(payment.date),
|
||||
amount: payment.amount,
|
||||
};
|
||||
await quotationPayment.updateQuotationPayment(payment.id, payload);
|
||||
const res = await quotationPayment.updateQuotationPayment(
|
||||
payment.id,
|
||||
payload,
|
||||
);
|
||||
|
||||
if (res) emit('fetchStatus');
|
||||
},
|
||||
cancel: () => {},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -295,7 +295,10 @@ async function fetchStatus() {
|
|||
},
|
||||
{
|
||||
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: () =>
|
||||
view.value === View.Invoice || view.value === View.InvoicePre,
|
||||
handler: () => {
|
||||
|
|
@ -1479,13 +1482,9 @@ const view = ref<View>(View.Quotation);
|
|||
view !== View.Receipt
|
||||
"
|
||||
:data="quotationFormState.source"
|
||||
@view="
|
||||
(invoiceId) => {
|
||||
selectedInstallmentNo =
|
||||
quotationFormState.source?.paySplit
|
||||
.filter((v) => v.invoiceId === invoiceId)
|
||||
.map((v) => v.no) || [];
|
||||
view = View.Receipt;
|
||||
@fetch-status="
|
||||
() => {
|
||||
fetchQuotation();
|
||||
}
|
||||
"
|
||||
/>
|
||||
|
|
@ -1667,8 +1666,9 @@ const view = ref<View>(View.Quotation);
|
|||
<div
|
||||
v-if="
|
||||
view === View.Invoice &&
|
||||
quotationFormData.quotationStatus !== 'PaymentPending' &&
|
||||
quotationFormData.payCondition !== 'Full'
|
||||
((quotationFormData.quotationStatus !== 'PaymentPending' &&
|
||||
quotationFormData.payCondition !== 'Full') ||
|
||||
quotationFormData.quotationStatus === 'Accepted')
|
||||
"
|
||||
>
|
||||
<MainButton
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue