From 4a92ef03ccb6ae05b086d19699cf5fff9f34a8a0 Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Fri, 21 Aug 2020 15:48:48 -0700
Subject: [PATCH] Added server side job calculation. BOD-267
---
.../job-totals-table.component.jsx | 14 +
.../jobs-detail-header.component.jsx | 2 +
.../jobs-detail.page.component.jsx | 24 +-
server.js | 3 +
server/job/job-totals.js | 325 ++++++++++++++++++
server/job/job.js | 1 +
6 files changed, 362 insertions(+), 7 deletions(-)
create mode 100644 server/job/job-totals.js
create mode 100644 server/job/job.js
diff --git a/client/src/components/job-totals-table/job-totals-table.component.jsx b/client/src/components/job-totals-table/job-totals-table.component.jsx
index 48a30c0d4..016cf6c01 100644
--- a/client/src/components/job-totals-table/job-totals-table.component.jsx
+++ b/client/src/components/job-totals-table/job-totals-table.component.jsx
@@ -26,6 +26,20 @@ export function JobsTotalsTableComponent({ bodyshop, job }) {
setTotals(CalculateJob(job, bodyshop.shoprates));
}, [bodyshop, job]);
+ // useEffect(() => {
+ // const Calculate = async () => {
+ // const newTotals = (
+ // await Axios.post("/job/totals", {
+ // job: job,
+ // shoprates: bodyshop.shoprates,
+ // })
+ // ).data;
+ // setTotals(newTotals);
+ // };
+
+ // Calculate();
+ // }, [bodyshop, job]);
+
if (!!!totals) {
return ;
}
diff --git a/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx b/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx
index 492eedbd1..c190dadc7 100644
--- a/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx
+++ b/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx
@@ -30,6 +30,7 @@ export function JobsDetailHeader({
bodyshop,
updateJobStatus,
setScheduleContext,
+ loading,
form,
}) {
const { t } = useTranslation();
@@ -79,6 +80,7 @@ export function JobsDetailHeader({