-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
672 lines (591 loc) · 17 KB
/
index.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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>JQ Tab Example</title>
<style>
/* * {
margin: 0;
padding: 0;
} */
ul.link-wapper {
list-style-type: none;
margin: 20px;
padding: 0;
text-align: center;
}
ul.link-wapper li {
display: inline-block;
padding: 10px;
}
ul.link-wapper li a {
text-decoration: none;
color: black;
padding: 10px;
}
ul.link-wapper li a.active {
color: #0037ff;
border-bottom: 1px solid red;
}
div.content {
max-width: 800px;
padding: 20px 50px;
margin: 0 auto 10px;
display: none;
}
div#shop {
background-color: #d2d2d2;
max-width: 75%;
}
div.shop {
display: grid;
grid-template-columns: 170px 170px 170px 170px 170px;
grid-gap: 50px 30px;
text-align: center;
justify-content: center;
}
div.item {
background-color: white;
}
div.item img {
width: 140px;
height: 160px;
object-fit: contain;
transition: 0.3s;
margin-bottom: 50px;
}
div.item p {
font-size: 15px;
margin-bottom: 30px;
}
button.atc {
width: 100%;
padding: 10px 0;
border: none;
transition: 0.3s;
}
button.atc:hover {
background-color: blanchedalmond;
cursor: pointer;
}
div#contact {
background-image: url(https://images.pexels.com/photos/1416530/pexels-photo-1416530.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940);
background-position: center;
background-repeat: no-repeat;
max-width: 75%;
height: 470px;
}
div#contact > p {
color: white;
font-size: 40px;
text-align: center;
padding-top: 100px;
font-family: Montserrat;
}
div.contact {
margin-top: 100px;
justify-content: center;
text-align: center;
display: grid;
grid-template-columns: 350px 350px 350px;
column-gap: 30px;
}
div.contact div {
background-color: white;
height: 150px;
}
div.contact p {
font-size: 20px;
margin-top: 25px;
}
div.contact img {
width: 50px;
height: 50px;
padding-top: 5px;
}
div.contact p.title {
color: white;
font-size: 20px;
font-family: Montserrat;
margin-bottom: 10px;
}
.map {
background-color: #d2d2d2;
margin-top: 310px;
height: 490px;
width: 100%;
}
.map iframe {
float: left;
padding: 20px 10px;
}
.clear {
clear: both;
}
.map > p {
font-size: 30px;
text-align: center;
font-family: Montserrat;
padding-top: 20px;
}
.form {
margin-top: 10px;
float: right;
margin-right: 15%;
}
.form input[type="text"],
input[type="email"] {
padding: 10px;
margin-top: 30px;
width: 100%;
background-color: white;
border: hidden;
outline: none;
transition: 0.3s;
}
textarea {
width: 110%;
margin-top: 30px;
height: 200px;
border: hidden;
transition: 0.3s;
}
form input[type="text"]:focus,
input[type="email"]:focus {
padding: 12px;
outline: none;
}
textarea:focus {
outline: none;
padding: 2px;
}
textarea[placeholder] {
font-size: 17px;
}
form input[type="submit"] {
padding: 7px 10px;
background-color: #16191c;
color: white;
border: hidden;
transition: 0.3s;
}
form input[type="submit"]:hover {
padding: 8px 11px;
cursor: pointer;
}
form input[type="submit"]:active {
padding: 9px 12px;
background-color: #0267eb;
}
th,
td {
border: 1px solid #dddddd;
}
span.show_qty {
position: relative;
bottom: 10px;
right: 10px;
padding: 0px 4px;
font-size: 13px;
background-color: rgb(23, 193, 216);
border-radius: 25px;
color: white;
}
button.remove {
border: none;
background: none;
position: relative;
top: 2px;
}
button.remove:hover {
cursor: pointer;
}
</style>
<script src="sweetalert2.all.min.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
// Your Script Here!
// $(document).ready(function (argument) {
$(function () {
$(".content").first().slideDown();
$("ul.link-wapper li a").on("click", function (event) {
var current_tab = $(this);
$("ul.link-wapper li a").removeClass("active");
current_tab.addClass("active");
$(".content").slideUp();
current_tab_href = current_tab.attr("href"); // #home
$(current_tab_href).slideDown(); // $('#home')
event.preventDefault();
});
// LocalStorage
$(".atc").on("click", function () {
let id = $(this).data("id");
let name = $(this).data("name");
let price = $(this).data("price");
let item = {
id: id,
name: name,
price: price,
qty: 1,
};
// console.log(item)
let cart = localStorage.getItem("cart");
let myArr = "";
if (cart != null) {
myArr = JSON.parse(cart);
} else {
myArr = [];
}
// homework
let status = 0;
for (row of myArr) {
// 1,2
if (row.id == id) {
// 3
row.qty++;
status = 1;
}
}
if (status == 0) {
myArr.push(item);
}
// JS Object => JSON String
let myArrString = JSON.stringify(myArr);
// console.log(myArrString)
localStorage.setItem("cart", myArrString);
getdata();
Swal.fire({
position: "center",
icon: "success",
title: "Added to cart",
showConfirmButton: false,
timer: 500,
});
});
// Get Data From LS
function getdata() {
let cart = localStorage.getItem("cart");
if (cart != null) {
let myArr = JSON.parse(cart);
let row = "";
let total = 0;
let i = 0;
console.log(myArr);
for ([index, item] of myArr.entries()) {
total += item.qty * item.price;
row += `<tr>
<td>
<button class="remove" data-id="${index}"><img src="delete-button.png"></button>
${++i}
</td>
<td>${item.name}</td>
<td>${item.price}</td>
<td>
<input type="number" min="1" value="${
item.qty
}" data-id="${index}" class="updateqty">
</td>
<td>${item.qty * item.price} Ks</td>
</tr>`;
}
row += `<tr>
<td colspan="4">Total Amount</td>
<td>${total} Ks</td>
</tr>`;
$("tbody").html(row);
} else {
$("tbody").html(
`<tr><td colspan="5">Your Cart is empty!</td></tr>`
);
}
show_qty();
}
getdata();
// Remove
$("tbody").on("click", ".remove", function () {
let index = $(this).data("id");
// console.log(index)
let cart = localStorage.getItem("cart");
let myArr = JSON.parse(cart);
// Delete one row
myArr.splice(index, 1);
// JS Object => JSON String
let myArrString = JSON.stringify(myArr);
// console.log(myArrString)
localStorage.setItem("cart", myArrString);
getdata();
});
// increase - decrease Qty
$("tbody").on("change", ".updateqty", function () {
let index = $(this).data("id");
// console.log(index)
let qty = $(this).val();
let cart = localStorage.getItem("cart");
let myArr = JSON.parse(cart);
myArr[index].qty = qty;
// JS Object => JSON String
let myArrString = JSON.stringify(myArr);
// console.log(myArrString)
localStorage.setItem("cart", myArrString);
getdata();
});
// checkout
$(".checkout").on("click", function () {
localStorage.removeItem("cart");
getdata();
Swal.fire("Order succeeded", "Checkout is complete", "success");
});
});
function show_qty() {
let cart = localStorage.getItem("cart");
let for_qty = JSON.parse(cart);
let number_of_qty = 0;
if (for_qty != null) {
for (item of for_qty) {
//console.log(item.qty);
number_of_qty += parseInt(item.qty);
}
} else {
number_of_qty = 0;
}
$(".show_qty").html(number_of_qty);
//console.log(number_of_qty)
}
</script>
</head>
<body>
<div class="tab">
<ul class="link-wapper">
<li>
<a href="#home" class="active">Home</a>
</li>
<li>
<a href="#about">About</a>
</li>
<li>
<a href="#contact">Contact</a>
</li>
<li>
<a href="#shop">Shop</a>
</li>
<li>
<a href="#cart">Cart</a>
<span class="show_qty"></span>
</li>
</ul>
<div class="content" id="home">
<h3>Home Section</h3>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis
laborum sequi earum eaque pariatur atque voluptatibus maxime
exercitationem a ipsam consequatur, unde quidem quia deserunt
veritatis veniam dolorum, possimus quaerat!
</p>
</div>
<div class="content" id="about">
<h3>About Section</h3>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Sint repellat
consequatur quasi quidem vitae aliquam dignissimos veniam porro quos.
Cum maxime ipsa dolor eligendi, iure ea doloribus molestias beatae
vitae?
</p>
</div>
<div class="content" id="contact">
<p>We'd Love To Hear From You</p>
<div class="contact">
<p class="title">Email</p>
<p class="title">Phone</p>
<p class="title">Address</p>
<div class="email">
<img src="email.png" alt="" />
<p>Office : [email protected]</p>
<p>Office : [email protected]</p>
<p>Office : [email protected]</p>
<p>Customer Support : [email protected]</p>
<p>Customer Support : [email protected]</p>
</div>
<div class="phone">
<img src="phone-call.png" alt="" />
<p>Yangon : +959 774511562</p>
<p>Manadaly: +959 774511563</p>
<p>Office: +959 774511564</p>
<p>Customer Support: +959 774511565</p>
<p>Customer Support: +959 774511566</p>
</div>
<div class="Address">
<img src="location-pin.png" alt="" />
<p>821 Thanthumar Rd, Yangon 11091</p>
<p>
78th street,78th street, Yangon-Mandalay Kar Lam Bhay Near Myetnar
Pheyar ,Pyigyi Tagon Tsp, Mandalay.
</p>
<p>No.2390, Padonmar Street, Shwekyaroin Qtr, 15011</p>
</div>
</div>
<div class="break"></div>
<div class="map">
<iframe
src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d1909.268902379972!2d96.19198931648548!3d16.849270110937972!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x30c1933763f24a25%3A0xf6b0e96295e476c5!2sVVIP%20Liquor%20Store!5e0!3m2!1sen!2smm!4v1630143296194!5m2!1sen!2smm"
width="600"
height="450"
style="border: 0"
allowfullscreen=""
loading="lazy"
></iframe>
<p>Message Us</p>
<form action="" method="GET" class="form">
<input
type="text"
name="name"
placeholder="Enter your name"
/><br />
<input
type="email"
name="email"
placeholder="Enter your email"
/><br />
<textarea name="message" placeholder="Enter your message"></textarea
><br />
<input type="submit" value="submit" />
</form>
</div>
<div class="clear"></div>
</div>
<div class="content" id="shop">
<h3>Shop Section</h3>
<div class="shop">
<div class="item">
<img src="cocacola.jfif" alt="" width="100px" />
<p>Item 1</p>
<strong>500ks</strong><br />
<button
class="atc"
data-id="1"
data-name="Item One"
data-price="500"
>
Add To Cart
</button>
</div>
<div class="item">
<img src="cocacola.jfif" alt="" width="100px" />
<p>Item 2</p>
<strong>600ks</strong><br />
<button
class="atc"
data-id="2"
data-name="Item Two"
data-price="600"
>
Add To Cart
</button>
</div>
<div class="item">
<img src="cocacola.jfif" alt="" width="100px" />
<p>Item 3</p>
<strong>800ks</strong><br />
<button
class="atc"
data-id="3"
data-name="Item Three"
data-price="800"
>
Add To Cart
</button>
</div>
<div class="item">
<img src="cocacola.jfif" alt="" width="100px" />
<p>Item 4</p>
<strong>800ks</strong><br />
<button
class="atc"
data-id="4"
data-name="Item Four"
data-price="800"
>
Add To Cart
</button>
</div>
<div class="item">
<img src="cocacola.jfif" alt="" width="100px" />
<p>Item 5</p>
<strong>800ks</strong><br />
<button
class="atc"
data-id="5"
data-name="Item Five"
data-price="800"
>
Add To Cart
</button>
</div>
<div class="item">
<img src="cocacola.jfif" alt="" width="100px" />
<p>Item 6</p>
<strong>800ks</strong><br />
<button
class="atc"
data-id="6"
data-name="Item Six"
data-price="800"
>
Add To Cart
</button>
</div>
<div class="item">
<img src="cocacola.jfif" alt="" width="100px" />
<p>Item 7</p>
<strong>800ks</strong><br />
<button
class="atc"
data-id="7"
data-name="Item Seven"
data-price="800"
>
Add To Cart
</button>
</div>
<div class="item">
<img src="cocacola.jfif" alt="" width="100px" />
<p>Item 8</p>
<strong>800ks</strong><br />
<button
class="atc"
data-id="8"
data-name="Item Eight"
data-price="800"
>
Add To Cart
</button>
</div>
</div>
</div>
<div class="content" id="cart">
<h3>Cart Section</h3>
<div class="mycart">
<table
cellspacing="0"
cellpadding="10"
width="100%"
style="margin-bottom: 10px"
>
<thead>
<tr>
<th>No</th>
<th>Name</th>
<th>Price</th>
<th>Qty</th>
<th>Subtotal</th>
</tr>
</thead>
<tbody></tbody>
</table>
<button class="checkout">Checkout</button>
<span class="noti"></span>
</div>
</div>
</div>
</body>
</html>