From 610292ff5633af7e5ea38379bbdc4c5903b02da8 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 12 Jan 2021 16:16:54 -0800 Subject: [PATCH] Temporary Demo Fixes --- .../components/email-overlay/email-overlay.container.jsx | 8 +++++++- .../labor-allocations-adjustment-edit.component.jsx | 2 +- .../production-sublets-manage.component.jsx | 4 +++- client/src/utils/TemplateConstants.js | 1 + server/job/job-totals.js | 6 ++++-- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/client/src/components/email-overlay/email-overlay.container.jsx b/client/src/components/email-overlay/email-overlay.container.jsx index 675e14b3e..d5d1a17ae 100644 --- a/client/src/components/email-overlay/email-overlay.container.jsx +++ b/client/src/components/email-overlay/email-overlay.container.jsx @@ -36,6 +36,7 @@ export function EmailOverlayContainer({ const [loading, setLoading] = useState(false); const [sending, setSending] = useState(false); + const [rawHtml, setRawHtml] = useState(""); const defaultEmailFrom = { from: { name: bodyshop.shopname || EmailSettings.fromNameDefault, @@ -65,7 +66,11 @@ export function EmailOverlayContainer({ setSending(true); try { - await axios.post("/sendemail", { ...messageOptions, attachments }); + await axios.post("/sendemail", { + ...messageOptions, + html: rawHtml, + attachments, + }); notification["success"]({ message: t("emails.successes.sent") }); toggleEmailOverlayVisible(); } catch (error) { @@ -115,6 +120,7 @@ export function EmailOverlayContainer({ html: html, url: `${window.location.protocol}://${window.location.host}/`, }); + setRawHtml(response.data); console.log("response", response); setMessageOptions({ diff --git a/client/src/components/labor-allocations-adjustment-edit/labor-allocations-adjustment-edit.component.jsx b/client/src/components/labor-allocations-adjustment-edit/labor-allocations-adjustment-edit.component.jsx index 3281474e9..e593b67b4 100644 --- a/client/src/components/labor-allocations-adjustment-edit/labor-allocations-adjustment-edit.component.jsx +++ b/client/src/components/labor-allocations-adjustment-edit/labor-allocations-adjustment-edit.component.jsx @@ -61,7 +61,7 @@ export default function LaborAllocationsAdjustmentEdit({ onFinish={handleFinish} initialValues={{ mod_lbr_ty: mod_lbr_ty, - hours: adjustments[mod_lbr_ty], + hours: adjustments && adjustments[mod_lbr_ty], }} > - {`${subletCount.outstanding} / ${subletCount.total} rem.`} + 0 ? "tomato" : "" }} + >{`${subletCount.outstanding} / ${subletCount.total} rem.`} ); } diff --git a/client/src/utils/TemplateConstants.js b/client/src/utils/TemplateConstants.js index 973b7d21a..68f6afc81 100644 --- a/client/src/utils/TemplateConstants.js +++ b/client/src/utils/TemplateConstants.js @@ -26,6 +26,7 @@ export const TemplateList = (type, object) => { description: "Parts Order", drivingId: "job", key: "parts_order_confirmation", + subject: "Parts Order", }, parts_return_confirmation: { title: i18n.t("printcenter.jobs.parts_return_confirmation"), diff --git a/server/job/job-totals.js b/server/job/job-totals.js index f152b6d87..0732b134c 100644 --- a/server/job/job-totals.js +++ b/server/job/job-totals.js @@ -235,7 +235,8 @@ function CalculateTaxesTotals(job, otherTotals) { Dinero({ amount: Math.round((val.act_price || 0) * 100) }) .multiply(val.part_qty || 1) .percentage( - (job.parts_tax_rates["PAN"] && + (job.parts_tax_rate && + job.parts_tax_rates["PAN"] && job.parts_tax_rates["PAN"].prt_tax_rt) * 100 ) ); @@ -244,7 +245,8 @@ function CalculateTaxesTotals(job, otherTotals) { Dinero({ amount: Math.round((val.act_price || 0) * 100) }) .multiply(val.part_qty || 1) .percentage( - (job.parts_tax_rates[val.part_type] && + (job.parts_tax_rate && + job.parts_tax_rates[val.part_type] && job.parts_tax_rates[val.part_type].prt_tax_rt) * 100 ) );