Commit 59e047a2 authored by Matthew Dizon's avatar Matthew Dizon

finished functionality of orders

parent f74cd87b
Pipeline #1927 canceled with stages
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
{% load static %} {% load static %}
{% block content %} {% block content %}
</div>
<div class="card w-75"> <div class="card w-75">
<div class="card-header"> <div class="card-header">
Order Details: Order Details:
...@@ -21,7 +20,7 @@ ...@@ -21,7 +20,7 @@
<div class="form-group"> <div class="form-group">
<label for="name"> Date of Order: </label> <label for="name"> Date of Order: </label>
<input type="date" class="form-control" id="date" name="date" value="{{order.ordered_at}}" disabled> <input type="text" class="form-control" id="date" name="date" value="{{order.ordered_at}}" disabled>
</div> </div>
<div class="form-group"> <div class="form-group">
...@@ -46,4 +45,5 @@ ...@@ -46,4 +45,5 @@
</form> </form>
</div> </div>
<a href="{% url 'view_order_details' order.pk %}"><button class="btn btn-secondary">Back</button></a>
{% endblock %} {% endblock %}
...@@ -14,11 +14,8 @@ ...@@ -14,11 +14,8 @@
<li class="list-group-item"><span style="color: #8AB4F8; font-weight:bold">Mode of Payment: </span> {{order.payment_mode}}</li> <li class="list-group-item"><span style="color: #8AB4F8; font-weight:bold">Mode of Payment: </span> {{order.payment_mode}}</li>
</ul> </ul>
</div> </div>
<form action="#" method="post">
{% csrf_token %} <a href="{% url 'update_order' order.pk %}"><button class="btn btn-primary">Update Order</button></a>
<input type="hidden" name="message" value="Bottle deleted successfully"> <a href="{% url 'delete_order' order.pk %}"><button class="btn btn-danger my-4">Delete Order</button></a>
<a href="#"><button class="btn btn-secondary my-4">Delete Order</button></a> <a href="{% url 'home' %}"><button class="btn btn-secondary">Back</button></a>
</form>
<a href="{% url 'update_order' order.pk %}"><button type="submit" class="mt-3 btn btn-primary">Update Order</button></a>
<a onclick="window.history.go(-1); return false;"><button class="btn btn-secondary">Back</button></a>
{% endblock %} {% endblock %}
\ No newline at end of file
...@@ -12,6 +12,7 @@ urlpatterns = [ ...@@ -12,6 +12,7 @@ urlpatterns = [
path('view_order_details/<int:pk>', views.view_order_details, name="view_order_details"), path('view_order_details/<int:pk>', views.view_order_details, name="view_order_details"),
path('update_order/<int:pk>', views.update_order, name="update_order"), path('update_order/<int:pk>', views.update_order, name="update_order"),
path('add_order', views.add_order, name="add_order"), path('add_order', views.add_order, name="add_order"),
path('delete_order/<int:pk>', views.delete_order, name="delete_order"),
# Path for Food Model # Path for Food Model
path('foods', views.view_foods, name="view_foods"), path('foods', views.view_foods, name="view_foods"),
path('view_food_details/<int:pk>', views.view_food_details, name="view_food_details"), path('view_food_details/<int:pk>', views.view_food_details, name="view_food_details"),
......
...@@ -107,6 +107,10 @@ def add_order(request): ...@@ -107,6 +107,10 @@ def add_order(request):
else: else:
return render(request, 'Kiosk/add_order.html', context) return render(request, 'Kiosk/add_order.html', context)
def delete_order(request, pk):
Order.objects.filter(pk=pk).delete()
return redirect('home')
### Views for Food Model ### Views for Food Model
def view_foods(request): def view_foods(request):
foods = Food.objects.all() foods = Food.objects.all()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment