IO-3262 Tech Console Job Clock Out

Signed-off-by: Allan Carr <allan@imexsystems.ca>
This commit is contained in:
Allan Carr
2025-12-01 12:50:11 -08:00
parent 123066f1cd
commit 90edf94fee
2 changed files with 110 additions and 119 deletions

View File

@@ -16,7 +16,7 @@ const mapDispatchToProps = () => ({
export function TechHeader({ technician }) { export function TechHeader({ technician }) {
const { t } = useTranslation(); const { t } = useTranslation();
return ( return (
<Header style={{ textAlign: "center" }}> <Header style={{ textAlign: "center", height: "auto", overflow: "visible" }}>
<Typography.Title style={{ color: "#fff" }}> <Typography.Title style={{ color: "#fff" }}>
{technician {technician
? t("tech.labels.loggedin", { ? t("tech.labels.loggedin", {

View File

@@ -1,5 +1,5 @@
import { useMutation, useQuery } from "@apollo/client"; 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 axios from "axios";
import { useState } from "react"; import { useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@@ -124,8 +124,7 @@ export function TechClockOffButton({
cost_center: isShiftTicket ? "timetickets.labels.shift" : technician ? technician.cost_center : null cost_center: isShiftTicket ? "timetickets.labels.shift" : technician ? technician.cost_center : null
}} }}
> >
<Row gutter={[16, 16]}> <Space direction="vertical">
<Col span={!isShiftTicket ? 8 : 24}>
{!isShiftTicket ? ( {!isShiftTicket ? (
<div> <div>
<Form.Item <Form.Item
@@ -155,7 +154,6 @@ export function TechClockOffButton({
} }
if (!value || getFieldValue("cost_center") === null || !lineTicketData) if (!value || getFieldValue("cost_center") === null || !lineTicketData)
return Promise.resolve(); return Promise.resolve();
//Check the cost center, //Check the cost center,
const totals = CalculateAllocationsTotals( const totals = CalculateAllocationsTotals(
bodyshop, bodyshop,
@@ -163,16 +161,13 @@ export function TechClockOffButton({
lineTicketData.timetickets, lineTicketData.timetickets,
lineTicketData.jobs_by_pk.lbr_adjustments lineTicketData.jobs_by_pk.lbr_adjustments
); );
const fieldTypeToCheck = const fieldTypeToCheck =
bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber ? "mod_lbr_ty" : "cost_center"; bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber ? "mod_lbr_ty" : "cost_center";
const costCenterDiff = const costCenterDiff =
Math.round( Math.round(
totals.find((total) => total[fieldTypeToCheck] === getFieldValue("cost_center")) totals.find((total) => total[fieldTypeToCheck] === getFieldValue("cost_center"))
?.difference * 10 ?.difference * 10
) / 10; ) / 10;
if (value > costCenterDiff) if (value > costCenterDiff)
return Promise.reject(t("timetickets.validation.hoursenteredmorethanavailable")); return Promise.reject(t("timetickets.validation.hoursenteredmorethanavailable"));
else { else {
@@ -213,7 +208,6 @@ export function TechClockOffButton({
)} )}
</Select> </Select>
</Form.Item> </Form.Item>
{isShiftTicket ? ( {isShiftTicket ? (
<div></div> <div></div>
) : ( ) : (
@@ -239,24 +233,21 @@ export function TechClockOffButton({
{t("general.actions.save")} {t("general.actions.save")}
</Button> </Button>
<TechJobClockoutDelete completedCallback={completedCallback} timeTicketId={timeTicketId} /> <TechJobClockoutDelete completedCallback={completedCallback} timeTicketId={timeTicketId} />
</Col>
{!isShiftTicket && ( {!isShiftTicket && (
<Col span={16}> <LaborAllocationContainer jobid={jobId || null} loading={queryLoading} lineTicketData={lineTicketData} />
<LaborAllocationContainer
jobid={jobId || null}
loading={queryLoading}
lineTicketData={lineTicketData}
/>
</Col>
)} )}
</Row> </Space>
</Form> </Form>
</div> </div>
</Card> </Card>
); );
return ( return (
<Popover content={overlay} trigger="click"> <Popover
content={<div style={{ maxHeight: "75vh", overflowY: "auto" }}>{overlay}</div>}
trigger="click"
getPopupContainer={() => document.querySelector('#time-ticket-modal')}
>
<Button loading={loading} {...otherBtnProps}> <Button loading={loading} {...otherBtnProps}>
{t("timetickets.actions.clockout")} {t("timetickets.actions.clockout")}
</Button> </Button>