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
9a97145b
Commit
9a97145b
authored
Mar 29, 2019
by
Ulises Morales Ramírez
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://gitlab.geoint.mx/mario.chirinos/GeoInt_SIDT
into modificaciones
parents
62ff5847
d99fa5af
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
13 deletions
+40
-13
.gitignore
.gitignore
+2
-1
dataRetrieval.js
catalog/static/catalog/js/dataRetrieval.js
+2
-2
show_cart.html
catalog/templates/show_cart.html
+2
-1
views.py
catalog/views.py
+21
-2
reportImg.js
reports/static/reports/js/reportImg.js
+11
-5
aside.html
reports/templates/aside.html
+2
-2
No files found.
.gitignore
View file @
9a97145b
...
...
@@ -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
catalog/static/catalog/js/dataRetrieval.js
View file @
9a97145b
...
...
@@ -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
...
...
catalog/templates/show_cart.html
View file @
9a97145b
...
...
@@ -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"
>
...
...
catalog/views.py
View file @
9a97145b
...
...
@@ -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
)
...
...
reports/static/reports/js/reportImg.js
View file @
9a97145b
...
...
@@ -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
);
...
...
reports/templates/aside.html
View file @
9a97145b
...
...
@@ -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>
...
...
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