feat(accounts): friends ledger for debts, settle up and offset, asset accounts by currency

Liabilities show one card per friend with who owes whom, last movement,
average days to pay back and twelve months of lending. s settles up,
+ lends more, o offsets two debts through the prefilled editor. Asset
accounts group by currency with totals, inactive ones behind i.
This commit is contained in:
hh committed 2026-10-16 15:05:56 +00:00
1 parent 60b099e917
commit 6f39343e07
9 files changed
+1103 -64

No files matched your search

@@ -1,11 +1,16 @@
<script lang="ts">
import type { AccountType } from "#lib/api/types.js";
import AccountsIndex from "#lib/components/accounts/AccountsIndex.svelte";
import Ledger from "#lib/components/accounts/Ledger.svelte";
import { page } from "$app/state";
const type = $derived(page.params.type as AccountType);
</script>
{#key type}
<AccountsIndex {type} />
{#if type === "liabilities"}
<Ledger />
{:else}
<AccountsIndex {type} />
{/if}
{/key}
@@ -22,6 +22,13 @@
});
const draftKey = $derived(page.url.searchParams.get("draft"));
function blank() {
const form = emptyForm(type);
form.splits[0].amount = page.url.searchParams.get("amount") ?? "";
form.splits[0].description = page.url.searchParams.get("description") ?? "";
return form;
}
const clone = createQuery(() => ({
enabled: Boolean(cloneId),
queryFn: () => api<One<TransactionGroup>>(`/v1/transactions/${cloneId}`),
@@ -42,6 +49,6 @@
could not be loaded, so this is an empty form.
</p>
{/if}
<Editor initial={draft ?? emptyForm(type)} {prefill} />
<Editor initial={draft ?? blank()} {prefill} />
{/if}
{/key}