forked from Open-Source-Chandigarh/Cafe-Management
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorder.js
27 lines (26 loc) · 731 Bytes
/
order.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$(document).ready(function () {
if (localStorage.getItem("cart") == null) {
var cart = {};
} else {
cart = JSON.parse(localStorage.getItem("cart"));
}
listcart(cart);
});
function listcart(cart) {
let str_order=``;
for (let item in cart) {
str_order+=`<div class="row">
<div class="col">
`+cart[item].name+`
</div>
<div class="col">
x`+ cart[item].quantity +`
</div>
<div class="col">
= Rs.`+ (cart[item].price)*(cart[item].quantity) +`
</div>
</div>`
}
if(str_order == ``) str_order = `<h5 class='default'> Your Cart is Empty. Click here to Go to Menu </h5>`;
document.getElementById("items").innerHTML= str_order;
}