Resolve time ticket posting issue.

This commit is contained in:
Patrick Fic
2023-04-05 14:02:34 -07:00
parent 6e7d1abd70
commit 8a6d94f193
3 changed files with 16 additions and 1 deletions

View File

@@ -26,6 +26,10 @@ export function TechClockInContainer({
technician, technician,
bodyshop, bodyshop,
}) { }) {
console.log(
"🚀 ~ file: tech-job-clock-in-form.container.jsx:29 ~ technician:",
technician
);
const [form] = Form.useForm(); const [form] = Form.useForm();
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [insertTimeTicket] = useMutation(INSERT_NEW_TIME_TICKET, { const [insertTimeTicket] = useMutation(INSERT_NEW_TIME_TICKET, {
@@ -33,6 +37,10 @@ export function TechClockInContainer({
}); });
const { t } = useTranslation(); const { t } = useTranslation();
const emps = bodyshop.employees.filter(
(e) => e.id === (technician && technician.id)
)[0];
const handleFinish = async (values) => { const handleFinish = async (values) => {
setLoading(true); setLoading(true);
const theTime = (await axios.post("/utils/time")).data; const theTime = (await axios.post("/utils/time")).data;
@@ -87,7 +95,12 @@ export function TechClockInContainer({
onClick={() => { onClick={() => {
setTimeTicketContext({ setTimeTicketContext({
actions: {}, actions: {},
context: { timeticket: { employeeid: technician.id } }, context: {
timeticket: {
employeeid: technician.id,
flat_rate: emps.flat_rate,
},
},
}); });
}} }}
> >

View File

@@ -59,6 +59,7 @@ export function TechClockOffButton({
emps && emps &&
emps.rates.filter((r) => r.cost_center === values.cost_center)[0] emps.rates.filter((r) => r.cost_center === values.cost_center)[0]
?.rate, ?.rate,
flat_rate: emps.flat_rate,
ciecacode: ciecacode:
bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber
? values.cost_center ? values.cost_center

View File

@@ -125,6 +125,7 @@ export const QUERY_BODYSHOP = gql`
employee_number employee_number
rates rates
external_id external_id
flat_rate
} }
} }
} }