diff --git a/src/App.jsx b/src/App.jsx
index cbc32b3..9eb031a 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -34,6 +34,7 @@ import AuthCallback from './components/App/AuthCallback.jsx'
import EmailNotificationTemplate from './components/Email/EmailNotificationTemplate.jsx'
import MarketplaceAuthCallback from './components/Dashboard/Sales/Marketplaces/MarketplaceAuthCallback.jsx'
import AuthLaunch from './components/App/AppLaunch.jsx'
+import { TableStateProvider } from './components/Dashboard/context/TableStateContext.jsx'
const SlicerIntegration = lazy(
() =>
import('./components/Dashboard/Production/Printers/SlicerIntegration.jsx')
@@ -86,76 +87,78 @@ const AppContent = () => {
-
- }
- />
- (
-
- )}
- />
- }
- />
- (
-
- )}
- />
- }
- />
- }
- />
- }
- />
- }
- />
- }
- />
+
+
+ }
+ />
+ (
+
+ )}
+ />
+ }
+ />
+ (
+
+ )}
+ />
+ }
+ />
+ }
+ />
+ }
+ />
+ }
+ />
+ }
+ />
- }
- />
- }
- >
- {ProductionRoutes}
- {InventoryRoutes}
- {FinanceRoutes}
- {SalesRoutes}
- {ManagementRoutes}
- {DeveloperRoutes}
-
-
- }
- />
-
+ }
+ />
+ }
+ >
+ {ProductionRoutes}
+ {InventoryRoutes}
+ {FinanceRoutes}
+ {SalesRoutes}
+ {ManagementRoutes}
+ {DeveloperRoutes}
+
+
+ }
+ />
+
+
diff --git a/src/components/Dashboard/Layout.jsx b/src/components/Dashboard/Layout.jsx
index 49a7b7b..56160aa 100644
--- a/src/components/Dashboard/Layout.jsx
+++ b/src/components/Dashboard/Layout.jsx
@@ -12,7 +12,6 @@ import DashboardBreadcrumb from './common/DashboardBreadcrumb'
import DeveloperSidebar from './Developer/DeveloperSidebar'
import { useThemeContext } from './context/ThemeContext'
import { MessageProvider } from './context/MessageContext'
-import { TableStateProvider } from './context/TableStateContext'
const { Content } = Layout
@@ -29,42 +28,40 @@ const DashboardLayout = ({ children }) => {
return (
-
-
-
-
- {isProduction ? (
-
- ) : isInventory ? (
-
- ) : isFinance ? (
-
- ) : isSales ? (
-
- ) : isManagement ? (
-
- ) : isDeveloper ? (
-
- ) : (
- // Default to production sidebar
- )}
-
-
-
-
-
-
-
- {children}
+
+
+
+ {isProduction ? (
+
+ ) : isInventory ? (
+
+ ) : isFinance ? (
+
+ ) : isSales ? (
+
+ ) : isManagement ? (
+
+ ) : isDeveloper ? (
+
+ ) : (
+ // Default to production sidebar
+ )}
+
+
+
+
+
-
-
+
+ {children}
+
+
-
+
)
}
diff --git a/src/components/Dashboard/Production/Printers/ControlPrinter.jsx b/src/components/Dashboard/Production/Printers/ControlPrinter.jsx
index 4c9b154..4c80fcc 100644
--- a/src/components/Dashboard/Production/Printers/ControlPrinter.jsx
+++ b/src/components/Dashboard/Production/Printers/ControlPrinter.jsx
@@ -272,7 +272,8 @@ const ControlPrinter = ({ slicerIntegration = false }) => {
visibleActions={{
edit: false,
info: !slicerIntegration,
- control: !slicerIntegration
+ control: !slicerIntegration,
+ newPrinterProfile: !slicerIntegration
}}
objectData={objectFormState.objectData}
/>
@@ -318,11 +319,13 @@ const ControlPrinter = ({ slicerIntegration = false }) => {
/>
-
+ {!slicerIntegration && (
+
+ )}
{
- if (action.type === 'divider') {
- return { type: 'divider' }
- }
- const actionUrl = action.url ? action.url(id) : undefined
-
- var disabled = actionUrl && actionUrl === currentUrlWithActions
- var visible = true
-
- const { userProfile } = useContext(AuthContext)
-
- if (action.disabled) {
- if (typeof action.disabled === 'function') {
- disabled = action.disabled({ ...objectData, _user: userProfile })
- } else {
- disabled = action.disabled
+function mapActionsToMenuItems(
+ actions,
+ currentUrlWithActions,
+ id,
+ objectData,
+ userProfile
+) {
+ return cleanDividers(
+ actions.map((action) => {
+ if (action.type === 'divider') {
+ return { type: 'divider' }
}
- }
+ const actionUrl = action.url ? action.url(id) : undefined
- if (action.visible) {
- if (typeof action.visible === 'function') {
- visible = action.visible(objectData)
- } else {
- visible = action.visible
+ var disabled = actionUrl && actionUrl === currentUrlWithActions
+ var visible = true
+
+ if (action.disabled) {
+ if (typeof action.disabled === 'function') {
+ disabled = action.disabled({ ...objectData, _user: userProfile })
+ } else {
+ disabled = action.disabled
+ }
}
- }
- const item = {
- key: action.key || action.name,
- label: action.label,
- danger: action?.danger || false,
- icon: action.icon ? createElement(action.icon) : undefined,
- disabled
- }
- if (action.children && Array.isArray(action.children)) {
- item.children = mapActionsToMenuItems(
- action.children,
- currentUrlWithActions,
- id,
- objectData
- )
- }
- if (visible == true) {
+ if (action.visible) {
+ if (typeof action.visible === 'function') {
+ visible = action.visible(objectData)
+ } else {
+ visible = action.visible
+ }
+ }
+
+ if (visible != true) {
+ return null
+ }
+
+ const item = {
+ key: action.key || action.name,
+ label: action.label,
+ danger: action?.danger || false,
+ icon: action.icon ? createElement(action.icon) : undefined,
+ disabled
+ }
+ if (action.children && Array.isArray(action.children)) {
+ item.children = mapActionsToMenuItems(
+ action.children,
+ currentUrlWithActions,
+ id,
+ objectData,
+ userProfile
+ )
+ }
return item
- }
- })
+ })
+ )
}
const stripActionParam = (pathname, search) => {
@@ -108,6 +149,7 @@ const ObjectActions = ({
const navigate = useNavigate()
const location = useLocation()
const { showActionsModal } = useActionsModal()
+ const { userProfile } = useContext(AuthContext)
// Get current url without 'action' param
const currentUrlWithoutActions = stripActionParam(
location.pathname,
@@ -120,10 +162,13 @@ const ObjectActions = ({
visibleActions
)
- const filteredActions = visibilityFilteredActions.filter(
- (action) =>
- typeof action.url !== 'function' ||
- action.url(id) !== currentUrlWithoutActions
+ const filteredActions = cleanDividers(
+ visibilityFilteredActions.filter(
+ (action) =>
+ action.type === 'divider' ||
+ typeof action.url !== 'function' ||
+ action.url(id) !== currentUrlWithoutActions
+ )
)
const currentUrlWithActions = location.pathname + location.search
@@ -134,7 +179,8 @@ const ObjectActions = ({
filteredActions,
currentUrlWithActions,
id,
- objectData
+ objectData,
+ userProfile
),
onClick: (info) => {
// Find the action by key