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
e191223e
Commit
e191223e
authored
Feb 08, 2019
by
Ulises Morales Ramírez
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'paypal' into 'dev'
Paypal See merge request
!7
parents
427ba53f
fb5cd2c0
Changes
5
Show 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 @
e191223e
...
@@ -445,6 +445,7 @@ $(document).ready(function () {
...
@@ -445,6 +445,7 @@ $(document).ready(function () {
});
});
}
else
{
}
else
{
hideWaitingModal
();
$
(
'aside'
).
removeClass
(
"control-sidebar-open"
);
$
(
'aside'
).
removeClass
(
"control-sidebar-open"
);
mssgModal
({
mssgModal
({
title
:
"No products were found!"
,
title
:
"No products were found!"
,
...
...
catalog/templates/base_top.html
View file @
e191223e
...
@@ -68,9 +68,10 @@
...
@@ -68,9 +68,10 @@
{% block user %}{% endblock %}
{% block user %}{% endblock %}
</li>
</li>
<!-- Control Sidebar Toggle Button -->
<!-- Control Sidebar Toggle Button -->
<li>
<li>
{% if showcart %}
<a
id=
"product-list-toggle"
href=
"#"
data-toggle=
"control-sidebar"
><i
<a
id=
"product-list-toggle"
href=
"#"
data-toggle=
"control-sidebar"
><i
class=
"fa fa-shopping-cart"
></i></a>
class=
"fa fa-shopping-cart"
></i></a>
{% endif %}
</li>
</li>
</ul>
</ul>
</div>
</div>
...
...
catalog/templates/show_cart.html
View file @
e191223e
...
@@ -2,26 +2,26 @@
...
@@ -2,26 +2,26 @@
{% load staticfiles %}
{% load staticfiles %}
{% block headMedia %}
{% block headMedia %}
<link
rel=
"stylesheet"
href=
"{% static 'catalog/css/map.css' %}"
type=
"text/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/body.css' %}"
type=
"text/css"
>
<link
rel=
"stylesheet"
href=
"{% static 'catalog/css/modal1.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://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=
"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://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://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.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/openLayers4.js' %}"
></script>
<script
src=
"{% static 'catalog/js/sidtMap.js' %}"
></script>
<script
src=
"{% static 'catalog/js/sidtMap.js' %}"
></script>
{% endblock %}
{% endblock %}
{% block messages %}
{% block messages %}
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
>
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
>
<i
class=
"fa fa-envelope-o"
></i>
<i
class=
"fa fa-envelope-o"
></i>
<span
class=
"label label-success"
>
4
</span>
<span
class=
"label label-success"
>
4
</span>
</a>
</a>
<ul
class=
"dropdown-menu"
>
<ul
class=
"dropdown-menu"
>
<li
class=
"header"
>
You have 4 messages
</li>
<li
class=
"header"
>
You have 4 messages
</li>
<li>
<li>
<!-- inner menu: contains the actual data -->
<!-- inner menu: contains the actual data -->
...
@@ -54,14 +54,14 @@
...
@@ -54,14 +54,14 @@
</ul>
</ul>
</li>
</li>
<li
class=
"footer"
><a
href=
"#"
>
See All Messages
</a></li>
<li
class=
"footer"
><a
href=
"#"
>
See All Messages
</a></li>
</ul>
</ul>
{% endblock %}
{% endblock %}
{% block notifications %}
{% block notifications %}
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
>
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
>
<i
class=
"fa fa-bell-o"
></i>
<i
class=
"fa fa-bell-o"
></i>
<span
class=
"label label-warning"
>
10
</span>
<span
class=
"label label-warning"
>
10
</span>
</a>
</a>
<ul
class=
"dropdown-menu"
>
<ul
class=
"dropdown-menu"
>
<li
class=
"header"
>
You have 10 notifications
</li>
<li
class=
"header"
>
You have 10 notifications
</li>
<li>
<li>
<!-- inner menu: contains the actual data -->
<!-- inner menu: contains the actual data -->
...
@@ -76,14 +76,14 @@
...
@@ -76,14 +76,14 @@
</ul>
</ul>
</li>
</li>
<li
class=
"footer"
><a
href=
"#"
>
View all
</a></li>
<li
class=
"footer"
><a
href=
"#"
>
View all
</a></li>
</ul>
</ul>
{% endblock %}
{% endblock %}
{% block tasks %}
{% block tasks %}
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
>
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
>
<i
class=
"fa fa-flag-o"
></i>
<i
class=
"fa fa-flag-o"
></i>
<span
class=
"label label-danger"
>
9
</span>
<span
class=
"label label-danger"
>
9
</span>
</a>
</a>
<ul
c
{%
load
static
%}
lass=
"dropdown-menu"
>
<ul
c
{%
load
static
%}
lass=
"dropdown-menu"
>
<li
class=
"header"
>
You have 9 tasks
</li>
<li
class=
"header"
>
You have 9 tasks
</li>
<li>
<li>
<!-- inner menu: contains the actual data -->
<!-- inner menu: contains the actual data -->
...
@@ -108,10 +108,10 @@
...
@@ -108,10 +108,10 @@
<li
class=
"footer"
>
<li
class=
"footer"
>
<a
href=
"#"
>
View all tasks
</a>
<a
href=
"#"
>
View all tasks
</a>
</li>
</li>
</ul>
</ul>
{% endblock %}
{% endblock %}
{% block sidebar %}
{% block sidebar %}
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<br>
<br>
<ul
class=
"sidebar-menu"
data-widget=
"tree"
>
<ul
class=
"sidebar-menu"
data-widget=
"tree"
>
<li>
<li>
...
@@ -124,16 +124,16 @@
...
@@ -124,16 +124,16 @@
</a>
</a>
</li>
</li>
</ul>
</ul>
</div>
</div>
<!-- form-group-->
<!-- form-group-->
{% endblock %}
{% endblock %}
{% block user %}
{% block user %}
{% include "user_button.html" %}
{% include "user_button.html" %}
{% endblock %}
{% endblock %}
{% block content %}
{% block content %}
<!-- Content Wrapper. Contains page content -->
<!-- Content Wrapper. Contains page content -->
<!-- Main content -->
<!-- Main content -->
<div
id=
"cartPage"
class=
"wrapper"
style=
"background-color: #ecf0f5"
>
<div
id=
"cartPage"
class=
"wrapper"
style=
"background-color: #ecf0f5"
>
<div
class=
"text-center"
><h1>
Shopping Cart
</h1></div>
<div
class=
"text-center"
><h1>
Shopping Cart
</h1></div>
<!-- Content Wrapper. Contains page content -->
<!-- Content Wrapper. Contains page content -->
<!-- Main content -->
<!-- Main content -->
...
@@ -143,7 +143,7 @@
...
@@ -143,7 +143,7 @@
{% for product in product_list %}
{% for product in product_list %}
<div
class=
"box box-warning"
style=
"margin-bottom: 10px"
>
<div
class=
"box box-warning"
style=
"margin-bottom: 10px"
>
<div
class=
"box-header with-border"
>
<div
class=
"box-header with-border"
>
<h3
class=
"box-title"
>
Product
{{ product.aggreg_date }}
</h3>
<h3
class=
"box-title"
>
{{ product.process }}:
{{ product.aggreg_date }}
</h3>
<div
class=
"box-tools pull-right"
>
<div
class=
"box-tools pull-right"
>
<span
class=
"badge bg-green"
>
Price ${{ product.price }}
</span>
<span
class=
"badge bg-green"
>
Price ${{ product.price }}
</span>
<button
type=
"button"
class=
"btn btn-box-tool"
data-widget=
"collapse"
>
<button
type=
"button"
class=
"btn btn-box-tool"
data-widget=
"collapse"
>
...
@@ -193,7 +193,41 @@
...
@@ -193,7 +193,41 @@
</tbody>
</tbody>
<tfoot>
<tfoot>
<tr>
<tr>
<td><a
href=
"../pay"
class=
"btn btn-primary"
>
Pay
</a></td>
<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>
</tr>
</tfoot>
</tfoot>
</table>
</table>
...
@@ -204,9 +238,9 @@
...
@@ -204,9 +238,9 @@
</div>
</div>
</section>
</section>
<!-- /.content -->
<!-- /.content -->
</div>
</div>
<!-- Footer -->
<!-- Footer -->
<footer
class=
" page-footer font-small special-color-dark pt-5"
style=
"bottom: 0; position: absolute"
>
<footer
class=
" page-footer font-small special-color-dark pt-5"
style=
"bottom: 0; position: absolute"
>
<!-- Footer Elements -->
<!-- Footer Elements -->
<div
class=
"container"
>
<div
class=
"container"
>
<!-- Social buttons
<!-- Social buttons
...
@@ -249,10 +283,10 @@
...
@@ -249,10 +283,10 @@
<!-- Copyright -->
<!-- Copyright -->
</footer>
</footer>
<!-- Footer -->
<!-- Footer -->
<!-- /.content -->
<!-- /.content -->
{% endblock %}
{% endblock %}
{% block scripts %}
{% block scripts %}
<!-- page script -->
<!-- page script -->
{% endblock %}
{% endblock %}
catalog/templates/user_button.html
View file @
e191223e
...
@@ -34,6 +34,15 @@
...
@@ -34,6 +34,15 @@
</span>
</span>
</a>
</a>
</li>
</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>
<li>
<a
class=
"treeview "
href=
"{% url 'logout' %}?next={{ request.path }}"
>
<a
class=
"treeview "
href=
"{% url 'logout' %}?next={{ request.path }}"
>
<i
class=
"fa fa-sign-out"
></i>
<i
class=
"fa fa-sign-out"
></i>
...
...
catalog/views.py
View file @
e191223e
...
@@ -62,9 +62,9 @@ def map(request):
...
@@ -62,9 +62,9 @@ def map(request):
View function for home page of site.
View function for home page of site.
"""
"""
form
=
ASFSearchForm
(
request
.
POST
)
form
=
ASFSearchForm
(
request
.
POST
)
showcart
=
True
# Render the HTML template index.html with the data in the context variable
# 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
):
def
requestToImage
(
request
):
...
@@ -559,5 +559,28 @@ def Pay (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
)
Purchase
.
objects
.
filter
(
user_id
=
request
.
user
.
id
,
purchased
=
0
)
.
update
(
purchased
=
True
)
return
redirect
(
'../../reports'
)
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