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:
@@ -1,8 +1,9 @@
|
||||
import { useState } from 'react'
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import toast from 'react-hot-toast'
|
||||
import { Shield, Lock, LogOut, User, KeyRound, ShieldCheck, Copy, RefreshCw, X } from 'lucide-react'
|
||||
import { Shield, Lock, LogOut, User, ShieldCheck, Copy, RefreshCw, X } from 'lucide-react'
|
||||
import client from '../../../api/client'
|
||||
import SignInSettings from '../sections/SignInSettings'
|
||||
import { PANEL_CLASS } from '../../../ui/tokens'
|
||||
import Button from '../../../ui/Button'
|
||||
|
||||
@@ -76,28 +77,6 @@ function Toggle({ checked, onChange, disabled }) {
|
||||
)
|
||||
}
|
||||
|
||||
function SegmentedControl({ options, value, onChange, disabled }) {
|
||||
return (
|
||||
<div className="flex rounded-lg border border-gray-200 overflow-hidden bg-gray-50 p-0.5 gap-0.5">
|
||||
{options.map(opt => (
|
||||
<button
|
||||
key={opt.value}
|
||||
type="button"
|
||||
onClick={() => !disabled && onChange(opt.value)}
|
||||
disabled={disabled}
|
||||
className={`px-3 py-1.5 text-xs font-medium rounded-md transition-all ${
|
||||
value === opt.value
|
||||
? 'bg-white text-gray-800 shadow-sm'
|
||||
: 'text-gray-500 hover:text-gray-700'
|
||||
}`}
|
||||
>
|
||||
{opt.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function TimeSelect({ value, onChange, disabled }) {
|
||||
return (
|
||||
<div className="flex items-center gap-2">
|
||||
@@ -290,8 +269,6 @@ export default function SecurityTab() {
|
||||
)
|
||||
}
|
||||
|
||||
const loginMethod = get('security.login_method', 'password')
|
||||
const autofill = get('security.autofill_username', 'true') === 'true'
|
||||
const autoLock = get('security.auto_lock', 'false') === 'true'
|
||||
const autoLockSecs = get('security.auto_lock_seconds', '300')
|
||||
const autoLogout = get('security.auto_logout', 'false') === 'true'
|
||||
@@ -300,46 +277,8 @@ export default function SecurityTab() {
|
||||
return (
|
||||
<div className="space-y-5">
|
||||
|
||||
{/* ── Μέθοδος σύνδεσης ─────────────────────────────────────────────── */}
|
||||
<SectionCard
|
||||
icon={KeyRound}
|
||||
title="Σύνδεση"
|
||||
description="Τι διαπιστευτήρια απαιτούνται όταν η εφαρμογή ξεκινά ή μετά από πλήρη αποσύνδεση."
|
||||
>
|
||||
<OptionRow
|
||||
label="Μέθοδος σύνδεσης"
|
||||
description="Πώς πιστοποιούνται οι διαχειριστές κατά την πρώτη πρόσβαση."
|
||||
>
|
||||
<SegmentedControl
|
||||
value={loginMethod}
|
||||
onChange={v => save('security.login_method', v)}
|
||||
disabled={busy}
|
||||
options={[
|
||||
{ value: 'password', label: 'Κωδικός' },
|
||||
{ value: 'pin', label: 'PIN' },
|
||||
{ value: 'none', label: 'Κανένα' },
|
||||
]}
|
||||
/>
|
||||
</OptionRow>
|
||||
|
||||
{loginMethod === 'none' && (
|
||||
<div className="mx-5 mb-4 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-[12px] text-amber-700">
|
||||
<strong>Προσοχή:</strong> με έναν μόνο λογαριασμό διαχειριστή, η εφαρμογή θα ανοίγει χωρίς πιστοποίηση.
|
||||
Χρησιμοποιήστε αυτό μόνο σε φυσικά ασφαλή, ιδιωτική συσκευή.
|
||||
</div>
|
||||
)}
|
||||
|
||||
<OptionRow
|
||||
label="Αυτόματη συμπλήρωση ονόματος χρήστη"
|
||||
description="Όταν υπάρχει μόνο ένας διαχειριστής, παράλειψη του πεδίου ονόματος."
|
||||
>
|
||||
<Toggle
|
||||
checked={autofill}
|
||||
onChange={v => save('security.autofill_username', v ? 'true' : 'false')}
|
||||
disabled={busy}
|
||||
/>
|
||||
</OptionRow>
|
||||
</SectionCard>
|
||||
{/* Sign-in (2.6f): the v2 settings auth.* replace the v1 security.login_method card */}
|
||||
<SignInSettings />
|
||||
|
||||
{/* ── Αυτόματο κλείδωμα ────────────────────────────────────────────── */}
|
||||
<SectionCard
|
||||
|
||||
Reference in New Issue
Block a user