-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathfertilizer.js
1554 lines (903 loc) · 35.3 KB
/
fertilizer.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
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
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
document.addEventListener('DOMContentLoaded',function(){
const menu_btn = document.querySelector('.right-bar');
const mobile_nav = document.querySelector('.mobile_nav');
menu_btn.addEventListener('click',function(){
menu_btn.classList.toggle('is-active');
mobile_nav.classList.toggle('is-active');
});
});
//main card
let mega = document.querySelector('.mega');
/**********************************************Sweet Potato******************************************************/
// Card 1
let containers_mega1 = document.querySelector('.containers-mega1');
document.querySelector('#buy1').onclick = ()=>{
mega.style.display = 'flex';
containers_mega1.classList.add('actived');
}
document.querySelector('#close1').onclick = ()=>{
mega.style.display = 'none';
containers_mega1.classList.remove('actived');
};
const immgs = document.querySelectorAll('.container1 .imgs a');
let imgId = 1;
immgs.forEach((img)=>{
img.addEventListener('click',(e)=>{
e.preventDefault();
imgId = img.dataset.id1;
moveImage();
});
})
function moveImage()
{
const imgwidth = document.querySelector('.main-image1 img:first-child').clientWidth;
let width = (imgId-1)*imgwidth;
document.querySelector('.main-image1').style.transform = `translateX(${-width}px)`;
}
let minus_qty1 = document.querySelector('.qty_minus1');
let plus_qty1 = document.querySelector('.qty_plus1');
let qty_value1 = document.querySelector('.qty_value1');
minus_qty1.addEventListener('click',function(){
let qty1 = parseInt(qty_value1.value);
if(qty1>1)
{
qty1--;
qty_value1.value=qty1;
}
});
plus_qty1.addEventListener('click',function(){
let qty1 = parseInt(qty_value1.value);
if(qty1>=1){
qty1++;
qty_value1.value = qty1;
}
});
/**********************************************Sweet Potato******************************************************/
/**********************************************Corn******************************************************/
//card 2
let containers_mega2 = document.querySelector('.containers-mega2');
document.querySelector('#buy2').onclick = ()=>{
mega.style.display = 'flex';
containers_mega2.classList.add('actived2');
}
document.querySelector('#close2').onclick = ()=>{
mega.style.display = 'none';
containers_mega2.classList.remove('actived2');
};
const immgs2 = document.querySelectorAll('.container2 .imgs a');
let imgId2 = 1;
immgs2.forEach((img2)=>{
img2.addEventListener('click',(e)=>{
e.preventDefault();
imgId2 = img2.dataset.id2;
moveImage2();
});
})
function moveImage2()
{
const imgwidth2 = document.querySelector('.main-image2 img:first-child').clientWidth;
let width2 = (imgId2-1)*imgwidth2;
document.querySelector('.main-image2').style.transform = `translateX(${-width2}px)`;
}
let minus_qty2 = document.querySelector('.qty_minus2');
let plus_qty2 = document.querySelector('.qty_plus2');
let qty_value2 = document.querySelector('.qty_value2');
minus_qty2.addEventListener('click',function(){
let qty2= parseInt(qty_value2.value);
if(qty2>1)
{
qty2--;
qty_value2.value=qty2;
}
});
plus_qty2.addEventListener('click',function(){
let qty2 = parseInt(qty_value2.value);
if(qty2>=1){
qty2++;
qty_value2.value = qty2;
}
});
/**********************************************Corn******************************************************/
/**********************************************Wheat******************************************************/
//card 3
let containers_mega3 = document.querySelector('.containers-mega3');
document.querySelector('#buy3').onclick = ()=>{
mega.style.display = 'flex';
containers_mega3.classList.add('actived3');
}
document.querySelector('#close3').onclick = ()=>{
mega.style.display = 'none';
containers_mega3.classList.remove('actived3');
};
const immgs3 = document.querySelectorAll('.container3 .imgs a');
let imgId3 = 1;
immgs3.forEach((img3)=>{
img3.addEventListener('click',(e)=>{
e.preventDefault();
imgId3 = img3.dataset.id3;
moveImage3();
});
})
function moveImage3()
{
const imgwidth3 = document.querySelector('.main-image3 img:first-child').clientWidth;
let width3 = (imgId3-1)*imgwidth3;
document.querySelector('.main-image3').style.transform = `translateX(${-width3}px)`;
}
let minus_qty3 = document.querySelector('.qty_minus3');
let plus_qty3 = document.querySelector('.qty_plus3');
let qty_value3 = document.querySelector('.qty_value3');
minus_qty3.addEventListener('click',function(){
let qty3= parseInt(qty_value3.value);
if(qty3>1)
{
qty3--;
qty_value3.value=qty3;
}
});
plus_qty3.addEventListener('click',function(){
let qty3 = parseInt(qty_value3.value);
if(qty3>=1){
qty3++;
qty_value3.value = qty3;
}
});
/**********************************************Wheat******************************************************/
/**********************************************Potatoes******************************************************/
//card 4
let containers_mega4 = document.querySelector('.containers-mega4');
document.querySelector('#buy4').onclick = ()=>{
mega.style.display = 'flex';
containers_mega4.classList.add('actived4');
}
document.querySelector('#close4').onclick = ()=>{
mega.style.display = 'none';
containers_mega4.classList.remove('actived4');
};
const immgs4 = document.querySelectorAll('.container4 .imgs a');
let imgId4 = 1;
immgs4.forEach((img4)=>{
img4.addEventListener('click',(e)=>{
e.preventDefault();
imgId4 = img4.dataset.id4;
moveImage4();
});
})
function moveImage4()
{
const imgwidth4 = document.querySelector('.main-image4 img:first-child').clientWidth;
let width4 = (imgId4-1)*imgwidth4;
document.querySelector('.main-image4').style.transform = `translateX(${-width4}px)`;
}
let minus_qty4 = document.querySelector('.qty_minus4');
let plus_qty4 = document.querySelector('.qty_plus4');
let qty_value4 = document.querySelector('.qty_value4');
minus_qty4.addEventListener('click',function(){
let qty4= parseInt(qty_value4.value);
if(qty4>1)
{
qty4--;
qty_value4.value=qty4;
}
});
plus_qty4.addEventListener('click',function(){
let qty4 = parseInt(qty_value4.value);
if(qty4>=1){
qty4++;
qty_value4.value = qty4;
}
});
/**********************************************Potatoes******************************************************/
/**********************************************Rice******************************************************/
//card 5
let containers_mega5 = document.querySelector('.containers-mega5');
document.querySelector('#buy5').onclick = ()=>{
mega.style.display = 'flex';
containers_mega5.classList.add('actived5');
}
document.querySelector('#close5').onclick = ()=>{
mega.style.display = 'none';
containers_mega5.classList.remove('actived5');
};
const immgs5 = document.querySelectorAll('.container5 .imgs a');
let imgId5 = 1;
immgs5.forEach((img5)=>{
img5.addEventListener('click',(e)=>{
e.preventDefault();
imgId5 = img5.dataset.id5;
moveImage5();
});
})
function moveImage5()
{
const imgwidth5 = document.querySelector('.main-image5 img:first-child').clientWidth;
let width5 = (imgId5-1)*imgwidth5;
document.querySelector('.main-image5').style.transform = `translateX(${-width5}px)`;
}
let minus_qty5 = document.querySelector('.qty_minus5');
let plus_qty5 = document.querySelector('.qty_plus5');
let qty_value5 = document.querySelector('.qty_value5');
minus_qty5.addEventListener('click',function(){
let qty5= parseInt(qty_value5.value);
if(qty5>1)
{
qty5--;
qty_value5.value=qty5;
}
});
plus_qty5.addEventListener('click',function(){
let qty5 = parseInt(qty_value5.value);
if(qty5>=1){
qty5++;
qty_value5.value = qty5;
}
});
/**********************************************Rice******************************************************/
/**********************************************Vegetable******************************************************/
//card 6
let containers_mega6 = document.querySelector('.containers-mega6');
document.querySelector('#buy6').onclick = ()=>{
mega.style.display = 'flex';
containers_mega6.classList.add('actived6');
}
document.querySelector('#close6').onclick = ()=>{
mega.style.display = 'none';
containers_mega6.classList.remove('actived6');
};
const immgs6 = document.querySelectorAll('.container6 .imgs a');
let imgId6 = 1;
immgs6.forEach((img6)=>{
img6.addEventListener('click',(e)=>{
e.preventDefault();
imgId6 = img6.dataset.id6;
moveImage6();
});
})
function moveImage6()
{
const imgwidth6 = document.querySelector('.main-image6 img:first-child').clientWidth;
let width6 = (imgId6-1)*imgwidth6;
document.querySelector('.main-image6').style.transform = `translateX(${-width6}px)`;
}
let minus_qty6 = document.querySelector('.qty_minus6');
let plus_qty6 = document.querySelector('.qty_plus6');
let qty_value6 = document.querySelector('.qty_value6');
minus_qty6.addEventListener('click',function(){
let qty6= parseInt(qty_value6.value);
if(qty6>1)
{
qty6--;
qty_value6.value=qty6;
}
});
plus_qty6.addEventListener('click',function(){
let qty6 = parseInt(qty_value6.value);
if(qty6>=1){
qty6++;
qty_value6.value = qty6;
}
});
/**********************************************Vegatable******************************************************/
/**********************************************Legumes******************************************************/
//card 7
let containers_mega7 = document.querySelector('.containers-mega7');
document.querySelector('#buy7').onclick = ()=>{
mega.style.display = 'flex';
containers_mega7.classList.add('actived7');
}
document.querySelector('#close7').onclick = ()=>{
mega.style.display = 'none';
containers_mega7.classList.remove('actived7');
};
const immgs7 = document.querySelectorAll('.container7 .imgs a');
let imgId7 = 1;
immgs7.forEach((img7)=>{
img7.addEventListener('click',(e)=>{
e.preventDefault();
imgId7 = img7.dataset.id7;
moveImage7();
});
})
function moveImage7()
{
const imgwidth7 = document.querySelector('.main-image7 img:first-child').clientWidth;
let width7 = (imgId7-1)*imgwidth7;
document.querySelector('.main-image7').style.transform = `translateX(${-width7}px)`;
}
let minus_qty7 = document.querySelector('.qty_minus7');
let plus_qty7 = document.querySelector('.qty_plus7');
let qty_value7 = document.querySelector('.qty_value7');
minus_qty7.addEventListener('click',function(){
let qty7= parseInt(qty_value7.value);
if(qty7>1)
{
qty7--;
qty_value7.value=qty7;
}
});
plus_qty7.addEventListener('click',function(){
let qty7 = parseInt(qty_value7.value);
if(qty7>=1){
qty7++;
qty_value7.value = qty7;
}
});
/**********************************************Legumes******************************************************/
/**********************************************Pomegranate******************************************************/
//card 8
let containers_mega8 = document.querySelector('.containers-mega8');
document.querySelector('#buy8').onclick = ()=>{
mega.style.display = 'flex';
containers_mega8.classList.add('actived8');
}
document.querySelector('#close8').onclick = ()=>{
mega.style.display = 'none';
containers_mega8.classList.remove('actived8');
};
const immgs8 = document.querySelectorAll('.container8 .imgs a');
let imgId8 = 1;
immgs8.forEach((img8)=>{
img8.addEventListener('click',(e)=>{
e.preventDefault();
imgId8 = img8.dataset.id8;
moveImage8();
});
})
function moveImage8()
{
const imgwidth8 = document.querySelector('.main-image8 img:first-child').clientWidth;
let width8 = (imgId8-1)*imgwidth8;
document.querySelector('.main-image8').style.transform = `translateX(${-width8}px)`;
}
let minus_qty8 = document.querySelector('.qty_minus8');
let plus_qty8 = document.querySelector('.qty_plus8');
let qty_value8 = document.querySelector('.qty_value8');
minus_qty8.addEventListener('click',function(){
let qty8= parseInt(qty_value8.value);
if(qty8>1)
{
qty8--;
qty_value8.value=qty8;
}
});
plus_qty8.addEventListener('click',function(){
let qty8 = parseInt(qty_value8.value);
if(qty8>=1){
qty8++;
qty_value8.value = qty8;
}
});
/**********************************************Pomegranate******************************************************/
/**********************************************Leeks******************************************************/
//card 9
let containers_mega9 = document.querySelector('.containers-mega9');
document.querySelector('#buy9').onclick = ()=>{
mega.style.display = 'flex';
containers_mega9.classList.add('actived9');
}
document.querySelector('#close9').onclick = ()=>{
mega.style.display = 'none';
containers_mega9.classList.remove('actived9');
};
const immgs9 = document.querySelectorAll('.container9 .imgs a');
let imgId9 = 1;
immgs9.forEach((img9)=>{
img9.addEventListener('click',(e)=>{
e.preventDefault();
imgId9 = img9.dataset.id9;
moveImage9();
});
})
function moveImage9()
{
const imgwidth9 = document.querySelector('.main-image9 img:first-child').clientWidth;
let width9 = (imgId9-1)*imgwidth9;
document.querySelector('.main-image9').style.transform = `translateX(${-width9}px)`;
}
let minus_qty9 = document.querySelector('.qty_minus9');
let plus_qty9 = document.querySelector('.qty_plus9');
let qty_value9 = document.querySelector('.qty_value9');
minus_qty9.addEventListener('click',function(){
let qty9= parseInt(qty_value9.value);
if(qty9>1)
{
qty9--;
qty_value9.value=qty9;
}
});
plus_qty9.addEventListener('click',function(){
let qty9 = parseInt(qty_value9.value);
if(qty9>=1){
qty9++;
qty_value9.value = qty9;
}
});
/**********************************************Leeks******************************************************/
/**********************************************Radish******************************************************/
//card 10
let containers_mega10 = document.querySelector('.containers-mega10');
document.querySelector('#buy10').onclick = ()=>{
mega.style.display = 'flex';
containers_mega10.classList.add('actived10');
}
document.querySelector('#close10').onclick = ()=>{
mega.style.display = 'none';
containers_mega10.classList.remove('actived10');
};
const immgs10 = document.querySelectorAll('.container10 .imgs a');
let imgId10 = 1;
immgs10.forEach((img10)=>{
img10.addEventListener('click',(e)=>{
e.preventDefault();
imgId10 = img10.dataset.id10;
moveImage10();
});
})
function moveImage10()
{
const imgwidth10 = document.querySelector('.main-image10 img:first-child').clientWidth;
let width10 = (imgId10-1)*imgwidth10;
document.querySelector('.main-image10').style.transform = `translateX(${-width10}px)`;
}
let minus_qty10 = document.querySelector('.qty_minus10');
let plus_qty10 = document.querySelector('.qty_plus10');
let qty_value10 = document.querySelector('.qty_value10');
minus_qty10.addEventListener('click',function(){
let qty10= parseInt(qty_value10.value);
if(qty10>1)
{
qty10--;
qty_value10.value=qty10;
}
});
plus_qty10.addEventListener('click',function(){
let qty10 = parseInt(qty_value10.value);
if(qty10>=1){
qty10++;
qty_value10.value = qty10;
}
});
/**********************************************Radish******************************************************/
/**********************************************Cauliflower******************************************************/
//card 11
let containers_mega11 = document.querySelector('.containers-mega11');
document.querySelector('#buy11').onclick = ()=>{
mega.style.display = 'flex';
containers_mega11.classList.add('actived11');
}
document.querySelector('#close11').onclick = ()=>{
mega.style.display = 'none';
containers_mega11.classList.remove('actived11');
};
const immgs11 = document.querySelectorAll('.container11 .imgs a');
let imgId11 = 1;
immgs11.forEach((img11)=>{
img11.addEventListener('click',(e)=>{
e.preventDefault();
imgId11 = img11.dataset.id11;
moveImage11();
});
})
function moveImage11()
{
const imgwidth11 = document.querySelector('.main-image11 img:first-child').clientWidth;
let width11 = (imgId11-1)*imgwidth11;
document.querySelector('.main-image11').style.transform = `translateX(${-width11}px)`;
}
let minus_qty11 = document.querySelector('.qty_minus11');
let plus_qty11 = document.querySelector('.qty_plus11');
let qty_value11 = document.querySelector('.qty_value11');
minus_qty11.addEventListener('click',function(){
let qty11= parseInt(qty_value11.value);
if(qty11>1)
{
qty11--;
qty_value11.value=qty11;
}
});
plus_qty11.addEventListener('click',function(){
let qty11 = parseInt(qty_value11.value);
if(qty11>=1){
qty11++;
qty_value11.value = qty11;
}
});
/**********************************************Cauliflower******************************************************/
/**********************************************Soya Beans******************************************************/
//card 12
let containers_mega12 = document.querySelector('.containers-mega12');
document.querySelector('#buy12').onclick = ()=>{
mega.style.display = 'flex';
containers_mega12.classList.add('actived12');
}
document.querySelector('#close12').onclick = ()=>{
mega.style.display = 'none';
containers_mega12.classList.remove('actived12');
};
const immgs12 = document.querySelectorAll('.container12 .imgs a');
let imgId12 = 1;
immgs12.forEach((img12)=>{
img12.addEventListener('click',(e)=>{
e.preventDefault();
imgId12 = img12.dataset.id12;
moveImage12();
});
})
function moveImage12()
{
const imgwidth12 = document.querySelector('.main-image12 img:first-child').clientWidth;
let width12 = (imgId12-1)*imgwidth12;
document.querySelector('.main-image12').style.transform = `translateX(${-width12}px)`;
}
let minus_qty12 = document.querySelector('.qty_minus12');
let plus_qty12 = document.querySelector('.qty_plus12');
let qty_value12 = document.querySelector('.qty_value12');
minus_qty12.addEventListener('click',function(){
let qty12= parseInt(qty_value12.value);
if(qty12>1)
{
qty12--;
qty_value12.value=qty12;
}
});
plus_qty12.addEventListener('click',function(){
let qty12 = parseInt(qty_value12.value);
if(qty12>=1){
qty12++;
qty_value12.value = qty12;
}
});
/**********************************************Soya Beans******************************************************/
let sell_mega = document.querySelector('.sell-mega');
let sell_click1 = document.querySelector('.sell-click1');
let sell_close1 = document.querySelector('#sell-close1');
document.querySelector('#sell1').onclick = function(){
sell_mega.style.display = 'flex';
sell_click1.style.display = 'block';
}
sell_close1.addEventListener('click',function(){
sell_mega.style.display = 'none';
sell_click1.style.display = 'none';
});
let sell_minus_qty_btn1 = document.querySelector('.sell1-minus');
let sell_plus_qty_btn1 = document.querySelector('.sell1-plus');
let sell_qty_value1 = document.querySelector('#sell1_value');
sell_minus_qty_btn1.addEventListener('click',function(){
let qty1 = parseInt(sell_qty_value1.value);
if(qty1>1)
{
qty1--;
sell_qty_value1.value=qty1;
}
});
sell_plus_qty_btn1.addEventListener('click',function(){
let qty1 = parseInt(sell_qty_value1.value);