Commit e1d1efff authored by Matthew Dizon's avatar Matthew Dizon

added customer and food pages including details

parent f4c47c40
Pipeline #1921 canceled with stages
......@@ -29,19 +29,34 @@
</nav>
<div class="container-fluid">
<div class="col justify-content-center mb-5">
<div class="row">
<div class ="col-2 justify-content-left">
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link" href="/home"> View Orders </a>
</li>
<li class="nav-item">
<a class="nav-link" href="/foods"> View Food Items </a>
</li>
<li class="nav-item">
<a class="nav-link" href="/customers"> View Customers </a>
</li>
</ul>
{% block content %}
{% endblock %}
</div>
<div class="col-10 justify-content-center mb-5">
{% block content %}
{% endblock %}
</div>
</div>
</div>
</div>
<footer class="footer bg-light" style="position: fixed;">
<!-- Copyright -->
<div class="container" style="color: black">&copy; 2020</div>
<!-- Copyright -->
<div class="container" style="color: black">M7L Final Project</div>
</footer>
......
{% extends 'Kiosk/base.html' %}
{% load static %}
{% block sidenav %}
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link" href="/view_suppliers"> View Suppliers </a>
</li>
<li class="nav-item">
<a class="nav-link" href="/view_bottles"> View Bottles </a>
</li>
<li class="nav-item">
<a class="nav-link" href="/add_bottle"> Add Bottle </a>
</li>
</ul>
{% endblock %}
{% block content %}
<section class="jumbotron text-center">
<div class="container">
<h1 class="jumbotron-heading">Matthew Dizon</h1>
<p>Module 5 Lab - Templates</p>
<h1 class="jumbotron-heading">Orders</h1>
<p>A table of all orders</p>
</div>
</section>
<div class="container marketing text-center">
<div class="row">
<div class="col-lg-4">
<h2>Suppliers</h2>
<p>View the details of the suppliers</p>
<p><a class="btn btn-secondary" href="/view_suppliers" role="button">View details »</a></p>
</div>
<div class="col-lg-4">
<h2>Bottles</h2>
<p>View the details of the bottles</p>
<p><a class="btn btn-secondary" href="/view_bottles" role="button">View details »</a></p>
</div>
<div class="col-lg-4">
<h2>Add Bottle</h2>
<p>Add bottles to the inventory</p>
<p><a class="btn btn-secondary" href="/add_bottle" role="button">View details »</a></p>
</div>
</div>
</div>
<div class="col-12">
<table class="table table-striped">
<thead>
<th scope="col"> Customer </th>
<th scope="col"> Food Ordered </th>
<th scope="col"> Date of Order </th>
<th scope="col"></th>
</thead>
<tbody>
{% for order in orders %}
<tr>
<td> {{ order.cust_order.getName }} </td>
<td> {{ order.food.getName }} </td>
<td> {{ order.ordered_at }} </td>
<td><a href="{% url 'view_order_details' order.pk %}"><button class="btn btn-dark">Details</button></a></td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="col-12">
<table class="table table-striped">
<thead>
<th scope="col"> Customer </th>
<th scope="col"> Food Ordered </th>
<th scope="col"> Date of Order </th>
<th scope="col"></th>
</thead>
<tbody>
{% for order in orders %}
<tr>
<td> {{ order.cust_order.getName }} </td>
<td> {{ order.food.getName }} </td>
<td> {{ order.ordered_at }} </td>
<td><a href="{% url 'view_order_details' order.pk %}"><button class="btn btn-dark">Details</button></a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}
\ No newline at end of file
{% extends 'Kiosk/base.html' %}
{% load static %}
{% block content %}
<div class="card w-75">
<div class="card-header">
Customer Details:
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item"><span style="color: #8AB4F8; font-weight:bold">Food: </span> {{customer.name}}</li>
<li class="list-group-item"><span style="color: #8AB4F8; font-weight:bold">Quantity: </span> {{customer.address}}</li>
<li class="list-group-item"><span style="color: #8AB4F8; font-weight:bold">Date of Order: </span> {{customer.city}}</li>
</ul>
</div>
<form action="#" method="post">
{% csrf_token %}
<input type="hidden" name="message" value="Bottle deleted successfully">
<a href="#"><button class="btn btn-secondary my-4">Delete Food</button></a>
</form>
<a href="#"><button type="submit" class="mt-3 btn btn-primary">Update Food</button></a>
<a onclick="window.history.go(-1); return false;"><button class="btn btn-secondary">Back</button></a>
{% endblock %}
\ No newline at end of file
{% extends 'Kiosk/base.html' %}
{% load static %}
{% block content %}
<section class="jumbotron text-center">
<div class="container">
<h1 class="jumbotron-heading">Customers</h1>
<p>A table of all customers</p>
</div>
</section>
<div class="col-12">
<table class="table table-striped">
<thead>
<th scope="col"> Name </th>
<th scope="col"> Address </th>
<th scope="col"> City </th>
<th scope="col"></th>
</thead>
<tbody>
{% for customer in customers %}
<tr>
<td> {{ customer.name }} </td>
<td> {{ customer.address }} </td>
<td> {{ customer.city }} </td>
<td><a href="{% url 'view_customer_details' customer.pk %}"><button class="btn btn-dark">Details</button></a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}
\ No newline at end of file
{% extends 'Kiosk/base.html' %}
{% load static %}
{% block content %}
<div class="card w-75">
<div class="card-header">
Food Details:
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item"><span style="color: #8AB4F8; font-weight:bold">Food: </span> {{food.name}}</li>
<li class="list-group-item"><span style="color: #8AB4F8; font-weight:bold">Quantity: </span> {{food.description}}</li>
<li class="list-group-item"><span style="color: #8AB4F8; font-weight:bold">Date of Order: </span> {{food.price}}</li>
<li class="list-group-item"><span style="color: #8AB4F8; font-weight:bold">Customer: </span> {{food.created_at}}</li>
</ul>
</div>
<form action="#" method="post">
{% csrf_token %}
<input type="hidden" name="message" value="Bottle deleted successfully">
<a href="#"><button class="btn btn-secondary my-4">Delete Food</button></a>
</form>
<a href="#"><button type="submit" class="mt-3 btn btn-primary">Update Food</button></a>
<a onclick="window.history.go(-1); return false;"><button class="btn btn-secondary">Back</button></a>
{% endblock %}
\ No newline at end of file
{% extends 'Kiosk/base.html' %}
{% load static %}
{% block content %}
<section class="jumbotron text-center">
<div class="container">
<h1 class="jumbotron-heading">Food Items</h1>
<p>A table of all food items</p>
</div>
</section>
<div class="col-12">
<table class="table table-striped">
<thead>
<th scope="col"> Name </th>
<th scope="col"> Description </th>
<th scope="col"> Price </th>
<th scope="col"> Date Created </th>
<th scope="col"></th>
</thead>
<tbody>
{% for food in foods %}
<tr>
<td> {{ food.name }} </td>
<td> {{ food.description }} </td>
<td> {{ food.price }} </td>
<td> {{ food.created_at }} </td>
<td><a href="{% url 'view_food_details' food.pk %}"><button class="btn btn-dark">Details</button></a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}
\ No newline at end of file
......@@ -3,10 +3,18 @@ from . import views
urlpatterns = [
# Path for Accounts Model
path('', views.login_view, name='login'),
path('signup', views.signup_view, name="signup"),
path('logout', views.logout_view, name="logout"),
# Path for Order Model
path('home', views.home, name="home"),
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 for Food Model
path('foods', views.view_foods, name="view_foods"),
path('view_food_details/<int:pk>', views.view_food_details, name="view_food_details"),
# Path for Customer Model
path('customers', views.view_customers, name="view_customers"),
path('view_customer_details/<int:pk>', views.view_customer_details, name="view_customer_details"),
]
\ No newline at end of file
......@@ -76,5 +76,23 @@ def update_order(request, pk):
return render(request, 'Kiosk/update_order.html', context)
### Views for Food Model
### Views for Customer Model
\ No newline at end of file
def view_foods(request):
foods = Food.objects.all()
context = {"foods":foods}
return render(request, 'Kiosk/view_foods.html', context)
def view_food_details(request, pk):
food = get_object_or_404(Food, pk=pk)
context = {"food": food}
return render(request, 'Kiosk/view_food_details.html', context)
### Views for Customer Model
def view_customers(request):
customers = Customer.objects.all()
context = {"customers":customers}
return render(request, 'Kiosk/view_customers.html', context)
def view_customer_details(request, pk):
customer = get_object_or_404(Customer, pk=pk)
context = {"customer":customer}
return render(request, 'Kiosk/view_customer_details.html', context)
\ No newline at end of file
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