Reformat all project files to use the prettier config file.
This commit is contained in:
@@ -1,93 +1,95 @@
|
||||
import {Tabs} from "antd";
|
||||
import React, {useEffect} from "react";
|
||||
import {useLocation, useNavigate} from "react-router-dom";
|
||||
import { Tabs } from "antd";
|
||||
import React, { useEffect } from "react";
|
||||
import { useLocation, useNavigate } from "react-router-dom";
|
||||
import queryString from "query-string";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import ShopEmployeesContainer from "../../components/shop-employees/shop-employees.container";
|
||||
import ShopInfoContainer from "../../components/shop-info/shop-info.container";
|
||||
import ShopCsiConfig from "../../components/shop-csi-config/shop-csi-config.component";
|
||||
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||
import InstanceRenderManager from '../../utils/instanceRenderMgr';
|
||||
import {connect} from "react-redux";
|
||||
import {createStructuredSelector} from "reselect";
|
||||
import {setBreadcrumbs, setSelectedHeader,} from "../../redux/application/application.actions";
|
||||
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { setBreadcrumbs, setSelectedHeader } from "../../redux/application/application.actions";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import ShopInfoUsersComponent from "../../components/shop-users/shop-users.component";
|
||||
|
||||
import ShopTeamsContainer from "../../components/shop-teams/shop-teams.container";
|
||||
import { HasFeatureAccess } from "../../components/feature-wrapper/feature-wrapper.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
bodyshop: selectBodyshop
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setSelectedHeader: (key) => dispatch(setSelectedHeader(key)),
|
||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||
setSelectedHeader: (key) => dispatch(setSelectedHeader(key)),
|
||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs))
|
||||
});
|
||||
|
||||
export function ShopPage({bodyshop, setSelectedHeader, setBreadcrumbs}) {
|
||||
const {t} = useTranslation();
|
||||
const history = useNavigate();
|
||||
const search = queryString.parse(useLocation().search);
|
||||
export function ShopPage({ bodyshop, setSelectedHeader, setBreadcrumbs }) {
|
||||
const { t } = useTranslation();
|
||||
const history = useNavigate();
|
||||
const search = queryString.parse(useLocation().search);
|
||||
|
||||
useEffect(() => {
|
||||
document.title = t("titles.shop",{app: InstanceRenderManager({imex:'$t(titles.imexonline)', rome: '$t(titles.romeonline)', promanager: '$t(titles.promanager)'})} );
|
||||
setSelectedHeader("shop");
|
||||
setBreadcrumbs([
|
||||
{
|
||||
link: "/manage/shop",
|
||||
label: t("titles.bc.shop", {shopname: bodyshop.shopname}),
|
||||
},
|
||||
]);
|
||||
}, [t, setSelectedHeader, setBreadcrumbs, bodyshop.shopname]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!search.tab) history({search: "?tab=info"});
|
||||
}, [history, search]);
|
||||
|
||||
const items = [
|
||||
{
|
||||
key: "info",
|
||||
label: t("bodyshop.labels.shopinfo"),
|
||||
children: <ShopInfoContainer/>,
|
||||
},
|
||||
{
|
||||
key: "employees",
|
||||
label: t("bodyshop.labels.employees"),
|
||||
children: <ShopEmployeesContainer/>,
|
||||
}];
|
||||
|
||||
if (bodyshop.md_tasks_presets.enable_tasks) {
|
||||
items.push({
|
||||
key: "teams",
|
||||
label: t("bodyshop.labels.employee_teams"),
|
||||
children: <ShopTeamsContainer/>
|
||||
});
|
||||
}
|
||||
|
||||
items.push({
|
||||
key: "licensing",
|
||||
label: t("bodyshop.labels.licensing"),
|
||||
children: <ShopInfoUsersComponent/>,
|
||||
},
|
||||
);
|
||||
|
||||
if(HasFeatureAccess({featureName:"csi", bodyshop})){
|
||||
items.push({
|
||||
key: "csiq",
|
||||
label: t("bodyshop.labels.csiq"),
|
||||
children: <ShopCsiConfig/>,
|
||||
useEffect(() => {
|
||||
document.title = t("titles.shop", {
|
||||
app: InstanceRenderManager({
|
||||
imex: "$t(titles.imexonline)",
|
||||
rome: "$t(titles.romeonline)",
|
||||
promanager: "$t(titles.promanager)"
|
||||
})
|
||||
}
|
||||
return (
|
||||
<RbacWrapper action="shop:config">
|
||||
<Tabs
|
||||
activeKey={search.tab}
|
||||
onChange={(key) => history({search: `?tab=${key}`})}
|
||||
items={items}
|
||||
/>
|
||||
</RbacWrapper>
|
||||
);
|
||||
});
|
||||
setSelectedHeader("shop");
|
||||
setBreadcrumbs([
|
||||
{
|
||||
link: "/manage/shop",
|
||||
label: t("titles.bc.shop", { shopname: bodyshop.shopname })
|
||||
}
|
||||
]);
|
||||
}, [t, setSelectedHeader, setBreadcrumbs, bodyshop.shopname]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!search.tab) history({ search: "?tab=info" });
|
||||
}, [history, search]);
|
||||
|
||||
const items = [
|
||||
{
|
||||
key: "info",
|
||||
label: t("bodyshop.labels.shopinfo"),
|
||||
children: <ShopInfoContainer />
|
||||
},
|
||||
{
|
||||
key: "employees",
|
||||
label: t("bodyshop.labels.employees"),
|
||||
children: <ShopEmployeesContainer />
|
||||
}
|
||||
];
|
||||
|
||||
if (bodyshop.md_tasks_presets.enable_tasks) {
|
||||
items.push({
|
||||
key: "teams",
|
||||
label: t("bodyshop.labels.employee_teams"),
|
||||
children: <ShopTeamsContainer />
|
||||
});
|
||||
}
|
||||
|
||||
items.push({
|
||||
key: "licensing",
|
||||
label: t("bodyshop.labels.licensing"),
|
||||
children: <ShopInfoUsersComponent />
|
||||
});
|
||||
|
||||
if (HasFeatureAccess({ featureName: "csi", bodyshop })) {
|
||||
items.push({
|
||||
key: "csiq",
|
||||
label: t("bodyshop.labels.csiq"),
|
||||
children: <ShopCsiConfig />
|
||||
});
|
||||
}
|
||||
return (
|
||||
<RbacWrapper action="shop:config">
|
||||
<Tabs activeKey={search.tab} onChange={(key) => history({ search: `?tab=${key}` })} items={items} />
|
||||
</RbacWrapper>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(ShopPage);
|
||||
|
||||
Reference in New Issue
Block a user