diff --git a/client/src/components/Budget/CostsPanel.test.tsx b/client/src/components/Budget/CostsPanel.test.tsx index 7f77d72a1..b9dbe6f14 100644 --- a/client/src/components/Budget/CostsPanel.test.tsx +++ b/client/src/components/Budget/CostsPanel.test.tsx @@ -1997,6 +1997,34 @@ describe('CostsPanel — split modes and guests', () => { expect(posted!.members).toEqual([{ user_id: 1, amount: null }, { user_id: 2, amount: null }]) }) + it('FE-W5COSTS-1709: a custom split typed in percent saves the matching amounts', async () => { + const user = userEvent.setup() + let posted: Record | null = null + server.use(http.post('/api/trips/1/budget', async ({ request }) => { + posted = await request.json() as Record + return HttpResponse.json({ item: dinner() }) + })) + mount([]) + + await user.click(await screen.findByRole('button', { name: 'Add expense' })) + await user.type(screen.getByPlaceholderText('e.g. Dinner, souvenirs, gas…'), 'Bag storage') + await user.type(screen.getAllByPlaceholderText('0,00')[0], '30') + await user.click(screen.getByRole('button', { name: 'Custom' })) + await user.click(screen.getByRole('button', { name: '%' })) + + const [alice, bob] = screen.getAllByRole('textbox', { name: / %$/ }) + await user.type(alice, '60') + expect(screen.getByText('60 % of 100 % assigned')).toBeInTheDocument() + await user.type(bob, '40') + expect(screen.getByText('Split matches total')).toBeInTheDocument() + expect(screen.getByText('18,00 €')).toBeInTheDocument() + + const submits = screen.getAllByRole('button', { name: 'Add expense' }) + await user.click(submits[submits.length - 1]) + await waitFor(() => expect(posted).toBeTruthy()) + expect(posted!.members).toEqual([{ user_id: 1, amount: 18 }, { user_id: 2, amount: 12 }]) + }) + it('FE-W5COSTS-057: multi-payer on a payer-less expense seeds and collapses back to me', async () => { const user = userEvent.setup() let put: Record | null = null diff --git a/client/src/components/Budget/CostsPanel.tsx b/client/src/components/Budget/CostsPanel.tsx index 0c239e139..0ed687b8f 100644 --- a/client/src/components/Budget/CostsPanel.tsx +++ b/client/src/components/Budget/CostsPanel.tsx @@ -23,6 +23,7 @@ import { ReceiptScanModal } from './ReceiptScanModal' import { SYMBOLS, currenciesWith, SPLIT_COLORS } from './BudgetPanel.constants' import { amountPattern, calculateTicketShares, finalBudgetFor, finalBudgetSources, hasTicketSplit, NOTE_MAX, paidByUser, payersBalanced, readTicketItems, newExpenseSeed, readUserNote, rebalancePayers, settlementDate, splitEqualShares, writeTicketItems, type TicketItem } from './CostsPanel.helpers' import { COST_CATEGORY_LIST, catMeta } from './costsCategories' +import { usePercentSplit, type CustomSplitUnit } from './usePercentSplit' import { ReceiptPreviewModal } from './ReceiptPreviewModal' import type { BudgetParticipantFinal, BudgetUnconverted, ReceiptLine } from '@trek/shared' import type { BudgetItem, BudgetItemReceipt } from '../../types' @@ -1480,6 +1481,10 @@ export function ExpenseModal({ tripId, base, people, me, editing, prefill, onClo return splitEqualShares(totalNum, [...participants].map(id => ({ user_id: id })), editing?.id || 0) }, [totalNum, participants, editing]) + // The custom split typed as percentages instead of amounts (#1709). + const pct = usePercentSplit({ total: totalNum, participants, customAmounts, setCustomAmounts, currency }) + const inPercent = splitMode === 'custom' && pct.unit === 'percent' + const placeholderShares = useMemo(() => { const emptyParts = [...participants].filter(id => !customAmounts[id]) if (emptyParts.length === 0) return {} @@ -1801,7 +1806,20 @@ export function ExpenseModal({ tripId, base, people, me, editing, prefill, onClo /> )} > - {modeHint(t(`costs.splitHint.${splitMode}`))} + {splitMode === 'custom' ? ( +
+

{t(inPercent ? 'costs.splitHint.percent' : 'costs.splitHint.custom')}

+ + label={t('costs.splitUnit')} + value={pct.unit} + onChange={pct.setUnit} + options={[ + { value: 'amount', label: sym(currency) }, + { value: 'percent', label: '%' }, + ]} + /> +
+ ) : modeHint(t(`costs.splitHint.${splitMode}`))} {splitMode === 'ticket' ? (
@@ -1887,6 +1905,16 @@ export function ExpenseModal({ tripId, base, people, me, editing, prefill, onClo {!on ? excludedNote : splitMode === 'equally' ? ( {badge(money(equalShares[p.id] || 0))} + ) : inPercent ? ( +
+
+ pct.onPercentChange(p.id, e.target.value)} + className={AMOUNT_INPUT} style={fs(13.5, 'body')} /> + % +
+ {customAmounts[p.id] && {money(Number.parseFloat(customAmounts[p.id]) || 0)}} +
) : (
{sym(currency)} @@ -1907,6 +1935,8 @@ export function ExpenseModal({ tripId, base, people, me, editing, prefill, onClo ) : customBalanced ? ( badge(<>{t('costs.splitBalanced')}, 'success') + ) : inPercent ? ( + badge(<>{t('costs.splitPercentOff', { sum: String(Math.round(pct.percentSum * 100) / 100) })}, 'danger') ) : ( badge(<>{t(splitShortfall > 0 ? 'costs.splitSumUnder' : 'costs.splitSumOver', { sum: money(splitSum), diff --git a/client/src/components/Budget/usePercentSplit.test.ts b/client/src/components/Budget/usePercentSplit.test.ts new file mode 100644 index 000000000..301787e7e --- /dev/null +++ b/client/src/components/Budget/usePercentSplit.test.ts @@ -0,0 +1,66 @@ +// FE-BUDGET-PCT-001 to FE-BUDGET-PCT-006 +import { describe, it, expect } from 'vitest' +import { useState } from 'react' +import { act, renderHook } from '@testing-library/react' +import { amountsToPercents, percentsToAmounts, percentString, usePercentSplit } from './usePercentSplit' + +describe('percent split maths (#1709)', () => { + it('FE-BUDGET-PCT-001: thirds add up to the total exactly', () => { + const amounts = percentsToAmounts(100, { 1: '33.33', 2: '33.33', 3: '33.34' }, [1, 2, 3], 'EUR') + expect(amounts).toEqual({ 1: 33.33, 2: 33.33, 3: 33.34 }) + const even = percentsToAmounts(10, { 1: '33.33', 2: '33.33', 3: '33.34' }, [1, 2, 3], 'EUR') + expect(Object.values(even).reduce((s, v) => s + v, 0)).toBeCloseTo(10, 10) + }) + + it('FE-BUDGET-PCT-002: a refund splits negative and still balances', () => { + const amounts = percentsToAmounts(-10, { 1: '50', 2: '25', 3: '25' }, [1, 2, 3], 'EUR') + expect(amounts).toEqual({ 1: -5, 2: -2.5, 3: -2.5 }) + const odd = percentsToAmounts(-0.05, { 1: '50', 2: '50' }, [1, 2], 'EUR') + expect(Math.round((odd[1] + odd[2]) * 100)).toBe(-5) + }) + + it('FE-BUDGET-PCT-003: zero-decimal currencies stay whole, and percentages short of 100 just round', () => { + expect(percentsToAmounts(1000, { 1: '33.33', 2: '66.67' }, [1, 2], 'JPY')).toEqual({ 1: 333, 2: 667 }) + expect(percentsToAmounts(80, { 1: '25', 2: '' }, [1, 2], 'EUR')).toEqual({ 1: 20 }) + }) + + it('FE-BUDGET-PCT-004: amounts read back as percentages of the total', () => { + expect(amountsToPercents(80, { 1: '20', 2: '60', 3: '' }, [1, 2, 3])).toEqual({ 1: '25', 2: '75' }) + expect(amountsToPercents(0, { 1: '20' }, [1])).toEqual({}) + expect(percentString(33.3333)).toBe('33.33') + }) +}) + +describe('usePercentSplit (#1709)', () => { + function setup(total = 90) { + return renderHook(({ t }) => { + const [amounts, setAmounts] = useState>({ 1: '30', 2: '60' }) + const pct = usePercentSplit({ total: t, participants: new Set([1, 2, 3]), customAmounts: amounts, setCustomAmounts: setAmounts, currency: 'EUR' }) + return { amounts, pct } + }, { initialProps: { t: total } }) + } + + it('FE-BUDGET-PCT-005: switching to % carries the typed amounts over, and typing writes amounts back', () => { + const { result } = setup() + act(() => result.current.pct.setUnit('percent')) + expect(result.current.pct.percents).toEqual({ 1: '33.33', 2: '66.67' }) + act(() => result.current.pct.onPercentChange(1, '50')) + act(() => result.current.pct.onPercentChange(2, '25')) + act(() => result.current.pct.onPercentChange(3, '25')) + expect(result.current.amounts).toEqual({ 1: '45.00', 2: '22.50', 3: '22.50' }) + expect(result.current.pct.percentSum).toBe(100) + // Not a percentage: ignored. + act(() => result.current.pct.onPercentChange(3, 'abc')) + expect(result.current.pct.percents[3]).toBe('25') + }) + + it('FE-BUDGET-PCT-006: a changed total moves the amounts, the placeholder offers the rest', () => { + const { result, rerender } = setup() + act(() => result.current.pct.setUnit('percent')) + act(() => result.current.pct.onPercentChange(1, '50')) + act(() => result.current.pct.onPercentChange(2, '')) + expect(result.current.pct.placeholderPercent).toBe('25') + rerender({ t: 200 }) + expect(result.current.amounts).toEqual({ 1: '100.00' }) + }) +}) diff --git a/client/src/components/Budget/usePercentSplit.ts b/client/src/components/Budget/usePercentSplit.ts new file mode 100644 index 000000000..b92f389ca --- /dev/null +++ b/client/src/components/Budget/usePercentSplit.ts @@ -0,0 +1,110 @@ +import { useEffect, useState } from 'react' +import { amountToInputString, currencyDecimals } from '../../utils/formatters' + +export type CustomSplitUnit = 'amount' | 'percent' + +const PERCENT_INPUT = /^\d{0,3}(\.\d{0,2})?$/ + +/** A percent as typed back into the field: at most two decimals, no trailing zeros. */ +export function percentString(value: number): string { + return String(Math.round(value * 100) / 100) +} + +/** + * Amounts from percentages of `total` (#1709), in whole minor units. When the + * percentages add up to 100 the shares add up to the total exactly: the units a + * plain rounding would lose go to the largest remainders, the same way + * splitEqualShares hands out an indivisible cent. Ids without a percentage get + * no amount. + */ +export function percentsToAmounts(total: number, percents: Record, ids: number[], currency: string): Record { + const factor = 10 ** currencyDecimals(currency) + const totalUnits = Math.round(total * factor) + const entered = ids + .map(id => ({ id, pct: Number.parseFloat(percents[id]) })) + .filter(e => Number.isFinite(e.pct)) + const raw = entered.map(e => ({ id: e.id, exact: (totalUnits * e.pct) / 100 })) + const out: Record = {} + const pctSum = entered.reduce((s, e) => s + e.pct, 0) + if (Math.abs(pctSum - 100) < 1e-9) { + const floors = raw.map(r => ({ id: r.id, units: Math.floor(r.exact), rest: r.exact - Math.floor(r.exact) })) + let left = totalUnits - floors.reduce((s, f) => s + f.units, 0) + // On a refund the total is negative, so the remainder runs the other way. + const order = [...floors].sort((a, b) => (left >= 0 ? b.rest - a.rest : a.rest - b.rest) || a.id - b.id) + for (const f of order) { + if (left === 0) break + f.units += Math.sign(left) + left -= Math.sign(left) + } + for (const f of floors) out[f.id] = f.units / factor + } else { + for (const r of raw) out[r.id] = Math.round(r.exact) / factor + } + return out +} + +/** The percentages the typed amounts make of `total`; an empty or unparsable amount stays empty. */ +export function amountsToPercents(total: number, amounts: Record, ids: number[]): Record { + const out: Record = {} + if (total === 0) return out + for (const id of ids) { + const amount = Number.parseFloat(amounts[id]) + if (Number.isFinite(amount)) out[id] = percentString((amount / total) * 100) + } + return out +} + +interface Args { + total: number + participants: Set + customAmounts: Record + /** Must be stable across renders (a state setter), it is an effect dependency. */ + setCustomAmounts: (next: Record) => void + currency: string + initialUnit?: CustomSplitUnit +} + +/** + * The "%" side of a custom split (#1709). Percentages are only an input aid: + * every change is turned straight into the amounts the custom split already + * keeps, so what is saved, validated and settled is unchanged. + */ +export function usePercentSplit({ total, participants, customAmounts, setCustomAmounts, currency, initialUnit = 'amount' }: Args) { + const [unit, setUnitState] = useState(initialUnit) + const [percents, setPercents] = useState>({}) + const ids = [...participants] + + const setUnit = (next: CustomSplitUnit) => { + if (next === unit) return + if (next === 'percent') setPercents(amountsToPercents(total, customAmounts, ids)) + setUnitState(next) + } + + const onPercentChange = (id: number, raw: string) => { + const val = raw.replace(',', '.') + if (val !== '' && !PERCENT_INPUT.test(val)) return + setPercents(prev => { + const next = { ...prev, [id]: val } + if (val === '') delete next[id] + return next + }) + } + + // The amounts follow the percentages: on every percentage typed, and when the + // total changes or somebody leaves the split. + const idsKey = ids.join(',') + useEffect(() => { + if (unit !== 'percent') return + const idList = idsKey ? idsKey.split(',').map(Number) : [] + const amounts = percentsToAmounts(total, percents, idList, currency) + const strings: Record = {} + for (const [id, amount] of Object.entries(amounts)) strings[Number(id)] = amountToInputString(amount, currency) + setCustomAmounts(strings) + }, [unit, percents, total, idsKey, currency, setCustomAmounts]) + + const percentSum = ids.reduce((s, id) => s + (Number.parseFloat(percents[id]) || 0), 0) + const empty = ids.filter(id => !percents[id]) + const placeholderPercent = empty.length > 0 ? percentString(Math.max(0, 100 - percentSum) / empty.length) : '0' + + return { unit, setUnit, percents, onPercentChange, percentSum, placeholderPercent } +} diff --git a/shared/src/i18n/ar/budget.ts b/shared/src/i18n/ar/budget.ts index fc8cf9c05..8d89797fe 100644 --- a/shared/src/i18n/ar/budget.ts +++ b/shared/src/i18n/ar/budget.ts @@ -158,6 +158,9 @@ const budget: TranslationStrings = { 'costs.payersHint': 'حدّد من دفع واكتب المبلغ الذي دفعه كل منهم.', 'costs.splitHint.equally': 'يدفع كل من حُدّد الحصة نفسها.', 'costs.splitHint.custom': 'اكتب حصة كل شخص؛ ويجب أن يساوي مجموع الحصص المبلغ الإجمالي.', + 'costs.splitHint.percent': 'أدخل حصة كل شخص بالنسبة المئوية؛ يجب أن يكون مجموعها 100 %.', + 'costs.splitUnit': 'إدخال الحصص كـ', + 'costs.splitPercentOff': 'تم توزيع {sum} % من 100 %', 'costs.splitHint.ticket': 'اكتب ما ورد في الإيصال وحدّد من أخذ كل عنصر.', 'costs.filter.allCategories': 'كل الفئات', 'costs.filter.allDays': 'كل الأيام', diff --git a/shared/src/i18n/az/budget.ts b/shared/src/i18n/az/budget.ts index c681a2b23..19a7ab0f6 100644 --- a/shared/src/i18n/az/budget.ts +++ b/shared/src/i18n/az/budget.ts @@ -149,6 +149,9 @@ const budget: TranslationStrings = { 'costs.payersHint': 'Kimin ödədiyini işarələyin və hər birinin nə qədər ödədiyini yazın.', 'costs.splitHint.equally': 'İşarələnən hər kəs bərabər pay ödəyir.', 'costs.splitHint.custom': 'Hər şəxsin payını yazın; paylar birlikdə ümumi məbləği təşkil etməlidir.', + 'costs.splitHint.percent': 'Hər kəsin payını faizlə yazın; cəmi 100 % olmalıdır.', + 'costs.splitUnit': 'Payları belə daxil et', + 'costs.splitPercentOff': '100 %-dən {sum} % bölüşdürülüb', 'costs.splitHint.ticket': 'Qəbzdə olanları sadalayın və hər elementi kimin götürdüyünü işarələyin.', 'costs.pickSomeone': 'Bölüşdürmək üçün ən azı bir nəfər seçin.', 'costs.splitSummary': '{count} nəfər arasında bölünüb · hərəsinə {amount}', diff --git a/shared/src/i18n/br/budget.ts b/shared/src/i18n/br/budget.ts index e49e08525..5106d336d 100644 --- a/shared/src/i18n/br/budget.ts +++ b/shared/src/i18n/br/budget.ts @@ -158,6 +158,9 @@ const budget: TranslationStrings = { 'costs.payersHint': 'Marque quem pagou e digite quanto cada um pagou.', 'costs.splitHint.equally': 'Todos os marcados pagam a mesma parte.', 'costs.splitHint.custom': 'Digite a parte de cada pessoa; juntas, elas precisam dar o total.', + 'costs.splitHint.percent': 'Digite a parte de cada pessoa em porcentagem; juntas devem somar 100 %.', + 'costs.splitUnit': 'Inserir partes como', + 'costs.splitPercentOff': '{sum} % de 100 % distribuídos', 'costs.splitHint.ticket': 'Liste o que estava no comprovante e marque quem consumiu cada item.', 'costs.filter.allCategories': 'Todas as categorias', 'costs.filter.allDays': 'Todos os dias', diff --git a/shared/src/i18n/ca/budget.ts b/shared/src/i18n/ca/budget.ts index f95b85dc4..7672df105 100644 --- a/shared/src/i18n/ca/budget.ts +++ b/shared/src/i18n/ca/budget.ts @@ -126,6 +126,9 @@ const budget: TranslationStrings = { 'costs.payersHint': 'Marca qui ha pagat i escriu quant hi ha posat cadascú.', 'costs.splitHint.equally': 'Totes les persones marcades paguen la mateixa part.', 'costs.splitHint.custom': 'Escriu la part de cada persona; entre totes han de sumar el total.', + 'costs.splitHint.percent': 'Escriu la part de cada persona en percentatge; juntes han de sumar el 100 %.', + 'costs.splitUnit': 'Introdueix les parts com a', + 'costs.splitPercentOff': '{sum} % de 100 % repartit', 'costs.splitHint.ticket': 'Llista el que hi havia al rebut i marca qui ha pres cada article.', 'costs.pickSomeone': 'Tria almenys una persona amb qui dividir-ho.', 'costs.splitSummary': 'Dividit de {count} maneres · {amount} cadascú', diff --git a/shared/src/i18n/cs/budget.ts b/shared/src/i18n/cs/budget.ts index ab7cdd868..a7fea98d3 100644 --- a/shared/src/i18n/cs/budget.ts +++ b/shared/src/i18n/cs/budget.ts @@ -158,6 +158,9 @@ const budget: TranslationStrings = { 'costs.payersHint': 'Zaškrtněte, kdo platil, a zadejte, kolik kdo zaplatil.', 'costs.splitHint.equally': 'Všichni zaškrtnutí platí stejný podíl.', 'costs.splitHint.custom': 'Zadejte podíl každé osoby; dohromady musí dát celkovou částku.', + 'costs.splitHint.percent': 'Zadejte podíl každé osoby v procentech; dohromady musí dát 100 %.', + 'costs.splitUnit': 'Zadávat podíly jako', + 'costs.splitPercentOff': 'Rozděleno {sum} % ze 100 %', 'costs.splitHint.ticket': 'Vypište, co bylo na účtence, a zaškrtněte, kdo měl kterou položku.', 'costs.filter.allCategories': 'Všechny kategorie', 'costs.filter.allDays': 'Všechny dny', diff --git a/shared/src/i18n/de/budget.ts b/shared/src/i18n/de/budget.ts index 859b14358..d46370d63 100644 --- a/shared/src/i18n/de/budget.ts +++ b/shared/src/i18n/de/budget.ts @@ -161,6 +161,9 @@ const budget: TranslationStrings = { 'costs.payersHint': 'Hak an, wer bezahlt hat, und trag ein, wie viel jede Person gezahlt hat.', 'costs.splitHint.equally': 'Alle Angehakten zahlen den gleichen Anteil.', 'costs.splitHint.custom': 'Trag für jede Person ihren Anteil ein; zusammen ergeben sie den Betrag.', + 'costs.splitHint.percent': 'Gib den Anteil jeder Person in Prozent ein; zusammen müssen es 100 % sein.', + 'costs.splitUnit': 'Anteile eingeben als', + 'costs.splitPercentOff': '{sum} % von 100 % verteilt', 'costs.splitHint.ticket': 'Liste auf, was auf dem Beleg steht, und hak ab, wer was hatte.', 'costs.ticketItemName': 'Artikelname', 'costs.ticketSplitting': 'Aufteilen auf:', diff --git a/shared/src/i18n/en/budget.ts b/shared/src/i18n/en/budget.ts index 001fd9a98..9dcce1bd9 100644 --- a/shared/src/i18n/en/budget.ts +++ b/shared/src/i18n/en/budget.ts @@ -134,6 +134,9 @@ const budget: TranslationStrings = { 'costs.payersHint': 'Tick who paid and type how much each of them put in.', 'costs.splitHint.equally': 'Everyone ticked pays the same share.', 'costs.splitHint.custom': "Type each person's share; together they have to make the total.", + 'costs.splitHint.percent': "Type each person's share in percent; together they have to make 100 %.", + 'costs.splitUnit': 'Enter shares as', + 'costs.splitPercentOff': '{sum} % of 100 % assigned', 'costs.splitHint.ticket': 'List what was on the receipt and tick who had each item.', 'costs.pickSomeone': 'Pick at least one person to split with.', 'costs.splitSummary': 'Split {count} ways · {amount} each', diff --git a/shared/src/i18n/es/budget.ts b/shared/src/i18n/es/budget.ts index 5ff2440db..d152bf7f9 100644 --- a/shared/src/i18n/es/budget.ts +++ b/shared/src/i18n/es/budget.ts @@ -158,6 +158,9 @@ const budget: TranslationStrings = { 'costs.payersHint': 'Marca quién pagó y escribe cuánto puso cada uno.', 'costs.splitHint.equally': 'Todos los marcados pagan la misma parte.', 'costs.splitHint.custom': 'Escribe la parte de cada persona; entre todas tienen que sumar el total.', + 'costs.splitHint.percent': 'Escribe la parte de cada persona en porcentaje; juntas deben sumar el 100 %.', + 'costs.splitUnit': 'Introducir partes como', + 'costs.splitPercentOff': '{sum} % de 100 % asignado', 'costs.splitHint.ticket': 'Enumera lo que había en el recibo y marca quién tomó cada artículo.', 'costs.filter.allCategories': 'Todas las categorías', 'costs.filter.allDays': 'Todos los días', diff --git a/shared/src/i18n/et/budget.ts b/shared/src/i18n/et/budget.ts index 3fb20e8d9..f8fa464cf 100644 --- a/shared/src/i18n/et/budget.ts +++ b/shared/src/i18n/et/budget.ts @@ -134,6 +134,9 @@ const budget: TranslationStrings = { 'costs.payersHint': 'Märgi, kes maksis, ja sisesta, kui palju igaüks neist maksis.', 'costs.splitHint.equally': 'Kõik märgitud maksavad võrdse osa.', 'costs.splitHint.custom': 'Sisesta iga inimese osa; kokku peavad need andma kogusumma.', + 'costs.splitHint.percent': 'Sisesta iga inimese osa protsentides; kokku peab tulema 100 %.', + 'costs.splitUnit': 'Sisesta osad kui', + 'costs.splitPercentOff': 'Jaotatud {sum} % 100 %-st', 'costs.splitHint.ticket': 'Loetle, mis tšekil oli, ja märgi iga kirje juurde, kellele see kuulus.', 'costs.pickSomeone': 'Vali jagamiseks vähemalt üks inimene.', 'costs.splitSummary': 'Jaotatud {count} osaks · igaühele {amount}', diff --git a/shared/src/i18n/fr/budget.ts b/shared/src/i18n/fr/budget.ts index b7abca6e0..b5fab367e 100644 --- a/shared/src/i18n/fr/budget.ts +++ b/shared/src/i18n/fr/budget.ts @@ -159,6 +159,9 @@ const budget: TranslationStrings = { 'costs.payersHint': 'Cochez qui a payé et saisissez combien chacun a versé.', 'costs.splitHint.equally': 'Chaque personne cochée paie la même part.', 'costs.splitHint.custom': 'Saisissez la part de chaque personne ; ensemble, elles doivent faire le total.', + 'costs.splitHint.percent': 'Saisissez la part de chacun en pourcentage ; ensemble elles doivent faire 100 %.', + 'costs.splitUnit': 'Saisir les parts en', + 'costs.splitPercentOff': '{sum} % sur 100 % répartis', 'costs.splitHint.ticket': 'Listez ce qui figurait sur le reçu et cochez qui a pris chaque article.', 'costs.filter.allCategories': 'Toutes les catégories', 'costs.filter.allDays': 'Tous les jours', diff --git a/shared/src/i18n/gr/budget.ts b/shared/src/i18n/gr/budget.ts index fef4b18f4..7863abe93 100644 --- a/shared/src/i18n/gr/budget.ts +++ b/shared/src/i18n/gr/budget.ts @@ -159,6 +159,9 @@ const budget: TranslationStrings = { 'costs.payersHint': 'Επιλέξτε ποιος πλήρωσε και γράψτε πόσα έβαλε ο καθένας.', 'costs.splitHint.equally': 'Όλοι οι επιλεγμένοι πληρώνουν το ίδιο μερίδιο.', 'costs.splitHint.custom': 'Γράψτε το μερίδιο κάθε ατόμου· μαζί πρέπει να φτάνουν το σύνολο.', + 'costs.splitHint.percent': 'Πληκτρολογήστε το μερίδιο κάθε ατόμου σε ποσοστό· μαζί πρέπει να κάνουν 100 %.', + 'costs.splitUnit': 'Εισαγωγή μεριδίων ως', + 'costs.splitPercentOff': 'Κατανεμήθηκε {sum} % από 100 %', 'costs.splitHint.ticket': 'Καταγράψτε τι είχε η απόδειξη και σημειώστε ποιος πήρε κάθε είδος.', 'costs.filter.allCategories': 'Όλες οι κατηγορίες', 'costs.filter.allDays': 'Όλες οι ημέρες', diff --git a/shared/src/i18n/hu/budget.ts b/shared/src/i18n/hu/budget.ts index 2584386b1..5b1c83963 100644 --- a/shared/src/i18n/hu/budget.ts +++ b/shared/src/i18n/hu/budget.ts @@ -158,6 +158,9 @@ const budget: TranslationStrings = { 'costs.payersHint': 'Jelöld be, ki fizetett, és írd be, mennyit adott bele mindegyikük.', 'costs.splitHint.equally': 'Minden bejelölt ugyanakkora részt fizet.', 'costs.splitHint.custom': 'Írd be mindenki részét; együtt ki kell adniuk a teljes összeget.', + 'costs.splitHint.percent': 'Add meg mindenki részét százalékban; együtt 100 %-ot kell kiadniuk.', + 'costs.splitUnit': 'Részek megadása mint', + 'costs.splitPercentOff': '100 %-ból {sum} % kiosztva', 'costs.splitHint.ticket': 'Sorold fel, mi szerepelt a nyugtán, és minden tételnél jelöld be, kié volt.', 'costs.filter.allCategories': 'Összes kategória', 'costs.filter.allDays': 'Összes nap', diff --git a/shared/src/i18n/id/budget.ts b/shared/src/i18n/id/budget.ts index e465e0d52..5726113a9 100644 --- a/shared/src/i18n/id/budget.ts +++ b/shared/src/i18n/id/budget.ts @@ -158,6 +158,9 @@ const budget: TranslationStrings = { 'costs.payersHint': 'Centang siapa yang membayar dan ketik berapa yang dibayar masing-masing.', 'costs.splitHint.equally': 'Semua yang dicentang membayar bagian yang sama.', 'costs.splitHint.custom': 'Ketik bagian tiap orang; jika dijumlahkan, semuanya harus sama dengan total.', + 'costs.splitHint.percent': 'Ketik bagian tiap orang dalam persen; jumlahnya harus 100 %.', + 'costs.splitUnit': 'Masukkan bagian sebagai', + 'costs.splitPercentOff': '{sum} % dari 100 % terbagi', 'costs.splitHint.ticket': 'Tuliskan isi kuitansi dan centang siapa yang mengambil tiap item.', 'costs.filter.allCategories': 'Semua kategori', 'costs.filter.allDays': 'Semua hari', diff --git a/shared/src/i18n/it/budget.ts b/shared/src/i18n/it/budget.ts index 2fbb9c5d8..b7943233b 100644 --- a/shared/src/i18n/it/budget.ts +++ b/shared/src/i18n/it/budget.ts @@ -158,6 +158,9 @@ const budget: TranslationStrings = { 'costs.payersHint': 'Spunta chi ha pagato e inserisci quanto ha versato ciascuno.', 'costs.splitHint.equally': 'Tutti quelli spuntati pagano la stessa quota.', 'costs.splitHint.custom': 'Inserisci la quota di ogni persona; insieme devono fare il totale.', + 'costs.splitHint.percent': 'Inserisci la quota di ciascuno in percentuale; insieme devono fare 100 %.', + 'costs.splitUnit': 'Inserisci le quote come', + 'costs.splitPercentOff': '{sum} % di 100 % assegnato', 'costs.splitHint.ticket': "Elenca cosa c'era sulla ricevuta e spunta chi ha preso ciascun articolo.", 'costs.filter.allCategories': 'Tutte le categorie', 'costs.filter.allDays': 'Tutti i giorni', diff --git a/shared/src/i18n/ja/budget.ts b/shared/src/i18n/ja/budget.ts index cd0f4b1c6..b0f2afe50 100644 --- a/shared/src/i18n/ja/budget.ts +++ b/shared/src/i18n/ja/budget.ts @@ -158,6 +158,9 @@ const budget: TranslationStrings = { 'costs.payersHint': '支払った人にチェックを入れ、それぞれが出した金額を入力します。', 'costs.splitHint.equally': 'チェックを入れた全員が同じ額を負担します。', 'costs.splitHint.custom': '各人の負担額を入力します。すべて足して合計金額になる必要があります。', + 'costs.splitHint.percent': '各人の負担をパーセントで入力してください。合計で 100 % になる必要があります。', + 'costs.splitUnit': '負担の入力方法', + 'costs.splitPercentOff': '100 % のうち {sum} % を割り当て済み', 'costs.splitHint.ticket': 'レシートの品目を書き出し、それぞれ誰の分かにチェックを入れます。', 'costs.filter.allCategories': 'すべてのカテゴリー', 'costs.filter.allDays': 'すべての日', diff --git a/shared/src/i18n/ko/budget.ts b/shared/src/i18n/ko/budget.ts index 4b0330fea..d381b233a 100644 --- a/shared/src/i18n/ko/budget.ts +++ b/shared/src/i18n/ko/budget.ts @@ -158,6 +158,9 @@ const budget: TranslationStrings = { 'costs.payersHint': '결제한 사람을 체크하고 각자 낸 금액을 입력하세요.', 'costs.splitHint.equally': '체크한 모든 사람이 같은 몫을 냅니다.', 'costs.splitHint.custom': '각자의 몫을 입력하세요. 모두 합쳐 총액이 되어야 합니다.', + 'costs.splitHint.percent': '각자의 몫을 퍼센트로 입력하세요. 합계가 100 %가 되어야 합니다.', + 'costs.splitUnit': '몫 입력 방식', + 'costs.splitPercentOff': '100 % 중 {sum} % 배분됨', 'costs.splitHint.ticket': '영수증에 있던 항목을 적고, 항목마다 누구 몫인지 체크하세요.', 'costs.filter.allCategories': '모든 카테고리', 'costs.filter.allDays': '모든 날짜', diff --git a/shared/src/i18n/nl/budget.ts b/shared/src/i18n/nl/budget.ts index 74a699694..ce4bb9cbb 100644 --- a/shared/src/i18n/nl/budget.ts +++ b/shared/src/i18n/nl/budget.ts @@ -158,6 +158,9 @@ const budget: TranslationStrings = { 'costs.payersHint': 'Vink aan wie heeft betaald en typ hoeveel ieder heeft bijgedragen.', 'costs.splitHint.equally': 'Iedereen die is aangevinkt betaalt hetzelfde deel.', 'costs.splitHint.custom': 'Typ het deel van elke persoon; samen moeten ze op het totaal uitkomen.', + 'costs.splitHint.percent': 'Vul ieders aandeel in procenten in; samen moet het 100 % zijn.', + 'costs.splitUnit': 'Aandelen invoeren als', + 'costs.splitPercentOff': '{sum} % van 100 % verdeeld', 'costs.splitHint.ticket': 'Zet op een rij wat er op de bon stond en vink aan wie welk item had.', 'costs.filter.allCategories': 'Alle categorieën', 'costs.filter.allDays': 'Alle dagen', diff --git a/shared/src/i18n/pl/budget.ts b/shared/src/i18n/pl/budget.ts index 66693a969..fade7982a 100644 --- a/shared/src/i18n/pl/budget.ts +++ b/shared/src/i18n/pl/budget.ts @@ -158,6 +158,9 @@ const budget: TranslationStrings = { 'costs.payersHint': 'Zaznacz, kto zapłacił, i wpisz, ile każda z tych osób wyłożyła.', 'costs.splitHint.equally': 'Wszyscy zaznaczeni płacą taką samą część.', 'costs.splitHint.custom': 'Wpisz udział każdej osoby; razem muszą dać całą kwotę.', + 'costs.splitHint.percent': 'Wpisz udział każdej osoby w procentach; razem musi to dać 100 %.', + 'costs.splitUnit': 'Wpisuj udziały jako', + 'costs.splitPercentOff': 'Przydzielono {sum} % ze 100 %', 'costs.splitHint.ticket': 'Wypisz, co było na paragonie, i zaznacz, kto miał którą pozycję.', 'costs.filter.allCategories': 'Wszystkie kategorie', 'costs.filter.allDays': 'Wszystkie dni', diff --git a/shared/src/i18n/ru/budget.ts b/shared/src/i18n/ru/budget.ts index 606024ed8..957e3414e 100644 --- a/shared/src/i18n/ru/budget.ts +++ b/shared/src/i18n/ru/budget.ts @@ -158,6 +158,9 @@ const budget: TranslationStrings = { 'costs.payersHint': 'Отметьте, кто платил, и впишите, сколько внёс каждый.', 'costs.splitHint.equally': 'Все отмеченные платят одинаковую долю.', 'costs.splitHint.custom': 'Впишите долю каждого; вместе они должны составить всю сумму.', + 'costs.splitHint.percent': 'Введите долю каждого в процентах; вместе должно получиться 100 %.', + 'costs.splitUnit': 'Вводить доли как', + 'costs.splitPercentOff': 'Распределено {sum} % из 100 %', 'costs.splitHint.ticket': 'Перечислите, что было в чеке, и отметьте, кто что брал.', 'costs.filter.allCategories': 'Все категории', 'costs.filter.allDays': 'Все дни', diff --git a/shared/src/i18n/sk/budget.ts b/shared/src/i18n/sk/budget.ts index 099ba0826..7cc028a78 100644 --- a/shared/src/i18n/sk/budget.ts +++ b/shared/src/i18n/sk/budget.ts @@ -134,6 +134,9 @@ const budget: TranslationStrings = { 'costs.payersHint': 'Označte, kto platil, a zadajte, koľko ktorý z nich zaplatil.', 'costs.splitHint.equally': 'Každý označený platí rovnaký podiel.', 'costs.splitHint.custom': 'Zadajte podiel každej osoby; spolu musia dať celú sumu.', + 'costs.splitHint.percent': 'Zadajte podiel každej osoby v percentách; spolu musia dať 100 %.', + 'costs.splitUnit': 'Zadávať podiely ako', + 'costs.splitPercentOff': 'Rozdelené {sum} % zo 100 %', 'costs.splitHint.ticket': 'Vypíšte, čo bolo na účtenke, a označte, kto mal ktorú položku.', 'costs.pickSomeone': 'Vyberte aspoň jednu osobu na rozdelenie.', 'costs.splitSummary': 'Rozdelené na {count} dielov · {amount} každý', diff --git a/shared/src/i18n/sv/budget.ts b/shared/src/i18n/sv/budget.ts index 86cd5dfd8..40e4ef13a 100644 --- a/shared/src/i18n/sv/budget.ts +++ b/shared/src/i18n/sv/budget.ts @@ -158,6 +158,9 @@ const budget: TranslationStrings = { 'costs.payersHint': 'Bocka för vem som betalade och skriv in hur mycket var och en lade ut.', 'costs.splitHint.equally': 'Alla som är ibockade betalar lika stor andel.', 'costs.splitHint.custom': 'Skriv in varje persons andel; tillsammans måste de bli hela summan.', + 'costs.splitHint.percent': 'Skriv varje persons andel i procent; tillsammans ska det bli 100 %.', + 'costs.splitUnit': 'Ange andelar som', + 'costs.splitPercentOff': '{sum} % av 100 % fördelat', 'costs.splitHint.ticket': 'Lista det som stod på kvittot och bocka för vem som hade varje artikel.', 'costs.filter.allCategories': 'Alla kategorier', 'costs.filter.allDays': 'Alla dagar', diff --git a/shared/src/i18n/th/budget.ts b/shared/src/i18n/th/budget.ts index 77972a19a..3317965f6 100644 --- a/shared/src/i18n/th/budget.ts +++ b/shared/src/i18n/th/budget.ts @@ -130,6 +130,9 @@ const budget: TranslationStrings = { 'costs.payersHint': 'ติ๊กเลือกคนที่จ่าย แล้วใส่จำนวนเงินที่แต่ละคนจ่ายไป', 'costs.splitHint.equally': 'ทุกคนที่ติ๊กเลือกจ่ายส่วนแบ่งเท่ากัน', 'costs.splitHint.custom': 'ใส่ส่วนแบ่งของแต่ละคน โดยรวมกันแล้วต้องเท่ากับยอดทั้งหมด', + 'costs.splitHint.percent': 'ใส่ส่วนแบ่งของแต่ละคนเป็นเปอร์เซ็นต์ รวมกันต้องได้ 100 %', + 'costs.splitUnit': 'ใส่ส่วนแบ่งเป็น', + 'costs.splitPercentOff': 'แบ่งแล้ว {sum} % จาก 100 %', 'costs.splitHint.ticket': 'ใส่รายการที่อยู่ในใบเสร็จ แล้วติ๊กว่าใครสั่งรายการไหน', 'costs.pickSomeone': 'เลือกอย่างน้อยหนึ่งคนที่จะแยกด้วย', 'costs.splitSummary': 'แยก {count} วิธี · {amount} วิธีละ', diff --git a/shared/src/i18n/tr/budget.ts b/shared/src/i18n/tr/budget.ts index 79c133229..6e81d7bac 100644 --- a/shared/src/i18n/tr/budget.ts +++ b/shared/src/i18n/tr/budget.ts @@ -158,6 +158,9 @@ const budget: TranslationStrings = { 'costs.payersHint': 'Kimin ödediğini işaretleyin ve her birinin ne kadar verdiğini yazın.', 'costs.splitHint.equally': 'İşaretlenen herkes aynı payı öder.', 'costs.splitHint.custom': 'Her kişinin payını yazın; hepsi birlikte toplam tutarı tutmalı.', + 'costs.splitHint.percent': 'Herkesin payını yüzde olarak yazın; toplam %100 olmalı.', + 'costs.splitUnit': 'Payları şu şekilde gir', + 'costs.splitPercentOff': "%100'ün %{sum} kadarı dağıtıldı", 'costs.splitHint.ticket': 'Fişte neler olduğunu listeleyin ve her kalemi kimin aldığını işaretleyin.', 'costs.filter.allCategories': 'Tüm kategoriler', 'costs.filter.allDays': 'Tüm günler', diff --git a/shared/src/i18n/uk/budget.ts b/shared/src/i18n/uk/budget.ts index 3116e462b..b5db02ea4 100644 --- a/shared/src/i18n/uk/budget.ts +++ b/shared/src/i18n/uk/budget.ts @@ -158,6 +158,9 @@ const budget: TranslationStrings = { 'costs.payersHint': 'Позначте, хто платив, і впишіть, скільки вніс кожен.', 'costs.splitHint.equally': 'Усі позначені платять однакову частку.', 'costs.splitHint.custom': 'Впишіть частку кожної людини; разом вони мають скласти загальну суму.', + 'costs.splitHint.percent': 'Введіть частку кожного у відсотках; разом має бути 100 %.', + 'costs.splitUnit': 'Вводити частки як', + 'costs.splitPercentOff': 'Розподілено {sum} % зі 100 %', 'costs.splitHint.ticket': 'Перелічіть, що було в чеку, і позначте, хто брав кожну позицію.', 'costs.filter.allCategories': 'Усі категорії', 'costs.filter.allDays': 'Усі дні', diff --git a/shared/src/i18n/vi/budget.ts b/shared/src/i18n/vi/budget.ts index 2fdd8c8af..958f36b0d 100644 --- a/shared/src/i18n/vi/budget.ts +++ b/shared/src/i18n/vi/budget.ts @@ -158,6 +158,9 @@ const budget: TranslationStrings = { 'costs.payersHint': 'Đánh dấu những người đã trả và nhập số tiền mỗi người đã bỏ ra.', 'costs.splitHint.equally': 'Mọi người được đánh dấu trả phần bằng nhau.', 'costs.splitHint.custom': 'Nhập phần của từng người; cộng lại phải bằng tổng số tiền.', + 'costs.splitHint.percent': 'Nhập phần của mỗi người theo phần trăm; tổng cộng phải là 100 %.', + 'costs.splitUnit': 'Nhập phần theo', + 'costs.splitPercentOff': 'Đã chia {sum} % trên 100 %', 'costs.splitHint.ticket': 'Liệt kê các món trên hóa đơn và đánh dấu ai đã dùng từng món.', 'costs.filter.allCategories': 'Tất cả danh mục', 'costs.filter.allDays': 'Tất cả các ngày', diff --git a/shared/src/i18n/zh-TW/budget.ts b/shared/src/i18n/zh-TW/budget.ts index cac4c8238..28969693f 100644 --- a/shared/src/i18n/zh-TW/budget.ts +++ b/shared/src/i18n/zh-TW/budget.ts @@ -157,6 +157,9 @@ const budget: TranslationStrings = { 'costs.payersHint': '勾選付款的人,並填入每個人各付了多少。', 'costs.splitHint.equally': '每位勾選的人負擔相同的份額。', 'costs.splitHint.custom': '填入每個人的份額;加總必須等於總額。', + 'costs.splitHint.percent': '以百分比輸入每個人的份額,合計必須為 100 %。', + 'costs.splitUnit': '份額輸入方式', + 'costs.splitPercentOff': '已分配 {sum} %(共 100 %)', 'costs.splitHint.ticket': '列出收據上的項目,並勾選每一項是誰的。', 'costs.filter.allCategories': '所有類別', 'costs.filter.allDays': '所有日期', diff --git a/shared/src/i18n/zh/budget.ts b/shared/src/i18n/zh/budget.ts index 24f5768eb..f3ccdcfbd 100644 --- a/shared/src/i18n/zh/budget.ts +++ b/shared/src/i18n/zh/budget.ts @@ -157,6 +157,9 @@ const budget: TranslationStrings = { 'costs.payersHint': '勾选付款的人,并填写每个人各付了多少。', 'costs.splitHint.equally': '每位被勾选的人承担相同的份额。', 'costs.splitHint.custom': '填写每个人的份额;合计必须等于总额。', + 'costs.splitHint.percent': '以百分比输入每个人的份额,合计必须为 100 %。', + 'costs.splitUnit': '份额输入方式', + 'costs.splitPercentOff': '已分配 {sum} %(共 100 %)', 'costs.splitHint.ticket': '列出收据上的项目,并勾选每一项是谁的。', 'costs.filter.allCategories': '所有类别', 'costs.filter.allDays': '所有日期',