feat(manager): products and categories on v2, a product in several categories, allergens (platform-v2 step 6.3)
- Management/ProductsTab + ProductFormModal (3.1k lines) → src/pages/products/: category tree, list/grid, toolbar + filters (search folds accents and Latin letters), bulk actions, category dialogs; the editor in editor/ (details, sold at, cost, fiscal; the waiter's choices). Arithmetic in productsLogic.js / editor/formLogic.js (tests/products.test.mjs). - Several categories per product with a main one (D-23): edited in the editor, "also in" on the rows, each category's list ordered on its own (drag or up/down → PUT /reorder with category_id); bulk "move to" / "also list in". The waiter's picker now shows a product in every category. - Allergens: products.allergens (Alembic 0032, core/allergens.py: 14 EU, contains | may_contain, catalog.allergen), in the API, POS menu, menu tablet, catalogue bundles and the cloud snapshot (C-2); @xenia/access allergens.js + <Allergens> shown on the phone, the counter, the tablet. - Bell: only the newest load sets the list (an older answer could hide a live notification). - e2e: manager (two categories, order per category, allergens), terminal / menu tablet / waiter (allergens shown); media saves by test id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -177,6 +177,19 @@ try {
|
||||
.catch(async e => { await a.screenshot({ path: path.join(OUT, 'waiter-add-items.png') }); throw e })
|
||||
const onScreen = await a.locator('[data-testid="product-card"]:has([data-testid="product-quick-add"])').evaluateAll(els => els.map(e => e.dataset.name))
|
||||
const [plain, other] = prods.filter(p => simple(p) && onScreen.includes(p.name))
|
||||
// 6.3: allergens set in the manager reach the phone (live) and show in the product's details (hold it)
|
||||
await api('PUT', `/api/products/${other.id}`, { token: boss, body: { allergens: { milk: 'contains', nuts: 'may_contain' } } })
|
||||
await sleep(1500)
|
||||
const held = a.locator(`[data-testid="product-card"][data-name="${other.name}"]`).first()
|
||||
await held.hover()
|
||||
await a.mouse.down()
|
||||
await sleep(1600)
|
||||
await a.mouse.up()
|
||||
const info = a.getByTestId('allergens')
|
||||
r.check('6.3: holding a product shows its allergens on the phone', await info.waitFor({ timeout: 5000 }).then(() => true).catch(() => false)
|
||||
&& await info.locator('[data-allergen="milk"][data-level="contains"]').count() === 1 && await info.locator('[data-allergen="nuts"][data-level="may_contain"]').count() === 1)
|
||||
await a.mouse.click(5, 5)
|
||||
await info.waitFor({ state: 'detached', timeout: 3000 }).catch(() => {})
|
||||
// a price the phone's menu doesn't know (a price modifier): only the server can say it
|
||||
const mod = await api('POST', '/api/pricing/modifiers', { token: boss, body: {
|
||||
name: 'e2e 4.4', scope: 'item', item_id: plain.id, action_type: 'set', action_value: 1.2 } })
|
||||
|
||||
Reference in New Issue
Block a user