feature/IO-3255-simplified-parts-management - Bug Fixes
This commit is contained in:
@@ -220,7 +220,7 @@ export function SimplifiedPartsJobsListComponent({
|
|||||||
<RbacWrapper action="shop:config">
|
<RbacWrapper action="shop:config">
|
||||||
<Button
|
<Button
|
||||||
icon={<SettingOutlined />}
|
icon={<SettingOutlined />}
|
||||||
onClick={() => history("/parts/parts-settings")}
|
onClick={() => history("/parts/settings")}
|
||||||
title={t("general.labels.settings")}
|
title={t("general.labels.settings")}
|
||||||
>
|
>
|
||||||
{t("general.labels.settings")}
|
{t("general.labels.settings")}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { FloatButton, Layout, Spin } from "antd";
|
import { FloatButton, Layout, Spin } from "antd";
|
||||||
|
import { Route, Routes, useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
// import preval from "preval.macro";
|
// import preval from "preval.macro";
|
||||||
import { lazy, Suspense, useEffect, useState } from "react";
|
import { lazy, Suspense, 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 { Route, Routes } from "react-router-dom";
|
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import BreadCrumbs from "../../components/breadcrumbs/breadcrumbs.component";
|
import BreadCrumbs from "../../components/breadcrumbs/breadcrumbs.component";
|
||||||
import ChatAffixContainer from "../../components/chat-affix/chat-affix.container";
|
import ChatAffixContainer from "../../components/chat-affix/chat-affix.container";
|
||||||
@@ -20,7 +20,7 @@ import LoadingSpinner from "../../components/loading-spinner/loading-spinner.com
|
|||||||
import PartnerPingComponent from "../../components/partner-ping/partner-ping.component";
|
import PartnerPingComponent from "../../components/partner-ping/partner-ping.component";
|
||||||
import ShopSubStatusComponent from "../../components/shop-sub-status/shop-sub-status.component";
|
import ShopSubStatusComponent from "../../components/shop-sub-status/shop-sub-status.component";
|
||||||
import UpdateAlert from "../../components/update-alert/update-alert.component";
|
import UpdateAlert from "../../components/update-alert/update-alert.component";
|
||||||
import { selectBodyshop, selectInstanceConflict } from "../../redux/user/user.selectors";
|
import { selectBodyshop, selectInstanceConflict, selectPartsManagementOnly } from "../../redux/user/user.selectors";
|
||||||
import InstanceRenderManager from "../../utils/instanceRenderMgr.js";
|
import InstanceRenderManager from "../../utils/instanceRenderMgr.js";
|
||||||
import useAlertsNotifications from "../../hooks/useAlertsNotifications.jsx";
|
import useAlertsNotifications from "../../hooks/useAlertsNotifications.jsx";
|
||||||
|
|
||||||
@@ -106,12 +106,14 @@ const { Content } = Layout;
|
|||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
conflict: selectInstanceConflict,
|
conflict: selectInstanceConflict,
|
||||||
bodyshop: selectBodyshop
|
bodyshop: selectBodyshop,
|
||||||
|
partsManagementOnly: selectPartsManagementOnly
|
||||||
});
|
});
|
||||||
|
|
||||||
export function Manage({ conflict, bodyshop }) {
|
export function Manage({ conflict, bodyshop, partsManagementOnly }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [chatVisible] = useState(false);
|
const [chatVisible] = useState(false);
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
// Centralized alerts handling (fetch + dedupe + notifications)
|
// Centralized alerts handling (fetch + dedupe + notifications)
|
||||||
useAlertsNotifications();
|
useAlertsNotifications();
|
||||||
@@ -132,6 +134,12 @@ export function Manage({ conflict, bodyshop }) {
|
|||||||
});
|
});
|
||||||
}, [t]);
|
}, [t]);
|
||||||
|
|
||||||
|
if (partsManagementOnly) {
|
||||||
|
// This NEEDS to be done this way, DO NOT use the react router, it will cause a ton of side effects
|
||||||
|
window.location = "/parts";
|
||||||
|
return null; // Prevent further rendering
|
||||||
|
}
|
||||||
|
|
||||||
const AppRouteTable = (
|
const AppRouteTable = (
|
||||||
<Suspense
|
<Suspense
|
||||||
fallback={
|
fallback={
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export function PartsSettingsPage({ setSelectedHeader, setBreadcrumbs }) {
|
|||||||
rome: "$t(titles.romeonline)"
|
rome: "$t(titles.romeonline)"
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
setSelectedHeader("parts-settings");
|
setSelectedHeader("settings");
|
||||||
setBreadcrumbs([
|
setBreadcrumbs([
|
||||||
{
|
{
|
||||||
link: "/parts",
|
link: "/parts",
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ export function SimplifiedPartsPage({ conflict, bodyshop }) {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/parts-settings"
|
path="/settings"
|
||||||
element={
|
element={
|
||||||
<Suspense fallback={<Spin />}>
|
<Suspense fallback={<Spin />}>
|
||||||
<PartsSettingsPage />
|
<PartsSettingsPage />
|
||||||
|
|||||||
@@ -401,12 +401,11 @@ export function* SetAuthLevelFromShopDetails({ payload }) {
|
|||||||
window.$zoho.salesiq.visitor.info({ "Shop Name": payload.shopname });
|
window.$zoho.salesiq.visitor.info({ "Shop Name": payload.shopname });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set whether it is for parts management only
|
|
||||||
yield put(setPartsManagementOnly(payload.features.partsManagementOnly));
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn("Couldnt find $crisp.", error.message);
|
console.warn("Couldnt find $crisp.", error.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
yield put(setPartsManagementOnly(payload.features.partsManagementOnly));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
yield put(signInFailure(error.message));
|
yield put(signInFailure(error.message));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user