diff --git a/mordor/models.py b/mordor/models.py
index e3f6cee..6075820 100644
--- a/mordor/models.py
+++ b/mordor/models.py
@@ -24,7 +24,7 @@ class Order(TimeStampMixin):
return self.ORDER_STATES[self.state]
def price_33(self):
- return self.amount_33 * 25
+ return self.amount_33 * 28
def price_50(self):
return self.amount_50 * 30
diff --git a/mordor/templates/mordor/manage.html b/mordor/templates/mordor/manage.html
new file mode 100644
index 0000000..a251261
--- /dev/null
+++ b/mordor/templates/mordor/manage.html
@@ -0,0 +1,28 @@
+{% extends "base.html" %}
+
+{% block title %}Manage{% endblock %}
+
+{% block content %}
+
+
Aangezien we al geruime tijd klant zijn genieten we van horecaprijzen, dit bij aankoop vanaf € 200.
+Bestellingen lager dan € 200 gebeuren via de webshop.
+ Bestellingen kunnen doorgegeven worden door te mailen naar order@drinks52.com
+
+ - 33CL: Kostprijs per bak: €23.32 + €4.50 (leeggoed) = €28; Flesjes met kroonkurk.
+ - 50CL: Kostprijs per bak: €25.44 + €4.50 (leeggoed) = €30; Flesjes met schroefdop.
+
+
+ Genoeg open orders om een bestelling te kunnen plaatsen?
+ {% if sum > 200 %}
+ Ja
+ {% else %}
+ Nee
+ {% endif %}
+ {% if sum > 0 %}
+ Er staan orders open met een totale waarde van €{{ sum }}.
+ {% else %}
+ Er staan geen orders open.
+ {% endif %}
+
+
+{% endblock %}
diff --git a/mordor/templates/mordor/winkel.html b/mordor/templates/mordor/winkel.html
index a6ae33a..43419b5 100644
--- a/mordor/templates/mordor/winkel.html
+++ b/mordor/templates/mordor/winkel.html
@@ -11,7 +11,7 @@
let total_sum = 0
function input_changed() {
- sum_33 = Number(document.getElementById(`amount_33`).value) * 25;
+ sum_33 = Number(document.getElementById(`amount_33`).value) * 28;
sum_50 = Number(document.getElementById(`amount_50`).value) * 30;
let total_field_33 = document.getElementById(`sum_33`);
@@ -45,7 +45,7 @@
onblur="this.placeholder='0'" oninput="input_changed()">
x
- €25
+ €28
=€
diff --git a/mordor/urls.py b/mordor/urls.py
index 12962cc..a21a1ae 100644
--- a/mordor/urls.py
+++ b/mordor/urls.py
@@ -23,6 +23,7 @@ urlpatterns = [
path("", views.index, name="index"),
path("winkel", views.winkel, name="winkel"),
path("orders", views.orders, name="orders"),
+ path("manage", views.manage, name="manage"),
path("remove_order/
", views.remove_order, name="remove_order"),
path("admin/", admin.site.urls),
path("login/zeus/", include("oauth.urls")),
diff --git a/mordor/views.py b/mordor/views.py
index 2f6f067..323df84 100644
--- a/mordor/views.py
+++ b/mordor/views.py
@@ -44,3 +44,16 @@ def orders(req):
user_orders = Order.objects.filter(user=req.user)
return render(req, "mordor/orders.html", {"orders": user_orders})
+
+
+def manage(req):
+ if req.user.is_staff or req.user.is_superuser:
+ open_orders = Order.objects.filter(state=Order.OPEN)
+ sum_open_orders = sum([o.total_price() for o in open_orders])
+ return render(
+ req,
+ "mordor/manage.html",
+ {"open_orders": open_orders, "sum": sum_open_orders},
+ )
+ else:
+ return HttpResponseRedirect(reverse("index"))
diff --git a/templates/base.html b/templates/base.html
index 74ac56d..def10ab 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -33,6 +33,11 @@
{% if user.is_staff or user.is_superuser %}
+
+
+ Manage
+
+
Admininterface