Commit e191223e authored by Ulises Morales Ramírez's avatar Ulises Morales Ramírez

Merge branch 'paypal' into 'dev'

Paypal

See merge request !7
parents 427ba53f fb5cd2c0
......@@ -445,6 +445,7 @@ $(document).ready(function () {
});
} else {
hideWaitingModal();
$('aside').removeClass("control-sidebar-open");
mssgModal({
title : "No products were found!",
......
......@@ -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>
......
This diff is collapsed.
......@@ -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>
......
......@@ -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')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment