This commit is contained in:
2026-08-28 00:18:26 +02:00
parent 0a74773ca6
commit 4de752cae3
2 changed files with 20 additions and 40 deletions
+20
View File
@@ -3313,6 +3313,16 @@ def admin_invoices():
invoices = list(col.find().sort("created_at", -1))
for item in invoices:
item["id"] = str(item.get("_id"))
# Fehlerbehebung: Betrag für das Template in Float umwandeln
amt = item.get("amount_eur", 0)
if isinstance(amt, str):
try:
amt = float(amt.replace('.', '').replace(',', '.'))
except ValueError:
amt = 0.0
item["amount_eur"] = amt
except PyMongoError:
flash("Rechnungen konnten nicht geladen werden.", "error")
finally:
@@ -3326,6 +3336,16 @@ def admin_invoices():
instance_requests = list(req_col.find().sort("created_at", -1))
for item in instance_requests:
item["id"] = str(item.get("_id"))
# Fehlerbehebung: Betrag auch hier sicher in Float umwandeln
amt = item.get("amount_eur", 0)
if isinstance(amt, str):
try:
amt = float(amt.replace('.', '').replace(',', '.'))
except ValueError:
amt = 0.0
item["amount_eur"] = amt
except PyMongoError:
flash("Instanz-Anfragen konnten nicht geladen werden.", "error")
finally:
-40
View File
@@ -51,46 +51,6 @@
</table>
</section>
<section class="panel">
<h2>Instanz-Anfragen</h2>
<p>Hier siehst du den Status deiner angeforderten Instanzen/Buchungen, die vom Admin geprüft werden.</p>
</section>
<section class="table-wrap">
<table>
<thead>
<tr>
<th>Anfrage</th>
<th>Paket</th>
<th>Subdomain</th>
<th>Betrag</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{% for prov in instance_requests %}
<tr>
<td>{{ prov.booking_number or prov.booking_number }}</td>
<td>{{ prov.package_label or prov.package }}</td>
<td>{{ prov.subdomain }}</td>
<td>{{ '%.2f'|format(prov.amount_eur or 0) }} EUR</td>
<td>
{{ prov.provision_status or 'not_started' }}
<form method="post" action="{{ url_for('instance_request_delete') }}" style="display:inline-block; margin-left:0.6rem;">
<input type="hidden" name="prov_id" value="{{ prov.id }}">
<button type="submit" class="danger">Löschen</button>
</form>
</td>
</tr>
{% else %}
<tr>
<td colspan="5">Keine Provisionierungsanfragen vorhanden.</td>
</tr>
{% endfor %}
</tbody>
</table>
</section>
<style>
.panel { margin-bottom: 1rem; }
.table-wrap { background: #fff; border: 1px solid #d8e1e8; border-radius: 14px; padding: 1rem; overflow-x: auto; }