diff --git a/docs/DESIGN.md b/docs/DESIGN.md new file mode 100644 index 0000000..6ffc84d --- /dev/null +++ b/docs/DESIGN.md @@ -0,0 +1,77 @@ +# Design language (on-site frontends) + +> The rules every screen of the manager (and later the terminal and the waiter app) follows, so the product looks like one thing. +> **Read this before writing or changing any page, dialog or component.** Change a rule here first, then in `packages/ui`, never in one page. +> Started 2026-11-20 from the owner's UI review (modelled on the BellSystems control panel's `DESIGN.md`). + +## 1. Principles + +- **Global, never local.** Anything that two pages need is a component or a token in `@xenia/ui` (`packages/ui`). If a page needs a new look, add it to `@xenia/ui` and use it from there. Never rebuild a dropdown, a tab strip or a page frame inside a page. +- **Tokens only.** Colours, sizes, radii, paddings and heights come from `packages/ui/src/tokens.css` (Tailwind names from `tailwind-preset.js`). No hex or rgb values in app code (see also CS-16). +- **Same height in a row.** Controls that sit side by side (a search box, dropdowns, chips, buttons) share one height: `md` (44 px, `--x-control-md`) unless the whole row is `sm`. +- **Quiet secondary text.** `text-ink-2` / `text-ink-3` are muted on purpose. Don't make subtitles, hints or labels darker to make them stand out. + +## 2. The page rule + +Every page's root is `` from `@xenia/ui`. It provides: + +- **its own scrolling** (the shell's `
` never scrolls), +- **the width:** it fills the content area up to the width of a 16:9 screen (`--x-page-max` = `max(1280px, 100vh × 16/9)`). On a 1080p monitor the page fills the screen; on an ultrawide it stays 16:9 wide and is **centred**, +- **the padding and gaps** (`--x-page-pad`, `--x-page-gap`), the same on every page. + +```jsx + + New} /> + + + + + + +``` + +- `top={}` keeps a tab strip above the scrolling part (Online orders, Settings). The tab is kept in the address (`?tab=`). +- `width="form"` for settings and forms (centred at `--x-page-form-max`, 880 px). Lists, tables and dashboards use the default (full). +- **Never** put `p-*`, `max-w-*`, `mx-auto`, `h-full` or `overflow-*` on a page's root, and never nest a second width limit inside it. +- Checked by `tests/e2e/manager_layout.mjs` (1920×1080 and 3440×1440: every page fills / is centred, and scrolls). Add a new page to its `PAGES` list. + +Pages not on `` yet (own layouts, next review pass): Management → Products (category tree + list), Management → Tables (list + floor editor), Inventory → Stock (placeholder). + +## 3. Components (`@xenia/ui`) + +| Need | Use | Notes | +|---|---|---| +| A page | `Page`, `PageHeader` | §2 | +| Filters / actions over a list | `Toolbar`, `ToolbarSpacer` | every control in it the same height; the search box grows | +| Search | `SearchInput` | icon, clear button; `onChange(text)` | +| Choose one / several | `Dropdown` (`multiple`) | **never a native ` setQ(e.target.value)} placeholder={t('customers.search')} aria-label={t('customers.search')} className="pl-9" data-testid="customer-search" /> - + + } onClick={() => setDialog({ kind: 'new' })} data-testid="customer-new">{t('customers.new')}} /> + + + {isPending ?
: !rows.length && !search ? } title={t('customers.none')} description={t('customers.noneHint')} /> : ( @@ -80,7 +73,6 @@ export default function CustomersPage() { empty={t('customers.noMatch')} initialSort={{ key: 'name', dir: 'asc' }} /> )} - {(dialog?.kind === 'new' || dialog?.kind === 'edit') && } {dialog?.kind === 'card' && setDialog({ kind: 'edit', customer: dialog.customer })} />} {dialog?.kind === 'remove' && ( @@ -90,6 +82,6 @@ export default function CustomersPage() { } /> )} - +
) } diff --git a/manager_dashboard/src/pages/finance/ContactsPage.jsx b/manager_dashboard/src/pages/finance/ContactsPage.jsx index d21a99e..695b991 100644 --- a/manager_dashboard/src/pages/finance/ContactsPage.jsx +++ b/manager_dashboard/src/pages/finance/ContactsPage.jsx @@ -5,10 +5,10 @@ import { useState } from 'react' import { useMutation } from '@tanstack/react-query' import toast from 'react-hot-toast' -import { BookUser, Pencil, Plus, Search, Trash2 } from 'lucide-react' +import { BookUser, Pencil, Plus, Trash2 } from 'lucide-react' import { errorMessage } from '@xenia/api' import { useFormat, useTranslation } from '@xenia/i18n' -import { Button, Dialog, EmptyState, IconButton, Input, Select, Spinner } from '@xenia/ui' +import { Button, Dialog, Dropdown, EmptyState, IconButton, Page, PageHeader, SearchInput, Spinner, Toolbar } from '@xenia/ui' import client from '../../api/client' import { useLiveQuery } from '../../live/useLiveQuery' import { Pill } from '../overview/parts' @@ -21,7 +21,7 @@ const TYPE_TONE = { supplier: 'accent', staff: 'success', utility: 'warning', ot export default function ContactsPage() { const { t } = useTranslation('manager') const fmt = useFormat() - const [filter, setFilter] = useState({ type: '', q: '' }) + const [filter, setFilter] = useState({ type: [], q: '' }) const [dialog, setDialog] = useState(null) // { kind: 'new' | 'edit' | 'remove', contact } const { data, isPending, refetch } = useLiveQuery({ queryKey: ['contacts'], queryFn: () => client.get('/api/contacts/').then(r => r.data), events: ['expenses.changed'] }) const { data: expenses = [] } = useLiveQuery({ queryKey: ['expenses'], queryFn: () => client.get('/api/expenses/').then(r => r.data), events: ['expenses.changed'] }) @@ -57,23 +57,14 @@ export default function ContactsPage() { ] return ( -
-
-
-
-

{t('finance.contacts.title')}

-

{t('finance.contacts.subtitle', { count: all.length })}

-
- -
-
-
-
- set('q', e.target.value)} placeholder={t('finance.exp.search')} aria-label={t('finance.exp.search')} className="pl-9" /> -
- set('category', e.target.value)} aria-label={t('finance.exp.category')} - options={[{ value: '', label: t('finance.exp.allCategories') }, ...CATEGORIES.map(c => ({ value: c, label: cat(c) }))]} /> -
+ + set('q', v)} placeholder={t('finance.exp.search')} /> + set('status', v)} aria-label={t('finance.exp.status')} data-testid="expenses-status" allLabel={t('finance.exp.all')} + options={['due', 'partial', 'paid'].map(s => ({ value: s, label: t(`finance.status.${s}`) }))} /> + set('category', v)} aria-label={t('finance.exp.category')} allLabel={t('finance.exp.allCategories')} + options={CATEGORIES.map(c => ({ value: c, label: cat(c) }))} /> + {isPending ?
: !all.length ? } title={t('finance.exp.none')} description={t('finance.exp.noneHint')} /> @@ -104,7 +95,6 @@ export default function ExpensesPage() { initialSort={{ key: 'created_at', dir: 'desc' }} /> )} -
{(dialog?.kind === 'new' || dialog?.kind === 'edit') && } {dialog?.kind === 'pay' && } @@ -120,7 +110,7 @@ export default function ExpensesPage() { } /> )} - +
) } @@ -144,7 +134,7 @@ function ExpenseView({ expense: e, cat, onClose, onPay, onEdit }) { {e.due_date &&

{t('finance.exp.dueOn', { date: fmt.formatDate(e.due_date) })}

} {e.notes &&

{e.notes}

} -

{t('finance.exp.payments')}

+

{t('finance.exp.payments')}

{e.payments?.length ? (
    {e.payments.map(p => ( @@ -163,7 +153,7 @@ function ExpenseView({ expense: e, cat, onClose, onPay, onEdit }) { function Figure({ label, value, tone }) { return (
    - {label} + {label} {value}
    ) diff --git a/manager_dashboard/src/pages/finance/TabsPage.jsx b/manager_dashboard/src/pages/finance/TabsPage.jsx index 30a95d9..9f7d2e3 100644 --- a/manager_dashboard/src/pages/finance/TabsPage.jsx +++ b/manager_dashboard/src/pages/finance/TabsPage.jsx @@ -9,7 +9,7 @@ import toast from 'react-hot-toast' import { Banknote, CheckCircle2, ChevronDown, CreditCard, HandHeart, Search } from 'lucide-react' import { errorMessage } from '@xenia/api' import { useFormat, useTranslation } from '@xenia/i18n' -import { Button, EmptyState, Input, Spinner, cx } from '@xenia/ui' +import { Button, EmptyState, Input, Page, Spinner, cx } from '@xenia/ui' import client from '../../api/client' import { useLiveQuery } from '../../live/useLiveQuery' import { Pill } from '../overview/parts' @@ -40,8 +40,7 @@ export default function TabsPage() { }) return ( -
    -
    +

    {t('finance.tabs.title')}

    {t('finance.tabs.subtitle')}

    @@ -75,9 +74,8 @@ export default function TabsPage() { ))}
)} - setDialog(null)} onSaved={() => { setDialog(null); refresh() }} /> - + ) } @@ -110,14 +108,14 @@ function TabCard({ tab, open, onToggle, onPay, onForgive, onClose, closing }) {
{[['charged', tab.total_charged, 'text-ink'], ['paid', tab.total_paid, 'text-success-ink'], ['balance', tab.balance, tab.balance > 0.005 ? 'text-danger-ink' : 'text-ink']].map(([k, v, tone]) => ( - {t(`finance.tabs.${k}`)} + {t(`finance.tabs.${k}`)} {fmt.formatMoney(v)} ))}
-

{t('finance.tabs.charges')}

+

{t('finance.tabs.charges')}

{tab.entries.length ? (
    {tab.entries.map(e => ( @@ -133,7 +131,7 @@ function TabCard({ tab, open, onToggle, onPay, onForgive, onClose, closing }) { ) :

    {t('finance.tabs.noCharges')}

    }
-

{t('finance.tabs.payments')}

+

{t('finance.tabs.payments')}

{tab.payments.length ? (
    {tab.payments.map(p => ( diff --git a/manager_dashboard/src/pages/finance/financeLogic.js b/manager_dashboard/src/pages/finance/financeLogic.js index bbd14a0..39048b8 100644 --- a/manager_dashboard/src/pages/finance/financeLogic.js +++ b/manager_dashboard/src/pages/finance/financeLogic.js @@ -57,10 +57,15 @@ export function isLate(expense, today, dateKey) { } /** The page's list after its filters: status ('' | 'unpaid' | due | partial | paid), category, text. */ +/** A filter's chosen values: a list (the toolbars' multi-selects, 2026-11-20), one value, or none = all. */ +const picked = v => (Array.isArray(v) ? v : v ? [v] : []) + export function filterExpenses(list, { status = '', category = '', q = '' } = {}) { const words = q.trim().toLowerCase().split(/\s+/).filter(Boolean) - return list.filter(e => (!status || (status === 'unpaid' ? e.status !== 'paid' : e.status === status)) - && (!category || e.category === category) + const statuses = picked(status) + const categories = picked(category) + return list.filter(e => (!statuses.length || statuses.some(s => (s === 'unpaid' ? e.status !== 'paid' : e.status === s))) + && (!categories.length || categories.includes(e.category)) && words.every(w => `${e.description} ${e.contact_name ?? ''} ${e.notes ?? ''}`.toLowerCase().includes(w))) } @@ -107,7 +112,8 @@ export function contactBody(form) { export function filterContacts(list, { type = '', q = '' } = {}) { const words = q.trim().toLowerCase().split(/\s+/).filter(Boolean) - return list.filter(c => (!type || c.type === type) + const types = picked(type) + return list.filter(c => (!types.length || types.includes(c.type)) && words.every(w => `${c.name} ${c.phone ?? ''} ${c.email ?? ''} ${c.notes ?? ''}`.toLowerCase().includes(w))) } diff --git a/manager_dashboard/src/pages/floor/FloorPlansTab.jsx b/manager_dashboard/src/pages/floor/FloorPlansTab.jsx index ef37ec5..4065aed 100644 --- a/manager_dashboard/src/pages/floor/FloorPlansTab.jsx +++ b/manager_dashboard/src/pages/floor/FloorPlansTab.jsx @@ -35,7 +35,7 @@ export default function FloorPlansTab() {
    {byZone.map(z => (
    - {z.name} + {z.name}
    {z.plans.map(p => (
} - {removing && ( setRemoving(null)} title={t('waste.deleteTitle', { name: removing.product_name })} footer={<> @@ -108,7 +106,7 @@ export default function ThrowawaysPage() { } /> )} - + ) } diff --git a/manager_dashboard/src/pages/media/MediaPage.jsx b/manager_dashboard/src/pages/media/MediaPage.jsx index 221cfec..f7c538d 100644 --- a/manager_dashboard/src/pages/media/MediaPage.jsx +++ b/manager_dashboard/src/pages/media/MediaPage.jsx @@ -7,7 +7,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react' import { Upload } from 'lucide-react' import { errorMessage } from '@xenia/api' import { useTranslation } from '@xenia/i18n' -import { Button, EmptyState, Input, Select, Spinner, cx } from '@xenia/ui' +import { Button, EmptyState, Input, Page, Select, Spinner, cx } from '@xenia/ui' import { listMedia } from './mediaApi' import { ACCEPT, preparing } from './mediaLogic' import MediaDetails from './MediaDetails' @@ -57,8 +57,8 @@ export default function MediaPage() { const closeDetails = useCallback(() => setOpen(null), []) return ( -
{ if ([...(e.dataTransfer?.types || [])].includes('Files')) { e.preventDefault(); setDragging(true) } }} onDragLeave={e => { if (e.currentTarget === e.target) setDragging(false) }} onDrop={onDrop}> @@ -95,6 +95,6 @@ export default function MediaPage() { {open && setPage(p => p && { ...p, items: p.items.map(x => (x.id === m.id ? { ...x, ...m } : x)) })} onDeleted={id => setPage(p => p && { ...p, items: p.items.filter(x => x.id !== id), total: p.total - 1 })} />} -
+ ) } diff --git a/manager_dashboard/src/pages/notes/NotesPage.jsx b/manager_dashboard/src/pages/notes/NotesPage.jsx index b60fe3a..b735976 100644 --- a/manager_dashboard/src/pages/notes/NotesPage.jsx +++ b/manager_dashboard/src/pages/notes/NotesPage.jsx @@ -8,7 +8,7 @@ import toast from 'react-hot-toast' import { Check, ChevronDown, Pin, PinOff, Plus, Trash2 } from 'lucide-react' import { errorMessage } from '@xenia/api' import { useFormat, useTranslation } from '@xenia/i18n' -import { Button, Dialog, IconButton, Input, Switch, Textarea, cx } from '@xenia/ui' +import { Button, Dialog, IconButton, Input, Page, Switch, Textarea, cx } from '@xenia/ui' import client from '../../api/client' import { useLiveQuery } from '../../live/useLiveQuery' import { Panel } from '../reports/kit/parts' @@ -36,8 +36,7 @@ export default function NotesPage() { const { pinned, rest } = splitNotes(notes) const { open, done } = splitTodos(todos) return ( -
-
+

{t('notes.title')}

{t('notes.subtitle', { notes: notes.length, todos: open.length })}

@@ -62,7 +61,6 @@ export default function NotesPage() {
- {removing && ( setRemoving(null)} title={t(removing.kind === 'note' ? 'notes.deleteNote' : 'notes.deleteTodo')} description={removing.item.body.length > 120 ? `${removing.item.body.slice(0, 120)}…` : removing.item.body} @@ -71,12 +69,12 @@ export default function NotesPage() { } /> )} - + ) } function Label({ children }) { - return {children} + return {children} } function NewNote() { diff --git a/manager_dashboard/src/pages/online/FeesPage.jsx b/manager_dashboard/src/pages/online/FeesPage.jsx index 933eb3f..d9bb351 100644 --- a/manager_dashboard/src/pages/online/FeesPage.jsx +++ b/manager_dashboard/src/pages/online/FeesPage.jsx @@ -1,3 +1,4 @@ +// Online ordering settings: Online orders → Settings (2026-11-20; was its own page /online/fees). // Online ordering (plan phase 3S, steps S.3–S.5): the ordering settings (OrderingSettings), // delivery areas and fees, and the fee's line on the receipt (FeeProductCard). Backend: /api/connect/fees // (connect_orders.fees). The venue lists the areas it delivers to and the fee rules, looked @@ -49,14 +50,11 @@ export default function FeesPage() { } } - if (error) return
- if (!data) return
+ if (error) return + if (!data) return
return ( -
-
-

{t('ordering.pageTitle')}

-
+
{data.links?.order && } diff --git a/manager_dashboard/src/pages/online/OnlineOrdersPage.jsx b/manager_dashboard/src/pages/online/OnlineOrdersPage.jsx index 28fbb8c..64b6410 100644 --- a/manager_dashboard/src/pages/online/OnlineOrdersPage.jsx +++ b/manager_dashboard/src/pages/online/OnlineOrdersPage.jsx @@ -4,17 +4,22 @@ // then ready (takeaway) or out for delivery, then delivered. Each card shows the customer, when // they want it, the venue's own price check and the lines. The lists refresh on the live // events (a new order, a status change), after a reconnect, and every 20 seconds. +// Settings (2026-11-20, was the page /online/fees): ordering hours, delivery areas and fees, for +// whoever has connect_orders.fees. The tab is kept in the address (?tab=). import { useState } from 'react' +import { useSearchParams } from 'react-router-dom' import { useQueryClient } from '@tanstack/react-query' import toast from 'react-hot-toast' import { Check, RefreshCw, StickyNote, X } from 'lucide-react' import { errorMessage } from '@xenia/api' import { useFormat, useTranslation } from '@xenia/i18n' -import { Button, EmptyState, Field, Spinner, Textarea, cx } from '@xenia/ui' +import { useCan } from '@xenia/access' +import { Button, EmptyState, Field, Page, Spinner, Tabs, Textarea, cx } from '@xenia/ui' import client from '../../api/client' import { useLiveQuery } from '../../live/useLiveQuery' import { lineTotal, orderTotal } from '../overview/overviewLogic' import { Pill } from '../overview/parts' +import FeesPage from './FeesPage' import { ONLINE_TABS, ONLINE_TONE, onlineKind, onlineNextStep } from './onlineOrdersLogic' const EVENTS = ['online_order_received', 'online_order_updated'] @@ -33,9 +38,13 @@ function useList(tab) { export default function OnlineOrdersPage() { const { t } = useTranslation('manager') const qc = useQueryClient() - const [tab, setTab] = useState('incoming') + const canSettings = useCan('connect_orders.fees') + const [params, setParams] = useSearchParams() + const asked = params.get('tab') + const tab = asked === 'settings' ? (canSettings ? 'settings' : 'incoming') : ONLINE_TABS.includes(asked) ? asked : 'incoming' + const setTab = id => setParams(p => { const n = new URLSearchParams(p); n.set('tab', id); return n }, { replace: true }) const lists = { incoming: useList('incoming'), active: useList('active'), history: useList('history') } - const current = lists[tab] + const current = lists[tab] ?? lists.incoming const refresh = () => qc.invalidateQueries({ queryKey: ['online-orders'] }) async function act(fn) { @@ -47,34 +56,29 @@ export default function OnlineOrdersPage() { : client.post(`/api/connect/orders/${id}/status`, { status: extra }) )) + const tabs = [ + ...ONLINE_TABS.map(k => { + const count = lists[k].data?.length ?? 0 + return { id: k, label: t(`onlineOrders.tab.${k}`), badge: count > 0 ? count : null, warn: k === 'incoming', testId: `online-tab-${k}` } + }), + ...(canSettings ? [{ id: 'settings', label: t('onlineOrders.tab.settings'), testId: 'online-tab-settings' }] : []), + ] + return ( -
-
- {ONLINE_TABS.map(k => { - const count = lists[k].data?.length ?? 0 - return ( - - ) - })} - - -
-
+ } loading={current.isFetching} onClick={refresh}>{t('onlineOrders.refresh')}} />}> + {tab === 'settings' ? : (<> {current.error && } {current.isPending ?
: current.data?.length === 0 ? : ( -
+
{current.data?.map(o => )}
)} -
-
+ )} + ) } diff --git a/manager_dashboard/src/pages/online/QrCodesPage.jsx b/manager_dashboard/src/pages/online/TableQrCodes.jsx similarity index 83% rename from manager_dashboard/src/pages/online/QrCodesPage.jsx rename to manager_dashboard/src/pages/online/TableQrCodes.jsx index 034d6e7..44485cf 100644 --- a/manager_dashboard/src/pages/online/QrCodesPage.jsx +++ b/manager_dashboard/src/pages/online/TableQrCodes.jsx @@ -1,3 +1,4 @@ +// The tables' QR codes: Tables → QR codes (2026-11-20; was its own page /online/qr). // The tables' QR codes (plan phase 3S, step S.7): one code per table that opens the QR menu // at that table. The venue chooses whether guests can order from it (straight onto the // table's order, to the kitchen, with a message to the table's waiters) or only read it. A @@ -13,7 +14,7 @@ import { Button, Dialog, EmptyState, Spinner, Switch } from '@xenia/ui' import { QrCode } from '@xenia/ui/qr' import client from '../../api/client' -export default function QrCodesPage() { +export default function TableQrCodes() { const { t } = useTranslation('manager') const [data, setData] = useState(null) const [error, setError] = useState(null) @@ -31,17 +32,13 @@ export default function QrCodesPage() { setBusy(false) } - if (error) return
- if (!data) return
+ if (error) return + if (!data) return
return ( -
-
-

{t('qr.title')}

-

{t('qr.intro')}

-
- -
+
+
+

{t('qr.intro')}

act(() => client.put('/api/connect/qr/ordering', { on }), t('fees.saved'))} label={t('qr.ordering')} description={t(data.ordering ? 'qr.orderingOn' : 'qr.orderingOff')} /> @@ -57,7 +54,7 @@ export default function QrCodesPage() { ) : (
    {data.tables.map(tb => ( -
  • +
  • {t('qr.table', { name: tb.name })} {tb.group && {tb.group}} diff --git a/manager_dashboard/src/pages/orders/OrderPage.jsx b/manager_dashboard/src/pages/orders/OrderPage.jsx index 14ca7c3..846b082 100644 --- a/manager_dashboard/src/pages/orders/OrderPage.jsx +++ b/manager_dashboard/src/pages/orders/OrderPage.jsx @@ -10,7 +10,7 @@ import toast from 'react-hot-toast' import { ArrowLeft, Ban, CheckCheck, CreditCard, Printer } from 'lucide-react' import { errorMessage } from '@xenia/api' import { useFormat, useTranslation } from '@xenia/i18n' -import { Button, Dialog, EmptyState, Select, Spinner, cx } from '@xenia/ui' +import { Button, Dialog, EmptyState, Page, Select, Spinner, cx } from '@xenia/ui' import client from '../../api/client' import { useLiveQuery } from '../../live/useLiveQuery' import { useDuration } from '../overview/hooks' @@ -54,8 +54,7 @@ function NewOrder({ tableId }) { const table = tables.find(x => x.id === tableId) const open = async () => (await client.post('/api/orders/', { table_id: tableId, order_type: 'here' })).data.id return ( -
    -
    +

    {t('orders.newTitle', { table: table ? tableName(table) : tableId ?? '' })}

    @@ -66,8 +65,7 @@ function NewOrder({ tableId }) { qc.invalidateQueries({ queryKey: ['orders-active'] }) navigate(`/orders/${id}`, { replace: true }) }} /> -
    -
    + ) } @@ -121,8 +119,7 @@ function OrderView({ orderId }) { } return ( -
    -
    +

    {order.table_name ? t('orders.title', { table: order.table_name }) : t('orders.titleNoTable', { id: order.id })}

    @@ -167,7 +164,6 @@ function OrderView({ orderId }) { )} {tab === 'prices' &&
    } {tab === 'history' &&
    } -
    {paying && setPaying(null)} @@ -192,6 +188,6 @@ function OrderView({ orderId }) { } /> )} -
    + ) } diff --git a/manager_dashboard/src/pages/orders/OrderPeople.jsx b/manager_dashboard/src/pages/orders/OrderPeople.jsx index 6ca5713..d69038f 100644 --- a/manager_dashboard/src/pages/orders/OrderPeople.jsx +++ b/manager_dashboard/src/pages/orders/OrderPeople.jsx @@ -25,7 +25,7 @@ export default function OrderPeople({ order, open, staff, onChanged }) { return (
    -

    {t('orders.people.staff')}

    +

    {t('orders.people.staff')}

    {order.waiters.length === 0 && {t('orders.people.noStaff')}} {order.waiters.map(w => ( @@ -65,7 +65,7 @@ function Customer({ order, open, onChanged }) { return (
    -

    {t('orders.people.customer')}

    +

    {t('orders.people.customer')}

    {order.customer_id ? (
)} - + ) } function Kpi({ label, sub, pct, tone, children }) { return ( -
- {label} +
+ {label} {children} {sub && {sub}} {pct != null && ( diff --git a/manager_dashboard/src/pages/overview/ShiftDialog.jsx b/manager_dashboard/src/pages/overview/ShiftDialog.jsx index e544a63..0d9ce64 100644 --- a/manager_dashboard/src/pages/overview/ShiftDialog.jsx +++ b/manager_dashboard/src/pages/overview/ShiftDialog.jsx @@ -82,7 +82,7 @@ export default function ShiftDialog({ shift, mode, onClose, onConfirm, busy }) { {screen === 'overview' && (<>
- {t('overview.shift.expected')} + {t('overview.shift.expected')}
@@ -106,7 +106,7 @@ export default function ShiftDialog({ shift, mode, onClose, onConfirm, busy }) { {data.activity && } {summary && shiftPairs(summary).length > 0 && (
- {t('overview.shift.perHour')} + {t('overview.shift.perHour')}
)} diff --git a/manager_dashboard/src/pages/overview/ShiftsCard.jsx b/manager_dashboard/src/pages/overview/ShiftsCard.jsx index 65a4936..23a0f04 100644 --- a/manager_dashboard/src/pages/overview/ShiftsCard.jsx +++ b/manager_dashboard/src/pages/overview/ShiftsCard.jsx @@ -19,11 +19,11 @@ export default function ShiftsCard({ shifts, idle, dayOpen, hidden, onStart, onE return ( 0 && }> -
+
{shifts.length === 0 ? : shifts.map(s => { const onBreak = Array.isArray(s.breaks) ? s.breaks.find(b => !b.ended_at) : null return ( -
+
diff --git a/manager_dashboard/src/pages/overview/TablesCard.jsx b/manager_dashboard/src/pages/overview/TablesCard.jsx index 917deab..c12c89d 100644 --- a/manager_dashboard/src/pages/overview/TablesCard.jsx +++ b/manager_dashboard/src/pages/overview/TablesCard.jsx @@ -19,7 +19,7 @@ export default function TablesCard({ cards, onOpen }) { return ( } onClick={() => navigate('/tables')}>{t('overview.tables.all')}}> -
+
{cards.map(({ table, order, state }) => ( @@ -187,7 +187,7 @@ export default function DevicesPage() { setDialog(null)} onRemove={() => act(() => client.post(`/api/devices/${dialog.device.id}/revoke`))} /> )} -
+ ) } diff --git a/manager_dashboard/src/pages/platform/LicensePage.jsx b/manager_dashboard/src/pages/platform/LicensePage.jsx index 1b65179..4abe012 100644 --- a/manager_dashboard/src/pages/platform/LicensePage.jsx +++ b/manager_dashboard/src/pages/platform/LicensePage.jsx @@ -8,7 +8,7 @@ import toast from 'react-hot-toast' import { errorMessage } from '@xenia/api' import { useAccess } from '@xenia/access' import { useFormat, useTranslation } from '@xenia/i18n' -import { Button, EmptyState, Spinner } from '@xenia/ui' +import { Button, EmptyState, Page, Spinner } from '@xenia/ui' import client from '../../api/client' export default function LicensePage() { @@ -68,7 +68,7 @@ export default function LicensePage() { const sorted = [...modules].sort((a, b) => t(`modules:${a.key}.name`).localeCompare(t(`modules:${b.key}.name`))) return ( -
+
@@ -129,6 +129,6 @@ export default function LicensePage() {
- +
) } diff --git a/manager_dashboard/src/pages/platform/ModulesPage.jsx b/manager_dashboard/src/pages/platform/ModulesPage.jsx index e6c34de..a9616d6 100644 --- a/manager_dashboard/src/pages/platform/ModulesPage.jsx +++ b/manager_dashboard/src/pages/platform/ModulesPage.jsx @@ -9,7 +9,7 @@ import toast from 'react-hot-toast' import { errorMessage } from '@xenia/api' import { useAccess, useCan } from '@xenia/access' import { useTranslation } from '@xenia/i18n' -import { Button, Dialog, EmptyState, Spinner, Switch } from '@xenia/ui' +import { Button, Dialog, EmptyState, Page, Spinner, Switch } from '@xenia/ui' import client from '../../api/client' import { moduleState, stoppedBy } from './modulesLogic' @@ -79,7 +79,7 @@ function ModulesPage({ kinds, intro }) { if (!modules) return
return ( -
+

{intro}

{!canManage &&

{t('modules.readOnly')}

} @@ -113,7 +113,7 @@ function ModulesPage({ kinds, intro }) { )} -
+
) } diff --git a/manager_dashboard/src/pages/pricing/PricingPage.jsx b/manager_dashboard/src/pages/pricing/PricingPage.jsx index 6948c6d..0eba216 100644 --- a/manager_dashboard/src/pages/pricing/PricingPage.jsx +++ b/manager_dashboard/src/pages/pricing/PricingPage.jsx @@ -3,6 +3,7 @@ // apply to what is added to orders from then on (lines already on an order keep their price). import { useState } from 'react' import { useTranslation } from '@xenia/i18n' +import { Page } from '@xenia/ui' import DealsTab from './DealsTab' import DiscountsTab from './DiscountsTab' import ModifiersTab from './ModifiersTab' @@ -14,7 +15,7 @@ export default function PricingPage() { const { t } = useTranslation('manager') const [tab, setTab] = useState('rules') return ( -
+

{t('pricing.pageTitle')}

{t('pricing.intro')}

@@ -32,6 +33,6 @@ export default function PricingPage() { {tab === 'groups' && } {tab === 'deals' && } {tab === 'discounts' && } -
+ ) } diff --git a/manager_dashboard/src/pages/printing/PrepZonesPage.jsx b/manager_dashboard/src/pages/printing/PrepZonesPage.jsx index 77423f6..c30bb65 100644 --- a/manager_dashboard/src/pages/printing/PrepZonesPage.jsx +++ b/manager_dashboard/src/pages/printing/PrepZonesPage.jsx @@ -9,7 +9,7 @@ import { CookingPot, Pencil, Plus, Printer, Trash2 } from 'lucide-react' import { useCan } from '@xenia/access' import { errorMessage } from '@xenia/api' import { useTranslation } from '@xenia/i18n' -import { Button, Dialog, EmptyState, IconButton, Spinner } from '@xenia/ui' +import { Button, Dialog, EmptyState, IconButton, Page, Spinner } from '@xenia/ui' import client from '../../api/client' import { useLiveQuery } from '../../live/useLiveQuery' import { Pill } from '../overview/parts' @@ -32,8 +32,7 @@ export default function PrepZonesPage() { const nameOf = id => printers.find(p => p.id === id)?.name ?? `#${id}` return ( -
-
+

{t('printing.zones.title')}

@@ -61,13 +60,13 @@ export default function PrepZonesPage() {
- {t('printing.zones.main')} + {t('printing.zones.main')} {z.master_printer_id ? : {t('printing.zones.noPrinter')}} {z.secondary_printer_ids?.length > 0 && ( - {t('printing.zones.also')} + {t('printing.zones.also')} {z.secondary_printer_ids.map(id => )} {z.auto_print === 'all' && z.secondary_copies > 1 && ×{z.secondary_copies}} @@ -86,7 +85,6 @@ export default function PrepZonesPage() { ))}
)} -
{editing && setEditing(null)} onSaved={() => { setEditing(null); qc.invalidateQueries({ queryKey: ['prep-zones'] }) }} />} @@ -98,6 +96,6 @@ export default function PrepZonesPage() { } /> )} -
+ ) } diff --git a/manager_dashboard/src/pages/printing/PrintingSettings.jsx b/manager_dashboard/src/pages/printing/PrintingSettings.jsx index f027d72..5a17565 100644 --- a/manager_dashboard/src/pages/printing/PrintingSettings.jsx +++ b/manager_dashboard/src/pages/printing/PrintingSettings.jsx @@ -6,7 +6,7 @@ import TicketSettings from './TicketSettings' export default function PrintingSettings() { return ( -
+
diff --git a/manager_dashboard/src/pages/printing/TicketSettings.jsx b/manager_dashboard/src/pages/printing/TicketSettings.jsx index e9b6768..e3238c3 100644 --- a/manager_dashboard/src/pages/printing/TicketSettings.jsx +++ b/manager_dashboard/src/pages/printing/TicketSettings.jsx @@ -97,7 +97,7 @@ export default function TicketSettings() { {FONT_GROUPS.map(g => (
-
{t(`printing.ticket.groups.${g.key}`)}
+
{t(`printing.ticket.groups.${g.key}`)}
{g.fields.map(key => s.save(key, v)} />)} {g.key === 'items' && s.save('print.dot_style', v)} />}
diff --git a/manager_dashboard/src/pages/printing/ZoneDialog.jsx b/manager_dashboard/src/pages/printing/ZoneDialog.jsx index b1562d1..40c2f43 100644 --- a/manager_dashboard/src/pages/printing/ZoneDialog.jsx +++ b/manager_dashboard/src/pages/printing/ZoneDialog.jsx @@ -15,7 +15,7 @@ import { AUTO_PRINT, SORT_BY, move, orderedCategories, setBypass, setMain, toggl function Section({ title, children }) { return (
-

{title}

+

{title}

{children}
) diff --git a/manager_dashboard/src/pages/products/ProductList.jsx b/manager_dashboard/src/pages/products/ProductList.jsx index 90151de..25f52d0 100644 --- a/manager_dashboard/src/pages/products/ProductList.jsx +++ b/manager_dashboard/src/pages/products/ProductList.jsx @@ -61,7 +61,7 @@ export default function ProductList({ groups, view, categories, prepZones, selec
{headers && ( )}
- {t('products.show')} + {t('products.show')} diff --git a/manager_dashboard/src/pages/reports/expenses/ExpensesReport.jsx b/manager_dashboard/src/pages/reports/expenses/ExpensesReport.jsx index 5cf36b3..bc925c7 100644 --- a/manager_dashboard/src/pages/reports/expenses/ExpensesReport.jsx +++ b/manager_dashboard/src/pages/reports/expenses/ExpensesReport.jsx @@ -81,7 +81,7 @@ function Expenses() {

{t('reports.exp.total')}: {fmt.formatMoney(open.total_amount)} · {t('reports.exp.paid')}: {fmt.formatMoney(open.paid_amount)}{open.due_amount ? <> · {t('reports.exp.due')}: {fmt.formatMoney(open.due_amount)} : null}

{open.due_date &&

{t('reports.exp.dueDate', { date: fmt.formatDate(open.due_date) })}

} {open.notes &&

{open.notes}

} -

{t('reports.exp.payments')}

+

{t('reports.exp.payments')}

{open.payments?.length ? (
    {open.payments.map(p =>
  • {fmt.formatDate(p.paid_at)}{p.paid_by_name ? ` · ${p.paid_by_name}` : ''}{p.notes ? ` · ${p.notes}` : ''}{fmt.formatMoney(p.amount)}
  • )} diff --git a/manager_dashboard/src/pages/reports/kit/parts.jsx b/manager_dashboard/src/pages/reports/kit/parts.jsx index c5dab56..80733a2 100644 --- a/manager_dashboard/src/pages/reports/kit/parts.jsx +++ b/manager_dashboard/src/pages/reports/kit/parts.jsx @@ -7,7 +7,7 @@ import toast from 'react-hot-toast' import { ArrowDown, ArrowUp, Download, Info } from 'lucide-react' import { errorMessage } from '@xenia/api' import { useFormat, useTranslation } from '@xenia/i18n' -import { Button, EmptyState, InfoTip, Spinner, cx } from '@xenia/ui' +import { Button, EmptyState, InfoTip, Page, Spinner, cx } from '@xenia/ui' import client from '../../../api/client' import { sortRows } from './reportLogic' @@ -17,8 +17,7 @@ export function ReportPage({ title, tabs = [], children, testId }) { const active = tabs.find(t => t.id === params.get('tab'))?.id ?? tabs[0]?.id const tab = tabs.find(t => t.id === active) return ( -
    -
    +

    {title}

    {tabs.length > 1 && ( @@ -33,8 +32,7 @@ export function ReportPage({ title, tabs = [], children, testId }) { )}
    {tab ? : children} -
    -
    + ) } @@ -43,12 +41,12 @@ export function Panel({ title, tip, actions, children, className, padded = true, return (
    {(title || actions) && ( -
    +

    {title}{tip && {tip}}

    {actions}
    )} -
    {children}
    +
    {children}
    ) } @@ -58,8 +56,8 @@ const TONE = { success: 'text-success-ink', danger: 'text-danger-ink', warning: /** A figure: a label over a value, an optional line under it, a tone for the value. */ export function Stat({ label, value, sub, tip, tone, big = false, testId }) { return ( -
    - {label}{tip && {tip}} +
    + {label}{tip && {tip}} {value} {sub && {sub}}
    @@ -94,7 +92,7 @@ export function Table({ columns, rows, initialSort, onRow, rowTestId, limit = 20 {columns.map(c => ( - + {c.sort === false ? c.label : (
    + ) } diff --git a/manager_dashboard/src/pages/staff/SessionsPage.jsx b/manager_dashboard/src/pages/staff/SessionsPage.jsx index 49da5af..c3a0863 100644 --- a/manager_dashboard/src/pages/staff/SessionsPage.jsx +++ b/manager_dashboard/src/pages/staff/SessionsPage.jsx @@ -10,7 +10,7 @@ import { LogIn } from 'lucide-react' import { errorMessage } from '@xenia/api' import { useAccess } from '@xenia/access' import { useTranslation, useFormat } from '@xenia/i18n' -import { Button, Dialog, EmptyState, Spinner } from '@xenia/ui' +import { Button, Dialog, EmptyState, Page, Spinner } from '@xenia/ui' import client from '../../api/client' import { useLiveQuery } from '../../live/useLiveQuery' import { canEndSession } from './permissionsLogic' @@ -48,7 +48,7 @@ export default function SessionsPage() { const live = rows.filter(s => !s.ended_at) return ( -
    +

    {t('sessions.intro')}

    {live.length === 0 && !showEnded @@ -100,7 +100,7 @@ export default function SessionsPage() { setEnding(null)} onDone={() => { setEnding(null); toast.success(t('sessions.ended', { name: person(ending) })); load() }} /> )} -
    + ) } diff --git a/manager_dashboard/src/pages/staff/StaffPage.jsx b/manager_dashboard/src/pages/staff/StaffPage.jsx index e98a043..8f00d12 100644 --- a/manager_dashboard/src/pages/staff/StaffPage.jsx +++ b/manager_dashboard/src/pages/staff/StaffPage.jsx @@ -10,7 +10,7 @@ import { Ban, CheckCircle2, KeyRound, LockKeyhole, MapPin, Pencil, Plus, Search, import { useAccess } from '@xenia/access' import { errorMessage } from '@xenia/api' import { useTranslation } from '@xenia/i18n' -import { Button, Dialog, EmptyState, IconButton, Input, Select, Spinner, cx } from '@xenia/ui' +import { Button, Dialog, EmptyState, IconButton, Input, Page, Select, Spinner, cx } from '@xenia/ui' import client from '../../api/client' import { useLiveQuery } from '../../live/useLiveQuery' import { Avatar, Pill } from '../overview/parts' @@ -45,8 +45,7 @@ export default function StaffPage() { const open = (kind, member = null) => setDialog({ kind, member }) return ( -
    -
    +

    {t('staff.title')}

    @@ -124,7 +123,6 @@ export default function StaffPage() { })}
)} -
{(dialog?.kind === 'new' || dialog?.kind === 'edit') && ( setDialog(null)} onSaved={() => { setDialog(null); changed() }} /> @@ -142,6 +140,6 @@ export default function StaffPage() { } /> )} -
+ ) } diff --git a/manager_dashboard/src/shell/ProfileDialog.jsx b/manager_dashboard/src/shell/ProfileDialog.jsx index a13fd7b..fcd1e4c 100644 --- a/manager_dashboard/src/shell/ProfileDialog.jsx +++ b/manager_dashboard/src/shell/ProfileDialog.jsx @@ -48,7 +48,7 @@ export default function ProfileDialog({ onClose }) { set('username', e.target.value)} />
- {t('profile.password')} + {t('profile.password')}

{t('profile.keepHint')}

set('current', e.target.value)} />
@@ -57,7 +57,7 @@ export default function ProfileDialog({ onClose }) {
- {t('profile.pin')} + {t('profile.pin')}

{t('profile.pinHint')}

set('pin', digits(e.target.value))} data-testid="profile-pin" /> diff --git a/manager_dashboard/src/shell/nav.js b/manager_dashboard/src/shell/nav.js index beef911..6151e4a 100644 --- a/manager_dashboard/src/shell/nav.js +++ b/manager_dashboard/src/shell/nav.js @@ -17,7 +17,7 @@ import { BookUser, Users, Receipt, CreditCard, Package, TableProperties, UserCog, CalendarDays, Trash2, Boxes, BarChart2, TrendingUp, Users2, ShoppingCart, Tag, Activity, Printer, ConciergeBell, FileText, - AppWindow, Settings, CookingPot, Truck, StickyNote, Percent, Plug, BadgeCheck, MonitorSmartphone, LogIn, ShieldCheck, QrCode, Images, Tv, + AppWindow, Settings, CookingPot, StickyNote, Percent, Plug, BadgeCheck, MonitorSmartphone, LogIn, ShieldCheck, Images, Tv, } from 'lucide-react' const DASH = 'core.dashboard.access' @@ -31,8 +31,7 @@ export const NAV = [ { to: '/dashboard', icon: LayoutDashboard, label: 'nav.dashboard', module: 'core', perm: DASH }, { to: '/tables', icon: LayoutGrid, label: 'nav.tables', module: 'ordering', perm: DASH }, { to: '/online-orders', icon: ShoppingBag, label: 'nav.onlineOrders', module: 'connect_orders', perm: DASH, badge: 'onlineOrders' }, - { to: '/online/fees', icon: Truck, label: 'nav.deliveryFees', module: 'connect_orders', perm: 'connect_orders.fees' }, - { to: '/online/qr', icon: QrCode, label: 'nav.qrCodes', module: 'connect_menu', perm: 'connect_menu.manage' }, + // 2026-11-20: delivery fees are Online orders → Settings, the QR codes a view of Tables ], }, { diff --git a/manager_dashboard/tests/finance.test.mjs b/manager_dashboard/tests/finance.test.mjs index 378f1ec..92a60ba 100644 --- a/manager_dashboard/tests/finance.test.mjs +++ b/manager_dashboard/tests/finance.test.mjs @@ -36,6 +36,8 @@ test('a payment is above zero and no more than what is due', () => { test('filters, totals, late ones and what each supplier is owed', () => { assert.deepEqual(filterExpenses(expenses, { status: 'unpaid' }).map(e => e.id), [1, 3]) assert.deepEqual(filterExpenses(expenses, { category: 'rent' }).map(e => e.id), [2]) + assert.deepEqual(filterExpenses(expenses, { status: ['due', 'partial'] }).map(e => e.id), [1, 3]) // multi-select + assert.deepEqual(filterExpenses(expenses, { status: [], category: ['rent', 'supplier'] }).map(e => e.id), [1, 2, 3]) assert.deepEqual(filterExpenses(expenses, { q: 'nikos tins' }).map(e => e.id), [3]) assert.deepEqual(filterExpenses(expenses, { q: 'γάλα' }).map(e => e.id), [1]) assert.equal(isLate(expenses[0], '2026-11-19', key), true) @@ -51,6 +53,7 @@ test('a contact: name needed, a wrong e-mail caught, empty fields cleared', () = assert.deepEqual(contactBody({ ...f, name: ' Dairy ', phone: ' ' }), { name: 'Dairy', type: 'supplier', phone: null, email: null, address: null, notes: null }) const list = [{ id: 1, name: 'Dairy Nikos', type: 'supplier', phone: '2310' }, { id: 2, name: 'DEH', type: 'utility' }] assert.deepEqual(filterContacts(list, { type: 'utility' }).map(c => c.id), [2]) + assert.deepEqual(filterContacts(list, { type: ['utility', 'supplier'] }).map(c => c.id), [1, 2]) assert.deepEqual(filterContacts(list, { q: '2310' }).map(c => c.id), [1]) }) diff --git a/manager_dashboard/tests/orders.test.mjs b/manager_dashboard/tests/orders.test.mjs index 8fa0790..c82ef5a 100644 --- a/manager_dashboard/tests/orders.test.mjs +++ b/manager_dashboard/tests/orders.test.mjs @@ -50,6 +50,8 @@ test('tables: filters by state and zone, flags per table, where a card goes', () assert.deepEqual(filterCards(cards, { states: ['free'] }).map(c => c.table.id), [2, 3]) assert.deepEqual(filterCards(cards, { zone: NO_ZONE }).map(c => c.table.id), [2]) assert.deepEqual(filterCards(cards, { zone: '11', states: ['free'] }).map(c => c.table.id), [3]) + assert.deepEqual(filterCards(cards, { zones: ['10', NO_ZONE] }).map(c => c.table.id), [1, 2]) // several zones at once + assert.deepEqual(filterCards(cards, { zones: [] }).map(c => c.table.id), [1, 2, 3]) assert.deepEqual(flagsByTable([{ id: 1, name: 'VIP' }], [{ flag_id: 1, table_id: 2, assigned_at: 'x' }, { flag_id: 9, table_id: 2 }]), { 2: [{ id: 1, name: 'VIP', assigned_at: 'x' }] }) assert.equal(cardTarget(cards[0]), '/orders/7') assert.equal(cardTarget(cards[1]), '/orders/new?table=2') diff --git a/packages/i18n/locales/el/manager.json b/packages/i18n/locales/el/manager.json index c890d4e..ec33320 100644 --- a/packages/i18n/locales/el/manager.json +++ b/packages/i18n/locales/el/manager.json @@ -952,7 +952,8 @@ "tab": { "incoming": "Εισερχόμενες", "active": "Ενεργές", - "history": "Ιστορικό" + "history": "Ιστορικό", + "settings": "Ρυθμίσεις" }, "refresh": "Ανανέωση", "empty": { @@ -1664,7 +1665,8 @@ "card": "Κάρτα", "transfer": "Τρ. μεταφορά", "treat": "Κεράστηκε", - "other": "Άλλο" + "other": "Άλλο", + "onTab": "Σε καρτέλες" }, "tables": { "title": "Τραπέζια τώρα", @@ -2718,7 +2720,9 @@ "seats_other": "{{count}} θέσεις", "noWaiter": "Χωρίς σερβιτόρο", "view": "Άνοιγμα", - "take": "Νέα παραγγελία" + "take": "Νέα παραγγελία", + "viewAs": "Προβολή", + "qrCodes": "Κωδικοί QR" }, "quick": { "title": "Τραπέζι {{table}}: γρήγορες ενέργειες", diff --git a/packages/i18n/locales/en/manager.json b/packages/i18n/locales/en/manager.json index 8e6e82d..efa3ed2 100644 --- a/packages/i18n/locales/en/manager.json +++ b/packages/i18n/locales/en/manager.json @@ -952,7 +952,8 @@ "tab": { "incoming": "New", "active": "In progress", - "history": "History" + "history": "History", + "settings": "Settings" }, "refresh": "Refresh", "empty": { @@ -1664,7 +1665,8 @@ "card": "Card", "transfer": "Bank transfer", "treat": "On the house", - "other": "Other" + "other": "Other", + "onTab": "On tabs" }, "tables": { "title": "Tables now", @@ -2718,7 +2720,9 @@ "seats_other": "{{count}} seats", "noWaiter": "No waiter", "view": "Open", - "take": "Take an order" + "take": "Take an order", + "viewAs": "View as", + "qrCodes": "QR codes" }, "quick": { "title": "Table {{table}}: quick actions", diff --git a/tests/e2e/manager.mjs b/tests/e2e/manager.mjs index ca3342f..6f0a677 100644 --- a/tests/e2e/manager.mjs +++ b/tests/e2e/manager.mjs @@ -518,9 +518,9 @@ try { ooUrls.some(u => u.startsWith('/api/connect/orders')) && !ooUrls.some(u => u.startsWith('/api/stream')), [...new Set(ooUrls)].filter(u => u.startsWith('/api/')).join(' ')) // ── phase 3S S.3: delivery areas and fees, set up and tested on the real page ── - await page.goto(`${APP}/online/fees`) - r.check('fees: the page opens from the nav entry, no rules yet', await page.getByTestId('fees-page').waitFor({ timeout: 10_000 }).then(() => true).catch(() => false) - && await page.locator('a[href="/online/fees"]').count() >= 1 && await page.getByTestId('rule').count() === 0) + await page.goto(`${APP}/online/fees`) // the old address leads to Online orders → Settings (2026-11-20) + r.check('fees: Online orders → Settings opens, no rules yet', await page.getByTestId('fees-page').waitFor({ timeout: 10_000 }).then(() => true).catch(() => false) + && await page.getByTestId('online-tab-settings').getAttribute('aria-selected') === 'true' && await page.getByTestId('rule').count() === 0) r.check('ordering link: the venue\'s ordering app address is shown, with its QR code', await page.getByTestId('ordering-link').count() === 1 && (await page.getByTestId('ordering-link-url').textContent()).endsWith('/order/test-site-1') && await page.getByTestId('ordering-link').locator('svg').count() >= 1) await page.getByTestId('area-add').click() @@ -1412,7 +1412,10 @@ try { const gone = await milkRow.waitFor({ state: 'detached', timeout: 8000 }).then(() => true).catch(() => false) milk = (await api('GET', '/api/expenses/', { token: boss })).find(e => e.id === milk.id) r.check(`${fi} the rest paid: it shows paid and leaves the "not fully paid" list`, gone && milk.status === 'paid' && milk.payments.length === 2, JSON.stringify(milk)) - await page.getByTestId('expenses-status').selectOption('paid') + // the status filter is the shared multi-select (2026-11-20): add Paid to Due + Partly paid + await page.getByTestId('expenses-status').click() + await page.locator('.x-dropdown__option', { hasText: 'Paid' }).filter({ hasNotText: 'Partly' }).click() + await page.keyboard.press('Escape') await page.locator('[data-testid="expense-row"]', { hasText: 'E2E milk November' }).click() r.check(`${fi} the expense opens with its two payments`, await page.getByTestId('expense-view').waitFor({ timeout: 8000 }).then(() => true).catch(() => false) && await page.locator('[data-testid="expense-view"] li').count() === 2) diff --git a/tests/e2e/manager_layout.mjs b/tests/e2e/manager_layout.mjs new file mode 100644 index 0000000..a044dc6 --- /dev/null +++ b/tests/e2e/manager_layout.mjs @@ -0,0 +1,115 @@ +// The page rule (2026-11-20): every manager page is a that scrolls on its own, fills a +// 1080p screen and stays at 16:9 width, centred, on an ultrawide. For each page, at 1920×1080 +// and 3440×1440: the page body exists, fills the content area (1080p) or is capped and centred +// (ultrawide), and the page scrolls when its content is taller than the screen. Screenshots of a +// few key screens (and the open dropdowns / the day summary) go to out/manager-layout/. +// +// node manager_layout.mjs +// +// Starts its own backend (:8067, demo data) and the manager (:5191). +import { mkdirSync, openSync } from 'node:fs' +import path from 'node:path' +import { spawn } from 'node:child_process' +import { chromium } from 'playwright' +import { BROWSER_CHANNEL, CS, OUT, reporter, sleep } from './lib/env.mjs' +import { killTree, login, startBackend, waitHttp } from './lib/proc.mjs' + +const DIR = path.join(OUT, 'manager-layout') +mkdirSync(DIR, { recursive: true }) +// pages on (the rest have their own layout: products, tables set-up, stock placeholder) +const PAGES = [ + 'dashboard', 'tables', 'tables?view=qr', 'online-orders', 'online-orders?tab=settings', 'crm/contacts', 'crm/customers', + 'financials/expenses', 'financials/tabs', 'management/media', 'management/signage', 'management/staff', 'management/sessions', + 'management/approvals', 'management/schedule', 'management/prep-zones', 'management/pricing', 'inventory/throwaways', 'notes', + 'reports/today', 'reports/store', 'devices', 'license', 'apps', 'settings?tab=operation', +] +const SHOTS = ['dashboard', 'tables', 'tables?view=qr', 'online-orders?tab=settings', 'crm/contacts', 'crm/customers', 'financials/expenses'] +const SCREENS = [{ id: '1080p', width: 1920, height: 1080 }, { id: 'ultrawide', width: 3440, height: 1440 }] +const MODULES = ['connect_orders', 'connect_menu', 'crm', 'tabs', 'expenses', 'inventory', 'notes', 'chat', 'reservations', 'pricing', 'signage', 'staff_planning'] + +const backend = await startBackend({ port: 8067, siteId: 'test-site-1', env: { LICENSE_MODE: 'off' } }) +const APP = 'http://localhost:5191' +const log = openSync(path.join(OUT, 'vite-5191.log'), 'w') +const vite = spawn('npx', ['vite', '--port', '5191', '--strictPort'], { + cwd: path.join(CS, 'manager_dashboard'), shell: process.platform === 'win32', detached: process.platform !== 'win32', + stdio: ['ignore', log, log], env: { ...process.env, XENIA_BACKEND: backend.url }, +}) +const browser = await chromium.launch(BROWSER_CHANNEL ? { channel: BROWSER_CHANNEL } : {}) +const r = reporter('manager layout (the page rule): fills 1080p, 16:9 and centred on ultrawides, scrolls') +const name = p => p.replace(/[/?=]/g, '-') +try { + await waitHttp(APP) + const boss = await login(backend.url) + const call = (method, url, body) => fetch(`${backend.url}${url}`, { method, headers: { 'content-type': 'application/json', authorization: `Bearer ${boss}` }, body: body ? JSON.stringify(body) : undefined }) + for (const m of MODULES) await call('PUT', `/api/platform/modules/${m}`, { enabled: true }).catch(() => {}) + await call('POST', '/api/business-day/open', {}).catch(() => {}) + const errors = [] + for (const screen of SCREENS) { + const ctx = await browser.newContext({ viewport: { width: screen.width, height: screen.height } }) + const page = await ctx.newPage() + page.on('pageerror', e => errors.push(String(e))) + await page.goto(`${APP}/login`) + await page.getByTestId('login-form').waitFor({ timeout: 60_000 }) + if (!(await page.getByTestId('login-account').count())) await page.getByLabel('Username').fill('manager') + await page.getByLabel('Password').fill('password') + await page.getByRole('button', { name: 'Sign in', exact: true }).click() + await page.waitForURL(u => u.pathname === '/dashboard', { timeout: 20_000 }) + const bad = [] + for (const p of PAGES) { + await page.goto(`${APP}/${p}`) + await page.waitForLoadState('networkidle').catch(() => {}) + await sleep(500) + const m = await page.evaluate(() => { + const body = document.querySelector('main .x-page__body') + const main = document.querySelector('main') + if (!body || !main) return null + const b = body.getBoundingClientRect(); const a = main.getBoundingClientRect() + const scroll = body.closest('.x-page__scroll') + // a form page (settings) is centred at its own width + const form = body.classList.contains('x-page__body--form') + return { form, left: b.left - a.left, right: a.right - b.right, width: b.width, area: a.width, cap: Math.max(1280, innerHeight * 16 / 9), + scrolls: scroll.scrollHeight <= scroll.clientHeight + 1 || getComputedStyle(scroll).overflowY === 'auto' } + }) + if (!m) { bad.push(`${p}: no `); continue } + const centred = Math.abs(m.left - m.right) <= 2 + const fills = m.form || m.width >= Math.min(m.area, m.cap) - 2 + if (!centred || !fills || !m.scrolls) bad.push(`${p}: ${JSON.stringify(m)}`) + if (SHOTS.includes(p)) await page.screenshot({ path: path.join(DIR, `${name(p)}-${screen.id}.png`) }) + } + r.check(`${screen.id}: every page fills its area up to 16:9, centred, and scrolls`, bad.length === 0, bad.join('\n')) + + if (screen.id === '1080p') { + // the shared dropdown: multi-select, same height as the search box + await page.goto(`${APP}/financials/expenses`) + const search = page.locator('.x-search input') + await search.waitFor() + const hs = await search.boundingBox() + const dd = page.getByTestId('expenses-status') + const hd = await dd.boundingBox() + r.check('expenses: dropdowns are as tall as the search box', Math.abs(hs.height - hd.height) < 1, `${hs.height} vs ${hd.height}`) + await dd.click() + await page.locator('.x-dropdown__menu').waitFor() + await page.screenshot({ path: path.join(DIR, 'expenses-dropdown-open.png') }) + await page.keyboard.press('Escape') + // the day summary + await page.goto(`${APP}/dashboard`) + await page.getByTestId('day-stats').click() + await page.getByTestId('day-summary').waitFor() + await sleep(400) + const tabsScroll = await page.evaluate(() => { const l = document.querySelector('.x-dialog .x-tabs__list'); return l.scrollHeight - l.clientHeight }) + r.check('day summary: the tab strip has no up/down scroll', tabsScroll === 0, String(tabsScroll)) + await page.screenshot({ path: path.join(DIR, 'day-summary.png') }) + await page.getByTestId('day-tab-staff').click() + await sleep(300) + await page.screenshot({ path: path.join(DIR, 'day-summary-staff.png') }) + } + await ctx.close() + } + r.check('no page errors', errors.length === 0, errors.slice(0, 3).join(' | ')) + console.log(` screenshots: ${DIR}`) +} finally { + await browser.close() + killTree(vite) + await backend.stop() +} +process.exit(r.done() ? 1 : 0) diff --git a/tests/e2e/manager_look.mjs b/tests/e2e/manager_look.mjs index 8204190..911c763 100644 --- a/tests/e2e/manager_look.mjs +++ b/tests/e2e/manager_look.mjs @@ -23,7 +23,7 @@ const LOOKS = [ ...(extra ? [{ id: 'nord-light', mode: 'light', palette: 'nord', style: 'sharp' }, { id: 'nord-dark', mode: 'dark', palette: 'nord', style: 'sharp' }] : []), ] const PAGES = [ - 'dashboard', 'tables', 'online-orders', 'online/fees', 'online/qr', 'crm/contacts', 'crm/customers', 'financials/expenses', 'financials/tabs', + 'dashboard', 'tables', 'online-orders', 'online-orders?tab=settings', 'tables?view=qr', 'crm/contacts', 'crm/customers', 'financials/expenses', 'financials/tabs', 'management/products', 'management/media', 'management/signage', 'management/tables', 'management/staff', 'management/sessions', 'management/approvals', 'management/schedule', 'management/prep-zones', 'management/pricing', 'inventory/throwaways', 'inventory/stock', 'notes', 'reports/today', 'reports/store', 'reports/staff', 'reports/products', 'reports/prep-zones', 'reports/expenses', 'reports/technical', 'reports/misc',