First commit

This commit is contained in:
2026-11-17 21:48:36 +01:00
parent a3014ae75d
commit 1366d6b69d
35 changed files with 3770 additions and 1 deletions
+49
View File
@@ -0,0 +1,49 @@
{% extends "base.html" %}
{% block title %}Debts{% endblock %}
{% from "_debt_form.html" import debt_form with context %}
{% block content %}
<div class="page-head"><div><h1>Debts</h1><div class="sub">What you owe and what others owe you</div></div>
<div class="actions"><a class="btn" href="#add-debt" onclick="document.getElementById('add-debt').open=true">{{ icon('plus', 'sm') }} Add debt</a></div></div>
<div class="grid cols-3 mb">
<div class="card kpi"><div class="kpi-ico tint-bad">{{ icon('arrow-up-right') }}</div><div class="label">I owe</div><div class="value bad" data-live="i_owe" data-fmt="eur">{{ sums.i_owe|eur }}</div></div>
<div class="card kpi"><div class="kpi-ico tint-good">{{ icon('arrow-down-right') }}</div><div class="label">Owed to me</div><div class="value good" data-live="owed" data-fmt="eur">{{ sums.owed_to_me|eur }}</div></div>
<div class="card kpi"><div class="kpi-ico tint-accent">{{ icon('scale') }}</div><div class="label">Net</div><div class="value" data-live="debt_net" data-fmt="eurs">{{ (sums.owed_to_me - sums.i_owe)|eur(2, true) }}</div></div>
</div>
{% for dir, label in [('i_owe', 'Debts I have'), ('owed_to_me', 'Money people owe me')] %}
<div class="card mb">
<h2>{{ icon('landmark' if dir == 'i_owe' else 'handshake') }} {{ label }}</h2>
<div class="table-wrap"><table>
<thead><tr><th>Name</th><th>Status</th><th style="min-width:140px">Progress</th><th class="num">Total</th><th class="num">Paid</th><th class="num">Remaining</th>
<th class="num">Monthly</th><th>Next due</th><th>Last payment</th><th>Paid off ≈</th></tr></thead>
<tbody>
{% for x, s in debts if x.direction == dir %}
<tr>
<td><a href="/debts/{{ x.id }}"><strong>{{ x.name }}</strong></a><div class="desc">{{ x.counterparty }}</div></td>
<td>{% set cls = {'behind':'bad','on track':'good','ahead':'good','paid off':'good'}.get(s.status, '') %}
<span class="badge {{ cls }}">{{ s.status }}{% if s.missed %} · {{ s.missed }} missed{% endif %}</span></td>
<td><div class="progress"><div style="width:{{ [s.pct, 100]|min }}%"></div></div><span class="small muted">{{ '%.0f'|format(s.pct) }}%</span></td>
<td class="num">{{ x.principal|eur }}</td>
<td class="num" data-live="d{{ x.id }}_paid" data-fmt="eur">{{ s.paid|eur }}</td>
<td class="num"><strong data-live="d{{ x.id }}_remaining" data-fmt="eur">{{ s.remaining|eur }}</strong></td>
<td class="num">{{ x.monthly_payment|eur if x.monthly_payment else '—' }}</td>
<td class="small">{{ s.next_due.strftime('%d-%m-%Y') if s.next_due else '—' }}</td>
<td class="small">{{ s.last_payment.strftime('%d-%m-%Y') if s.last_payment else 'never' }}</td>
<td class="small">{{ s.payoff.strftime('%b %Y') if s.payoff else '—' }}</td>
</tr>
{% else %}<tr><td colspan="10" class="muted">None.</td></tr>{% endfor %}
</tbody>
</table></div>
</div>
{% endfor %}
<p><a href="?show_closed={{ 0 if show_closed else 1 }}">{{ 'Hide' if show_closed else 'Show' }} closed debts</a></p>
<details class="card" id="add-debt" {{ 'open' if not debts }}>
<summary>{{ icon('plus') }} Add a debt</summary>
{{ debt_form() }}
<p class="small muted">With a monthly payment set, the status compares what should have been paid by now with what was paid.
The “auto-match” text links bank transactions automatically (outgoing for debts you have, incoming for money owed to you).</p>
</details>
{% endblock %}