Merged in release/2023-04-14 (pull request #705)

Release/2023 04 14
This commit is contained in:
Patrick Fic
2023-04-14 18:39:19 +00:00
7 changed files with 55 additions and 22 deletions

View File

@@ -14,6 +14,14 @@ export default function ResizableComponent(props) {
height={0} height={0}
onResize={onResize} onResize={onResize}
draggableOpts={{ enableUserSelectHack: false }} draggableOpts={{ enableUserSelectHack: false }}
handle={
<span
className="react-resizable-handle"
onClick={(e) => {
e.stopPropagation();
}}
/>
}
> >
<th {...restProps} /> <th {...restProps} />
</Resizable> </Resizable>

View File

@@ -1,10 +1,9 @@
import { Card, Statistic } from "antd"; import { Card, Divider, Statistic } from "antd";
import moment from "moment"; import moment from "moment";
import React from "react"; 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,
}); });
@@ -14,7 +13,6 @@ 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) => {
@@ -43,10 +41,9 @@ export function ScoreboardDayStats({ bodyshop, date, entries }) {
label="P" label="P"
value={paintHrs.toFixed(1)} value={paintHrs.toFixed(1)}
/> />
<Statistic <Divider style={{ margin: 0 }} />
title={t("general.labels.total")}
value={(bodyHrs + paintHrs).toFixed(1)} <Statistic value={(bodyHrs + paintHrs).toFixed(1)} />
/>
</Card> </Card>
); );
} }

View File

@@ -1,5 +1,5 @@
import { CalendarOutlined } from "@ant-design/icons"; import { CalendarOutlined } from "@ant-design/icons";
import { Card, Col, Row, Statistic } from "antd"; import { Card, Col, Divider, Row, Statistic } from "antd";
import _ from "lodash"; import _ from "lodash";
import moment from "moment"; import moment from "moment";
import React, { useMemo } from "react"; import React, { useMemo } from "react";
@@ -177,6 +177,9 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
<Statistic value={values.toDatePaint.toFixed(1)} /> <Statistic value={values.toDatePaint.toFixed(1)} />
</Col> </Col>
</Row> </Row>
<Row>
<Divider style={{ margin: 5 }} />
</Row>
<Row> <Row>
<Col {...statSpans}></Col> <Col {...statSpans}></Col>
<Col {...statSpans}> <Col {...statSpans}>
@@ -186,7 +189,6 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
</Col> </Col>
<Col {...statSpans}> <Col {...statSpans}>
<Statistic <Statistic
title={t("general.labels.total")}
value={( value={(
Util.WeeklyTargetHrs( Util.WeeklyTargetHrs(
bodyshop.scoreboard_target.dailyBodyTarget, bodyshop.scoreboard_target.dailyBodyTarget,
@@ -206,7 +208,6 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
</Col> </Col>
<Col {...statSpans}> <Col {...statSpans}>
<Statistic <Statistic
title={t("general.labels.total")}
value={( value={(
Util.MonthlyTargetHrs( Util.MonthlyTargetHrs(
bodyshop.scoreboard_target.dailyBodyTarget, bodyshop.scoreboard_target.dailyBodyTarget,
@@ -221,7 +222,6 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
</Col> </Col>
<Col {...statSpans}> <Col {...statSpans}>
<Statistic <Statistic
title={t("general.labels.total")}
value={( value={(
Util.AsOfTodayTargetHrs( Util.AsOfTodayTargetHrs(
bodyshop.scoreboard_target.dailyBodyTarget, bodyshop.scoreboard_target.dailyBodyTarget,

View File

@@ -81,6 +81,7 @@ export default function ScoreboardTimeTickets() {
totalLastMonth: 0, totalLastMonth: 0,
totalOverPeriod: 0, totalOverPeriod: 0,
actualTotalOverPeriod: 0, actualTotalOverPeriod: 0,
totalEffieciencyOverPeriod: 0,
employees: {}, employees: {},
}; };
data.fixedperiod.forEach((ticket) => { data.fixedperiod.forEach((ticket) => {
@@ -94,6 +95,7 @@ export default function ScoreboardTimeTickets() {
totalLastMonth: 0, totalLastMonth: 0,
totalOverPeriod: 0, totalOverPeriod: 0,
actualTotalOverPeriod: 0, actualTotalOverPeriod: 0,
totalEffieciencyOverPeriod: 0,
}; };
} }
@@ -221,6 +223,19 @@ export default function ScoreboardTimeTickets() {
ret2.push(r); ret2.push(r);
}); });
// Add total efficiency of employees
ret.totalEffieciencyOverPeriod = Object.keys(ret.employees)
.map((key) => {
return { employee_number: key, ...ret.employees[key] };
})
.map((e) =>
((e.totalOverPeriod / (e.actualTotalOverPeriod || 0.1)) * 100).toFixed(
1
)
)
.reduce((acc, prev) => acc + Number(prev), 0);
roundObject(ret); roundObject(ret);
roundObject(totals); roundObject(totals);
roundObject(ret2); roundObject(ret2);

View File

@@ -62,7 +62,7 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
key: "efficiencyoverperiod", key: "efficiencyoverperiod",
render: (text, record) => render: (text, record) =>
`${( `${(
(record.totalOverPeriod / (record.actualTotalOverPeriod || .1)) * (record.totalOverPeriod / (record.actualTotalOverPeriod || 0.1)) *
100 100
).toFixed(1)} %`, ).toFixed(1)} %`,
}, },
@@ -113,6 +113,12 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
value={data.totalOverPeriod} value={data.totalOverPeriod}
/> />
</Col> </Col>
<Col span={12}>
<Statistic
title={t("scoreboard.labels.efficiencyoverperiod")}
value={`${data.totalEffieciencyOverPeriod}%`}
/>
</Col>
</Row> </Row>
<Typography.Text type="secondary"> <Typography.Text type="secondary">
{t("scoreboard.labels.calendarperiod")} {t("scoreboard.labels.calendarperiod")}
@@ -121,7 +127,7 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
<Col md={24} lg={20}> <Col md={24} lg={20}>
<Table <Table
columns={columns} columns={columns}
rowKey='employee_number' rowKey="employee_number"
dataSource={tableData} dataSource={tableData}
id="employee_number" id="employee_number"
scroll={{ y: "300px" }} scroll={{ y: "300px" }}

View File

@@ -169,11 +169,14 @@ export function TechClockOffButton({
? "mod_lbr_ty" ? "mod_lbr_ty"
: "cost_center"; : "cost_center";
const costCenterDiff = totals.find( const costCenterDiff =
(total) => Math.round(
total[fieldTypeToCheck] === totals.find(
getFieldValue("cost_center") (total) =>
)?.difference; total[fieldTypeToCheck] ===
getFieldValue("cost_center")
)?.difference * 10
) / 10;
if (value > costCenterDiff) if (value > costCenterDiff)
return Promise.reject( return Promise.reject(

View File

@@ -206,10 +206,14 @@ export function TimeTicketModalComponent({
? "mod_lbr_ty" ? "mod_lbr_ty"
: "cost_center"; : "cost_center";
const costCenterDiff = totals.find( const costCenterDiff =
(total) => Math.round(
total[fieldTypeToCheck] === getFieldValue("cost_center") totals.find(
)?.difference; (total) =>
total[fieldTypeToCheck] ===
getFieldValue("cost_center")
)?.difference * 10
) / 10;
if (value > costCenterDiff) if (value > costCenterDiff)
return Promise.reject( return Promise.reject(