Resolve issue on payments page.

This commit is contained in:
Patrick Fic
2021-06-17 10:37:29 -07:00
parent 1489d5cd5a
commit ae67033417

View File

@@ -20,7 +20,9 @@ export default function PaymentFormTotalPayments({ jobid }) {
if (!data) return <></>;
const totalPayments = data.jobs_by_pk.payments.reduce((acc, val) => {
return acc.add(Dinero({ amount: (val.amount || 0) * 100 }));
return acc.add(
Dinero({ amount: Math.round(((val && val.amount) || 0) * 100) })
);
}, Dinero());
const balance =
@@ -39,7 +41,7 @@ export default function PaymentFormTotalPayments({ jobid }) {
<Statistic
title={t("payments.labels.balance")}
valueStyle={{ color: balance.getAmount() !== 0 ? "red" : "green" }}
value={balance.toFormat()}
value={(balance && balance.toFormat()) || ""}
/>
)}
{!balance && <div>{t("jobs.errors.nofinancial")}</div>}