feat: add payment tracking for orders

- Add payment method selection (PayPal/Bar) to order form
- Store payment_method and payment_status in database
- Add payment status badges in admin orders view
- Add "mark as paid" functionality for admins
- PayPal account configurable via PAYPAL_ACCOUNT env variable
- Frontend loads PayPal account dynamically from /wawi/config endpoint
- Update email notifications to include payment method

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-09 08:28:33 +01:00
parent fd3f49a2e1
commit aa0de2fe4a
5 changed files with 131 additions and 6 deletions

View File

@@ -20,6 +20,8 @@
<th>Artikel</th>
<th>Größe</th>
<th>Menge</th>
<th>Zahlungsart</th>
<th>Zahlung</th>
<th>Notiz</th>
<th>Status</th>
<th class="actions">Aktion</th>
@@ -35,6 +37,16 @@
<td>{{ o.artikel }}</td>
<td>{{ o.groesse }}</td>
<td>{{ o.menge }}</td>
<td>
{% if o.payment_method == "paypal" %}PayPal
{% else %}Bar
{% endif %}
</td>
<td>
{% if o.payment_status == "paid" %}<span class="badge success">Bezahlt</span>
{% else %}<span class="badge warning">Unbezahlt</span>
{% endif %}
</td>
<td>{{ o.notiz or "" }}</td>
<td>
{% if o.canceled %}Storniert
@@ -48,6 +60,12 @@
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<button class="btn small" type="submit">Erledigt</button>
</form>
{% if o.payment_status != "paid" %}
<form method="post" action="{{ url_for('bp.mark_paid', order_id=o.id) }}" onsubmit="return confirm('Als bezahlt markieren?');">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<button class="btn small success" type="submit">Bezahlt</button>
</form>
{% endif %}
<form method="post" action="{{ url_for('bp.cancel_order', order_id=o.id) }}" onsubmit="return confirm('Bestellung wirklich stornieren?');">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<button class="btn small danger" type="submit">Stornieren</button>
@@ -58,12 +76,14 @@
</td>
</tr>
<tr class="order-history">
<td colspan="10">
<td colspan="12">
<details class="inline-details">
<summary>Historie</summary>
<div class="history-grid">
<div><strong>Abgeschlossen von:</strong> {{ o.completed_by or "" }}</div>
<div><strong>Abgeschlossen am:</strong> {{ o.completed_at or "" }}</div>
<div><strong>Bezahlt markiert von:</strong> {{ o.paid_by or "" }}</div>
<div><strong>Bezahlt markiert am:</strong> {{ o.paid_at or "" }}</div>
<div><strong>Storniert von:</strong> {{ o.canceled_by or "" }}</div>
<div><strong>Storniert am:</strong> {{ o.canceled_at or "" }}</div>
</div>
@@ -72,7 +92,7 @@
</tr>
{% else %}
<tr>
<td colspan="10" class="empty">Keine Bestellungen.</td>
<td colspan="12" class="empty">Keine Bestellungen.</td>
</tr>
{% endfor %}
</tbody>