- Simplified solution in previous commit
- Additional regression testing fixes Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -4,7 +4,7 @@ import { useMutation, useQuery } from "@apollo/client";
|
|||||||
import { MUTATION_TOGGLE_TASK_COMPLETED, MUTATION_TOGGLE_TASK_DELETED } from "../../graphql/tasks.queries.js";
|
import { MUTATION_TOGGLE_TASK_COMPLETED, MUTATION_TOGGLE_TASK_DELETED } from "../../graphql/tasks.queries.js";
|
||||||
import { pageLimit } from "../../utils/config.js";
|
import { pageLimit } from "../../utils/config.js";
|
||||||
import AlertComponent from "../alert/alert.component.jsx";
|
import AlertComponent from "../alert/alert.component.jsx";
|
||||||
import React, { useContext, useEffect } from "react";
|
import React from "react";
|
||||||
import TaskListComponent from "./task-list.component.jsx";
|
import TaskListComponent from "./task-list.component.jsx";
|
||||||
import { notification } from "antd";
|
import { notification } from "antd";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -14,7 +14,6 @@ import AuditTrailMapping from "../../utils/AuditTrailMappings.js";
|
|||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { selectBodyshop, selectCurrentUser } from "../../redux/user/user.selectors.js";
|
import { selectBodyshop, selectCurrentUser } from "../../redux/user/user.selectors.js";
|
||||||
import dayjs from "../../utils/day";
|
import dayjs from "../../utils/day";
|
||||||
import { SharedModalContext } from "../../providers/shared-modal.provider.jsx";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -41,7 +40,6 @@ export function TaskListContainer({
|
|||||||
const searchParams = queryString.parse(useLocation().search);
|
const searchParams = queryString.parse(useLocation().search);
|
||||||
const { page, sortcolumn, sortorder, deleted, completed, mine } = searchParams;
|
const { page, sortcolumn, sortorder, deleted, completed, mine } = searchParams;
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const { updateTaskQuery } = useContext(SharedModalContext); // Use the context
|
|
||||||
|
|
||||||
const { loading, error, data, refetch } = useQuery(query[Object.keys(query)[0]], {
|
const { loading, error, data, refetch } = useQuery(query[Object.keys(query)[0]], {
|
||||||
fetchPolicy: "network-only",
|
fetchPolicy: "network-only",
|
||||||
@@ -166,11 +164,6 @@ export function TaskListContainer({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Update the Last Task Paginated Query
|
|
||||||
useEffect(() => {
|
|
||||||
updateTaskQuery(Object.keys(query)[0]);
|
|
||||||
}, [query]);
|
|
||||||
|
|
||||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useMutation, useQuery } from "@apollo/client";
|
import { useMutation, useQuery } from "@apollo/client";
|
||||||
import { Form, Modal, notification } from "antd";
|
import { Form, Modal, notification } from "antd";
|
||||||
import React, { useContext, useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
@@ -15,7 +15,7 @@ import { useLocation, useNavigate } from "react-router-dom";
|
|||||||
import { insertAuditTrail } from "../../redux/application/application.actions.js";
|
import { insertAuditTrail } from "../../redux/application/application.actions.js";
|
||||||
import AuditTrailMapping from "../../utils/AuditTrailMappings.js";
|
import AuditTrailMapping from "../../utils/AuditTrailMappings.js";
|
||||||
import { isEqual } from "lodash";
|
import { isEqual } from "lodash";
|
||||||
import { SharedModalContext } from "../../providers/shared-modal.provider.jsx";
|
import refetchRouteMappings from "./task-upsert-modal.route.mappings.js";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
@@ -46,7 +46,6 @@ export function TaskUpsertModalContainer({ bodyshop, currentUser, taskUpsert, to
|
|||||||
variables: { id: jobIdState },
|
variables: { id: jobIdState },
|
||||||
skip: !jobIdState
|
skip: !jobIdState
|
||||||
});
|
});
|
||||||
const { taskQuery } = useContext(SharedModalContext);
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
loading: taskLoading,
|
loading: taskLoading,
|
||||||
@@ -108,25 +107,32 @@ export function TaskUpsertModalContainer({ bodyshop, currentUser, taskUpsert, to
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Task Query Refetch function to determine if we need to refetch the task query
|
* Handle refetch queries
|
||||||
* @returns {boolean}
|
* @param taskObject
|
||||||
*/
|
*/
|
||||||
const taskQueryRefetch = () =>
|
const handleRefetchQueries = (taskObject) => {
|
||||||
(!jobid || !joblineid || !billid || !partsorderid || !taskId) &&
|
if (query && Object.keys(query).length) {
|
||||||
taskQuery &&
|
taskObject.refetchQueries.push(Object.keys(query)[0]);
|
||||||
location.pathname.includes("/manage/tasks");
|
} else {
|
||||||
|
refetchRouteMappings.forEach((mapping) => {
|
||||||
|
if (location.pathname.includes(mapping.route)) {
|
||||||
|
taskObject.refetchQueries.push(mapping.query);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle existing task
|
* Handle existing task
|
||||||
|
* @param id
|
||||||
|
* @param jobId
|
||||||
* @param values
|
* @param values
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
const handleExistingTask = async (values) => {
|
const handleExistingTask = async (id, jobId, values) => {
|
||||||
const isAssignedToDirty = values.assigned_to !== existingTask.assigned_to;
|
|
||||||
|
|
||||||
const taskObject = {
|
const taskObject = {
|
||||||
variables: {
|
variables: {
|
||||||
taskId: existingTask.id,
|
taskId: id,
|
||||||
task: replaceUndefinedWithNull(values)
|
task: replaceUndefinedWithNull(values)
|
||||||
},
|
},
|
||||||
refetchQueries: []
|
refetchQueries: []
|
||||||
@@ -136,16 +142,11 @@ export function TaskUpsertModalContainer({ bodyshop, currentUser, taskUpsert, to
|
|||||||
taskObject.refetchQueries.push({
|
taskObject.refetchQueries.push({
|
||||||
query: GET_JOB_BY_PK,
|
query: GET_JOB_BY_PK,
|
||||||
variables: {
|
variables: {
|
||||||
id: existingTask.jobid
|
id: jobId
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// We have a relationship query, so we need to refetch the query
|
handleRefetchQueries(taskObject);
|
||||||
if (query && Object.keys(query).length) {
|
|
||||||
taskObject.refetchQueries.push(Object.keys(query)[0]);
|
|
||||||
} else if (taskQueryRefetch()) {
|
|
||||||
taskObject.refetchQueries.push(taskQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
const taskData = await updateTask(taskObject);
|
const taskData = await updateTask(taskObject);
|
||||||
|
|
||||||
@@ -196,7 +197,7 @@ export function TaskUpsertModalContainer({ bodyshop, currentUser, taskUpsert, to
|
|||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
const handleNewTask = async (values) => {
|
const handleNewTask = async (values) => {
|
||||||
const newTaskObject = {
|
const taskObject = {
|
||||||
variables: {
|
variables: {
|
||||||
taskInput: [
|
taskInput: [
|
||||||
{
|
{
|
||||||
@@ -210,7 +211,7 @@ export function TaskUpsertModalContainer({ bodyshop, currentUser, taskUpsert, to
|
|||||||
};
|
};
|
||||||
|
|
||||||
// We need to make sure this is updated everywhere
|
// We need to make sure this is updated everywhere
|
||||||
newTaskObject.refetchQueries.push({
|
taskObject.refetchQueries.push({
|
||||||
query: GET_JOB_BY_PK,
|
query: GET_JOB_BY_PK,
|
||||||
variables: {
|
variables: {
|
||||||
id: values.jobid
|
id: values.jobid
|
||||||
@@ -218,15 +219,10 @@ export function TaskUpsertModalContainer({ bodyshop, currentUser, taskUpsert, to
|
|||||||
});
|
});
|
||||||
|
|
||||||
// We have a relationship query, so we need to refetch the query
|
// We have a relationship query, so we need to refetch the query
|
||||||
if (query && Object.keys(query).length) {
|
handleRefetchQueries(taskObject);
|
||||||
newTaskObject.refetchQueries.push(Object.keys(query)[0]);
|
|
||||||
} else if (taskQueryRefetch()) {
|
|
||||||
newTaskObject.refetchQueries.push(taskQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
const newTaskData = await insertTask({ ...newTaskObject });
|
const newTaskData = await insertTask(taskObject);
|
||||||
const newTask = newTaskData?.data?.insert_tasks?.returning[0];
|
const newTask = newTaskData?.data?.insert_tasks?.returning[0];
|
||||||
const newTaskID = newTask?.id;
|
|
||||||
|
|
||||||
if (!newTaskData.errors) {
|
if (!newTaskData.errors) {
|
||||||
insertAuditTrail({
|
insertAuditTrail({
|
||||||
@@ -274,15 +270,16 @@ export function TaskUpsertModalContainer({ bodyshop, currentUser, taskUpsert, to
|
|||||||
* @returns {Promise<[{jobid, bodyshopid, created_by},...*]>}
|
* @returns {Promise<[{jobid, bodyshopid, created_by},...*]>}
|
||||||
*/
|
*/
|
||||||
const handleFinish = async (formValues) => {
|
const handleFinish = async (formValues) => {
|
||||||
if (existingTask) {
|
if (existingTask || taskData?.tasks_by_pk) {
|
||||||
|
const taskSource = existingTask || taskData?.tasks_by_pk;
|
||||||
const dirtyValues = Object.keys(formValues).reduce((acc, key) => {
|
const dirtyValues = Object.keys(formValues).reduce((acc, key) => {
|
||||||
if (!isEqual(formValues[key], existingTask[key])) {
|
if (!isEqual(formValues[key], taskSource[key])) {
|
||||||
acc[key] = formValues[key];
|
acc[key] = formValues[key];
|
||||||
}
|
}
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
try {
|
try {
|
||||||
await handleExistingTask(dirtyValues);
|
await handleExistingTask(taskSource.id, taskSource.jobid, dirtyValues);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
message: t("tasks.failures.updated")
|
message: t("tasks.failures.updated")
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import {
|
||||||
|
QUERY_ALL_TASKS_PAGINATED,
|
||||||
|
QUERY_JOB_TASKS_PAGINATED,
|
||||||
|
QUERY_MY_TASKS_PAGINATED
|
||||||
|
} from "../../graphql/tasks.queries.js";
|
||||||
|
|
||||||
|
const getQueryName = (query) => Object.keys(query)[0];
|
||||||
|
|
||||||
|
const refetchRouteMappings = [
|
||||||
|
{query: getQueryName({QUERY_MY_TASKS_PAGINATED}), route: "/manage/tasks/mytasks"},
|
||||||
|
{query: getQueryName({QUERY_ALL_TASKS_PAGINATED}), route: "/manage/tasks/alltasks"},
|
||||||
|
{query: getQueryName({QUERY_JOB_TASKS_PAGINATED}), route: "/manage/jobs"}
|
||||||
|
];
|
||||||
|
|
||||||
|
export default refetchRouteMappings;
|
||||||
@@ -27,7 +27,6 @@ import { setJoyRideFinished } from "../../redux/application/application.actions.
|
|||||||
import { selectEnableJoyRide, selectJoyRideSteps } from "../../redux/application/application.selectors.js";
|
import { selectEnableJoyRide, selectJoyRideSteps } from "../../redux/application/application.selectors.js";
|
||||||
import InstanceRenderManager from "../../utils/instanceRenderMgr.js";
|
import InstanceRenderManager from "../../utils/instanceRenderMgr.js";
|
||||||
import "./manage.page.styles.scss";
|
import "./manage.page.styles.scss";
|
||||||
import { SharedModalProvider } from "../../providers/shared-modal.provider.jsx";
|
|
||||||
|
|
||||||
const JobsPage = lazy(() => import("../jobs/jobs.page"));
|
const JobsPage = lazy(() => import("../jobs/jobs.page"));
|
||||||
|
|
||||||
@@ -152,425 +151,423 @@ export function Manage({ conflict, bodyshop, enableJoyRide, joyRideSteps, setJoy
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<SharedModalProvider>
|
<PaymentModalContainer />
|
||||||
<PaymentModalContainer />
|
<CardPaymentModalContainer />
|
||||||
<CardPaymentModalContainer />
|
<TaskUpsertModalContainer />
|
||||||
<TaskUpsertModalContainer />
|
<BreadCrumbs />
|
||||||
<BreadCrumbs />
|
<BillEnterModalContainer />
|
||||||
<BillEnterModalContainer />
|
<JobCostingModal />
|
||||||
<JobCostingModal />
|
<ReportCenterModal />
|
||||||
<ReportCenterModal />
|
<EmailOverlayContainer />
|
||||||
<EmailOverlayContainer />
|
<TimeTicketModalContainer />
|
||||||
<TimeTicketModalContainer />
|
<TimeTicketModalTask />
|
||||||
<TimeTicketModalTask />
|
<PrintCenterModalContainer />
|
||||||
<PrintCenterModalContainer />
|
<Routes>
|
||||||
<Routes>
|
<Route path="/_test" element={<TestComponent />} />
|
||||||
<Route path="/_test" element={<TestComponent />} />
|
<Route path="/" element={<ManageRootPage />} />
|
||||||
<Route path="/" element={<ManageRootPage />} />
|
<Route
|
||||||
<Route
|
path="/jobs"
|
||||||
path="/jobs"
|
element={
|
||||||
element={
|
<Suspense fallback={<Spin />}>
|
||||||
<Suspense fallback={<Spin />}>
|
<JobsPage />
|
||||||
<JobsPage />
|
</Suspense>
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/jobs/:jobId/intake"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<JobIntake />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/jobs/:jobId/deliver"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<JobDeliver />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/jobs/:jobId/checklist"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<JobChecklistView />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/jobs/:jobId/close"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<JobsClose />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/jobs/:jobId/admin"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<JobsAdmin />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/jobs/all"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<AllJobs />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/jobs/ready"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<ReadyJobs />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/jobs/new"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<JobsCreateContainerPage />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/jobs/:jobId"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<JobsDetailPage />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/temporarydocs/"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<TempDocs />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/tasks/mytasks"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<MyTasksPage />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/tasks/alltasks"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<AllTasksPage />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/inventory/"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<InventoryListPage />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/courtesycars/"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<CourtesyCarsPage />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/courtesycars/new"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<CourtesyCarCreateContainer />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/courtesycars/contracts"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<ContractsList />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/courtesycars/contracts/new"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<ContractCreatePage />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/courtesycars/contracts/:contractId"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<ContractDetailPage />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/courtesycars/:ccId"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<CourtesyCarDetailContainer />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/profile"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<ProfilePage />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/vehicles"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<VehiclesContainer />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/production/list"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<ProductionListPage />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/production/board"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<ProductionBoardPage />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/vehicles/:vehId"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<VehiclesDetailContainer />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/bills"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<BillsListPage />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/owners"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<OwnersContainer />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/owners/:ownerId"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<OwnersDetailContainer />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/schedule"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<ScheduleContainer />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/available"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<JobsAvailablePage />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/shop"
|
|
||||||
element={
|
|
||||||
<Suspense fallback={<Spin />}>
|
|
||||||
<ShopPage />
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
{
|
|
||||||
// <Route
|
|
||||||
// path='/shop/templates'
|
|
||||||
// element={<ShopTemplates />}
|
|
||||||
// />
|
|
||||||
}
|
}
|
||||||
<Route
|
/>
|
||||||
path="/shop/vendors"
|
<Route
|
||||||
element={
|
path="/jobs/:jobId/intake"
|
||||||
<Suspense fallback={<Spin />}>
|
element={
|
||||||
<ShopVendorPageContainer />
|
<Suspense fallback={<Spin />}>
|
||||||
</Suspense>
|
<JobIntake />
|
||||||
}
|
</Suspense>
|
||||||
/>
|
}
|
||||||
<Route
|
/>
|
||||||
path="/shop/csi"
|
<Route
|
||||||
element={
|
path="/jobs/:jobId/deliver"
|
||||||
<Suspense fallback={<Spin />}>
|
element={
|
||||||
<ShopCsiPageContainer />
|
<Suspense fallback={<Spin />}>
|
||||||
</Suspense>
|
<JobDeliver />
|
||||||
}
|
</Suspense>
|
||||||
/>
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/jobs/:jobId/checklist"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<JobChecklistView />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/jobs/:jobId/close"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<JobsClose />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/jobs/:jobId/admin"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<JobsAdmin />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/jobs/all"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<AllJobs />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/jobs/ready"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<ReadyJobs />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/jobs/new"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<JobsCreateContainerPage />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/jobs/:jobId"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<JobsDetailPage />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/temporarydocs/"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<TempDocs />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/tasks/mytasks"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<MyTasksPage />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/tasks/alltasks"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<AllTasksPage />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/inventory/"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<InventoryListPage />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/courtesycars/"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<CourtesyCarsPage />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/courtesycars/new"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<CourtesyCarCreateContainer />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/courtesycars/contracts"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<ContractsList />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/courtesycars/contracts/new"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<ContractCreatePage />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/courtesycars/contracts/:contractId"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<ContractDetailPage />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/courtesycars/:ccId"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<CourtesyCarDetailContainer />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/profile"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<ProfilePage />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/vehicles"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<VehiclesContainer />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/production/list"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<ProductionListPage />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/production/board"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<ProductionBoardPage />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/vehicles/:vehId"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<VehiclesDetailContainer />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/bills"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<BillsListPage />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/owners"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<OwnersContainer />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/owners/:ownerId"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<OwnersDetailContainer />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/schedule"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<ScheduleContainer />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/available"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<JobsAvailablePage />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/shop"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<ShopPage />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
{
|
||||||
|
// <Route
|
||||||
|
// path='/shop/templates'
|
||||||
|
// element={<ShopTemplates />}
|
||||||
|
// />
|
||||||
|
}
|
||||||
|
<Route
|
||||||
|
path="/shop/vendors"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<ShopVendorPageContainer />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/shop/csi"
|
||||||
|
element={
|
||||||
|
<Suspense fallback={<Spin />}>
|
||||||
|
<ShopCsiPageContainer />
|
||||||
|
</Suspense>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
<Route
|
<Route
|
||||||
path="/accounting/qbo"
|
path="/accounting/qbo"
|
||||||
element={
|
element={
|
||||||
<Suspense fallback={<Spin />}>
|
<Suspense fallback={<Spin />}>
|
||||||
<AccountingQboCallback />
|
<AccountingQboCallback />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Route
|
<Route
|
||||||
path="/accounting/receivables"
|
path="/accounting/receivables"
|
||||||
element={
|
element={
|
||||||
<Suspense fallback={<Spin />}>
|
<Suspense fallback={<Spin />}>
|
||||||
<AccountingReceivables />
|
<AccountingReceivables />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/accounting/payables"
|
path="/accounting/payables"
|
||||||
element={
|
element={
|
||||||
<Suspense fallback={<Spin />}>
|
<Suspense fallback={<Spin />}>
|
||||||
<AccountingPayables />
|
<AccountingPayables />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/accounting/payments"
|
path="/accounting/payments"
|
||||||
element={
|
element={
|
||||||
<Suspense fallback={<Spin />}>
|
<Suspense fallback={<Spin />}>
|
||||||
<AccountingPayments />
|
<AccountingPayments />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/accounting/exportlogs"
|
path="/accounting/exportlogs"
|
||||||
element={
|
element={
|
||||||
<Suspense fallback={<Spin />}>
|
<Suspense fallback={<Spin />}>
|
||||||
<ExportLogs />
|
<ExportLogs />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/ttapprovals"
|
path="/ttapprovals"
|
||||||
element={
|
element={
|
||||||
<Suspense fallback={<Spin />}>
|
<Suspense fallback={<Spin />}>
|
||||||
<TtApprovals />
|
<TtApprovals />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/partsqueue"
|
path="/partsqueue"
|
||||||
element={
|
element={
|
||||||
<Suspense fallback={<Spin />}>
|
<Suspense fallback={<Spin />}>
|
||||||
<PartsQueue />
|
<PartsQueue />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/phonebook"
|
path="/phonebook"
|
||||||
element={
|
element={
|
||||||
<Suspense fallback={<Spin />}>
|
<Suspense fallback={<Spin />}>
|
||||||
<Phonebook />
|
<Phonebook />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Route
|
<Route
|
||||||
path="/payments"
|
path="/payments"
|
||||||
element={
|
element={
|
||||||
<Suspense fallback={<Spin />}>
|
<Suspense fallback={<Spin />}>
|
||||||
<PaymentsAll />
|
<PaymentsAll />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/shiftclock"
|
path="/shiftclock"
|
||||||
element={
|
element={
|
||||||
<Suspense fallback={<Spin />}>
|
<Suspense fallback={<Spin />}>
|
||||||
<ShiftClock />
|
<ShiftClock />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/scoreboard"
|
path="/scoreboard"
|
||||||
element={
|
element={
|
||||||
<Suspense fallback={<Spin />}>
|
<Suspense fallback={<Spin />}>
|
||||||
<Scoreboard />
|
<Scoreboard />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/timetickets"
|
path="/timetickets"
|
||||||
element={
|
element={
|
||||||
<Suspense fallback={<Spin />}>
|
<Suspense fallback={<Spin />}>
|
||||||
<TimeTicketsAll />
|
<TimeTicketsAll />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/help"
|
path="/help"
|
||||||
element={
|
element={
|
||||||
<Suspense fallback={<Spin />}>
|
<Suspense fallback={<Spin />}>
|
||||||
<Help />
|
<Help />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route path="/emailtest" element={<EmailTest />} />
|
<Route path="/emailtest" element={<EmailTest />} />
|
||||||
<Route
|
<Route
|
||||||
path="/dashboard"
|
path="/dashboard"
|
||||||
element={
|
element={
|
||||||
<Suspense fallback={<Spin />}>
|
<Suspense fallback={<Spin />}>
|
||||||
<Dashboard />
|
<Dashboard />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/dms"
|
path="/dms"
|
||||||
element={
|
element={
|
||||||
<Suspense fallback={<Spin />}>
|
<Suspense fallback={<Spin />}>
|
||||||
<Dms />
|
<Dms />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/dmsap"
|
path="/dmsap"
|
||||||
element={
|
element={
|
||||||
<Suspense fallback={<Spin />}>
|
<Suspense fallback={<Spin />}>
|
||||||
<DmsPayables />
|
<DmsPayables />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</Routes>
|
</Routes>
|
||||||
</SharedModalProvider>
|
|
||||||
</Suspense>
|
</Suspense>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
import React from "react";
|
|
||||||
|
|
||||||
// Create a context
|
|
||||||
export const SharedModalContext = React.createContext({});
|
|
||||||
|
|
||||||
export const SharedModalProvider = ({ children }) => {
|
|
||||||
const [taskQuery, setTaskQuery] = React.useState([]);
|
|
||||||
|
|
||||||
const updateTaskQuery = (query) => {
|
|
||||||
setTaskQuery(query);
|
|
||||||
};
|
|
||||||
|
|
||||||
return <SharedModalContext.Provider value={{ taskQuery, updateTaskQuery }}>{children}</SharedModalContext.Provider>;
|
|
||||||
};
|
|
||||||
Reference in New Issue
Block a user