diff --git a/client/src/components/scoreboard-chart/chart-custom-tooltip.jsx b/client/src/components/scoreboard-chart/chart-custom-tooltip.jsx
new file mode 100644
index 000000000..5dba79e71
--- /dev/null
+++ b/client/src/components/scoreboard-chart/chart-custom-tooltip.jsx
@@ -0,0 +1,39 @@
+import Dinero from "dinero.js";
+
+const CustomTooltip = ({ active, payload, label }) => {
+ if (active && payload && payload.length) {
+ return (
+
+
{label}
+ {payload.map((data, index) => {
+ if (data.dataKey === "sales")
+ return (
+
{`${data.name} : ${Dinero({
+ amount: data.value,
+ }).toFormat()}`}
+ );
+
+ return (
+
{`${data.name} : ${data.value}`}
+ );
+ })}
+
+ );
+ }
+
+ return null;
+};
+
+export default CustomTooltip;
diff --git a/client/src/components/scoreboard-chart/scoreboard-chart.component.jsx b/client/src/components/scoreboard-chart/scoreboard-chart.component.jsx
index 7b1fd410e..800f04515 100644
--- a/client/src/components/scoreboard-chart/scoreboard-chart.component.jsx
+++ b/client/src/components/scoreboard-chart/scoreboard-chart.component.jsx
@@ -18,6 +18,7 @@ import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
import * as Utils from "../scoreboard-targets-table/scoreboard-targets-table.util";
import _ from "lodash";
+import CustomTooltip from "./chart-custom-tooltip";
const graphProps = {
strokeWidth: 3,
@@ -55,6 +56,14 @@ export function ScoreboardChart({ sbEntriesByDate, bodyshop }) {
};
}
+ const yesterdaySales = acc.length > 0 && acc[acc.length - 1].sales;
+ const sales =
+ sbEntriesByDate[val]?.reduce((acc, sb) => {
+ return acc + sb.job.job_totals.totals.subtotal.amount;
+ }, 0) || 0;
+
+ const accSales = yesterdaySales + sales;
+
const theValue = {
date: moment(val).format("D ddd"),
paintHrs: _.round(dayhrs.painthrs, 1),
@@ -73,6 +82,7 @@ export function ScoreboardChart({ sbEntriesByDate, bodyshop }) {
: dayhrs.painthrs + dayhrs.bodyhrs,
1
),
+ sales: accSales,
};
return [...acc, theValue];
@@ -87,8 +97,15 @@ export function ScoreboardChart({ sbEntriesByDate, bodyshop }) {
>
-
-
+
+
+ } />
+
+
diff --git a/client/src/graphql/scoreboard.queries.js b/client/src/graphql/scoreboard.queries.js
index 4dc7d522b..0d3efb31e 100644
--- a/client/src/graphql/scoreboard.queries.js
+++ b/client/src/graphql/scoreboard.queries.js
@@ -19,6 +19,7 @@ export const QUERY_SCOREBOARD = gql`
v_make_desc
v_model_desc
v_model_yr
+ job_totals
}
}
}