Fix bugs with empty tables

This commit is contained in:
2025-05-19 12:14:23 +02:00
parent 4ee1d99224
commit cd2b7ae14c
4 changed files with 89 additions and 81 deletions

View File

@@ -92,75 +92,79 @@
</button>
</form>
<p>Füge bestehendem Prepaid-User Geld hinzu:</p>
<form
method="post"
action="/add_money_prepaid_user"
style="
display: flex;
gap: 1em;
align-items: center;
margin-bottom: 1em;
background: var(--hellgrau);
padding: 1em;
border-radius: 8px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
max-width: 600px;
"
>
<label
for="addmoney-username"
style="margin: 0 0.5em 0 0; font-weight: bold"
>Username:</label
>
<select
id="addmoney-username"
name="username"
required
{% if db_users_prepaid %}
<form
method="post"
action="/add_money_prepaid_user"
style="
padding: 0.5em;
border: 1px solid #ccc;
border-radius: 4px;
display: flex;
gap: 1em;
align-items: center;
margin-bottom: 1em;
background: var(--hellgrau);
padding: 1em;
border-radius: 8px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
max-width: 600px;
"
>
{% for db_user in db_users_prepaid %}
<option value="{{ db_user.username }}">
{{ db_user.username }}
</option>
{% endfor %}
</select>
<label
for="addmoney-money"
style="margin: 0 0.5em 0 0; font-weight: bold"
>Amount (€):</label
>
<input
id="addmoney-money"
type="number"
name="money"
placeholder="Money"
step="0.01"
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;
"
>
Add Money
</button>
</form>
<label
for="addmoney-username"
style="margin: 0 0.5em 0 0; font-weight: bold"
>Username:</label
>
<select
id="addmoney-username"
name="username"
required
style="
padding: 0.5em;
border: 1px solid #ccc;
border-radius: 4px;
"
>
{% for db_user in db_users_prepaid %}
<option value="{{ db_user.username }}">
{{ db_user.username }}
</option>
{% endfor %}
</select>
<label
for="addmoney-money"
style="margin: 0 0.5em 0 0; font-weight: bold"
>Amount (€):</label
>
<input
id="addmoney-money"
type="number"
name="money"
placeholder="Money"
step="0.01"
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;
"
>
Add Money
</button>
</form>
{% else %}
<p>Es sind keine Prepaid-User vorhanden.</p>
{% endif %}
{% endif %}
{% if 'Fachschaft Admins' in user.groups %}
<h2>Admin Interface</h2>
@@ -405,6 +409,7 @@
</form>
<h3>Prepaid Liste</h3>
<p>Users in prepaid database:</p>
{% if db_users_prepaid %}
<table>
<thread>
<tr>
@@ -418,7 +423,6 @@
</tr>
</thread>
<tbody>
{% if db_users_prepaid %}
{% for prepaid_user_i in db_users_prepaid %}
<tr
{%
@@ -454,13 +458,6 @@
</td>
</tr>
{% endfor %}
{% else %}
<tr>
<td colspan="7" style="text-align: center">
No users in prepaid database
</td>
</tr>
{% endif %}
</tbody>
</table>
<p>(De-)Activate User</p>
@@ -514,6 +511,13 @@
Toggle Activation
</button>
</form>
{% else %}
<tr>
<td colspan="7" style="text-align: center">
No users in prepaid database
</td>
</tr>
{% endif %}
{% endif %} {% endif %}
</main>
</body>