-
Notifications
You must be signed in to change notification settings - Fork 1
/
checkout.html
250 lines (207 loc) · 9.39 KB
/
checkout.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
<!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>CHECK OUT PAGE</title>
<!-- <link rel="stylesheet" href="Navbar/navbar.css"> -->
<style>
.main_container{
/* width: 85%; */
margin: auto;
}
.nav_cart{
margin-left: 20%;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.nav_content_wrap{
display: flex;
}
.nav_logo {
width: 120px;
/* margin-right: 40px; */
margin-left: 7%;
margin-top: 1%;
display: flex;
}
#nav_logo_link {
display: block;
width: 179px;
height: 38px;
background: url("https://ii1.pepperfry.com/images/svg/pf-logo-21.svg")
no-repeat center;
background-size: contain;
}
.bottom{
display: flex;
margin-left: 7%;
margin-top: 4%;
}
.bottom-left{
/* border: 1px solid rgb(192, 40, 40); */
width: 25%;
height: 500px;
margin-left: 2%;
}
.bottom-right{
border: 1px solid rgb(131, 124, 124);
width: 55%;
/* height: 500px; */
}
.bottom-left > div{
border: 1px solid rgb(219, 210, 210);margin-top: 5%;
}
.bottom-left > div{
color: rgb(148, 144, 144);
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
font-size: 12px;
}
p{
color: rgb(148, 144, 144);
margin-left: 3%;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
#product > div{
display: flex;
border: 1px solid rgb(207, 205, 205);
margin-bottom: 2%;
height: 170px;
justify-content: space-between;
}
#product > div > img{
width: 120px;
height: 120px;
margin-left: 2%;
margin-top: 1%;
}
#product > div > p{
color: black;
}
#product > div > #IM{
width: 30px;
height: 30px;
}
</style>
</head>
<body>
<!-- <h1>checkout</h1> -->
<div class="main_container">
<nav>
<div class="nav_content_wrap" >
<div class="nav_logo">
<a href="" id="nav_logo_link"></a>
</div>
<div class="nav_cart" style="width: 50%;">
<p> <samp style="color:rgb(244,124,99) ;">Cart</samp> ---- Delivery & Billing Address ---- Payment </p>
</div>
</div>
</nav>
<hr style="margin-top: 1%;width: 100%;color: rgb(241, 241, 241);">
<div>
<P style="margin-left: 6%;font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;">IN YOUR CART <span style="color: grey;">(item)</span></P>
</div>
<div class="bottom">
<div class="bottom-right" >
<div style="border: 1px solid rgb(206, 199, 199);display: flex;padding: 5px;background-color: rgb(247, 244, 239);">
<div style="margin-top: 2%;">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-geo-alt-fill" viewBox="0 0 16 16">
<path d="M8 16s6-5.686 6-10A6 6 0 0 0 2 6c0 4.314 6 10 6 10zm0-7a3 3 0 1 1 0-6 3 3 0 0 1 0 6z"/>
</svg>
</div>
<p>Enter Your Pincode For Delivery & Assembly Information</p>
<input style="width: 150px;height: 35px;margin-left: 5%;" type="text" placeholder="PIN CODE">
<input style="height: 40px;background-color: black;color: white;" type="submit" value="GO">
</div>
<div id="product">
<div id="icon"></div>
</div>
</div>
<div class="bottom-left">
<div >
<h2 style="font-family: Arial, Helvetica, sans-serif; color: black;margin-left: 2%;font-weight: 100;margin-bottom: 0px;">Login OR Register</h4>
<p>For Express Checkout, Exciting Offers & More.</p>
</div>
<div style="display: flex;" >
<div style="margin-top: 4%;margin-left: 2%;margin-right: 5%;">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-ticket-perforated" viewBox="0 0 16 16">
<path d="M4 4.85v.9h1v-.9H4Zm7 0v.9h1v-.9h-1Zm-7 1.8v.9h1v-.9H4Zm7 0v.9h1v-.9h-1Zm-7 1.8v.9h1v-.9H4Zm7 0v.9h1v-.9h-1Zm-7 1.8v.9h1v-.9H4Zm7 0v.9h1v-.9h-1Z"/>
<path d="M1.5 3A1.5 1.5 0 0 0 0 4.5V6a.5.5 0 0 0 .5.5 1.5 1.5 0 1 1 0 3 .5.5 0 0 0-.5.5v1.5A1.5 1.5 0 0 0 1.5 13h13a1.5 1.5 0 0 0 1.5-1.5V10a.5.5 0 0 0-.5-.5 1.5 1.5 0 0 1 0-3A.5.5 0 0 0 16 6V4.5A1.5 1.5 0 0 0 14.5 3h-13ZM1 4.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 .5.5v1.05a2.5 2.5 0 0 0 0 4.9v1.05a.5.5 0 0 1-.5.5h-13a.5.5 0 0 1-.5-.5v-1.05a2.5 2.5 0 0 0 0-4.9V4.5Z"/>
</svg>
</div>
<div style="width: 50%;">
<p>Apply coupon</p>
</div>
</div>
<div>
<div style="display: flex;justify-content: space-between;padding: 2px; margin-bottom: 0px;" ><p>cart Value</p> <p id="tol_price"></p></div>
<div style="display: flex;justify-content: space-between;padding: 2px; margin-bottom: 0px;" ><p>Retail Discount</p><p>10%</p></div>
<p>Delivery & Assembly Charges Extra. Enter Pincode To Know</p>
<hr style="width: 90%;">
<div style="display: flex;justify-content: space-between;padding: 2px; margin-left: 2%;"><h4>Total</h4><p id="final_price"></p></div>
</div>
<div style="margin-top: 5%; display: flex;">
<input style="margin-top: 4%;size: 10px;" type="checkbox">
<p>Contribution rs.99 For COVID Relief Through GiveIndia</p>
</div>
<div style="margin-top: 5%; display: flex;">
<input style="margin-top: 4%;size: 10px;" type="checkbox">
<p>Claim Tax Credit By Entering Your Companies GSTIN.</p>
</div>
<input style="width: 100%;height: 35px;background-color: rgb(241,101,33);color: aliceblue; border: 0px; margin-top: 3%;" type="submit" value="PLACE ORDER" id="checkout">
</div>
<div>
</div>
</div>
</div>
</body>
</html>
<script>
var parent= document.getElementById('product');
document.getElementById("checkout").addEventListener("click",function(){
window.location.href="address.html"
})
var cartData = JSON.parse(localStorage.getItem('cartItem'))||[];
displayCart(cartData);
console.log(cartData);
function displayCart(cartData){
document.querySelector("#product").innerHTML=" ";
cartData.forEach((element,index) => {
let div = document.createElement("div");
let img = document.createElement("IMG");
img.src=element.img;
let title = document.createElement("p");
title.innerHTML=element.title;
let price = document.createElement("p");
price.innerHTML="₹"+element.discount_price;
// var btn=document.createElement("button");
// btn.innerText = 'remove'
// btn.addEventListener("click", function(){
// removeitem(index)
// });
var img1 = document.createElement('IMG');
img1.setAttribute('src', "https://img.icons8.com/material-outlined/24/000000/trash--v2.png");
img1.setAttribute("id","IM");
img1.addEventListener("click", function(){
removeitem(index)
});
div.append(img,title,price,img1);
parent.append(div);
});
var total = cartData.reduce(function(acc,cv){
return acc+cv.discount_price;
},0)
document.querySelector("#tol_price").textContent = "Rs."+total;
localStorage.setItem('total',JSON.stringify(total));
var final_total = Math.floor(total-(total/10));
document.querySelector("#final_price").textContent = "Rs."+final_total;
localStorage.setItem('final_total',JSON.stringify(final_total));
}
function removeitem(index)
{
cartData.splice(index,1);
localStorage.setItem("cartItem",JSON.stringify(cartData))
displayCart(cartData);
}
//pop up
</script>