From 1ca2e16e73fac87c66c604a70b4cda43453c11a9 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 9 Dec 2020 15:53:17 -0800 Subject: [PATCH] Addded parts order modal updates & translations --- bodyshop_translations.babel | 105 ++++++++++++++++++ .../parts-order-modal.container.jsx | 8 +- .../vendors-form/vendors-form.container.jsx | 12 +- client/src/graphql/vendors.queries.js | 1 + client/src/translations/en_us/common.json | 5 + client/src/translations/es/common.json | 5 + client/src/translations/fr/common.json | 5 + client/src/utils/TemplateConstants.js | 1 + 8 files changed, 139 insertions(+), 3 deletions(-) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 56e3b106e..d1d7680c3 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -21932,6 +21932,27 @@ jobs + + all_job_notes + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + appointment_reminder false @@ -21953,6 +21974,27 @@ + + casl_authorization + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + casl_work_authorization false @@ -21974,6 +22016,27 @@ + + cover_sheet + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + coversheet false @@ -22016,6 +22079,27 @@ + + fippa_authorization + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + fippa_work_authorization false @@ -22058,6 +22142,27 @@ + + window_tag + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + work_authorization false diff --git a/client/src/components/parts-order-modal/parts-order-modal.container.jsx b/client/src/components/parts-order-modal/parts-order-modal.container.jsx index 0d73cbfb8..5c1f1da2a 100644 --- a/client/src/components/parts-order-modal/parts-order-modal.container.jsx +++ b/client/src/components/parts-order-modal/parts-order-modal.container.jsx @@ -130,6 +130,7 @@ export function PartsOrderModalContainer({ actual_price: 0, actual_cost: 0, line_desc: p.line_desc, + line_remarks: p.line_remarks, quantity: p.quantity || 1, cost_center: bodyshop.md_responsibility_centers.defaults.PAO || "Other*", @@ -147,10 +148,15 @@ export function PartsOrderModalContainer({ toggleModalVisible(); if (sendType === "e") { + const matchingVendor = data.vendors.filter( + (item) => item.id === values.vendorid + )[0]; setEmailOptions({ messageOptions: { - to: [data.vendors.filter((item) => item.id === values.id)[0]] || null, + to: matchingVendor ? [matchingVendor.email] : null, replyTo: bodyshop.email, + subject: TemplateList("job", bodyshop.shopname) + .parts_order_confirmation.subject, }, template: { name: isReturn diff --git a/client/src/components/vendors-form/vendors-form.container.jsx b/client/src/components/vendors-form/vendors-form.container.jsx index 9ff9cda7a..70a01afce 100644 --- a/client/src/components/vendors-form/vendors-form.container.jsx +++ b/client/src/components/vendors-form/vendors-form.container.jsx @@ -47,7 +47,11 @@ function VendorsFormContainer({ refetch, bodyshop }) { message: t("vendors.successes.deleted"), }); //TODO Better way to reset the field decorators? - if (refetch) refetch().then((r) => form.resetFields()); + if (refetch) + refetch().then((r) => { + form.resetFields(); + form.resetFields(); + }); setFormLoading(false); }) .catch((error) => { @@ -71,7 +75,11 @@ function VendorsFormContainer({ refetch, bodyshop }) { message: t("vendors.successes.saved"), }); //TODO Better way to reset the field decorators? - if (refetch) refetch().form.resetFields(); + if (refetch) + refetch().then(() => { + form.resetFields(); + form.resetFields(); + }); setFormLoading(false); }) .catch((error) => { diff --git a/client/src/graphql/vendors.queries.js b/client/src/graphql/vendors.queries.js index 9579ad926..976be68fc 100644 --- a/client/src/graphql/vendors.queries.js +++ b/client/src/graphql/vendors.queries.js @@ -74,6 +74,7 @@ export const QUERY_ALL_VENDORS_FOR_ORDER = gql` id favorite discount + email } jobs(where: { id: { _eq: $jobId } }) { v_make_desc diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index aee505c89..a3540916f 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -1343,12 +1343,17 @@ "nocontexttype": "No context type set." }, "jobs": { + "all_job_notes": "All Job Notes", "appointment_reminder": "Appointment Reminder", + "casl_authorization": "CASL Authorization", "casl_work_authorization": "CASL Work Authorization", + "cover_sheet": "Cover Sheet", "coversheet": "Coversheet", "estimate_detail": "Estimate Details", + "fippa_authorization": "FIPPA Authorization", "fippa_work_authorization": "FIPPA Work Authorization", "job_totals": "Job Totals Only", + "window_tag": "Window Tag", "work_authorization": "Work Authorization" }, "labels": { diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 688ebeff2..936e1950b 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -1343,12 +1343,17 @@ "nocontexttype": "" }, "jobs": { + "all_job_notes": "", "appointment_reminder": "", + "casl_authorization": "", "casl_work_authorization": "", + "cover_sheet": "", "coversheet": "", "estimate_detail": "", + "fippa_authorization": "", "fippa_work_authorization": "", "job_totals": "", + "window_tag": "", "work_authorization": "" }, "labels": { diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 9fd9c3026..76b333439 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -1343,12 +1343,17 @@ "nocontexttype": "" }, "jobs": { + "all_job_notes": "", "appointment_reminder": "", + "casl_authorization": "", "casl_work_authorization": "", + "cover_sheet": "", "coversheet": "", "estimate_detail": "", + "fippa_authorization": "", "fippa_work_authorization": "", "job_totals": "", + "window_tag": "", "work_authorization": "" }, "labels": { diff --git a/client/src/utils/TemplateConstants.js b/client/src/utils/TemplateConstants.js index e637c27b4..23c297215 100644 --- a/client/src/utils/TemplateConstants.js +++ b/client/src/utils/TemplateConstants.js @@ -72,6 +72,7 @@ export const TemplateList = (type, object) => { description: "Parts order template including part details", drivingId: "partsorder", key: "parts_order_confirmation", + subject: `Parts Order for ${object}`, }, cover_sheet_landscape: {