- the great reformat

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-02-06 18:20:58 -05:00
parent 30c530bcc4
commit e83badb454
912 changed files with 108516 additions and 107493 deletions

View File

@@ -1,50 +1,52 @@
import { Card, Divider, Statistic } from "antd";
import {Card, Divider, Statistic} from "antd";
import dayjs from "../../utils/day";
import React from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
import {connect} from "react-redux";
import {createStructuredSelector} from "reselect";
import {selectBodyshop} from "../../redux/user/user.selectors";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export function ScoreboardDayStats({ bodyshop, date, entries }) {
const { dailyPaintTarget, dailyBodyTarget } = bodyshop.scoreboard_target;
export function ScoreboardDayStats({bodyshop, date, entries}) {
const {dailyPaintTarget, dailyBodyTarget} = bodyshop.scoreboard_target;
//let totalHrs = 0;
const paintHrs = entries.reduce((acc, value) => {
// totalHrs = +value.painthrs;
return acc + value.painthrs;
}, 0);
//let totalHrs = 0;
const paintHrs = entries.reduce((acc, value) => {
// totalHrs = +value.painthrs;
return acc + value.painthrs;
}, 0);
const bodyHrs = entries.reduce((acc, value) => {
//totalHrs = +value.bodyhrs;
return acc + value.bodyhrs;
}, 0);
const bodyHrs = entries.reduce((acc, value) => {
//totalHrs = +value.bodyhrs;
return acc + value.bodyhrs;
}, 0);
return (
<Card
title={dayjs(date).format("D - ddd")}
className="ant-card-grid-hoverable"
style={{ height: "100%" }}
>
<Statistic
valueStyle={{ color: dailyBodyTarget > bodyHrs ? "red" : "green" }}
label="B"
value={bodyHrs.toFixed(1)}
/>
<Statistic
valueStyle={{ color: dailyPaintTarget > paintHrs ? "red" : "green" }}
label="P"
value={paintHrs.toFixed(1)}
/>
<Divider style={{ margin: 0 }} />
return (
<Card
title={dayjs(date).format("D - ddd")}
className="ant-card-grid-hoverable"
style={{height: "100%"}}
>
<Statistic
valueStyle={{color: dailyBodyTarget > bodyHrs ? "red" : "green"}}
label="B"
value={bodyHrs.toFixed(1)}
/>
<Statistic
valueStyle={{color: dailyPaintTarget > paintHrs ? "red" : "green"}}
label="P"
value={paintHrs.toFixed(1)}
/>
<Divider style={{margin: 0}}/>
<Statistic value={(bodyHrs + paintHrs).toFixed(1)} />
</Card>
);
<Statistic value={(bodyHrs + paintHrs).toFixed(1)}/>
</Card>
);
}
export default connect(mapStateToProps, mapDispatchToProps)(ScoreboardDayStats);