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
d114da80
Commit
d114da80
authored
Oct 11, 2018
by
Renán Sosa Guillen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
1076f2c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
dataRetrieval.js
catalog/static/js/dataRetrieval.js
+10
-5
No files found.
catalog/static/js/dataRetrieval.js
View file @
d114da80
...
@@ -220,6 +220,7 @@ $(document).ready(function () {
...
@@ -220,6 +220,7 @@ $(document).ready(function () {
var
typingInterval
=
800
;
//milliseconds
var
typingInterval
=
800
;
//milliseconds
var
productListGlobe
=
[];
var
productListGlobe
=
[];
var
cartProductList
=
[];
// this array represent DB where products will be stored
var
cartProductList
=
[];
// this array represent DB where products will be stored
var
productsToObtain
=
[];
var
productUUIDListCart
=
[];
var
productUUIDListCart
=
[];
// On keyup, start the contdown
// On keyup, start the contdown
...
@@ -332,7 +333,7 @@ $(document).ready(function () {
...
@@ -332,7 +333,7 @@ $(document).ready(function () {
if
(
submit_data_array
.
indexOf
(
data
.
uuid
)
>
-
1
)
{
if
(
submit_data_array
.
indexOf
(
data
.
uuid
)
>
-
1
)
{
console
.
log
(
"DATA sí esta: "
,
data
.
uuid
);
console
.
log
(
"DATA sí esta: "
,
data
.
uuid
);
console
.
log
(
"SS: "
,
data
.
product
.
size
);
console
.
log
(
"SS: "
,
data
.
product
.
size
);
product
UUIDListCart
.
push
(
data
.
uuid
);
product
sToObtain
.
push
(
data
.
uuid
);
erase_product_list_globe_by_id
(
data
.
uuid
);
erase_product_list_globe_by_id
(
data
.
uuid
);
cartProductList
.
push
({
cartProductList
.
push
({
...
@@ -362,6 +363,7 @@ $(document).ready(function () {
...
@@ -362,6 +363,7 @@ $(document).ready(function () {
},
},
success
:
function
()
{
success
:
function
()
{
cartProductList
=
[];
cartProductList
=
[];
productUUIDListCart
.
push
.
apply
(
productUUIDListCart
,
productsToObtain
);
// PRODUCT_COUNTER += 1; // this variable counts the number of products in shopping cart
// PRODUCT_COUNTER += 1; // this variable counts the number of products in shopping cart
// PRODUCT_COUNTER_STR = PRODUCT_COUNTER.toString();
// PRODUCT_COUNTER_STR = PRODUCT_COUNTER.toString();
...
@@ -378,6 +380,7 @@ $(document).ready(function () {
...
@@ -378,6 +380,7 @@ $(document).ready(function () {
createProductContainer
();
createProductContainer
();
IS_PRODUCT_CONTAINER
=
true
;
IS_PRODUCT_CONTAINER
=
true
;
}
}
// TODO : return IS_PRODUCT_CONTAINER to 'false' in some point
// request a DB para mostrar los productos en el carrito
// request a DB para mostrar los productos en el carrito
// variable prod_from_cartDB_url en map.html
// variable prod_from_cartDB_url en map.html
...
@@ -386,11 +389,11 @@ $(document).ready(function () {
...
@@ -386,11 +389,11 @@ $(document).ready(function () {
url
:
prod_from_cartDB_url
,
url
:
prod_from_cartDB_url
,
data
:
{
data
:
{
'csrfmiddlewaretoken'
:
document
.
getElementsByName
(
'csrfmiddlewaretoken'
)[
0
].
value
,
'csrfmiddlewaretoken'
:
document
.
getElementsByName
(
'csrfmiddlewaretoken'
)[
0
].
value
,
'product_uuid_list'
:
product
UUIDListCart
.
toString
()
'product_uuid_list'
:
product
sToObtain
.
toString
()
},
},
dataType
:
'json'
,
dataType
:
'json'
,
success
:
function
(
data
)
{
success
:
function
(
data
)
{
// productUUIDListCart
= [];
productsToObtain
=
[];
data
.
product_list
.
forEach
(
function
(
product
)
{
data
.
product_list
.
forEach
(
function
(
product
)
{
var
temp_2
=
document
.
querySelector
(
'#product_cart_2'
);
var
temp_2
=
document
.
querySelector
(
'#product_cart_2'
);
...
@@ -437,13 +440,13 @@ $(document).ready(function () {
...
@@ -437,13 +440,13 @@ $(document).ready(function () {
}
}
});
});
// L1C product download
petition
// L1C product download
request
$
.
ajax
({
$
.
ajax
({
type
:
"POST"
,
type
:
"POST"
,
url
:
purch_prod_url
,
url
:
purch_prod_url
,
data
:
{
data
:
{
'csrfmiddlewaretoken'
:
document
.
getElementsByName
(
'csrfmiddlewaretoken'
)[
0
].
value
,
'csrfmiddlewaretoken'
:
document
.
getElementsByName
(
'csrfmiddlewaretoken'
)[
0
].
value
,
'product_objects'
:
JSON
.
stringify
(
productObject
)
'product_objects'
:
JSON
.
stringify
(
productObject
)
},
},
dataType
:
'json'
dataType
:
'json'
});
});
...
@@ -454,4 +457,6 @@ $(document).ready(function () {
...
@@ -454,4 +457,6 @@ $(document).ready(function () {
});
});
}
}
});
});
// TODO: Clean productUUIDListCart array after purchased is done
});
});
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