diff --git a/src/pages/05_quotation/PaymentForm.vue b/src/pages/05_quotation/PaymentForm.vue index afcd0b0a..4dd6cdd3 100644 --- a/src/pages/05_quotation/PaymentForm.vue +++ b/src/pages/05_quotation/PaymentForm.vue @@ -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: () => {}, }); diff --git a/src/pages/05_quotation/QuotationForm.vue b/src/pages/05_quotation/QuotationForm.vue index cddde6ae..a706e246 100644 --- a/src/pages/05_quotation/QuotationForm.vue +++ b/src/pages/05_quotation/QuotationForm.vue @@ -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.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.Quotation);