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
09ac6580
Commit
09ac6580
authored
May 27, 2021
by
Miguel Bandelaria
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
customer functionality
parent
077699b1
Pipeline
#1930
canceled with stages
Changes
5
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
12 deletions
+53
-12
base.html
GrabGrub/Kiosk/templates/Kiosk/base.html
+1
-1
update_customer.html
GrabGrub/Kiosk/templates/Kiosk/update_customer.html
+26
-0
view_customer_details.html
GrabGrub/Kiosk/templates/Kiosk/view_customer_details.html
+7
-10
urls.py
GrabGrub/Kiosk/urls.py
+2
-0
views.py
GrabGrub/Kiosk/views.py
+17
-1
No files found.
GrabGrub/Kiosk/templates/Kiosk/base.html
View file @
09ac6580
...
...
@@ -17,7 +17,7 @@
<a
class=
"navbar-brand mb-0"
href=
"/"
>
GrabGrub
</a>
<ul
class=
"navbar-nav"
>
<li
class=
"nav-item mx-2"
>
Miguel Bandelaria | 19
1735
Miguel Bandelaria | 19
0518
</li>
<li
class=
"nav-item mx-2"
>
Matthew Dizon | 191735
...
...
GrabGrub/Kiosk/templates/Kiosk/update_customer.html
0 → 100644
View file @
09ac6580
{% extends 'Kiosk/base.html' %}
{% load static %}
{% block content %}
<div
class=
"card w-75"
>
<div
class=
"card-header"
>
Customer Details:
</div>
<form
method=
"POST"
action=
"{% url 'update_customer' pk=customer.pk %}"
>
{% csrf_token %}
<div
class=
"form-group"
>
<label
for=
"name"
>
Customer Name:
</label>
<input
type=
"text"
class=
"form-control"
id=
"customer_name"
name=
"customer_name"
value=
"{{customer.name}}"
required
>
</div>
<div
class=
"form-group"
>
<label
for=
"name"
>
Address:
</label>
<input
type=
"text"
class=
"form-control"
id=
"address"
name=
"address"
value=
"{{customer.address}}"
required
>
</div>
<div
class=
"form-group"
>
<label
for=
"name"
>
City:
</label>
<input
type=
"text"
class=
"form-control"
id=
"city"
name=
"city"
value=
"{{customer.city}}"
required
>
</div>
<a
href=
"{% url 'update_customer' customer.pk %}"
><button
type=
"submit"
class=
"mt-3 btn btn-primary"
>
Update Customer
</button></a>
</form>
</div>
<a
href=
"{% url 'view_customer_details' customer.pk %}"
><button
class=
"btn btn-secondary"
>
Back
</button></a>
{% endblock %}
GrabGrub/Kiosk/templates/Kiosk/view_customer_details.html
View file @
09ac6580
...
...
@@ -7,16 +7,13 @@
Customer Details:
</div>
<ul
class=
"list-group list-group-flush"
>
<li
class=
"list-group-item"
><span
style=
"color: #8AB4F8; font-weight:bold"
>
Food
:
</span>
{{customer.name}}
</li>
<li
class=
"list-group-item"
><span
style=
"color: #8AB4F8; font-weight:bold"
>
Quantity
:
</span>
{{customer.address}}
</li>
<li
class=
"list-group-item"
><span
style=
"color: #8AB4F8; font-weight:bold"
>
Date of Order
:
</span>
{{customer.city}}
</li>
<li
class=
"list-group-item"
><span
style=
"color: #8AB4F8; font-weight:bold"
>
Customer Name
:
</span>
{{customer.name}}
</li>
<li
class=
"list-group-item"
><span
style=
"color: #8AB4F8; font-weight:bold"
>
Address
:
</span>
{{customer.address}}
</li>
<li
class=
"list-group-item"
><span
style=
"color: #8AB4F8; font-weight:bold"
>
City
:
</span>
{{customer.city}}
</li>
</ul>
</div>
<form
action=
"#"
method=
"post"
>
{% csrf_token %}
<input
type=
"hidden"
name=
"message"
value=
"Bottle deleted successfully"
>
<a
href=
"#"
><button
class=
"btn btn-secondary my-4"
>
Delete Customer
</button></a>
</form>
<a
href=
"#"
><button
type=
"submit"
class=
"mt-3 btn btn-primary"
>
Update Customer
</button></a>
<a
onclick=
"window.history.go(-1); return false;"
><button
class=
"btn btn-secondary"
>
Back
</button></a>
<a
href=
"{% url 'delete_customer' customer.pk %}"
><button
class=
"btn btn-danger my-4"
>
Delete Customer
</button></a>
<a
href=
"{% url 'update_customer' customer.pk %}"
><button
type=
"submit"
class=
"btn btn-primary"
>
Update Customer
</button></a>
<a
href=
"{% url 'view_customers' %}"
><button
class=
"btn btn-secondary"
>
Back
</button></a>
{% endblock %}
\ No newline at end of file
GrabGrub/Kiosk/urls.py
View file @
09ac6580
...
...
@@ -22,4 +22,6 @@ urlpatterns = [
# Path for Customer Model
path
(
'customers'
,
views
.
view_customers
,
name
=
"view_customers"
),
path
(
'view_customer_details/<int:pk>'
,
views
.
view_customer_details
,
name
=
"view_customer_details"
),
path
(
'update_customer/<int:pk>'
,
views
.
update_customer
,
name
=
"update_customer"
),
path
(
'delete_customer/<int:pk>'
,
views
.
delete_customer
,
name
=
"delete_customer"
),
]
\ No newline at end of file
GrabGrub/Kiosk/views.py
View file @
09ac6580
...
...
@@ -176,3 +176,19 @@ def view_customer_details(request, pk):
customer
=
get_object_or_404
(
Customer
,
pk
=
pk
)
context
=
{
"customer"
:
customer
}
return
render
(
request
,
'Kiosk/view_customer_details.html'
,
context
)
def
delete_customer
(
request
,
pk
):
Customer
.
objects
.
filter
(
pk
=
pk
)
.
delete
()
return
redirect
(
'view_customers'
)
def
update_customer
(
request
,
pk
):
if
(
request
.
method
==
"POST"
):
customer_name
=
request
.
POST
.
get
(
'customer_name'
)
address
=
request
.
POST
.
get
(
'address'
)
city
=
request
.
POST
.
get
(
'city'
)
Customer
.
objects
.
filter
(
pk
=
pk
)
.
update
(
name
=
customer_name
,
address
=
address
,
city
=
city
)
return
redirect
(
'view_customer_details'
,
pk
=
pk
)
else
:
customer
=
get_object_or_404
(
Customer
,
pk
=
pk
)
context
=
{
"customer"
:
customer
}
return
render
(
request
,
'Kiosk/update_customer.html'
,
context
)
\ No newline at end of file
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