forked from RAHULANN/vijay-Sales-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcategory.html
659 lines (585 loc) · 22.1 KB
/
category.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
<!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>Mobile Phones | VijaySales</title>
<link rel="stylesheet" href="navbar.css" />
<link rel="stylesheet" href="./styles/footer.css">
<link
rel="shortcut icon"
type="image/x-icon"
href="https://d2xamzlzrdbdbn.cloudfront.net/images/fevicon.ico"
/>
<style>
/* -----main Div----- */
#main{
display:flex;
width:95%;
margin:auto;
}
/* -------left Div------- */
#left-div{
/* width:20%; */
display:grid;
grid-template-columns: repeat(1,1fr);
grid-template-rows: 50px 200px 100px 200px 50px 50px 50px;
height:1000px;
margin:0px 25px;
/* border:1px solid purple; */
}
#left-div>div{
width:200px;
padding-left: 10px;
box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
/* border:1px solid pink; */
}
#price-range{
line-height: 7px;
}
#price-range>div{
display:flex;
justify-content: space-between;
}
/* -------Right Div------- */
/* --------upper Container------- */
#upper-container{
display:flex;
height:100px;
width:1200px;
justify-content: space-between;
align-items: center;
align-content:center;
/* border:1px solid yellow */
}
#upper-head-div{
display:flex;
gap:20px;
}
/* #mobile-div>h1{
font-family:RobotoMedium;
Font being Rendered:RobotoMedium;
border:1px solid red;
} */
#result-div{
margin-top:10px;
}
#sort-div{
/* margin-top: 20px; */
display:flex;
width:100px;
height:30px;
align-items: center;
justify-content: space-between;
border:1px solid orange;
}
#filter{
width:20px;
}
/* -------lower Container------- */
#container{
display:grid;
grid-gap:25px;
grid-template-columns:repeat(5,1fr);
}
#container>div>h4+p{
color:red;
text-align: left;
/* margin-left:10px; */
/* font-size: 1.1em; */
}
#container>div>p:nth-child(1){
color:red;
}
#container>div>div{
display:flex;
justify-content: space-between;
font-size: 1.1em;
/* background: red; */
}
#container>div>div>p:nth-child(2){
color:blue;
}
#container>div>div>p:nth-child(1){
text-decoration: line-through;
}
#container>div>button{
/* padding-left:-20px; */
/* margin: auto; */
width:100%;
padding:2px 0px;
background:red;
color:white;
border-radius: 5px;;
}
/* --------media Query-------- */
/* --------for small screen------ */
@media only screen and (min-width:0px) and (max-width:375px){
#container{
display:flex;
flex-wrap: wrap;
}
}
/* --------for medium screen------ */
@media only screen and (min-width:375px) and (max-width:768px){
#container{
display:flex;
flex-wrap: wrap;
}
}
</style>
</head>
<body>
<div id="headerDiv">
</div>
<!-- -----main Div----- -->
<div id="main">
<!-- ------left Div------ -->
<div id="left-div">
<!-- -----first left div---- -->
<div>
<h2>FILTERS</h2>
</div>
<!-- -------Type Div------- -->
<div>
<h3>TYPE</h3>
<div>
<input type = "checkbox" id="iPhones" value="iPhones">
<label for = "iPhones">iPhones</label><br>
<input type="checkbox" id="smartPhones" value="smartPhones">
<label for="smartPhones">smartphones</label><br>
<input type="checkbox" id="basicPhones" value="basicPhones">
<label for="basicPhones">basic phones</label><br>
</div>
</div>
<!-- --------price range Div------------>
<div id="price-range">
<h3>PRICE RANGE</h3>
<div>
<div>
<p>Rs.699</p>
</div>
<div>
<p>Rs.212900</p>
</div>
</div>
<hr>
</div>
<!---------brand Div----------->
<div>
<h3>BRAND</h3>
<div>
<input type = "checkbox" id="apple" value="apple">
<label for = "apple">Apple</label><br>
<input type="checkbox" id="onePlus" value="onePlus">
<label for="onePlus">One Plus</label><br>
<input type="checkbox" id="basicPhones" value="basicPhones">
<label for="basicPhones">basic phones</label><br>
</div>
</div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<!-- ---------right Div-------- -->
<div id="right-div">
<!-- -----------upper container---------- -->
<div id="upper-container">
<div id="upper-head-div">
<div id="mobile-div">
<h1>Buy Mobiles & Tablets Online</h1>
</div>
<div id="result-div">
<h3>We have got 1183 Results</h3>
</div>
</div>
<!-- -------sort Div------ -->
<div id="sort-div">
<div id="sort-by"><p>sort by</p></div>
<div id="sort-menu">
<select name="" id="filter" onchange="mySort()">
<option value=""></option>
<option value="new">New</option>
<option value="popular">Popular</option>
<option value="relevance">Relevance</option>
<option value="low">Price:Low to High</option>
<option value="high">Price:High To Low</option>
</select>
</div>
</div>
</div>
<!-- ---------lower container Div---------- -->
<div id="container"></div>
</div>
</body>
</html>
<script type="module">
// ------------database storage----------
// ------database firsrt key value pair------
let generalData2 = [
{
category: "general",
feature: "Lenovo IdeaPad 3 15IML05 81WB0113IN Laptop (10th Gen",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/44686e35-901d-4d21-9591-21c227c6a4b021091118_182x182.jpg",
newPrice: "36,490",
offer: "22%",
oldPrice: "47,000",
},
{
category: "general",
feature: "LG 6.5 Kg 5 Star Fully Automatic Top Load Washing Machine",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/ccf11718-e0a2-492e-8737-3794d90087fa_182x182.jpg",
newPrice: "18,990",
offer: "34%",
oldPrice: "28,990",
},
{
category: "general",
feature: "Vivo Y21 (4 GB RAM, 64 GB ROM, Diamond Glow)",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/6d2e5b51-b2c0-46de-a2b1-beb3b6d7342c21081257_182x182.jpg",
newPrice: "13,990",
offer: "22%",
oldPrice: "17,990",
},
{
category: "general",
feature: "Beats Studio Buds True Wireless Noise Cancelling Earphones",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/83a34fd4-2d7c-461b-803b-1b01f0024f3921281412_182x182.jpg",
newPrice: "10,990",
offer: "27%",
oldPrice: "14,900"
},
{
category: "general",
feature: "LG 32LM562BPTA 32(80 cm) HD Ready Smart",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/20d1a580-caf8-4d11-9cad-c14db28063f821200510_182x182.jpg",
newPrice: "18,490",
offer: "20%",
oldPrice: "22,990",
},
{
category: "general",
feature: "Haier 181L 2 Star Direct-Cool Single Door",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/ef807112-407f-4443-83fb-ea83e7678a4c_182x182.jpg",
newPrice: "11,340",
offer: "35%",
oldPrice: "17,400",
},
{
category: "general",
feature: "ASUS E410MA-EB002T Laptop (Intel Celeron",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/1ee98a57-79fb-4915-bd95-7ea0d6e6fef9_182x182.jpg",
newPrice: "24,490",
offer: "21%",
oldPrice: "30,990"
},
];
let laptopsData2 = [
{
category: "laptop",
feature: "Aspire 3 A315-58 NX.AE0SI.007 Laptop (11th Gen Core i5/8GB",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/631c35de-f67f-4e7e-bce5-ec54dd80b69921271238_182x182.jpg",
newPrice: "53,690",
offer: "23%",
oldPrice: "69,999",
},
{
category: "laptop",
feature: "Acer Aspire 5 A515-45 NX.A2ASI.004 Laptop (11th Gen",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/74fc3588-e65e-4472-8834-cf3698610ff821271315_182x182.jpg",
newPrice: "54,499",
offer: "23%",
oldPrice: "75,999",
},
{
category: "laptop",
feature: "Acer Aspire 5 A515-45 NX.A84SI.007 Laptop / 8GB RAM",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/c6f5e5e4-755e-423f-bb9c-62876610083821161318_182x182.jpg",
newPrice: "53,999",
offer: "29%",
oldPrice: "75,999",
},
{
category: "laptop",
feature: "Apple MGN63HN/A MacBook Air (Apple M1 Chip/ 8GB RAM/ 256G",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/b72b2403-3141-473a-8ed1-ca91b8009793_182x182.jpg",
newPrice: "83,900",
offer: "18%",
oldPrice: "92,900",
},
{
category: "laptop",
feature: "ASUS X515EA-BQ312TS Laptop (Intel 11th Gen",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/39f5704d-c84e-4986-ac70-36a8dadca3a2_182x182.jpg",
newPrice: "39,090",
offer: "26%",
oldPrice: "52,990",
},
{
category: "laptop",
feature: "Dell VOS 14 D552149WIN9BE (3401)",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/a8443229-998b-40f2-a52f-0890b6e29e4121031043_182x182.jpg",
newPrice: "37,290",
offer: "15%",
oldPrice: "43,990",
},
{
category: "laptop",
feature: "HP Pavilion 15-eg1000TU Laptop (11th Gen Core i5 /)",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/b1e3aeaa-3c99-4464-a610-0b50c22f928d21271246_182x182.jpg",
newPrice: "63,490",
offer: "18%",
oldPrice: "77,000"
},
];
// ---------mobilesData------
let mobilesData2 = [
{
category: "mobile",
feature: "Apple iPhone 12 (128 GB, Blue)",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/f0e87916-ef3d-49ba-a336-786ea2c5b06b_182x182.jpg",
newPrice: "62,605",
offer: "5%",
oldPrice: "65,900",
},
{
category: "mobile",
feature: "Apple iPhone 12 (128 GB, Black)",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/7b3d514b-a469-469b-8c0e-4bf5140438cb_182x182.jpg",
newPrice: "67,355",
offer: "5%",
oldPrice: "70,900",
},
{
category: "mobile",
feature: "OnePlus Nord 2 5G (8 GB RAM, 128 GB Storage,",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/6d9fa7c0-c6ab-47d1-b6f0-16f7832a7556_182x182.jpg",
newPrice: "29,999",
offer: "8%",
oldPrice: "32,999",
},
{
category: "mobile",
feature: "OnePlus 9 Pro 5G (8 GB RAM, 128 GB Storage,",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/63796658-96e1-48c4-8b7e-4aa910e81c13_182x182.jpg",
newPrice: "59,999",
offer: "8%",
oldPrice: "64,999",
},
{
category: "mobile",
feature: "OnePlus 9 Pro 5G (8 GB RAM, 128 GB Storage, Pine Green)",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/aade5485-9d17-44b1-bc12-c1cf1ce4ff85_182x182.jpg",
newPrice: "59,999",
offer: "8%",
oldPrice: "64,999",
},
{
category: "mobile",
feature: "OnePlus 9 5G (8 GB RAM, 128 GB Storage, Arctic",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/bdf16d36-53df-4151-9aa1-0f46112a760c_182x182.jpg",
newPrice: "44,999",
offer: "10%",
oldPrice: "49,999",
},
{
category: "mobile",
feature: "OnePlus 9R 5G (12 GB RAM, 256 GB Storage,",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/cc37c6f9-5095-4818-af27-6295ddd4c532_182x182.jpg",
newPrice: "40,999",
offer: "7%",
oldPrice: "43,990",
},
{
category: "mobile",
feature: "Oppo CPH2185 A15 (3 GB, 32 GB, Dynamic Black)",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/a5eac8a8-01e3-4294-ac61-489c469d2fbf_182x182.jpg",
newPrice: "10,990",
offer: "15%",
oldPrice: "12,990",
},
{
category: "mobile",
feature: "Redmi Note 10S (6 GB RAM, 64 GB Storage, Deep",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/df5630de-bddb-4538-93b0-a2894e5e2b94_182x182.jpg",
newPrice: "13,999",
offer: "18%",
oldPrice: "16,999",
},
{
category: "mobile",
feature: "Redmi Note 10S (6 GB RAM, 64 GB Storage)",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/67d54c6b-5771-4694-b7bb-3d9cdfd85ca9_182x182.jpg",
newPrice: "13,999",
offer: "18%",
oldPrice: "16,999",
},
{
category: "mobile",
feature: "Samsung Galaxy A03s (4 GB RAM, 64 GB ROM, Blue)",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/bb492ed2-6bbc-44a8-9392-16d1fbfa202f_182x182.jpg",
newPrice: "12,499",
offer: "8%",
oldPrice: "14,499",
},
{
category: "mobile",
feature: "Vivo Y12G (3 GB RAM, 64 GB ROM, Phantom Black)",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/d3c3e7bf-3acd-4d4a-aef7-156c2ab7ab9d21140626_182x182.jpg",
newPrice: "11,999",
offer: "8%",
oldPrice: "12,990",
},
{
category: "mobile",
feature: "Redmi 10 Prime (6 GB RAM, 128 GB ROM",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/d03ad00a-1328-4335-8de4-06c9e133f17a21091150_182x182.jpg",
newPrice: "14,499",
offer: "15%",
oldPrice: "16,999",
},
{
category: "mobile",
feature: "Samsung Galaxy A12 (4 GB RAM, 64 GB ROM, Blue)",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/71c5d230-c6c2-4762-8cba-c157432144be21131237_182x182.jpg",
newPrice: "13,999",
offer: "8%",
oldPrice: "14,499",
},
{
category: "mobile",
feature: "Redmi Note 10T 5G (4 GB RAM, 64 GB ROM, Graphit",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/2e5831cb-c02b-48e6-99d1-79edbaac4d20_182x182.jpg",
newPrice: "13,999",
offer: "18%",
oldPrice: "16,999",
},
{
category: "mobile",
feature: "Realme C25Y (4GB RAM, 128 GB ROM, Metal Grey)",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/a9e71f71-a1d6-47d2-95af-efc7d175e7c321200526_182x182.jpg",
newPrice: "11,999",
offer: "8%",
oldPrice: "12,990",
},
{
category: "mobile",
feature: "Vivo Y21 (4 GB RAM, 64 GB ROM, Diamond Glow)",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/6d2e5b51-b2c0-46de-a2b1-beb3b6d7342c21081257_182x182.jpg",
newPrice: "13,990",
offer: "22%",
oldPrice: "17,990"
}
];
// ----------televisionsData-----------
let televisionsData2 = [
{
category: "television",
feature: "LG 43UP7750PTZ 43(109.22 cm) Ultra HD (4K) Smart (2021 Model)",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/79685294-c0ec-43e4-9c14-ea3c6b4a6c52_182x182.jpg",
newPrice: "44,000",
offer: "27%",
oldPrice: "59,990",
},
{
category: "television",
feature: "Samsung Crystal UA43AU8000 43(108 cm) Ultra HD (4K) Smart",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/1cc11129-fa85-4803-8ce1-f65869481909_182x182.jpg",
newPrice: "45,890",
offer: "23%",
oldPrice: "59,900",
},
{
category: "television",
feature: "Sansui JSW32SKHD Smart HD ready LED TV",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/99929658-d9f5-452d-838b-99c219b2227021200531_182x182.jpg",
newPrice: "13,990",
offer: "30%",
oldPrice: "19,990",
},
{
category: "television",
feature: "Sansui JSW43ASUHD 43 (109 cm ) 4K Ultra HD LED Smart Android ",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/0bcecfa3-2a1d-45ac-934e-da31a8093fb2_182x182.jpg",
newPrice: "28,990",
offer: "26%",
oldPrice: "38,990",
},
{
category: "television",
feature: "Panasonic TH-32JS660DX 32 (80cm) HD Ready",
img: "https://d2xamzlzrdbdbn.cloudfront.net/products/8c8ebf6c-b8cd-43e3-a76a-4d542965da8521190646_182x182.jpg",
newPrice: "20,500",
offer: "23%",
oldPrice: "26,490"
},
];
localStorage.setItem("mobilesData",JSON.stringify(mobilesData2));
localStorage.setItem("laptopsData",JSON.stringify(laptopsData2));
localStorage.setItem("televisionsData",JSON.stringify(televisionsData2));
localStorage.setItem("generalData",JSON.stringify(generalData2));
// -------------html part------
let mobilesData = JSON.parse(localStorage.getItem("mobilesData"));
let container = document.querySelector("#container");
mobilesData.forEach(function(el){
let coupon = document.createElement("p");
let mainDiv=document.createElement("div");
let priceOfferDiv=document.createElement("div");
let img = document.createElement("img");
let h4=document.createElement("h4");
let newPrice=document.createElement("p");
let oldPrice=document.createElement("p");
let offer=document.createElement("p");
let btn=document.createElement("button");
img.setAttribute("src",el.img);
img.height="200";
img.width="200";
coupon.innerHTML="DISCOUNT COUPON"
h4.innerHTML=el.feature;
newPrice.innerHTML="Rs."+el.newPrice;
oldPrice.innerHTML="Rs"+el.oldPrice;
offer.innerHTML=el.offer+"off";
btn.innerHTML="OFFER AVAILABLE";
priceOfferDiv.append(oldPrice,offer);
mainDiv.append(coupon,img,h4,newPrice,priceOfferDiv,btn);
container.append(mainDiv);
})
// ---------sort function-----
let sortedArr;
function mySort(){
let filter=document.querySelector("#filter").value;
if(filter="low"){
sortedArr=mobilesData.sort(function(a,b){
if(a>b){
return 1;
}
if(a<b){
return -1;
}
return 0;
})
}else if(filter=="high"){
sortedArr=mobilesData.sort(function(a,b){
if(a>b){
return -1;
}
if(a<b){
return 1;
}
return 0;
})
}
}
import header from "./components/header.js"
let y = document.getElementById("headerDiv");
y.innerHTML=header();
var cs = document.querySelector("#container>div:nth-child(1)");
cs.addEventListener("click",goToUnique);
function goToUnique(){
window.location.href = "uniqueProduct.html"
}
</script>