diff --git a/biscuit/apps/fibu/models.py b/biscuit/apps/fibu/models.py index 788e4c2732077800b225daa5d8aa75140f06d06c..bd9dccbcc586c8423fb90f74224ea2efe5e2949e 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 764fd73be39c55256ffc39b2d6c2a1cbf763b5e5..348aa198cc3816703c4da3132f545e03fc52d4ee 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 0ab60cf3b55662dad5b2a3e848a5c11e5326ab55..a705dc3de3839bbf0e3ab7da2446cb3ebee4197b 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 "