From 40aca91c7689eee130764a8d13d736db38b8dd0d Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 11 Feb 2025 10:51:26 -0800 Subject: [PATCH] IO-3077 Move parts scan order to correctly update totals. --- .../job-lines-upsert-modal.container.jsx | 11 +++++++---- .../jobs-available-table.container.jsx | 7 ++++--- server/parts-scan/parts-scan.js | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.container.jsx b/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.container.jsx index be9a19c79..12ffdf3a2 100644 --- a/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.container.jsx +++ b/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.container.jsx @@ -62,6 +62,9 @@ function JobLinesUpsertModalContainer({ jobLineEditModal, toggleModalVisible, bo refetchQueries: ["GET_LINE_TICKET_BY_PK"] }); if (!r.errors) { + if (CriticalPartsScanning.treatment === "on") { + await CriticalPartsScan(jobLineEditModal.context.jobid, notification); + } await Axios.post("/job/totalsssu", { id: jobLineEditModal.context.jobid }); @@ -107,7 +110,9 @@ function JobLinesUpsertModalContainer({ jobLineEditModal, toggleModalVisible, bo }) }); } - + if (CriticalPartsScanning.treatment === "on") { + await CriticalPartsScan(jobLineEditModal.context.jobid, notification); + } if (jobLineEditModal.actions.submit) { jobLineEditModal.actions.submit(); } else { @@ -115,9 +120,7 @@ function JobLinesUpsertModalContainer({ jobLineEditModal, toggleModalVisible, bo } toggleModalVisible(); } - if (CriticalPartsScanning.treatment === "on") { - CriticalPartsScan(jobLineEditModal.context.jobid, notification); - } + setLoading(false); }; diff --git a/client/src/components/jobs-available-table/jobs-available-table.container.jsx b/client/src/components/jobs-available-table/jobs-available-table.container.jsx index 043a5b30e..0e41c3997 100644 --- a/client/src/components/jobs-available-table/jobs-available-table.container.jsx +++ b/client/src/components/jobs-available-table/jobs-available-table.container.jsx @@ -172,13 +172,13 @@ export function JobsAvailableContainer({ bodyshop, currentUser, insertAuditTrail job: newJob } }); + if (CriticalPartsScanning.treatment === "on") { + await CriticalPartsScan(r.data.insert_jobs.returning[0].id, notification); + } await Axios.post("/job/totalsssu", { id: r.data.insert_jobs.returning[0].id }); - if (CriticalPartsScanning.treatment === "on") { - CriticalPartsScan(r.data.insert_jobs.returning[0].id, notification); - } notification["success"]({ message: t("jobs.successes.created"), onClick: () => { @@ -281,6 +281,7 @@ export function JobsAvailableContainer({ bodyshop, currentUser, insertAuditTrail if (CriticalPartsScanning.treatment === "on") { CriticalPartsScan(updateResult.data.update_jobs.returning[0].id, notification); } + if (updateResult.errors) { //error while inserting notification["error"]({ diff --git a/server/parts-scan/parts-scan.js b/server/parts-scan/parts-scan.js index 10d95f392..6822bded6 100644 --- a/server/parts-scan/parts-scan.js +++ b/server/parts-scan/parts-scan.js @@ -93,7 +93,7 @@ exports.partsScan = async function (req, res) { auditObj: { bodyshopid: data.jobs_by_pk.bodyshop.id, jobid, - operation: `Jobline (${jobline.line_desc}/${jobline.id}) ${update_field} updated from ${jobline[update_field]} to ${update_value}. Lined marked as manual line.`, + operation: `Jobline (#${jobline.line_no} ${jobline.line_desc}/${jobline.id}) ${update_field} updated from ${jobline[update_field]} to ${update_value}. Lined marked as manual line.`, type: "partscanupdate", useremail: req.user.email }