IO-2501 Add Jobs Complete Not Invoiced Section to Stats
This commit is contained in:
@@ -29,7 +29,7 @@ export default connect(
|
||||
|
||||
export function ScoreboardTimeTicketsStats({ bodyshop }) {
|
||||
const { t } = useTranslation();
|
||||
const startDate = moment().startOf("month")
|
||||
const startDate = moment().startOf("month");
|
||||
const endDate = moment().endOf("month");
|
||||
|
||||
const fixedPeriods = useMemo(() => {
|
||||
@@ -84,6 +84,8 @@ export function ScoreboardTimeTicketsStats({ bodyshop }) {
|
||||
end: endDate.format("YYYY-MM-DD"),
|
||||
fixedStart: fixedPeriods.start.format("YYYY-MM-DD"),
|
||||
fixedEnd: fixedPeriods.end.format("YYYY-MM-DD"),
|
||||
jobStart: startDate,
|
||||
jobEnd: endDate,
|
||||
},
|
||||
fetchPolicy: "network-only",
|
||||
nextFetchPolicy: "network-only",
|
||||
@@ -340,11 +342,21 @@ export function ScoreboardTimeTicketsStats({ bodyshop }) {
|
||||
larData.push({ ...r, ...lar });
|
||||
});
|
||||
|
||||
const jobData = {};
|
||||
data.jobs.forEach((job) => {
|
||||
job.tthrs = job.joblines.reduce((acc, val) => acc + val.mod_lb_hrs, 0);
|
||||
});
|
||||
jobData.tthrs = data.jobs
|
||||
.reduce((acc, val) => acc + val.tthrs, 0)
|
||||
.toFixed(1);
|
||||
jobData.count = data.jobs.length.toFixed(0);
|
||||
|
||||
return {
|
||||
fixed: ret,
|
||||
combinedData: combinedData,
|
||||
labData: labData,
|
||||
larData: larData,
|
||||
jobData: jobData,
|
||||
};
|
||||
}, [fixedPeriods, data, bodyshop]);
|
||||
|
||||
@@ -356,7 +368,10 @@ export function ScoreboardTimeTicketsStats({ bodyshop }) {
|
||||
<ScoreboardTimeticketsTargetsTable />
|
||||
</Col>
|
||||
<Col span={24}>
|
||||
<ScoreboardTicketsStats data={calculatedData.fixed} />
|
||||
<ScoreboardTicketsStats
|
||||
data={calculatedData.fixed}
|
||||
jobData={calculatedData.jobData}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={24}>
|
||||
<ScoreboardTimeTicketsChart
|
||||
|
||||
@@ -41,7 +41,7 @@ function useLocalStorage(key, initialValue) {
|
||||
return [storedValue, setStoredValue];
|
||||
}
|
||||
|
||||
export function ScoreboardTicketsStats({ data, bodyshop }) {
|
||||
export function ScoreboardTicketsStats({ data, jobData, bodyshop }) {
|
||||
const { t } = useTranslation();
|
||||
const [isLarge, setIsLarge] = useLocalStorage("isLargeStatistic", false);
|
||||
|
||||
@@ -408,7 +408,7 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
|
||||
{/* Monthly Stats */}
|
||||
<Row gutter={[16, 16]}>
|
||||
{/* This Month */}
|
||||
<Col span={8} align="center">
|
||||
<Col span={7} align="center">
|
||||
<Card size="small" title={t("scoreboard.labels.thismonth")}>
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col span={24}>
|
||||
@@ -482,7 +482,7 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
|
||||
</Card>
|
||||
</Col>
|
||||
{/* Last Month */}
|
||||
<Col span={8} align="center">
|
||||
<Col span={7} align="center">
|
||||
<Card size="small" title={t("scoreboard.labels.lastmonth")}>
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col span={24}>
|
||||
@@ -556,7 +556,7 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
|
||||
</Card>
|
||||
</Col>
|
||||
{/* Efficiency Over Period */}
|
||||
<Col span={8} align="center">
|
||||
<Col span={7} align="center">
|
||||
<Card
|
||||
size="small"
|
||||
title={t("scoreboard.labels.efficiencyoverperiod")}
|
||||
@@ -604,6 +604,40 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
|
||||
</Row>
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span={3} align="center">
|
||||
<Card
|
||||
size="small"
|
||||
title={t("scoreboard.labels.jobscompletednotinvoiced")}
|
||||
>
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col span={24}>
|
||||
<Statistic
|
||||
value={jobData.count}
|
||||
valueStyle={{
|
||||
fontSize: statisticSize,
|
||||
fontWeight: statisticWeight,
|
||||
}}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col span={24}>
|
||||
<Statistic
|
||||
title={
|
||||
<Typography.Text strong>
|
||||
{t("scoreboard.labels.totalhrs")}
|
||||
</Typography.Text>
|
||||
}
|
||||
value={jobData.tthrs}
|
||||
valueStyle={{
|
||||
fontSize: statisticSize,
|
||||
fontWeight: statisticWeight,
|
||||
}}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
</Space>
|
||||
{/* Disclaimer */}
|
||||
|
||||
Reference in New Issue
Block a user