From d48b87d5993b18c20c64dce0dd8f9ebf52e0f52b Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Tue, 2 Feb 2021 21:06:01 -0800 Subject: [PATCH] Added manual parts queue action IO-542 --- bodyshop_translations.babel | 42 +++++++++++++++++++ .../jobs-detail-header-actions.component.jsx | 29 ++++++++++++- client/src/translations/en_us/common.json | 2 + client/src/translations/es/common.json | 2 + client/src/translations/fr/common.json | 2 + 5 files changed, 76 insertions(+), 1 deletion(-) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index c118e9728..da0cbc862 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -13028,6 +13028,27 @@ + + addtopartsqueue + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + addtoproduction false @@ -19577,6 +19598,27 @@ + + partsqueue + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + save false diff --git a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx index 9f782b6ab..ea66f70ee 100644 --- a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx +++ b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx @@ -7,7 +7,7 @@ import { connect } from "react-redux"; import { Link, useHistory } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { logImEXEvent } from "../../firebase/firebase.utils"; -import { DELETE_JOB } from "../../graphql/jobs.queries"; +import { DELETE_JOB, UPDATE_JOB } from "../../graphql/jobs.queries"; import { selectJobReadOnly } from "../../redux/application/application.selectors"; import { setModalContext } from "../../redux/modals/modals.actions"; import { selectBodyshop } from "../../redux/user/user.selectors"; @@ -44,6 +44,7 @@ export function JobsDetailHeaderActions({ const client = useApolloClient(); const history = useHistory(); const [deleteJob] = useMutation(DELETE_JOB); + const [updateJob] = useMutation(UPDATE_JOB); const jobInProduction = useMemo(() => { return bodyshop.md_ro_statuses.production_statuses.includes(job.status); }, [job, bodyshop.md_ro_statuses.production_statuses]); @@ -213,6 +214,32 @@ export function JobsDetailHeaderActions({ > {t("jobs.actions.postbills")} + { + const result = await updateJob({ + variables: { + jobId: job.id, + job: { queued_for_parts: true }, + }, + }); + + if (!!!result.errors) { + notification["success"]({ + message: t("jobs.successes.partsqueue"), + }); + } else { + notification["error"]({ + message: t("jobs.errors.saving", { + error: JSON.stringify(result.errors), + }), + }); + } + }} + > + {t("jobs.actions.addtopartsqueue")} +