Add transaction history
Test FastAPI Startup / fastapi-up (push) Has been cancelled

Co-authored-by: Sebastian Beckmann <beckmann.sebastian@outlook.de>
This commit is contained in:
2026-07-03 18:07:31 +02:00
co-authored by Sebastian Beckmann
parent daa2d80397
commit 9f918c40e0
5 changed files with 165 additions and 24 deletions
+7 -10
View File
@@ -24,16 +24,13 @@
fill: #0366d6;
}
</style>
<a class="github-icon-link" href="https://github.com/Moritz921/GetraenkelisteWebsite" target="_blank" title="GitHub" rel="noopener">
<svg viewBox="0 0 16 16" aria-hidden="true">
<path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38
0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52
-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2
-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64
-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08
2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01
1.93-.01 2.19 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/>
</svg>
<a class="github-icon-link" href="https://git.fs.cs.uni-frankfurt.de/Fachschaft/GetraenkelisteWebsite" target="_blank" title="Gitea" rel="noopener">
<img
src="/static/gitea.svg"
alt="Gitea Logo"
height="64"
width="64"
/>
</a>
</head>
<body>
+75 -2
View File
@@ -242,7 +242,81 @@ content %}
<p>Es sind keine Prepaid-User vorhanden.</p>
{% endif %}
{% endif %}
{% if 'Getraenkeliste Verantwortliche' in user.groups %}
{% if drink_history %}
<style>
.hidden {
display: none
}
</style>
<h3>Historie</h3>
<table>
<thead>
<tr>
<th style="padding: 0.5em 1em">Datum / Uhrzeit</th>
<th style="padding: 0.5em 1em">Veränderung</th>
<th style="padding: 0.5em 1em">Neuer Kontostand</th>
<th style="padding: 0.5em 1em">Transaktionsart</th>
<th style="padding: 0.5em 1em">Icon</th>
</tr>
</thead>
<tbody>
{% for drink in drink_history %}
{% if loop.index <= 10 %}
<tr>
{% else %}
<tr class="long-history-hidden hidden">
{% endif %}
<td style="padding: 0.5em 1em">{{ drink.timestamp }} UTC</td>
<td style="padding: 0.5em 1em">
{% if drink.delta_money > 0 %}
+{{ drink.delta_money / 100}} €
{% else %}
{{ drink.delta_money / 100}} €
{% endif %}
</td>
<td style="padding: 0.5em 1em">{{ drink.new_money / 100}} €</td>
<td style="padding: 0.5em 1em">
{% if drink.description == "Drink button pressed" %}
Strich hinzugefügt
{% elif drink.description == "Reverted last drink" %}
Strich rückgängig gemacht
{% elif drink.description == "Set money manually via Admin UI" %}
Änderung durch Admin
{% else %}
{{ drink.description }}
{% endif %}
</td>
<td style="padding: 0.5em 1em">
{% if drink.icon %}
<img src="/static/drinks/{{ drink.icon }}" alt="{{ drink.icon }}" style="width:48px; height:48px; object-fit:contain;">
{% elif drink.description == "Drink button pressed" %}
:(
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="long-history-hidden hidden">Es werden maximal 100 Ergebnisse angezeigt.</div>
<button id="history-expand" class="long-history-hidden-inv">Mehr anzeigen</button>
<button id="history-collapse" class="long-history-hidden hidden" type="button">Weniger anzeigen</button>
<script>
const hidden = () => document.querySelectorAll('.long-history-hidden');
const hidden_inv = () => document.querySelectorAll('.long-history-hidden-inv');
document.getElementById('history-expand').addEventListener('click', () => {
hidden().forEach(el => el.classList.remove('hidden'));
hidden_inv().forEach(el => el.classList.add('hidden'));
});
document.getElementById('history-collapse').addEventListener('click', () => {
hidden().forEach(el => el.classList.add('hidden'));
hidden_inv().forEach(el => el.classList.remove('hidden'));
});
</script>
{% endif %}
{% if 'Getraenkeliste Verantwortliche' in user.groups %}
<h2>Admin Interface</h2>
<p>Ausgleichszahlung:</p>
<p>Der eingegebene Betrag wird vom aktuell eingeloggten Nutzer abgezogen und dem eingetragenem Nutzer gutgeschrieben.</p>
@@ -403,7 +477,6 @@ content %}
<input id="drink_type_quantity" type="number" name="quantity" min="0" step="1" required style="padding: 0.5em; border: 1px solid #ccc; border-radius: 4px; width: 100px;" />
<button type="submit" style="padding: 0.5em 1em; background: rgb(0, 97, 143); color: #fff; border: none; border-radius: 4px; cursor: pointer;">Setzen</button>
</form>
{% endif %}
{% endif %}