From 4516491c8c04a0e7df8044be4085fd7762ded3ee Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Fri, 26 Jun 2020 09:29:16 -0700 Subject: [PATCH] Changes to recent items BOD-178 --- .../jobs-close-auto-allocate.component.jsx | 9 +++++++-- client/src/graphql/jobs.queries.js | 1 + client/src/pages/jobs-close/jobs-close.component.jsx | 7 ++++--- .../pages/jobs-detail/jobs-detail.page.container.jsx | 10 ++++++---- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx b/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx index a22d3db82..31f12fdd5 100644 --- a/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx +++ b/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx @@ -14,7 +14,8 @@ export function JobsCloseAutoAllocate({ setLabmatAllocations, partsAllocations, setPartsAllocations, - invoiced + + disabled, }) { const { t } = useTranslation(); const handleAllocate = () => { @@ -63,6 +64,10 @@ export function JobsCloseAutoAllocate({ }); }; - return ; + return ( + + ); } export default connect(mapStateToProps, null)(JobsCloseAutoAllocate); diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index 93e092378..f8ffee563 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -836,6 +836,7 @@ export const QUERY_JOB_CLOSE_DETAILS = gql` rate_matd status owner_owing + date_exported joblines { id tax_part diff --git a/client/src/pages/jobs-close/jobs-close.component.jsx b/client/src/pages/jobs-close/jobs-close.component.jsx index 4243b5634..1fc034ceb 100644 --- a/client/src/pages/jobs-close/jobs-close.component.jsx +++ b/client/src/pages/jobs-close/jobs-close.component.jsx @@ -109,6 +109,7 @@ export function JobsCloseComponent({ job, bodyshop, jobTotals }) { partsAllocations={partsAllocations} labMatAllocations={labmatAllocations} jobTotals={jobTotals} + disabled={!!job.date_exported} suspenseAmount={jobTotals.totals.subtotal .subtract(labmatAllocatedTotal) .subtract(partsAllocatedTotal) @@ -125,19 +126,19 @@ export function JobsCloseComponent({ job, bodyshop, jobTotals }) { setLabmatAllocations={setLabmatAllocations} partsAllocations={partsAllocations} setPartsAllocations={setPartsAllocations} - invoiced={invoiced} + disabled={!!job.date_exported} /> ); diff --git a/client/src/pages/jobs-detail/jobs-detail.page.container.jsx b/client/src/pages/jobs-detail/jobs-detail.page.container.jsx index d85d49936..23ad9f659 100644 --- a/client/src/pages/jobs-detail/jobs-detail.page.container.jsx +++ b/client/src/pages/jobs-detail/jobs-detail.page.container.jsx @@ -19,10 +19,10 @@ import { connect } from "react-redux"; const mapDispatchToProps = (dispatch) => ({ setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)), - addRecentItem: (item) => dispatch(setrecentItem(item)), + addRecentItem: (item) => dispatch(addRecentItem(item)), }); -function JobsDetailPageContainer({ match, setBreadcrumbs,addRecentItem }) { +function JobsDetailPageContainer({ match, setBreadcrumbs, addRecentItem }) { const { jobId } = match.params; const { t } = useTranslation(); @@ -74,7 +74,9 @@ function JobsDetailPageContainer({ match, setBreadcrumbs,addRecentItem }) { }, [loading, data, t, error, setBreadcrumbs, jobId]); if (loading) return ; - if (error) return ; + if (error) return ; + + if (data) addRecentItem({ id: 1234, label: " abcd" }); return data.jobs_by_pk ? ( ) : ( - + ); } export default connect(null, mapDispatchToProps)(JobsDetailPageContainer);