Files
2026-11-17 21:48:36 +01:00

64 lines
5.0 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% 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 %}