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
af79f7bd
Commit
af79f7bd
authored
Feb 06, 2019
by
Sergio Adrian Gongora Euan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
view of store products
parent
6ddcc845
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
54 deletions
+60
-54
body.css
catalog/static/catalog/css/body.css
+6
-1
map.css
catalog/static/catalog/css/map.css
+2
-1
dataRetrieval.js
catalog/static/catalog/js/dataRetrieval.js
+46
-47
base_top.html
catalog/templates/base_top.html
+2
-2
templates.html
catalog/templates/templates.html
+2
-2
views.py
catalog/views.py
+2
-1
No files found.
catalog/static/catalog/css/body.css
View file @
af79f7bd
...
...
@@ -331,7 +331,7 @@ div .menu-info h4 {
/*}*/
div
#product-list-globe
{
max-height
:
773
px
;
max-height
:
820
px
;
overflow
:
auto
;
}
...
...
@@ -363,6 +363,11 @@ ul.product_list_category li:hover div.bg-geo {
display
:
block
;
}
div
#product-list-cart
{
max-height
:
820px
;
overflow
:
auto
;
}
/*div #product-list-cart-items {
max-height: 167px;
overflow: auto;
...
...
catalog/static/catalog/css/map.css
View file @
af79f7bd
...
...
@@ -17,7 +17,8 @@ html, body
position
:
absolute
;
bottom
:
0
;
border
:
0px
solid
blue
;
z-index
:
99999
;
/* z-index: 99999; */
z-index
:
6
!important
;
width
:
100%
;
height
:
32px
;
vertical-align
:
middle
;
...
...
catalog/static/catalog/js/dataRetrieval.js
View file @
af79f7bd
...
...
@@ -66,6 +66,42 @@ var makeRequest = function (value) {
});
};
function
updateCart
(){
$
(
"#product-list-cart"
).
empty
();
$
.
ajax
({
type
:
'POST'
,
url
:
prod_from_cartDB_url
,
data
:
{
'csrfmiddlewaretoken'
:
document
.
getElementsByName
(
'csrfmiddlewaretoken'
)[
0
].
value
},
dataType
:
'json'
,
success
:
function
(
data
)
{
productsToObtain
=
[];
createProductContainer
(
data
.
product_list
);
data
.
product_list
.
forEach
(
function
(
products
)
{
let
id
=
"L-"
+
products
.
aggreg_date
.
replace
(
/
([
.*+?^=!:${}()|
\[\]\/\\])
/g
,
"-"
);
products
.
catalog
.
forEach
(
function
(
product
)
{
var
temp_2
=
document
.
querySelector
(
'#product_cart_2'
);
// filling template
temp_2
.
content
.
querySelector
(
'li'
).
id
=
product
.
uuid
;
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
.
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
;
var
clone_2
=
document
.
importNode
(
temp_2
.
content
,
true
);
//document.querySelector('#product-list-cart-items').appendChild(clone_2);
document
.
querySelector
(
'#'
+
id
).
appendChild
(
clone_2
);
});
});
}
});
};
function
drawPolygon
(
element
)
{
polygonList
.
forEach
(
function
(
polygon
)
{
...
...
@@ -171,14 +207,15 @@ function drawApiResponse(element) {
}
function
createProductContainer
()
{
function
createProductContainer
(
products
)
{
products
.
forEach
(
function
(
list
){
var
temp_1
=
document
.
querySelector
(
'#product_cart_1'
);
// filling template
temp_1
.
content
.
querySelector
(
'span'
).
textContent
=
"Product"
;
let
name
=
list
.
aggreg_date
.
replace
(
/
([
.*+?^=!:${}()|
\[\]\/\\])
/g
,
"-"
);
temp_1
.
content
.
querySelector
(
'span'
).
textContent
=
name
;
temp_1
.
content
.
querySelector
(
'ul .control-sidebar-menu'
).
id
=
"L-"
+
name
;
var
clone_1
=
document
.
importNode
(
temp_1
.
content
,
true
);
document
.
querySelector
(
'#product-list-cart'
).
appendChild
(
clone_1
);
})
}
let
productCategory
=
new
Map
();
...
...
@@ -416,45 +453,7 @@ $(document).ready(function () {
success
:
function
()
{
cartProductList
=
[];
productUUIDListCart
.
push
.
apply
(
productUUIDListCart
,
productsToObtain
);
if
(
!
IS_PRODUCT_CONTAINER
)
{
// building product container
createProductContainer
();
IS_PRODUCT_CONTAINER
=
true
;
// this flag is set to false when products are purchased
}
// request to DB for showing the products in cart
// variable prod_from_cartDB_url in map.html
$
.
ajax
({
type
:
'POST'
,
url
:
prod_from_cartDB_url
,
data
:
{
'csrfmiddlewaretoken'
:
document
.
getElementsByName
(
'csrfmiddlewaretoken'
)[
0
].
value
,
'product_uuid_list'
:
productsToObtain
.
toString
()
},
dataType
:
'json'
,
success
:
function
(
data
)
{
productsToObtain
=
[];
data
.
product_list
.
forEach
(
function
(
products
)
{
products
.
catalog
.
forEach
(
function
(
product
){
var
temp_2
=
document
.
querySelector
(
'#product_cart_2'
);
// filling template
temp_2
.
content
.
querySelector
(
'li'
).
id
=
product
.
uuid
;
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
.
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
;
var
clone_2
=
document
.
importNode
(
temp_2
.
content
,
true
);
document
.
querySelector
(
'#product-list-cart-items'
).
appendChild
(
clone_2
);
});
});
}
});
updateCart
();
}
});
}
else
{
...
...
catalog/templates/base_top.html
View file @
af79f7bd
...
...
@@ -104,7 +104,7 @@
<!-- Create the tabs -->
<ul
class=
"nav nav-tabs nav-justified control-sidebar-tabs"
>
<li
id=
"globe"
><a
href=
"#control-sidebar-home-tab"
data-toggle=
"tab"
><i
class=
"fa fa-globe"
></i></a></li>
<li
id=
"cart"
><a
href=
"#control-sidebar-settings-tab"
data-toggle=
"tab"
><i
class=
"fa fa-shopping-cart"
></i></a>
<li
id=
"cart"
><a
href=
"#control-sidebar-settings-tab"
onclick=
"updateCart()"
data-toggle=
"tab"
><i
class=
"fa fa-shopping-cart"
></i></a>
</li>
</ul>
<!-- Tab panes -->
...
...
@@ -147,7 +147,7 @@
</div>
</div>
<!-- this ul element is filled with data -->
<ul
id=
"product-list-cart"
class=
"sidebar-menu"
data-widget=
"tree"
></ul>
<ul
id=
"product-list-cart"
class=
"
control-
sidebar-menu"
data-widget=
"tree"
></ul>
</form>
</div>
<!-- /.tab-pane -->
...
...
catalog/templates/templates.html
View file @
af79f7bd
...
...
@@ -80,7 +80,7 @@
</a>
<ul
class=
"treeview-menu sidebar-form"
>
<li>
<ul
id=
"
product-list-cart-items"
class=
"control-sidebar-menu
"
></ul>
<ul
id=
"
"
class=
"control-sidebar-menu product_list_category
"
></ul>
</li>
</ul>
</li>
...
...
@@ -95,7 +95,7 @@
<p></p>
</div>
</a>
<div
class=
"info-product-
cart-
box bg-geo"
>
<div
class=
"info-product-box bg-geo"
>
<span
class=
"info-product-box-img"
>
<img
src=
""
>
</span>
...
...
catalog/views.py
View file @
af79f7bd
...
...
@@ -206,13 +206,14 @@ def getFromCart(request):
user
=
User
.
objects
.
get
(
id
=
request
.
user
.
id
)
prod_list
=
[]
product_list
=
Purchase
.
objects
.
values
(
'user'
,
'productList'
,
'purchased'
,
'pric
e'
)
.
filter
(
user
=
user
,
purchased
=
0
)
product_list
=
Purchase
.
objects
.
values
(
'user'
,
'productList'
,
'purchased'
,
'price'
,
'aggreg_dat
e'
)
.
filter
(
user
=
user
,
purchased
=
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
})
return
JsonResponse
({
'product_list'
:
prod_list
})
...
...
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