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:
+16
-2
@@ -54,6 +54,10 @@ try {
|
||||
await api('POST', '/api/business-day/open', { token: boss, body: {} }).catch(() => {})
|
||||
const waiters = await api('GET', '/api/auth/waiters')
|
||||
const maria = waiters.find(w => (w.full_name || '').includes('Κωνσταντίνου'))
|
||||
// no shift left from the demo data: the phone then shows the start-shift gate (6F.2 checks it)
|
||||
for (const sh of (await api('GET', '/api/shifts/?active_only=true', { token: boss })).shifts.filter(x => x.waiter_id === maria?.id)) {
|
||||
await api('POST', `/api/shifts/manager/end/${sh.id}`, { token: boss, body: {} }).catch(() => {})
|
||||
}
|
||||
|
||||
// ── login-by-id is gone ────────────────────────────────────────────────────
|
||||
const old = await api('POST', '/api/auth/login-by-id', { body: { waiter_id: maria?.id, pin: '3302' }, raw: true })
|
||||
@@ -77,9 +81,19 @@ try {
|
||||
const sessions = await api('GET', '/api/auth/sessions', { token: boss })
|
||||
r.check('the session is a "waiter" session', sessions.some(s => s.username === 'demo_maria' && s.client === 'waiter'), JSON.stringify(sessions.map(s => [s.username, s.client])))
|
||||
|
||||
// start the shift on the phone (the gate after sign-in)
|
||||
// start the shift on the phone (the gate after sign-in), the starting cash typed with a comma (6F.2)
|
||||
const cashBox = a.getByPlaceholder('0,00')
|
||||
await cashBox.fill('abc', { timeout: 10_000 }).catch(() => {})
|
||||
await a.getByRole('button', { name: /Start shift/ }).click({ timeout: 10_000 }).catch(() => {})
|
||||
await a.waitForURL(u => u.pathname.startsWith('/tables'), { timeout: 10_000 }).catch(() => {})
|
||||
await sleep(500)
|
||||
r.check('starting cash that is not a number: a message, the gate stays, no shift', await cashBox.isVisible()
|
||||
&& (await a.getByText('Type an amount').count()) > 0
|
||||
&& !(await api('GET', '/api/shifts/?active_only=true', { token: boss })).shifts.some(x => x.waiter_id === maria?.id))
|
||||
await cashBox.fill('25,50').catch(() => {})
|
||||
await a.getByRole('button', { name: /Start shift/ }).click({ timeout: 10_000 }).catch(() => {})
|
||||
await cashBox.waitFor({ state: 'detached', timeout: 10_000 }).catch(() => {})
|
||||
const started = (await api('GET', '/api/shifts/?active_only=true', { token: boss })).shifts.find(x => x.waiter_id === maria?.id)
|
||||
r.check('starting cash "25,50" is kept as €25.50', started?.starting_cash === 25.5, JSON.stringify(started?.starting_cash))
|
||||
await sleep(1500)
|
||||
|
||||
// ── One session per waiter (refuse_new) ────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user