Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GeoInt_SIDT
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mario Chirinos Colunga
GeoInt_SIDT
Commits
fb5cd2c0
Commit
fb5cd2c0
authored
Feb 08, 2019
by
Ulises Morales Ramírez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Paypal
parent
427ba53f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
246 additions
and
178 deletions
+246
-178
dataRetrieval.js
catalog/static/catalog/js/dataRetrieval.js
+1
-0
base_top.html
catalog/templates/base_top.html
+2
-1
show_cart.html
catalog/templates/show_cart.html
+209
-175
user_button.html
catalog/templates/user_button.html
+9
-0
views.py
catalog/views.py
+25
-2
No files found.
catalog/static/catalog/js/dataRetrieval.js
View file @
fb5cd2c0
...
...
@@ -445,6 +445,7 @@ $(document).ready(function () {
});
}
else
{
hideWaitingModal
();
$
(
'aside'
).
removeClass
(
"control-sidebar-open"
);
mssgModal
({
title
:
"No products were found!"
,
...
...
catalog/templates/base_top.html
View file @
fb5cd2c0
...
...
@@ -68,9 +68,10 @@
{% block user %}{% endblock %}
</li>
<!-- Control Sidebar Toggle Button -->
<li>
<li>
{% if showcart %}
<a
id=
"product-list-toggle"
href=
"#"
data-toggle=
"control-sidebar"
><i
class=
"fa fa-shopping-cart"
></i></a>
{% endif %}
</li>
</ul>
</div>
...
...
catalog/templates/show_cart.html
View file @
fb5cd2c0
...
...
@@ -2,211 +2,245 @@
{% load staticfiles %}
{% block headMedia %}
<link
rel=
"stylesheet"
href=
"{% static 'catalog/css/map.css' %}"
type=
"text/css"
>
<link
rel=
"stylesheet"
href=
"{% static 'catalog/css/body.css' %}"
type=
"text/css"
>
<link
rel=
"stylesheet"
href=
"{% static 'catalog/css/modal1.css' %}"
type=
"text/css"
>
<!-- <link rel="stylesheet" href="https://openlayers.org/en/v4.6.4/css/ol.css" type="text/css">-->
<link
rel=
"stylesheet"
href=
"https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/css/ol.css"
>
<link
rel=
"stylesheet"
href=
"{% static 'catalog/css/map.css' %}"
type=
"text/css"
>
<link
rel=
"stylesheet"
href=
"{% static 'catalog/css/body.css' %}"
type=
"text/css"
>
<link
rel=
"stylesheet"
href=
"{% static 'catalog/css/modal1.css' %}"
type=
"text/css"
>
<!-- <link rel="stylesheet" href="https://openlayers.org/en/v4.6.4/css/ol.css" type="text/css">-->
<link
rel=
"stylesheet"
href=
"https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/css/ol.css"
>
<script
src=
"https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"
></script>
<!-- <script src="https://openlayers.org/en/v4.6.4/build/ol.js"></script>-->
<script
src=
"https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/build/ol.js"
></script>
<script
src=
"https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"
></script>
<!-- <script src="https://openlayers.org/en/v4.6.4/build/ol.js"></script>-->
<script
src=
"https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/build/ol.js"
></script>
<script
src=
"{% static 'catalog/js/openLayers4.js' %}"
></script>
<script
src=
"{% static 'catalog/js/sidtMap.js' %}"
></script>
<script
src=
"{% static 'catalog/js/openLayers4.js' %}"
></script>
<script
src=
"{% static 'catalog/js/sidtMap.js' %}"
></script>
{% endblock %}
{% block messages %}
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
>
<i
class=
"fa fa-envelope-o"
></i>
<span
class=
"label label-success"
>
4
</span>
</a>
<ul
class=
"dropdown-menu"
>
<li
class=
"header"
>
You have 4 messages
</li>
<li>
<!-- inner menu: contains the actual data -->
<ul
class=
"menu"
>
<li>
<!-- start message -->
<a
href=
"#"
>
<div
class=
"pull-left"
>
<img
src=
"dist/img/user2-160x160.jpg"
class=
"img-circle"
alt=
"User Image"
>
</div>
<h4>
Support Team
<small><i
class=
"fa fa-clock-o"
></i>
5 mins
</small>
</h4>
<p>
Why not buy a new awesome theme?
</p>
</a>
</li>
<!-- end message -->
<li>
<a
href=
"#"
>
<div
class=
"pull-left"
>
<img
src=
"dist/img/user3-128x128.jpg"
class=
"img-circle"
alt=
"User Image"
>
</div>
<h4>
AdminLTE Design Team
<small><i
class=
"fa fa-clock-o"
></i>
2 hours
</small>
</h4>
<p>
Why not buy a new awesome theme?
</p>
</a>
</li>
</ul>
</li>
<li
class=
"footer"
><a
href=
"#"
>
See All Messages
</a></li>
</ul>
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
>
<i
class=
"fa fa-envelope-o"
></i>
<span
class=
"label label-success"
>
4
</span>
</a>
<ul
class=
"dropdown-menu"
>
<li
class=
"header"
>
You have 4 messages
</li>
<li>
<!-- inner menu: contains the actual data -->
<ul
class=
"menu"
>
<li>
<!-- start message -->
<a
href=
"#"
>
<div
class=
"pull-left"
>
<img
src=
"dist/img/user2-160x160.jpg"
class=
"img-circle"
alt=
"User Image"
>
</div>
<h4>
Support Team
<small><i
class=
"fa fa-clock-o"
></i>
5 mins
</small>
</h4>
<p>
Why not buy a new awesome theme?
</p>
</a>
</li>
<!-- end message -->
<li>
<a
href=
"#"
>
<div
class=
"pull-left"
>
<img
src=
"dist/img/user3-128x128.jpg"
class=
"img-circle"
alt=
"User Image"
>
</div>
<h4>
AdminLTE Design Team
<small><i
class=
"fa fa-clock-o"
></i>
2 hours
</small>
</h4>
<p>
Why not buy a new awesome theme?
</p>
</a>
</li>
</ul>
</li>
<li
class=
"footer"
><a
href=
"#"
>
See All Messages
</a></li>
</ul>
{% endblock %}
{% block notifications %}
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
>
<i
class=
"fa fa-bell-o"
></i>
<span
class=
"label label-warning"
>
10
</span>
</a>
<ul
class=
"dropdown-menu"
>
<li
class=
"header"
>
You have 10 notifications
</li>
<li>
<!-- inner menu: contains the actual data -->
<ul
class=
"menu"
>
<li>
<a
href=
"#"
>
<i
class=
"fa fa-users text-aqua"
></i>
5 new members joined today
</a>
</li>
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
>
<i
class=
"fa fa-bell-o"
></i>
<span
class=
"label label-warning"
>
10
</span>
</a>
<ul
class=
"dropdown-menu"
>
<li
class=
"header"
>
You have 10 notifications
</li>
<li>
<!-- inner menu: contains the actual data -->
<ul
class=
"menu"
>
<li>
<a
href=
"#"
>
<i
class=
"fa fa-users text-aqua"
></i>
5 new members joined today
</a>
</li>
</li>
</ul>
</li>
<li
class=
"footer"
><a
href=
"#"
>
View all
</a></li>
</ul>
</li>
</ul>
</li>
<li
class=
"footer"
><a
href=
"#"
>
View all
</a></li>
</ul>
{% endblock %}
{% block tasks %}
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
>
<i
class=
"fa fa-flag-o"
></i>
<span
class=
"label label-danger"
>
9
</span>
</a>
<ul
c
{%
load
static
%}
lass=
"dropdown-menu"
>
<li
class=
"header"
>
You have 9 tasks
</li>
<li>
<!-- inner menu: contains the actual data -->
<ul
class=
"menu"
>
<li>
<!-- Task item -->
<a
href=
"#"
>
<h3>
Design some buttons
<small
class=
"pull-right"
>
20%
</small>
</h3>
<div
class=
"progress xs"
>
<div
class=
"progress-bar progress-bar-aqua"
style=
"width: 20%"
role=
"progressbar"
aria-valuenow=
"20"
aria-valuemin=
"0"
aria-valuemax=
"100"
>
<span
class=
"sr-only"
>
20% Complete
</span>
</div>
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
>
<i
class=
"fa fa-flag-o"
></i>
<span
class=
"label label-danger"
>
9
</span>
</a>
<ul
c
{%
load
static
%}
lass=
"dropdown-menu"
>
<li
class=
"header"
>
You have 9 tasks
</li>
<li>
<!-- inner menu: contains the actual data -->
<ul
class=
"menu"
>
<li>
<!-- Task item -->
<a
href=
"#"
>
<h3>
Design some buttons
<small
class=
"pull-right"
>
20%
</small>
</h3>
<div
class=
"progress xs"
>
<div
class=
"progress-bar progress-bar-aqua"
style=
"width: 20%"
role=
"progressbar"
aria-valuenow=
"20"
aria-valuemin=
"0"
aria-valuemax=
"100"
>
<span
class=
"sr-only"
>
20% Complete
</span>
</div>
</a>
</li>
<!-- end task item -->
</ul>
</li>
<li
class=
"footer"
>
<a
href=
"#"
>
View all tasks
</a>
</li>
</ul>
</div>
</a>
</li>
<!-- end task item -->
</ul>
</li>
<li
class=
"footer"
>
<a
href=
"#"
>
View all tasks
</a>
</li>
</ul>
{% endblock %}
{% block sidebar %}
<div
class=
"form-group"
>
<br>
<ul
class=
"sidebar-menu"
data-widget=
"tree"
>
<li>
<a
class=
"treeview "
href=
"{{ BASE_URL }}/catalog"
>
<i
class=
"fa fa-map"
></i>
<span>
Home
</span>
<span
class=
"pull-right-container"
>
<div
class=
"form-group"
>
<br>
<ul
class=
"sidebar-menu"
data-widget=
"tree"
>
<li>
<a
class=
"treeview "
href=
"{{ BASE_URL }}/catalog"
>
<i
class=
"fa fa-map"
></i>
<span>
Home
</span>
<span
class=
"pull-right-container"
>
<span
class=
"label label-primary pull-right"
></span>
</span>
</a>
</li>
</ul>
</div>
<!-- form-group-->
</a>
</li>
</ul>
</div>
<!-- form-group-->
{% endblock %}
{% block user %}
{% include "user_button.html" %}
{% include "user_button.html" %}
{% endblock %}
{% block content %}
<!-- Content Wrapper. Contains page content -->
<!-- Main content -->
<div
id=
"cartPage"
class=
"wrapper"
style=
"background-color: #ecf0f5"
>
<div
class=
"text-center"
><h1>
Shopping Cart
</h1></div>
<!-- Content Wrapper. Contains page content -->
<!-- Main content -->
<div
id=
"cartPage"
class=
"wrapper"
style=
"background-color: #ecf0f5"
>
<div
class=
"text-center"
><h1>
Shopping Cart
</h1></div>
<!-- Content Wrapper. Contains page content -->
<!-- Main content -->
<section
class=
"content"
style=
"overflow-y: auto; height: 85vh"
>
<div
class=
"row"
>
<div
class=
"col-md-5 col-md-offset-2"
>
<section
class=
"content"
style=
"overflow-y: auto; height: 85vh"
>
<div
class=
"row"
>
<div
class=
"col-md-5 col-md-offset-2"
>
{% for product in product_list %}
<div
class=
"box box-warning"
style=
"margin-bottom: 10px"
>
<div
class=
"box-header with-border"
>
<h3
class=
"box-title"
>
Product {{ product.aggreg_date }}
</h3>
<div
class=
"box-tools pull-right"
>
<span
class=
"badge bg-green"
>
Price ${{ product.price }}
</span>
<button
type=
"button"
class=
"btn btn-box-tool"
data-widget=
"collapse"
>
<i
class=
"fa fa-minus"
></i>
</button>
<div
class=
"box box-warning"
style=
"margin-bottom: 10px"
>
<div
class=
"box-header with-border"
>
<h3
class=
"box-title"
>
{{ product.process }}: {{ product.aggreg_date }}
</h3>
<div
class=
"box-tools pull-right"
>
<span
class=
"badge bg-green"
>
Price ${{ product.price }}
</span>
<button
type=
"button"
class=
"btn btn-box-tool"
data-widget=
"collapse"
>
<i
class=
"fa fa-minus"
></i>
</button>
</div>
</div>
<div
class=
"box-body"
>
<ul
class=
"products-list product-list-in-box"
>
{% for catalog in product.catalog %}
<li
class=
"item"
>
<div
class=
"product-img"
>
<img
src=
"data:image/jpeg;base64, {{ catalog.info.img }}"
>
</div>
</div>
<div
class=
"box-body"
>
<ul
class=
"products-list product-list-in-box"
>
{% for catalog in product.catalog %}
<li
class=
"item"
>
<div
class=
"product-img"
>
<img
src=
"data:image/jpeg;base64, {{ catalog.info.img }}"
>
</div>
<div
class=
"product-info"
>
<div
class=
"product-info"
>
<span
class=
"product-title"
>
{{ catalog.info.identifier }}
</span>
<span
class=
"product-description"
>
<span
class=
"product-description"
>
{{ catalog.info.instrumentname }}
</span>
</div>
</li>
{% endfor %}
</ul>
</div>
</div>
{% endfor %}
</div>
</li>
{% endfor %}
</ul>
</div>
</div>
<div
class=
"col-md-3"
>
<div
class=
"box box-warning"
>
<div
class=
"box-header with-border"
>
<h3
class=
"box-title"
>
Summary
</h3>
</div>
<div
class=
"box-body"
>
<div
class=
"table-responsive"
>
<table
class=
"table"
>
<tbody>
<tr>
<th>
Total products:
</th>
<td>
{{ total_products }}
</td>
</tr>
<tr>
<th>
Total price:
</th>
<td>
${{ total_price }}
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td><a
href=
"../pay"
class=
"btn btn-primary"
>
Pay
</a></td>
</tr>
</tfoot>
</table>
</div>
{% endfor %}
</div>
<div
class=
"col-md-3"
>
<div
class=
"box box-warning"
>
<div
class=
"box-header with-border"
>
<h3
class=
"box-title"
>
Summary
</h3>
</div>
<div
class=
"box-body"
>
<div
class=
"table-responsive"
>
<table
class=
"table"
>
<tbody>
<tr>
<th>
Total products:
</th>
<td>
{{ total_products }}
</td>
</tr>
<tr>
<th>
Total price:
</th>
<td>
${{ total_price }}
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>
<a
href=
"../pay"
class=
"btn btn-primary pull-right"
>
Pay
</a>
</td>
<td>
<form
action=
"https://www.sandbox.paypal.com/cgi-bin/webscr"
method=
"post"
>
<input
type=
"hidden"
name=
"cmd"
value=
"_cart"
>
<input
type=
"hidden"
name=
"upload"
value=
"1"
>
<input
type=
"hidden"
name=
"business"
value=
"ulisexmorales-facilitator@gmail.com"
>
<input
type=
"hidden"
name=
"currency_code"
value=
"MXN"
>
{% for product in product_list %}
<input
type=
"hidden"
name=
"item_name_{{forloop.counter}}"
value=
"{{product.process}}: {{ product.aggreg_date }}"
>
<input
type=
"hidden"
name=
"amount_{{forloop.counter}}"
value=
"{{ product.price }}"
>
<input
type=
"hidden"
name=
"item_number_{{forloop.counter}}"
value=
"{{ product.product_id }}"
>
{% endfor %}
<input
type=
'hidden'
name=
'cancel_return'
value=
'http://www.example.com/cancel.php'
>
<input
type=
'hidden'
name=
'return'
value=
'http://www.example.com/success.php'
>
<input
type=
"image"
src=
"https://www.sandbox.paypal.com/es_XC/MX/i/btn/btn_buynowCC_LG.gif"
border=
"0"
name=
"submit"
alt=
"PayPal, la forma más segura y rápida de pagar en línea."
>
<img
alt=
""
border=
"0"
src=
"https://www.sandbox.paypal.com/es_XC/i/scr/pixel.gif"
width=
"1"
height=
"1"
>
</form>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</section>
<!-- /.content -->
</div>
<!-- Footer -->
<footer
class=
" page-footer font-small special-color-dark pt-5"
style=
"bottom: 0; position: absolute"
>
</div>
</section>
<!-- /.content -->
</div>
<!-- Footer -->
<footer
class=
" page-footer font-small special-color-dark pt-5"
style=
"bottom: 0; position: absolute"
>
<!-- Footer Elements -->
<div
class=
"container"
>
<!-- Social buttons
...
...
@@ -249,10 +283,10 @@
<!-- Copyright -->
</footer>
<!-- Footer -->
<!-- Footer -->
<!-- /.content -->
<!-- /.content -->
{% endblock %}
{% block scripts %}
<!-- page script -->
<!-- page script -->
{% endblock %}
catalog/templates/user_button.html
View file @
fb5cd2c0
...
...
@@ -34,6 +34,15 @@
</span>
</a>
</li>
<li>
<a
class=
"treeview "
href=
"{{ BASE_URL }}/catalog/cart"
>
<i
class=
"fa fa-shopping-cart"
></i>
<span>
View shopping cart
</span>
<span
class=
"pull-right-container"
>
<span
class=
"label label-primary pull-right"
></span>
</span>
</a>
</li>
<li>
<a
class=
"treeview "
href=
"{% url 'logout' %}?next={{ request.path }}"
>
<i
class=
"fa fa-sign-out"
></i>
...
...
catalog/views.py
View file @
fb5cd2c0
...
...
@@ -62,9 +62,9 @@ def map(request):
View function for home page of site.
"""
form
=
ASFSearchForm
(
request
.
POST
)
showcart
=
True
# Render the HTML template index.html with the data in the context variable
return
render
(
request
,
'map.html'
,
{
"searchForm"
:
form
})
return
render
(
request
,
'map.html'
,
{
"searchForm"
:
form
,
"showcart"
:
showcart
})
#-------------------------------------------------------------------------------
def
requestToImage
(
request
):
...
...
@@ -559,5 +559,28 @@ def Pay (request):
user
=
User
.
objects
.
get
(
id
=
request
.
user
.
id
)
prod_list
=
[]
product_list
=
Purchase
.
objects
.
values
(
'id'
,
'user'
,
'productList'
,
'purchased'
,
'price'
,
'aggreg_date'
,
'search__process_id__name'
)
.
filter
(
user
=
user
,
purchased
=
0
)
total_price
=
0
total_products
=
0
for
products
in
product_list
:
product
=
json
.
loads
(
products
[
'productList'
])
prod_list
.
append
({
'purchased'
:
products
[
'purchased'
],
'price'
:
products
[
'price'
],
'aggreg_date'
:
products
[
'aggreg_date'
],
'catalog'
:
product
,
'product_id'
:
products
[
'id'
],
"process"
:
products
[
'search__process_id__name'
],
})
total_price
+=
products
[
'price'
]
total_products
+=
1
return
render
(
request
,
'show_cart.html'
,
{
'product_list'
:
prod_list
,
'total_price'
:
total_price
,
'total_products'
:
total_products
})
#-------------------------------------
def
Pay
(
request
):
Purchase
.
objects
.
filter
(
user_id
=
request
.
user
.
id
,
purchased
=
0
)
.
update
(
purchased
=
True
)
return
redirect
(
'../../reports'
)
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