36 lines
752 B
Svelte
36 lines
752 B
Svelte
<script lang="ts">
|
|
import Amount from "#lib/components/Amount.svelte";
|
|
import { formatMoney } from "#lib/format.js";
|
|
import type { Total } from "./object-groups.js";
|
|
|
|
let {
|
|
totals,
|
|
tone = "plain",
|
|
empty = "",
|
|
}: {
|
|
totals: Total[];
|
|
tone?: "income" | "expense" | "plain";
|
|
empty?: string;
|
|
} = $props();
|
|
</script>
|
|
|
|
{#each totals as total (total.code)}
|
|
<div>
|
|
{#if tone === "plain"}
|
|
<span class="num">{formatMoney(total)}</span>
|
|
{:else}
|
|
<Amount
|
|
amount={total.amount}
|
|
code={total.code}
|
|
decimals={total.decimals}
|
|
symbol={total.symbol}
|
|
{tone}
|
|
/>
|
|
{/if}
|
|
</div>
|
|
{:else}
|
|
{#if empty}
|
|
<span class="text-cladd-fg-softer">{empty}</span>
|
|
{/if}
|
|
{/each}
|