fix: opravy po review
CI / Generate TypeScript types (push) Successful in 10s
CI / Server unit tests (push) Successful in 21s
CI / Generate TypeScript types (pull_request) Successful in 47s
CI / Build server (push) Successful in 27s
CI / Server unit tests (pull_request) Successful in 20s
CI / Build server (pull_request) Successful in 27s
CI / Build client (pull_request) Successful in 40s
CI / Playwright E2E tests (pull_request) Successful in 1m20s
CI / Build and push Docker image (pull_request) Has been skipped
CI / Notify (pull_request) Has been skipped
CI / Build client (push) Successful in 4m13s
CI / Playwright E2E tests (push) Successful in 6m7s
CI / Build and push Docker image (push) Has been skipped
CI / Notify (push) Successful in 6s

This commit is contained in:
2026-05-07 08:56:49 +02:00
parent 21d7224fb4
commit 5f03471541
14 changed files with 359 additions and 88 deletions
@@ -87,10 +87,16 @@ export default function PayForAllModal({ isOpen, onClose, locationName, location
const totalPeople = includedDiners.length + 1; // +1 for payer
return Math.round((tip / totalPeople) * 100) / 100;
})();
const payerTipShare = (() => {
const tip = parseAmount(tipTotal);
if (!tip) return 0;
return Math.round((tip - tipPerPerson * includedDiners.length) * 100) / 100;
})();
const getTotal = (d: DinerEntry): number => {
const surcharge = parseAmount(d.surchargeAmount) ?? 0;
return Math.round((d.baseAmount + surcharge + tipPerPerson) * 100) / 100;
const tip = d.login === payerLogin ? payerTipShare : tipPerPerson;
return Math.round((d.baseAmount + surcharge + tip) * 100) / 100;
};
const handleInclude = useCallback((login: string, checked: boolean) => {
@@ -248,7 +254,7 @@ export default function PayForAllModal({ isOpen, onClose, locationName, location
</div>
</td>
<td className="text-end">
{tipPerPerson > 0 ? `${tipPerPerson} Kč` : '—'}
{(() => { const s = isPayer ? payerTipShare : tipPerPerson; return s > 0 ? `${s} Kč` : '—'; })()}
</td>
<td className="text-end fw-bold">
{`${total} Kč`}