Several payers: clearer on phones, plus tests

The editor already supported several payers ("Several people" in Paid by);
this polishes it after checking it at 390x844 and 360x780 (Czech):

- Expense list: "Paid by 3 people" was truncated on phones; now "3 payers"
  (proper Czech plurals: plátce / plátci / plátců).
- Empty payer boxes show the unassigned remainder as a placeholder.
- A green "Adds up to the total" line confirms when the payers match.
- Tests: core balance + settle-up for a car bought by three people, a
  foreign-currency multi-payer case, and an e2e flow (remaining, over,
  validation error, save, balances).
- SPEC: describe the actual several-payers UI (no "add payer" button).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HA82gX9UJk6BEyaJJwiWPc
This commit is contained in:
agent 2026-11-18 19:23:19 +00:00
parent 61f4e42846
commit 9981cf9a9a
7 changed files with 80 additions and 6 deletions

View file

@ -349,14 +349,18 @@
<div class="item member">
<Avatar member={m} index={memberIndex(m.id)} size={28} />
<span class="grow name">{m.name}</span>
<input class="num value" inputmode="decimal" bind:value={payerAmounts[m.id]} aria-label="{t('paid_by_label')}: {m.name}" />
<!-- empty boxes hint at what's still unassigned -->
<input class="num value" inputmode="decimal" bind:value={payerAmounts[m.id]} aria-label="{t('paid_by_label')}: {m.name}"
placeholder={payersRemaining > 0 ? amountInput(payersRemaining, currency) : ''} />
</div>
{/each}
</div>
{#if payersRemaining !== 0 && amount}
{#if amount && payersRemaining !== 0}
<span class="small {payersRemaining < 0 ? 'neg' : 'muted'}">
{payersRemaining > 0 ? t('remaining', { amount: money(payersRemaining, currency) }) : t('over_by', { amount: money(-payersRemaining, currency) })}
</span>
{:else if amount && payers.length > 1}
<span class="small pos row adds-up"><Icon name="check" size={14} />{t('adds_up')}</span>
{/if}
</div>
{/if}
@ -507,6 +511,8 @@
.value-wrap { gap: 4px; flex-shrink: 0; }
.value { width: 104px; min-height: 36px; padding: 4px 10px; text-align: right; }
.value.narrow { width: 64px; }
.value::placeholder { color: var(--muted); opacity: 0.6; }
.adds-up { gap: 4px; }
.extras { display: flex; flex-wrap: wrap; gap: 8px; }
.extras .btn { flex: 1 1 auto; gap: 6px; padding: 0 12px; }

View file

@ -22,6 +22,7 @@
upload: 'M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12',
down: 'M6 9l6 6 6-6',
up: 'M6 15l6-6 6 6',
check: 'M20 6L9 17l-5-5',
archive: 'M3 4h18v5H3zM5 9v11h14V9M10 13h4',
} as const;

View file

@ -76,7 +76,7 @@ const cs: Messages = {
payment_short: 'Platba',
add_payment: 'Zaznamenat platbu',
paid_by: 'Platil(a) {name}',
paid_by_many: 'Platilo {n} lidí',
paid_by_many: { one: '{n} plátce', few: '{n} plátci', other: '{n} plátců' },
your_share: 'váš podíl {amount}',
you_lent: 'půjčili jste {amount}',
you_borrowed: 'dlužíte {amount}',
@ -129,6 +129,7 @@ const cs: Messages = {
split_percent: 'Procenta',
remaining: 'Zbývá: {amount}',
over_by: 'Přebývá: {amount}',
adds_up: 'Součet sedí',
select_all: 'Všichni',
select_none: 'Nikdo',
note: 'Poznámka',

View file

@ -82,7 +82,7 @@ const en = {
payment_short: 'Payment',
add_payment: 'Record a payment',
paid_by: 'Paid by {name}',
paid_by_many: 'Paid by {n} people',
paid_by_many: { one: '{n} payer', few: '{n} payers', other: '{n} payers' },
your_share: 'your share {amount}',
you_lent: 'you lent {amount}',
you_borrowed: 'you borrowed {amount}',
@ -137,6 +137,7 @@ const en = {
split_percent: 'Percent',
remaining: 'Remaining: {amount}',
over_by: 'Over by: {amount}',
adds_up: 'Adds up to the total',
select_all: 'All',
select_none: 'None',
note: 'Note',