feat(manager): notification bell, sign-in/venue/print settings, log download (platform-v2 2.6f)

- Bell in the header: /api/platform/notifications with unread count, live via
  the new LiveProvider (one createLiveClient connection) on platform_notification
  and reconnect; mark read / all; warning+critical pop a toast.
- Settings: Sign-in card (manager/waiter/device modes, require username, one
  session per manager/waiter, username autofill) replaces the dead v1
  security.login_method card; new "Venue & language" tab (language, time zone);
  print alert threshold in Printing. Tab labels are i18n keys.
- Technical > Log files: list + download of the daily logs (owner-level).
  Backend: GET /api/system/logs, /api/system/logs/{date} (core.settings.manage),
  error system.log_not_found.
- Setup wizard asks staff language and time zone (setup/init stores them).
- @xenia/ui theme helpers (applyTheme, getStoredTheme); the manager stays light
  until phase 6 converts the older pages (owner decision 2026-11-14).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-14 09:01:26 +02:00
co-authored by Claude Opus 5.5
parent 92bc1b0113
commit 2426ffddad
36 changed files with 995 additions and 92 deletions
@@ -0,0 +1,61 @@
// Sign-in settings (plan step 2.6f, APPS_PLATFORM D-8, D-9). Backend-only until now:
// auth.manager_login_mode, auth.waiter_login_mode, auth.waiter_require_username,
// auth.default_login_mode (paired devices; a device can choose its own on the Devices page),
// auth.single_session_manager / _waiter, and security.autofill_username (the sign-in page).
// Replaces the v1 "login method" card, whose setting (security.login_method) no longer exists.
import { useId } from 'react'
import { useTranslation } from '@xenia/i18n'
import { Select, Spinner, Switch } from '@xenia/ui'
import { SettingRow, SettingsCard } from './SettingsCard'
import { useSettings } from './useSettings'
const SESSION_RULES = ['off', 'refuse_new', 'end_old']
export default function SignInSettings() {
const { t } = useTranslation('manager')
const s = useSettings()
const idManager = useId()
const idWaiter = useId()
const idDevice = useId()
const idSingleManager = useId()
const idSingleWaiter = useId()
if (s.loading) return <div className="py-8 flex justify-center"><Spinner /></div>
const opts = (keys, prefix) => keys.map(k => ({ value: k, label: t(`${prefix}.${k}`) }))
const select = (key, fallback, options, id) => (
<Select id={id} value={s.get(key, fallback)} disabled={s.saving} onChange={e => s.save(key, e.target.value)}
options={options} data-testid={`setting-${key}`} />
)
const toggle = (key, fallback, label) => (
<Switch aria-label={label} checked={s.get(key, fallback) === 'true'} disabled={s.saving}
onChange={v => s.save(key, v ? 'true' : 'false')} data-testid={`setting-${key}`} />
)
const waiterMode = s.get('auth.waiter_login_mode', 'pin')
return (
<SettingsCard title={t('settings.signIn.title')} description={t('settings.signIn.intro')} testId="settings-sign-in">
<SettingRow label={t('settings.signIn.manager')} htmlFor={idManager} tip={t('settings.signIn.managerTip')}>
{select('auth.manager_login_mode', 'password', opts(['password', 'pin'], 'settings.mode'), idManager)}
</SettingRow>
<SettingRow label={t('settings.signIn.autofill')} hint={t('settings.signIn.autofillHint')}>
{toggle('security.autofill_username', 'true', t('settings.signIn.autofill'))}
</SettingRow>
<SettingRow label={t('settings.signIn.waiter')} htmlFor={idWaiter}
warning={waiterMode === 'tap' ? t('settings.signIn.waiterTapWarning') : undefined}>
{select('auth.waiter_login_mode', 'pin', opts(['pin', 'password', 'tap'], 'settings.mode'), idWaiter)}
</SettingRow>
<SettingRow label={t('settings.signIn.requireUsername')} hint={t('settings.signIn.requireUsernameHint')}>
{toggle('auth.waiter_require_username', 'false', t('settings.signIn.requireUsername'))}
</SettingRow>
<SettingRow label={t('settings.signIn.device')} htmlFor={idDevice} hint={t('settings.signIn.deviceHint')}>
{select('auth.default_login_mode', 'pin', opts(['pin', 'password', 'tap', 'none'], 'settings.mode'), idDevice)}
</SettingRow>
<SettingRow label={t('settings.signIn.singleManager')} htmlFor={idSingleManager} tip={t('settings.signIn.singleTip')}>
{select('auth.single_session_manager', 'off', opts(SESSION_RULES, 'settings.session'), idSingleManager)}
</SettingRow>
<SettingRow label={t('settings.signIn.singleWaiter')} htmlFor={idSingleWaiter}>
{select('auth.single_session_waiter', 'off', opts(SESSION_RULES, 'settings.session'), idSingleWaiter)}
</SettingRow>
</SettingsCard>
)
}