Finished moving job totals calculation to server side BOD-267.

This commit is contained in:
Patrick Fic
2020-08-24 10:17:32 -07:00
parent 4b44fdfde5
commit 2acef8f726
18 changed files with 801 additions and 618 deletions

View File

@@ -109,9 +109,8 @@ export function JobsCloseComponent({ job, bodyshop, jobTotals }) {
setInvoicedState={setInvoiced}
partsAllocations={partsAllocations}
labMatAllocations={labmatAllocations}
jobTotals={jobTotals}
disabled={!!job.date_exported}
suspenseAmount={jobTotals.totals.subtotal
suspenseAmount={Dinero(jobTotals.totals.subtotal)
.subtract(labmatAllocatedTotal)
.subtract(partsAllocatedTotal)
.getAmount()}

View File

@@ -5,7 +5,6 @@ import { connect } from "react-redux";
import { useParams } from "react-router-dom";
import { createStructuredSelector } from "reselect";
import AlertComponent from "../../components/alert/alert.component";
import { CalculateJob } from "../../components/job-totals-table/job-totals.utility";
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
import { QUERY_JOB_CLOSE_DETAILS } from "../../graphql/jobs.queries";
@@ -53,13 +52,12 @@ export function JobsCloseContainer({ setBreadcrumbs, bodyshop }) {
if (loading) return <LoadingSpinner />;
if (error) return <AlertComponent message={error.message} type="error" />;
const jobTotals = CalculateJob(data.jobs_by_pk, bodyshop.shoprates);
return (
<RbacWrapper action="jobs:close">
<div>
<JobsCloseComponent
job={data ? data.jobs_by_pk : {}}
jobTotals={jobTotals}
jobTotals={data.jobs_by_pk.job_totals}
/>
</div>
</RbacWrapper>