feat: change view by condition

This commit is contained in:
Methapon Metanipat 2024-10-28 11:48:49 +07:00
parent 9d24e8439f
commit 65b603ab42

View file

@ -712,7 +712,6 @@ function getStatus(
: 'waiting';
}
// TODO: check for payment type and decide wether to change view to pre or not
const statusQuotationForm = ref<
{ title: string; status: 'done' | 'doing' | 'waiting'; handler: () => void }[]
>([
@ -729,22 +728,41 @@ const statusQuotationForm = ref<
{
title: 'ใบแจ้งหนี้',
status: getStatus(quotationFormData.value.quotationStatus, 4, 1),
handler: () => (view.value = View.InvoicePre),
handler: () => {
quotationFormData.value.payCondition === 'Full' ||
quotationFormData.value.payCondition === 'BillFull'
? View.Invoice
: View.InvoicePre;
},
},
{
title: 'ชำระเงิน',
status: getStatus(quotationFormData.value.quotationStatus, 4, 1),
handler: () => (view.value = View.PaymentPre),
handler: () => {
view.value =
quotationFormData.value.payCondition === 'Full' ||
quotationFormData.value.payCondition === 'BillFull'
? View.Payment
: View.PaymentPre;
},
},
{
title: 'ใบเสร็จรับเงิน',
status: getStatus(quotationFormData.value.quotationStatus, 4, 1),
handler: () => (view.value = View.ReceiptPre),
handler: () => {
view.value =
quotationFormData.value.payCondition === 'Full' ||
quotationFormData.value.payCondition === 'BillFull'
? View.Receipt
: View.ReceiptPre;
},
},
{
title: 'เสร็จสิ้น',
status: getStatus(quotationFormData.value.quotationStatus, 5, 4),
handler: () => (view.value = View.Complete),
handler: () => {
view.value = View.Complete;
},
},
]);