IO-2239 Added totals on cards in job scoreboards
This commit is contained in:
@@ -4,6 +4,7 @@ import React from "react";
|
|||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
});
|
});
|
||||||
@@ -13,6 +14,7 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
|
|
||||||
export function ScoreboardDayStats({ bodyshop, date, entries }) {
|
export function ScoreboardDayStats({ bodyshop, date, entries }) {
|
||||||
const { dailyPaintTarget, dailyBodyTarget } = bodyshop.scoreboard_target;
|
const { dailyPaintTarget, dailyBodyTarget } = bodyshop.scoreboard_target;
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
//let totalHrs = 0;
|
//let totalHrs = 0;
|
||||||
const paintHrs = entries.reduce((acc, value) => {
|
const paintHrs = entries.reduce((acc, value) => {
|
||||||
@@ -41,6 +43,10 @@ export function ScoreboardDayStats({ bodyshop, date, entries }) {
|
|||||||
label="P"
|
label="P"
|
||||||
value={paintHrs.toFixed(1)}
|
value={paintHrs.toFixed(1)}
|
||||||
/>
|
/>
|
||||||
|
<Statistic
|
||||||
|
title={t("general.labels.total")}
|
||||||
|
value={(bodyHrs + paintHrs).toFixed(1)}
|
||||||
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -184,14 +184,56 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
|
|||||||
value={(values.todayPaint + values.todayBody).toFixed(1)}
|
value={(values.todayPaint + values.todayBody).toFixed(1)}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col {...statSpans}></Col>
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
title={t("general.labels.total")}
|
||||||
|
value={(
|
||||||
|
Util.WeeklyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
bodyshop
|
||||||
|
) +
|
||||||
|
Util.WeeklyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
).toFixed(1)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
<Col {...statSpans}>
|
<Col {...statSpans}>
|
||||||
<Statistic
|
<Statistic
|
||||||
value={(values.weeklyPaint + values.weeklyBody).toFixed(1)}
|
value={(values.weeklyPaint + values.weeklyBody).toFixed(1)}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col {...statSpans}></Col>
|
<Col {...statSpans}>
|
||||||
<Col {...statSpans}></Col>
|
<Statistic
|
||||||
|
title={t("general.labels.total")}
|
||||||
|
value={(
|
||||||
|
Util.MonthlyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
bodyshop
|
||||||
|
) +
|
||||||
|
Util.MonthlyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
).toFixed(1)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
title={t("general.labels.total")}
|
||||||
|
value={(
|
||||||
|
Util.AsOfTodayTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
bodyshop
|
||||||
|
) +
|
||||||
|
Util.AsOfTodayTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
).toFixed(1)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
<Col {...statSpans}>
|
<Col {...statSpans}>
|
||||||
<Statistic
|
<Statistic
|
||||||
value={(values.toDatePaint + values.toDateBody).toFixed(1)}
|
value={(values.toDatePaint + values.toDateBody).toFixed(1)}
|
||||||
|
|||||||
@@ -1064,6 +1064,7 @@
|
|||||||
"text": "Text",
|
"text": "Text",
|
||||||
"thursday": "Thursday",
|
"thursday": "Thursday",
|
||||||
"totals": "Totals",
|
"totals": "Totals",
|
||||||
|
"total": "Total",
|
||||||
"tuesday": "Tuesday",
|
"tuesday": "Tuesday",
|
||||||
"unknown": "Unknown",
|
"unknown": "Unknown",
|
||||||
"username": "Username",
|
"username": "Username",
|
||||||
|
|||||||
Reference in New Issue
Block a user