First commit
This commit is contained in:
@@ -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 & 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 %}
|
||||
Reference in New Issue
Block a user