diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index e1889fd73..25490894b 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -7561,6 +7561,48 @@ + + notfoundsub + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + notfoundtitle + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + rbacunauth false diff --git a/client/src/components/_test/test.component.jsx b/client/src/components/_test/test.component.jsx index 01005bddb..d554e405b 100644 --- a/client/src/components/_test/test.component.jsx +++ b/client/src/components/_test/test.component.jsx @@ -6,8 +6,6 @@ export default function Test() { console.log("handleQbSignIn -> result", result.data); // window.open(result.data, "_blank", "toolbar=0,location=0,menubar=0"); - var win; - var checkConnect; var parameters = "location=1,width=800,height=650"; parameters += ",left=" + @@ -16,7 +14,7 @@ export default function Test() { (window.screen.height - 650) / 2; // Launch Popup - win = window.open(result.data, "connectPopup", parameters); + window.open(result.data, "connectPopup", parameters); }; return ( diff --git a/client/src/components/not-found/not-found.component.jsx b/client/src/components/not-found/not-found.component.jsx new file mode 100644 index 000000000..3ecc6a307 --- /dev/null +++ b/client/src/components/not-found/not-found.component.jsx @@ -0,0 +1,16 @@ +import React from "react"; +import { Result } from "antd"; +import { useTranslation } from "react-i18next"; + +export default function NotFound() { + const { t } = useTranslation(); + return ( +
+ +
+ ); +} diff --git a/client/src/pages/contract-detail/contract-detail.page.container.jsx b/client/src/pages/contract-detail/contract-detail.page.container.jsx index 0e0baaff1..99e7f892a 100644 --- a/client/src/pages/contract-detail/contract-detail.page.container.jsx +++ b/client/src/pages/contract-detail/contract-detail.page.container.jsx @@ -19,6 +19,7 @@ import { } from "../../redux/application/application.actions"; import { CreateRecentItem } from "../../utils/create-recent-item"; import ContractDetailPageComponent from "./contract-detail.page.component"; +import NotFound from "../../components/not-found/not-found.component"; const mapDispatchToProps = (dispatch) => ({ setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)), @@ -41,7 +42,11 @@ export function ContractDetailPageContainer({ setBreadcrumbs, addRecentItem }) { : error ? t("titles.app") : t("titles.contracts-detail", { - id: (data && data.cccontracts_by_pk.agreementnumber) || "", + id: + (data && + data.cccontracts_by_pk && + data.cccontracts_by_pk.agreementnumber) || + "", }); setBreadcrumbs([ @@ -53,12 +58,16 @@ export function ContractDetailPageContainer({ setBreadcrumbs, addRecentItem }) { { link: "/manage/courtesycars/contracts/new", label: t("titles.bc.contracts-detail", { - number: (data && data.cccontracts_by_pk.agreementnumber) || "", + number: + (data && + data.cccontracts_by_pk && + data.cccontracts_by_pk.agreementnumber) || + "", }), }, ]); - if (data) + if (data && data.cccontracts_by_pk) addRecentItem( CreateRecentItem( contractId, @@ -88,12 +97,19 @@ export function ContractDetailPageContainer({ setBreadcrumbs, addRecentItem }) { }; useEffect(() => { - if (data) form.resetFields(); + if (data && data.cccontracts_by_pk) form.resetFields(); }, [data, form]); if (error) return ; if (loading) return ; + if (!!!data.cccontracts_by_pk) return ; + console.log( + "data.cccontracts_by_pk", + !!!data.cccontracts_by_pk, + data.cccontracts_by_pk + ); + return (
diff --git a/client/src/pages/courtesy-car-detail/courtesy-car-detail.page.container.jsx b/client/src/pages/courtesy-car-detail/courtesy-car-detail.page.container.jsx index 98f6c5a2e..f534c74b3 100644 --- a/client/src/pages/courtesy-car-detail/courtesy-car-detail.page.container.jsx +++ b/client/src/pages/courtesy-car-detail/courtesy-car-detail.page.container.jsx @@ -14,6 +14,8 @@ import { } from "../../redux/application/application.actions"; import { CreateRecentItem } from "../../utils/create-recent-item"; import CourtesyCarDetailPageComponent from "./courtesy-car-detail.page.component"; +import NotFound from "../../components/not-found/not-found.component"; +import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component"; const mapDispatchToProps = (dispatch) => ({ setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)), @@ -38,21 +40,29 @@ export function CourtesyCarDetailPageContainer({ : error ? t("titles.app") : t("titles.courtesycars-detail", { - id: (data && data.courtesycars_by_pk.fleet_number) || "", + id: + (data && + data.courtesycars_by_pk && + data.courtesycars_by_pk.fleet_number) || + "", }); setBreadcrumbs([ { link: "/manage/courtesycars", label: t("titles.bc.courtesycars") }, { link: `/manage/courtesycars/${ - (data && data.courtesycars_by_pk.id) || "" + (data && data.courtesycars_by_pk && data.courtesycars_by_pk.id) || "" }`, label: t("titles.bc.courtesycars-detail", { - number: (data && data.courtesycars_by_pk.fleetnumber) || "", + number: + (data && + data.courtesycars_by_pk && + data.courtesycars_by_pk.fleetnumber) || + "", }), }, ]); - if (data) + if (data && data.courtesycars_by_pk) addRecentItem( CreateRecentItem( ccId, @@ -84,10 +94,14 @@ export function CourtesyCarDetailPageContainer({ }; useEffect(() => { - if (data) form.resetFields(); + if (data && data.courtesycars_by_pk) form.resetFields(); }, [data, form]); + if (loading) return ; if (error) return ; + + if (!!!data.courtesycars_by_pk) return ; + return (
({ setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)), }); -export function JobsCloseContainer({ setBreadcrumbs, bodyshop }) { +export function JobsCloseContainer({ setBreadcrumbs }) { const { jobId } = useParams(); const { loading, error, data } = useQuery(QUERY_JOB_CLOSE_DETAILS, { variables: { id: jobId }, @@ -28,7 +23,7 @@ export function JobsCloseContainer({ setBreadcrumbs, bodyshop }) { const { t } = useTranslation(); useEffect(() => { document.title = t("titles.jobs-close", { - number: data ? data.jobs_by_pk.ro_number : null, + number: data ? data.jobs_by_pk && data.jobs_by_pk.ro_number : null, }); setBreadcrumbs([ @@ -39,7 +34,7 @@ export function JobsCloseContainer({ setBreadcrumbs, bodyshop }) { { link: `/manage/jobs/${jobId}/`, label: t("titles.bc.jobs-detail", { - number: data ? data.jobs_by_pk.ro_number : null, + number: data ? data.jobs_by_pk && data.jobs_by_pk.ro_number : null, }), }, { @@ -51,6 +46,7 @@ export function JobsCloseContainer({ setBreadcrumbs, bodyshop }) { if (loading) return ; if (error) return ; + if (!!!data.jobs_by_pk) return ; return ( @@ -63,4 +59,4 @@ export function JobsCloseContainer({ setBreadcrumbs, bodyshop }) { ); } -export default connect(mapStateToProps, mapDispatchToProps)(JobsCloseContainer); +export default connect(null, mapDispatchToProps)(JobsCloseContainer); diff --git a/client/src/pages/jobs-detail/jobs-detail.page.container.jsx b/client/src/pages/jobs-detail/jobs-detail.page.container.jsx index 274a136ce..f3c936a48 100644 --- a/client/src/pages/jobs-detail/jobs-detail.page.container.jsx +++ b/client/src/pages/jobs-detail/jobs-detail.page.container.jsx @@ -17,6 +17,7 @@ import { } from "../../redux/application/application.actions"; import { CreateRecentItem } from "../../utils/create-recent-item"; import JobsDetailPage from "./jobs-detail.page.component"; +import NotFound from "../../components/not-found/not-found.component"; const mapDispatchToProps = (dispatch) => ({ setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)), @@ -53,9 +54,10 @@ function JobsDetailPageContainer({ match, setBreadcrumbs, addRecentItem }) { : error ? t("titles.app") : t("titles.jobsdetail", { - ro_number: data.jobs_by_pk.converted - ? data.jobs_by_pk.ro_number - : `EST ${data.jobs_by_pk.est_number}`, + ro_number: + data.jobs_by_pk && data.jobs_by_pk.converted + ? data.jobs_by_pk && data.jobs_by_pk.ro_number + : `EST ${data.jobs_by_pk && data.jobs_by_pk.est_number}`, }); setBreadcrumbs([ { link: "/manage/jobs", label: t("titles.bc.jobs") }, @@ -64,15 +66,16 @@ function JobsDetailPageContainer({ match, setBreadcrumbs, addRecentItem }) { label: t("titles.bc.jobs-detail", { number: (data && - (data.jobs_by_pk.converted - ? data && data.jobs_by_pk.ro_number - : `EST ${data.jobs_by_pk.est_number}`)) || + data.jobs_by_pk && + (data.jobs_by_pk && data.jobs_by_pk.converted + ? data && data.jobs_by_pk && data.jobs_by_pk.ro_number + : `EST ${data.jobs_by_pk && data.jobs_by_pk.est_number}`)) || "", }), }, ]); - if (data) + if (data && data.jobs_by_pk) addRecentItem( CreateRecentItem( jobId, @@ -87,6 +90,7 @@ function JobsDetailPageContainer({ match, setBreadcrumbs, addRecentItem }) { if (loading) return ; if (error) return ; + if (!!!data.jobs_by_pk) return ; return data.jobs_by_pk ? ( diff --git a/client/src/redux/user/user.sagas.js b/client/src/redux/user/user.sagas.js index 5552148d6..f0148fb55 100644 --- a/client/src/redux/user/user.sagas.js +++ b/client/src/redux/user/user.sagas.js @@ -64,8 +64,6 @@ export function* isUserAuthenticated() { return; } - console.log(yield auth.currentUser.getIdToken(true)); - LogRocket.identify(user.email); yield put( signInSuccess({ diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index b2e450d6a..ba6b64e46 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -486,6 +486,8 @@ "exception": "$t(titles.app) has encountered an error. Please try again. If the problem persists, please submit a support ticket or contact us.", "newversionmessage": "Click refresh below to update to the latest available version of ImEX Online.", "newversiontitle": "New version of ImEX Online Available", + "notfoundsub": "Please make sure that you have access to the data or that the link is correct.", + "notfoundtitle": "We couldn't find what you're looking for...", "rbacunauth": "You are not authorized to view this content. Please reach out to your shop manager to change your access level.", "unsavedchanges": "You have unsaved changes.", "unsavedchangespopup": "You have unsaved changes. Are you sure you want to leave?" diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index a6538b63c..a39723a6f 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -486,6 +486,8 @@ "exception": "", "newversionmessage": "", "newversiontitle": "", + "notfoundsub": "", + "notfoundtitle": "", "rbacunauth": "", "unsavedchanges": "Usted tiene cambios no guardados.", "unsavedchangespopup": "" diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index e3eb27fb6..d05cf738a 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -486,6 +486,8 @@ "exception": "", "newversionmessage": "", "newversiontitle": "", + "notfoundsub": "", + "notfoundtitle": "", "rbacunauth": "", "unsavedchanges": "Vous avez des changements non enregistrés.", "unsavedchangespopup": ""