Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
18 changed files
with
166 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
body{ | ||
background-color: hsl(0, 0%, 98%); | ||
} | ||
|
||
h1,h2,h3,h4,h5,h6{ | ||
color:hsl(0, 0%, 30%); | ||
} | ||
|
||
.box-element{ | ||
box-shadow:hsl(0, 0%, 80%) 0 0 16px; | ||
background-color: #fff; | ||
border-radius: 4px; | ||
padding: 10px; | ||
} | ||
|
||
.thumbnail{ | ||
width: 100%; | ||
height: 200px; | ||
-webkit-box-shadow: -1px -3px 5px -2px rgba(214,214,214,1); | ||
-moz-box-shadow: -1px -3px 5px -2px rgba(214,214,214,1); | ||
box-shadow: -1px -3px 5px -2px rgba(214,214,214,1); | ||
} | ||
|
||
.product{ | ||
border-radius: 0 0 4px 4px; | ||
} | ||
|
||
.bg-dark{ | ||
background-color: #4f868c!important; | ||
} | ||
|
||
#cart-icon{ | ||
width:25px; | ||
display: inline-block; | ||
margin-left: 15px; | ||
} | ||
|
||
#cart-total{ | ||
display: block; | ||
text-align: center; | ||
color:#fff; | ||
background-color: red; | ||
width: 20px; | ||
height: 25px; | ||
border-radius: 50%; | ||
font-size: 14px; | ||
} | ||
|
||
.col-lg-4, .col-lg-6, .col-lg-8, .col-lg-12{ | ||
margin-top: 10px; | ||
} | ||
|
||
.btn{ | ||
border-radius: 0; | ||
} | ||
|
||
.row-image{ | ||
width: 100px; | ||
} | ||
|
||
.form-field{ | ||
width:250px; | ||
display: inline-block; | ||
padding: 5px; | ||
} | ||
|
||
.cart-row{ | ||
display: flex; | ||
align-items: flex-stretch; | ||
padding-bottom: 10px; | ||
margin-bottom: 10px; | ||
border-bottom: 1px solid #ececec; | ||
|
||
} | ||
|
||
.quantity{ | ||
display: inline-block; | ||
font-weight: 700; | ||
padding-right:10px; | ||
|
||
|
||
} | ||
|
||
.chg-quantity{ | ||
width: 12px; | ||
cursor: pointer; | ||
display: block; | ||
margin-top: 5px; | ||
transition:.1s; | ||
} | ||
|
||
.chg-quantity:hover{ | ||
opacity: .6; | ||
} | ||
|
||
|
||
.hidden{ | ||
display: none!important; | ||
} |
BIN
+9.82 KB
static/images/acer.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+75.3 KB
static/images/aronium2.JPG
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+25 KB
static/images/arrowDown.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+18.2 KB
static/images/arrowUp.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+89.8 KB
static/images/cart.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+5.57 KB
static/images/cmbk1.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+5.57 KB
static/images/cmbk1_mOrKcma.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+6.6 KB
static/images/el1.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+6.6 KB
static/images/el1_VYXBhB2.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+5.36 KB
static/images/elitebook1.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+4.68 KB
static/images/elitebook2.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+7.65 KB
static/images/fineHP1.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+4.94 KB
static/images/hp1.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+5.6 KB
static/images/hp2.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+4.51 KB
static/images/lenovo1.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+2.46 KB
static/images/product.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
var updateBtns = document.getElementsByClassName('update-cart') | ||
|
||
for (var i =0; i < updateBtns.length; i++){ | ||
updateBtns[i].addEventListener('click', function() | ||
{ | ||
var productId = this.dataset.product | ||
var action= this.dataset.action | ||
console.log('productId:', productId, 'action:', action) | ||
|
||
console.log('USER:', user) | ||
if (user === 'AnonymousUser'){ | ||
addCookieItem(productId, action) | ||
|
||
|
||
}else{ | ||
updateUserOrder(productId, action) | ||
} | ||
}) | ||
|
||
} | ||
|
||
function addCookieItem(productId, action){ | ||
console.log('Not logged in!....') | ||
if (action == 'add'){ | ||
if(cart[productId] == undefined){ | ||
cart[productId] = {'quantity':1} | ||
|
||
}else{ | ||
cart[productId]['quantity'] += 1 | ||
} | ||
} | ||
if (action == 'remove'){ | ||
cart[productId]['quantity'] -= 1 | ||
if(cart[productId]['quantity']<= 0){ | ||
console.log('Remove Item') | ||
delete cart[productId] | ||
} | ||
} | ||
console.log('Cart:', cart) | ||
document.cookie = 'cart=' + JSON.stringify(cart) + ";domain=;path=/" | ||
location.reload() | ||
|
||
} | ||
|
||
function updateUserOrder(productId, action){ | ||
console.log('logged in. Sending Data') | ||
var url ='/update_item/' | ||
|
||
fetch(url,{ | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'X-CSRFToken': csrftoken | ||
}, | ||
body:JSON.stringify({ 'productId':productId, 'action':action}) | ||
}) | ||
.then((response) =>{ | ||
return response.json() | ||
|
||
}) | ||
.then((data) =>{ | ||
console.log('data:', data) | ||
location.reload() | ||
|
||
}) | ||
|
||
} |