-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhomeopathy.js
543 lines (518 loc) · 16.3 KB
/
homeopathy.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
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
// product data store in arr of object bellow
var productData = [
{
img: "https://static.oxinis.com/healthmug/image/product/411-2-200.jpg",
nam: "Evion Capsule (400mg) (10caps)",
detail:
"Assists in managing the levels of Vitamin E in the body, contains anti-oxidants",
logo: " https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTKhsLXBmJvoDmYBorqmDgfjZs-y4Mn5xNGyg&usqp=CAU",
price: "300",
discount: "40",
actualprice: "399",
cat: "Medicines",
s1: "fas fa-star",
s2: "fas fa-star",
s3: "fas fa-star-half-alt",
s4: "far fa-star",
s5: "far fa-star",
},
{
img: "https://static.oxinis.com/healthmug/image/product/1365-1-200.jpg",
nam: "Skinlite cream (15g)",
detail: null,
logo: " https://static.oxinis.com/healthmug/image/asset/498-rm-150.png",
price: "49",
discount: "40",
actualprice: "210",
cat: "Medicines",
s1: "fas fa-star",
s2: "fas fa-star",
s3: "fas fa-star-half-alt",
s4: "far fa-star",
s5: "far fa-star",
},
{
img: "https://static.oxinis.com/healthmug/image/product/61158-1-200.jpg",
nam: "Skinlite cream (15g)",
detail: null,
logo: " https://static.oxinis.com/healthmug/image/asset/498-rm-150.png",
price: "49",
discount: "40",
actualprice: "210",
cat: "Medicines",
s1: "fas fa-star",
s2: "fas fa-star",
s3: "fas fa-star-half-alt",
s4: "far fa-star",
s5: "far fa-star",
},
{
img: "https://static.oxinis.com/healthmug/image/product/878-1-200.jpg",
nam: "SBL Calcarea Fluoricum 6X (25g)",
detail:
"Helps to counter Vitamin B deficiency, and assists in promoting a healthy nervous system",
logo: " https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTKhsLXBmJvoDmYBorqmDgfjZs-y4Mn5xNGyg&usqp=CAU",
price: "29",
discount: "40",
actualprice: "34",
cat: "Medicines",
s1: "fas fa-star",
s2: "fas fa-star",
s3: "fas fa-star-half-alt",
s4: "far fa-star",
s5: "far fa-star",
},
{
img: "https://static.oxinis.com/healthmug/image/product/6308-1-200.jpg",
nam: "Willmar Schwabe India Berberis Aquifolium 1X (Q) (30ml)",
detail:
"Useful in seasonal cold and viral flu, reduces bloating and helps in digestive process",
logo: " https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTKhsLXBmJvoDmYBorqmDgfjZs-y4Mn5xNGyg&usqp=CAU",
price: "200",
discount: "40",
actualprice: "300",
cat: "Medicines",
s1: "fas fa-star",
s2: "fas fa-star-half-alt",
s3: "far fa-star",
s4: "far fa-star",
s5: "far fa-star",
},
{
img: "https://static.oxinis.com/healthmug/image/product/633-1-200.jpg",
nam: "SBL Nux Vomica 200 CH (30ml)",
detail:
"Useful in seasonal cold and viral flu, reduces bloating and helps in digestive process",
logo: " https://static.oxinis.com/healthmug/image/asset/498-rm-150.png",
price: "130",
discount: "40",
actualprice: "153",
cat: "Medicines",
s1: "fas fa-star",
s2: "fas fa-star",
s3: "fas fa-star-half-alt",
s4: "far fa-star",
s5: "far fa-star",
},
{
img: "https://static.oxinis.com/healthmug/image/product/1549-1-200.jpg",
nam: "Candid Cream (50g)",
detail:
"Useful in seasonal cold and viral flu, reduces bloating and helps in digestive process",
logo: " https://static.oxinis.com/healthmug/image/asset/498-rm-150.png",
price: "130",
discount: "40",
actualprice: "153",
cat: "Medicines",
s1: "fas fa-star",
s2: "fas fa-star",
s3: "fas fa-star-half-alt",
s4: "far fa-star",
s5: "far fa-star",
},
{
img: "https://static.oxinis.com/healthmug/image/product/3050-3-200.jpg",
nam: "Candid Cream (50g)",
detail:
"Useful in seasonal cold and viral flu, reduces bloating and helps in digestive process",
logo: " https://static.oxinis.com/healthmug/image/asset/498-rm-150.png",
price: "130",
discount: "40",
actualprice: "153",
cat: "Medicines",
s1: "fas fa-star",
s2: "fas fa-star",
s3: "fas fa-star-half-alt",
s4: "far fa-star",
s5: "far fa-star",
},
{
img: "https://static.oxinis.com/healthmug/image/product/540-2-200.jpg",
nam: "Clear Gel (20g)",
detail: null,
logo: " https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTKhsLXBmJvoDmYBorqmDgfjZs-y4Mn5xNGyg&usqp=CAU",
price: "98",
cat: "Dilutions",
discount: "50",
actualprice: "148",
s1: "fas fa-star",
s2: "fas fa-star",
s3: "fas fa-star",
s3: "fas fa-star-half-alt",
s4: "far fa-star",
},
{
img: "https://static.oxinis.com/healthmug/image/product/61167-1-200.jpg",
nam: "Clear Gel (20g)",
detail: null,
logo: " https://static.oxinis.com/healthmug/image/asset/498-rm-150.png",
price: "98",
cat: "Dilutions",
discount: "50",
actualprice: "148",
s1: "fas fa-star",
s2: "fas fa-star",
s3: "fas fa-star",
s3: "fas fa-star-half-alt",
s4: "far fa-star",
},
{
img: "https://static.oxinis.com/healthmug/image/product/622-1-200.jpg",
nam: "Clear Gel (20g)",
detail: null,
logo: " https://static.oxinis.com/healthmug/image/asset/498-rm-150.png",
price: "98",
cat: "Dilutions",
discount: "50",
actualprice: "148",
s1: "fas fa-star",
s2: "fas fa-star",
s3: "fas fa-star",
s3: "fas fa-star-half-alt",
s4: "far fa-star",
},
{
img: "https://static.oxinis.com/healthmug/image/product/622-1-200.jpg",
nam: "Clear Gel (20g)",
detail: null,
logo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTKhsLXBmJvoDmYBorqmDgfjZs-y4Mn5xNGyg&usqp=CAU",
price: "98",
cat: "Dilutions",
discount: "50",
actualprice: "148",
s1: "fas fa-star",
s2: "fas fa-star",
s3: "fas fa-star",
s3: "fas fa-star-half-alt",
s4: "far fa-star",
},
{
img: "https://static.oxinis.com/healthmug/image/product/622-1-200.jpg",
nam: "Clear Gel (20g)",
detail: null,
logo: " https://static.oxinis.com/healthmug/image/asset/498-rm-150.png",
price: "98",
cat: "Dilutions",
discount: "50",
actualprice: "148",
s1: "fas fa-star",
s2: "fas fa-star",
s3: "fas fa-star",
s3: "fas fa-star-half-alt",
s4: "far fa-star",
},
{
img: "https://static.oxinis.com/healthmug/image/product/127856-1-200.jpg",
nam: "Salicylic Acid I.P. (20g)",
detail: "Salicylic Acid for better skin and Keratolytictherapy",
logo: " https://static.oxinis.com/healthmug/image/asset/498-rm-150.png",
price: "169",
discount: "30",
actualprice: "200",
cat: "Mother Tinctures",
s1: "fas fa-star",
s2: "fas fa-star",
s3: "fas fa-star",
s4: "fas fa-star",
s5: "fas fa-star",
},
{
img: "https://static.oxinis.com/healthmug/image/product/7603-1-200.jpg",
nam: "Refresh Tears Eye Drop (10ml)",
detail:
"Helps in relieving pain and provides comfort in dry eyes by producing artificial tears",
logo: " https://static.oxinis.com/healthmug/image/asset/498-rm-150.png",
price: "90",
cat: "Mother Tinctures",
s1: "fas fa-star",
s2: "fas fa-star",
s3: "fas fa-star-half-alt",
s4: "far fa-star",
s5: "far fa-star",
},
{
img: "https://static.oxinis.com/healthmug/image/product/11537-1-200.jpg",
nam: "Isotine Eye Drops (10ml)",
detail: null,
logo: " https://static.oxinis.com/healthmug/image/asset/498-rm-150.png",
price: "200",
discount: "30",
cat: "Dilutions",
actualprice: "399",
cat: "Mother Tinctures",
s1: "fas fa-star",
s2: "fas fa-star",
s3: "fas fa-star-half-alt",
s4: "far fa-star",
s5: "far fa-star",
},
{
img: "https://static.oxinis.com/healthmug/image/product/7723-1-200.jpg",
nam: "Silverex Ionic Gel (10g)",
detail: null,
logo: " https://static.oxinis.com/healthmug/image/asset/498-rm-150.png",
price: "90",
cat: "Mother Tinctures",
s1: "fas fa-star",
s2: "fas fa-star",
s3: "fas fa-star-half-alt",
s4: "far fa-star",
s5: "far fa-star",
},
{
img: "https://static.oxinis.com/healthmug/image/product/92785-1-200.jpg",
nam: "Soframycin Skin Cream (30g)",
detail: null,
logo: " https://static.oxinis.com/healthmug/image/asset/498-rm-150.png",
price: "189",
discount: "40",
actualprice: "250",
cat: "Biochemic Tablets",
s1: "fas fa-star",
s2: "fas fa-star",
s3: "fas fa-star",
s4: "fas fa-star",
s5: "fas fa-star-half-alt",
},
{
img: "https://static.oxinis.com/healthmug/image/product/137284-1-200.jpg",
nam: "Volini Gel (4g)",
detail: null,
logo: " https://static.oxinis.com/healthmug/image/asset/498-rm-150.png",
price: "70",
discount: "40",
actualprice: "100",
cat: "Biochemic Tablets",
s1: "fas fa-star",
s2: "fas fa-star",
s3: "fas fa-star",
s4: "fas fa-star",
s5: "fas fa-star-half-alt",
},
{
img: "https://static.oxinis.com/healthmug/image/product/121505-1-200.jpg",
nam: "Cliface Gel (20g)",
detail: null,
logo: " https://static.oxinis.com/healthmug/image/asset/498-rm-150.png",
price: "100",
discount: "40",
actualprice: "150",
cat: "Biochemic Tablets",
s1: "fas fa-star",
s2: "fas fa-star",
s3: "fas fa-star",
s4: "fas fa-star",
s5: "fas fa-star-half-alt",
},
{
img: "https://static.oxinis.com/healthmug/image/product/92785-1-200.jpg",
nam: "Soframycin Skin Cream (30g)",
detail: null,
logo: " https://static.oxinis.com/healthmug/image/asset/498-rm-150.png",
price: "189",
discount: "40",
actualprice: "250",
cat: "Biochemic Tablets",
s1: "fas fa-star",
s2: "fas fa-star",
s3: "fas fa-star",
s4: "fas fa-star",
s5: "fas fa-star-half-alt",
},
{
img: "https://static.oxinis.com/healthmug/image/product/137284-1-200.jpg",
nam: "Volini Gel (4g)",
detail: null,
logo: " https://static.oxinis.com/healthmug/image/asset/498-rm-150.png",
price: "70",
discount: "40",
actualprice: "100",
cat: "Biochemic Tablets",
s1: "fas fa-star",
s2: "fas fa-star",
s3: "fas fa-star",
s4: "fas fa-star",
s5: "fas fa-star-half-alt",
},
{
img: "https://static.oxinis.com/healthmug/image/product/121505-1-200.jpg",
nam: "Cliface Gel (20g)",
detail: null,
logo: " https://static.oxinis.com/healthmug/image/asset/498-rm-150.png",
price: "100",
discount: "40",
actualprice: "150",
cat: "Biochemic Tablets",
s1: "fas fa-star",
s2: "fas fa-star",
s3: "fas fa-star",
s4: "fas fa-star",
s5: "fas fa-star-half-alt",
},
{
img: "https://static.oxinis.com/healthmug/image/product/92570-1-200.jpg",
nam: "Combiflam Icy Hot Fast Pain Relief Gel (30g)",
detail: null,
logo: " https://static.oxinis.com/healthmug/image/asset/498-rm-150.png",
price: "477",
discount: "40",
actualprice: "522",
cat: "Biochemic Tablets",
s1: "fas fa-star",
s2: "fas fa-star",
s3: "fas fa-star",
s4: "fas fa-star",
s5: "fas fa-star-half-alt",
},
];
// map productData and append in to div bellow
function display(productData) {
document.querySelector(".items").textContent = "";
productData.map(function (ele, index) {
var mainD = document.createElement("div");
mainD.setAttribute("class", "itm"); //main div for item img and details
var d1 = document.createElement("div"); //img
var img = document.createElement("img");
img.setAttribute("src", ele.img);
d1.append(img);
var d2 = document.createElement("div");
var name = document.createElement("p");
name.setAttribute("id", "iname"); //name of product
name.textContent = ele.nam;
var detail = document.createElement("p");
detail.textContent = ele.detail;
d2.prepend(name, detail);
var d3 = document.createElement("div"); // img for review stras img (still ppending)
var stardiv1 = document.createElement("i");
var stardiv2 = document.createElement("i");
var stardiv3 = document.createElement("i");
var stardiv4 = document.createElement("i");
var stardiv5 = document.createElement("i");
stardiv1.setAttribute("class", ele.s1);
stardiv2.setAttribute("class", ele.s2);
stardiv3.setAttribute("class", ele.s3);
stardiv4.setAttribute("class", ele.s4);
stardiv5.setAttribute("class", ele.s5);
d3.append(stardiv1, stardiv2, stardiv3, stardiv4, stardiv5);
var d4 = document.createElement("div");
var logo = document.createElement("img");
logo.setAttribute("src", ele.logo);
logo.setAttribute("src", ele.logo);
d4.append(logo);
var d5 = document.createElement("div");
var price = document.createElement("p");
price.setAttribute("id", "price");
price.textContent = ele.price;
var rupeeLogo = document.createElement("span");
rupeeLogo.textContent = "₹";
rupeeLogo.style.fontSize = "20px";
var rupeeLogo1 = document.createElement("span");
rupeeLogo1.textContent = "₹";
rupeeLogo1.style.fontSize = "20px";
rupeeLogo1.style.color = "#b7b7b7";
var actualPrice = document.createElement("span");
actualPrice.textContent = ele.actualprice;
actualPrice.style.fontSize = "20px";
actualPrice.style.color = "#b7b7b7";
actualPrice.style.marginRight = "15px";
actualPrice.style.textDecoration = "line-through";
d5.append(rupeeLogo1, actualPrice, rupeeLogo, price);
var d6 = document.createElement("div"); // add to cart logo
var cartLogo = document.createElement("i");
cartLogo.setAttribute("class", "fas fa-cart-plus");
cartLogo.style.fontSize = "20px";
d6.append(cartLogo);
mainD.append(d1, d2, d3, d4, d5, d6);
document.querySelector(".items").append(mainD);
});
// var numberofitem = document.createElement("div");
// numberofitem.textContent = productData.length;
// console.log(numberofitem);
// document.querySelector(".products>div:nth-child(4)>div:nth-child(1)").append(numberofitem)
}
// document.querySelector(".products>div:nth-child(4)>div:nth-child(1)").textContent= "";
display(productData);
//sorting bellow
// sort by name
document.querySelector(".sbyName").addEventListener("click", sortbyname);
function sortbyname() {
productData.sort(function (a, b) {
if (a.nam > b.nam) return -1;
if (a.nam < b.nam) return -1;
return 0;
});
display(productData);
// console.log(productData)
}
// sort by price --1
document.querySelector(".LtoH").addEventListener("click", sortbyLtoH);
function sortbyLtoH() {
productData.sort(function (a, b) {
return Number(a.price) - Number(b.price);
});
display(productData);
// console.log(productData)
}
// sort by price --2
document.querySelector(".HtoL").addEventListener("click", sortbyHtoL);
function sortbyHtoL() {
productData.sort(function (a, b) {
return Number(b.price) - Number(a.price);
});
display(productData);
// console.log(productData)
}
document.querySelector(".bayurveda1").addEventListener("click", filterby1);
function filterby1() {
var filtitem = productData.filter(function (ele) {
return ele.cat == "Medicines";
});
console.log(filtitem);
display(filtitem);
}
document.querySelector(".bayurveda2").addEventListener("click", filterby2);
function filterby2() {
var filtitem = productData.filter(function (ele) {
return ele.cat == "Dilutions";
});
console.log(filtitem);
display(filtitem);
}
document.querySelector(".bayurveda3").addEventListener("click", filterby3);
function filterby3() {
var filtitem = productData.filter(function (ele) {
return ele.cat == "Mother Tinctures";
});
console.log(filtitem);
display(filtitem);
}
document.querySelector(".bayurveda4").addEventListener("click", filterby4);
function filterby4() {
var filtitem = productData.filter(function (ele) {
return ele.cat == "Biochemic Tablets";
});
// console.log(filtitem);
display(filtitem);
}
//by price filter
//bellow 200
document.querySelector(".b200").addEventListener("click", filtby200);
function filtby200() {
var filtbyprice = productData.filter(function (ele) {
return Number(ele.price) <= 100;
});
console.log(filtbyprice);
display(filtbyprice);
}
//bellow 500 and abow 200
document.querySelector(".b500").addEventListener("click", filtby500);
function filtby500() {
var filtbyprice = productData.filter(function (ele) {
return Number(ele.price) <= 500 && Number(ele.price) >= 201;
});
console.log(filtbyprice);
display(filtbyprice);
}
document.querySelector("#return").addEventListener("click", function () {
window.location.href = "index.html";
});