Added parts table for job close BOD-131

This commit is contained in:
Patrick Fic
2020-05-19 17:59:02 -07:00
parent bdead5b4a0
commit 94777bf661
6 changed files with 141 additions and 26 deletions

View File

@@ -3,6 +3,7 @@ import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import JobsCloseLaborMaterialAllocation from "../../components/jobs-close-labmat-allocation/jobs-close-labmat-allocation.component";
import { selectBodyshop } from "../../redux/user/user.selectors";
import JobsClosePartsAllocation from "../../components/jobs-close-parts-allocation/jobs-close-parts-allocation.component";
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
@@ -20,12 +21,24 @@ export function JobsCloseComponent({ job, bodyshop, jobTotals }) {
}, {})
);
const [partsAllocations, setPartsAllocations] = useState(
Object.keys(jobTotals.parts.parts.list).reduce((acc, val) => {
acc[val] = { ...jobTotals.parts.parts.list[val], allocations: [] };
return acc;
}, {})
);
return (
<div>
<JobsCloseLaborMaterialAllocation
labmatAllocations={labmatAllocations}
setLabmatAllocations={setLabmatAllocations}
/>
<JobsClosePartsAllocation
partsAllocations={partsAllocations}
setPartsAllocations={setPartsAllocations}
/>
</div>
);
}