@@ -261,7 +261,7 @@ export function JobsDetailPage({
|
||||
items={[
|
||||
{
|
||||
key: "general",
|
||||
tab: (
|
||||
label: (
|
||||
<span><Icon component={FaShieldAlt} />{t("menus.jobsdetail.general")}</span>
|
||||
),
|
||||
forceRender: true,
|
||||
@@ -269,7 +269,7 @@ export function JobsDetailPage({
|
||||
},
|
||||
{
|
||||
key: "repairdata",
|
||||
tab: (
|
||||
label: (
|
||||
<span><BarsOutlined />{t("menus.jobsdetail.repairdata")}</span>
|
||||
),
|
||||
forceRender: true,
|
||||
@@ -284,7 +284,7 @@ export function JobsDetailPage({
|
||||
},
|
||||
{
|
||||
key: "rates",
|
||||
tab: (
|
||||
label: (
|
||||
<span><DollarCircleOutlined />{t("menus.jobsdetail.rates")}</span>
|
||||
),
|
||||
forceRender: true,
|
||||
@@ -292,28 +292,28 @@ export function JobsDetailPage({
|
||||
},
|
||||
{
|
||||
key: "totals",
|
||||
tab: (
|
||||
label: (
|
||||
<span><DollarCircleOutlined />{t("menus.jobsdetail.totals")}</span>
|
||||
),
|
||||
children: <JobsDetailTotals job={job} refetch={refetch} />,
|
||||
},
|
||||
{
|
||||
key: "partssublet",
|
||||
tab: (
|
||||
label: (
|
||||
<span><ToolFilled />{t("menus.jobsdetail.partssublet")}</span>
|
||||
),
|
||||
children: <JobsDetailPliContainer job={job} />,
|
||||
},
|
||||
{
|
||||
key: "labor",
|
||||
tab: (
|
||||
label: (
|
||||
<span><Icon component={FaHardHat} />{t("menus.jobsdetail.labor")}</span>
|
||||
),
|
||||
children: <JobsDetailLaborContainer job={job} jobId={job.id} />,
|
||||
},
|
||||
{
|
||||
key: "dates",
|
||||
tab: (
|
||||
label: (
|
||||
<span><CalendarFilled />{t("menus.jobsdetail.dates")}</span>
|
||||
),
|
||||
forceRender: true,
|
||||
@@ -321,7 +321,7 @@ export function JobsDetailPage({
|
||||
},
|
||||
{
|
||||
key: "documents",
|
||||
tab: (
|
||||
label: (
|
||||
<span><FileImageFilled />{t("jobs.labels.documents")}</span>
|
||||
),
|
||||
children: bodyshop.uselocalmediaserver ? (
|
||||
@@ -332,14 +332,14 @@ export function JobsDetailPage({
|
||||
},
|
||||
{
|
||||
key: "notes",
|
||||
tab: (
|
||||
label: (
|
||||
<span><Icon component={FaRegStickyNote} />{t("jobs.labels.notes")}</span>
|
||||
),
|
||||
children: <JobNotesContainer jobId={job.id} />,
|
||||
},
|
||||
{
|
||||
key: "audit",
|
||||
tab: (<span><HistoryOutlined />{t("jobs.labels.audit")}</span>
|
||||
label: (<span><HistoryOutlined />{t("jobs.labels.audit")}</span>
|
||||
),
|
||||
children: <JobAuditTrail jobId={job.id} />,
|
||||
},
|
||||
|
||||
@@ -77,21 +77,21 @@ export function ScoreboardContainer({ setBreadcrumbs, setSelectedHeader }) {
|
||||
items={[
|
||||
{
|
||||
key: "sb",
|
||||
tab: (<span><Icon component={FaShieldAlt} />{t("scoreboard.labels.jobs")}</span>
|
||||
label: (<span><Icon component={FaShieldAlt} />{t("scoreboard.labels.jobs")}</span>
|
||||
),
|
||||
forceRender: true,
|
||||
children: <ScoreboardDisplay />,
|
||||
},
|
||||
{
|
||||
key: "tickets",
|
||||
tab: (<span><FieldTimeOutlined />{t("scoreboard.labels.timeticketsemployee")}</span>
|
||||
label: (<span><FieldTimeOutlined />{t("scoreboard.labels.timeticketsemployee")}</span>
|
||||
),
|
||||
forceRender: true,
|
||||
children: <ScoreboardTimeTickets />,
|
||||
},
|
||||
{
|
||||
key: "ticketsstats",
|
||||
tab: (<span><FieldTimeOutlined />{t("scoreboard.labels.allemployeetimetickets")}</span>
|
||||
label: (<span><FieldTimeOutlined />{t("scoreboard.labels.allemployeetimetickets")}</span>
|
||||
),
|
||||
forceRender: true,
|
||||
children: <ScoreboardTimeTicketsStats />,
|
||||
|
||||
@@ -1,78 +1,77 @@
|
||||
import { Tabs } from "antd";
|
||||
import React, { useEffect } from "react";
|
||||
import { useNavigate, useLocation } 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 { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import {
|
||||
setSelectedHeader,
|
||||
setBreadcrumbs,
|
||||
} from "../../redux/application/application.actions";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
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";
|
||||
|
||||
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");
|
||||
setSelectedHeader("shop");
|
||||
setBreadcrumbs([
|
||||
{
|
||||
link: "/manage/shop",
|
||||
label: t("titles.bc.shop", { shopname: bodyshop.shopname }),
|
||||
},
|
||||
]);
|
||||
}, [t, setSelectedHeader, setBreadcrumbs, bodyshop.shopname]);
|
||||
useEffect(() => {
|
||||
document.title = t("titles.shop");
|
||||
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]);
|
||||
useEffect(() => {
|
||||
if (!search.tab) history({search: "?tab=info"});
|
||||
}, [history, search]);
|
||||
|
||||
return (
|
||||
<RbacWrapper action="shop:config">
|
||||
<Tabs
|
||||
activeKey={search.tab}
|
||||
onChange={(key) => history({ search: `?tab=${key}` })}
|
||||
tabs={[
|
||||
{
|
||||
key: "info",
|
||||
tab: t("bodyshop.labels.shopinfo"),
|
||||
children: <ShopInfoContainer />,
|
||||
},
|
||||
{
|
||||
key: "employees",
|
||||
tab: t("bodyshop.labels.employees"),
|
||||
children: <ShopEmployeesContainer />,
|
||||
},
|
||||
{
|
||||
key: "licensing",
|
||||
tab: t("bodyshop.labels.licensing"),
|
||||
children: <ShopInfoUsersComponent />,
|
||||
},
|
||||
{
|
||||
key: "csiq",
|
||||
tab: t("bodyshop.labels.csiq"),
|
||||
children: <ShopCsiConfig />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</RbacWrapper>
|
||||
);
|
||||
return (
|
||||
<RbacWrapper action="shop:config">
|
||||
<Tabs
|
||||
activeKey={search.tab}
|
||||
onChange={(key) => history({search: `?tab=${key}`})}
|
||||
items={[
|
||||
{
|
||||
key: "info",
|
||||
label: t("bodyshop.labels.shopinfo"),
|
||||
children: <ShopInfoContainer/>,
|
||||
},
|
||||
{
|
||||
key: "employees",
|
||||
label: t("bodyshop.labels.employees"),
|
||||
children: <ShopEmployeesContainer/>,
|
||||
},
|
||||
{
|
||||
key: "licensing",
|
||||
label: t("bodyshop.labels.licensing"),
|
||||
children: <ShopInfoUsersComponent/>,
|
||||
},
|
||||
{
|
||||
key: "csiq",
|
||||
label: t("bodyshop.labels.csiq"),
|
||||
children: <ShopCsiConfig/>,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</RbacWrapper>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(ShopPage);
|
||||
|
||||
Reference in New Issue
Block a user