Changes to recent items BOD-178
This commit is contained in:
@@ -14,7 +14,8 @@ export function JobsCloseAutoAllocate({
|
|||||||
setLabmatAllocations,
|
setLabmatAllocations,
|
||||||
partsAllocations,
|
partsAllocations,
|
||||||
setPartsAllocations,
|
setPartsAllocations,
|
||||||
invoiced
|
|
||||||
|
disabled,
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const handleAllocate = () => {
|
const handleAllocate = () => {
|
||||||
@@ -63,6 +64,10 @@ export function JobsCloseAutoAllocate({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return <Button onClick={handleAllocate} disabled={invoiced}>{t("jobs.actions.autoallocate")}</Button>;
|
return (
|
||||||
|
<Button onClick={handleAllocate} disabled={disabled}>
|
||||||
|
{t("jobs.actions.autoallocate")}
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
export default connect(mapStateToProps, null)(JobsCloseAutoAllocate);
|
export default connect(mapStateToProps, null)(JobsCloseAutoAllocate);
|
||||||
|
|||||||
@@ -836,6 +836,7 @@ export const QUERY_JOB_CLOSE_DETAILS = gql`
|
|||||||
rate_matd
|
rate_matd
|
||||||
status
|
status
|
||||||
owner_owing
|
owner_owing
|
||||||
|
date_exported
|
||||||
joblines {
|
joblines {
|
||||||
id
|
id
|
||||||
tax_part
|
tax_part
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ export function JobsCloseComponent({ job, bodyshop, jobTotals }) {
|
|||||||
partsAllocations={partsAllocations}
|
partsAllocations={partsAllocations}
|
||||||
labMatAllocations={labmatAllocations}
|
labMatAllocations={labmatAllocations}
|
||||||
jobTotals={jobTotals}
|
jobTotals={jobTotals}
|
||||||
|
disabled={!!job.date_exported}
|
||||||
suspenseAmount={jobTotals.totals.subtotal
|
suspenseAmount={jobTotals.totals.subtotal
|
||||||
.subtract(labmatAllocatedTotal)
|
.subtract(labmatAllocatedTotal)
|
||||||
.subtract(partsAllocatedTotal)
|
.subtract(partsAllocatedTotal)
|
||||||
@@ -125,19 +126,19 @@ export function JobsCloseComponent({ job, bodyshop, jobTotals }) {
|
|||||||
setLabmatAllocations={setLabmatAllocations}
|
setLabmatAllocations={setLabmatAllocations}
|
||||||
partsAllocations={partsAllocations}
|
partsAllocations={partsAllocations}
|
||||||
setPartsAllocations={setPartsAllocations}
|
setPartsAllocations={setPartsAllocations}
|
||||||
invoiced={invoiced}
|
disabled={!!job.date_exported}
|
||||||
/>
|
/>
|
||||||
<JobsCloseLaborMaterialAllocation
|
<JobsCloseLaborMaterialAllocation
|
||||||
labmatAllocations={labmatAllocations}
|
labmatAllocations={labmatAllocations}
|
||||||
setLabmatAllocations={setLabmatAllocations}
|
setLabmatAllocations={setLabmatAllocations}
|
||||||
labMatTotalAllocation={labmatAllocatedTotal}
|
labMatTotalAllocation={labmatAllocatedTotal}
|
||||||
invoiced={invoiced}
|
invoiced={!!job.date_exported}
|
||||||
/>
|
/>
|
||||||
<JobsClosePartsAllocation
|
<JobsClosePartsAllocation
|
||||||
partsAllocations={partsAllocations}
|
partsAllocations={partsAllocations}
|
||||||
setPartsAllocations={setPartsAllocations}
|
setPartsAllocations={setPartsAllocations}
|
||||||
partsAllocatedTotal={partsAllocatedTotal}
|
partsAllocatedTotal={partsAllocatedTotal}
|
||||||
invoiced={invoiced}
|
invoiced={!!job.date_exported}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ import { connect } from "react-redux";
|
|||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
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 { jobId } = match.params;
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
@@ -74,7 +74,9 @@ function JobsDetailPageContainer({ match, setBreadcrumbs,addRecentItem }) {
|
|||||||
}, [loading, data, t, error, setBreadcrumbs, jobId]);
|
}, [loading, data, t, error, setBreadcrumbs, jobId]);
|
||||||
|
|
||||||
if (loading) return <SpinComponent />;
|
if (loading) return <SpinComponent />;
|
||||||
if (error) return <AlertComponent message={error.message} type='error' />;
|
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||||
|
|
||||||
|
if (data) addRecentItem({ id: 1234, label: " abcd" });
|
||||||
|
|
||||||
return data.jobs_by_pk ? (
|
return data.jobs_by_pk ? (
|
||||||
<JobsDetailPage
|
<JobsDetailPage
|
||||||
@@ -85,7 +87,7 @@ function JobsDetailPageContainer({ match, setBreadcrumbs,addRecentItem }) {
|
|||||||
updateJobStatus={updateJobStatus}
|
updateJobStatus={updateJobStatus}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<AlertComponent message={t("jobs.errors.noaccess")} type='error' />
|
<AlertComponent message={t("jobs.errors.noaccess")} type="error" />
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
export default connect(null, mapDispatchToProps)(JobsDetailPageContainer);
|
export default connect(null, mapDispatchToProps)(JobsDetailPageContainer);
|
||||||
|
|||||||
Reference in New Issue
Block a user