IO-1699 Add additional scoreboard total details.
This commit is contained in:
@@ -1,12 +1,14 @@
|
|||||||
import { CalendarOutlined } from "@ant-design/icons";
|
import { CalendarOutlined } from "@ant-design/icons";
|
||||||
import { Card, Col, Row, Statistic } from "antd";
|
import { Card, Col, Row, Statistic } from "antd";
|
||||||
import React from "react";
|
import React, { useMemo } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
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 ScoreboardJobsList from "../scoreboard-jobs-list/scoreboard-jobs-list.component";
|
import ScoreboardJobsList from "../scoreboard-jobs-list/scoreboard-jobs-list.component";
|
||||||
import * as Util from "./scoreboard-targets-table.util";
|
import * as Util from "./scoreboard-targets-table.util";
|
||||||
|
import _ from "lodash";
|
||||||
|
import moment from "moment";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -16,25 +18,78 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const rowGutter = [16, 16];
|
const rowGutter = [16, 16];
|
||||||
const statSpans = { xs: 24, sm: 6 };
|
const statSpans = { xs: 24, sm: 3 };
|
||||||
|
|
||||||
export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
|
export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const values = useMemo(() => {
|
||||||
|
const dateHash = _.groupBy(scoreBoardlist, "date");
|
||||||
|
console.log(
|
||||||
|
"🚀 ~ file: scoreboard-targets-table.component.jsx ~ line 31 ~ values ~ dateHash",
|
||||||
|
dateHash
|
||||||
|
);
|
||||||
|
|
||||||
|
let ret = {
|
||||||
|
todayBody: 0,
|
||||||
|
todayPaint: 0,
|
||||||
|
weeklyPaint: 0,
|
||||||
|
weeklyBody: 0,
|
||||||
|
toDateBody: 0,
|
||||||
|
toDatePaint: 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
const today = moment().tz(bodyshop.timezone);
|
||||||
|
if (dateHash[today.format("YYYY-MM-DD")]) {
|
||||||
|
dateHash[today.format("YYYY-MM-DD")].forEach((d) => {
|
||||||
|
ret.todayBody = ret.todayBody + d.bodyhrs;
|
||||||
|
ret.todayPaint = ret.todayPaint + d.painthrs;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let StartOfWeek = moment().tz(bodyshop.timezone).startOf("week");
|
||||||
|
while (StartOfWeek.isSameOrBefore(today)) {
|
||||||
|
if (dateHash[StartOfWeek.format("YYYY-MM-DD")]) {
|
||||||
|
dateHash[StartOfWeek.format("YYYY-MM-DD")].forEach((d) => {
|
||||||
|
ret.weeklyBody = ret.weeklyBody + d.bodyhrs;
|
||||||
|
ret.weeklyPaint = ret.weeklyPaint + d.painthrs;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
StartOfWeek = StartOfWeek.add(1, "day");
|
||||||
|
}
|
||||||
|
|
||||||
|
let startOfMonth = moment().tz(bodyshop.timezone).startOf("month");
|
||||||
|
while (startOfMonth.isSameOrBefore(today)) {
|
||||||
|
if (dateHash[startOfMonth.format("YYYY-MM-DD")]) {
|
||||||
|
dateHash[startOfMonth.format("YYYY-MM-DD")].forEach((d) => {
|
||||||
|
ret.toDateBody = ret.toDateBody + d.bodyhrs;
|
||||||
|
ret.toDatePaint = ret.toDatePaint + d.painthrs;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
startOfMonth = startOfMonth.add(1, "day");
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}, [scoreBoardlist, bodyshop.timezone]);
|
||||||
|
console.log(
|
||||||
|
"🚀 ~ file: scoreboard-targets-table.component.jsx ~ line 51 ~ values ~ values",
|
||||||
|
values
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
title={t("scoreboard.labels.targets")}
|
title={t("scoreboard.labels.targets")}
|
||||||
extra={<ScoreboardJobsList scoreBoardlist={scoreBoardlist} />}
|
extra={<ScoreboardJobsList scoreBoardlist={scoreBoardlist} />}
|
||||||
>
|
>
|
||||||
<Row gutter={rowGutter}>
|
<Row gutter={rowGutter}>
|
||||||
<Col xs={24} sm={{ offset: 0, span: 4 }} lg={{ offset: 5, span: 4 }}>
|
<Col xs={24} sm={{ offset: 0, span: 4 }} lg={{ span: 4 }}>
|
||||||
<Statistic
|
<Statistic
|
||||||
title={t("scoreboard.labels.workingdays")}
|
title={t("scoreboard.labels.workingdays")}
|
||||||
value={Util.CalculateWorkingDaysThisMonth()}
|
value={Util.CalculateWorkingDaysThisMonth()}
|
||||||
prefix={<CalendarOutlined />}
|
prefix={<CalendarOutlined />}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col xs={24} sm={{ offset: 0, span: 20 }} lg={{ offset: 0, span: 13 }}>
|
<Col xs={24} sm={{ offset: 0, span: 20 }} lg={{ offset: 0, span: 20 }}>
|
||||||
<Row>
|
<Row>
|
||||||
<Col {...statSpans}>
|
<Col {...statSpans}>
|
||||||
<Statistic
|
<Statistic
|
||||||
@@ -43,6 +98,12 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
|
|||||||
prefix="B"
|
prefix="B"
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
title={t("scoreboard.labels.dailyactual")}
|
||||||
|
value={values.todayBody}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
<Col {...statSpans}>
|
<Col {...statSpans}>
|
||||||
<Statistic
|
<Statistic
|
||||||
title={t("scoreboard.labels.weeklytarget")}
|
title={t("scoreboard.labels.weeklytarget")}
|
||||||
@@ -52,6 +113,12 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
title={t("scoreboard.labels.weeklyactual")}
|
||||||
|
value={values.weeklyBody}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
<Col {...statSpans}>
|
<Col {...statSpans}>
|
||||||
<Statistic
|
<Statistic
|
||||||
title={t("scoreboard.labels.monthlytarget")}
|
title={t("scoreboard.labels.monthlytarget")}
|
||||||
@@ -70,6 +137,12 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
title={t("scoreboard.labels.todateactual")}
|
||||||
|
value={values.toDateBody}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<Col {...statSpans}>
|
<Col {...statSpans}>
|
||||||
@@ -78,6 +151,9 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
|
|||||||
prefix="P"
|
prefix="P"
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic value={values.todayPaint} />
|
||||||
|
</Col>
|
||||||
<Col {...statSpans}>
|
<Col {...statSpans}>
|
||||||
<Statistic
|
<Statistic
|
||||||
value={Util.WeeklyTargetHrs(
|
value={Util.WeeklyTargetHrs(
|
||||||
@@ -86,6 +162,9 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic value={values.weeklyPaint} />
|
||||||
|
</Col>
|
||||||
<Col {...statSpans}>
|
<Col {...statSpans}>
|
||||||
<Statistic
|
<Statistic
|
||||||
value={Util.MonthlyTargetHrs(
|
value={Util.MonthlyTargetHrs(
|
||||||
@@ -102,6 +181,9 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic value={values.toDatePaint} />
|
||||||
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|||||||
@@ -1557,7 +1557,7 @@
|
|||||||
"partstotal": "Parts Total (ex. Taxes)",
|
"partstotal": "Parts Total (ex. Taxes)",
|
||||||
"plitooltips": {
|
"plitooltips": {
|
||||||
"billtotal": "The total amount of all bill lines that have been posted against this RO (not including credits, taxes, or labor adjustments).",
|
"billtotal": "The total amount of all bill lines that have been posted against this RO (not including credits, taxes, or labor adjustments).",
|
||||||
"creditmemos": "The total amount of all credit memos entered. This amount does not reflect any parts returns created.",
|
"creditmemos": "The total amount of all returns created. This amount does not reflect credit memos that have been posted.",
|
||||||
"creditsnotreceived": "The total amount of returns created for this job that do not have a corresponding credit memo posted. An amount greater than $0 indicates that vendors have not provided requested credit memos.",
|
"creditsnotreceived": "The total amount of returns created for this job that do not have a corresponding credit memo posted. An amount greater than $0 indicates that vendors have not provided requested credit memos.",
|
||||||
"discrep1": "If the discrepancy is not $0, you may have one of the following: <br/><br/>\n\n<ul>\n<li>Too many bills/bill lines that have been posted against this RO. Check to make sure every bill posted on this RO is correctly posted and assigned.</li>\n<li>You do not have the latest supplement imported, or, a supplement must be submitted and then imported.</li>\n<li>You have posted a bill line to labor.</li>\n</ul>\n<br/>\n<i>There may be additional issues not listed above that prevent this job from reconciling.</i>",
|
"discrep1": "If the discrepancy is not $0, you may have one of the following: <br/><br/>\n\n<ul>\n<li>Too many bills/bill lines that have been posted against this RO. Check to make sure every bill posted on this RO is correctly posted and assigned.</li>\n<li>You do not have the latest supplement imported, or, a supplement must be submitted and then imported.</li>\n<li>You have posted a bill line to labor.</li>\n</ul>\n<br/>\n<i>There may be additional issues not listed above that prevent this job from reconciling.</i>",
|
||||||
"discrep2": "If the discrepancy is not $0, you may have one of the following: <br/><br/>\n\n<ul>\n<li>Used an incorrect rate when deducting from labor.</li>\n<li>An outstanding imbalance higher in the reconciliation process.</li>\n</ul>\n<br/>\n<i>There may be additional issues not listed above that prevent this job from reconciling.</i>",
|
"discrep2": "If the discrepancy is not $0, you may have one of the following: <br/><br/>\n\n<ul>\n<li>Used an incorrect rate when deducting from labor.</li>\n<li>An outstanding imbalance higher in the reconciliation process.</li>\n</ul>\n<br/>\n<i>There may be additional issues not listed above that prevent this job from reconciling.</i>",
|
||||||
@@ -2320,9 +2320,12 @@
|
|||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
"asoftodaytarget": "As of Today",
|
"asoftodaytarget": "As of Today",
|
||||||
|
"dailyactual": "Actual (D)",
|
||||||
"dailytarget": "Daily",
|
"dailytarget": "Daily",
|
||||||
"monthlytarget": "Monthly",
|
"monthlytarget": "Monthly",
|
||||||
"targets": "Targets",
|
"targets": "Targets",
|
||||||
|
"todateactual": "Actual (MTD)",
|
||||||
|
"weeklyactual": "Actual (W)",
|
||||||
"weeklytarget": "Weekly",
|
"weeklytarget": "Weekly",
|
||||||
"workingdays": "Working Days / Month"
|
"workingdays": "Working Days / Month"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2320,9 +2320,12 @@
|
|||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
"asoftodaytarget": "",
|
"asoftodaytarget": "",
|
||||||
|
"dailyactual": "",
|
||||||
"dailytarget": "",
|
"dailytarget": "",
|
||||||
"monthlytarget": "",
|
"monthlytarget": "",
|
||||||
"targets": "",
|
"targets": "",
|
||||||
|
"todateactual": "",
|
||||||
|
"weeklyactual": "",
|
||||||
"weeklytarget": "",
|
"weeklytarget": "",
|
||||||
"workingdays": ""
|
"workingdays": ""
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2320,9 +2320,12 @@
|
|||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
"asoftodaytarget": "",
|
"asoftodaytarget": "",
|
||||||
|
"dailyactual": "",
|
||||||
"dailytarget": "",
|
"dailytarget": "",
|
||||||
"monthlytarget": "",
|
"monthlytarget": "",
|
||||||
"targets": "",
|
"targets": "",
|
||||||
|
"todateactual": "",
|
||||||
|
"weeklyactual": "",
|
||||||
"weeklytarget": "",
|
"weeklytarget": "",
|
||||||
"workingdays": ""
|
"workingdays": ""
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user