diff --git a/gaehsnitz/static/suff/style.css b/gaehsnitz/static/suff/style.css index c6177ed..a68da67 100644 --- a/gaehsnitz/static/suff/style.css +++ b/gaehsnitz/static/suff/style.css @@ -280,6 +280,28 @@ section { text-shadow: 0 0 12px #CC6611; } +.total-box-settled { + border-color: #3a7a44; + background-color: rgba(30, 80, 40, 0.35); +} + +.total-settled { + color: #66cc77; + font-size: 1.6rem; + font-weight: bold; + text-shadow: 0 0 12px #2a6633; +} + +.total-breakdown { + display: flex; + flex-wrap: wrap; + justify-content: center; + gap: 4px 6px; + margin-top: 4px; + font-size: 0.82rem; + color: #889988; +} + .for-free-toggle { display: flex; flex-direction: row; @@ -314,6 +336,7 @@ section { color: #EE9933; } + .drink-grid { display: grid; grid-template-columns: repeat(2, 1fr); diff --git a/gaehsnitz/suff.py b/gaehsnitz/suff.py index 7cd77ed..1d01aed 100644 --- a/gaehsnitz/suff.py +++ b/gaehsnitz/suff.py @@ -282,6 +282,9 @@ def book_view(request): raise Http404 drink_id = request.POST.get("drink_id") + booking_mode = request.POST.get("booking_mode", "normal") + for_free = booking_mode == "for_free" + cash_paid = booking_mode == "cash_paid" try: drink = Drink.objects.get(pk=int(drink_id)) except (Drink.DoesNotExist, TypeError, ValueError): @@ -292,9 +295,17 @@ def book_view(request): drink=drink, amount=1, day=_current_festival_day(), - for_free=False, + for_free=for_free, ) - return HttpResponseRedirect(f"{reverse('suff:me')}?booked={drink.id}") + if cash_paid: + UserPayment.objects.create( + user=request.user, + amount=drink.sale_price_per_bottle, + method=UserPayment.Method.cash, + note=f"Auto: {drink.name}", + ) + free_suffix = "&free=1" if for_free else "" + return HttpResponseRedirect(f"{reverse('suff:me')}?booked={drink.id}{free_suffix}") @login_required @@ -546,7 +557,9 @@ def staff_book_view(request, username): target = _get_staff_target(username) drink_id = request.POST.get("drink_id") - for_free = request.POST.get("for_free") == "1" + booking_mode = request.POST.get("booking_mode", "normal") + for_free = booking_mode == "for_free" + cash_paid = booking_mode == "cash_paid" try: drink = Drink.objects.get(pk=int(drink_id)) except (Drink.DoesNotExist, TypeError, ValueError): @@ -559,7 +572,7 @@ def staff_book_view(request, username): day=_current_festival_day(), for_free=for_free, ) - if _is_anonymous(target) and not for_free: + if cash_paid or (_is_anonymous(target) and not for_free): UserPayment.objects.create( user=target, amount=drink.sale_price_per_bottle, @@ -848,6 +861,7 @@ def dashboard_view(request): .annotate(s=Sum("amount")) ) method_split = {r["method"]: r["s"] for r in method_rows} + cash_total = method_split.get(UserPayment.Method.cash, 0) # Free drinks free_recipient_rows = ( @@ -893,6 +907,7 @@ def dashboard_view(request): "biggest_tip": biggest_tip, "total_entry": total_entry, "method_split": method_split, + "cash_total": cash_total, "top_free_recipient": top_free_recipient, "free_total_count": free_total_count, } diff --git a/gaehsnitz/templates/suff/dashboard.html b/gaehsnitz/templates/suff/dashboard.html index 3ce89ba..aef4cda 100644 --- a/gaehsnitz/templates/suff/dashboard.html +++ b/gaehsnitz/templates/suff/dashboard.html @@ -33,6 +33,10 @@ Zahlungen (User-Tab) {{ user_payments_total|euro }} +
  • + Kasse (bar) + {{ cash_total|euro }} +
  • Einkaufspreis Getränke {{ purchase_cost|euro }} diff --git a/gaehsnitz/templates/suff/me.html b/gaehsnitz/templates/suff/me.html index 1f4edd8..407fbc2 100644 --- a/gaehsnitz/templates/suff/me.html +++ b/gaehsnitz/templates/suff/me.html @@ -21,14 +21,29 @@ {% endif %} -
    - Deine Rechnung - {{ total|floatformat:2 }} € - {% if paid %} - Bezahlt - {{ paid|floatformat:2 }} € - Offen - {{ open_balance|floatformat:2 }} € + @@ -37,19 +52,26 @@ {% if phase == "booking" %}

    Neues Getränk buchen

    -
    - {% for drink in drinks %} -
    - {% csrf_token %} - - -
    - {% endfor %} -
    + {% endfor %} + +
    {% endif %} @@ -80,7 +102,6 @@

    🍺

    Noch nichts gebucht.

    - {% if phase == "booking" %}

    Tipp dich rein, sobald du was trinkst!

    {% endif %}
    {% endif %}
    diff --git a/gaehsnitz/templates/suff/pay.html b/gaehsnitz/templates/suff/pay.html index b38b264..c622ba3 100644 --- a/gaehsnitz/templates/suff/pay.html +++ b/gaehsnitz/templates/suff/pay.html @@ -4,15 +4,30 @@ {% block content %}

    Spenden

    -
    - Deine Rechnung - {{ total|floatformat:2 }} € - {% if paid %} - Bezahlt - {{ paid|floatformat:2 }} € +

    @@ -24,7 +39,7 @@

    Du darfst gerne weniger geben, wenn das gerade besser passt – kein Problem. Und wenn du mehr geben kannst, - hilft uns das sehr, die Kosten für Bands, Toiletten und Technik zu + hilft uns das sehr, die Kosten für Bands, Toiletten usw. zu decken. So oder so: danke, dass du da bist!

    diff --git a/gaehsnitz/templates/suff/staff_pay.html b/gaehsnitz/templates/suff/staff_pay.html index 584fdbc..b76d496 100644 --- a/gaehsnitz/templates/suff/staff_pay.html +++ b/gaehsnitz/templates/suff/staff_pay.html @@ -4,15 +4,30 @@

    Crew-Ansicht

    Zahlung für {{ tab_user.username }}

    -
    - Rechnung - {{ total|floatformat:2 }} € - {% if paid %} - Bezahlt - {{ paid|floatformat:2 }} € + {% if error %} @@ -24,7 +39,7 @@