Changes to recent items BOD-178
This commit is contained in:
@@ -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 <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);
|
||||
|
||||
@@ -836,6 +836,7 @@ export const QUERY_JOB_CLOSE_DETAILS = gql`
|
||||
rate_matd
|
||||
status
|
||||
owner_owing
|
||||
date_exported
|
||||
joblines {
|
||||
id
|
||||
tax_part
|
||||
|
||||
@@ -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}
|
||||
/>
|
||||
<JobsCloseLaborMaterialAllocation
|
||||
labmatAllocations={labmatAllocations}
|
||||
setLabmatAllocations={setLabmatAllocations}
|
||||
labMatTotalAllocation={labmatAllocatedTotal}
|
||||
invoiced={invoiced}
|
||||
invoiced={!!job.date_exported}
|
||||
/>
|
||||
<JobsClosePartsAllocation
|
||||
partsAllocations={partsAllocations}
|
||||
setPartsAllocations={setPartsAllocations}
|
||||
partsAllocatedTotal={partsAllocatedTotal}
|
||||
invoiced={invoiced}
|
||||
invoiced={!!job.date_exported}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -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 <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 ? (
|
||||
<JobsDetailPage
|
||||
@@ -85,7 +87,7 @@ function JobsDetailPageContainer({ match, setBreadcrumbs,addRecentItem }) {
|
||||
updateJobStatus={updateJobStatus}
|
||||
/>
|
||||
) : (
|
||||
<AlertComponent message={t("jobs.errors.noaccess")} type='error' />
|
||||
<AlertComponent message={t("jobs.errors.noaccess")} type="error" />
|
||||
);
|
||||
}
|
||||
export default connect(null, mapDispatchToProps)(JobsDetailPageContainer);
|
||||
|
||||
Reference in New Issue
Block a user