fix: json-form-Extension fuer Standalone-Elemente, Kontoname in Buchungsliste

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-17 18:53:23 +02:00
parent a6009c47e3
commit 3847398055
2 changed files with 7 additions and 3 deletions

View File

@@ -84,9 +84,11 @@ def buchungen(
offset=0,
session=session,
)
accounts = session.execute(select(Account)).scalars().all()
return templates.TemplateResponse(request, "transactions.html", {
"transactions": txs,
"accounts": session.execute(select(Account)).scalars().all(),
"accounts": accounts,
"account_names": {a.id: a.name for a in accounts},
"categories": session.execute(select(Category)).scalars().all(),
"filters": {
"account_id": account_id,

View File

@@ -50,7 +50,7 @@
{% for tx in transactions %}
<tr>
<td>{{ tx.booking_date.strftime('%d.%m.%Y') }}</td>
<td>{{ tx.account_id }}</td>
<td>{{ account_names.get(tx.account_id, tx.account_id) }}</td>
<td>{{ tx.purpose }}</td>
<td>{{ tx.counterparty }}</td>
<td class="{{ 'neg' if tx.amount < 0 else '' }}">{{ '%.2f'|format(tx.amount) }} €</td>
@@ -128,7 +128,9 @@
var out = {};
for (var k in parameters) {
var v = parameters[k];
var field = elt.querySelector('[name="' + k + '"]');
var field = elt.matches && elt.matches('[name="' + k + '"]')
? elt
: elt.querySelector('[name="' + k + '"]');
var kind = field && field.dataset ? field.dataset.type : null;
if (v === '') {
out[k] = null;