Added job intake process for BOD-114
This commit is contained in:
@@ -1,18 +1,13 @@
|
||||
import { Col, Row } from "antd";
|
||||
import React, { useEffect } from "react";
|
||||
import InvoicesByVendorList from "../../components/invoices-by-vendor-list/invoices-by-vendor-list.component";
|
||||
import VendorsList from "../../components/invoices-vendors-list/invoices-vendors-list.component";
|
||||
import InvoiceDetailEditContainer from "../../components/invoice-detail-edit/invoice-detail-edit.container";
|
||||
import { setBreadcrumbs } from "../../redux/application/application.actions";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import InvoiceDetailEditContainer from "../../components/invoice-detail-edit/invoice-detail-edit.container";
|
||||
import InvoicesByVendorList from "../../components/invoices-by-vendor-list/invoices-by-vendor-list.component";
|
||||
import VendorsList from "../../components/invoices-vendors-list/invoices-vendors-list.component";
|
||||
import { setBreadcrumbs } from "../../redux/application/application.actions";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||
});
|
||||
|
||||
@@ -41,7 +36,4 @@ export function InvoicesPageContainer({ setBreadcrumbs }) {
|
||||
</Row>
|
||||
);
|
||||
}
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(InvoicesPageContainer);
|
||||
export default connect(null, mapDispatchToProps)(InvoicesPageContainer);
|
||||
|
||||
90
client/src/pages/jobs-intake/jobs-intake.page.container.jsx
Normal file
90
client/src/pages/jobs-intake/jobs-intake.page.container.jsx
Normal file
@@ -0,0 +1,90 @@
|
||||
import React, { useEffect } from "react";
|
||||
import { useQuery } from "@apollo/react-hooks";
|
||||
import { QUERY_INTAKE_CHECKLIST } from "../../graphql/bodyshop.queries";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { useParams } from "react-router-dom";
|
||||
import AlertComponent from "../../components/alert/alert.component";
|
||||
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { setBreadcrumbs } from "../../redux/application/application.actions";
|
||||
import JobIntakeComponent from "../../components/job-intake/job-intake.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||
});
|
||||
|
||||
export function JobsIntakeContainer({ bodyshop, setBreadcrumbs }) {
|
||||
const { t } = useTranslation();
|
||||
const { loading, error, data } = useQuery(QUERY_INTAKE_CHECKLIST, {
|
||||
variables: { shopId: bodyshop.id },
|
||||
});
|
||||
const { jobId } = useParams();
|
||||
|
||||
useEffect(() => {
|
||||
document.title = t("titles.jobs-intake");
|
||||
setBreadcrumbs([
|
||||
{ link: "/manage/jobs", label: t("titles.bc.jobs") },
|
||||
{
|
||||
link: `/manage/jobs/${jobId}`,
|
||||
label: t("titles.bc.jobs-detail", { number: "TODO" }),
|
||||
},
|
||||
{
|
||||
link: `/manage/jobs/${jobId}/intake`,
|
||||
label: t("titles.bc.jobs-intake"),
|
||||
},
|
||||
]);
|
||||
}, [t, setBreadcrumbs, jobId]);
|
||||
|
||||
if (loading) return <LoadingSpinner />;
|
||||
if (error) return <AlertComponent message={error.message} type='error' />;
|
||||
// if (data && !!!data.bodyshops_by_pk.intakechecklist)
|
||||
// return (
|
||||
// <AlertComponent message={t("intake.errors.nochecklist")} type='error' />
|
||||
// );
|
||||
return (
|
||||
<div>
|
||||
<JobIntakeComponent intakeChecklistConfig={testConfig} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(JobsIntakeContainer);
|
||||
|
||||
const testConfig = {
|
||||
form: [
|
||||
{
|
||||
name: "item1",
|
||||
label: "Checklist Item 1",
|
||||
required: true,
|
||||
type: "checkbox",
|
||||
},
|
||||
{
|
||||
name: "item2",
|
||||
label: "Checklist Item 2",
|
||||
required: true,
|
||||
type: "checkbox",
|
||||
},
|
||||
{
|
||||
name: "item3",
|
||||
label: "Checklist Item 3",
|
||||
required: true,
|
||||
type: "checkbox",
|
||||
},
|
||||
{
|
||||
name: "item4",
|
||||
label: "Checklist Item 4",
|
||||
required: true,
|
||||
type: "checkbox",
|
||||
},
|
||||
],
|
||||
templates: ["estimate_detail", "estimate_detail2"],
|
||||
};
|
||||
@@ -85,6 +85,9 @@ const ProductionBoardPage = lazy(() =>
|
||||
const ShopTemplates = lazy(() =>
|
||||
import("../shop-templates/shop-templates.container")
|
||||
);
|
||||
const JobIntake = lazy(() =>
|
||||
import("../jobs-intake/jobs-intake.page.container")
|
||||
);
|
||||
const { Header, Content, Footer } = Layout;
|
||||
|
||||
export default function Manage({ match }) {
|
||||
@@ -116,14 +119,19 @@ export default function Manage({ match }) {
|
||||
<PrintCenterModalContainer />
|
||||
<Route exact path={`${match.path}`} component={ManageRootPage} />
|
||||
<Route exact path={`${match.path}/jobs`} component={JobsPage} />
|
||||
|
||||
<Switch>
|
||||
<Route
|
||||
exact
|
||||
path={`${match.path}/jobs/:jobId/intake`}
|
||||
component={JobIntake}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path={`${match.path}/jobs/new`}
|
||||
component={JobsCreateContainerPage}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path={`${match.path}/jobs/:jobId`}
|
||||
component={JobsDetailPage}
|
||||
/>
|
||||
@@ -188,7 +196,6 @@ export default function Manage({ match }) {
|
||||
path={`${match.path}/vehicles/:vehId`}
|
||||
component={VehiclesDetailContainer}
|
||||
/>
|
||||
|
||||
<Route
|
||||
exact
|
||||
path={`${match.path}/invoices`}
|
||||
@@ -199,7 +206,6 @@ export default function Manage({ match }) {
|
||||
path={`${match.path}/invoices/:invoiceId`}
|
||||
component={InvoiceDetailPage}
|
||||
/>
|
||||
|
||||
<Route
|
||||
exact
|
||||
path={`${match.path}/owners`}
|
||||
|
||||
Reference in New Issue
Block a user