bug fixes on intake BOD-114
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
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 React, { useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { setBreadcrumbs } from "../../redux/application/application.actions";
|
||||
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 LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
|
||||
import { QUERY_INTAKE_CHECKLIST } from "../../graphql/bodyshop.queries";
|
||||
import { setBreadcrumbs } from "../../redux/application/application.actions";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -21,6 +20,7 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
|
||||
export function JobsIntakeContainer({ bodyshop, setBreadcrumbs }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { loading, error, data } = useQuery(QUERY_INTAKE_CHECKLIST, {
|
||||
variables: { shopId: bodyshop.id },
|
||||
});
|
||||
@@ -43,13 +43,17 @@ export function JobsIntakeContainer({ bodyshop, setBreadcrumbs }) {
|
||||
|
||||
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' />
|
||||
// );
|
||||
if (data && !!!data.bodyshops_by_pk.intakechecklist)
|
||||
return (
|
||||
<AlertComponent message={t("intake.errors.nochecklist")} type='error' />
|
||||
);
|
||||
return (
|
||||
<div>
|
||||
<JobIntakeComponent intakeChecklistConfig={testConfig} />
|
||||
<JobIntakeComponent
|
||||
intakeChecklistConfig={
|
||||
(data && data.bodyshops_by_pk.intakechecklist) || {}
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -58,33 +62,3 @@ 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"],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user