WIP on several user stories. BOD-10 BOD-52
This commit is contained in:
@@ -63,13 +63,20 @@ function JobsCreateContainer({ bodyshop }) {
|
||||
let ownerData;
|
||||
if (!!job.owner) {
|
||||
ownerData = job.owner.data;
|
||||
ownerData.shopid = bodyshop.id;
|
||||
delete ownerData.allow_text_message;
|
||||
delete ownerData.preferred_contact;
|
||||
delete job.ownerid;
|
||||
} else {
|
||||
ownerData = RemoteOwnerData.data.owners_by_pk;
|
||||
delete ownerData.id;
|
||||
delete ownerData.__typename;
|
||||
}
|
||||
if (!!job.vehicle) {
|
||||
delete job.vehicleid;
|
||||
job.vehicle.data.shopid = bodyshop.id;
|
||||
}
|
||||
|
||||
job = { ...job, ...ownerData };
|
||||
runInsertJob(job);
|
||||
};
|
||||
|
||||
@@ -43,9 +43,7 @@ const ShopVendorPageContainer = lazy(() =>
|
||||
const EmailOverlayContainer = lazy(() =>
|
||||
import("../../components/email-overlay/email-overlay.container.jsx")
|
||||
);
|
||||
const GlobalLoadingBar = lazy(() =>
|
||||
import("../../components/global-loading-bar/global-loading-bar.component")
|
||||
);
|
||||
|
||||
const JobsCreateContainerPage = lazy(() =>
|
||||
import("../jobs-create/jobs-create.container")
|
||||
);
|
||||
@@ -66,16 +64,13 @@ export default function Manage({ match }) {
|
||||
</Header>
|
||||
<Layout>
|
||||
<Content
|
||||
className="content-container"
|
||||
style={{ padding: "0em 4em 4em" }}
|
||||
>
|
||||
<GlobalLoadingBar />
|
||||
className='content-container'
|
||||
style={{ padding: "0em 4em 4em" }}>
|
||||
<ErrorBoundary>
|
||||
<Suspense
|
||||
fallback={
|
||||
<LoadingSpinner message={t("general.labels.loadingapp")} />
|
||||
}
|
||||
>
|
||||
}>
|
||||
<EmailOverlayContainer />
|
||||
<Route exact path={`${match.path}`} component={ManageRootPage} />
|
||||
<Route exact path={`${match.path}/jobs`} component={JobsPage} />
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
import { useQuery } from "@apollo/react-hooks";
|
||||
import { notification } from "antd";
|
||||
import React, { useEffect } from "react";
|
||||
import { useQuery } from "@apollo/react-hooks";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
|
||||
import { QUERY_BODYSHOP } from "../../graphql/bodyshop.queries";
|
||||
import { setBodyshop } from "../../redux/user/user.actions";
|
||||
import {
|
||||
selectBodyshop,
|
||||
selectCurrentUser
|
||||
} from "../../redux/user/user.selectors";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import ManagePage from "./manage.page.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
currentUser: selectCurrentUser,
|
||||
bodyshop: selectBodyshop
|
||||
});
|
||||
|
||||
@@ -22,13 +18,11 @@ const mapDispatchToProps = dispatch => ({
|
||||
setBodyshop: bs => dispatch(setBodyshop(bs))
|
||||
});
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(function ManagePageContainer({ match, setBodyshop, bodyshop }) {
|
||||
function ManagePageContainer({ match, setBodyshop, bodyshop }) {
|
||||
const { error, data } = useQuery(QUERY_BODYSHOP, {
|
||||
fetchPolicy: "network-only"
|
||||
});
|
||||
|
||||
const { t } = useTranslation();
|
||||
if (error) {
|
||||
notification["error"]({ message: t("bodyshop.errors.loading") });
|
||||
@@ -36,10 +30,14 @@ export default connect(
|
||||
|
||||
useEffect(() => {
|
||||
if (data) setBodyshop(data.bodyshops[0]);
|
||||
return () => {};
|
||||
}, [data, setBodyshop]);
|
||||
|
||||
if (!bodyshop)
|
||||
return <LoadingSpinner message={t("general.labels.loadingshop")} />;
|
||||
return <ManagePage match={match} />;
|
||||
});
|
||||
}
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(ManagePageContainer);
|
||||
|
||||
Reference in New Issue
Block a user