From 9021373a6bdf78d615212791d3c9be6d63f18cd9 Mon Sep 17 00:00:00 2001 From: bonamin Date: Fri, 20 Nov 2026 15:27:07 +0200 Subject: [PATCH] feat(manager): every report on the shared controls (one toolbar height, modern dropdowns, shared tabs) - The period: one toolbar (range / day as a Segmented, dates, quick choices, the report's own filters and export / print on the right), every control 44 px; the business day a searchable Dropdown. - Report filters (person, category, status, waiter, table, printer) are the shared Dropdown; export / print buttons as tall as the rest; trends' step a Segmented. - A report's tabs are the shared tab strip above the page; a day's and an order's sections too. - e2e: the floor editor's edge '+' and the layout check cover products, tables set-up and the channel prices. Co-Authored-By: Claude Opus 5.5 --- .../pages/reports/expenses/ExpensesReport.jsx | 10 +-- .../src/pages/reports/kit/OrderDialog.jsx | 6 +- .../src/pages/reports/kit/Period.jsx | 65 +++++++++---------- .../src/pages/reports/kit/parts.jsx | 24 ++----- .../reports/prepzones/PrepZonesReport.jsx | 6 +- .../pages/reports/products/ProductsReport.jsx | 8 +-- .../src/pages/reports/staff/StaffReport.jsx | 6 +- .../src/pages/reports/store/DaysTab.jsx | 11 +--- .../src/pages/reports/store/OrdersTab.jsx | 12 ++-- .../src/pages/reports/store/TablesTab.jsx | 2 +- .../src/pages/reports/store/TrendsTab.jsx | 4 +- .../reports/technical/TechnicalReport.jsx | 8 +-- tests/e2e/manager.mjs | 2 +- 13 files changed, 71 insertions(+), 93 deletions(-) diff --git a/manager_dashboard/src/pages/reports/expenses/ExpensesReport.jsx b/manager_dashboard/src/pages/reports/expenses/ExpensesReport.jsx index bc925c7..ec0bb79 100644 --- a/manager_dashboard/src/pages/reports/expenses/ExpensesReport.jsx +++ b/manager_dashboard/src/pages/reports/expenses/ExpensesReport.jsx @@ -4,7 +4,7 @@ // The period is filtered by the server (venue dates, 6.13a); categories / statuses are `finance.*` texts. import { useState } from 'react' import { useFormat, useTranslation } from '@xenia/i18n' -import { Button, Dialog, Select } from '@xenia/ui' +import { Button, Dialog, Dropdown } from '@xenia/ui' import client from '../../../api/client' import { useLiveQuery } from '../../../live/useLiveQuery' import { Pill } from '../../overview/parts' @@ -51,10 +51,10 @@ function Expenses() { ] return (
- - setCategory(e.target.value)} aria-label={t('reports.prod.category')} + setCategory(v)} aria-label={t('reports.prod.category')} options={[{ value: '', label: t('reports.prod.allCategories') }, ...CATEGORIES.map(c => ({ value: c, label: catName(c) }))]} /> } /> {isPending ? : error ? : (<> @@ -65,7 +65,7 @@ function Expenses() {
{groups.length > 0 && ( {['category', 'supplier'].map(s => ( - ))}}> + ))}}> fmt.formatMoney(v)} rows={groups.map(g => ({ ...g, sub: g.due ? t('reports.exp.dueSub', { amount: fmt.formatMoney(g.due) }) : undefined }))} /> )} diff --git a/manager_dashboard/src/pages/reports/kit/OrderDialog.jsx b/manager_dashboard/src/pages/reports/kit/OrderDialog.jsx index 384ea36..a60fae1 100644 --- a/manager_dashboard/src/pages/reports/kit/OrderDialog.jsx +++ b/manager_dashboard/src/pages/reports/kit/OrderDialog.jsx @@ -5,7 +5,7 @@ import { useState } from 'react' import { useNavigate } from 'react-router-dom' import { ArrowRight } from 'lucide-react' import { useFormat, useTranslation } from '@xenia/i18n' -import { Button, Dialog } from '@xenia/ui' +import { Button, Dialog, Tabs } from '@xenia/ui' import client from '../../../api/client' import { useLiveQuery } from '../../../live/useLiveQuery' import { AuditList, PriceEventList } from '../../orders/OrderHistory' @@ -41,9 +41,7 @@ export default function OrderDialog({ order: summary, onClose }) { }>
- - {TABS.map(k => )} - + ({ id: k, label: t(`reports.orderTabs.${k}`) }))} /> {!order ? : tab === 'lines' ? {}} onChanged={() => {}} /> : tab === 'prices' ? : }
diff --git a/manager_dashboard/src/pages/reports/kit/Period.jsx b/manager_dashboard/src/pages/reports/kit/Period.jsx index 5401c33..2bdc7b2 100644 --- a/manager_dashboard/src/pages/reports/kit/Period.jsx +++ b/manager_dashboard/src/pages/reports/kit/Period.jsx @@ -1,15 +1,15 @@ // The period a report covers (plan step 6.12a): dates (from – to, with quick choices) or one // business day. Dates are venue calendar days; the backend reads them in venue time. -import { useId } from 'react' +// 2026-11-20: one toolbar (the shared controls, one height): range / day, the dates, the quick +// choices, then what the report adds on the right (filters, export, print). import { useFormat, useTranslation } from '@xenia/i18n' -import { Button, Input, Select } from '@xenia/ui' +import { Button, Dropdown, Input, Segmented, Toolbar, ToolbarSpacer } from '@xenia/ui' import { dayChoices, quickRange, rangeProblem } from './reportLogic' import { useBusinessDays } from './useBusinessDays' export function PeriodPicker({ value, onChange, allowDay = true, right }) { const { t } = useTranslation('manager') const fmt = useFormat() - const id = useId() const today = fmt.venueToday() const { data: days = [] } = useBusinessDays() const set = patch => onChange({ ...value, ...patch }) @@ -17,38 +17,33 @@ export function PeriodPicker({ value, onChange, allowDay = true, right }) { const dayLabel = d => `${fmt.formatDateTime(d.opened_at, 'datetimeShort')}${d.status === 'open' ? ` · ${t('reports.open')}` : ''}` return ( -
- {allowDay && ( -
- {['range', 'day'].map(m => ( - - ))} -
- )} - {value.mode === 'range' ? (<> - - - - {['today', 'week', 'month', 'thirty'].map(k => ( - - ))} - - ) : ( - + + + {['today', 'week', 'month', 'thirty'].map(k => ( + + ))} + + ) : ( + set({ dayId: v })} aria-label={t('reports.businessDay')} data-testid="period-day" searchable + options={dayChoices(days).map(d => ({ value: String(d.id), label: dayLabel(d) }))} placeholder={days.length ? t('reports.businessDay') : t('reports.noDays')} /> + )} + + {right} + + {problem &&

{t(`reports.rangeProblem.${problem}`)}

}
) } diff --git a/manager_dashboard/src/pages/reports/kit/parts.jsx b/manager_dashboard/src/pages/reports/kit/parts.jsx index 80733a2..049d048 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, Page, Spinner, cx } from '@xenia/ui' +import { Button, EmptyState, InfoTip, Page, PageHeader, Spinner, Tabs, cx } from '@xenia/ui' import client from '../../../api/client' import { sortRows } from './reportLogic' @@ -17,21 +17,11 @@ 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 && ( - - )} -
- {tab ? : children} + 1 ? ({ id: t.id, label: t.label, testId: `report-tab-${t.id}` }))} + onChange={id => setParams(p => { const n = new URLSearchParams(p); n.set('tab', id); return n }, { replace: true })} /> : undefined}> + + {tab ? : children} ) } @@ -149,5 +139,5 @@ export function ExportButton({ endpoint, params, filename }) { setTimeout(() => URL.revokeObjectURL(url), 1000) } catch (err) { toast.error(errorMessage(err, t)) } finally { setBusy(false) } } - return + return } diff --git a/manager_dashboard/src/pages/reports/prepzones/PrepZonesReport.jsx b/manager_dashboard/src/pages/reports/prepzones/PrepZonesReport.jsx index 915e33e..56663e9 100644 --- a/manager_dashboard/src/pages/reports/prepzones/PrepZonesReport.jsx +++ b/manager_dashboard/src/pages/reports/prepzones/PrepZonesReport.jsx @@ -82,9 +82,9 @@ function ZoneCard({ zone: z, period }) { {z.notification_name && {z.notification_name}} {z.printers.map(p => )}} actions={ - - - + + + }>
diff --git a/manager_dashboard/src/pages/reports/products/ProductsReport.jsx b/manager_dashboard/src/pages/reports/products/ProductsReport.jsx index 5516260..19480a3 100644 --- a/manager_dashboard/src/pages/reports/products/ProductsReport.jsx +++ b/manager_dashboard/src/pages/reports/products/ProductsReport.jsx @@ -5,7 +5,7 @@ import { useState } from 'react' import { Printer } from 'lucide-react' import { useFormat, useTranslation } from '@xenia/i18n' -import { Button, Select } from '@xenia/ui' +import { Button, Dropdown } from '@xenia/ui' import client from '../../../api/client' import { useLiveQuery } from '../../../live/useLiveQuery' import { BarList } from '../kit/charts' @@ -67,9 +67,9 @@ function ProductsTab() {
- + } /> - onChange(e.target.value)} aria-label={t('reports.person')} className="w-56" + onChange(v)} aria-label={t('reports.person')} className="w-56" options={[{ value: '', label: t('reports.store.anyone') }, ...people.map(p => ({ value: String(p.id), label: p.name }))]} /> ) } @@ -85,7 +85,7 @@ function ShiftsTab() { return (
+ right={ } /> {isPending ? : error ? : ( setEditing(false)}>{t('reports.back')}
)} - - {['orders', 'shifts'].map(k => ( - - ))} - + ({ id: k, label: t(`reports.store.dayTabs.${k}`, { count: k === 'orders' ? orders.length : shifts.length }), testId: `day-tab-${k}` }))} /> {(tab === 'orders' ? loadingOrders : loadingShifts) ? : tab === 'orders' ? :
} diff --git a/manager_dashboard/src/pages/reports/store/OrdersTab.jsx b/manager_dashboard/src/pages/reports/store/OrdersTab.jsx index b2c18e7..bd0cb3a 100644 --- a/manager_dashboard/src/pages/reports/store/OrdersTab.jsx +++ b/manager_dashboard/src/pages/reports/store/OrdersTab.jsx @@ -2,7 +2,7 @@ // waiter and table; products, delivery fee and refunds per order; a tap opens it; export. import { useState } from 'react' import { useFormat, useTranslation } from '@xenia/i18n' -import { Select } from '@xenia/ui' +import { Dropdown, Toolbar } from '@xenia/ui' import client from '../../../api/client' import { useLiveQuery } from '../../../live/useLiveQuery' import { Pill } from '../../overview/parts' @@ -48,14 +48,14 @@ export default function OrdersTab() {
} /> -
- set('waiter_id', e.target.value)} aria-label={t('reports.person')} + set('waiter_id', v)} aria-label={t('reports.person')} options={[{ value: '', label: t('reports.store.anyone') }, ...waiters.map(w => ({ value: String(w.id), label: w.name }))]} /> -
diff --git a/manager_dashboard/src/pages/reports/store/TablesTab.jsx b/manager_dashboard/src/pages/reports/store/TablesTab.jsx index 9c1491d..a1e2c69 100644 --- a/manager_dashboard/src/pages/reports/store/TablesTab.jsx +++ b/manager_dashboard/src/pages/reports/store/TablesTab.jsx @@ -31,7 +31,7 @@ export default function TablesTab() { ] return (
- } onClick={() => setPrinting(true)}>{t('reports.print.button')}} /> + } onClick={() => setPrinting(true)}>{t('reports.print.button')}} /> {isPending ? : error ? : (<>
r.table_id ?? 'none'} initialSort={{ key: 'revenue', dir: 'desc' }} /> diff --git a/manager_dashboard/src/pages/reports/store/TrendsTab.jsx b/manager_dashboard/src/pages/reports/store/TrendsTab.jsx index a3c03d0..16ba252 100644 --- a/manager_dashboard/src/pages/reports/store/TrendsTab.jsx +++ b/manager_dashboard/src/pages/reports/store/TrendsTab.jsx @@ -2,7 +2,7 @@ // dates, with the 7-day average for days; delivery fees beside the revenue. import { useState } from 'react' import { useFormat, useTranslation } from '@xenia/i18n' -import { Button } from '@xenia/ui' +import { Button, Segmented } from '@xenia/ui' import client from '../../../api/client' import { useLiveQuery } from '../../../live/useLiveQuery' import { TrendChart } from '../kit/charts' @@ -35,7 +35,7 @@ export default function TrendsTab() { return (
{STEPS.map(s => )}} /> + right={ ({ value: s, label: t(`reports.trends.steps.${s}`) }))} />} /> {isPending ? : error ? : (<> {rows.length > 1 && ({ label: label(r.date), revenue: r.revenue, profit: r.profit }))} showProfit={anyProfit} />}
r.date} initialSort={{ key: 'date', dir: 'desc' }} /> diff --git a/manager_dashboard/src/pages/reports/technical/TechnicalReport.jsx b/manager_dashboard/src/pages/reports/technical/TechnicalReport.jsx index 5400cc6..ff69303 100644 --- a/manager_dashboard/src/pages/reports/technical/TechnicalReport.jsx +++ b/manager_dashboard/src/pages/reports/technical/TechnicalReport.jsx @@ -6,7 +6,7 @@ import { useState } from 'react' import { Printer } from 'lucide-react' import { useCan } from '@xenia/access' import { useFormat, useTranslation } from '@xenia/i18n' -import { Button, Select } from '@xenia/ui' +import { Button, Dropdown } from '@xenia/ui' import client from '../../../api/client' import { useLiveQuery } from '../../../live/useLiveQuery' import { Pill } from '../../overview/parts' @@ -58,11 +58,11 @@ function PrintingTab() { ] return (
- -