Commit 51830b93 authored by Christine Dela Rosa's avatar Christine Dela Rosa

Add Inventory form

- Edited Inventory.html to accommodate add inventory form
- Added addinventory.html, which contains the add ingredient form
- Edited forms.py, urls.py, views.py with addinventory
- Minor edits to addorder and css for better visuals
parent 77a6b16a
...@@ -128,7 +128,7 @@ header { ...@@ -128,7 +128,7 @@ header {
margin-left: 5rem; margin-left: 5rem;
} }
/* ======== ORDER.HTML and RECEIPT.HTML ============ */ /* ======== ORDER.HTML, RECEIPT.HTML, INVENTORY.HTML ============ */
.title-area { .title-area {
text-align: center; text-align: center;
} }
......
{% extends 'blizzardblast\templates\base.html' %}
{% load static %}
{% block title %}Add Ingredient in Inventory{% endblock %}
{% block styles %}
{% endblock %}
{% block content %}
<form action="/addinventory" method="post" style="text-align:center">
{% csrf_token %}
{{inventory_form.as_p}}
<input type="submit" value="Submit">
</form>
{% endblock %}
\ No newline at end of file
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
{% block content %} {% block content %}
<form action="/addorder" method="post" style="text-align:center"> <form action="/addorder" method="post" style="text-align:center">
{% csrf_token %} {% csrf_token %}
{{form}} {{form.as_p}}
<input type="submit" value="Submit"> <input type="submit" value="Submit">
</form> </form>
......
...@@ -13,13 +13,53 @@ ...@@ -13,13 +13,53 @@
<select name="search-filter" id="search-filter"> <select name="search-filter" id="search-filter">
<option selected="selected">Filter</option> <option selected="selected">Filter</option>
<option value="category">Category</option> <option value="category">Category</option>
<option value="name_alphabetical">Name: A-to-Z</option>
</select> </select>
<input class="search-bar" size=60 type="text" placeholder="Search.."> <input class="search-bar" size=60 type="text" placeholder="Search..">
<button class="search-button">Search</button> <button class="search-button">Search</button>
</div> </div>
<div id="CRUD-features"> <div id="CRUD-features">
<button id="add-to-inventory">Add to Inventory</button> <button class="crud-button"><a href="{% url 'addinventory' %}">Add to Inventory</a></button>
<button id="update">Refresh</button> <button class="crud-button">Refresh</button>
</div>
<div id="order-table">
<table>
<!-- TABLE HEADER -->
<tr>
<th>ingredient_id</th>
<th>Ingredient Name</th>
<th>Category</th>
<th>Quantity</th>
<th>Price per Serving</th>
</tr>
<!-- TABLE ROWS WITH INFO -->
<tr>
<th>111</th>
<th>Vanilla Ice Cream</th>
<th>base</th>
<th>100</th>
<th>10</th>
</tr>
<tr>
<th>112</th>
<th>Strawberry</th>
<th>fruits</th>
<th>50</th>
<th>20</th>
</tr>
<!-- TABLE ROW WITHOUT INFO -->
<tr>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
</table>
</div> </div>
{% endblock %} {% endblock %}
...@@ -8,3 +8,21 @@ class AddOrderForm(forms.Form): ...@@ -8,3 +8,21 @@ class AddOrderForm(forms.Form):
base_recipe = forms.CharField(label='Base Recipe') base_recipe = forms.CharField(label='Base Recipe')
add_on_qty = forms.IntegerField(label='Add-on Qty') add_on_qty = forms.IntegerField(label='Add-on Qty')
add_on_name = forms.CharField(label='Add-on') add_on_name = forms.CharField(label='Add-on')
INGREDIENT_CATEGORIES = (
(1,'nuts'),
(2,'fruits'),
(3,'chocolate'),
(4,'baked'),
(5,'mix-in'),
(6,'base'),
(7,'topping')
)
class AddInventoryForm(forms.Form):
ingredient_id = forms.IntegerField(label='Ingredient No.')
ingredient_name = forms.CharField(label='Ingredient Name')
ingredient_category = forms.ChoiceField(choices = INGREDIENT_CATEGORIES, label ='Category')
ingredient_quantity = forms.IntegerField(label='Quantity')
ingredient_price = forms.IntegerField(label='Price per Serving')
\ No newline at end of file
...@@ -9,5 +9,5 @@ urlpatterns = [ ...@@ -9,5 +9,5 @@ urlpatterns = [
path('report', report, name='report'), path('report', report, name='report'),
path('receipt', receipt, name='receipt'), path('receipt', receipt, name='receipt'),
path('addorder', addorder, name='addorder' ), path('addorder', addorder, name='addorder' ),
path('addinventory', addinventory, name='addinventory')
] ]
from django.shortcuts import render from django.shortcuts import render
from django.http import HttpResponse from django.http import HttpResponse
from .forms import AddOrderForm from .forms import AddInventoryForm, AddOrderForm
def homepage(request): def homepage(request):
...@@ -25,3 +25,7 @@ def report(request): ...@@ -25,3 +25,7 @@ def report(request):
def addorder(request): def addorder(request):
form = AddOrderForm() form = AddOrderForm()
return render(request, "blizzardblast/templates/addorder.html", {'form': form}) return render(request, "blizzardblast/templates/addorder.html", {'form': form})
def addinventory(request):
form = AddInventoryForm()
return render(request, "blizzardblast/templates/addinventory.html", {'inventory_form':form})
\ 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