fix: splitPay can't set

This commit is contained in:
Thanaphon Frappet 2024-11-04 14:46:44 +07:00
parent c9202d8355
commit ef61354e67

View file

@ -952,11 +952,13 @@ async function assignFormDataProductService(id: string) {
formDataProductService.value.work = prevService.value.work;
workItems.value = res.work.map((item) => {
splitPay.value = Math.max(
...item.productOnWork.map(
(productOnWorkItem) => productOnWorkItem.installmentNo,
),
const maxInstallmentsNo = item.productOnWork.map(
(productOnWorkItem) => productOnWorkItem.installmentNo || 0,
);
if (splitPay.value < Math.max(...maxInstallmentsNo))
splitPay.value = Math.max(...maxInstallmentsNo);
return {
id: item.id,
name: item.name,