{#each columns as label (label)} {label} {/each} {#each shown as top, i (top.cur.code)} {top.approx ? "≈" : ""}{top.cur.code} {#if free} {@render stat( "Available", top.available === null ? null : topMoney(top, top.available) )} {/if} {@render stat( "Budgeted", top.budgeted ? topMoney(top, top.budgeted) : null )} {#if free} {@const unallocated = (top.available ?? 0) - top.budgeted} {@render stat( "Left to budget", top.available === null ? null : topMoney(top, unallocated), unallocated < 0 ? "text-expense" : "" )} {/if} {@const left = top.budgeted - top.inBudgets} {@render stat( "Left in budgets", top.budgeted ? topMoney(top, left) : null, left < 0 ? "text-expense" : "" )} {@render stat("Spent", topMoney(top, top.spent))}
Without a budget {#if top.outside > 0} {:else} 0 {/if}
{/each}
{#snippet stat( label: string, value: string | null, tone = "" )}
{label} {value ?? "0"}
{/snippet}