generalized job checklist functionality & created deliver checklist. BOD-376
This commit is contained in:
@@ -5,7 +5,7 @@ import { connect } from "react-redux";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import AlertComponent from "../../components/alert/alert.component";
|
||||
import JobIntakeComponent from "../../components/job-intake/job-intake.component";
|
||||
import JobChecklist from "../../components/job-checklist/job-checklist.component";
|
||||
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
|
||||
import { QUERY_INTAKE_CHECKLIST } from "../../graphql/bodyshop.queries";
|
||||
import { setBreadcrumbs } from "../../redux/application/application.actions";
|
||||
@@ -22,11 +22,11 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
|
||||
export function JobsIntakeContainer({ bodyshop, setBreadcrumbs }) {
|
||||
const { t } = useTranslation();
|
||||
const { jobId } = useParams();
|
||||
|
||||
const { loading, error, data } = useQuery(QUERY_INTAKE_CHECKLIST, {
|
||||
variables: { shopId: bodyshop.id },
|
||||
variables: { shopId: bodyshop.id, jobId: jobId },
|
||||
});
|
||||
const { jobId } = useParams();
|
||||
|
||||
useEffect(() => {
|
||||
document.title = t("titles.jobs-intake");
|
||||
@@ -34,14 +34,18 @@ export function JobsIntakeContainer({ bodyshop, setBreadcrumbs }) {
|
||||
{ link: "/manage/jobs", label: t("titles.bc.jobs") },
|
||||
{
|
||||
link: `/manage/jobs/${jobId}`,
|
||||
label: t("titles.bc.jobs-detail", { number: "TODO" }),
|
||||
label: t("titles.bc.jobs-detail", {
|
||||
number:
|
||||
(data && data.jobs_by_pk && data.jobs_by_pk.ro_number) ||
|
||||
data.jobs_by_pk.est_number,
|
||||
}),
|
||||
},
|
||||
{
|
||||
link: `/manage/jobs/${jobId}/intake`,
|
||||
label: t("titles.bc.jobs-intake"),
|
||||
},
|
||||
]);
|
||||
}, [t, setBreadcrumbs, jobId]);
|
||||
}, [t, setBreadcrumbs, jobId, data]);
|
||||
|
||||
if (loading) return <LoadingSpinner />;
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
@@ -52,10 +56,9 @@ export function JobsIntakeContainer({ bodyshop, setBreadcrumbs }) {
|
||||
return (
|
||||
<RbacWrapper action="jobs:intake">
|
||||
<div>
|
||||
<JobIntakeComponent
|
||||
intakeChecklistConfig={
|
||||
(data && data.bodyshops_by_pk.intakechecklist) || {}
|
||||
}
|
||||
<JobChecklist
|
||||
type="intake"
|
||||
checklistConfig={(data && data.bodyshops_by_pk.intakechecklist) || {}}
|
||||
/>
|
||||
</div>
|
||||
</RbacWrapper>
|
||||
|
||||
Reference in New Issue
Block a user