From 5ecd5a5a5c7f36228e371249b3989f778cc5f365 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 4 Aug 2021 09:10:23 -0700 Subject: [PATCH] IO-1122 Add permission to text to intake checklist. --- bodyshop_translations.babel | 21 ++++++++++++++ .../job-checklist-form.component.jsx | 29 +++++++++++++++++++ client/src/graphql/bodyshop.queries.js | 4 +++ client/src/translations/en_us/common.json | 1 + client/src/translations/es/common.json | 1 + client/src/translations/fr/common.json | 1 + 6 files changed, 57 insertions(+) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 39f7c8a01..dbee40f32 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -8144,6 +8144,27 @@ + + allow_text_message + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + checklist false diff --git a/client/src/components/job-checklist/components/job-checklist-form/job-checklist-form.component.jsx b/client/src/components/job-checklist/components/job-checklist-form/job-checklist-form.component.jsx index 8c6db2e4c..cc61d1aa3 100644 --- a/client/src/components/job-checklist/components/job-checklist-form/job-checklist-form.component.jsx +++ b/client/src/components/job-checklist/components/job-checklist-form/job-checklist-form.component.jsx @@ -18,6 +18,7 @@ import DateTimePicker from "../../../form-date-time-picker/form-date-time-picker import moment from "moment-business-days"; import { insertAuditTrail } from "../../../../redux/application/application.actions"; import AuditTrailMapping from "../../../../utils/AuditTrailMappings"; +import { UPDATE_OWNER } from "../../../../graphql/owners.queries"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -41,6 +42,8 @@ export function JobChecklistForm({ const [intakeJob] = useMutation(UPDATE_JOB); const [loading, setLoading] = useState(false); const [markAptArrived] = useMutation(MARK_LATEST_APPOINTMENT_AS_ARRIVED); + const [updateOwner] = useMutation(UPDATE_OWNER); + const { jobId } = useParams(); const history = useHistory(); const search = queryString.parse(useLocation().search); @@ -114,6 +117,23 @@ export function JobChecklistForm({ }); } } + + //Updae Owner Allow to Text + const updateOwnerResult = await updateOwner({ + variables: { + ownerId: job.owner.id, + owner: { allow_text_message: values.allow_text_message }, + }, + }); + + if (!!updateOwnerResult.errors) { + notification["error"]({ + message: t("checklist.errors.complete", { + error: JSON.stringify(result.errors), + }), + }); + } + setLoading(false); if (!!!result.errors) { @@ -156,6 +176,7 @@ export function JobChecklistForm({ initialValues={{ ...(type === "intake" && { addToProduction: true, + allow_text_message: job.owner.allow_text_message, scheduled_completion: (job && job.scheduled_completion) || moment().businessAdd( @@ -191,6 +212,14 @@ export function JobChecklistForm({ > + + +