+
+
+
+
+
+ {t('profile.language')}
+
+ {languages.map(lng => (
+
+ ))}
+
)}
diff --git a/manager_dashboard/src/hooks/usePermissions.js b/manager_dashboard/src/hooks/usePermissions.js
deleted file mode 100644
index 312e6a9..0000000
--- a/manager_dashboard/src/hooks/usePermissions.js
+++ /dev/null
@@ -1,51 +0,0 @@
-import { useAccess } from '@xenia/access'
-
-// The current screens' permission names -> the v2 keys they stand for (the same pairs as
-// local_backend/core/access/legacy.py). Removed when the pages use useCan(key) directly (phase 6).
-const KEYS = {
- accessDashboard: 'core.dashboard.access',
- accessWaiterApp: 'waiter_app.access',
- accessKds: 'kds.access',
- cancelOrders: 'ordering.orders.cancel',
- applyDiscounts: 'pricing.discounts.apply',
- modifyPrices: 'ordering.prices.modify',
- openOrders: 'ordering.orders.open',
- closeOrders: 'ordering.orders.close',
- viewReports: 'reports.view',
- manageStaff: 'core.staff.manage',
- manageTables: 'catalog.tables.manage',
- manageMenu: 'catalog.menu.manage',
- manageSettings: 'core.settings.manage',
-}
-
-/**
- * The signed-in user's permissions in the shape the current pages use, from the keys in
- * the platform bootstrap (@xenia/access). A key whose module is off counts as not held.
- * Superadmin holds every key (the backend sends them all).
- */
-export default function usePermissions() {
- const { user, permissions } = useAccess()
-
- if (!user) {
- return {
- isSuperadmin: false,
- accessDashboard: false,
- accessWaiterApp: false,
- accessKds: false,
- cancelOrders: false,
- applyDiscounts: false,
- modifyPrices: false,
- openOrders: false,
- closeOrders: false,
- viewReports: false,
- manageStaff: false,
- manageTables: false,
- manageMenu: false,
- manageSettings: false,
- }
- }
-
- const out = { isSuperadmin: user.role === 'superadmin' }
- for (const [name, key] of Object.entries(KEYS)) out[name] = permissions.has(key)
- return out
-}
diff --git a/manager_dashboard/src/hooks/usePhase2Features.js b/manager_dashboard/src/hooks/usePhase2Features.js
deleted file mode 100644
index b53aaf6..0000000
--- a/manager_dashboard/src/hooks/usePhase2Features.js
+++ /dev/null
@@ -1,61 +0,0 @@
-import { useState, useEffect } from 'react'
-
-const STORAGE_KEY = 'phase2_features'
-
-// All Phase 2 features with their sidebar metadata.
-// enabled: true = shown by default (feature is polished)
-// enabled: false = hidden by default (still in development)
-export const PHASE2_FEATURE_DEFS = [
- { id: 'online-orders', label: 'Online Orders', route: '/online-orders', enabled: true },
- { id: 'notes', label: 'Σημειώσεις & Εργασίες', route: '/notes', enabled: true },
- { id: 'expenses', label: 'Έξοδα', route: '/expenses', enabled: true },
- { id: 'contacts', label: 'Επαφές / Προμηθευτές', route: '/contacts', enabled: true },
- { id: 'customers', label: 'Πελάτες', route: '/customers', enabled: true },
- { id: 'tabs', label: 'Καρτέλες', route: '/tabs', enabled: true },
- { id: 'waste', label: 'Αποβλήτα / Φθορές', route: '/waste', enabled: true },
- { id: 'kds', label: 'KDS — Κουζίνα', route: '/kds', enabled: true },
- { id: 'schedule', label: 'Πρόγραμμα Βαρδιών', route: '/schedule', enabled: true },
-]
-
-function _load() {
- try {
- const raw = localStorage.getItem(STORAGE_KEY)
- return raw ? JSON.parse(raw) : {}
- } catch {
- return {}
- }
-}
-
-export function isFeatureEnabled(id) {
- const overrides = _load()
- if (id in overrides) return overrides[id]
- const def = PHASE2_FEATURE_DEFS.find(f => f.id === id)
- return def ? def.enabled : true
-}
-
-export function setFeatureEnabled(id, value) {
- const overrides = _load()
- overrides[id] = value
- localStorage.setItem(STORAGE_KEY, JSON.stringify(overrides))
- // Notify other components in this tab
- window.dispatchEvent(new Event('phase2features'))
-}
-
-export function usePhase2Features() {
- const [, tick] = useState(0)
-
- useEffect(() => {
- const handler = () => tick(n => n + 1)
- window.addEventListener('phase2features', handler)
- window.addEventListener('storage', handler)
- return () => {
- window.removeEventListener('phase2features', handler)
- window.removeEventListener('storage', handler)
- }
- }, [])
-
- return PHASE2_FEATURE_DEFS.map(f => ({
- ...f,
- enabled: isFeatureEnabled(f.id),
- }))
-}
diff --git a/manager_dashboard/src/layouts/AppLayout.jsx b/manager_dashboard/src/layouts/AppLayout.jsx
index d091483..be24343 100644
--- a/manager_dashboard/src/layouts/AppLayout.jsx
+++ b/manager_dashboard/src/layouts/AppLayout.jsx
@@ -9,72 +9,29 @@ import UserMenuButton from '../components/UserMenuButton'
import EditProfileModal from '../components/EditProfileModal'
import useLicenseStatus from '../hooks/useLicenseStatus'
import PhoneListener from '../components/PhoneListener'
+import { useTranslation } from '@xenia/i18n'
+import { pageFor } from '../shell/nav'
+import RouteGuard from '../shell/RouteGuard'
export const LicenseContext = createContext(null)
const DIGITS = ['1','2','3','4','5','6','7','8','9','','0','⌫']
-// ─── Route → title/breadcrumb map ────────────────────────────────────────────
-
-const ROUTE_META = {
- '/dashboard': { title: 'Εικόνα' },
- '/tables': { title: 'Τραπέζια' },
- '/online-orders': { title: 'Online Παραγγελίες' },
- '/crm/contacts': { title: 'Επαφές', crumbs: ['CRM', 'Επαφές'] },
- '/crm/customers': { title: 'Πελάτες', crumbs: ['CRM', 'Πελάτες'] },
- '/financials/expenses': { title: 'Έξοδα', crumbs: ['Οικονομικά', 'Έξοδα'] },
- '/financials/tabs': { title: 'Καρτέλες Πελατών', crumbs: ['Οικονομικά', 'Καρτέλες Πελατών'] },
- '/management/products': { title: 'Προϊόντα', crumbs: ['Διαχείριση', 'Προϊόντα'] },
- '/management/tables': { title: 'Τραπέζια', crumbs: ['Διαχείριση', 'Τραπέζια'] },
- '/management/staff': { title: 'Προσωπικό', crumbs: ['Διαχείριση', 'Προσωπικό'] },
- '/management/schedule': { title: 'Πρόγραμμα', crumbs: ['Διαχείριση', 'Πρόγραμμα'] },
- '/inventory/throwaways': { title: 'Απορρίμματα', crumbs: ['Αποθήκη', 'Απορρίμματα'] },
- '/inventory/stock': { title: 'Απόθεμα', crumbs: ['Αποθήκη', 'Απόθεμα'] },
- '/reports/today': { title: 'Σήμερα', crumbs: ['Αναφορές', 'Σήμερα'] },
- '/reports/store': { title: 'Κατάστημα', crumbs: ['Αναφορές', 'Κατάστημα'] },
- '/reports/staff': { title: 'Προσωπικό', crumbs: ['Αναφορές', 'Προσωπικό'] },
- '/reports/products': { title: 'Προϊόντα', crumbs: ['Αναφορές', 'Προϊόντα'] },
- '/reports/prep-zones': { title: 'Ζώνες Ετοιμασίας', crumbs: ['Αναφορές', 'Ζώνες Ετοιμασίας'] },
- '/reports/expenses': { title: 'Έξοδα', crumbs: ['Αναφορές', 'Έξοδα'] },
- '/reports/technical': { title: 'Τεχνικά', crumbs: ['Αναφορές', 'Τεχνικά'] },
- '/reports/misc': { title: 'Λοιπά', crumbs: ['Αναφορές', 'Λοιπά'] },
- '/apps': { title: 'Εφαρμογές' },
- '/apps/phone': { title: 'Τηλέφωνο', crumbs: ['Εφαρμογές', 'Τηλέφωνο'] },
- '/settings': { title: 'Ρυθμίσεις' },
- '/notes': { title: 'Σημειώσεις' },
-}
+// ─── Page title / breadcrumb (from shell/nav.js) ─────────────────────────────
function PageTitle() {
const { pathname } = useLocation()
+ const { t } = useTranslation('manager')
+ const page = pageFor(pathname)
- // Match exact first, then try prefix for dynamic routes like /orders/:id
- let meta = ROUTE_META[pathname]
- if (!meta && pathname.startsWith('/orders/')) {
- meta = { title: 'Order Detail', crumbs: ['Order Detail'] }
- }
-
- if (!meta) return
XeniaPOS
-
- if (!meta.crumbs) {
- return
{meta.title}
- }
+ if (!page) return
XeniaPOS
+ if (!page.parent) return
{t(page.label)}
return (
)
}
@@ -408,7 +365,7 @@ export default function AppLayout() {
-
+
diff --git a/manager_dashboard/src/pages/Settings/SettingsPage.jsx b/manager_dashboard/src/pages/Settings/SettingsPage.jsx
index 7e86290..96267a2 100644
--- a/manager_dashboard/src/pages/Settings/SettingsPage.jsx
+++ b/manager_dashboard/src/pages/Settings/SettingsPage.jsx
@@ -5,7 +5,6 @@ import OperationTab from './tabs/OperationTab'
import PrintFontsTab from './tabs/PrintFontsTab'
import SecurityTab from './tabs/SecurityTab'
import DevelopmentTab from './tabs/DevelopmentTab'
-import Phase2FeaturesTab from './tabs/Phase2FeaturesTab'
import FiscalTab from './tabs/FiscalTab'
import { TabGroup } from '../../ui/Tabs'
@@ -16,7 +15,6 @@ const TABS = [
{ id: 'colours', label: 'Εμφάνιση' },
{ id: 'print-fonts', label: 'Εκτύπωση' },
{ id: 'fiscal', label: 'Ταμειακή' },
- { id: 'features', label: 'Λειτουργίες' },
{ id: 'development', label: 'Developer' },
]
@@ -33,7 +31,6 @@ export default function SettingsPage() {
{activeTab === 'colours' &&