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