feat(manager,waiter): money and weights typed with a comma or a dot everywhere
Owner 2026-11-23 (plan 6F.2): new DecimalInput / MoneyInput in @xenia/ui (keeps what is typed,
reports a number, null when empty, NaN when not a number) on parseNumber. The waiter app's starting
cash, weighed quantity and typed prices were type=number + parseFloat (a Greek keypad's comma was
dropped: 12,50 became 12 or nothing); now text fields read with parseNumber, and a wrong starting
cash shows a message. The manager's price rules, deals and order-total condition use the new
fields; every Number(x.replace(',', '.')) now reads through parseNumber (1.234,50 too). Guard test
packages/i18n/tests/typed-numbers.test.mjs refuses parseFloat, .replace(',', '.') and decimal
type=number fields in the apps. e2e: shift close with 20,50, waiter starting cash 25,50.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@ import { useState } from 'react'
|
||||
import { ArrowDown, ArrowUp, Check, Pencil, Plus, Power, Trash2, X } from 'lucide-react'
|
||||
import { SALES_POINTS, normalizeSalesPoints } from '@xenia/access'
|
||||
import { latin, useFormat, useTranslation } from '@xenia/i18n'
|
||||
import { Button, Dropdown, IconButton, Input, Select, cx } from '@xenia/ui'
|
||||
import { Button, Dropdown, IconButton, Input, MoneyInput, Select, cx } from '@xenia/ui'
|
||||
import { COLOURS } from './useCatalog'
|
||||
import { OLD_PLACEHOLDERS, WEEKDAYS, blankCondition, conditionComplete, toggleIn } from './pricingLogic'
|
||||
|
||||
@@ -202,7 +202,13 @@ function ConditionFields({ cond, onChange, catalog }) {
|
||||
case 'specific_date': return <DateList value={p.dates ?? []} onChange={v => set('dates', v)} />
|
||||
case 'day_of_week': return <DayPicker value={p.days ?? []} onChange={v => set('days', v)} />
|
||||
case 'min_item_quantity': return <label className="flex items-center gap-2 text-label text-ink-2">{num('min', 1, 1)}{t('pricing.condition.ofTheDish')}</label>
|
||||
case 'min_order_value': return <label className="flex items-center gap-2 text-label text-ink-2">{num('min', 0, 0.5)}{t('pricing.condition.orderTotal')}</label>
|
||||
case 'min_order_value': return (
|
||||
<label className="flex items-center gap-2 text-label text-ink-2">
|
||||
<MoneyInput size="sm" className="w-32" value={p.min ?? null} aria-label={t('pricing.condition.fields.min_order_value')}
|
||||
onChange={v => set('min', Number.isFinite(v) ? v : null)} />
|
||||
{t('pricing.condition.orderTotal')}
|
||||
</label>
|
||||
)
|
||||
case 'min_category_qty': return (
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
{num('min', 1, 1)}
|
||||
|
||||
Reference in New Issue
Block a user