feat(manager): UI review pass 3 (fees tabs, products panes, floor editor, permissions search, pricing heads)

- Online orders → Settings: the fee tabs breathe (inset strip); a rule's buttons
  and switch centred together.
- Products: categories and list as panes that scroll on their own, headers and
  footers stay; the list sunken with white rows; the category search is the
  shared SearchInput. Product editor: "Make main" text instead of a star, the
  left tabs share the width.
- Floor editor: no "+" next to a corner; − / fit width / whole plan / +;
  "Edit the floor's shape" → "Save shape" (saves the shape and size at once);
  sizes in grid cells by half cells (steppers; typing snapped every keystroke
  before), resize handles on every unrotated table and thing, half-cell snapping.
- MediaField: the picture's name under the buttons, Remove red on hover.
- Staff permissions: a search box at the top.
- Prep zone name hint fixed. Offers & pricing: title first, then tabs; every tab
  has its head with the New button at the top right.
- Tests: floor cells, e2e (cell steppers, no + near a corner, Save shape,
  permission search, products panes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-20 17:51:17 +02:00
co-authored by Claude Opus 5.5
parent 181b2f16b0
commit 301502965c
20 changed files with 257 additions and 97 deletions
@@ -7,21 +7,26 @@
// corner; resting on a corner shows a bubble to remove it (a floor keeps at least 3). An area
// (2026-11-20) is resized by the handles on its sides and corners, and has a colour (pastel, see-
// through); when tables cover its name, the name shows in its corner too.
// 2026-11-21: the "+" on an edge hides near a corner (there the corner's bubble removes it);
// minus / fit width / whole plan / plus; "Edit the floor's shape" is a button that turns into
// "Save shape" (saves the shape and the floor's size at once, nothing else); every unrotated table
// or thing has resize handles, and sizes are in grid cells (half cells), so they follow the grid
// resolution picked; a wall's thickness in steps.
// Arrow keys move the selected thing (a grid cell, or 5; Shift: 1), Delete takes it off, Escape
// lets go. Nothing is saved until "Save"; then every app's map changes at once.
import { useLayoutEffect, useMemo, useRef, useState } from 'react'
import toast from 'react-hot-toast'
import { RotateCcw, RotateCw, Save, Trash2, Undo2 } from 'lucide-react'
import { Check, Minus, PenTool, Plus, RotateCcw, RotateCw, Save, Trash2, Undo2 } from 'lucide-react'
import { errorMessage } from '@xenia/api'
import {
AREA_COLOURS, Floor, GRID_LEVELS, ITEM_KINDS, Item, SHAPES, TableShape, addCornerAt, coveredAreas, defaultSize, moveCorner, moveTo,
nearestEdge, outlineOf, removeCorner, resizeBox, toPlan,
} from '@xenia/floorplan'
import { useTranslation } from '@xenia/i18n'
import { Button, Dialog, Dropdown, Field, IconButton, Input, Segmented, Switch, cx } from '@xenia/ui'
import { Button, Dialog, Dropdown, Field, IconButton, Input, Segmented, Stepper, Switch, cx } from '@xenia/ui'
import MediaField from '../media/MediaField'
import * as api from './floorApi'
import { addItem, addable, find, fitOutline, layoutBody, layoutOf, nudge, placeTable, planBody, remove, resize, rotate, sameLayout, update } from './editorLogic'
import { WALL_THICKNESS, addItem, addable, cellOf, find, fitOutline, layoutBody, layoutOf, nudge, placeTable, planBody, remove, resizeCells, rotate, sameLayout, toCells, update } from './editorLogic'
const PAD = 30 // room around the floor for the corner handles
const HANDLES = ['nw', 'n', 'ne', 'e', 'se', 's', 'sw', 'w']
@@ -44,6 +49,7 @@ export default function FloorEditor({ plan: saved, data, groups, onSaved, onDele
const { t } = useTranslation('manager')
const initial = useMemo(() => layoutOf(data, saved.id), [data, saved.id])
const [layout, setLayout] = useState(initial)
const [base, setBase] = useState(saved) // the plan as saved (a saved shape updates it)
const [form, setForm] = useState(() => ({ ...saved }))
const [sel, setSel] = useState(null) // {type: 'table'|'item', id} | {type: 'corner', index}
const [shapeMode, setShapeMode] = useState(false)
@@ -51,6 +57,8 @@ export default function FloorEditor({ plan: saved, data, groups, onSaved, onDele
const [busy, setBusy] = useState(false)
const [deleting, setDeleting] = useState(false)
const [fit, setFit] = useState('width') // 'width' | 'all'
const [zoom, setZoom] = useState(null) // a scale picked with − / + (null: the fit)
const [shapeBusy, setShapeBusy] = useState(false)
const [edgeHover, setEdgeHover] = useState(null) // where a click on the edge adds a corner
const [cornerTip, setCornerTip] = useState(null) // the corner showing its "remove" bubble
const tipTimer = useRef(null)
@@ -60,7 +68,7 @@ export default function FloorEditor({ plan: saved, data, groups, onSaved, onDele
const size = useSize(box)
const plan = form // the preview follows the unsaved settings
const dirtySettings = JSON.stringify(planBody(form)) !== JSON.stringify(planBody(saved))
const dirtySettings = JSON.stringify(planBody(form)) !== JSON.stringify(planBody(base))
const dirty = dirtySettings || !sameLayout(layout, initial)
const selected = sel && sel.type !== 'corner' ? find(layout, sel) : null
const corners = outlineOf(plan)
@@ -71,7 +79,9 @@ export default function FloorEditor({ plan: saved, data, groups, onSaved, onDele
// the scale: the plan (and its margin) fitted to the width, or whole in the box
const vbW = plan.width + 2 * PAD
const vbH = plan.height + 2 * PAD
const scale = size.width ? (fit === 'all' && size.height ? Math.min(size.width / vbW, size.height / vbH) : size.width / vbW) : 1
const fitScale = size.width ? (fit === 'all' && size.height ? Math.min(size.width / vbW, size.height / vbH) : size.width / vbW) : 1
const scale = zoom ?? fitScale
const zoomBy = f => setZoom(Math.min(4, Math.max(0.1, scale * f)))
const r = Math.max(8, 9 / scale) // a handle's size on screen ≈ 18 px
const point = e => toPlan(svg.current, e.clientX, e.clientY)
@@ -96,7 +106,9 @@ export default function FloorEditor({ plan: saved, data, groups, onSaved, onDele
const [px, py] = point(e)
if (!d) {
if (shapeMode) {
const n = nearestEdge(corners, [px, py])
// near a corner there is no "+": that corner's bubble removes it
const nearCorner = corners.some(([x, y]) => Math.hypot(x - px, y - py) < r * 3)
const n = nearCorner ? null : nearestEdge(corners, [px, py])
setEdgeHover(n && n.d < 14 / scale ? n : null)
}
return
@@ -106,7 +118,7 @@ export default function FloorEditor({ plan: saved, data, groups, onSaved, onDele
return
}
if (d.target.handle) {
setLayout(l => update(l, d.target, resizeBox(find(l, d.target), d.target.handle, px, py, plan)))
setLayout(l => update(l, d.target, resizeBox(find(l, d.target), d.target.handle, px, py, plan, cellOf(plan) / 2)))
return
}
setLayout(l => {
@@ -148,10 +160,27 @@ export default function FloorEditor({ plan: saved, data, groups, onSaved, onDele
onSaved()
} catch (err) { toast.error(errorMessage(err, t)) } finally { setBusy(false) }
}
const enterShape = () => { setShapeMode(true); setSel(null); setEdgeHover(null); setCornerTip(null) }
const leaveShape = () => { setShapeMode(false); setEdgeHover(null); setCornerTip(null); setSel(null) }
// "Save shape": the floor's shape and size are saved at once; the rest waits for "Save"
const saveShape = async () => {
const shape = { outline: form.outline ?? null, width: form.width, height: form.height }
if (JSON.stringify(planBody({ ...base, ...shape })) !== JSON.stringify(planBody(base))) {
setShapeBusy(true)
try {
await api.savePlan(saved.id, planBody({ ...base, ...shape }))
setBase(b => ({ ...b, ...shape }))
toast.success(t('floor.shapeSaved'))
} catch (err) { toast.error(errorMessage(err, t)); setShapeBusy(false); return }
setShapeBusy(false)
}
leaveShape()
}
const zoneName = id => groups.find(g => g.id === id)?.name ?? t('floor.noZone')
const gridOptions = [...GRID_LEVELS.map(([k, v]) => ({ value: v, label: t(`floor.gridLevels.${k}`), hint: t('floor.gridCell', { size: v }) })),
...(GRID_LEVELS.some(([, v]) => v === form.grid_size) ? [] : [{ value: form.grid_size, label: t('floor.gridCell', { size: form.grid_size }) }])]
const resizable = selected && sel.type === 'item' && selected.kind === 'area' && !shapeMode && Math.round(selected.rotation || 0) % 180 === 0
const resizable = selected && !shapeMode && Math.round(selected.rotation || 0) % 180 === 0
const handles = resizable && selected.kind === 'wall' ? ['e', 'w'] : HANDLES
return (
<div className="grid gap-4 lg:grid-cols-[minmax(0,1fr)_19rem] items-start" data-testid="floor-editor" data-plan={saved.id}>
@@ -164,16 +193,27 @@ export default function FloorEditor({ plan: saved, data, groups, onSaved, onDele
{form.grid_on && (
<Dropdown size="sm" className="w-44" value={form.grid_size} onChange={v => setF('grid_size', v)} aria-label={t('floor.gridSize')} data-testid="floor-grid-size" options={gridOptions} />
)}
<Switch checked={shapeMode} onChange={v => { setShapeMode(v); setSel(null); setEdgeHover(null); setCornerTip(null) }} label={t('floor.editShape')} data-testid="floor-shape-mode" />
<Segmented size="sm" value={fit} onChange={setFit} aria-label={t('floor.fit')}
options={[{ value: 'width', label: t('floor.fitWidth'), testId: 'floor-fit-width' }, { value: 'all', label: t('floor.fitAll'), testId: 'floor-fit-all' }]} />
{shapeMode ? (
<span className="flex items-center gap-2">
<Button size="sm" variant="ghost" disabled={shapeBusy} onClick={() => { setF('outline', base.outline ?? null); leaveShape() }} data-testid="floor-shape-cancel">{t('floor.cancel')}</Button>
<Button size="sm" icon={<Check size={16} />} loading={shapeBusy} onClick={saveShape} data-testid="floor-shape-save">{t('floor.saveShape')}</Button>
</span>
) : (
<Button size="sm" variant="secondary" icon={<PenTool size={16} />} onClick={enterShape} data-testid="floor-shape-mode">{t('floor.editShape')}</Button>
)}
<span className="flex items-center gap-1">
<IconButton size="sm" variant="secondary" label={t('floor.zoomOut')} onClick={() => zoomBy(1 / 1.25)} data-testid="floor-zoom-out"><Minus size={16} /></IconButton>
<Segmented size="sm" value={zoom == null ? fit : null} onChange={v => { setFit(v); setZoom(null) }} aria-label={t('floor.fit')}
options={[{ value: 'width', label: t('floor.fitWidth'), testId: 'floor-fit-width' }, { value: 'all', label: t('floor.fitAll'), testId: 'floor-fit-all' }]} />
<IconButton size="sm" variant="secondary" label={t('floor.zoomIn')} onClick={() => zoomBy(1.25)} data-testid="floor-zoom-in"><Plus size={16} /></IconButton>
</span>
<Button variant="secondary" size="sm" icon={<Undo2 size={16} />} disabled={!dirty || busy}
onClick={() => { setLayout(initial); setForm({ ...saved }); setSel(null) }}>{t('floor.undoAll')}</Button>
onClick={() => { setLayout(initial); setForm({ ...base }); setSel(null) }}>{t('floor.undoAll')}</Button>
<Button size="sm" icon={<Save size={16} />} loading={busy} disabled={!dirty || !form.name.trim()} onClick={save} data-testid="floor-save">{t('floor.save')}</Button>
</div>
<div className="grid gap-2 content-start min-w-0">
<div ref={box} className={cx('rounded-card border border-line bg-canvas overflow-auto', fit === 'all' ? 'h-[calc(100dvh-17rem)] min-h-[22rem]' : 'max-h-[calc(100dvh-17rem)]')}
<div ref={box} className={cx('rounded-card border border-line bg-canvas overflow-auto', fit === 'all' || zoom != null ? 'h-[calc(100dvh-17rem)] min-h-[22rem]' : 'max-h-[calc(100dvh-17rem)]')}
style={{ scrollbarGutter: 'stable' }}>
<svg ref={svg} viewBox={`${-PAD} ${-PAD} ${vbW} ${vbH}`} tabIndex={0} onKeyDown={keys} role="application" aria-label={t('floor.canvas')}
width={Math.max(1, vbW * scale)} height={Math.max(1, vbH * scale)}
@@ -190,13 +230,13 @@ export default function FloorEditor({ plan: saved, data, groups, onSaved, onDele
style={{ cursor: shapeMode ? 'default' : 'move' }} pointerEvents={shapeMode ? 'none' : undefined}
onPointerDown={e => start(e, { type: 'table', id: tb.id })} data-testid="floor-table" />
))}
{resizable && HANDLES.map(h => {
{resizable && handles.map(h => {
const x = selected.x + (h.includes('e') ? 1 : h.includes('w') ? -1 : 0) * selected.width / 2
const y = selected.y + (h.includes('s') ? 1 : h.includes('n') ? -1 : 0) * selected.height / 2
return (
<rect key={h} x={x - r / 2} y={y - r / 2} width={r} height={r} rx={r / 4} fill="var(--x-surface)" stroke="var(--x-accent)" strokeWidth={2 / scale}
style={{ cursor: CURSOR[h] }} data-testid={`floor-handle-${h}`}
onPointerDown={e => start(e, { type: 'item', id: sel.id, handle: h })} />
onPointerDown={e => start(e, { ...sel, handle: h })} />
)
})}
{shapeMode && edgeHover && (
@@ -342,7 +382,7 @@ function TableButtons({ tables, title, onAdd, quiet = false }) {
function Selected({ thing, sel, plan, t, onChange, onRemove }) {
const isTable = sel.type === 'table'
const isArea = !isTable && thing.kind === 'area'
const setSize = (w, h) => onChange(resize(thing, plan, w, h))
const cells = v => t('floor.cells', { count: v, value: String(v).replace('.', t('floor.decimal')) })
return (
<Panel title={isTable ? t('floor.table', { name: thing.name }) : t(`floor.kinds.${thing.kind}`)}>
{isTable && (
@@ -386,9 +426,21 @@ function Selected({ thing, sel, plan, t, onChange, onRemove }) {
<p className="text-caption text-ink-2">{t('floor.areaResizeHint')}</p>
</>
) : (
<div className="grid grid-cols-2 gap-2">
<Field label={t('floor.itemWidth')}><Input size="sm" type="number" min={4} value={thing.width} onChange={e => setSize(Number(e.target.value), undefined)} /></Field>
<Field label={t('floor.itemHeight')}><Input size="sm" type="number" min={4} value={thing.height} onChange={e => setSize(undefined, Number(e.target.value))} /></Field>
// sizes in grid cells, by half cells (2026-11-21); a wall's thickness in steps
<div className="grid gap-2">
<div className="flex items-center gap-2">
<span className="flex-1 text-label text-ink-2">{t(thing.kind === 'wall' ? 'floor.length' : 'floor.itemWidth')}</span>
<Stepper value={toCells(thing.width, plan)} min={0.5} max={60} step={0.5} format={cells} label={t('floor.itemWidth')}
onChange={v => onChange(resizeCells(thing, plan, v, null))} data-testid="floor-width" />
</div>
<div className="flex items-center gap-2">
<span className="flex-1 text-label text-ink-2">{t(thing.kind === 'wall' ? 'floor.thickness' : 'floor.itemHeight')}</span>
{thing.kind === 'wall'
? <Stepper value={thing.height} steps={WALL_THICKNESS} format={v => `${v} px`} label={t('floor.thickness')} onChange={v => onChange({ height: v })} />
: <Stepper value={toCells(thing.height, plan)} min={0.5} max={60} step={0.5} format={cells} label={t('floor.itemHeight')}
onChange={v => onChange(resizeCells(thing, plan, null, v))} data-testid="floor-height" />}
</div>
<p className="text-caption text-ink-3">{t('floor.cellsHint')}</p>
</div>
)}
<div className="flex items-center gap-1.5">
@@ -92,6 +92,23 @@ export function resize(thing, plan, width, height) {
return { width: w, height: h }
}
/** Sizes in grid cells (2026-11-21): one cell is the plan's grid size (also while the grid is
* hidden), counted in half cells, so a table follows the grid resolution picked. */
export const cellOf = plan => plan.grid_size || 40
export const toCells = (v, plan) => Math.max(0.5, Math.round((v / cellOf(plan)) * 2) / 2)
/** A new size in cells (null: that side unchanged); the centre stays on the grid. */
export function resizeCells(thing, plan, wCells, hCells) {
const c = cellOf(plan)
const width = wCells != null ? Math.max(0.5, wCells) * c : thing.width
const height = hCells != null ? Math.max(0.5, hCells) * c : thing.height
const m = moveTo({ ...thing, width, height }, thing.x, thing.y, plan)
return { width, height, x: m.x, y: m.y }
}
/** A wall's thickness, in steps (px). */
export const WALL_THICKNESS = [4, 6, 8, 12, 16, 20, 24, 32]
/** A rotation turned by `by` degrees, kept within 0–359. */
export const rotate = (deg, by) => (((deg + by) % 360) + 360) % 360
@@ -2,6 +2,7 @@
// Upload → into the library and set here at once ("upload on the spot")
// From library → the picker
// Remove → nothing here any more (the photo stays in the library)
// Layout (2026-11-21): the two buttons, the picture's name under them, then Remove.
// After an upload on the spot, "Name it after <the product>" sets the photo's display name to
// `nameAfter` in Latin letters (latin() from @xenia/i18n). The file names on disk are the backend's.
//
@@ -51,15 +52,16 @@ export default function MediaField({ value, onChange, nameAfter, nameAfterLabel,
<div className="flex gap-3 items-start">
<MediaThumb item={value} className="w-20 h-20 rounded-card border border-line shrink-0" />
<div className="grid gap-2 min-w-0">
{value && <span className="text-label text-ink truncate" title={value.name} data-testid="media-field-name">{value.name}</span>}
<div className="flex flex-wrap gap-2">
<Button size="sm" variant="secondary" icon={<ImagePlus size={14} />} loading={busy} onClick={() => input.current?.click()}
data-testid="media-field-upload">{t(value ? 'media.replace' : 'media.uploadPhoto')}</Button>
<Button size="sm" variant="secondary" icon={<Images size={14} />} disabled={busy} onClick={() => setPicking(true)}
data-testid="media-field-pick">{t('media.fromLibrary')}</Button>
{value && <Button size="sm" variant="ghost" icon={<X size={14} />} disabled={busy} onClick={() => { onChange(null); setFresh(null) }}
data-testid="media-field-remove">{t('media.removePhoto')}</Button>}
</div>
{/* 2026-11-21: the picture's name under the buttons, then "Remove" (red under the pointer) */}
{value && <span className="text-label text-ink truncate" title={value.name} data-testid="media-field-name">{value.name}</span>}
{value && <Button size="sm" variant="ghost" tone="danger" className="justify-self-start" icon={<X size={14} />} disabled={busy} onClick={() => { onChange(null); setFresh(null) }}
data-testid="media-field-remove">{t('media.removePhoto')}</Button>}
{value && fresh === value.id && suggested && suggested !== value.name && (
<button type="button" className="text-label text-accent-ink font-medium text-left disabled:opacity-50" disabled={busy}
onClick={rename} data-testid="media-field-name-after">
@@ -72,7 +72,7 @@ export default function FeesPage() {
{/* left: the fee rules, the areas and the fee's settings as tabs; right: test an order (2026-11-20) */}
<div className="grid gap-6 xl:grid-cols-[minmax(0,3fr)_minmax(19rem,1fr)] items-start">
<section className="rounded-card border border-line bg-surface shadow-raised min-w-0" data-testid="fees-sections">
<Tabs className="px-card" value={section} onChange={setSection}
<Tabs inset value={section} onChange={setSection}
tabs={[
{ id: 'rules', label: t('fees.rules'), badge: data.rules.length || null, testId: 'fees-tab-rules' },
{ id: 'areas', label: t('fees.areas'), badge: data.areas.length || null, testId: 'fees-tab-areas' },
@@ -160,11 +160,13 @@ function RuleRow({ rule, n, areaNames, first, last, onMove, onToggle, onEdit, on
<div className="flex items-center gap-2">
<span className="text-caption font-semibold text-ink-3 w-5">{n}</span>
<span className="flex-1 min-w-0 text-body font-semibold text-ink truncate">{rule.name}</span>
<span className="flex items-center gap-1 shrink-0">
<IconButton size="sm" variant="ghost" label={t('fees.up')} disabled={first} onClick={() => onMove(-1)}><ArrowUp size={16} /></IconButton>
<IconButton size="sm" variant="ghost" label={t('fees.down')} disabled={last} onClick={() => onMove(1)}><ArrowDown size={16} /></IconButton>
<IconButton size="sm" variant="ghost" tone="accent" label={t('fees.edit')} onClick={onEdit}><Pencil size={16} /></IconButton>
<IconButton size="sm" variant="ghost" tone="danger" label={t('fees.delete')} onClick={onDelete}><Trash2 size={16} /></IconButton>
<Switch className="ml-2" checked={rule.is_active} onChange={onToggle} aria-label={t('fees.active')} />
</span>
</div>
<div className="pl-7 text-label text-ink-2 grid gap-0.5">
<span>
@@ -18,6 +18,7 @@ import * as api from './pricingApi'
import { ACTIONS, ROUNDINGS, blankRule, levelOf, roundingKey, ruleBody, ruleProblems, ruleToForm } from './channelPricing'
import { useCatalog } from './useCatalog'
import { useActionText } from './useActionText'
import { TabHead } from './PricingParts'
const LEVEL_TONE = { product: 'accent', category: 'info', channel: 'neutral' }
@@ -48,11 +49,9 @@ export default function ChannelPricesTab() {
const list = [...(rules ?? [])].sort((a, b) => order[levelOf(a)] - order[levelOf(b)] || b.id - a.id)
return (
<div className="grid gap-4" data-testid="channel-prices">
<div className="flex flex-wrap items-start gap-3">
<p className="flex-1 min-w-64 text-body text-ink-2 max-w-3xl">{t('pricing.channels.intro')}</p>
<Button icon={<Plus size={16} />} onClick={() => setEdit(blankRule())} data-testid="channel-price-new">{t('pricing.channels.new')}</Button>
</div>
<section className="grid gap-4" data-testid="channel-prices">
<TabHead title={t('pricing.tabs.channels')} intro={t('pricing.channels.intro')}
action={<Button icon={<Plus size={16} />} onClick={() => setEdit(blankRule())} data-testid="channel-price-new">{t('pricing.channels.new')}</Button>} />
{isPending ? <div className="py-10 flex justify-center"><Spinner /></div>
: !list.length ? <EmptyState title={t('pricing.channels.none')} description={t('pricing.channels.noneHint')} />
: (
@@ -91,7 +90,7 @@ export default function ChannelPricesTab() {
<p className="text-body text-ink-2">{t('pricing.channels.removeBody')}</p>
</Dialog>
)}
</div>
</section>
)
}
@@ -21,7 +21,7 @@ const UNIT = { max_discount_percent: '%', max_discount_amount: '€', max_total_
export default function DiscountsTab() {
const { t } = useTranslation('manager')
return (
<section className="grid gap-5" data-testid="pricing-discounts">
<section className="grid gap-4" data-testid="pricing-discounts">
<TabHead title={t('pricing.discounts.title')} intro={t('pricing.discounts.intro')} />
<VenueLimits />
<PersonLimits />
@@ -73,7 +73,7 @@ function VenueForm({ data, onSaved, t }) {
} catch (err) { toast.error(errorMessage(err, t)) } finally { setBusy(false) }
}
return (
<div className="grid gap-4 p-5 rounded-card border border-line bg-surface shadow-raised" data-testid="pricing-venue-limits">
<div className="grid gap-4 p-card rounded-card border border-line bg-surface shadow-raised" data-testid="pricing-venue-limits">
<header className="grid gap-0.5">
<h3 className="text-body font-semibold text-ink">{t('pricing.discounts.venue')}</h3>
<p className="text-label text-ink-2">{t('pricing.discounts.venueHint')}</p>
@@ -95,7 +95,7 @@ function PersonLimits() {
const id = chosen ?? people[0]?.id ?? null
const { data } = useLiveQuery({ queryKey: ['pricing', 'person-limits', id], queryFn: () => api.waiterLimits(id), enabled: !!id, events: api.PRICING_EVENTS })
return (
<div className="grid gap-4 p-5 rounded-card border border-line bg-surface shadow-raised" data-testid="pricing-person-limits">
<div className="grid gap-4 p-card rounded-card border border-line bg-surface shadow-raised" data-testid="pricing-person-limits">
<header className="grid gap-0.5">
<h3 className="text-body font-semibold text-ink">{t('pricing.discounts.person')}</h3>
<p className="text-label text-ink-2">{t('pricing.discounts.personHint')}</p>
@@ -2,6 +2,8 @@
// limits and (2026-11-20) order channel prices, one tab each. Changes reach the counter, the phones
// and the tablets at once: new prices apply to what is added to orders from then on (lines already
// on an order keep their price). The tab is in the address (?tab=).
// 2026-11-21: the page's title and description first, then the tabs; each tab has its own head
// (title, description, its "New" button at the top right).
import { useSearchParams } from 'react-router-dom'
import { useTranslation } from '@xenia/i18n'
import { Page, PageHeader, Tabs } from '@xenia/ui'
@@ -19,10 +21,9 @@ export default function PricingPage() {
const tab = TABS.includes(params.get('tab')) ? params.get('tab') : 'rules'
const setTab = v => setParams(p => { const n = new URLSearchParams(p); n.set('tab', v); return n }, { replace: true })
return (
<Page testId="pricing-page"
<Page testId="pricing-page" header={<PageHeader title={t('pricing.pageTitle')} subtitle={t('pricing.intro')} />}
top={<Tabs size="lg" value={tab} onChange={setTab} aria-label={t('pricing.pageTitle')}
tabs={TABS.map(k => ({ id: k, label: t(`pricing.tabs.${k}`), testId: `pricing-tab-${k}` }))} />}>
<PageHeader title={t('pricing.pageTitle')} subtitle={t('pricing.intro')} />
{tab === 'rules' && <ModifiersTab />}
{tab === 'channels' && <ChannelPricesTab />}
{tab === 'groups' && <PriceGroupsTab />}
@@ -271,12 +271,12 @@ export function RuleCard({ colour, name, active, badges, summary, description, o
/** The tab's head: what it is, and its "New" button. */
export function TabHead({ title, intro, action }) {
return (
<header className="flex flex-wrap items-start justify-between gap-3">
<div className="grid gap-1 max-w-3xl">
<header className="flex flex-wrap items-start gap-3">
<div className="flex-1 min-w-64 grid gap-1">
<h2 className="text-body-lg font-semibold text-ink">{title}</h2>
<p className="text-label text-ink-2">{intro}</p>
<p className="text-label text-ink-2 max-w-3xl">{intro}</p>
</div>
{action}
{action && <div className="shrink-0 ml-auto">{action}</div>}
</header>
)
}
@@ -4,9 +4,9 @@
// count is the products listed in it, so a product in two categories counts in both. The chosen
// category's row shows its actions.
import { useRef, useState } from 'react'
import { Archive, ArrowRightLeft, ChevronDown, ChevronRight, Folder, GripVertical, Pencil, Plus, Search, Trash2, Truck, X } from 'lucide-react'
import { Archive, ArrowRightLeft, ChevronDown, ChevronRight, Folder, GripVertical, Pencil, Plus, Trash2, Truck } from 'lucide-react'
import { useTranslation } from '@xenia/i18n'
import { IconButton, Input, cx } from '@xenia/ui'
import { IconButton, Pane, SearchInput, cx } from '@xenia/ui'
import { SCOPES, countIn, isArchived, moveId, subsOf, topLevel } from './productsLogic'
export function Dot({ cat, size = 'w-2 h-2' }) {
@@ -57,36 +57,34 @@ export default function CategoryTree({ categories, products, scope, onScope, onA
)
return (
<aside className="rounded-card border border-line bg-surface shadow-raised flex flex-col min-h-0 overflow-hidden md:sticky md:top-0 md:max-h-[calc(100dvh-7.5rem)]" data-testid="category-tree">
<div className="flex items-center gap-2 px-card pt-card-y pb-2">
<Folder size={16} className="text-ink-3" aria-hidden="true" />
<h2 className="flex-1 text-label font-semibold text-ink">{t('products.categories')}</h2>
<IconButton size="sm" variant="secondary" label={t('products.category.new')} onClick={() => onAdd(null)} data-testid="category-add"><Plus size={14} /></IconButton>
</div>
<div className="px-4 pb-2 relative">
<Search size={14} className="absolute left-7 top-1/2 -translate-y-1/2 text-ink-3 pointer-events-none" aria-hidden="true" />
<Input size="sm" className="pl-8" value={query} onChange={e => setQuery(e.target.value)} placeholder={t('products.searchCategories')} aria-label={t('products.searchCategories')} />
{query && <IconButton size="sm" variant="ghost" className="absolute right-5 top-1/2 -translate-y-1/2" label={t('products.clear')} onClick={() => setQuery('')}><X size={12} /></IconButton>}
</div>
<div className="flex-1 min-h-0 overflow-y-auto px-2 pb-2 max-h-72 md:max-h-none">
<Row label={t('products.service')} count={live.filter(p => p.is_service_item).length} active={scope === SCOPES.service} onClick={() => onScope(SCOPES.service)}
dot={<Truck size={14} className="text-warning-ink shrink-0" aria-hidden="true" />} />
<Row label={t('products.all')} count={live.filter(p => !p.is_service_item).length} active={scope === SCOPES.all} onClick={() => onScope(SCOPES.all)}
dot={<span className="w-2 h-2 rounded-full bg-accent shrink-0" aria-hidden="true" />} testId="category-all" />
{topLevel(categories).filter(matches).map(cat => (
<div key={cat.id}>
{row(cat, 0, null)}
{(open.has(cat.id) || q) && subsOf(categories, cat.id).map(s => row(s, 1, cat.id))}
</div>
))}
</div>
<div className="border-t border-line p-2">
<Pane as="aside" data-testid="category-tree" bodyClassName="px-2 py-2 max-h-72 md:max-h-none"
header={<>
<div className="flex items-center gap-2 px-card pt-card-y pb-2">
<Folder size={16} className="text-ink-3" aria-hidden="true" />
<h2 className="flex-1 text-label font-semibold text-ink">{t('products.categories')}</h2>
<IconButton size="sm" variant="secondary" label={t('products.category.new')} onClick={() => onAdd(null)} data-testid="category-add"><Plus size={14} /></IconButton>
</div>
<div className="px-4 pb-3">
<SearchInput size="sm" value={query} onChange={setQuery} placeholder={t('products.searchCategories')} />
</div>
</>}
footer={<div className="p-2">
<Row label={t('products.uncategorized')} count={live.filter(p => !(p.category_ids ?? []).length && !p.is_service_item).length}
active={scope === SCOPES.none} onClick={() => onScope(SCOPES.none)} dot={<Folder size={14} className="text-ink-3 shrink-0" aria-hidden="true" />} />
<Row label={t('products.archived')} count={products.filter(isArchived).length}
active={scope === SCOPES.archived} onClick={() => onScope(SCOPES.archived)} dot={<Archive size={14} className="text-ink-3 shrink-0" aria-hidden="true" />} />
</div>
</aside>
</div>}>
<Row label={t('products.service')} count={live.filter(p => p.is_service_item).length} active={scope === SCOPES.service} onClick={() => onScope(SCOPES.service)}
dot={<Truck size={14} className="text-warning-ink shrink-0" aria-hidden="true" />} />
<Row label={t('products.all')} count={live.filter(p => !p.is_service_item).length} active={scope === SCOPES.all} onClick={() => onScope(SCOPES.all)}
dot={<span className="w-2 h-2 rounded-full bg-accent shrink-0" aria-hidden="true" />} testId="category-all" />
{topLevel(categories).filter(matches).map(cat => (
<div key={cat.id}>
{row(cat, 0, null)}
{(open.has(cat.id) || q) && subsOf(categories, cat.id).map(s => row(s, 1, cat.id))}
</div>
))}
</Pane>
)
}
@@ -3,7 +3,7 @@
// in that category only. A product listed in several categories shows in each, with its other
// categories named; its main one is marked.
import { useRef, useState } from 'react'
import { Archive, ChevronDown, ChevronRight, ChevronUp, GripVertical, Pencil, Star, Trash2 } from 'lucide-react'
import { Archive, ChevronDown, ChevronRight, ChevronUp, GripVertical, Pencil, Trash2 } from 'lucide-react'
import { useFormat, useTranslation } from '@xenia/i18n'
import { Button, IconButton, cx } from '@xenia/ui'
import { Dot } from './CategoryTree'
@@ -91,12 +91,12 @@ function Others({ p, here, categories }) {
if (!other.length) return null // only in this category: nothing to say
return (
<>
{here != null && here === p.primary_category_id && <span className="inline-flex items-center gap-1 text-accent-ink" title={t('products.mainHere')}><Star size={12} aria-hidden="true" />{t('products.main')}</span>}
{here != null && here === p.primary_category_id && <span className="px-1.5 rounded-full bg-accent-soft text-accent-ink font-semibold" title={t('products.mainHere')}>{t('products.main')}</span>}
{other.map(id => {
const c = categories.find(x => x.id === id)
return c && (
<span key={id} className="inline-flex items-center gap-1 px-1.5 rounded-full bg-surface-2" data-testid="also-in">
<Dot cat={c} size="w-1.5 h-1.5" />{t('products.alsoIn', { name: c.name })}{id === p.primary_category_id && <Star size={10} className="text-accent-ink" aria-label={t('products.main')} />}
<Dot cat={c} size="w-1.5 h-1.5" />{t('products.alsoIn', { name: c.name })}{id === p.primary_category_id && <span className="font-semibold text-accent-ink">· {t('products.main')}</span>}
</span>
)
})}
@@ -8,7 +8,7 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'
import toast from 'react-hot-toast'
import { errorMessage } from '@xenia/api'
import { useTranslation } from '@xenia/i18n'
import { Button, Dialog, EmptyState, Page, Spinner } from '@xenia/ui'
import { Button, Dialog, EmptyState, Page, Pane, Spinner } from '@xenia/ui'
import { Package } from 'lucide-react'
import client from '../../api/client'
import { useLiveQuery } from '../../live/useLiveQuery'
@@ -97,15 +97,16 @@ export default function ProductsPage() {
const allIds = [...new Set(groups.flatMap(g => g.items.map(p => p.id)))]
return (
<Page testId="products-page">
<div className="grid gap-5 md:grid-cols-[minmax(17rem,22rem)_minmax(0,1fr)] items-start">
<Page testId="products-page" fit>
{/* 2026-11-21: the page doesn't scroll; each side does, its header and footer stay */}
<div className="x-page__fill grid gap-5 md:grid-cols-[minmax(17rem,22rem)_minmax(0,1fr)]">
<CategoryTree categories={categories} products={products} scope={scope}
onScope={s => { setScope(s); setSub(null); setSelected(new Set()) }}
onAdd={parent => setCatEdit({ parent_id: parent })} onEdit={setCatEdit} onMove={setCatMove}
onDelete={c => setConfirm({ kind: 'category', item: c })}
onReorder={(level, ids) => reorderCats.mutate({ level, ids })} />
<section className="min-w-0 rounded-card border border-line bg-surface shadow-raised" data-testid="products-panel">
<Pane sunken data-testid="products-panel" bodyClassName="p-card" header={<>
<Toolbar title={title} shown={allIds.length} total={products.filter(p => !isArchived(p)).length}
search={search} onSearch={setSearch} filters={filters} onFilters={setFilters} view={view} onView={setView} onNew={newProduct} />
{subs.length > 0 && (
@@ -118,7 +119,7 @@ export default function ProductsPage() {
onUnavailable={() => bulkPut(() => ({ is_available: false }), t('products.updated', { count: selected.size }))}
onArchive={() => setConfirm({ kind: 'bulkArchive' })} onZones={() => setBulk('zones')} onCategory={() => setBulk('category')} />
)}
<div className="flex items-center justify-between px-card py-2.5 border-y border-line bg-surface-2 text-label text-ink-2">
<div className="flex items-center justify-between px-card py-2.5 border-t border-line text-label text-ink-2">
<label className="flex items-center gap-2 cursor-pointer select-none">
<input type="checkbox" className="w-4 h-4 accent-[var(--x-accent)]" checked={allIds.length > 0 && allIds.every(id => selected.has(id))}
onChange={e => setSelected(e.target.checked ? new Set(allIds) : new Set())} />
@@ -126,14 +127,13 @@ export default function ProductsPage() {
</label>
<span>{t('products.totals', { active: products.filter(p => !isArchived(p)).length, categories: categories.length, archived: products.filter(isArchived).length })}</span>
</div>
<div className="p-card">
{allIds.length === 0
? <EmptyState icon={<Package size={28} />} title={t('products.none')} description={t('products.noneHint')} action={<Button onClick={newProduct}>{t('products.new')}</Button>} />
: <ProductList groups={groups} view={view} categories={categories} prepZones={zones} selected={selected} onSelect={toggleSelect}
onEdit={setEditing} onToggle={p => toggle.mutate(p)} onReorder={body => reorder.mutate(body)}
onRemove={p => setConfirm({ kind: isArchived(p) ? 'delete' : 'archive', item: p })} />}
</div>
</section>
</>}>
{allIds.length === 0
? <EmptyState icon={<Package size={28} />} title={t('products.none')} description={t('products.noneHint')} action={<Button onClick={newProduct}>{t('products.new')}</Button>} />
: <ProductList groups={groups} view={view} categories={categories} prepZones={zones} selected={selected} onSelect={toggleSelect}
onEdit={setEditing} onToggle={p => toggle.mutate(p)} onReorder={body => reorder.mutate(body)}
onRemove={p => setConfirm({ kind: isArchived(p) ? 'delete' : 'archive', item: p })} />}
</Pane>
</div>
{editing && (
@@ -1,9 +1,9 @@
// The editor's two list fields (plan step 6.3): the product's categories with its main one, and
// its allergens.
import { Star, X } from 'lucide-react'
import { X } from 'lucide-react'
import { ALLERGENS, nextAllergenLevel, setAllergen } from '@xenia/access'
import { useTranslation } from '@xenia/i18n'
import { IconButton, InfoTip, Select, cx } from '@xenia/ui'
import { Button, IconButton, InfoTip, Select, cx } from '@xenia/ui'
import { categoryTree, treeLabel } from '../productsLogic'
import { addCategory, removeCategory } from './formLogic'
@@ -32,8 +32,8 @@ export function CategoriesField({ form, setForm, categories }) {
data-testid="product-category" data-id={id} data-main={main}>
<span className="flex-1 min-w-0 truncate text-body text-ink">{name(id)}</span>
{main
? <span className="text-caption font-semibold text-accent-ink">{t('products.editor.main')}</span>
: <IconButton size="sm" variant="ghost" label={t('products.editor.makeMain')} onClick={() => setForm(f => ({ ...f, primary_category_id: id }))} data-testid="make-main"><Star size={14} /></IconButton>}
? <span className="px-2 py-0.5 rounded-full bg-accent text-accent-fg text-caption font-semibold">{t('products.editor.main')}</span>
: <Button size="sm" variant="ghost" title={t('products.editor.makeMain')} onClick={() => setForm(f => ({ ...f, primary_category_id: id }))} data-testid="make-main">{t('products.editor.setMain')}</Button>}
<IconButton size="sm" variant="ghost" label={t('products.editor.removeCategory')} onClick={() => setForm(f => removeCategory(f, id))}><X size={14} /></IconButton>
</li>
)
@@ -38,7 +38,7 @@ export default function ProductEditor({ product, categories, prepZones, saving,
</div>}>
<div className="flex-1 flex flex-col md:flex-row min-h-0 w-full overflow-y-auto md:overflow-hidden" data-testid="product-editor">
<div className={cx('flex flex-col md:min-h-0 border-b md:border-b-0 md:border-r border-line bg-surface-2', service ? 'w-full' : 'w-full md:w-[34%] md:min-w-[24rem]')}>
<Tabs className="px-card bg-surface shrink-0" value={left} onChange={setLeft}
<Tabs fill className="px-card bg-surface shrink-0" value={left} onChange={setLeft}
tabs={leftTabs.map(k => ({ id: k, label: t(`products.editor.left.${k}`), testId: `editor-tab-${k}` }))} />
<div className="flex-1 md:min-h-0 md:overflow-y-auto p-4 md:p-5">
{left === 'info' && <InfoTab form={form} set={set} setForm={setForm} categories={categories} prepZones={prepZones} />}
@@ -10,13 +10,15 @@
// - Role mode (plan step 4.3, `role` instead of `member`): the venue's defaults of a role,
// GET/PUT /api/waiters/roles/{role}/permissions; saving applies the change to everyone
// with the role and to staff added later. "Back to the defaults" = the manifests' keys.
// - A search box stays at the top (2026-11-21): it finds a permission by its name or its
// module's (accents ignored, Latin letters find Greek).
import { useEffect, useMemo, useState } from 'react'
import toast from 'react-hot-toast'
import { useQueryClient } from '@tanstack/react-query'
import { errorMessage, parseError } from '@xenia/api'
import { useAccess } from '@xenia/access'
import { useTranslation } from '@xenia/i18n'
import { Button, InfoTip, Sheet, Spinner, Switch } from '@xenia/ui'
import { latin, useTranslation } from '@xenia/i18n'
import { Button, EmptyState, InfoTip, SearchInput, Sheet, Spinner, Switch } from '@xenia/ui'
import client from '../../api/client'
import { canGive, diff, editorGroups, permLabelKey, resetToRole } from './permissionsLogic'
@@ -30,6 +32,7 @@ export default function PermissionEditor({ member, role, onClose }) {
const [error, setError] = useState('')
const [note, setNote] = useState('')
const [busy, setBusy] = useState(false)
const [query, setQuery] = useState('')
const targetUrl = role ? `/api/waiters/roles/${role}/permissions` : `/api/waiters/${member.id}/permissions`
@@ -57,6 +60,10 @@ export default function PermissionEditor({ member, role, onClose }) {
const roleName = r => t(`roles.${r}`, { defaultValue: r })
const name = role ? roleName(role) : (member.full_name || member.username)
const label = key => t(permLabelKey(key))
const fold = v => latin(String(v ?? '')).toLowerCase()
const q = fold(query.trim())
const shown = !q ? groups : groups.map(g => (fold(t(`modules:${g.key}.name`, { defaultValue: g.key })).includes(q) ? g
: { ...g, permissions: g.permissions.filter(p => fold(label(p.key)).includes(q)) })).filter(g => g.permissions.length)
const changes = data && draft ? diff(draft, data.original) : { added: [], removed: [] }
const changed = changes.added.length + changes.removed.length
const readOnly = data?.target.superadmin
@@ -111,6 +118,7 @@ export default function PermissionEditor({ member, role, onClose }) {
<Sheet open side="right" size="wide" onClose={onClose} title={role ? t('permissions.roleTitle', { role: name }) : t('permissions.title', { name })}
description={!data ? undefined : role ? t('permissions.roleSubtitle', { count: data.target.people })
: t('permissions.subtitle', { role: roleName(data.target.role) })}
toolbar={data && !readOnly ? <SearchInput value={query} onChange={setQuery} placeholder={t('permissions.search')} data-testid="perm-search" /> : undefined}
footer={footer}>
{!data && !error && <div className="py-10 flex justify-center"><Spinner /></div>}
{!data && error && <p className="text-label text-danger-ink" role="alert">{error}</p>}
@@ -119,7 +127,8 @@ export default function PermissionEditor({ member, role, onClose }) {
<div className="grid gap-8" data-testid="perm-editor">
{note && <p className="text-label text-ink-2 bg-surface-2 rounded-card px-3 py-2" data-testid="perm-note">{note}</p>}
{error && <p className="text-label text-danger-ink bg-danger-soft rounded-card px-3 py-2" role="alert" data-testid="perm-error">{error}</p>}
{groups.map(g => (
{shown.length === 0 && <EmptyState title={t('permissions.noMatch')} />}
{shown.map(g => (
<section key={g.key} data-testid={`perm-group-${g.key}`}>
<h3 className="text-overline font-semibold uppercase tracking-wide text-ink-3 mb-3 flex items-center gap-3">
{t(`modules:${g.key}.name`, { defaultValue: g.key })}
+17
View File
@@ -73,3 +73,20 @@ test('the floor’s shape: a corner added where the edge was pressed; an area re
assert.equal(coveredAreas([named], []).size, 0)
assert.equal(coveredAreas([named], [{ x: 200, y: 200, width: 80, height: 80 }]).has('a'), true)
})
test('sizes in grid cells (by half cells) follow the grid resolution', async () => {
const { cellOf, resizeCells, toCells } = await import('../src/pages/floor/editorLogic.js')
assert.equal(cellOf(plan), 50)
assert.equal(toCells(100, plan), 2)
assert.equal(toCells(70, plan), 1.5)
assert.equal(toCells(5, plan), 0.5)
const table = { x: 100, y: 100, width: 100, height: 100 }
const r = resizeCells(table, plan, 3, null)
assert.equal(r.width, 150)
assert.equal(r.height, 100)
assert.equal(r.x % 50, 25) // 3 cells: the centre goes into the middle of a cell
assert.equal(resizeCells(table, { ...plan, grid_size: 25 }, 3, 1.5).height, 37.5)
// a resize handle snaps to half cells
const { resizeBox } = await import('@xenia/floorplan/geometry')
assert.equal(resizeBox({ x: 100, y: 100, width: 100, height: 100 }, 'e', 172, 0, { width: 500, height: 500, grid_on: true, grid_size: 50 }).width, 125)
})
+1 -1
View File
@@ -182,7 +182,7 @@ export function resizeBox(thing, handle, px, py, plan, min = 20) {
let right = thing.x + thing.width / 2
let top = thing.y - thing.height / 2
let bottom = thing.y + thing.height / 2
const at = v => (grid ? snap(v, grid) : Math.round(v))
const at = v => (grid ? snap(v, grid / 2) : Math.round(v)) // half cells (2026-11-21)
if (handle.includes('w')) left = Math.min(at(clamp(px, 0, plan.width)), right - min)
if (handle.includes('e')) right = Math.max(at(clamp(px, 0, plan.width)), left + min)
if (handle.includes('n')) top = Math.min(at(clamp(py, 0, plan.height)), bottom - min)
+15 -2
View File
@@ -249,6 +249,8 @@
"custom": "Προσαρμοσμένος"
},
"permissions": {
"search": "Αναζήτηση δικαιωμάτων",
"noMatch": "Κανένα δικαίωμα δεν ταιριάζει με την αναζήτηση.",
"column": "Δικαιώματα",
"open": "Δικαιώματα",
"count_one": "{{count}} δικαίωμα",
@@ -2078,6 +2080,7 @@
"noCategory": "Δεν είναι ακόμα σε κατηγορία.",
"main": "Κύρια",
"makeMain": "Ορισμός ως κύρια κατηγορία",
"setMain": "Ορισμός κύριας",
"removeCategory": "Αφαίρεση από την κατηγορία",
"addCategory": "Προσθήκη κατηγορίας…",
"prepZones": "Ζώνες προετοιμασίας",
@@ -2646,7 +2649,17 @@
"shapeHowTo": "Ένας χώρος έχει τουλάχιστον 3 γωνίες.",
"colour": "Χρώμα",
"noColour": "Κανένα",
"areaResizeHint": "Σύρετε τις λαβές στις πλευρές και τις γωνίες για να αλλάξετε το μέγεθος."
"areaResizeHint": "Σύρετε τις λαβές στις πλευρές και τις γωνίες για να αλλάξετε το μέγεθος.",
"saveShape": "Αποθήκευση σχήματος",
"shapeSaved": "Το σχήμα του χώρου αποθηκεύτηκε.",
"zoomIn": "Μεγέθυνση",
"zoomOut": "Σμίκρυνση",
"cells_one": "{{value}} κελί",
"cells_other": "{{value}} κελιά",
"decimal": ",",
"length": "Μήκος",
"thickness": "Πάχος",
"cellsHint": "Σε κελιά του πλέγματος (ανά μισό κελί): ένα κελί είναι το μέγεθος του πλέγματος, οπότε τα μεγέθη ακολουθούν την ανάλυσή του. Ή σύρετε τις λαβές στις πλευρές και τις γωνίες."
},
"orders": {
"back": "Πίσω",
@@ -2851,7 +2864,7 @@
"saved": "Η ζώνη αποθηκεύτηκε",
"about": "Η ζώνη",
"name": "Όνομα",
"nameHint": "Το εσωτερικό όνομα της ζώνης, για το σύστημα (λίστες, αναφορές, ρυθμίσεις). Το προσωπικό βλέπει το όνομα από κάτω.",
"nameHint": "Το εσωτερικό όνομα της ζώνης, για το σύστημα (λίστες, αναφορές, ρυθμίσεις). Το προσωπικό βλέπει αντί γι' αυτό το «Όνομα στα μηνύματα».",
"namePh": "π.χ. Κουζίνα, Ψησταριά, Μπαρ",
"nameNeeded": "Δώστε όνομα στη ζώνη.",
"shown": "Όνομα στα μηνύματα",
+15 -2
View File
@@ -249,6 +249,8 @@
"custom": "Custom"
},
"permissions": {
"search": "Search permissions",
"noMatch": "No permission matches this search.",
"column": "Permissions",
"open": "Permissions",
"count_one": "{{count}} permission",
@@ -2078,6 +2080,7 @@
"noCategory": "Not in any category yet.",
"main": "Main",
"makeMain": "Make it the main category",
"setMain": "Make main",
"removeCategory": "Remove from this category",
"addCategory": "Add a category…",
"prepZones": "Prep zones",
@@ -2646,7 +2649,17 @@
"shapeHowTo": "A floor has at least 3 corners.",
"colour": "Colour",
"noColour": "None",
"areaResizeHint": "Drag the handles on its sides and corners to resize it."
"areaResizeHint": "Drag the handles on its sides and corners to resize it.",
"saveShape": "Save shape",
"shapeSaved": "The floor's shape is saved.",
"zoomIn": "Zoom in",
"zoomOut": "Zoom out",
"cells_one": "{{value}} cell",
"cells_other": "{{value}} cells",
"decimal": ".",
"length": "Length",
"thickness": "Thickness",
"cellsHint": "In grid cells (by half cells): a cell is the grid's size, so sizes follow the grid resolution. Or drag the handles on its sides and corners."
},
"orders": {
"back": "Back",
@@ -2851,7 +2864,7 @@
"saved": "Zone saved",
"about": "The zone",
"name": "Name",
"nameHint": "The zone's own name, used inside the system (lists, reports, settings). Staff see the name below.",
"nameHint": "The zone's own name, used inside the system (lists, reports, settings). Staff see its \"Name in messages\" instead.",
"namePh": "e.g. Kitchen, Grill, Bar",
"nameNeeded": "Give the zone a name.",
"shown": "Name in messages",
+23 -1
View File
@@ -427,6 +427,11 @@ try {
r.check('editor: grouped by module (Ordering, Kitchen display, Core…), cancel is off for a waiter',
await page.getByTestId('perm-group-ordering').count() === 1 && await page.getByTestId('perm-group-core').count() === 1 &&
await cancelRow.getAttribute('data-on') === 'false' && (await cancelRow.textContent()).includes('Cancel items already sent'))
// 2026-11-21: the search at the top finds a permission
await page.getByTestId('perm-search').fill('cancel items')
r.check('editor: the search keeps only the matching permissions',
await cancelRow.count() === 1 && await page.getByTestId('perm-group-core').count() === 0)
await page.getByTestId('perm-search').fill('')
await cancelRow.getByRole('switch').click()
await page.getByRole('button', { name: 'Save 1 change' }).click()
await editor.waitFor({ state: 'detached', timeout: 8000 }).catch(() => {})
@@ -1120,8 +1125,21 @@ try {
await page.mouse.move(tb.x + tb.width / 2 + 75, tb.y + tb.height / 2, { steps: 5 })
await page.mouse.move(tb.x + tb.width / 2 + 150, tb.y + tb.height / 2 + 60, { steps: 5 })
await page.mouse.up()
// 2026-11-21: sizes in grid cells: "+" on the width adds half a cell
await page.locator(`[data-testid="floor-canvas"] [data-testid="floor-table"][data-table="${secondId}"]`).click()
const widthOf = () => page.getByTestId('floor-width').locator('.x-stepper__value').textContent()
const w0 = await widthOf()
await page.getByTestId('floor-width').locator('button').last().click()
const w1 = await widthOf()
r.check('floor: a table\'s width grows by half a grid cell', parseFloat(w1.replace(',', '.')) - parseFloat(w0.replace(',', '.')) === 0.5, `${w0} → ${w1}`)
await page.keyboard.press('Escape')
// an irregular floor: a corner more, pulled in
await page.getByTestId('floor-shape-mode').click()
// 2026-11-21: right beside a corner there is no "+" (the corner's bubble removes it)
const c0 = await page.getByTestId('floor-corner').nth(1).boundingBox()
await page.mouse.move(c0.x + c0.width / 2, c0.y + c0.height / 2 + 14, { steps: 2 })
await sleep(100)
r.check('floor: no "+" right beside a corner', await page.getByTestId('floor-edge-add').count() === 0)
// 2026-11-20: a "+" shows on the edge under the pointer; pressing there adds a corner and drags it
const c1 = await page.getByTestId('floor-corner').nth(1).boundingBox()
const c2 = await page.getByTestId('floor-corner').nth(2).boundingBox()
@@ -1134,7 +1152,11 @@ try {
await page.mouse.move(mid.x - 120, mid.y + 10, { steps: 6 })
await page.mouse.up()
r.check('floor: pressing on the edge added a corner (5)', await page.getByTestId('floor-corner').count() === 5)
await page.getByTestId('floor-shape-mode').click()
// "Save shape" saves the shape at once and leaves the shape mode
await page.getByTestId('floor-shape-save').click()
await page.getByTestId('floor-shape-mode').waitFor({ timeout: 5000 })
const shaped = (await api('GET', '/api/floor-plans', { token: boss })).plans.find(x => x.name === 'E2E ground floor')
r.check('floor: "Save shape" saved the five-corner floor', shaped?.outline?.length === 5, JSON.stringify(shaped?.outline))
await page.screenshot({ path: path.join(OUT, 'manager-floor-editor.png') })
await page.getByTestId('floor-save').click()
let saved = null
+16 -1
View File
@@ -65,8 +65,10 @@ try {
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')
// the area: the scroller without its scrollbar's room (kept on every page, 2026-11-21)
const b = body.getBoundingClientRect(); const s = scroll.getBoundingClientRect()
const a = { left: s.left, right: s.left + scroll.clientWidth, width: scroll.clientWidth }
// 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),
@@ -80,6 +82,19 @@ try {
}
r.check(`${screen.id}: every page fills its area up to 16:9, centred, and scrolls`, bad.length === 0, bad.join('\n'))
// Products (2026-11-21): the page doesn't scroll, its two panes do, each on its own
await page.goto(`${APP}/management/products`)
await page.getByTestId('products-panel').waitFor()
const panes = await page.evaluate(() => {
const scroll = document.querySelector('main .x-page__scroll')
const bodies = [...document.querySelectorAll('main .x-pane__body')].map(e => getComputedStyle(e).overflowY)
const tree = document.querySelector('[data-testid="category-tree"]').getBoundingClientRect()
const list = document.querySelector('[data-testid="products-panel"]').getBoundingClientRect()
return { page: getComputedStyle(scroll).overflowY, bodies, sameTop: Math.abs(tree.top - list.top) < 1, fits: list.bottom <= innerHeight + 1 }
})
r.check(`${screen.id}: products: two panes that scroll on their own, the page fixed`,
panes.page === 'hidden' && panes.bodies.length === 2 && panes.bodies.every(o => o === 'auto') && panes.sameTop && panes.fits, JSON.stringify(panes))
if (screen.id === '1080p') {
// the shared dropdown: multi-select, same height as the search box
await page.goto(`${APP}/financials/expenses`)