diff --git a/client/src/components/tech-header/tech-header.component.jsx b/client/src/components/tech-header/tech-header.component.jsx index 72d085c12..e6c0d2f05 100644 --- a/client/src/components/tech-header/tech-header.component.jsx +++ b/client/src/components/tech-header/tech-header.component.jsx @@ -16,7 +16,7 @@ const mapDispatchToProps = () => ({ export function TechHeader({ technician }) { const { t } = useTranslation(); return ( -
+
{technician ? t("tech.labels.loggedin", { 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 ed48ecff5..5ef1b46c5 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 @@ -1,5 +1,5 @@ import { useMutation, useQuery } from "@apollo/client"; -import { Button, Card, Col, Form, InputNumber, Popover, Row, Select } from "antd"; +import { Button, Card, Form, InputNumber, Popover, Select, Space } from "antd"; import axios from "axios"; import { useState } from "react"; import { useTranslation } from "react-i18next"; @@ -124,103 +124,12 @@ export function TechClockOffButton({ cost_center: isShiftTicket ? "timetickets.labels.shift" : technician ? technician.cost_center : null }} > - - - {!isShiftTicket ? ( -
- - - - ({ - validator(rule, value) { - if (!bodyshop.tt_enforce_hours_for_tech_console) { - return Promise.resolve(); - } - if (!value || getFieldValue("cost_center") === null || !lineTicketData) - return Promise.resolve(); - - //Check the cost center, - const totals = CalculateAllocationsTotals( - bodyshop, - lineTicketData.joblines, - lineTicketData.timetickets, - lineTicketData.jobs_by_pk.lbr_adjustments - ); - - const fieldTypeToCheck = - bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber ? "mod_lbr_ty" : "cost_center"; - - const costCenterDiff = - Math.round( - totals.find((total) => total[fieldTypeToCheck] === getFieldValue("cost_center")) - ?.difference * 10 - ) / 10; - - if (value > costCenterDiff) - return Promise.reject(t("timetickets.validation.hoursenteredmorethanavailable")); - else { - return Promise.resolve(); - } - } - }) - ]} - > - - -
- ) : null} - - - - - {isShiftTicket ? ( -
- ) : ( + + {!isShiftTicket ? ( +
- + - )} - - - - {!isShiftTicket && ( - - - + ({ + validator(rule, value) { + if (!bodyshop.tt_enforce_hours_for_tech_console) { + return Promise.resolve(); + } + if (!value || getFieldValue("cost_center") === null || !lineTicketData) + return Promise.resolve(); + //Check the cost center, + const totals = CalculateAllocationsTotals( + bodyshop, + lineTicketData.joblines, + lineTicketData.timetickets, + lineTicketData.jobs_by_pk.lbr_adjustments + ); + const fieldTypeToCheck = + bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber ? "mod_lbr_ty" : "cost_center"; + const costCenterDiff = + Math.round( + totals.find((total) => total[fieldTypeToCheck] === getFieldValue("cost_center")) + ?.difference * 10 + ) / 10; + if (value > costCenterDiff) + return Promise.reject(t("timetickets.validation.hoursenteredmorethanavailable")); + else { + return Promise.resolve(); + } + } + }) + ]} + > + + +
+ ) : null} + + + + {isShiftTicket ? ( +
+ ) : ( + + + )} -
+ + + {!isShiftTicket && ( + + )} + ); return ( - + {overlay}} + trigger="click" + getPopupContainer={() => document.querySelector('#time-ticket-modal')} + >