360 lines
12 KiB
JavaScript
360 lines
12 KiB
JavaScript
import { Elements } from "@stripe/react-stripe-js";
|
|
import { loadStripe } from "@stripe/stripe-js";
|
|
import { BackTop, Layout } from "antd";
|
|
import React, { lazy, Suspense, useEffect } from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
import { connect } from "react-redux";
|
|
import { Route, Switch } from "react-router-dom";
|
|
import { createStructuredSelector } from "reselect";
|
|
import { client } from "../../App/App.container";
|
|
import BreadCrumbs from "../../components/breadcrumbs/breadcrumbs.component";
|
|
import ChatAffixContainer from "../../components/chat-affix/chat-affix.container";
|
|
import ConflictComponent from "../../components/conflict/conflict.component";
|
|
import ErrorBoundary from "../../components/error-boundary/error-boundary.component";
|
|
import FcmNotification from "../../components/fcm-notification/fcm-notification.component";
|
|
//import FooterComponent from "../../components/footer/footer.component";
|
|
//Component Imports
|
|
import HeaderContainer from "../../components/header/header.container";
|
|
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
|
|
import PrintCenterModalContainer from "../../components/print-center-modal/print-center-modal.container";
|
|
import { QUERY_STRIPE_ID } from "../../graphql/bodyshop.queries";
|
|
import { selectInstanceConflict } from "../../redux/user/user.selectors";
|
|
import "./manage.page.styles.scss";
|
|
import TestComponent from "../../components/_test/test.component";
|
|
|
|
const ManageRootPage = lazy(() =>
|
|
import("../manage-root/manage-root.page.container")
|
|
);
|
|
const JobsPage = lazy(() => import("../jobs/jobs.page"));
|
|
const JobsDetailPage = lazy(() =>
|
|
import("../jobs-detail/jobs-detail.page.container")
|
|
);
|
|
const ProfilePage = lazy(() => import("../profile/profile.container.page"));
|
|
const JobsAvailablePage = lazy(() =>
|
|
import("../jobs-available/jobs-available.page.container")
|
|
);
|
|
const ScheduleContainer = lazy(() =>
|
|
import("../schedule/schedule.page.container")
|
|
);
|
|
const VehiclesContainer = lazy(() =>
|
|
import("../vehicles/vehicles.page.container")
|
|
);
|
|
const VehiclesDetailContainer = lazy(() =>
|
|
import("../vehicles-detail/vehicles-detail.page.container")
|
|
);
|
|
const OwnersContainer = lazy(() => import("../owners/owners.page.container"));
|
|
const OwnersDetailContainer = lazy(() =>
|
|
import("../owners-detail/owners-detail.page.container")
|
|
);
|
|
const ShopPage = lazy(() => import("../shop/shop.page.component"));
|
|
const ShopVendorPageContainer = lazy(() =>
|
|
import("../shop-vendor/shop-vendor.page.container")
|
|
);
|
|
const EmailOverlayContainer = lazy(() =>
|
|
import("../../components/email-overlay/email-overlay.container.jsx")
|
|
);
|
|
const JobsCreateContainerPage = lazy(() =>
|
|
import("../jobs-create/jobs-create.container")
|
|
);
|
|
const CourtesyCarCreateContainer = lazy(() =>
|
|
import("../courtesy-car-create/courtesy-car-create.page.container")
|
|
);
|
|
const CourtesyCarDetailContainer = lazy(() =>
|
|
import("../courtesy-car-detail/courtesy-car-detail.page.container")
|
|
);
|
|
const CourtesyCarsPage = lazy(() =>
|
|
import("../courtesy-cars/courtesy-cars.page.container")
|
|
);
|
|
const ContractCreatePage = lazy(() =>
|
|
import("../contract-create/contract-create.page.container")
|
|
);
|
|
const ContractDetailPage = lazy(() =>
|
|
import("../contract-detail/contract-detail.page.container")
|
|
);
|
|
const ContractsList = lazy(() =>
|
|
import("../contracts/contracts.page.container")
|
|
);
|
|
const InvoicesListPage = lazy(() =>
|
|
import("../invoices/invoices.page.container")
|
|
);
|
|
|
|
const JobCostingModal = lazy(() =>
|
|
import("../../components/job-costing-modal/job-costing-modal.container")
|
|
);
|
|
const EnterInvoiceModalContainer = lazy(() =>
|
|
import("../../components/invoice-enter-modal/invoice-enter-modal.container")
|
|
);
|
|
const TimeTicketModalContainer = lazy(() =>
|
|
import("../../components/time-ticket-modal/time-ticket-modal.container")
|
|
);
|
|
const PaymentModalContainer = lazy(() =>
|
|
import("../../components/payment-modal/payment-modal.container")
|
|
);
|
|
const ProductionListPage = lazy(() =>
|
|
import("../production-list/production-list.container")
|
|
);
|
|
const ProductionBoardPage = lazy(() =>
|
|
import("../production-board/production-board.container")
|
|
);
|
|
const ShopTemplates = lazy(() =>
|
|
import("../shop-templates/shop-templates.container")
|
|
);
|
|
const JobIntake = lazy(() =>
|
|
import("../jobs-intake/jobs-intake.page.container")
|
|
);
|
|
const AccountingReceivables = lazy(() =>
|
|
import("../accounting-receivables/accounting-receivables.container")
|
|
);
|
|
const AccountingPayables = lazy(() =>
|
|
import("../accounting-payables/accounting-payables.container")
|
|
);
|
|
const AccountingPayments = lazy(() =>
|
|
import("../accounting-payments/accounting-payments.container")
|
|
);
|
|
const AllJobs = lazy(() => import("../jobs-all/jobs-all.container"));
|
|
const JobsClose = lazy(() => import("../jobs-close/jobs-close.container"));
|
|
const ShopCsiPageContainer = lazy(() =>
|
|
import("../shop-csi/shop-csi.container.page")
|
|
);
|
|
const PaymentsAll = lazy(() =>
|
|
import("../payments-all/payments-all.container.page")
|
|
);
|
|
const ShiftClock = lazy(() => import("../shift-clock/shift-clock.page"));
|
|
const Scoreboard = lazy(() =>
|
|
import("../scoreboard/scoreboard.page.container")
|
|
);
|
|
const TimeTicketsAll = lazy(() =>
|
|
import("../time-tickets/time-tickets.container")
|
|
);
|
|
|
|
const { Content } = Layout;
|
|
|
|
const stripePromise = new Promise((resolve, reject) => {
|
|
client.query({ query: QUERY_STRIPE_ID }).then((resp) => {
|
|
resolve(
|
|
loadStripe(process.env.REACT_APP_STRIPE_PUBLIC_KEY, {
|
|
stripeAccount: resp.data.bodyshops[0].stripe_acct_id || "",
|
|
})
|
|
);
|
|
});
|
|
});
|
|
|
|
const mapStateToProps = createStructuredSelector({
|
|
conflict: selectInstanceConflict,
|
|
});
|
|
|
|
export function Manage({ match, conflict }) {
|
|
const { t } = useTranslation();
|
|
|
|
useEffect(() => {
|
|
document.title = t("titles.app");
|
|
}, [t]);
|
|
|
|
return (
|
|
<Layout className="layout-container">
|
|
<HeaderContainer />
|
|
|
|
<Content className="content-container">
|
|
<FcmNotification />
|
|
<ErrorBoundary>
|
|
{conflict ? (
|
|
<ConflictComponent />
|
|
) : (
|
|
<Suspense
|
|
fallback={
|
|
<LoadingSpinner message={t("general.labels.loadingapp")} />
|
|
}
|
|
>
|
|
<Elements stripe={stripePromise}>
|
|
<PaymentModalContainer />
|
|
</Elements>
|
|
<BreadCrumbs />
|
|
<EnterInvoiceModalContainer />
|
|
<JobCostingModal />
|
|
<EmailOverlayContainer />
|
|
<TimeTicketModalContainer />
|
|
<PrintCenterModalContainer />
|
|
<Route
|
|
exact
|
|
path={`${match.path}/_test`}
|
|
component={TestComponent}
|
|
/>
|
|
<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/:jobId/close`}
|
|
component={JobsClose}
|
|
/>
|
|
<Route
|
|
exact
|
|
path={`${match.path}/jobs/all`}
|
|
component={AllJobs}
|
|
/>
|
|
<Route
|
|
exact
|
|
path={`${match.path}/jobs/new`}
|
|
component={JobsCreateContainerPage}
|
|
/>
|
|
<Route
|
|
path={`${match.path}/jobs/:jobId`}
|
|
component={JobsDetailPage}
|
|
/>
|
|
</Switch>
|
|
<Route
|
|
exact
|
|
path={`${match.path}/courtesycars/`}
|
|
component={CourtesyCarsPage}
|
|
/>
|
|
<Switch>
|
|
<Route
|
|
exact
|
|
path={`${match.path}/courtesycars/new`}
|
|
component={CourtesyCarCreateContainer}
|
|
/>
|
|
|
|
<Route
|
|
exact
|
|
path={`${match.path}/courtesycars/contracts`}
|
|
component={ContractsList}
|
|
/>
|
|
|
|
<Route
|
|
exact
|
|
path={`${match.path}/courtesycars/contracts/new`}
|
|
component={ContractCreatePage}
|
|
/>
|
|
<Route
|
|
exact
|
|
path={`${match.path}/courtesycars/contracts/:contractId`}
|
|
component={ContractDetailPage}
|
|
/>
|
|
|
|
<Route
|
|
exact
|
|
path={`${match.path}/courtesycars/:ccId`}
|
|
component={CourtesyCarDetailContainer}
|
|
/>
|
|
</Switch>
|
|
<Route
|
|
exact
|
|
path={`${match.path}/profile`}
|
|
component={ProfilePage}
|
|
/>
|
|
<Route
|
|
exact
|
|
path={`${match.path}/vehicles`}
|
|
component={VehiclesContainer}
|
|
/>
|
|
<Route
|
|
exact
|
|
path={`${match.path}/production/list`}
|
|
component={ProductionListPage}
|
|
/>
|
|
<Route
|
|
exact
|
|
path={`${match.path}/production/board`}
|
|
component={ProductionBoardPage}
|
|
/>
|
|
<Route
|
|
exact
|
|
path={`${match.path}/vehicles/:vehId`}
|
|
component={VehiclesDetailContainer}
|
|
/>
|
|
<Route
|
|
exact
|
|
path={`${match.path}/invoices`}
|
|
component={InvoicesListPage}
|
|
/>
|
|
<Route
|
|
exact
|
|
path={`${match.path}/owners`}
|
|
component={OwnersContainer}
|
|
/>
|
|
<Route
|
|
exact
|
|
path={`${match.path}/owners/:ownerId`}
|
|
component={OwnersDetailContainer}
|
|
/>
|
|
<Route
|
|
exact
|
|
path={`${match.path}/schedule`}
|
|
component={ScheduleContainer}
|
|
/>
|
|
<Route
|
|
exact
|
|
path={`${match.path}/available`}
|
|
component={JobsAvailablePage}
|
|
/>
|
|
<Route exact path={`${match.path}/shop/`} component={ShopPage} />
|
|
<Route
|
|
exact
|
|
path={`${match.path}/shop/templates`}
|
|
component={ShopTemplates}
|
|
/>
|
|
<Route
|
|
exact
|
|
path={`${match.path}/shop/vendors`}
|
|
component={ShopVendorPageContainer}
|
|
/>
|
|
<Route
|
|
exact
|
|
path={`${match.path}/shop/csi`}
|
|
component={ShopCsiPageContainer}
|
|
/>
|
|
<Route
|
|
exact
|
|
path={`${match.path}/accounting/receivables`}
|
|
component={AccountingReceivables}
|
|
/>
|
|
<Route
|
|
exact
|
|
path={`${match.path}/accounting/payables`}
|
|
component={AccountingPayables}
|
|
/>
|
|
<Route
|
|
exact
|
|
path={`${match.path}/accounting/payments`}
|
|
component={AccountingPayments}
|
|
/>
|
|
<Route
|
|
exact
|
|
path={`${match.path}/payments`}
|
|
component={PaymentsAll}
|
|
/>
|
|
<Route
|
|
exact
|
|
path={`${match.path}/shiftclock`}
|
|
component={ShiftClock}
|
|
/>
|
|
<Route
|
|
exact
|
|
path={`${match.path}/scoreboard`}
|
|
component={Scoreboard}
|
|
/>
|
|
<Route
|
|
exact
|
|
path={`${match.path}/timetickets`}
|
|
component={TimeTicketsAll}
|
|
/>
|
|
</Suspense>
|
|
)}
|
|
</ErrorBoundary>
|
|
<ChatAffixContainer />
|
|
<BackTop />
|
|
<div
|
|
style={{ textAlign: "center", margin: "1rem 0rem" }}
|
|
>{`ImEX Online V.${process.env.NODE_ENV}-${process.env.REACT_APP_GIT_SHA}`}</div>
|
|
</Content>
|
|
</Layout>
|
|
);
|
|
}
|
|
export default connect(mapStateToProps, null)(Manage);
|