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
+19
View File
@@ -0,0 +1,19 @@
{% macro debt_form(x=None) %}
<form method="post" action="/debts/save" class="form-grid">
<input type="hidden" name="id" value="{{ x.id if x else '' }}">
<label>Name<input name="name" required value="{{ x.name if x else '' }}" placeholder="DUO study loan / Loan to Sam"></label>
<label>Direction<select name="direction">
<option value="i_owe" {{ 'selected' if x and x.direction == 'i_owe' }}>I owe them</option>
<option value="owed_to_me" {{ 'selected' if x and x.direction == 'owed_to_me' }}>They owe me</option></select></label>
<label>Counterparty<input name="counterparty" value="{{ x.counterparty if x else '' }}"></label>
<label>Amount (€)<input name="principal" inputmode="decimal" required value="{{ x.principal if x else '' }}"></label>
<label>Start date<input type="date" name="start_date" value="{{ x.start_date.isoformat() if x else today().isoformat() }}"></label>
<label>Monthly payment (€)<input name="monthly_payment" inputmode="decimal" value="{{ x.monthly_payment if x and x.monthly_payment else '' }}" placeholder="optional"></label>
<label>Due day of month<input name="due_day" type="number" min="1" max="31" value="{{ x.due_day if x and x.due_day else '' }}" placeholder="optional"></label>
<label>Interest % / year<input name="interest_rate" inputmode="decimal" value="{{ x.interest_rate if x and x.interest_rate is not none else '' }}" placeholder="informational"></label>
<label title="Bank transactions whose name/description contains this are counted as payments automatically">Auto-match bank text
<input name="match_pattern" value="{{ x.match_pattern if x and x.match_pattern else '' }}" placeholder="e.g. DUO or S. Jansen"></label>
<label>Notes<input name="notes" value="{{ x.notes if x else '' }}"></label>
<div><button>{{ 'Save' if x else 'Add' }}</button></div>
</form>
{% endmacro %}
+150
View File
@@ -0,0 +1,150 @@
<svg xmlns="http://www.w3.org/2000/svg" style="display:none">
<!-- Lucide icons, ISC License, https://lucide.dev -->
<symbol id="i-layout-dashboard" viewBox="0 0 24 24"><rect width="7" height="9" x="3" y="3" rx="1" />
<rect width="7" height="5" x="14" y="3" rx="1" />
<rect width="7" height="9" x="14" y="12" rx="1" />
<rect width="7" height="5" x="3" y="16" rx="1" /></symbol>
<symbol id="i-receipt" viewBox="0 0 24 24"><path d="M12 17V7" />
<path d="M16 8h-6a2 2 0 0 0 0 4h4a2 2 0 0 1 0 4H8" />
<path d="M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z" /></symbol>
<symbol id="i-repeat" viewBox="0 0 24 24"><path d="m17 2 4 4-4 4" />
<path d="M3 11v-1a4 4 0 0 1 4-4h14" />
<path d="m7 22-4-4 4-4" />
<path d="M21 13v1a4 4 0 0 1-4 4H3" /></symbol>
<symbol id="i-trending-up" viewBox="0 0 24 24"><path d="M16 7h6v6" />
<path d="m22 7-8.5 8.5-5-5L2 17" /></symbol>
<symbol id="i-gem" viewBox="0 0 24 24"><path d="M10.5 3 8 9l4 13 4-13-2.5-6" />
<path d="M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3z" />
<path d="M2 9h20" /></symbol>
<symbol id="i-handshake" viewBox="0 0 24 24"><path d="m11 17 2 2a1 1 0 1 0 3-3" />
<path d="m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4" />
<path d="m21 3 1 11h-2" />
<path d="M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3" />
<path d="M3 4h8" /></symbol>
<symbol id="i-upload" viewBox="0 0 24 24"><path d="M12 3v12" />
<path d="m17 8-5-5-5 5" />
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" /></symbol>
<symbol id="i-settings" viewBox="0 0 24 24"><path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915" />
<circle cx="12" cy="12" r="3" /></symbol>
<symbol id="i-log-out" viewBox="0 0 24 24"><path d="m16 17 5-5-5-5" />
<path d="M21 12H9" />
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /></symbol>
<symbol id="i-sun" viewBox="0 0 24 24"><circle cx="12" cy="12" r="4" />
<path d="M12 2v2" />
<path d="M12 20v2" />
<path d="m4.93 4.93 1.41 1.41" />
<path d="m17.66 17.66 1.41 1.41" />
<path d="M2 12h2" />
<path d="M20 12h2" />
<path d="m6.34 17.66-1.41 1.41" />
<path d="m19.07 4.93-1.41 1.41" /></symbol>
<symbol id="i-moon" viewBox="0 0 24 24"><path d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401" /></symbol>
<symbol id="i-monitor" viewBox="0 0 24 24"><rect width="20" height="14" x="2" y="3" rx="2" />
<line x1="8" x2="16" y1="21" y2="21" />
<line x1="12" x2="12" y1="17" y2="21" /></symbol>
<symbol id="i-wallet" viewBox="0 0 24 24"><path d="M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1" />
<path d="M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4" /></symbol>
<symbol id="i-shopping-cart" viewBox="0 0 24 24"><path d="m2.05 2.05 1.099-.028a1 1 0 0 1 1.008.815l2.69 14.347A1 1 0 0 0 7.83 18H18" />
<path d="M4.563 5h16.435a1 1 0 0 1 .981 1.204l-1.026 6.226A2 2 0 0 1 18.962 14H6.25" />
<circle cx="18" cy="20" r="2" />
<circle cx="8" cy="20" r="2" /></symbol>
<symbol id="i-landmark" viewBox="0 0 24 24"><path d="M10 18v-7" />
<path d="M11.119 2.205a2 2 0 0 1 1.762 0l7.84 3.846A.5.5 0 0 1 20.5 7h-17a.5.5 0 0 1-.22-.949z" />
<path d="M14 18v-7" />
<path d="M18 18v-7" />
<path d="M3 22h18" />
<path d="M6 18v-7" /></symbol>
<symbol id="i-alert-triangle" viewBox="0 0 24 24"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" />
<path d="M12 9v4" />
<path d="M12 17h.01" /></symbol>
<symbol id="i-calendar-clock" viewBox="0 0 24 24"><path d="M16 14v2.2l1.6 1" />
<path d="M16 2v3" />
<path d="M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338" />
<path d="M3 9h5.859" />
<path d="M8 2v3" />
<circle cx="16" cy="16" r="6" /></symbol>
<symbol id="i-refresh-cw" viewBox="0 0 24 24"><path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" />
<path d="M21 3v5h-5" />
<path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" />
<path d="M8 16H3v5" /></symbol>
<symbol id="i-search" viewBox="0 0 24 24"><path d="m21 21-4.34-4.34" />
<circle cx="11" cy="11" r="8" /></symbol>
<symbol id="i-plus" viewBox="0 0 24 24"><path d="M5 12h14" />
<path d="M12 5v14" /></symbol>
<symbol id="i-check" viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5" /></symbol>
<symbol id="i-x" viewBox="0 0 24 24"><path d="M18 6 6 18" />
<path d="m6 6 12 12" /></symbol>
<symbol id="i-trash-2" viewBox="0 0 24 24"><path d="M10 11v6" />
<path d="M14 11v6" />
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" />
<path d="M3 6h18" />
<path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" /></symbol>
<symbol id="i-pencil" viewBox="0 0 24 24"><path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" />
<path d="m15 5 4 4" /></symbol>
<symbol id="i-chevron-left" viewBox="0 0 24 24"><path d="m15 18-6-6 6-6" /></symbol>
<symbol id="i-chevron-right" viewBox="0 0 24 24"><path d="m9 18 6-6-6-6" /></symbol>
<symbol id="i-arrow-up-right" viewBox="0 0 24 24"><path d="M7 7h10v10" />
<path d="M7 17 17 7" /></symbol>
<symbol id="i-arrow-down-right" viewBox="0 0 24 24"><path d="m7 7 10 10" />
<path d="M17 7v10H7" /></symbol>
<symbol id="i-piggy-bank" viewBox="0 0 24 24"><path d="M11 17h3v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3a3.16 3.16 0 0 0 2-2h1a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1h-1a5 5 0 0 0-2-4V3a4 4 0 0 0-3.2 1.6l-.3.4H11a6 6 0 0 0-6 6v1a5 5 0 0 0 2 4v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1z" />
<path d="M16 10h.01" />
<path d="M2 8v1a2 2 0 0 0 2 2h1" /></symbol>
<symbol id="i-coins" viewBox="0 0 24 24"><path d="M13.744 17.736a6 6 0 1 1-7.48-7.48" />
<path d="M15 6h1v4" />
<path d="m6.134 14.768.866-.5 2 3.464" />
<circle cx="16" cy="8" r="6" /></symbol>
<symbol id="i-bitcoin" viewBox="0 0 24 24"><path d="M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727" /></symbol>
<symbol id="i-line-chart" viewBox="0 0 24 24"><path d="M3 3v16a2 2 0 0 0 2 2h16" />
<path d="m19 9-5 5-4-4-3 3" /></symbol>
<symbol id="i-pie-chart" viewBox="0 0 24 24"><path d="M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z" />
<path d="M21.21 15.89A10 10 0 1 1 8 2.83" /></symbol>
<symbol id="i-bar-chart-3" viewBox="0 0 24 24"><path d="M3 3v16a2 2 0 0 0 2 2h16" />
<path d="M18 17V9" />
<path d="M13 17V5" />
<path d="M8 17v-3" /></symbol>
<symbol id="i-lock" viewBox="0 0 24 24"><rect width="18" height="11" x="3" y="11" rx="2" ry="2" />
<path d="M7 11V7a5 5 0 0 1 10 0v4" /></symbol>
<symbol id="i-link" viewBox="0 0 24 24"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" />
<path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" /></symbol>
<symbol id="i-file-up" viewBox="0 0 24 24"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z" />
<path d="M14 2v5a1 1 0 0 0 1 1h5" />
<path d="M12 12v6" />
<path d="m15 15-3-3-3 3" /></symbol>
<symbol id="i-circle-alert" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" />
<line x1="12" x2="12" y1="8" y2="12" />
<line x1="12" x2="12.01" y1="16" y2="16" /></symbol>
<symbol id="i-eye-off" viewBox="0 0 24 24"><path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49" />
<path d="M14.084 14.158a3 3 0 0 1-4.242-4.242" />
<path d="M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143" />
<path d="m2 2 20 20" /></symbol>
<symbol id="i-building-2" viewBox="0 0 24 24"><path d="M10 12h4" />
<path d="M10 8h4" />
<path d="M14 21v-3a2 2 0 0 0-4 0v3" />
<path d="M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2" />
<path d="M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16" /></symbol>
<symbol id="i-credit-card" viewBox="0 0 24 24"><rect width="20" height="14" x="2" y="5" rx="2" />
<line x1="2" x2="22" y1="10" y2="10" />
<path d="M6 14h2" /></symbol>
<symbol id="i-banknote" viewBox="0 0 24 24"><rect width="20" height="12" x="2" y="6" rx="2" />
<circle cx="12" cy="12" r="2" />
<path d="M6 12h.01M18 12h.01" /></symbol>
<symbol id="i-scale" viewBox="0 0 24 24"><path d="M12 3v18" />
<path d="m19 8 3 8a5 5 0 0 1-6 0zV7" />
<path d="M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1" />
<path d="m5 8 3 8a5 5 0 0 1-6 0zV7" />
<path d="M7 21h10" /></symbol>
<symbol id="i-clock" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" />
<path d="M12 6v6l4 2" /></symbol>
<symbol id="i-menu" viewBox="0 0 24 24"><path d="M4 5h16" />
<path d="M4 12h16" />
<path d="M4 19h16" /></symbol>
<symbol id="i-filter" viewBox="0 0 24 24"><path d="M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z" /></symbol>
<symbol id="i-download" viewBox="0 0 24 24"><path d="M12 15V3" />
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<path d="m7 10 5 5 5-5" /></symbol>
<symbol id="i-sparkles" viewBox="0 0 24 24"><path d="M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z" />
<path d="M20 2v4" />
<path d="M22 4h-4" />
<circle cx="4" cy="20" r="2" /></symbol>
</svg>

