Added a new filtering view that shows all the base flavors

Ommitted the base category from models.py.

Updated CSS accordingly.
parent b79224cb
......@@ -207,8 +207,12 @@ a:hover {
justify-content: center;
}
#baseflavor {
display: flex;
justify-content: center;
}
table, th {
border: 1px solid black;
padding: 5px;
border-collapse: separate;
}
......
......@@ -19,7 +19,8 @@
<div class="inventory buttonpanel">
<button class="add ingredient"><a href="{% url 'addingredient' %}">Add Ingredient</a></button>
<button class="add"><a href="{% url 'addBaseFlavor' %}">Add Base Flavor</a></button>
<button class="add BaseFlavor"><a href="{% url 'addBaseFlavor' %}">Add Base Flavor</a></button>
<button class="add show BaseFlavor"><a href="{% url 'showBaseFlavors' %}">Show Base Flavors</a></button>
</div>
<div id="order-table">
......@@ -31,6 +32,7 @@
<th>Quantity</th>
<th>Price per Serving</th>
<th>Replenished Stock?</th>
<th>Options</th>
</tr>
......@@ -38,15 +40,15 @@
<!-- TABLE ROWS WITH INFO -->
{% for ingredient in inventory %}
<tr>
{% if ingredient.ingredient_name == baseflavor.bf_name %}
<td>{{baseflavor.bf_name}}</td>
{% else %}
<td>{{ingredient.ingredient_name}}</td>
{% endif %}
<td>{{ingredient.category}}</td>
<td>{{ingredient.quantity}}</td>
<td>{{ingredient.price_per_serving}}</td>
<td>{{ingredient.replenished_stock}}</td>
<td>
<button class="edit-value edit">Edit</button>
<button class="edit-value delete">Delete</button>
</td>
</tr>
{% endfor %}
......
{% extends 'blizzardblast\templates\base.html' %}
{% load static %}
{% block title %}Add Customer{% endblock %}
{% block styles %}
{% endblock %}
{% block content %}
<table id="baseflavor">
<!-- TABLE HEADER -->
<tr>
<th>Base Flavor</th>
</tr>
<!-- TABLE ROW WITH INFO -->
{% for bf in show_bfs%}
<tr>
<td>{{bf.bf_name}}</td>
</tr>
{%endfor%}
</table>
{% endblock %}
\ No newline at end of file
......@@ -36,7 +36,7 @@ class Ingredient(models.Model):
('chocolate','chocolate'),
('baked','baked'),
('mix-in','mix-in'),
('base','base'),
# ('base','base'),
('topping','topping')
]
......
......@@ -24,6 +24,7 @@ urlpatterns = [
path('manager_query', manager_query, name='manager_query'),
path('week_query', week_query, name='week_query'),
path('role_query', role_query, name='role_query'),
path('alphabetical_query', alphabetical_query, name='alphabetical_query')
path('alphabetical_query', alphabetical_query, name='alphabetical_query'),
path('showBaseFlavors', showBaseFlavors, name='showBaseFlavors'),
]
......@@ -18,10 +18,8 @@ def receipt(request):
def inventory(request):
ingredients_context = Ingredient.objects.all()
base_flavor_context = BaseFlavor.objects.all()
contexts = {
'baseflavor' : base_flavor_context,
'inventory' : ingredients_context
}
return render(request, "blizzardblast/templates/inventory.html", contexts)
......@@ -74,7 +72,12 @@ def alphabetical_query(request):
'alphabetical': alphabetical_query
})
def showBaseFlavors(request):
show_bfs = BaseFlavor.objects.all()
contexts = {
'show_bfs' : show_bfs
}
return render(request, "blizzardblast/templates/showBaseFlavors.html", contexts)
# ========================== FORMS ==========================
def addorder(request):
......
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