IO-306 Further development of dashboard.
This commit is contained in:
@@ -2,6 +2,7 @@ import { Card, Statistic } from "antd";
|
||||
import Dinero from "dinero.js";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import DashboardRefreshRequired from "../refresh-required.component";
|
||||
|
||||
export default function DashboardTotalProductionDollars({
|
||||
data,
|
||||
@@ -9,18 +10,17 @@ export default function DashboardTotalProductionDollars({
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
if (!data) return null;
|
||||
|
||||
const dollars = data.production_jobs.reduce(
|
||||
(acc, val) => acc.add(Dinero(val.job_totals.totals.subtotal)),
|
||||
Dinero()
|
||||
);
|
||||
if (!data.production_jobs) return <DashboardRefreshRequired {...cardProps} />;
|
||||
const dollars =
|
||||
data.production_jobs &&
|
||||
data.production_jobs.reduce(
|
||||
(acc, val) => acc.add(Dinero(val.job_totals.totals.subtotal)),
|
||||
Dinero()
|
||||
);
|
||||
|
||||
return (
|
||||
<Card {...cardProps}>
|
||||
<Statistic
|
||||
title={t("dashboard.labels.dollarsinproduction")}
|
||||
value={dollars.toFormat()}
|
||||
/>
|
||||
<Card title={t("dashboard.labels.dollarsinproduction")} {...cardProps}>
|
||||
<Statistic value={dollars.toFormat()} />
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user