fix: poplatky děleny všemi (včetně plátce), přejmenování Dýško → Poplatek
CI / Generate TypeScript types (push) Successful in 11s
CI / Generate TypeScript types (pull_request) Successful in 10s
CI / Build server (push) Successful in 46s
CI / Build client (push) Successful in 39s
CI / Server unit tests (pull_request) Successful in 21s
CI / Playwright E2E tests (push) Successful in 1m17s
CI / Server unit tests (push) Has been cancelled
CI / Build and push Docker image (push) Has been cancelled
CI / Notify (push) Has been cancelled
CI / Build server (pull_request) Has been cancelled
CI / Build client (pull_request) Has been cancelled
CI / Playwright E2E tests (pull_request) Has been cancelled
CI / Build and push Docker image (pull_request) Has been cancelled
CI / Notify (pull_request) Has been cancelled
CI / Generate TypeScript types (push) Successful in 11s
CI / Generate TypeScript types (pull_request) Successful in 10s
CI / Build server (push) Successful in 46s
CI / Build client (push) Successful in 39s
CI / Server unit tests (pull_request) Successful in 21s
CI / Playwright E2E tests (push) Successful in 1m17s
CI / Server unit tests (push) Has been cancelled
CI / Build and push Docker image (push) Has been cancelled
CI / Notify (push) Has been cancelled
CI / Build server (pull_request) Has been cancelled
CI / Build client (pull_request) Has been cancelled
CI / Playwright E2E tests (pull_request) Has been cancelled
CI / Build and push Docker image (pull_request) Has been cancelled
CI / Notify (pull_request) Has been cancelled
This commit is contained in:
@@ -84,13 +84,13 @@ export default function PayForAllModal({ isOpen, onClose, locationName, location
|
|||||||
if (includedDiners.length === 0) return 0;
|
if (includedDiners.length === 0) return 0;
|
||||||
const tip = parseAmount(tipTotal);
|
const tip = parseAmount(tipTotal);
|
||||||
if (tip === null || tip === 0) return 0;
|
if (tip === null || tip === 0) return 0;
|
||||||
return Math.round((tip / includedDiners.length) * 100) / 100;
|
const totalPeople = includedDiners.length + 1; // +1 for payer
|
||||||
|
return Math.round((tip / totalPeople) * 100) / 100;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
const getTotal = (d: DinerEntry): number => {
|
const getTotal = (d: DinerEntry): number => {
|
||||||
const surcharge = parseAmount(d.surchargeAmount) ?? 0;
|
const surcharge = parseAmount(d.surchargeAmount) ?? 0;
|
||||||
const tip = d.included && d.login !== payerLogin ? tipPerPerson : 0;
|
return Math.round((d.baseAmount + surcharge + tipPerPerson) * 100) / 100;
|
||||||
return Math.round((d.baseAmount + surcharge + tip) * 100) / 100;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleInclude = useCallback((login: string, checked: boolean) => {
|
const handleInclude = useCallback((login: string, checked: boolean) => {
|
||||||
@@ -167,7 +167,7 @@ export default function PayForAllModal({ isOpen, onClose, locationName, location
|
|||||||
</Alert>
|
</Alert>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<p>Zaplatili jste za skupinu v restauraci. Nastavte příplatky a dýško, poté vygenerujte QR kódy pro ostatní.</p>
|
<p>Zaplatili jste za skupinu v restauraci. Nastavte příplatky a společné poplatky, poté vygenerujte QR kódy pro ostatní.</p>
|
||||||
|
|
||||||
{!hasMenu && (
|
{!hasMenu && (
|
||||||
<Alert variant="info">
|
<Alert variant="info">
|
||||||
@@ -194,7 +194,7 @@ export default function PayForAllModal({ isOpen, onClose, locationName, location
|
|||||||
<th>Strávník</th>
|
<th>Strávník</th>
|
||||||
<th>Jídla</th>
|
<th>Jídla</th>
|
||||||
<th style={{ width: 220 }}>Příplatek</th>
|
<th style={{ width: 220 }}>Příplatek</th>
|
||||||
<th style={{ width: 90 }}>Dýško</th>
|
<th style={{ width: 90 }}>Poplatek</th>
|
||||||
<th style={{ width: 90 }}>Celkem</th>
|
<th style={{ width: 90 }}>Celkem</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -248,7 +248,7 @@ export default function PayForAllModal({ isOpen, onClose, locationName, location
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td className="text-end">
|
<td className="text-end">
|
||||||
{!isPayer && d.included ? `${tipPerPerson} Kč` : '—'}
|
{tipPerPerson > 0 ? `${tipPerPerson} Kč` : '—'}
|
||||||
</td>
|
</td>
|
||||||
<td className="text-end fw-bold">
|
<td className="text-end fw-bold">
|
||||||
{`${total} Kč`}
|
{`${total} Kč`}
|
||||||
@@ -260,7 +260,7 @@ export default function PayForAllModal({ isOpen, onClose, locationName, location
|
|||||||
</Table>
|
</Table>
|
||||||
|
|
||||||
<div className="d-flex align-items-center gap-2 mt-2">
|
<div className="d-flex align-items-center gap-2 mt-2">
|
||||||
<label className="mb-0 text-nowrap">Dýško celkem (Kč):</label>
|
<label className="mb-0 text-nowrap">Poplatky celkem (Kč):</label>
|
||||||
<Form.Control
|
<Form.Control
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="0"
|
placeholder="0"
|
||||||
|
|||||||
@@ -60,13 +60,13 @@ export default function PayForGroupModal({ isOpen, onClose, group, payerLogin, b
|
|||||||
if (includedNonPayers.length === 0) return 0;
|
if (includedNonPayers.length === 0) return 0;
|
||||||
const tip = parseAmount(tipTotal);
|
const tip = parseAmount(tipTotal);
|
||||||
if (tip === null || tip === 0) return 0;
|
if (tip === null || tip === 0) return 0;
|
||||||
return Math.round((tip / includedNonPayers.length) * 100) / 100;
|
const totalPeople = includedNonPayers.length + 1; // +1 for payer
|
||||||
|
return Math.round((tip / totalPeople) * 100) / 100;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
const getTotal = (d: DinerEntry): number => {
|
const getTotal = (d: DinerEntry): number => {
|
||||||
const surcharge = parseAmount(d.surchargeAmount) ?? 0;
|
const surcharge = parseAmount(d.surchargeAmount) ?? 0;
|
||||||
const tip = d.included && d.login !== payerLogin ? tipPerPerson : 0;
|
return Math.round((d.baseAmount + surcharge + tipPerPerson) * 100) / 100;
|
||||||
return Math.round((d.baseAmount + surcharge + tip) * 100) / 100;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleInclude = useCallback((login: string, checked: boolean) => {
|
const handleInclude = useCallback((login: string, checked: boolean) => {
|
||||||
@@ -139,7 +139,7 @@ export default function PayForGroupModal({ isOpen, onClose, group, payerLogin, b
|
|||||||
</Alert>
|
</Alert>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<p>Zaplatili jste za skupinu. Nastavte příplatky a dýško, poté vygenerujte QR kódy pro ostatní.</p>
|
<p>Zaplatili jste za skupinu. Nastavte příplatky a společné poplatky, poté vygenerujte QR kódy pro ostatní.</p>
|
||||||
|
|
||||||
{error && (
|
{error && (
|
||||||
<Alert variant="danger" onClose={() => setError(null)} dismissible>
|
<Alert variant="danger" onClose={() => setError(null)} dismissible>
|
||||||
@@ -154,7 +154,7 @@ export default function PayForGroupModal({ isOpen, onClose, group, payerLogin, b
|
|||||||
<th>Člen</th>
|
<th>Člen</th>
|
||||||
<th style={{ width: 90 }}>Základ (Kč)</th>
|
<th style={{ width: 90 }}>Základ (Kč)</th>
|
||||||
<th style={{ width: 220 }}>Příplatek</th>
|
<th style={{ width: 220 }}>Příplatek</th>
|
||||||
<th style={{ width: 90 }}>Dýško</th>
|
<th style={{ width: 90 }}>Poplatek</th>
|
||||||
<th style={{ width: 90 }}>Celkem</th>
|
<th style={{ width: 90 }}>Celkem</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -203,7 +203,7 @@ export default function PayForGroupModal({ isOpen, onClose, group, payerLogin, b
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td className="text-end">
|
<td className="text-end">
|
||||||
{!isPayer && d.included ? `${tipPerPerson} Kč` : '—'}
|
{tipPerPerson > 0 ? `${tipPerPerson} Kč` : '—'}
|
||||||
</td>
|
</td>
|
||||||
<td className="text-end fw-bold">
|
<td className="text-end fw-bold">
|
||||||
{`${total} Kč`}
|
{`${total} Kč`}
|
||||||
@@ -215,7 +215,7 @@ export default function PayForGroupModal({ isOpen, onClose, group, payerLogin, b
|
|||||||
</Table>
|
</Table>
|
||||||
|
|
||||||
<div className="d-flex align-items-center gap-2 mt-2">
|
<div className="d-flex align-items-center gap-2 mt-2">
|
||||||
<label className="mb-0 text-nowrap">Dýško celkem (Kč):</label>
|
<label className="mb-0 text-nowrap">Poplatky celkem (Kč):</label>
|
||||||
<Form.Control
|
<Form.Control
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="0"
|
placeholder="0"
|
||||||
|
|||||||
Reference in New Issue
Block a user