feat(orders): PDF footer = issuer name+email, 'Zobrazit objednávku' button, per-currency list totals

- Issued-order PDF: drop the Vystavil/Schválil signature row; footer now shows
  'Vystavil: <name>' + 'E-mail: <email>' from the logged-in user (authData).
- IssuedOrderDetail PDF button 'Export PDF' -> 'Zobrazit objednávku' (already
  opens inline like invoices' 'Zobrazit fakturu').
- New /orders/stats + /issued-orders/stats endpoints sum order total (incl VAT)
  per currency across the active filter; rendered as 'Celkem: …' beneath both
  the received and issued lists. formatMultiCurrency lifted to a shared util.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-06-09 21:50:05 +02:00
parent 78cd7cf2d8
commit 5462fcf944
14 changed files with 627 additions and 84 deletions

View File

@@ -17,6 +17,20 @@ export function formatCurrency(
}
}
/**
* Joins per-currency amounts into a single display string
* (e.g. `"1 234,00 Kč · 50,00 €"`). Typed structurally so it stays decoupled
* from the React Query layer's `CurrencyAmount`. Empty/invalid input →
* `formatCurrency(0, "CZK")`.
*/
export function formatMultiCurrency(
amounts: Array<{ amount: number; currency: string }>,
): string {
if (!Array.isArray(amounts) || amounts.length === 0)
return formatCurrency(0, "CZK");
return amounts.map((a) => formatCurrency(a.amount, a.currency)).join(" · ");
}
export function formatDate(dateStr: string | null | undefined): string {
if (!dateStr) return "—";
const d = new Date(dateStr);