From 8a6d94f193f7b11331f0fcfbcd177b7fa226336c Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Wed, 5 Apr 2023 14:02:34 -0700 Subject: [PATCH] Resolve time ticket posting issue. --- .../tech-job-clock-in-form.container.jsx | 15 ++++++++++++++- .../tech-job-clock-out-button.component.jsx | 1 + client/src/graphql/bodyshop.queries.js | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/client/src/components/tech-job-clock-in-form/tech-job-clock-in-form.container.jsx b/client/src/components/tech-job-clock-in-form/tech-job-clock-in-form.container.jsx index 4144d06d3..7754c07f2 100644 --- a/client/src/components/tech-job-clock-in-form/tech-job-clock-in-form.container.jsx +++ b/client/src/components/tech-job-clock-in-form/tech-job-clock-in-form.container.jsx @@ -26,6 +26,10 @@ export function TechClockInContainer({ technician, bodyshop, }) { + console.log( + "🚀 ~ file: tech-job-clock-in-form.container.jsx:29 ~ technician:", + technician + ); const [form] = Form.useForm(); const [loading, setLoading] = useState(false); const [insertTimeTicket] = useMutation(INSERT_NEW_TIME_TICKET, { @@ -33,6 +37,10 @@ export function TechClockInContainer({ }); const { t } = useTranslation(); + const emps = bodyshop.employees.filter( + (e) => e.id === (technician && technician.id) + )[0]; + const handleFinish = async (values) => { setLoading(true); const theTime = (await axios.post("/utils/time")).data; @@ -87,7 +95,12 @@ export function TechClockInContainer({ onClick={() => { setTimeTicketContext({ actions: {}, - context: { timeticket: { employeeid: technician.id } }, + context: { + timeticket: { + employeeid: technician.id, + flat_rate: emps.flat_rate, + }, + }, }); }} > 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 476742d60..7ea864ad5 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 @@ -59,6 +59,7 @@ export function TechClockOffButton({ emps && emps.rates.filter((r) => r.cost_center === values.cost_center)[0] ?.rate, + flat_rate: emps.flat_rate, ciecacode: bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber ? values.cost_center diff --git a/client/src/graphql/bodyshop.queries.js b/client/src/graphql/bodyshop.queries.js index bd52f4721..956bf9dd4 100644 --- a/client/src/graphql/bodyshop.queries.js +++ b/client/src/graphql/bodyshop.queries.js @@ -125,6 +125,7 @@ export const QUERY_BODYSHOP = gql` employee_number rates external_id + flat_rate } } }