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
1ab33d8d
Commit
1ab33d8d
authored
Feb 12, 2019
by
Sergio Adrian Gongora Euan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Automatic change to my cart was added and more description of the products
parent
def6262a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
39 deletions
+74
-39
dataRetrieval.js
catalog/static/catalog/js/dataRetrieval.js
+54
-34
base_top.html
catalog/templates/base_top.html
+2
-2
templates.html
catalog/templates/templates.html
+13
-1
views.py
catalog/views.py
+5
-2
No files found.
catalog/static/catalog/js/dataRetrieval.js
View file @
1ab33d8d
...
...
@@ -66,7 +66,11 @@ var makeRequest = function (value) {
});
};
var
statusUpdateCart
=
false
;
function
updateCart
(){
if
(
statusUpdateCart
==
false
){
statusUpdateCart
=
true
;
showCarProductsTabPanel
();
$
(
"#product-list-cart"
).
empty
();
$
.
ajax
({
type
:
'POST'
,
...
...
@@ -98,8 +102,10 @@ function updateCart(){
document
.
querySelector
(
'#'
+
id
).
appendChild
(
clone_2
);
});
});
statusUpdateCart
=
false
;
}
});
}
};
function
deleteProductCar
(
element
){
...
...
@@ -246,8 +252,14 @@ function createProductContainer(products) {
products
.
forEach
(
function
(
list
){
var
temp_1
=
document
.
querySelector
(
'#product_cart_1'
);
let
name
=
list
.
aggreg_date
.
replace
(
/
([
.*+?^=!:${}()|
\[\]\/\\])
/g
,
"-"
);
temp_1
.
content
.
querySelector
(
'span'
).
id
=
list
.
id
;
temp_1
.
content
.
querySelector
(
'span'
).
textContent
=
list
.
aggreg_date
;
let
startDate
=
new
Date
(
list
.
startDate
).
toUTCString
().
split
(
' '
).
slice
(
0
,
4
).
join
(
' '
);
let
endDate
=
new
Date
(
list
.
endDate
).
toUTCString
().
split
(
' '
).
slice
(
0
,
4
).
join
(
' '
);
temp_1
.
content
.
querySelectorAll
(
'span'
)[
0
].
id
=
list
.
id
;
temp_1
.
content
.
querySelectorAll
(
'span'
)[
0
].
textContent
=
list
.
aggreg_date
;
temp_1
.
content
.
querySelectorAll
(
'span'
)[
1
].
textContent
=
list
.
process
;
temp_1
.
content
.
querySelectorAll
(
'span'
)[
2
].
textContent
=
startDate
;
temp_1
.
content
.
querySelectorAll
(
'span'
)[
3
].
textContent
=
endDate
;
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
);
...
...
@@ -320,6 +332,14 @@ function showProductTabPane() {
$
(
'aside'
).
addClass
(
"control-sidebar-open"
);
}
function
showCarProductsTabPanel
(){
$
(
'#cart'
).
addClass
(
"active"
);
$
(
'#globe'
).
removeClass
(
"active"
);
$
(
'#control-sidebar-settings-tab'
).
addClass
(
"active"
);
$
(
'#control-sidebar-home-tab'
).
removeClass
(
"active"
);
$
(
'aside'
).
addClass
(
"control-sidebar-open"
);
}
function
showWaitingModal
()
{
$
(
"body"
).
addClass
(
'loading'
)
$
(
"#product-list-toggle"
).
addClass
(
'not-active'
)
...
...
catalog/templates/base_top.html
View file @
1ab33d8d
...
...
@@ -104,14 +104,14 @@
<aside
class=
"control-sidebar control-sidebar-dark"
>
<!-- 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=
"globe"
class=
"active"
><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"
onclick=
"updateCart()"
data-toggle=
"tab"
><i
class=
"fa fa-shopping-cart"
></i></a>
</li>
</ul>
<!-- Tab panes -->
<div
class=
"tab-content"
>
<!-- Home tab content -->
<div
class=
"tab-pane"
id=
"control-sidebar-home-tab"
>
<div
class=
"tab-pane
active
"
id=
"control-sidebar-home-tab"
>
<form
id=
'product-to-cart-form'
role=
"form"
method=
"post"
>
{% csrf_token %}
<div
class=
"container"
>
...
...
catalog/templates/templates.html
View file @
1ab33d8d
...
...
@@ -73,8 +73,20 @@
<li
class=
"treeview"
>
<a
href=
"#"
>
<i
class=
"fa fa-cubes"
></i>
<span></span>
<span
id=
""
></span>
<i
class=
"glyphicon glyphicon-remove"
style=
"padding-left: 15px"
onclick=
"deleteProductCar(this);"
></i>
<div>
<label>
Process:
</label>
<span></span>
</div>
<div>
<label>
Start Date:
</label>
<span></span>
</div>
<div>
<label>
End Date:
</label>
<span></span>
</div>
<span
class=
"pull-right-container"
>
<span
class=
"label label-primary pull-right"
></span>
</span>
...
...
catalog/views.py
View file @
1ab33d8d
...
...
@@ -237,8 +237,8 @@ def getFromCart(request):
user
=
User
.
objects
.
get
(
id
=
request
.
user
.
id
)
prod_list
=
[]
product_list
=
Purchase
.
objects
.
values
(
'user'
,
'productList'
,
'purchased'
,
'price'
,
'aggreg_date'
,
'id'
)
.
filter
(
user
=
user
,
purchased
=
0
)
product_list
=
Purchase
.
objects
.
values
(
'user'
,
'productList'
,
'purchased'
,
'price'
,
'aggreg_date'
,
'id'
,
'search__process__name'
,
'search__startDate'
,
'search__endDate'
)
.
filter
(
user
=
user
,
purchased
=
0
)
for
products
in
product_list
:
product
=
json
.
loads
(
products
[
'productList'
])
...
...
@@ -247,6 +247,9 @@ def getFromCart(request):
'price'
:
products
[
'price'
],
'aggreg_date'
:
products
[
'aggreg_date'
],
'id'
:
products
[
'id'
],
'process'
:
products
[
'search__process__name'
],
'startDate'
:
products
[
'search__startDate'
],
'endDate'
:
products
[
'search__endDate'
],
'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