diff --git a/client/src/components/feature-wrapper/feature-wrapper.component.jsx b/client/src/components/feature-wrapper/feature-wrapper.component.jsx
index 042b6c92c..7a3ca5b47 100644
--- a/client/src/components/feature-wrapper/feature-wrapper.component.jsx
+++ b/client/src/components/feature-wrapper/feature-wrapper.component.jsx
@@ -1,23 +1,17 @@
-import dayjs from "../../utils/day";
-import React from "react";
-import { useTranslation } from "react-i18next";
-import { connect } from "react-redux";
-import { createStructuredSelector } from "reselect";
-import { selectBodyshop } from "../../redux/user/user.selectors";
-import AlertComponent from "../alert/alert.component";
+import dayjs from '../../utils/day';
+import React from 'react';
+import { useTranslation } from 'react-i18next';
+import { connect } from 'react-redux';
+import { createStructuredSelector } from 'reselect';
+import { selectBodyshop } from '../../redux/user/user.selectors';
+import AlertComponent from '../alert/alert.component';
import InstanceRenderManager from '../../utils/instanceRenderMgr';
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
});
-function FeatureWrapper({
- bodyshop,
- featureName,
- noauth,
- children,
- ...restProps
-}) {
+function FeatureWrapper({ bodyshop, featureName, noauth, children, ...restProps }) {
const { t } = useTranslation();
if (HasFeatureAccess({ featureName, bodyshop })) return children;
@@ -25,7 +19,13 @@ function FeatureWrapper({
return (
noauth || (
)
@@ -33,10 +33,12 @@ function FeatureWrapper({
}
export function HasFeatureAccess({ featureName, bodyshop }) {
- return (
- bodyshop?.features.allAccess ||
+ console.log(
+ 'Feature Name', featureName,
+ bodyshop?.features.allAccess,
dayjs(bodyshop?.features[featureName]).isAfter(dayjs())
);
+ return bodyshop?.features.allAccess || dayjs(bodyshop?.features[featureName]).isAfter(dayjs());
}
export default connect(mapStateToProps, null)(FeatureWrapper);
diff --git a/client/src/components/job-detail-lines/job-lines.component.jsx b/client/src/components/job-detail-lines/job-lines.component.jsx
index f8f3198d5..492fa57df 100644
--- a/client/src/components/job-detail-lines/job-lines.component.jsx
+++ b/client/src/components/job-detail-lines/job-lines.component.jsx
@@ -290,7 +290,7 @@ export function JobLinesComponent({
key: 'location',
render: (text, record) => ,
},
- ...(HasFeatureAccess({ featureName: 'bills' })
+ ...(HasFeatureAccess({ featureName: 'bills', bodyshop })
? [
{
title: t('joblines.labels.billref'),
diff --git a/client/src/components/report-center-modal/report-center-modal.component.jsx b/client/src/components/report-center-modal/report-center-modal.component.jsx
index 6130a5e62..5830c1c04 100644
--- a/client/src/components/report-center-modal/report-center-modal.component.jsx
+++ b/client/src/components/report-center-modal/report-center-modal.component.jsx
@@ -141,9 +141,10 @@ export function ReportCenterModalComponent({reportCenterModal, bodyshop}) {
const grouped = _.groupBy(FilteredReportsList, "group");
- const groupExcludeKeyFilter = [...!HasFeatureAccess({featureName: 'bills'})? ["purchases"]:[],
- ...!HasFeatureAccess({featureName: 'timetickets'})? ["payroll"]:[],
- ]
+ const groupExcludeKeyFilter = [
+ ...(!HasFeatureAccess({ featureName: 'bills', bodyshop }) ? ['purchases'] : []),
+ ...(!HasFeatureAccess({ featureName: 'timetickets', bodyshop }) ? ['payroll'] : []),
+ ];
return (
diff --git a/client/src/components/shop-info/shop-info.component.jsx b/client/src/components/shop-info/shop-info.component.jsx
index 304ae029e..ae116411b 100644
--- a/client/src/components/shop-info/shop-info.component.jsx
+++ b/client/src/components/shop-info/shop-info.component.jsx
@@ -18,7 +18,6 @@ import ShopInfoSpeedPrint from "./shop-info.speedprint.component";
import {useLocation, useNavigate} from "react-router-dom";
import ShopInfoTaskPresets from "./shop-info.task-presets.component";
import queryString from "query-string";
-import { HasFeatureAccess } from "../feature-wrapper/feature-wrapper.component";
import InstanceRenderManager from "../../utils/instanceRenderMgr";
const mapStateToProps = createStructuredSelector({
diff --git a/client/src/pages/shop/shop.page.component.jsx b/client/src/pages/shop/shop.page.component.jsx
index a4b0a7503..13efc59fc 100644
--- a/client/src/pages/shop/shop.page.component.jsx
+++ b/client/src/pages/shop/shop.page.component.jsx
@@ -72,7 +72,7 @@ export function ShopPage({bodyshop, setSelectedHeader, setBreadcrumbs}) {
},
);
- if(HasFeatureAccess("csi")){
+ if(HasFeatureAccess({featureName:"csi", bodyshop})){
items.push({
key: "csiq",
label: t("bodyshop.labels.csiq"),