Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Blizzard Blast
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Martina Therese R. Reyes
Blizzard Blast
Commits
3ba6e692
Commit
3ba6e692
authored
Dec 15, 2021
by
Martina Therese R. Reyes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created new forms and views accordingly for functioning order and inventory views
parent
fb8ba6c0
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
190 additions
and
40 deletions
+190
-40
addBaseFlavor.html
blizzardblast/templates/forms/addBaseFlavor.html
+16
-0
addcustomer.html
blizzardblast/templates/forms/addcustomer.html
+16
-0
addingredient.html
blizzardblast/templates/forms/addingredient.html
+16
-0
addinventory.html
blizzardblast/templates/forms/addinventory.html
+16
-0
additem.html
blizzardblast/templates/forms/additem.html
+16
-0
addorder.html
blizzardblast/templates/forms/addorder.html
+16
-0
forms.py
main/forms.py
+23
-7
urls.py
main/urls.py
+5
-1
views.py
main/views.py
+66
-32
No files found.
blizzardblast/templates/forms/addBaseFlavor.html
0 → 100644
View file @
3ba6e692
{% extends 'blizzardblast\templates\base.html' %}
{% load static %}
{% block title %}Add Customer{% endblock %}
{% block styles %}
{% endblock %}
{% block content %}
<form
action=
"/addBaseFlavor"
method=
"POST"
style=
"text-align:center"
>
{% csrf_token %}
{{form.as_p}}
<input
type=
"submit"
value=
"Submit"
>
</form>
{% endblock %}
\ No newline at end of file
blizzardblast/templates/forms/addcustomer.html
0 → 100644
View file @
3ba6e692
{% extends 'blizzardblast\templates\base.html' %}
{% load static %}
{% block title %}Add Customer{% endblock %}
{% block styles %}
{% endblock %}
{% block content %}
<form
action=
"/addcustomer"
method=
"POST"
style=
"text-align:center"
>
{% csrf_token %}
{{form.as_p}}
<input
type=
"submit"
value=
"Submit"
>
</form>
{% endblock %}
\ No newline at end of file
blizzardblast/templates/forms/addingredient.html
0 → 100644
View file @
3ba6e692
{% extends 'blizzardblast\templates\base.html' %}
{% load static %}
{% block title %}Add order{% endblock %}
{% block styles %}
{% endblock %}
{% block content %}
<form
action=
"/addingredient"
method=
"POST"
style=
"text-align:center"
>
{% csrf_token %}
{{form.as_p}}
<input
type=
"submit"
value=
"Submit"
>
</form>
{% endblock %}
\ No newline at end of file
blizzardblast/templates/forms/addinventory.html
0 → 100644
View file @
3ba6e692
{% 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
blizzardblast/templates/forms/additem.html
0 → 100644
View file @
3ba6e692
{% extends 'blizzardblast\templates\base.html' %}
{% load static %}
{% block title %}Add item{% endblock %}
{% block styles %}
{% endblock %}
{% block content %}
<form
action=
"/additem"
method=
"POST"
style=
"text-align:center"
>
{% csrf_token %}
{{form.as_p}}
<input
type=
"submit"
value=
"Submit"
>
</form>
{% endblock %}
\ No newline at end of file
blizzardblast/templates/forms/addorder.html
0 → 100644
View file @
3ba6e692
{% extends 'blizzardblast\templates\base.html' %}
{% load static %}
{% block title %}Add order{% endblock %}
{% block styles %}
{% endblock %}
{% block content %}
<form
action=
"/addorder"
method=
"POST"
style=
"text-align:center"
>
{% csrf_token %}
{{form.as_p}}
<input
type=
"submit"
value=
"Submit"
>
</form>
{% endblock %}
\ No newline at end of file
main/forms.py
View file @
3ba6e692
from
django
import
forms
from
django
import
forms
from
django.forms
import
(
ModelForm
,
from
django.forms
import
(
ModelForm
,
TextInput
,
Textarea
,
widgets
)
TextInput
,
Textarea
,
widgets
)
from
.models
import
Customer
,
Orders
,
Item
from
.models
import
*
class
AddOrderForm
(
forms
.
ModelForm
):
class
AddOrderForm
(
forms
.
ModelForm
):
class
Meta
:
class
Meta
:
model
=
Orders
model
=
Orders
fields
=
'__all__'
fields
=
'__all__'
# customer_no = forms.IntegerField(label='Customer no')
# customer_name = forms.CharField(label='Customer Name', max_length=50)
class
AddItemForm
(
forms
.
ModelForm
):
# date = forms.DateField(label='Date')
class
Meta
:
# base_recipe = forms.CharField(label='Base Recipe')
model
=
Item
# add_on_qty = forms.IntegerField(label='Add-on Qty')
fields
=
'__all__'
# add_on_name = forms.CharField(label='Add-on')
class
AddCustomerForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
Customer
fields
=
'__all__'
class
AddIngredient
(
forms
.
ModelForm
):
class
Meta
:
model
=
Ingredient
fields
=
'__all__'
class
AddBaseFlavor
(
forms
.
ModelForm
):
class
Meta
:
model
=
BaseFlavor
fields
=
'__all__'
INGREDIENT_CATEGORIES
=
(
INGREDIENT_CATEGORIES
=
(
(
1
,
'nuts'
),
(
1
,
'nuts'
),
...
...
main/urls.py
View file @
3ba6e692
...
@@ -14,6 +14,10 @@ urlpatterns = [
...
@@ -14,6 +14,10 @@ urlpatterns = [
#forms
#forms
path
(
'addorder'
,
addorder
,
name
=
'addorder'
),
path
(
'addorder'
,
addorder
,
name
=
'addorder'
),
path
(
'additem'
,
additem
,
name
=
'additem'
),
path
(
'addcustomer'
,
addcustomer
,
name
=
'addcustomer'
),
path
(
'addingredient'
,
addingredient
,
name
=
'addingredient'
),
path
(
'addBaseFlavor'
,
addbaseflavor
,
name
=
'addBaseFlavor'
),
path
(
'addinventory'
,
addinventory
,
name
=
'addinventory'
),
path
(
'addinventory'
,
addinventory
,
name
=
'addinventory'
),
#queries
#queries
...
...
main/views.py
View file @
3ba6e692
from
django.shortcuts
import
render
,
redirect
from
django.shortcuts
import
render
,
redirect
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
.forms
import
AddInventoryForm
,
AddOrderForm
from
.forms
import
*
from
.models
import
*
from
.models
import
*
# ========================== MAIN VIEWS ==========================
def
homepage
(
request
):
def
homepage
(
request
):
return
render
(
request
,
"blizzardblast/templates/index.html"
)
return
render
(
request
,
"blizzardblast/templates/index.html"
)
def
order
(
request
):
def
order
(
request
):
orders_context
=
Orders
.
objects
.
all
()
orders_context
=
Orders
.
objects
.
all
()
return
render
(
request
,
"blizzardblast/templates/order.html"
,
{
'orders'
:
orders_context
})
return
render
(
request
,
"blizzardblast/templates/order.html"
,
{
'orders'
:
orders_context
})
def
receipt
(
request
):
def
receipt
(
request
):
return
render
(
request
,
"blizzardblast/templates/receipt.html"
)
return
render
(
request
,
"blizzardblast/templates/receipt.html"
)
def
inventory
(
request
):
def
inventory
(
request
):
return
render
(
request
,
"blizzardblast/templates/inventory.html"
)
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
)
def
schedule
(
request
):
def
schedule
(
request
):
all_values
=
EmployeeRole
.
objects
.
all
()
all_values
=
EmployeeRole
.
objects
.
all
()
return
render
(
request
,
# 5: FILTER EMPLOYEES AND ROLES BY DATE IN ORDER - xx
"blizzardblast/templates/schedule.html"
,
date_order_query
=
EmployeeRole
.
objects
.
all
()
.
order_by
(
'role_date'
)
{
'all_values'
:
all_values
}
return
render
(
request
,
"blizzardblast/templates/schedule.html"
,
{
'all_values'
:
all_values
}
)
)
def
report
(
request
):
return
render
(
request
,
"blizzardblast/templates/report.html"
)
# ========================== SCHEDULE QUERIES ==========================
# 1: FILTER EMPLOYEES BY MANAGER FOR THE DAY - mate
# 1: FILTER EMPLOYEES BY MANAGER FOR THE DAY - mate
def
manager_query
(
request
):
def
manager_query
(
request
):
ismanager_query
=
EmployeeRole
.
objects
.
all
()
.
filter
(
is_manager
=
'Y'
)
ismanager_query
=
EmployeeRole
.
objects
.
all
()
.
filter
(
is_manager
=
'Y'
)
...
@@ -74,17 +75,11 @@ def alphabetical_query(request):
...
@@ -74,17 +75,11 @@ def alphabetical_query(request):
})
})
def
report
(
request
):
return
render
(
request
,
"blizzardblast/templates/report.html"
)
#
FORMS
#
========================== FORMS ==========================
def
addorder
(
request
):
def
addorder
(
request
):
form
=
AddOrderForm
()
form
=
AddOrderForm
()
context
=
{
'form'
:
form
}
context
=
{
'form'
:
form
}
if
request
.
method
==
'POST'
:
if
request
.
method
==
'POST'
:
#print("Printing post: ", request.POST)
#print("Printing post: ", request.POST)
...
@@ -93,9 +88,48 @@ def addorder(request):
...
@@ -93,9 +88,48 @@ def addorder(request):
form
.
save
()
form
.
save
()
return
redirect
(
'/order'
)
return
redirect
(
'/order'
)
return
render
(
request
,
"blizzardblast/templates/addorder.html"
,
context
)
return
render
(
request
,
"blizzardblast/templates/
forms/
addorder.html"
,
context
)
def
additem
(
request
):
form
=
AddItemForm
()
context
=
{
'form'
:
form
}
if
request
.
method
==
'POST'
:
form
=
AddItemForm
(
request
.
POST
)
if
form
.
is_valid
():
form
.
save
()
return
redirect
(
'/order'
)
return
render
(
request
,
"blizzardblast/templates/forms/additem.html"
,
context
)
def
addcustomer
(
request
):
form
=
AddCustomerForm
()
context
=
{
'form'
:
form
}
if
request
.
method
==
'POST'
:
form
=
AddCustomerForm
(
request
.
POST
)
if
form
.
is_valid
():
form
.
save
()
return
redirect
(
'/order'
)
return
render
(
request
,
"blizzardblast/templates/forms/addcustomer.html"
,
context
)
def
addingredient
(
request
):
form
=
AddIngredient
()
context
=
{
'form'
:
form
}
if
request
.
method
==
'POST'
:
form
=
AddIngredient
(
request
.
POST
)
if
form
.
is_valid
():
form
.
save
()
return
redirect
(
'/inventory'
)
return
render
(
request
,
"blizzardblast/templates/forms/addingredient.html"
,
context
)
def
addbaseflavor
(
request
):
form
=
AddBaseFlavor
()
context
=
{
'form'
:
form
}
if
request
.
method
==
'POST'
:
form
=
AddBaseFlavor
(
request
.
POST
)
if
form
.
is_valid
():
form
.
save
()
return
redirect
(
'/inventory'
)
return
render
(
request
,
"blizzardblast/templates/forms/addBaseFlavor.html"
,
context
)
def
addinventory
(
request
):
def
addinventory
(
request
):
form
=
AddInventoryForm
()
form
=
AddInventoryForm
()
return
render
(
request
,
"blizzardblast/templates/addinventory.html"
,
{
'form'
:
form
})
return
render
(
request
,
"blizzardblast/templates/
forms/
addinventory.html"
,
{
'form'
:
form
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment