Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
GrabGrub
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
Matthew Dominic M. Dizon
GrabGrub
Commits
f4ca1637
Commit
f4ca1637
authored
May 27, 2021
by
Jansen Lao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
7
parent
f74cd87b
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
1 deletion
+65
-1
add_food.html
GrabGrub/Kiosk/templates/Kiosk/add_food.html
+36
-0
base.html
GrabGrub/Kiosk/templates/Kiosk/base.html
+1
-1
view_foods.html
GrabGrub/Kiosk/templates/Kiosk/view_foods.html
+1
-0
urls.py
GrabGrub/Kiosk/urls.py
+1
-0
views.py
GrabGrub/Kiosk/views.py
+26
-0
No files found.
GrabGrub/Kiosk/templates/Kiosk/add_food.html
0 → 100644
View file @
f4ca1637
{% extends 'Kiosk/base.html' %}
{% load static %}
{% block content %}
<div
class=
"card w-75"
>
<div
class=
"card-header"
>
Enter Food Details:
</div>
<form
method=
"POST"
action=
"{% url 'add_food' %}"
>
{% csrf_token %}
<div
class=
"form-group"
>
<label
for=
"name"
>
Food Name:
</label>
<input
type=
"text"
class=
"form-control"
id=
"food_name"
name=
"food_name"
required
>
</div>
<div
class=
"form-group"
>
<label
for=
"name"
>
Description:
</label>
<input
type=
"text"
class=
"form-control"
id=
"description"
name=
"description"
required
>
</div>
<div
class=
"form-group"
>
<label
for=
"name"
>
Price:
</label>
<input
type=
"number"
class=
"form-control"
id=
"price"
name=
"price"
required
>
</div>
<div
class=
"form-group"
>
<label
for=
"name"
>
Date Created:
</label>
<input
type=
"date"
class=
"form-control"
id=
"date"
name=
"date"
required
>
</div>
<a
href=
"{% url 'add_food' %}"
><button
type=
"submit"
class=
"mt-3 btn btn-primary"
>
Add Food
</button></a>
</form>
</div>
{% endblock %}
GrabGrub/Kiosk/templates/Kiosk/base.html
View file @
f4ca1637
...
...
@@ -23,7 +23,7 @@
Matthew Dizon | 191735
</li>
<li
class=
"nav-item mx-2"
>
Jansen Lao | 19
1735
Jansen Lao | 19
2729
</li>
</ul>
</nav>
...
...
GrabGrub/Kiosk/templates/Kiosk/view_foods.html
View file @
f4ca1637
...
...
@@ -6,6 +6,7 @@
<div
class=
"container"
>
<h1
class=
"jumbotron-heading"
>
Food Items
</h1>
<p>
A table of all food items
</p>
<a
href=
"{% url 'add_food' %}"
><button
class=
"btn btn-dark"
>
Add Food
</button></a>
</div>
</section>
...
...
GrabGrub/Kiosk/urls.py
View file @
f4ca1637
...
...
@@ -13,6 +13,7 @@ urlpatterns = [
path
(
'update_order/<int:pk>'
,
views
.
update_order
,
name
=
"update_order"
),
path
(
'add_order'
,
views
.
add_order
,
name
=
"add_order"
),
# Path for Food Model
path
(
'add_food'
,
views
.
add_food
,
name
=
"add_food"
),
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
...
...
GrabGrub/Kiosk/views.py
View file @
f4ca1637
...
...
@@ -107,6 +107,32 @@ def add_order(request):
else
:
return
render
(
request
,
'Kiosk/add_order.html'
,
context
)
### Views for Add Food
def
add_food
(
request
):
if
(
request
.
method
==
"POST"
):
food_name
=
request
.
POST
.
get
(
'food_name'
)
description
=
request
.
POST
.
get
(
'description'
)
price
=
request
.
POST
.
get
(
'price'
)
created_at
=
request
.
POST
.
get
(
'date'
)
try
:
Food
.
objects
.
create
(
name
=
food_name
,
description
=
description
,
price
=
price
,
created_at
=
created_at
,
)
return
redirect
(
'view_foods'
)
except
Exception
as
e
:
message
=
e
print
(
message
)
return
render
(
request
,
'Kiosk/add_food.html'
)
else
:
return
render
(
request
,
'Kiosk/add_food.html'
)
### Views for Food Model
def
view_foods
(
request
):
foods
=
Food
.
objects
.
all
()
...
...
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