From c62c3fa9389619c32c9babf99ebb85d01685ef70 Mon Sep 17 00:00:00 2001 From: swtmply Date: Fri, 14 Apr 2023 00:40:50 +0800 Subject: [PATCH 1/6] IO-2240 total for productive hours in summary --- ...scoreboard-timetickets.stats.component.jsx | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/client/src/components/scoreboard-timetickets/scoreboard-timetickets.stats.component.jsx b/client/src/components/scoreboard-timetickets/scoreboard-timetickets.stats.component.jsx index 0b1b9b6bf..3a25d4957 100644 --- a/client/src/components/scoreboard-timetickets/scoreboard-timetickets.stats.component.jsx +++ b/client/src/components/scoreboard-timetickets/scoreboard-timetickets.stats.component.jsx @@ -1,5 +1,5 @@ import { Card, Col, Row, Statistic, Table, Typography } from "antd"; -import React from "react"; +import React, { useMemo } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -62,7 +62,7 @@ export function ScoreboardTicketsStats({ data, bodyshop }) { key: "efficiencyoverperiod", render: (text, record) => `${( - (record.totalOverPeriod / (record.actualTotalOverPeriod || .1)) * + (record.totalOverPeriod / (record.actualTotalOverPeriod || 0.1)) * 100 ).toFixed(1)} %`, }, @@ -74,6 +74,23 @@ export function ScoreboardTicketsStats({ data, bodyshop }) { }) : []; + const totalEffieciencyOverPeriod = useMemo( + () => + Object.keys(data?.employees ?? []) + .map((key) => { + return { employee_number: key, ...data.employees[key] }; + }) + .map((e) => + ( + (e.totalOverPeriod / (e.actualTotalOverPeriod || 0.1)) * + 100 + ).toFixed(1) + ) + .reduce((acc, prev) => acc + Number(prev), 0) + .toFixed(1), + [data] + ); + return ( @@ -113,6 +130,12 @@ export function ScoreboardTicketsStats({ data, bodyshop }) { value={data.totalOverPeriod} /> + + + {t("scoreboard.labels.calendarperiod")} @@ -121,7 +144,7 @@ export function ScoreboardTicketsStats({ data, bodyshop }) { Date: Thu, 13 Apr 2023 10:11:15 -0700 Subject: [PATCH 2/6] IO-2244 Round difference calculation to 1 decimal point for productive hours claiming enforcement. --- .../tech-job-clock-out-button.component.jsx | 13 ++++++++----- .../time-ticket-modal.component.jsx | 12 ++++++++---- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/client/src/components/tech-job-clock-out-button/tech-job-clock-out-button.component.jsx b/client/src/components/tech-job-clock-out-button/tech-job-clock-out-button.component.jsx index 8ace8e08d..5c0830d5e 100644 --- a/client/src/components/tech-job-clock-out-button/tech-job-clock-out-button.component.jsx +++ b/client/src/components/tech-job-clock-out-button/tech-job-clock-out-button.component.jsx @@ -169,11 +169,14 @@ export function TechClockOffButton({ ? "mod_lbr_ty" : "cost_center"; - const costCenterDiff = totals.find( - (total) => - total[fieldTypeToCheck] === - getFieldValue("cost_center") - )?.difference; + const costCenterDiff = + Math.round( + totals.find( + (total) => + total[fieldTypeToCheck] === + getFieldValue("cost_center") + )?.difference * 10 + ) / 10; if (value > costCenterDiff) return Promise.reject( diff --git a/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx b/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx index c0cf7b024..a72322851 100644 --- a/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx +++ b/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx @@ -206,10 +206,14 @@ export function TimeTicketModalComponent({ ? "mod_lbr_ty" : "cost_center"; - const costCenterDiff = totals.find( - (total) => - total[fieldTypeToCheck] === getFieldValue("cost_center") - )?.difference; + const costCenterDiff = + Math.round( + totals.find( + (total) => + total[fieldTypeToCheck] === + getFieldValue("cost_center") + )?.difference * 10 + ) / 10; if (value > costCenterDiff) return Promise.reject( From c7ff8933978f2ea8d690b157687c8735324d5c23 Mon Sep 17 00:00:00 2001 From: swtmply Date: Fri, 14 Apr 2023 02:53:04 +0800 Subject: [PATCH 3/6] IO-1412 Fixed column resize drag speed --- .../production-list-table.resizeable.component.jsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client/src/components/production-list-table/production-list-table.resizeable.component.jsx b/client/src/components/production-list-table/production-list-table.resizeable.component.jsx index 07b47c87a..618e9e8cd 100644 --- a/client/src/components/production-list-table/production-list-table.resizeable.component.jsx +++ b/client/src/components/production-list-table/production-list-table.resizeable.component.jsx @@ -14,6 +14,14 @@ export default function ResizableComponent(props) { height={0} onResize={onResize} draggableOpts={{ enableUserSelectHack: false }} + handle={ + { + e.stopPropagation(); + }} + /> + } > @@ -186,7 +189,6 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) { Date: Sat, 15 Apr 2023 01:11:44 +0800 Subject: [PATCH 5/6] IO-2240 Moved the calculation within the function --- .../scoreboard-timetickets.component.jsx | 15 +++++++++++++ ...scoreboard-timetickets.stats.component.jsx | 21 ++----------------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/client/src/components/scoreboard-timetickets/scoreboard-timetickets.component.jsx b/client/src/components/scoreboard-timetickets/scoreboard-timetickets.component.jsx index 6f3f53a42..23a009722 100644 --- a/client/src/components/scoreboard-timetickets/scoreboard-timetickets.component.jsx +++ b/client/src/components/scoreboard-timetickets/scoreboard-timetickets.component.jsx @@ -81,6 +81,7 @@ export default function ScoreboardTimeTickets() { totalLastMonth: 0, totalOverPeriod: 0, actualTotalOverPeriod: 0, + totalEffieciencyOverPeriod: 0, employees: {}, }; data.fixedperiod.forEach((ticket) => { @@ -94,6 +95,7 @@ export default function ScoreboardTimeTickets() { totalLastMonth: 0, totalOverPeriod: 0, actualTotalOverPeriod: 0, + totalEffieciencyOverPeriod: 0, }; } @@ -217,6 +219,19 @@ export default function ScoreboardTimeTickets() { r.employees[ticket.employee.employee_number].actual + ticket.actualhrs; }); + + // 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); } ret2.push(r); diff --git a/client/src/components/scoreboard-timetickets/scoreboard-timetickets.stats.component.jsx b/client/src/components/scoreboard-timetickets/scoreboard-timetickets.stats.component.jsx index 3a25d4957..e31cec3af 100644 --- a/client/src/components/scoreboard-timetickets/scoreboard-timetickets.stats.component.jsx +++ b/client/src/components/scoreboard-timetickets/scoreboard-timetickets.stats.component.jsx @@ -1,5 +1,5 @@ import { Card, Col, Row, Statistic, Table, Typography } from "antd"; -import React, { useMemo } from "react"; +import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -74,23 +74,6 @@ export function ScoreboardTicketsStats({ data, bodyshop }) { }) : []; - const totalEffieciencyOverPeriod = useMemo( - () => - Object.keys(data?.employees ?? []) - .map((key) => { - return { employee_number: key, ...data.employees[key] }; - }) - .map((e) => - ( - (e.totalOverPeriod / (e.actualTotalOverPeriod || 0.1)) * - 100 - ).toFixed(1) - ) - .reduce((acc, prev) => acc + Number(prev), 0) - .toFixed(1), - [data] - ); - return ( @@ -133,7 +116,7 @@ export function ScoreboardTicketsStats({ data, bodyshop }) { From 0e06b449cbe6676616a9b8c73df9d1658d9bf2dc Mon Sep 17 00:00:00 2001 From: swtmply Date: Sat, 15 Apr 2023 01:18:29 +0800 Subject: [PATCH 6/6] IO-2240 Adjusted the location of the calculation --- .../scoreboard-timetickets.component.jsx | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/client/src/components/scoreboard-timetickets/scoreboard-timetickets.component.jsx b/client/src/components/scoreboard-timetickets/scoreboard-timetickets.component.jsx index 23a009722..1b6fae085 100644 --- a/client/src/components/scoreboard-timetickets/scoreboard-timetickets.component.jsx +++ b/client/src/components/scoreboard-timetickets/scoreboard-timetickets.component.jsx @@ -219,23 +219,23 @@ export default function ScoreboardTimeTickets() { r.employees[ticket.employee.employee_number].actual + ticket.actualhrs; }); - - // 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); } 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(totals); roundObject(ret2);
From 79e2fecb2438f085034d58ac6857d08e3cf4fc96 Mon Sep 17 00:00:00 2001 From: swtmply Date: Fri, 14 Apr 2023 23:33:14 +0800 Subject: [PATCH 4/6] IO-2239 Removed total title --- .../scoreboard-day-stats.component.jsx | 11 ++++------- .../scoreboard-targets-table.component.jsx | 8 ++++---- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/client/src/components/scoreboard-day-stats/scoreboard-day-stats.component.jsx b/client/src/components/scoreboard-day-stats/scoreboard-day-stats.component.jsx index 497eab209..cfd6d945d 100644 --- a/client/src/components/scoreboard-day-stats/scoreboard-day-stats.component.jsx +++ b/client/src/components/scoreboard-day-stats/scoreboard-day-stats.component.jsx @@ -1,10 +1,9 @@ -import { Card, Statistic } from "antd"; +import { Card, Divider, Statistic } from "antd"; import moment from "moment"; import React from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { selectBodyshop } from "../../redux/user/user.selectors"; -import { useTranslation } from "react-i18next"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, }); @@ -14,7 +13,6 @@ const mapDispatchToProps = (dispatch) => ({ export function ScoreboardDayStats({ bodyshop, date, entries }) { const { dailyPaintTarget, dailyBodyTarget } = bodyshop.scoreboard_target; - const { t } = useTranslation(); //let totalHrs = 0; const paintHrs = entries.reduce((acc, value) => { @@ -43,10 +41,9 @@ export function ScoreboardDayStats({ bodyshop, date, entries }) { label="P" value={paintHrs.toFixed(1)} /> - + + + ); } diff --git a/client/src/components/scoreboard-targets-table/scoreboard-targets-table.component.jsx b/client/src/components/scoreboard-targets-table/scoreboard-targets-table.component.jsx index 558b217b6..112d441f6 100644 --- a/client/src/components/scoreboard-targets-table/scoreboard-targets-table.component.jsx +++ b/client/src/components/scoreboard-targets-table/scoreboard-targets-table.component.jsx @@ -1,5 +1,5 @@ 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 moment from "moment"; import React, { useMemo } from "react"; @@ -177,6 +177,9 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) { + + +