Files
xenia-pos-local/manager_dashboard/src/pages/Settings/SettingsPage.jsx
T
bonaminandClaude Opus 5.5 2a38602d45 feat(manager): the venue's identity (Settings -> Identity): name, slogan, named colours, logos, guest Wi-Fi, contact details
Set once (GET/PUT /api/identity, venue.name + venue.identity); every colour field
offers the venue's colours first (VenueColoursProvider in @xenia/ui); signage screens
get the identity and the venue's time zone with their venue and are told on a change;
logos are protected in the media library; wifiQr() for the join-the-network code.
Plan 6R.14, F-111.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:10:58 +02:00

60 lines
2.9 KiB
React

// Settings (plan step 6.14a; every tab on v2): General, Venue & language, the customer display and
// menu tablets (with those apps), Sign-in & security, Operation, Appearance (the waiter app's table
// colours), Printing, Fiscal device (with that app) and Development. The tab is in the address
// (?tab=…), so a link or a reload opens the same one. Everything here needs core.settings.manage.
import { useSearchParams } from 'react-router-dom'
import { useCan, useModule } from '@xenia/access'
import { useTranslation } from '@xenia/i18n'
import { Page, Tabs } from '@xenia/ui'
import PrintingSettings from '../printing/PrintingSettings'
import CustomerDisplaySettings from './sections/CustomerDisplaySettings'
import DevelopmentSettings from './sections/DevelopmentSettings'
import FiscalSettings from './sections/FiscalSettings'
import MenuTabletSettings from './sections/MenuTabletSettings'
import OperationSettings from './sections/OperationSettings'
import SecuritySettings from './sections/SecuritySettings'
import SystemSettings from './sections/SystemSettings'
import TableColours from './sections/TableColours'
import VenueSettings from './sections/VenueSettings'
import IdentitySettings from './sections/IdentitySettings'
const TABS = {
'app-info': () => <SystemSettings />,
venue: () => <VenueSettings />,
identity: () => <IdentitySettings />,
'customer-display': () => <CustomerDisplaySettings />,
'menu-tablets': () => <MenuTabletSettings />,
security: () => <SecuritySettings />,
operation: () => <OperationSettings />,
colours: () => <TableColours />,
'print-fonts': () => <PrintingSettings />,
fiscal: () => <FiscalSettings />,
development: () => <DevelopmentSettings />,
}
export default function SettingsPage() {
const { t } = useTranslation('manager')
const [params, setParams] = useSearchParams()
// tabs that need an app (and, for the screens, the key to set them up)
const displayOn = useModule('customer_display')
const displayKey = useCan('customer_display.manage')
const tabletOn = useModule('menu_tablet')
const tabletKey = useCan('menu_tablet.manage')
const display = displayOn && displayKey
const tablets = tabletOn && tabletKey
const waiterApp = useModule('waiter_app')
const fiscal = useModule('fiscal')
const shown = { 'customer-display': display, 'menu-tablets': tablets, colours: waiterApp, fiscal }
const tabs = Object.keys(TABS).filter(id => shown[id] ?? true)
const active = tabs.includes(params.get('tab')) ? params.get('tab') : tabs[0]
const Tab = TABS[active]
return (
// settings are forms: the page's form width, centred (the page rule, 2026-11-20)
<Page testId="settings-page" width="form" aria-label={t('settings.title')}
top={<Tabs size="lg" value={active} onChange={id => setParams({ tab: id }, { replace: true })}
tabs={tabs.map(id => ({ id, label: t(`settings.tabs.${id}`), testId: `settings-tab-${id}` }))} />}>
<Tab />
</Page>
)
}