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
62ff5847
Commit
62ff5847
authored
Mar 29, 2019
by
Ulises Morales Ramírez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
descripcion reportes
parent
c6a9dc1f
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
68 additions
and
41 deletions
+68
-41
models.py
catalog/models.py
+2
-1
dataRetrieval.js
catalog/static/catalog/js/dataRetrieval.js
+8
-2
map.html
catalog/templates/map.html
+1
-0
views.py
catalog/views.py
+7
-3
Reports_scripts.js
reports/static/reports/js/Reports_scripts.js
+29
-16
Reports.html
reports/templates/Reports.html
+5
-12
views.py
reports/views.py
+16
-7
No files found.
catalog/models.py
View file @
62ff5847
...
@@ -58,6 +58,7 @@ class Process(models.Model):
...
@@ -58,6 +58,7 @@ class Process(models.Model):
class
Search
(
models
.
Model
):
class
Search
(
models
.
Model
):
area
=
models
.
TextField
(
null
=
True
)
area
=
models
.
TextField
(
null
=
True
)
search_name
=
models
.
TextField
(
default
=
"Drawn polygon "
)
search_name
=
models
.
TextField
(
default
=
"Drawn polygon "
)
description
=
models
.
TextField
(
default
=
""
)
user
=
models
.
ForeignKey
(
User
,
on_delete
=
models
.
CASCADE
)
user
=
models
.
ForeignKey
(
User
,
on_delete
=
models
.
CASCADE
)
aggreg_date
=
models
.
DateTimeField
(
auto_now
=
True
)
# date of product aggregation
aggreg_date
=
models
.
DateTimeField
(
auto_now
=
True
)
# date of product aggregation
startDate
=
models
.
DateTimeField
(
verbose_name
=
'Start Date'
)
startDate
=
models
.
DateTimeField
(
verbose_name
=
'Start Date'
)
...
@@ -71,7 +72,7 @@ class Purchase(models.Model):
...
@@ -71,7 +72,7 @@ class Purchase(models.Model):
user
=
models
.
ForeignKey
(
User
,
on_delete
=
models
.
CASCADE
)
user
=
models
.
ForeignKey
(
User
,
on_delete
=
models
.
CASCADE
)
search
=
models
.
ForeignKey
(
Search
,
on_delete
=
models
.
CASCADE
)
search
=
models
.
ForeignKey
(
Search
,
on_delete
=
models
.
CASCADE
)
productList
=
models
.
TextField
(
verbose_name
=
"JSON Product List"
)
productList
=
models
.
TextField
(
verbose_name
=
"JSON Product List"
)
name
=
models
.
TextField
(
default
=
"
Drawn polygon
"
)
name
=
models
.
TextField
(
default
=
""
)
description
=
models
.
TextField
(
default
=
""
)
description
=
models
.
TextField
(
default
=
""
)
purchased
=
models
.
BooleanField
(
default
=
False
)
purchased
=
models
.
BooleanField
(
default
=
False
)
price
=
models
.
FloatField
(
default
=
0.0
)
price
=
models
.
FloatField
(
default
=
0.0
)
...
...
catalog/static/catalog/js/dataRetrieval.js
View file @
62ff5847
...
@@ -156,6 +156,8 @@ function drawPolygon(element) {
...
@@ -156,6 +156,8 @@ function drawPolygon(element) {
// set input box with polygon city name
// set input box with polygon city name
var
input_text
=
polygon
.
city
+
", "
+
polygon
.
state
;
var
input_text
=
polygon
.
city
+
", "
+
polygon
.
state
;
$
(
"#ajax-input"
).
val
(
input_text
);
$
(
"#ajax-input"
).
val
(
input_text
);
$
(
'#search_name'
).
val
(
input_text
);
$
(
"#area_description"
).
val
(
polygon
.
description
)
// remove prev polygon
// remove prev polygon
osmap
.
removePolygon
();
osmap
.
removePolygon
();
...
@@ -308,8 +310,7 @@ $('#ajax-input').focus(function () {
...
@@ -308,8 +310,7 @@ $('#ajax-input').focus(function () {
$
(
'#polygon-list'
).
click
(
function
()
{
$
(
'#polygon-list'
).
click
(
function
()
{
$
(
'#option-list'
).
hide
();
$
(
'#option-list'
).
hide
();
OPT_LIST_IS_HIDDEN
=
true
;
OPT_LIST_IS_HIDDEN
=
true
;
$
(
'#search_name'
).
val
(
$
(
'#ajax-input'
).
val
());
//$('#area_description').val("hola");
// $('#ajax-input').value = $(this);
});
});
...
@@ -403,6 +404,11 @@ $(document).ready(function () {
...
@@ -403,6 +404,11 @@ $(document).ready(function () {
// function for making POST request to productList in view.py
// function for making POST request to productList in view.py
$
(
'#product-form'
).
submit
(
function
(
event
)
{
$
(
'#product-form'
).
submit
(
function
(
event
)
{
if
(
$
(
'#ajax-input'
).
val
().
length
<=
0
)
{
$
(
'#search_name'
).
val
(
"Drawn Polygon"
);
$
(
'#area_description'
).
val
(
""
);
}
event
.
preventDefault
();
event
.
preventDefault
();
erase_product_list_globe
();
erase_product_list_globe
();
var
submit_data
=
$
(
'#product-form'
).
serialize
();
var
submit_data
=
$
(
'#product-form'
).
serialize
();
...
...
catalog/templates/map.html
View file @
62ff5847
...
@@ -141,6 +141,7 @@
...
@@ -141,6 +141,7 @@
{% csrf_token %}
{% csrf_token %}
<input
type=
"hidden"
id=
"user_name"
name=
"user_name"
value=
{{user.get_username}}
>
<input
type=
"hidden"
id=
"user_name"
name=
"user_name"
value=
{{user.get_username}}
>
<input
type=
"hidden"
id=
"search_name"
name=
"search_name"
value=
"Drawn Polygon"
>
<input
type=
"hidden"
id=
"search_name"
name=
"search_name"
value=
"Drawn Polygon"
>
<input
type=
"hidden"
id=
"area_description"
name=
"area_description"
value=
""
>
<ul
class=
"sidebar-menu"
data-widget=
"tree"
>
<ul
class=
"sidebar-menu"
data-widget=
"tree"
>
<li
class=
"treeview"
>
<li
class=
"treeview"
>
<a
href=
"#"
>
<a
href=
"#"
>
...
...
catalog/views.py
View file @
62ff5847
...
@@ -89,6 +89,8 @@ def productList(request):
...
@@ -89,6 +89,8 @@ def productList(request):
end_date
=
req
[
'end'
][
0
][:
10
]
end_date
=
req
[
'end'
][
0
][:
10
]
clouds
=
req
[
'cloudPercentage'
][
0
]
clouds
=
req
[
'cloudPercentage'
][
0
]
search_name
=
req
[
'search_name'
][
0
]
search_name
=
req
[
'search_name'
][
0
]
description
=
req
[
'area_description'
][
0
]
print
(
search_name
)
print
(
search_name
)
cloud_percentage
=
"[0 TO "
+
req
[
'cloudPercentage'
][
0
]
+
"]"
cloud_percentage
=
"[0 TO "
+
req
[
'cloudPercentage'
][
0
]
+
"]"
...
@@ -149,6 +151,8 @@ def productList(request):
...
@@ -149,6 +151,8 @@ def productList(request):
clouds
=
clouds
,
clouds
=
clouds
,
area
=
area
,
area
=
area
,
search_name
=
search_name
,
search_name
=
search_name
,
description
=
description
,
)
)
listSearch
.
save
()
listSearch
.
save
()
...
@@ -502,7 +506,7 @@ def Pay(request):
...
@@ -502,7 +506,7 @@ def Pay(request):
user
=
User
.
objects
.
get
(
id
=
request
.
user
.
id
)
user
=
User
.
objects
.
get
(
id
=
request
.
user
.
id
)
product_list
=
[]
product_list
=
[]
product_list
=
Purchase
.
objects
.
values
(
'id'
,
'search__area'
,
'user'
,
'user__username'
,
'user__email'
,
'search_id'
,
product_list
=
Purchase
.
objects
.
values
(
'id'
,
'search__area'
,
'user'
,
'user__username'
,
'user__email'
,
'search_id'
,
'search__clouds'
,
'search__startDate'
,
'search__endDate'
)
.
filter
(
user
=
user
,
'search__clouds'
,
'search__startDate'
,
'search__endDate'
,
'search__search_name'
,
'search__description'
)
.
filter
(
user
=
user
,
purchased
=
0
)
purchased
=
0
)
for
product
in
product_list
:
for
product
in
product_list
:
...
@@ -577,7 +581,7 @@ def Pay(request):
...
@@ -577,7 +581,7 @@ 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
,
pk
=
product
[
'id'
])
.
update
(
purchased
=
True
,
description
=
product
[
'search__description'
],
name
=
product
[
'search__search_name'
]
)
return
redirect
(
'../../reports'
)
return
redirect
(
'../../reports'
)
...
...
reports/static/reports/js/Reports_scripts.js
View file @
62ff5847
$
(
document
).
ready
(
function
()
{
$
(
'[data-toggle="popover"]'
).
popover
();
});
function
showEditModal
(
zone
,
description
,
id
)
{
$
(
'#edit_id'
).
empty
();
$
(
'#zone'
).
empty
();
$
(
'#description'
).
empty
();
$
(
'#zone'
).
val
(
zone
);
$
(
'#description'
).
val
(
description
);
$
(
'#edit_id'
).
val
(
id
);
//$('#myModalTitle').append(name);
$
(
"#editmodal"
).
modal
();
}
function
openmodal
(
info
)
{
function
openmodal
(
info
)
{
info2
=
info
.
split
(
";"
);
info2
=
info
.
split
(
";"
);
$
(
"#myModal"
).
modal
();
$
(
"#myModal"
).
modal
();
...
@@ -142,6 +158,18 @@ function change_public(data) {
...
@@ -142,6 +158,18 @@ function change_public(data) {
}
}
function
SaveButton
()
{
$
.
ajax
({
dataType
:
"json"
,
url
:
'../reports/ws/wsEditTitle'
,
data
:
{
'purchase_id'
:
$
(
'#edit_id'
).
val
(),
'zone'
:
$
(
'#zone'
).
val
(),
'description'
:
$
(
'#description'
).
val
()},
success
:
function
(
data
)
{
console
.
log
(
data
)
}
});
}
function
is_public
(
purchase_id
,
status
)
{
function
is_public
(
purchase_id
,
status
)
{
//alert(purchase_id);
//alert(purchase_id);
$
.
ajax
({
$
.
ajax
({
...
@@ -149,23 +177,8 @@ function is_public(purchase_id, status) {
...
@@ -149,23 +177,8 @@ function is_public(purchase_id, status) {
url
:
'../reports/ws/is_public'
,
url
:
'../reports/ws/is_public'
,
data
:
{
'purchase_id'
:
purchase_id
,
'status'
:
status
},
data
:
{
'purchase_id'
:
purchase_id
,
'status'
:
status
},
success
:
function
(
data
)
{
success
:
function
(
data
)
{
alert
(
"cambiado"
);
alert
(
data
);
}
}
});
});
};
function
showEditModal
(
zone
,
description
,
id
)
{
$
(
'#edit_id'
).
empty
();
$
(
'#zone'
).
empty
();
$
(
'#description'
).
empty
();
$
(
'#zone'
).
val
(
zone
);
$
(
'#description'
).
val
(
description
);
$
(
'#edit_id'
).
val
(
id
);
//$('#myModalTitle').append(name);
$
(
"#editmodal"
).
modal
();
}
}
$
(
document
).
ready
(
function
()
{
$
(
'[data-toggle="popover"]'
).
popover
();
});
\ No newline at end of file
reports/templates/Reports.html
View file @
62ff5847
...
@@ -168,11 +168,11 @@
...
@@ -168,11 +168,11 @@
{% for product in productList %}
{% for product in productList %}
<tr>
<tr>
<td>
<td>
<a
href=
"#"
data-toggle=
"popover"
data-trigger=
"hover"
<a
href=
"#"
id=
"title{{ product.purchase_id }}"
data-toggle=
"popover"
data-trigger=
"hover"
data-content=
"{
{ product.search_name }
}"
data-content=
"{
% if product.description %}{{ product.description }}{% else %}Without Description{% endif %
}"
onclick=
"showMyModalSetTitle('{{ product.search_name }}','{{ product.polygon }}');"
>
{{ product.search_name }}
</a>
onclick=
"showMyModalSetTitle('{{ product.search_name }}','{{ product.polygon }}');"
>
{{ product.search_name }}
</a>
<a
href=
"#"
onclick=
"showEditModal('{{ product.search_name }}','
Descripcion ekiz
','{{ product.purchase_id }}')"
><span
<a
href=
"#"
onclick=
"showEditModal('{{ product.search_name }}','
{{ product.description }}
','{{ product.purchase_id }}')"
><span
class=
"fas fa-pencil-alt"
class=
"fas fa-pencil-alt"
style=
"margin:3px 0 0 0"
></span></a>
style=
"margin:3px 0 0 0"
></span></a>
</td>
</td>
...
@@ -299,10 +299,6 @@
...
@@ -299,10 +299,6 @@
<input
type=
"text"
class=
"form-group-lg"
id=
"edit_id"
name=
"edit_id"
>
<input
type=
"text"
class=
"form-group-lg"
id=
"edit_id"
name=
"edit_id"
>
<label>
Description:
</label>
<br>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
for=
"usr"
>
Zone:
</label>
<label
for=
"usr"
>
Zone:
</label>
<input
type=
"text"
class=
"form-control"
id=
"zone"
name=
"zone"
style=
"text-align:center;"
>
<input
type=
"text"
class=
"form-control"
id=
"zone"
name=
"zone"
style=
"text-align:center;"
>
...
@@ -310,7 +306,7 @@
...
@@ -310,7 +306,7 @@
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
for=
"pwd"
>
Description:
</label>
<label
for=
"pwd"
>
Description:
</label>
<textarea
class=
"form-control"
id=
"description"
name=
"description"
<textarea
rows=
"4"
class=
"form-control"
id=
"description"
name=
"description"
style=
"text-align:center; resize: none"
></textarea>
style=
"text-align:center; resize: none"
></textarea>
</div>
</div>
...
@@ -318,7 +314,7 @@
...
@@ -318,7 +314,7 @@
<div
class=
"modal-footer"
>
<div
class=
"modal-footer"
>
<
input
class=
"btn btn-primary pull-left "
id=
"phSearchButton"
type=
"submit"
value=
"Save"
/
>
<
a
class=
"btn btn-primary pull-left "
id=
"SaveButton"
onclick=
"SaveButton()"
>
Save
</a
>
<button
type=
"button"
class=
"btn btn-danger"
data-dismiss=
"modal"
>
Close
</button>
<button
type=
"button"
class=
"btn btn-danger"
data-dismiss=
"modal"
>
Close
</button>
</form>
</form>
</div>
</div>
...
@@ -328,9 +324,6 @@
...
@@ -328,9 +324,6 @@
<!-- /.modals -->
<!-- /.modals -->
{% endblock %}
{% block modals %}
{% endblock %}
{% endblock %}
...
...
reports/views.py
View file @
62ff5847
...
@@ -101,7 +101,7 @@ def Reports(request):
...
@@ -101,7 +101,7 @@ def Reports(request):
zip
=
""
zip
=
""
product_list
=
Purchase
.
objects
.
values
(
'id'
,
'productList'
,
'aggreg_date'
,
'search__clouds'
,
'search__startDate'
,
product_list
=
Purchase
.
objects
.
values
(
'id'
,
'productList'
,
'aggreg_date'
,
'search__clouds'
,
'search__startDate'
,
'search__endDate'
,
'search__process_id__name'
,
'search__search_name'
,
'search__endDate'
,
'search__process_id__name'
,
'search__search_name'
,
'is_public'
)
.
filter
(
'is_public'
,
'name'
,
'description'
)
.
filter
(
user_id
=
request
.
user
.
id
,
purchased
=
1
)
user_id
=
request
.
user
.
id
,
purchased
=
1
)
for
producto
in
product_list
:
for
producto
in
product_list
:
log_info
=
USERS_PATH
+
request
.
user
.
email
+
"/"
+
str
(
producto
[
'id'
])
+
"/L2ASCL_AreaProcessing.log"
log_info
=
USERS_PATH
+
request
.
user
.
email
+
"/"
+
str
(
producto
[
'id'
])
+
"/L2ASCL_AreaProcessing.log"
...
@@ -170,7 +170,8 @@ def Reports(request):
...
@@ -170,7 +170,8 @@ def Reports(request):
if
file
.
endswith
(
".zip"
):
if
file
.
endswith
(
".zip"
):
zip
=
zip_path
+
"/"
+
file
zip
=
zip_path
+
"/"
+
file
productList
.
append
({
productList
.
append
({
"search_name"
:
producto
[
'search__search_name'
],
"search_name"
:
producto
[
'name'
],
"description"
:
producto
[
'description'
],
"process"
:
producto
[
'search__process_id__name'
],
"process"
:
producto
[
'search__process_id__name'
],
"purchase_date"
:
producto
[
'aggreg_date'
],
"purchase_date"
:
producto
[
'aggreg_date'
],
"startDate"
:
producto
[
'search__startDate'
],
"startDate"
:
producto
[
'search__startDate'
],
...
@@ -576,15 +577,23 @@ def ProcessChartData(path):
...
@@ -576,15 +577,23 @@ def ProcessChartData(path):
# ---------------------------------------------------------------------------------
# ---------------------------------------------------------------------------------
def
wsIs_Public
(
request
):
def
wsIs_Public
(
request
):
if
request
.
is_ajax
():
if
request
.
is_ajax
():
status
=
request
.
GET
.
get
(
"status"
)
path
=
"/reports/"
+
request
.
GET
.
get
(
"purchase_id"
)
+
"/scl_data"
purchase
=
Purchase
.
objects
.
get
(
pk
=
request
.
GET
.
get
(
"purchase_id"
))
purchase
=
Purchase
.
objects
.
get
(
pk
=
request
.
GET
.
get
(
"purchase_id"
))
purchase
.
is_public
=
request
.
GET
.
get
(
"status"
)
purchase
.
is_public
=
request
.
GET
.
get
(
"status"
)
purchase
.
save
()
purchase
.
save
()
# print (purchase.aggreg_date)
return
HttpResponse
(
"hola"
)
else
:
raise
Http404
# ---------------------------------------------------------------------------------
def
wsEditTitle
(
request
):
if
request
.
is_ajax
():
purchase
=
Purchase
.
objects
.
get
(
pk
=
request
.
GET
.
get
(
"purchase_id"
))
purchase
.
name
=
request
.
GET
.
get
(
"zone"
)
purchase
.
description
=
request
.
GET
.
get
(
"description"
)
purchase
.
save
()
print
(
"hola"
)
return
HttpResponse
(
"hola"
)
return
HttpResponse
(
"hola"
)
else
:
else
:
raise
Http404
raise
Http404
\ No newline at end of file
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