Commit 9a97145b authored by Ulises Morales Ramírez's avatar Ulises Morales Ramírez

Merge branch 'dev' of http://gitlab.geoint.mx/mario.chirinos/GeoInt_SIDT into modificaciones

parents 62ff5847 d99fa5af
......@@ -3,6 +3,7 @@
config/
geosentinel/
geosentinel
catalog/static/catalog/images/sat_preview/
db.sqlite3-journal
# django stufff
......@@ -27,4 +28,4 @@ venv.bak/
.python-version
!**/migrations
!**/migrations/__init__.py
\ No newline at end of file
!**/migrations/__init__.py
......@@ -91,7 +91,7 @@ function updateCart(){
temp_2.content.querySelector('h4').id = product.uuid + "-h4";
temp_2.content.querySelector('h4').textContent = product.info.producttype + "_" + product.info.tileid;
temp_2.content.querySelector('p').textContent = product.info.beginposition;
temp_2.content.querySelector('img').src = "data:image/jpeg;base64, " + product.info.img;
temp_2.content.querySelector('img').src = product.info.img;
temp_2.content.querySelectorAll('span')[1].textContent = product.info.identifier;
temp_2.content.querySelectorAll('span')[2].textContent = product.info.size;
temp_2.content.querySelectorAll('span')[3].textContent = product.info.instrumentname;
......@@ -539,7 +539,7 @@ $(document).ready(function () {
'producttype' : data.product.producttype,
'tileid' : data.product.tileid,
'beginposition' : data.product.beginposition,
//'img' : data.img,
'img' : data.img,
'identifier' : data.product.identifier,
'size' : data.product.size,
'instrumentname' : data.product.instrumentname
......
......@@ -166,7 +166,8 @@
{% for catalog in product.catalog %}
<li class="item">
<div class="product-img">
<img src="data:image/jpeg;base64, {{ catalog.info.img }}">
<img src="{% static 'catalog/images/sat_preview/' %}{{ catalog.info.identifier }}_preview.png">
<!--<img src="{{ catalog.info.img }}"> -->
</div>
<div class="product-info" style="word-break: break-all">
<span class="product-title">
......
......@@ -16,6 +16,7 @@ import os
from geosentinel import APISentinel, polygonToBox
from mail.views import wsMail, wsMail2
from django.contrib import messages
import base64
dirname = os.path.dirname(__file__)
configfile = os.path.join(dirname, '../config/config.json')
......@@ -223,7 +224,25 @@ def saveInCart(request):
user = User.objects.get(id=request.user.id)
product_list = json.loads(request.POST['cart_product_list'])
search = Search.objects.filter(user=user).last()
#print("saveIncart")
#print(search)
#print(product_list)
#reemplaza la imagen base64 que se guardaba en la bd por un archivo .png y solo se guarda la ruta
#-------
for product in product_list:
#print(product['info']['img'])
img_file = "catalog/static/catalog/images/sat_preview/"+product['info']['identifier']+"_preview.png";
if(not os.path.isfile(img_file) ): #si no existe el preview lo crea
#print("crea!")
fh = open("catalog/static/catalog/images/sat_preview/"+product['info']['identifier']+"_preview.png", "wb")
decstr=base64.b64decode(product['info']['img'])
fh.write(decstr)
fh.close()
product['info']['img'] = img_file;
#------
print(product_list)
if (len(product_list) != 0):
cartProd = Purchase(
user=user,
......@@ -232,7 +251,7 @@ def saveInCart(request):
purchased=False,
price=5.0
)
cartProd.save()
sav = cartProd.save()
return HttpResponse(status=204)
......
......@@ -146,12 +146,18 @@ function change(newType) {
}
// Chart.js modifies the object you pass in. Pass a copy of the object so we can use the original object later
var temp = jQuery.extend(true, {}, config);
temp.type = newType;
if (newType == 'radar' || newType == 'pie' || newType == 'polarArea' || newType == 'doughnut') {
temp.options.scales.xAxes = { "display": false };
temp.options.scales.yAxes = { "display": false };
var temp = jQuery.extend(true, {}, config);
if (newType == "stackedBar"){
temp.type = "bar";
temp.options.scales.xAxes = [{ "stacked": true }];
temp.options.scales.yAxes = [{ "stacked": true }];
}else{
temp.type = newType;
if (newType == 'radar' || newType == 'pie' || newType == 'polarArea' || newType == 'doughnut') {
temp.options.scales.xAxes = [{ "display": false, "stacked": false }];
temp.options.scales.yAxes = [{ "display": false, "stacked": false }];
}
}
myChart = new Chart(ctx, temp);
......
......@@ -65,9 +65,9 @@
</a>
</li>
<li>
<a class="treeview submenu" href="#" onclick="change('bubble')">
<a class="treeview submenu" href="#" onclick="change('stackedBar')">
<i class="fa fa-bar-chart"></i>
<span>Bubble Chart</span>
<span>Stacked Bar Chart</span>
<span class="pull-right-container">
<span class="label label-primary pull-right"></span>
</span>
......
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