After

Width:  |  Height:  |  Size: 10 KiB

+73
View File
@@ -0,0 +1,73 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<meta name="robots" content="noindex">
<title>{% block title %}Finance{% endblock %} · Finance</title>
<script>try{var t=localStorage.getItem("theme");if(t==="dark"||t==="light")document.documentElement.dataset.theme=t;}catch(e){}</script>
<link rel="stylesheet" href="/static/style.css">
<script src="/static/chart.umd.min.js" defer></script>
<script src="/static/app.js" defer></script>
</head>
<body>
{% include "_icons.svg" %}
{% set path = request.url.path %}
{% macro navlink(href, ico, label, active, count=0) -%}
<a href="{{ href }}" class="nav-link {{ 'active' if active }}">{{ icon(ico) }}<span>{{ label }}</span>{% if count %}<span class="nav-count">{{ count }}</span>{% endif %}</a>
{%- endmacro %}
<div class="layout">
<nav class="side" aria-label="Main">
<div class="brand"><span class="logo">{{ icon('wallet') }}</span> Finance</div>
<div class="nav-section">Overview</div>
{{ navlink('/', 'layout-dashboard', 'Dashboard', path == '/') }}
{{ navlink('/transactions', 'receipt', 'Transactions', path.startswith('/transactions')) }}
{{ navlink('/recurring', 'repeat', 'Recurring', path.startswith('/recurring'), nav_missed) }}
<div class="nav-section">Wealth</div>
{{ navlink('/investments', 'trending-up', 'Investments', path.startswith('/investments')) }}
{{ navlink('/gold', 'gem', 'Gold', path.startswith('/gold')) }}
{{ navlink('/debts', 'handshake', 'Debts', path.startswith('/debts')) }}
<div class="nav-section">Data</div>
{{ navlink('/import', 'upload', 'Import', path.startswith('/import')) }}
{{ navlink('/settings', 'settings', 'Settings', path.startswith('/settings')) }}
<div class="nav-foot">
<div class="theme-toggle" role="group" aria-label="Theme">
<button type="button" data-theme-set="auto" title="Follow system">{{ icon('monitor', 'sm') }}</button>
<button type="button" data-theme-set="light" title="Light">{{ icon('sun', 'sm') }}</button>
<button type="button" data-theme-set="dark" title="Dark">{{ icon('moon', 'sm') }}</button>
</div>
<div class="user-chip">
<span class="avatar">{{ (user or 'Me')[:1]|upper }}</span>
<span class="who">{{ user or 'Signed in' }}</span>
<a href="/outpost.goauthentik.io/sign_out" title="Sign out">{{ icon('log-out', 'sm') }}</a>
</div>
</div>
</nav>
<div class="scrim" data-nav-close></div>
<div style="min-width:0">
<header class="topbar">
<button class="icon-btn" data-nav-toggle aria-label="Menu">{{ icon('menu') }}</button>
<div class="brand"><span class="logo">{{ icon('wallet', 'sm') }}</span> Finance</div>
</header>
<main>
{% if msg %}<div class="flash">{{ icon('circle-alert') }}<span>{{ msg }}</span></div>{% endif %}
{% block content %}{% endblock %}
</main>
</div>
</div>
<nav class="tabbar" aria-label="Quick">
<a href="/" class="{{ 'active' if path == '/' }}">{{ icon('layout-dashboard') }}Home</a>
<a href="/transactions" class="{{ 'active' if path.startswith('/transactions') }}">{{ icon('receipt') }}Activity</a>
<a href="/recurring" class="{{ 'active' if path.startswith('/recurring') }}">{{ icon('repeat') }}Recurring{% if nav_missed %}<span class="dot-count"></span>{% endif %}</a>
<a href="/investments" class="{{ 'active' if path.startswith('/investments') or path.startswith('/gold') }}">{{ icon('trending-up') }}Wealth</a>
<a href="/debts" class="{{ 'active' if path.startswith('/debts') }}">{{ icon('handshake') }}Debts</a>
</nav>
</body>
</html>
+146
View File
@@ -0,0 +1,146 @@
{% extends "base.html" %}
{% block title %}Dashboard{% endblock %}
{% block content %}
{% set acc_q = '&account=%s' % account if account else '' %}
<div class="page-head">
<div>
<h1>Dashboard</h1>
<div class="sub">{{ start.strftime('%B %Y') }} · <span class="live-status"></span></div>
</div>
<form class="actions" method="get">
{% if start.strftime('%Y-%m') != today().strftime('%Y-%m') %}<input type="hidden" name="month" value="{{ start.strftime('%Y-%m') }}">{% endif %}
<select name="account" data-autosubmit aria-label="Account">
<option value="">All accounts</option>
{% for a in accounts %}<option value="{{ a.id }}" {{ 'selected' if account == a.id }}>{{ a.name }}</option>{% endfor %}
</select>
<div class="seg">
<a href="?month={{ prev_month }}{{ acc_q }}" title="Previous month">{{ icon('chevron-left', 'sm') }}</a>
<a class="on" href="?{{ acc_q[1:] }}">{{ start.strftime('%b %Y') }}</a>
{% if next_month %}<a href="?month={{ next_month }}{{ acc_q }}" title="Next month">{{ icon('chevron-right', 'sm') }}</a>{% endif %}
</div>
</form>
</div>
{% if missed %}
<div class="card alert mb">
<div class="card-head"><h2>{{ icon('alert-triangle') }} {{ missed|length }} missed recurring payment{{ 's' if missed|length > 1 }}</h2>
<a class="btn secondary sm" href="/recurring">Review</a></div>
<ul class="list">
{% for r in missed %}
<li><span><strong>{{ r.name }}</strong> <span class="muted small">· {{ r.frequency }} · expected {{ r.next_date.strftime('%d %b') }} ({{ (today() - r.next_date).days }} days ago)</span></span>
<span class="num">{{ r.amount|eur }}</span></li>
{% endfor %}
</ul>
</div>
{% endif %}
<div class="grid cols-4 mb">
<div class="card kpi">
<div class="kpi-ico tint-accent">{{ icon('wallet') }}</div>
<div class="label">Net worth</div>
<div class="value" data-live="net_worth" data-fmt="eur0">{{ net_worth|eur(0) }}</div>
<div class="sub">Cash <span data-live="cash" data-fmt="eur0">{{ cash|eur(0) }}</span> · Invested <span data-live="all_value" data-fmt="eur0">{{ invest_value|eur(0) }}</span></div>
</div>
<div class="card kpi">
<div class="kpi-ico tint-bad">{{ icon('shopping-cart') }}</div>
<div class="label">Spent in {{ start.strftime('%B') }}</div>
<div class="value" data-live="spent" data-fmt="eur0">{{ cur.expense|eur(0) }}</div>
<div class="sub">Income <span data-live="income" data-fmt="eur0">{{ cur.income|eur(0) }}</span> ·
<span class="delta {{ 'good' if cur.income - cur.expense >= 0 else 'bad' }}" data-live="net_month" data-fmt="eur0s" data-color>{{ (cur.income - cur.expense)|eur(0, true) }}</span></div>
</div>
<div class="card kpi">
{% set a = pt.get('all') %}
<div class="kpi-ico tint-good">{{ icon('trending-up') }}</div>
<div class="label">Investments + gold</div>
<div class="value" data-live="all_value" data-fmt="eur0">{{ (a.value if a else 0)|eur(0) }}</div>
<div class="sub">{% if a %}Paid <span data-live="all_cost" data-fmt="eur0">{{ a.cost|eur(0) }}</span> ·
<span class="delta {{ 'good' if a.pnl >= 0 else 'bad' }}" data-live="all_pnl_pct" data-fmt="pct" data-color>{{ a.pnl_pct|pct }}</span>{% else %}<a href="/investments">Add holdings</a>{% endif %}</div>
</div>
<div class="card kpi">
<div class="kpi-ico tint-warn">{{ icon('handshake') }}</div>
<div class="label">Debts (net)</div>
<div class="value" data-live="debt_net" data-fmt="eur0s">{{ (owed - i_owe)|eur(0, true) }}</div>
<div class="sub">I owe <span data-live="i_owe" data-fmt="eur0">{{ i_owe|eur(0) }}</span> · Owed to me <span data-live="owed" data-fmt="eur0">{{ owed|eur(0) }}</span></div>
</div>
</div>
<div class="grid cols-3 mb">
<div class="card span-2">
<div class="card-head">
<h2>{{ icon('bar-chart-3') }} Income vs expenses</h2>
<span class="small muted">Click a month to open it</span>
</div>
<div class="chart-box tall"><canvas data-chart="months" data-link="?month={label}{{ acc_q }}"
data-json='{{ {"labels": charts.months.labels, "income": charts.months.income, "expense": charts.months.expense, "current": start.strftime("%Y-%m")}|tojson }}'></canvas></div>
</div>
<div class="card">
<div class="card-head"><h2>{{ icon('pie-chart') }} Spending · {{ start.strftime('%b') }}</h2></div>
{% if cats %}
<div class="chart-box sm"><canvas data-chart="donut" data-legend="cat-legend" data-center="spent"
data-json='{{ {"labels": charts.cats.labels, "data": charts.cats.data, "colors": charts.cats.colors,
"links": charts.cats.links}|tojson }}'></canvas></div>
<div class="legend" id="cat-legend" style="margin-top:.6rem"></div>
{% else %}<div class="empty">{{ icon('pie-chart') }}<br>No spending this month yet.</div>{% endif %}
</div>
</div>
<div class="grid cols-3 mb">
<div class="card">
<div class="card-head"><h2>{{ icon('receipt') }} Top categories</h2>
{% if uncategorised %}<a class="badge warn" href="/transactions?category=none">{{ uncategorised }} uncategorised</a>{% endif %}</div>
<ul class="list">
{% set top = cats[0].total if cats else 1 %}
{% for c in cats[:8] %}
<li style="display:block">
<div class="row spread"><a class="cat" href="/transactions?month={{ start.strftime('%Y-%m') }}&category={{ c.id if c.id else 'none' }}{{ acc_q }}"><span class="dot" style="background:{{ c.color }}"></span>{{ c.name }} <span class="muted small" style="margin-left:.35rem">{{ c.count }}×</span></a>
<span class="num">{{ c.total|eur }}</span></div>
<div class="bar"><div style="width:{{ (c.total / top * 100)|round(1) }}%; background:{{ c.color }}"></div></div>
</li>
{% else %}<li class="empty" style="display:block">Nothing yet. <a href="/import">Import a statement</a>.</li>{% endfor %}
</ul>
</div>
<div class="card">
<div class="card-head"><h2>{{ icon('calendar-clock') }} Coming up</h2><a class="small" href="/recurring">All recurring</a></div>
<ul class="list">
{% for r in due %}<li><span class="cell-main"><span class="tx-ico tint-accent">{{ icon('repeat', 'sm') }}</span>
<span><strong>{{ r.name }}</strong><br><span class="muted small">{{ r.next_date.strftime('%a %d %b') }}</span></span></span><span class="num">{{ r.amount|eur }}</span></li>
{% else %}<li class="muted">Nothing due in the next 7 days.</li>{% endfor %}
</ul>
<p class="small muted" style="margin:.8rem 0 0">Fixed costs ≈ <strong style="color:var(--text)">{{ subs_month|eur }}</strong> per month</p>
</div>
<div class="card">
<div class="card-head"><h2>{{ icon('landmark') }} Accounts</h2><a class="small" href="/import">Import</a></div>
<ul class="list">
{% for a in accounts %}<li><span class="cell-main"><span class="tx-ico tint-accent">{{ icon('credit-card' if a.bank == 'revolut' else 'building-2', 'sm') }}</span>
<span><strong>{{ a.name }}</strong>{% if a.share_pct < 100 %} <span class="badge accent">{{ a.share_pct }}% mine</span>{% endif %}
<br><span class="muted small">{{ 'Updated ' + a.balance_date.strftime('%d %b') if a.balance_date else 'No balance yet' }}</span></span></span>
<span class="num" data-live="acc{{ a.id }}_balance" data-fmt="eur">{{ a.balance|eur }}</span></li>
{% else %}<li class="muted">No accounts yet.</li>{% endfor %}
</ul>
</div>
</div>
<div class="grid cols-3">
<div class="card span-2">
<div class="card-head"><h2>{{ icon('line-chart') }} Portfolio value vs paid</h2>
<div class="seg" data-range-for="pf-history">
<button type="button" data-days="30">1M</button><button type="button" data-days="90">3M</button>
<button type="button" data-days="180">6M</button><button type="button" data-days="365" class="on">1Y</button><button type="button" data-days="0">All</button>
</div></div>
{% if charts.portfolio.labels %}
<div class="chart-box"><canvas id="pf-history" data-chart="history" data-json='{{ charts.portfolio|tojson }}'></canvas></div>
{% else %}<div class="empty">{{ icon('line-chart') }}<br>History builds up automatically once you add holdings.</div>{% endif %}
</div>
<div class="card">
<div class="card-head"><h2>{{ icon('handshake') }} Debts</h2><a class="small" href="/debts">Manage</a></div>
<ul class="list">
{% for x, s in dstat %}<li style="display:block">
<div class="row spread"><span><a href="/debts/{{ x.id }}"><strong>{{ x.name }}</strong></a>
<span class="badge {{ 'bad' if s.status == 'behind' else ('good' if s.status in ('ahead','on track') else '') }}">{{ s.status }}</span></span>
<span class="num {{ 'bad' if x.direction == 'i_owe' else 'good' }}" data-live="d{{ x.id }}_remaining" data-fmt="eur0">{{ s.remaining|eur(0) }}</span></div>
<div class="progress" style="margin-top:.45rem"><div style="width:{{ [s.pct, 100]|min }}%"></div></div>
</li>{% else %}<li class="muted">No open debts.</li>{% endfor %}
</ul>
</div>
</div>
{% endblock %}
+52
View File
@@ -0,0 +1,52 @@
{% extends "base.html" %}
{% from "_debt_form.html" import debt_form with context %}
{% block title %}{{ d.name }}{% endblock %}
{% block content %}
<p><a class="btn ghost sm" href="/debts">{{ icon('chevron-left', 'sm') }} All debts</a></p>
<div class="page-head">
<h1>{{ d.name }} <span class="badge">{{ 'I owe' if d.direction == 'i_owe' else 'owed to me' }}</span>
{% if d.closed %}<span class="badge">closed</span>{% endif %}</h1>
<div class="actions">
{% if d.match_pattern %}<form method="post" action="/debts/{{ d.id }}/rematch"><button class="secondary sm">{{ icon('link', 'sm') }} Re-match bank</button></form>{% endif %}
<form method="post" action="/debts/{{ d.id }}/toggle"><button class="secondary sm">{{ 'Re-open' if d.closed else 'Close' }}</button></form>
<form method="post" action="/debts/{{ d.id }}/delete" data-confirm="Delete this debt and its payment history?"><button class="danger sm">{{ icon('trash-2', 'sm') }} Delete</button></form>
</div>
</div>
<div class="grid cols-4 mb">
<div class="card kpi"><div class="label">Remaining</div><div class="value">{{ s.remaining|eur }}</div><div class="sub">of {{ d.principal|eur }}</div></div>
<div class="card kpi"><div class="label">Paid</div><div class="value">{{ s.paid|eur }}</div>
<div class="progress"><div style="width:{{ [s.pct,100]|min }}%"></div></div></div>
<div class="card kpi"><div class="label">Status</div>
<div class="value {{ 'bad' if s.status == 'behind' else 'good' }}">{{ s.status }}</div>
<div class="sub">{% if s.expected is not none %}expected by now {{ s.expected|eur }} ({{ s.diff|eur(2, true) }}){% else %}set a monthly payment to track schedule{% endif %}</div></div>
<div class="card kpi"><div class="label">Next due</div><div class="value">{{ s.next_due.strftime('%d %b') if s.next_due else '—' }}</div>
<div class="sub">{{ 'paid off ≈ ' + s.payoff.strftime('%b %Y') if s.payoff }}</div></div>
</div>
<div class="grid cols-2">
<div class="card">
<h2>{{ icon('banknote') }} Payments</h2>
<form method="post" action="/debts/{{ d.id }}/payment" class="row mb">
<input type="date" name="date" value="{{ today().isoformat() }}">
<input name="amount" inputmode="decimal" placeholder="€" required style="width:110px">
<input name="notes" placeholder="note" style="width:140px">
<button class="sm">{{ icon('plus', 'sm') }} Add payment</button>
</form>
<div class="table-wrap"><table>
<thead><tr><th>Date</th><th class="num">Amount</th><th class="num">Balance after</th><th>Note</th><th></th></tr></thead>
<tbody>
{% for p, bal in running %}
<tr><td>{{ p.date.strftime('%d-%m-%Y') }}</td><td class="num">{{ p.amount|eur }}</td><td class="num">{{ bal|eur }}</td>
<td class="small">{{ p.notes }}{% if p.transaction_id %} <span class="badge accent" title="Matched from bank">{{ icon('landmark', 'sm') }} bank</span>{% endif %}</td>
<td><form method="post" action="/payments/{{ p.id }}/delete" data-confirm="Remove this payment?"><button class="sm ghost icon" title="Remove">{{ icon('trash-2', 'sm') }}</button></form></td></tr>
{% else %}<tr><td colspan="5" class="muted">No payments yet.</td></tr>{% endfor %}
</tbody>
</table></div>
</div>
<div class="card">
<h2>{{ icon('pencil') }} Details</h2>
{{ debt_form(d) }}
</div>
</div>
{% endblock %}
+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 %}
+48
View File
@@ -0,0 +1,48 @@
{% extends "base.html" %}
{% block title %}Import{% endblock %}
{% block content %}
<div class="page-head"><div><h1>Import statements</h1><div class="sub">ING (NL) and Revolut CSV exports · duplicates are skipped automatically</div></div></div>
<div class="grid cols-2">
<form class="card" method="post" enctype="multipart/form-data">
<h2>{{ icon('file-up') }} Upload CSV files</h2>
<p class="muted small">You can select several files at once. Re-importing overlapping periods is safe: duplicates are skipped.</p>
<div class="form-grid" style="grid-template-columns:1fr">
<label>Files<input type="file" name="files" accept=".csv,text/csv" multiple required></label>
<label>Account
<select name="account_id">
<option value="auto">Auto-detect (ING uses the IBAN in the file; Revolut goes to your Revolut account)</option>
{% for a in accounts %}<option value="{{ a.id }}">{{ a.name }}{{ ' · ' + a.iban if a.iban }}</option>{% endfor %}
</select></label>
<div><button>{{ icon('upload', 'sm') }} Import</button></div>
</div>
</form>
<div class="card">
<h2>{{ icon('download') }} Where to get the files</h2>
<p><strong>ING (main and shared):</strong> Mijn ING → account → <em>Af- en bijschrijvingen downloaden</em> → format
<em>Kommagescheiden CSV</em> or <em>Puntkomma-gescheiden</em>, pick a date range. Both formats work, Dutch or English headers.</p>
<p><strong>Revolut:</strong> app → account → ⋯ → <em>Statement</em> → <em>Excel</em>/<em>CSV</em>, pick the period. Only completed
transactions from the <em>Current</em> account are imported.</p>
<p class="muted small">Prefer automatic syncing? Set up Enable Banking under <a href="/settings#bank">Settings</a>.</p>
</div>
</div>
{% if results %}
<div class="card" style="margin-top:1rem">
<h2>Result</h2>
<div class="table-wrap"><table>
<thead><tr><th>File</th><th>Account</th><th class="num">New</th><th class="num">Duplicates</th><th class="num">Skipped</th><th class="num">Debt payments</th></tr></thead>
<tbody>
{% for r in results %}
{% if r.ok %}
<tr><td>{{ r.file }} <span class="badge">{{ r.fmt }}</span></td><td>{{ r.account }}</td><td class="num">{{ r.inserted }}</td>
<td class="num">{{ r.duplicates }}</td><td class="num">{{ r.skipped }}</td><td class="num">{{ r.debt_payments }}</td></tr>
{% else %}
<tr><td>{{ r.file }}</td><td colspan="5" class="bad">{{ r.error }}</td></tr>
{% endif %}
{% endfor %}
</tbody>
</table></div>
<p><a href="/transactions?category=none">Review uncategorised</a> · <a href="/recurring">Check recurring</a> · <a href="/">Dashboard</a></p>
</div>
{% endif %}
{% endblock %}
+146
View File
@@ -0,0 +1,146 @@
{% extends "base.html" %}
{% block title %}{{ title }}{% endblock %}
{% set is_gold = kinds == ['gold'] %}{% set P = 'gold' if is_gold else 'inv' %}
{% block content %}
<div class="page-head">
<div><h1>{{ title }}</h1>
<div class="sub">{{ 'Physical gold valued at live spot price' if is_gold else 'Stocks, ETFs and crypto at live prices' }} · <span class="live-status"></span></div></div>
<div class="actions">
<a class="btn secondary" href="#add-trade">{{ icon('plus', 'sm') }} {{ 'Purchase' if is_gold else 'Trade' }}</a>
<form method="post" action="/prices/refresh" data-ajax-refresh><button>{{ icon('refresh-cw', 'sm') }}<span> Refresh prices</span></button></form>
</div>
</div>
<div class="grid cols-4 mb">
{% set a = t.get('all') %}
<div class="card kpi"><div class="kpi-ico tint-accent">{{ icon('gem' if is_gold else 'line-chart') }}</div><div class="label">Current value</div><div class="value" data-live="{{ P }}_value" data-fmt="eur">{{ (a.value if a else 0)|eur }}</div>
<div class="sub">{% if a and a.missing_price %}<span class="warn">{{ a.missing_price }} without price (counted at cost)</span>{% else %}live prices{% endif %}</div></div>
<div class="card kpi"><div class="kpi-ico tint-warn">{{ icon('banknote') }}</div><div class="label">Paid</div><div class="value" data-live="{{ P }}_cost" data-fmt="eur">{{ (a.cost if a else 0)|eur }}</div><div class="sub">incl. fees, open positions</div></div>
<div class="card kpi"><div class="kpi-ico {{ 'tint-good' if a and a.pnl >= 0 else 'tint-bad' }}">{{ icon('arrow-up-right' if a and a.pnl >= 0 else 'arrow-down-right') }}</div><div class="label">Unrealised P/L</div>
<div class="value {{ 'good' if a and a.pnl >= 0 else 'bad' }}" data-live="{{ P }}_pnl" data-fmt="eurs" data-color>{{ (a.pnl if a else 0)|eur(2, true) }}</div><div class="sub" data-live="{{ P }}_pnl_pct" data-fmt="pct">{{ (a.pnl_pct if a else None)|pct }}</div></div>
<div class="card kpi"><div class="kpi-ico tint-accent">{{ icon('check') }}</div><div class="label">Realised P/L</div><div class="value" data-live="{{ P }}_realized" data-fmt="eurs">{{ (a.realized if a else 0)|eur(2, true) }}</div><div class="sub">from sells</div></div>
</div>
{% if not is_gold %}
<div class="grid cols-2 mb">
{% for k, label in [('stock','Stocks & ETFs'),('crypto','Crypto')] %}{% set x = t.get(k) %}
<div class="card kpi"><div class="kpi-ico tint-accent">{{ icon('bitcoin' if k == 'crypto' else 'bar-chart-3') }}</div><div class="label">{{ label }}</div>
<div class="value" data-live="{{ k }}_value" data-fmt="eur">{{ (x.value if x else 0)|eur }}</div>
<div class="sub">paid <span data-live="{{ k }}_cost" data-fmt="eur">{{ (x.cost if x else 0)|eur }}</span> · <span data-live="{{ k }}_pnl" data-fmt="eurs" data-color class="{{ 'good' if x and x.pnl >= 0 else 'bad' }}">{{ (x.pnl if x else 0)|eur(2, true) }}</span> (<span data-live="{{ k }}_pnl_pct" data-fmt="pct" data-color>{{ (x.pnl_pct if x else None)|pct }}</span>)</div></div>
{% endfor %}
</div>
{% endif %}
<div class="card mb">
<h2>{{ icon('coins') }} Holdings</h2>
<div class="table-wrap"><table>
<thead><tr><th>Asset</th>{% if not is_gold %}<th>Type</th>{% endif %}<th class="num">Quantity</th>{% if is_gold %}<th class="num">Fine gold</th>{% endif %}
<th class="num">Avg paid</th><th class="num">Price</th><th class="num">Paid</th><th class="num">Value</th><th class="num">P/L</th><th class="num">%</th><th></th></tr></thead>
<tbody>
{% for r in rows %}{% set as = r.asset %}
<tr>
<td><strong>{{ as.name }}</strong><div class="desc">{{ as.symbol }}{% if as.price_error %} · <span class="bad" title="{{ as.price_error }}">price error</span>{% endif %}
{% if as.manual_price is not none %} · <span class="warn">manual price</span>{% elif as.last_price_at %} · {{ as.last_price_at.strftime('%d-%m %H:%M') }}{% endif %}</div></td>
{% if not is_gold %}<td><span class="badge">{{ as.kind }}</span></td>{% endif %}
<td class="num">{{ r.qty|num }} {{ as.unit if as.unit != 'unit' }}{% if is_gold and as.purity != 1 %} <span class="muted small">@{{ as.purity|num }}</span>{% endif %}</td>
{% if is_gold %}<td class="num">{{ r.grams|num(2) }} g</td>{% endif %}
<td class="num">{{ r.avg|eur }}</td>
<td class="num" data-live="a{{ as.id }}_price" data-fmt="eur">{{ r.price|eur }}</td>
<td class="num">{{ r.cost|eur }}</td>
<td class="num"><strong data-live="a{{ as.id }}_value" data-fmt="eur">{{ r.value|eur }}</strong></td>
<td class="num {{ 'good' if r.pnl and r.pnl >= 0 else 'bad' }}" data-live="a{{ as.id }}_pnl" data-fmt="eurs" data-color>{{ r.pnl|eur(2, true) }}</td>
<td class="num {{ 'good' if r.pnl and r.pnl >= 0 else 'bad' }}" data-live="a{{ as.id }}_pnl_pct" data-fmt="pct" data-color>{{ r.pnl_pct|pct }}</td>
<td style="white-space:nowrap">
<details><summary class="small muted">{{ icon('pencil', 'sm') }}</summary>
<form method="post" action="/assets/{{ as.id }}/update" class="row small" style="margin:.4rem 0">
<input name="symbol" value="{{ as.symbol }}" style="width:110px" title="Ticker / CoinGecko id">
<input name="manual_price" value="{{ as.manual_price if as.manual_price is not none else '' }}" placeholder="manual €/unit" style="width:110px">
<button class="sm">Save</button></form>
<form method="post" action="/assets/{{ as.id }}/delete" data-confirm="Delete {{ as.name }} and all its trades?"><button class="sm danger">Delete</button></form>
</details></td>
</tr>
{% else %}<tr><td colspan="11" class="muted">No holdings yet. Add an asset below, then record your purchases.</td></tr>{% endfor %}
</tbody>
</table></div>
</div>
<div class="grid cols-3 mb">
<div class="card span-2">
<div class="card-head"><h2>{{ icon('line-chart') }} Value vs paid</h2>
<div class="seg" data-range-for="inv-history">
<button type="button" data-days="30">1M</button><button type="button" data-days="90">3M</button>
<button type="button" data-days="180">6M</button><button type="button" data-days="365" class="on">1Y</button><button type="button" data-days="0">All</button>
</div></div>
{% if chart.labels %}
<div class="chart-box tall"><canvas id="inv-history" data-chart="history" data-json='{{ {"labels": chart.labels, "value": chart.value, "cost": chart.cost}|tojson }}'></canvas></div>
{% else %}<div class="empty">{{ icon('line-chart') }}<br>A data point is stored each time prices refresh.</div>{% endif %}
</div>
<div class="card">
<div class="card-head"><h2>{{ icon('pie-chart') }} Allocation</h2></div>
{% if chart.alloc_values %}
<div class="chart-box sm"><canvas data-chart="donut" data-legend="alloc-legend" data-json='{{ {"labels": chart.alloc_labels, "data": chart.alloc_values}|tojson }}'></canvas></div>
<div class="legend" id="alloc-legend" style="margin-top:.6rem"></div>
{% else %}<div class="empty">{{ icon('pie-chart') }}<br>No priced holdings yet.</div>{% endif %}
</div>
</div>
<div class="grid cols-2 mb">
<form class="card" method="post" action="/trades/add" id="add-trade">
<h2>{{ icon('plus') }} Record a {{ 'purchase' if is_gold else 'trade' }}</h2>
{% if assets %}
<div class="form-grid">
<label>Asset<select name="asset_id">{% for as in assets %}<option value="{{ as.id }}">{{ as.name }}</option>{% endfor %}</select></label>
<label>Buy / sell<select name="side"><option value="buy">Buy</option><option value="sell">Sell</option></select></label>
<label>Date<input type="date" name="date" value="{{ today().isoformat() }}"></label>
<label>Quantity{{ ' (grams/oz/pieces)' if is_gold }}<input name="quantity" inputmode="decimal" required></label>
<label>Price per unit (€)<input name="price" inputmode="decimal" placeholder="or fill total →"></label>
<label>…or total paid (€)<input name="total" inputmode="decimal"></label>
<label>Fees (€)<input name="fees" inputmode="decimal" value="0"></label>
<label>Note<input name="notes"></label>
<div><button>Save</button></div>
</div>
{% else %}<p class="muted">Add an asset first →</p>{% endif %}
</form>
<form class="card" method="post" action="/assets/add">
<h2>{{ icon('sparkles') }} Add an asset</h2>
{% if is_gold %}
<input type="hidden" name="kind" value="gold">
<div class="form-grid">
<label>Name<input name="name" required placeholder="Gold bar 100g / Krugerrand"></label>
<label>Unit<select name="unit"><option value="gram">gram</option><option value="oz">troy ounce</option></select></label>
<label>Purity<select name="purity"><option value="0.9999">24k · 999,9</option><option value="0.9167">22k · 916 (Krugerrand, Sovereign)</option>
<option value="0.900">900 (Gulden/Napoleon)</option><option value="0.750">18k · 750</option><option value="0.585">14k · 585</option><option value="0.333">8k · 333</option></select></label>
<label>Price source<input name="symbol" value="GC=F" title="Yahoo symbol, USD/oz. GC=F = gold, SI=F = silver"></label>
<div><button>Add</button></div>
</div>
<p class="small muted">Quantity is the item's total weight in the chosen unit; value = weight × purity × spot. Spot is the COMEX gold price
converted to EUR; dealers usually buy back 1–3 % below spot (set a manual price per item if you want to be conservative).</p>
{% else %}
<div class="form-grid">
<label>Name<input name="name" required placeholder="Vanguard FTSE All-World"></label>
<label>Type<select name="kind"><option value="stock">Stock / ETF</option><option value="crypto">Crypto</option></select></label>
<label>Symbol<input name="symbol" required placeholder="VWRL.AS · bitcoin"></label>
<div><button>Add</button></div>
</div>
<p class="small muted"><strong>Stocks/ETFs:</strong> Yahoo Finance ticker incl. exchange suffix (VWRL.AS, IWDA.AS, ASML.AS, AAPL), converted to EUR.
<strong>Crypto:</strong> CoinGecko id (bitcoin, ethereum, solana, cardano…) — find it in the coin's URL on coingecko.com.</p>
{% endif %}
</form>
</div>
<div class="card">
<h2>{{ icon('clock') }} History</h2>
<div class="table-wrap"><table>
<thead><tr><th>Date</th><th>Asset</th><th>Side</th><th class="num">Qty</th><th class="num">Price</th><th class="num">Fees</th><th class="num">Total</th><th>Note</th><th></th></tr></thead>
<tbody>
{% for tr in trades %}
<tr><td>{{ tr.date.strftime('%d-%m-%Y') }}</td><td>{{ tr.asset.name }}</td><td><span class="badge {{ 'good' if tr.side == 'buy' else 'warn' }}">{{ tr.side }}</span></td>
<td class="num">{{ tr.quantity|num }}</td><td class="num">{{ tr.price|eur }}</td><td class="num">{{ tr.fees|eur }}</td>
<td class="num">{{ (tr.quantity * tr.price + (tr.fees if tr.side == 'buy' else -tr.fees))|eur }}</td><td class="small">{{ tr.notes }}</td>
<td><form method="post" action="/trades/{{ tr.id }}/delete" data-confirm="Delete this trade?"><button class="sm ghost icon" title="Delete">{{ icon('trash-2', 'sm') }}</button></form></td></tr>
{% else %}<tr><td colspan="9" class="muted">No trades yet.</td></tr>{% endfor %}
</tbody>
</table></div>
</div>
{% endblock %}
+63
View File
@@ -0,0 +1,63 @@
{% extends "base.html" %}
{% block title %}Recurring{% endblock %}
{% block content %}
<div class="page-head">
<div><h1>Recurring payments</h1><div class="sub">Subscriptions and fixed costs, detected from your statements</div></div>
<div class="actions"><a class="btn secondary" href="#add-recurring">{{ icon('plus', 'sm') }} Add manually</a>
<form method="post" action="/recurring/detect"><button>{{ icon('search', 'sm') }} Re-scan</button></form></div>
</div>
<div class="grid cols-3 mb">
<div class="card kpi"><div class="kpi-ico tint-accent">{{ icon('calendar-clock') }}</div><div class="label">Fixed costs / month</div><div class="value">{{ out_total|eur }}</div><div class="sub">{{ (out_total*12)|eur(0) }} per year</div></div>
<div class="card kpi"><div class="kpi-ico tint-good">{{ icon('piggy-bank') }}</div><div class="label">Recurring income / month</div><div class="value">{{ in_total|eur }}</div><div class="sub">add salary manually below</div></div>
<div class="card kpi"><div class="kpi-ico tint-bad">{{ icon('alert-triangle') }}</div><div class="label">Missed</div>
{% set ns = namespace(m=0) %}{% for r in recs %}{% if rec_state(r) == 'missed' %}{% set ns.m = ns.m + 1 %}{% endif %}{% endfor %}
<div class="value {{ 'bad' if ns.m }}">{{ ns.m }}</div><div class="sub">past expected date + grace period</div></div>
</div>
<div class="card mb">
<div class="card-head"><h2>{{ icon('repeat') }} Payments</h2>
<div class="seg"><a class="{{ 'on' if show == 'active' }}" href="?show=active">Active</a><a class="{{ 'on' if show == 'ignored' }}" href="?show=ignored">Ignored</a><a class="{{ 'on' if show == 'all' }}" href="?show=all">All</a></div>
</div>
<div class="table-wrap"><table>
<thead><tr><th>Name</th><th>State</th><th>Every</th><th class="num">Amount</th><th class="num">/ month</th><th>Last paid</th><th>Next expected</th><th>Account</th><th></th></tr></thead>
<tbody>
{% for r in recs %}{% set st = rec_state(r) %}
<tr>
<td><strong>{{ r.name }}</strong> {% if r.status == 'detected' %}<span class="badge" title="auto-detected, not confirmed yet">new</span>{% endif %}
<div class="desc">match: “{{ r.match }}” · {{ r.occurrences }}× {{ '· ' + r.category.name if r.category }}</div></td>
<td>{% if st == 'missed' %}<span class="badge bad">missed</span>{% elif st == 'due-soon' %}<span class="badge warn">due soon</span>
{% elif st == 'ignored' %}<span class="badge">ignored</span>{% else %}<span class="badge good">ok</span>{% endif %}</td>
<td>
<form method="post" action="/recurring/{{ r.id }}/update" class="inline">
<select name="frequency" data-autosubmit>{% for fq in ['weekly','monthly','quarterly','yearly'] %}<option {{ 'selected' if r.frequency == fq }}>{{ fq }}</option>{% endfor %}</select>
</form></td>
<td class="num">{{ r.amount|eur }}</td>
<td class="num muted">{{ monthly_eq(r)|eur }}</td>
<td class="small">{{ r.last_date.strftime('%d-%m-%Y') if r.last_date else '—' }}</td>
<td class="small">{{ r.next_date.strftime('%d-%m-%Y') if r.next_date else '—' }}</td>
<td class="small">{{ r.account.name if r.account else '' }}</td>
<td style="white-space:nowrap">
{% if r.status != 'confirmed' %}<form class="inline" method="post" action="/recurring/{{ r.id }}/update"><input type="hidden" name="status" value="confirmed"><button class="sm ghost icon" title="Confirm">{{ icon('check', 'sm') }}</button></form>{% endif %}
{% if r.status != 'ignored' %}<form class="inline" method="post" action="/recurring/{{ r.id }}/update"><input type="hidden" name="status" value="ignored"><button class="sm ghost icon" title="Ignore (cancelled / not recurring)">{{ icon('eye-off', 'sm') }}</button></form>{% endif %}
<a class="btn ghost sm icon" title="Show transactions" href="/transactions?q={{ r.match|urlencode }}">{{ icon('receipt', 'sm') }}</a>
</td>
</tr>
{% else %}<tr><td colspan="9" class="muted">Nothing detected yet. Import at least 3 months of statements, then re-scan.</td></tr>{% endfor %}
</tbody>
</table></div>
</div>
<details class="card" id="add-recurring">
<summary>{{ icon('plus') }} Add a recurring payment manually <span class="muted small">(rent, salary, yearly insurance…)</span></summary>
<form method="post" action="/recurring/add" class="form-grid">
<label>Name<input name="name" required placeholder="Rent"></label>
<label>Matches counterparty text<input name="match" required placeholder="woonstichting"></label>
<label>Direction<select name="direction"><option value="out">Money out</option><option value="in">Money in</option></select></label>
<label>Amount (€)<input name="amount" inputmode="decimal" required></label>
<label>Frequency<select name="frequency"><option>monthly</option><option>weekly</option><option>quarterly</option><option>yearly</option></select></label>
<label>Next due date<input type="date" name="next_date" required></label>
<div><button>Add</button></div>
</form>
</details>
{% endblock %}
+114
View File
@@ -0,0 +1,114 @@
{% extends "base.html" %}
{% block title %}Settings{% endblock %}
{% block content %}
<div class="page-head"><div><h1>Settings</h1><div class="sub">Accounts, bank sync, categories and rules</div></div></div>
<div class="card mb" id="accounts">
<h2>{{ icon('landmark') }} Accounts</h2>
<p class="small muted">Add the IBANs of all your own accounts (including Revolut's) so transfers between them are recognised and not counted as spending.
“Your share” scales a joint account's spending, e.g. 50 for the shared house account.</p>
<div class="table-wrap"><table>
<thead><tr><th>Name</th><th>Bank</th><th>IBAN</th><th>Your share %</th><th class="num">Balance</th><th>Bank sync</th><th></th></tr></thead>
<tbody>
{% for a in accounts %}
<tr>
<td><form id="acc{{ a.id }}" method="post" action="/accounts/save"><input type="hidden" name="id" value="{{ a.id }}"></form>
<input form="acc{{ a.id }}" name="name" value="{{ a.name }}" required style="width:160px"></td>
<td><select form="acc{{ a.id }}" name="bank">{% for b in ['ing','revolut','other'] %}<option {{ 'selected' if a.bank == b }}>{{ b }}</option>{% endfor %}</select></td>
<td><input form="acc{{ a.id }}" name="iban" value="{{ a.iban or '' }}" style="width:200px"></td>
<td><input form="acc{{ a.id }}" name="share_pct" type="number" min="0" max="100" value="{{ a.share_pct }}" style="width:80px"></td>
<td class="num">{{ a.balance|eur }}</td>
<td class="small">{{ ('linked · ' + (a.eb_last_sync.strftime('%d-%m %H:%M') if a.eb_last_sync else 'never synced')) if a.eb_account_uid else '—' }}</td>
<td style="white-space:nowrap"><button form="acc{{ a.id }}" class="sm">Save</button>
<form class="inline" method="post" action="/accounts/{{ a.id }}/delete" data-confirm="Delete {{ a.name }} AND all its transactions?"><button class="sm ghost icon" title="Delete">{{ icon('trash-2', 'sm') }}</button></form></td>
</tr>
{% endfor %}
<tr>
<td><form id="accnew" method="post" action="/accounts/save"></form><input form="accnew" name="name" required placeholder="ING shared (house)" style="width:160px"></td>
<td><select form="accnew" name="bank"><option>ing</option><option>revolut</option><option>other</option></select></td>
<td><input form="accnew" name="iban" placeholder="NL00INGB0000000000" style="width:200px"></td>
<td><input form="accnew" name="share_pct" type="number" min="0" max="100" value="100" style="width:80px"></td>
<td></td><td></td><td><button form="accnew" class="sm">Add</button></td></tr>
</tbody>
</table></div>
</div>
<div class="card mb" id="bank">
<h2>{{ icon('refresh-cw') }} Automatic bank sync (Enable Banking)</h2>
{% if eb_configured %}
<p class="small">Configured ✓. New transactions are pulled every few hours. Bank consent expires (usually after 90–180 days); reconnect when it does.</p>
{% if eb_valid %}<ul class="list small">{% for k, v in eb_valid.items() %}<li><span>{{ k }}</span><span>consent valid until {{ v[:10] }}</span></li>{% endfor %}</ul>{% endif %}
<div class="row" style="margin-top:.75rem">
<form method="post" action="/eb/connect" class="row">
<select name="aspsp" id="aspsp"><option>ING</option><option>Revolut</option></select>
<select name="country"><option>NL</option><option>LT</option></select>
<button>Connect / renew</button>
</form>
<form method="post" action="/eb/sync"><button class="secondary">Sync now</button></form>
</div>
<p class="small muted">Bank names must match Enable Banking's list exactly (<a href="/eb/banks?country=NL" target="_blank">NL list</a>).
Revolut may be listed under LT. In free restricted mode, first link the same accounts in the Enable Banking control panel.</p>
{% else %}
<p class="small">Not configured. You can keep importing CSVs, or enable sync:</p>
<ol class="small">
<li>Sign up at enablebanking.com and create an application (environment: <em>Production</em>, redirect URL: <code>{{ request.base_url }}eb/callback</code>).</li>
<li>Download the private key to <code>./secrets/enablebanking.pem</code> and put the application ID in <code>.env</code> as <code>EB_APP_ID</code>.</li>
<li>In the Enable Banking control panel, use <em>Link accounts</em> for ING and Revolut (needed for the free restricted mode).</li>
<li><code>docker compose up -d</code>, then come back here and press Connect.</li>
</ol>
{% endif %}
</div>
<div class="grid cols-2">
<div class="card" id="categories">
<h2>{{ icon('pie-chart') }} Categories</h2>
<p class="small muted">Kind “transfer” is excluded from income/expense totals (own-account moves, investing, savings).</p>
<div class="table-wrap"><table>
<thead><tr><th></th><th>Name</th><th>Kind</th><th class="num">Txns</th><th></th></tr></thead>
<tbody>
{% for c in categories %}
<tr>
<td><form id="cat{{ c.id }}" method="post" action="/categories/save"><input type="hidden" name="id" value="{{ c.id }}"></form>
<input form="cat{{ c.id }}" type="color" name="color" value="{{ c.color }}"></td>
<td><input form="cat{{ c.id }}" name="name" value="{{ c.name }}" style="width:140px"></td>
<td><select form="cat{{ c.id }}" name="kind">{% for k in ['expense','income','transfer'] %}<option {{ 'selected' if c.kind == k }}>{{ k }}</option>{% endfor %}</select></td>
<td class="num"><a href="/transactions?category={{ c.id }}">{{ counts.get(c.id, 0) }}</a></td>
<td style="white-space:nowrap"><button form="cat{{ c.id }}" class="sm">Save</button>
<form class="inline" method="post" action="/categories/{{ c.id }}/delete" data-confirm="Delete category {{ c.name }}? Its rules go too; transactions become uncategorised."><button class="sm ghost icon" title="Delete">{{ icon('trash-2', 'sm') }}</button></form></td></tr>
{% endfor %}
<tr><td><form id="catnew" method="post" action="/categories/save"></form><input form="catnew" type="color" name="color" value="#888888"></td>
<td><input form="catnew" name="name" required placeholder="New category" style="width:140px"></td>
<td><select form="catnew" name="kind"><option>expense</option><option>income</option><option>transfer</option></select></td><td></td>
<td><button form="catnew" class="sm">Add</button></td></tr>
</tbody>
</table></div>
</div>
<div class="card" id="rules">
<h2>{{ icon('sparkles') }} Categorisation rules</h2>
<form method="post" action="/rules/add" class="form-grid mb">
<label>Text to match<input name="pattern" required value="{{ prefill.get('rule', '') }}" placeholder="albert heijn or re:^ah\b"></label>
<label>In<select name="field"><option value="any">name + description</option><option value="counterparty">name</option>
<option value="description">description</option><option value="iban">counter IBAN (exact)</option></select></label>
<label>Category<select name="category_id">{% for c in categories %}<option value="{{ c.id }}">{{ c.name }}</option>{% endfor %}</select></label>
<label>Priority<input type="number" name="priority" value="10" title="lower runs first"></label>
<div><button>Add &amp; apply</button></div>
</form>
<p class="small muted">Matches whole words, case-insensitive. Prefix with <code>re:</code> for a regular expression. Lower priority wins.</p>
<div class="row mb">
<form method="post" action="/rules/apply"><input type="hidden" name="only_uncategorised" value="1"><button class="secondary sm">Apply to uncategorised</button></form>
<form method="post" action="/rules/apply" data-confirm="Re-run all rules on every transaction that wasn't set manually?"><button class="secondary sm">Re-apply to all (except locked)</button></form>
</div>
<div class="table-wrap" style="max-height:480px; overflow-y:auto"><table>
<thead><tr><th>Pattern</th><th>In</th><th>Category</th><th class="num">Prio</th><th></th></tr></thead>
<tbody>
{% for r in rules %}
<tr><td><code>{{ r.pattern }}</code></td><td class="small">{{ r.field }}</td><td><span class="dot" style="background:{{ r.category.color }}"></span>{{ r.category.name }}</td>
<td class="num">{{ r.priority }}</td>
<td><form method="post" action="/rules/{{ r.id }}/delete"><button class="sm ghost icon" title="Delete">{{ icon('trash-2', 'sm') }}</button></form></td></tr>
{% endfor %}
</tbody>
</table></div>
</div>
</div>
{% endblock %}
+49
View File
@@ -0,0 +1,49 @@
{% extends "base.html" %}
{% block title %}Transactions{% endblock %}
{% block content %}
<div class="page-head"><div><h1>Transactions</h1><div class="sub">{{ total }} transactions · net <strong>{{ total_amount|eur }}</strong></div></div>
<div class="actions"><a class="btn secondary" href="/transactions?category=none">{{ icon('filter', 'sm') }} Uncategorised</a><a class="btn" href="/import">{{ icon('upload', 'sm') }} Import</a></div></div>
<form class="card mb form-grid" method="get">
<label>Search<input name="q" value="{{ f.q }}" placeholder="name, description, note"></label>
<label>Account<select name="account"><option value="">All</option>
{% for a in accounts %}<option value="{{ a.id }}" {{ 'selected' if f.account == a.id|string }}>{{ a.name }}</option>{% endfor %}</select></label>
<label>Category<select name="category"><option value="">All</option><option value="none" {{ 'selected' if f.category == 'none' }}>— Uncategorised —</option>
{% for c in categories %}<option value="{{ c.id }}" {{ 'selected' if f.category == c.id|string }}>{{ c.name }}</option>{% endfor %}</select></label>
<label>Month<input type="month" name="month" value="{{ f.month }}"></label>
<div class="row"><button>{{ icon('search', 'sm') }} Filter</button><a class="btn ghost" href="/transactions">Reset</a></div>
</form>
<div class="card">
<div class="card-head"><h2>{{ icon('receipt') }} Activity</h2><span class="small muted">{{ icon('lock', 'sm') }} Changing a category locks it so rules won't overwrite it.</span></div>
<div class="table-wrap">
<table>
<thead><tr><th>Date</th><th>Counterparty</th><th>Account</th><th>Category</th><th class="num">Amount</th><th>Note</th><th></th></tr></thead>
<tbody>
{% for t in txs %}
<tr>
<td class="small" style="white-space:nowrap">{{ t.date.strftime('%d-%m-%Y') }}</td>
<td><div class="cell-main"><span class="tx-ico {{ 'tint-good' if t.amount > 0 else 'tint-accent' }}">{{ icon('arrow-down-right' if t.amount > 0 else 'arrow-up-right', 'sm') }}</span>
<div><strong>{{ t.counterparty or '—' }}</strong>{% if t.recurring_id %} <span class="badge accent" title="Recurring">{{ icon('repeat', 'sm') }}</span>{% endif %}{% if t.debt_id %} <a class="badge warn" href="/debts/{{ t.debt_id }}" title="Debt payment">{{ icon('handshake', 'sm') }}</a>{% endif %}
<div class="desc" title="{{ t.description }}">{{ t.counter_iban or '' }} {{ t.description }}</div></div></div></td>
<td class="small">{{ t.account.name }}</td>
<td style="white-space:nowrap"><span class="dot" style="background:{{ t.category.color if t.category else 'transparent' }}; outline:1px solid var(--line)"></span><select data-tx="{{ t.id }}"><option value="">—</option>
{% for c in categories %}<option value="{{ c.id }}" data-color="{{ c.color }}" {{ 'selected' if t.category_id == c.id }}>{{ c.name }}</option>{% endfor %}</select>
{% if t.category_locked %}<span class="muted" title="Set manually">{{ icon('lock', 'sm') }}</span>{% endif %}</td>
<td class="num {{ 'good' if t.amount > 0 else '' }}" style="font-weight:600">{{ t.amount|eur }}{% if t.currency != 'EUR' %} <span class="muted small">{{ t.currency }}</span>{% endif %}</td>
<td><input data-notes="{{ t.id }}" value="{{ t.notes }}" placeholder="…" style="width:120px"></td>
<td><a class="btn ghost sm" title="Create a rule from this" href="/settings?rule={{ (t.counterparty or '')|urlencode }}#rules">{{ icon('plus', 'sm') }} Rule</a></td>
</tr>
{% else %}<tr><td colspan="7" class="muted">No transactions match.</td></tr>{% endfor %}
</tbody>
</table>
</div>
{% if pages > 1 %}
<div class="pager">
{% set qs = 'q=%s&account=%s&category=%s&month=%s'|format(f.q|urlencode, f.account, f.category, f.month) %}
{% if page > 1 %}<a class="btn secondary sm" href="?{{ qs }}&page={{ page-1 }}">‹ Prev</a>{% endif %}
<span class="muted">Page {{ page }} / {{ pages }}</span>
{% if page < pages %}<a class="btn secondary sm" href="?{{ qs }}&page={{ page+1 }}">Next ›</a>{% endif %}
</div>
{% endif %}
</div>
{% endblock %}