-
Notifications
You must be signed in to change notification settings - Fork 4
/
myOrders.html
73 lines (62 loc) · 1.77 KB
/
myOrders.html
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Order History</title>
<style>
body{
background-color:skyblue;
}
#checkOutData{
display:grid;
grid-template-columns: 23% 23% 23% 23%;
gap:2%;
}
.divParent{
background-color: white;
margin-bottom: 30px;
padding: 30px;
}
#checkOutData > div:hover{
border: 2px solid #24A3B5;
}
img{
width:100%;
height:60%;
margin: auto;
}
h2{
color: rgb(107, 55, 55);
text-align: center;
}
</style>
</head>
<body>
<h2 >Order History</h2>
<div id="checkOutData"></div>
<script>
let mainParent=document.getElementById("checkOutData");
let orderData= JSON.parse(localStorage.getItem("myOrders"));
function showFinalData(el){
mainParent.innerHTML="";
el.forEach(function(product){
let parent= document.createElement("div");
parent.setAttribute("class","divParent");
mainParent.append(parent);
let prod_img = document.createElement("img");
prod_img.src=product.img;
parent.append(prod_img);
let prod_name= document.createElement("p");
prod_name.textContent=product.name;
parent.append(prod_name);
let prod_price= document.createElement("p");
prod_price.textContent="₹"+product.price;
parent.append(prod_price);
})
}
showFinalData(orderData);
</script>
</body>
</html>