Resolve issue on payments page.
This commit is contained in:
@@ -20,7 +20,9 @@ export default function PaymentFormTotalPayments({ jobid }) {
|
|||||||
|
|
||||||
if (!data) return <></>;
|
if (!data) return <></>;
|
||||||
const totalPayments = data.jobs_by_pk.payments.reduce((acc, val) => {
|
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());
|
}, Dinero());
|
||||||
|
|
||||||
const balance =
|
const balance =
|
||||||
@@ -39,7 +41,7 @@ export default function PaymentFormTotalPayments({ jobid }) {
|
|||||||
<Statistic
|
<Statistic
|
||||||
title={t("payments.labels.balance")}
|
title={t("payments.labels.balance")}
|
||||||
valueStyle={{ color: balance.getAmount() !== 0 ? "red" : "green" }}
|
valueStyle={{ color: balance.getAmount() !== 0 ? "red" : "green" }}
|
||||||
value={balance.toFormat()}
|
value={(balance && balance.toFormat()) || ""}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{!balance && <div>{t("jobs.errors.nofinancial")}</div>}
|
{!balance && <div>{t("jobs.errors.nofinancial")}</div>}
|
||||||
|
|||||||
Reference in New Issue
Block a user