From 767d80b6744482003e3bfd6f1fe1d0d8ac97d560 Mon Sep 17 00:00:00 2001 From: Frank Poetzsch-Heffter <p-h@katharineum.de> Date: Sun, 17 Nov 2019 19:06:23 +0100 Subject: [PATCH] some changes in index template --- biscuit/apps/fibu/models.py | 1 + biscuit/apps/fibu/templates/fibu/index.html | 35 ++++++++++++++------- biscuit/apps/fibu/views.py | 2 +- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/biscuit/apps/fibu/models.py b/biscuit/apps/fibu/models.py index 788e4c2..bd9dccb 100644 --- a/biscuit/apps/fibu/models.py +++ b/biscuit/apps/fibu/models.py @@ -13,6 +13,7 @@ class Status: status_list = [ Status(name='beantragt', style_class='red'), Status(name='bewilligt', style_class='orange'), + Status(name='abgelehnt', style_class='black'), Status(name='bestellt', style_class='yellow'), Status(name='bezahlt', style_class='green'), ] diff --git a/biscuit/apps/fibu/templates/fibu/index.html b/biscuit/apps/fibu/templates/fibu/index.html index 764fd73..348aa19 100755 --- a/biscuit/apps/fibu/templates/fibu/index.html +++ b/biscuit/apps/fibu/templates/fibu/index.html @@ -17,22 +17,33 @@ </button> </form> - <h5>Laufende Anträge</h5> + <h4>Laufende Anträge</h4> <div class="collection"> {% for booking in bookings %} -{# <div class="collection-item row">#} - <a href="{% url 'booking_edit' booking.id %}" class="collection-item row"> + STATUS_ID: {% booking.status.id %} + <div class="collection-item row"> +{# <a href="{% url 'booking_edit' booking.id %}" class="collection-item row"> #} <span class="col s12 m8">{{ booking.description }}</span> - <span class="col s12 m3 flushright">{{ booking.planned_amount }} €</span> + <span class="col s12 m2 flushright">{{ booking.planned_amount }} €</span> <span class="col s12 m1 badge new {{ booking.getStatus.style_class }}">{{ booking.getStatus.name }}</span> -{# <form action="{% url 'booking_edit' booking.id %}" class="col s12 m2">#} -{# {% csrf_token %}#} -{# <button type="submit" name="edit" class="waves-effect waves-light btn-flat btn-flat-medium" title="Bearbeiten">#} -{# <i class="material-icons center green-text">create</i>#} -{# </button>#} -{# </form>#} - </a> -{# </div>#} + <form action="{% url 'booking_edit' booking.id %}" class="col s12 m1"> + {% csrf_token %} + <input type="hidden" value="{{ booking.id }}" name="booking-id"> + {% if booking.status.id == 0 %} + <button type="submit" name="edit" + class="waves-effect waves-light btn-flat btn-flat-large" title="Bearbeiten"> + <i class="material-icons center green-text">create</i> + </button> + {% endif %} + {% if booking.status.id == 1 %} + <button type="submit" name="order" + class="waves-effect waves-light btn-flat btn-flat-large" title="Ware ist bestellt"> + <i class="material-icons center red-text">shopping-cart</i> + </button> + {% endif %} + </form> +{# </a>#} + </div> {% endfor %} </div> {% endblock %} diff --git a/biscuit/apps/fibu/views.py b/biscuit/apps/fibu/views.py index 0ab60cf..a705dc3 100644 --- a/biscuit/apps/fibu/views.py +++ b/biscuit/apps/fibu/views.py @@ -75,7 +75,7 @@ def check(request): if 'allow' in request.POST: Booking.objects.filter(id=booking_id).update(status=1) elif 'deny' in request.POST: - Booking.objects.filter(id=booking_id).update(status=3) + Booking.objects.filter(id=booking_id).update(status=2) # Notify user # register_notification(title="Ihr Antrag auf Unterrichtsbefreiung wurde abgelehnt", # description="Ihr Antrag auf Unterrichtsbefreiung vom {}, {} Uhr bis {}, {} Uhr wurde von der " -- GitLab