-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
1305 lines (968 loc) · 37.6 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
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
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0">
<title>SwampHacks Dashboard</title>
<meta name="description" content="
SwampHacks is a 36 hour open coding event where students become creators.
In the time allotted, students from around the country come together at the
University of Florida to collaborate on projects, mingle in activities, and
network with sponsors for a fully immersive experience.
"/>
<!-- Stylesheets
================================================== -->
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link href="https://fortawesome.github.io/Font-Awesome/assets/font-awesome/css/font-awesome.css" rel="stylesheet">
<!-- Favicon
================================================== -->
<link rel="icon" type="image/png" href="favicon.png" />
<!-- Icons & Fonts
================================================== -->
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- MLH Badge
================================================== -->
<!-- <a id="mlh-trust-badge" style="display:block;max-width:100px;min-width:60px;position:absolute;right:50px;top:0;width:10%;z-index:0" href="https://mlh.io/seasons/na-2018/events?utm_source=na-2018&utm_medium=TrustBadge&utm_campaign=na-2018&utm_content=white" target="_blank"><img src="https://s3.amazonaws.com/logged-assets/trust-badge/2018/white.svg" alt="Major League Hacking 2017 Hackathon Season" style="width:100%"></a> -->
</head>
<body id="mainBody">
<!-- Begin Status Popups -->
<div id="confirmedPopup" class="hide">
<div class="pair">
<svg id="successAnimation" class="animated" xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 70 70">
<path id="successAnimationResult" fill="white" d="M35,60 C21.1928813,60 10,48.8071187 10,35 C10,21.1928813 21.1928813,10 35,10 C48.8071187,10 60,21.1928813 60,35 C60,48.8071187 48.8071187,60 35,60 Z M23.6332378,33.2260427 L22.3667622,34.7739573 L34.1433655,44.40936 L47.776114,27.6305926 L46.223886,26.3694074 L33.8566345,41.59064 L23.6332378,33.2260427 Z"/>
<circle id="successAnimationCircle" cx="35" cy="35" r="24" stroke="white" stroke-width="2" stroke-linecap="round" fill="transparent"/>
<polyline id="successAnimationCheck" stroke="white" stroke-width="2" points="23 34 34 43 47 27" fill="transparent"/>
</svg>
<span class="popuptxt">Confirmed!</span>
</div>
</div>
<div id="confirmLogoutPopup" class="hide">
<div class="centerConfirm">
<div class="row">
<div class="col-md-12">
<div class="popuptxt centertxt">Logout?</div>
</div>
</div>
<div class="row btn-row">
<div class="col-xs-6">
<button class="button green" id="confirmLogout" onclick="confirmLogoutClicked()">
<p>Yep</p>
</button>
</div>
<div class="col-xs-6">
<button class="button green" id="denyLogout" onclick="denyLogoutClicked()">
<p>Go Back</p>
</button>
</div>
</div>
</div>
</div>
<!-- End Status Popups -->
<div id="layout" class="">
<!-- Menu toggle -->
<a href="#menu" id="menuLink" class="menu-link">
<!-- Icon -->
<!-- <span><img id="logosmall" class="" src="img/logoblue.svg"></img></span> -->
<span>SH</span>
</a>
<div class="stickyheader">
<span id="headertxt">Profile</span>
</div>
<div id="menu" class="">
<div class="pure-menu">
<a class="pure-menu-heading" href="#">
<img id="logo" class="" src="img/logoblue.svg"></img>
</a>
<div class="menu-items-con">
<ul class="pure-menu-list">
<li id="op1" class="pure-menu-item top-ln pure-menu-selected">
<a href="#" class="pure-menu-link" onclick="menuClick(1)">Dashboard</a>
</li>
<li id="op5" class="pure-menu-item top-ln hide">
<a href="#" class="pure-menu-link" onclick="menuClick(5)">SH Stats</a>
</li>
<li id="op6" class="pure-menu-item top-ln hide">
<a href="#" class="pure-menu-link" onclick="menuClick(6)">Send iOS Notif</a>
</li>
<li id="op2" class="pure-menu-item top-ln">
<a href="#" class="pure-menu-link" onclick="menuClick(2)">Profile <i class="fa fa-exclamation-triangle" aria-hidden="true"></i></a>
</li>
<li id="op3" class="pure-menu-item top-ln">
<a href="#" class="pure-menu-link" onclick="menuClick(3)">Logout</a>
</li>
<li id="op4" class="pure-menu-item bottom-ln">
<a href="http://live.swamphacks.com" target="_blank" class="pure-menu-link" onclick="menuClick(4)">Live!</a>
</li>
</ul>
</div>
<div id="sign-in-link" class="hide">
<!-- <i class="fa fa-pencil" aria-hidden="true"></i> -->
<a href="checkin.html" target="_blank">Event Sign In</a>
</div>
</div>
</div>
<div id="dashboard" class="show">
<h1 class="header-main-type">Dashboard</h1>
<div class="container-fluid notif-con">
<div class="row">
<div class="col-md-12">
<h3 class="header-sub-type" id="welcomeMessage">Welcome, Albert!</h3>
<p class="descrip-txt"><br><b>Congratulations</b>, you're going to SwampHacks! <br><br>When you get the chance, <b>be sure to confirm your spot and fill out the necessary information in the profile tab on the left</b>. For any questions or concerns, feel free to email us at [email protected].
As the event draws nearer, we'll be sending more emails to keep you in the loop about SwampHacks!
<br><br>Deadline to accept your spot:<b> January 12th, 2017</b>
</p>
</div>
<div class="col-md-12 notif top-margin">
<p class="notif-txt">Your Status: <span class="status green" id="dashStatus">ACCEPTED</span></p>
</div>
<div class="col-md-12 top-margin descrip-txt">
Let us know if you're coming by confirming your spot! Please remember to update
your status if you decide you cannot attend.
</div>
<div class="row">
<div class="col-md-12 top-margin" id="confirmCon">
<button id="confirmBtn" class="button green" onclick="confirmSpotBtnClicked()">
<p id="confirmSpot">Confirm my spot!</p>
</button>
</div>
<div class="col-md-12 top-margin" id="rejectCon">
<button class="button dark" id="rejectSpot" onclick="rejectSpotBtnClicked()">
<p>I can't go <i class="fa fa-frown-o" aria-hidden="true"></i></p>
</button>
</div>
</div>
</div>
</div>
</div>
<div id="info" class="hide">
<h1 class="header-main-type">Profile</h1>
<div class="container-fluid notif-con">
<div class="row">
<div class="col-md-12">
<!-- <h3 class="header-sub-type">Welcome, Albert!</h3> -->
<p class="descrip-txt">
Please fill out the apropriate fields.
</p>
</div>
<div class="row">
<form id="profileForm" class="" autocomplete="off">
<div id="shirtCol" class="col-md-6 top-margin">
<label class="form-lbl" for="q1" name="">T-Shirt Size *</label>
<!-- <input class="form-field" id="shirtSize" name="q1" type="text" placeholder="Medium" required/> -->
<select class="form-field" id="shirtSize" required>
<option value="small">Small</option>
<option value="medium">Medium</option>
<option value="large">Large</option>
<option value="extra-large">Extra Large</option>
</select>
</div>
<div id="dietCol" class="col-md-6 top-margin">
<label class="form-lbl" for="q1" name="">Dietary Restrictions *</label>
<!-- <input class="form-field" id="diet" name="q1" type="text" placeholder="Halal" required/> -->
<select class="form-field" id="diet" required>
<option value="none">None</option>
<option value="vegetarian">Vegetarian</option>
<option value="vegan">Vegan</option>
<option value="halal">Halal</option>
</select>
</div>
<div id="extraInfoCol" class="col-md-12 top-margin">
<label class="form-lbl" for="q1" name="">Anything else we should know?</label>
<input class="form-field" id="extraInfo" name="q1" type="text" placeholder=""/>
</div>
<div class="col-md-12 top-margin">
<label class="form-lbl" for="q1" name="">Email</label>
<input class="form-field" id="userEmail" name="q1" type="text" placeholder="" disabled/>
</div>
<div class="col-md-12 top-margin" id="teamCol">
<label class="form-lbl" for="q1" name="">Your Team</label>
<input class="form-field" id="userTeam" name="q1" type="text" placeholder="" disabled/>
</div>
</form>
</div>
<div class="col-md-12 top-margin descrip-txt">
If you'd like to change anything later on, feel free to come back here and update your information!
</div>
<div class="col-md-12 top-margin descrip-txt hide" id="profileStatusTxt">
Please fill in all fields!
</div>
<div class="row">
<div class="col-md-12 top-margin">
<button id="updateBtn" class="button green" onclick="updateInfoBtnClicked()">
<p>Update Info</p>
</button>
</div>
</div>
</div>
</div>
</div>
<div id="notif" class="hide">
<h1 class="header-main-type">Send iOS Notif</h1>
<div class="container-fluid notif-con">
<div class="row">
<div class="row">
<form id="notifForm" class="" autocomplete="off">
<div class="col-md-12 top-margin">
<label class="form-lbl" for="q1" name="">Title</label>
<input class="form-field" id="notifTitle" name="q1" type="text" placeholder=""/>
</div>
<div class="col-md-12 top-margin">
<label class="form-lbl" for="q1" name="">Description</label>
<input class="form-field" id="notifDescription" name="q1" type="text" placeholder=""/>
</div>
<div class="col-md-12 top-margin">
<label class="form-lbl" for="q1" name="">Type</label>
<select class="form-field" id="notifType" required>
<option value="food">Food</option>
<option value="techtalk">Techtalk</option>
<option value="social">Social</option>
<option value="logistics">Logistics</option>
</select>
</div>
</form>
</div>
<div class="row">
<div class="col-md-12 top-margin">
<button class="button green" onclick="sendNotifClicked()">
<p>Send</p>
</button>
</div>
</div>
</div>
</div>
</div>
<div id="login" class="hide">
<h1 class="header-main-type">Stats</h1>
<div class="container-fluid notif-con">
<div class="row">
<div class="col-md-12">
<h3 class="header-sub-type">Overall Stats<span class="circle-ticker"></span><span class="live-ticker">LIVE</span></h3>
</div>
<div class="col-md-3 top-margin">
<div class="padder">
<div class="notifnew">
<p class="notif-txt stat-txt">Check Ins <span class="statusnew green" id="checkIns">--</span></p>
</div>
</div>
</div>
<div class="col-md-12 top-margin">
<h3 class="header-sub-type">Events Stats<span class="circle-ticker"></span><span class="live-ticker">LIVE</span></h3>
<p class="descrip-txt"><br>
Amount of people in each team.
</p>
</div>
<div class="col-md-3 top-margin">
<div class="padder">
<div class="notifnew">
<p class="notif-txt stat-txt">Dragonflies <span class="statusnew green" id="teamOneSize">--</span></p>
</div>
</div>
</div>
<div class="col-md-3 top-margin">
<div class="padder">
<div class="notifnew">
<p class="notif-txt stat-txt">Turtles <span class="statusnew green" id="teamTwoSize">--</span></p>
</div>
</div>
</div>
<div class="col-md-3 top-margin">
<div class="padder">
<div class="notifnew">
<p class="notif-txt stat-txt">Herons <span class="statusnew green" id="teamThreeSize">--</span></p>
</div>
</div>
</div>
<div class="col-md-3 top-margin">
<div class="padder">
<div class="notifnew">
<p class="notif-txt stat-txt">Gators <span class="statusnew green" id="teamFourSize">--</span></p>
</div>
</div>
</div>
<div class="col-md-12 top-margin">
<p class="descrip-txt"><br>
Amount of points each team currently has.
</p>
</div>
<div class="col-md-3 top-margin">
<div class="padder">
<div class="notifnew">
<p class="notif-txt stat-txt">Dragonflies <span class="statusnew green" id="teamOnePoints">--</span></p>
</div>
</div>
</div>
<div class="col-md-3 top-margin">
<div class="padder">
<div class="notifnew">
<p class="notif-txt stat-txt">Turtles <span class="statusnew green" id="teamTwoPoints">--</span></p>
</div>
</div>
</div>
<div class="col-md-3 top-margin">
<div class="padder">
<div class="notifnew">
<p class="notif-txt stat-txt">Herons <span class="statusnew green" id="teamThreePoints">--</span></p>
</div>
</div>
</div>
<div class="col-md-3 top-margin">
<div class="padder">
<div class="notifnew">
<p class="notif-txt stat-txt">Gators <span class="statusnew green" id="teamFourPoints">--</span></p>
</div>
</div>
</div>
<div class="col-md-12 top-margin">
<h3 class="header-sub-type">T-Shirts</h3>
<p class="descrip-txt"><br>
The amount of accepted applicants who selected each size.
</p>
</div>
<div class="col-md-3 top-margin">
<div class="padder">
<div class="notifnew">
<p class="notif-txt stat-txt">Small <span class="statusnew green" id="smallShirts">--</span></p>
</div>
</div>
</div>
<div class="col-md-3 top-margin">
<div class="padder">
<div class="notifnew">
<p class="notif-txt stat-txt">Medium <span class="statusnew green" id="mediumShirts">--</span></p>
</div>
</div>
</div>
<div class="col-md-3 top-margin">
<div class="padder">
<div class="notifnew">
<p class="notif-txt stat-txt">Large <span class="statusnew green" id="largeShirts">--</span></p>
</div>
</div>
</div>
<div class="col-md-3 top-margin">
<div class="padder">
<div class="notifnew">
<p class="notif-txt stat-txt">Extra Large <span class="statusnew green" id="exlargeShirts">--</span></p>
</div>
</div>
</div>
<div class="col-md-12 top-margin">
<h3 class="header-sub-type">Dietary Restrictions</h3>
<p class="descrip-txt"><br>
The amount of accepted applicants who selected each diet.
</p>
</div>
<div class="col-md-3 top-margin">
<div class="padder">
<div class="notifnew">
<p class="notif-txt stat-txt">Vegetarian <span class="statusnew green" id="veges">--</span></p>
</div>
</div>
</div>
<div class="col-md-3 top-margin">
<div class="padder">
<div class="notifnew">
<p class="notif-txt stat-txt">Vegan <span class="statusnew green" id="vegs">--</span></p>
</div>
</div>
</div>
<div class="col-md-3 top-margin">
<div class="padder">
<div class="notifnew">
<p class="notif-txt stat-txt">Halal <span class="statusnew green" id="hals">--</span></p>
</div>
</div>
</div>
<div class="col-md-3 top-margin">
<div class="padder">
<div class="notifnew">
<p class="notif-txt stat-txt">None <span class="statusnew green" id="nones">--</span></p>
</div>
</div>
</div>
<div class="col-md-12 top-margin">
<h3 class="header-sub-type">Top Schools</h3>
<p class="descrip-txt"><br>
The top ten schools by number of applicants.
</p>
</div>
<div class="col-md-12 top-margin">
<table class="table">
<thead>
<tr>
<th scope="col" class="greenTxt descrip-txt">School</th>
<th scope="col" class="righttab greenTxt descrip-txt">Applicants</th>
</tr>
</thead>
<tbody>
<tr>
<td class="descrip-txt school-tab" id="school1">The University of Florida</td>
<td class="descrip-txt righttab"><b id="schoolNum1">34</b></td>
</tr>
<tr>
<td class="descrip-txt school-tab" id="school2">The University of Florida</td>
<td class="descrip-txt righttab"><b id="schoolNum2">234</b></td>
</tr>
<tr>
<td class="descrip-txt school-tab" id="school3">The University of Florida</td>
<td class="descrip-txt righttab"><b id="schoolNum3">234</b></td>
</tr>
<tr>
<td class="descrip-txt school-tab" id="school4">The University of Florida</td>
<td class="descrip-txt righttab"><b id="schoolNum4">234</b></td>
</tr>
<tr>
<td class="descrip-txt school-tab" id="school5">The University of Florida</td>
<td class="descrip-txt righttab"><b id="schoolNum5">234</b></td>
</tr>
<tr>
<td class="descrip-txt school-tab" id="school6">The University of Florida</td>
<td class="descrip-txt righttab"><b id="schoolNum6">234</b></td>
</tr>
<tr>
<td class="descrip-txt school-tab" id="school7">The University of Florida</td>
<td class="descrip-txt righttab"><b id="schoolNum7">234</b></td>
</tr>
<tr>
<td class="descrip-txt school-tab" id="school8">The University of Florida</td>
<td class="descrip-txt righttab"><b id="schoolNum8">234</b></td>
</tr>
<tr>
<td class="descrip-txt school-tab" id="school9">The University of Florida</td>
<td class="descrip-txt righttab"><b id="schoolNum9">234</b></td>
</tr>
<tr>
<td class="descrip-txt school-tab" id="school10">The University of Florida</td>
<td class="descrip-txt righttab"><b id="schoolNum10">234</b></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<script src="js/menu.js"></script>
<script src="js/jquery.js"></script>
<script src="js/classie.js"></script>
<script src="js/jquerycsv.js"></script>
</body>
<script src="https://www.gstatic.com/firebasejs/3.7.6/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/3.7.6/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/3.7.6/firebase-database.js"></script>
<script src="https://www.gstatic.com/firebasejs/3.7.6/firebase.js"></script>
<script src="https://cdn.firebase.com/js/client/2.3.1/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "AIzaSyCkPM5Ta8WgzxpOP6O9WuLWD6Irkd6GAPc",
authDomain: "swamphacks-applicants.firebaseapp.com",
databaseURL: "https://swamphacks-applicants.firebaseio.com",
projectId: "swamphacks-applicants",
storageBucket: "swamphacks-applicants.appspot.com",
messagingSenderId: "622854578748"
};
firebase.initializeApp(config);
</script>
<script>
var ref = firebase.database().ref();
var usersRef = ref.child("applicants");
var acceptedRef = ref.child("accepted");
var checkedInRef = ref.child("confirmed");
var eventsDataRef = ref.child("eventsData");
var notifRef = ref.child("announcements");
var userObj = JSON.parse(localStorage.getItem('loggedInUser'));
var loggedInUserKey = localStorage.getItem('loggedInUserKey');
var selected = 1;
var schools = [];
var appliedSchools = [];
var schoolsAndCount = {};
var topTenSchools = {};
// Stats
var numSmalls = 0;
var numMeds = 0;
var numLarges = 0;
var numExLarges = 0;
var numVege = 0;
var numVegan = 0;
var numHalal = 0;
var numNone = 0;
if (userObj === null) {
window.location.href = "makeaccount.html";
} else {
$("#mainBody").css("visibility", "visible");
if (userObj.email === "[email protected]" || userObj.email === "[email protected]" || userObj.email === "[email protected]") {
$("#op5").removeClass("hide");
$("#op5").addClass("show");
$("#op6").removeClass("hide");
$("#op6").addClass("show");
getStats();
reloadStats();
}
if (userObj.isVolunteer !== undefined && userObj.isVolunteer === true) {
// Show link to event check in page
$("#sign-in-link").removeClass("hide");
$("#sign-in-link").addClass("show");
}
}
checkedInRef.on('value', function(snapshot) {
$("#checkIns").text(snapshot.numChildren());
});
eventsDataRef.on('value', function(snapshot) {
var info = snapshot.val();
// Sizes
$("#teamOneSize").text(info.people.dragonflies);
$("#teamTwoSize").text(info.people.turtles);
$("#teamThreeSize").text(info.people.herons);
$("#teamFourSize").text(info.people.gators);
// Points
$("#teamOnePoints").text(info.points.dragonflies);
$("#teamTwoPoints").text(info.points.turtles);
$("#teamThreePoints").text(info.points.herons);
$("#teamFourPoints").text(info.points.gators);
});
$("#welcomeMessage").text("Welcome, " + userObj.fname + "!");
$("#userEmail").val(userObj.email);
if (userObj.team !== null || userObj.team !== undefined) {
$("#userTeam").val(userObj.team);
} else {
$("#teamCol").addClass("hide");
}
document.getElementById("userEmail").disabled = true;
document.getElementById("userTeam").disabled = true;
$(".fa-exclamation-triangle").addClass("hide");
$(".fa-exclamation-triangle").removeClass("showIn");
if (userObj.dietaryRestriction === undefined && userObj.tshirtSize === undefined && userObj.extraInfo === undefined) {
$("#profileStatusTxt").addClass("hide");
$("#updateBtn").addClass("disabled");
$("#confirmBtn").addClass("disabled");
$("#rejectSpot").addClass("disabled");
}
if (userObj.dietaryRestriction !== undefined) {
$("#diet").val(userObj.dietaryRestriction);
} else {
$("#dietCol").addClass("hide");
}
if (userObj.tshirtSize !== undefined) {
$("#shirtSize").val(userObj.tshirtSize);
} else {
$("#shirtCol").addClass("hide");
}
if (userObj.extraInfo !== undefined) {
$("#extraInfo").val(userObj.extraInfo);
} else {
$("#extraInfoCol").addClass("hide");
}
if (userObj.status !== undefined) {
$("#dashStatus").text(userObj.status);
if (userObj.status === "CONFIRMED") {
$("#dashStatus").addClass("green");
$("#dashStatus").removeClass("dark");
$("#confirmCon").addClass("hide");
$("#confirmCon").removeClass("show");
$("#rejectCon").addClass("show");
$("#rejectCon").removeClass("hide");
} else if (userObj.status === "NOT ATTENDING") {
$("#dashStatus").removeClass("green");
$("#dashStatus").addClass("dark");
$("#confirmCon").addClass("show");
$("#confirmCon").removeClass("hide");
$("#rejectCon").addClass("hide");
$("#rejectCon").removeClass("show");
}
}
function rejectSpotBtnClicked() {
if (userObj.dietaryRestriction === undefined && userObj.tshirtSize === undefined && userObj.extraInfo === undefined) {
} else {
$("#dashStatus").text("NOT ATTENDING");
$("#dashStatus").addClass("dark");
$("#dashStatus").removeClass("green");
$("#confirmCon").addClass("show");
$("#confirmCon").removeClass("hide");
$("#rejectCon").addClass("hide");
$("#rejectCon").removeClass("show");
var loggedInUserRef = acceptedRef.child(loggedInUserKey);
loggedInUserRef.update({
status: "NOT ATTENDING"
});
acceptedRef.orderByChild("email").equalTo(userObj.email).on("value", function(snapshot) {
// Getting the info of the found user and storing it in local storage
snapshot.forEach(function(childSnapshot) {
var key = childSnapshot.key;
var childData = childSnapshot.val();
localStorage.setItem('loggedInUser', JSON.stringify(childData));
localStorage.setItem('loggedInUserKey', key);
userObj = JSON.parse(localStorage.getItem('loggedInUser'));
loggedInUserKey = localStorage.getItem('loggedInUserKey');
});
});
}
}
function confirmSpotBtnClicked() {
if (userObj.dietaryRestriction === undefined && userObj.tshirtSize === undefined && userObj.extraInfo === undefined) {
} else {
var delay = 3000;
if (userObj.status !== "CONFIRMED") {
// Show the popup
$("#confirmedPopup").removeClass("hide");
$("#confirmedPopup").addClass("showflex");
setTimeout(function() {
$("#confirmedPopup").removeClass("showflex");
$("#confirmedPopup").addClass("hide");
}, delay);
}
$("#dashStatus").text("CONFIRMED");
$("#dashStatus").addClass("green");
$("#dashStatus").removeClass("dark");
$("#confirmCon").addClass("hide");
$("#confirmCon").removeClass("show");
$("#rejectCon").addClass("show");
$("#rejectCon").removeClass("hide");
var loggedInUserRef = acceptedRef.child(loggedInUserKey);
loggedInUserRef.update({
status: "CONFIRMED"
});
acceptedRef.orderByChild("email").equalTo(userObj.email).on("value", function(snapshot) {
// Getting the info of the found user and storing it in local storage
snapshot.forEach(function(childSnapshot) {
var key = childSnapshot.key;
var childData = childSnapshot.val();
localStorage.setItem('loggedInUser', JSON.stringify(childData));
localStorage.setItem('loggedInUserKey', key);
userObj = JSON.parse(localStorage.getItem('loggedInUser'));
loggedInUserKey = localStorage.getItem('loggedInUserKey');
});
});
}
}
function updateInfoBtnClicked() {
if (userObj.dietaryRestriction === undefined && userObj.tshirtSize === undefined && userObj.extraInfo === undefined) {
} else {
var dietaryRestriction = $("#diet").val();
var tshirtSize = $("#shirtSize").val();
var extraInfo = $("#extraInfo").val();
if (dietaryRestriction !== "" && tshirtSize !== "") {
var loggedInUserRef = acceptedRef.child(loggedInUserKey);
if (extraInfo !== "") {
loggedInUserRef.update({
dietaryRestriction: dietaryRestriction,
tshirtSize: tshirtSize,
extraInfo: extraInfo
});
} else {
loggedInUserRef.update({
dietaryRestriction: dietaryRestriction,
tshirtSize: tshirtSize
});
}
acceptedRef.orderByChild("email").equalTo(userObj.email).on("value", function(snapshot) {
// Getting the info of the found user and storing it in local storage
snapshot.forEach(function(childSnapshot) {
var key = childSnapshot.key;
var childData = childSnapshot.val();
localStorage.setItem('loggedInUser', JSON.stringify(childData));
localStorage.setItem('loggedInUserKey', key);
userObj = JSON.parse(localStorage.getItem('loggedInUser'));
loggedInUserKey = localStorage.getItem('loggedInUserKey');
});
});
// SUCCESS
$("#profileStatusTxt").text("Info Updated!");
$("#profileStatusTxt").addClass("show");
$("#profileStatusTxt").addClass("greenTxt");
$("#profileStatusTxt").removeClass("redTxt");
$(".fa-exclamation-triangle").addClass("hide");
} else {
// ERROR
$("#profileStatusTxt").text("Please fill in your t-shirt size and dietary restriction!");
$("#profileStatusTxt").addClass("show");
$("#profileStatusTxt").addClass("redTxt");
$("#profileStatusTxt").removeClass("greenTxt");
}
}
}
function menuClick(item) {
selected = item;
$("#layout").removeClass("active");
$("#menu").removeClass("active");
$("#menuLink").removeClass("active");
// Hiding and showing the appropriate info
if (item === 1) {
$("#op1").addClass("pure-menu-selected");
$("#op2").removeClass("pure-menu-selected");
$("#op3").removeClass("pure-menu-selected");
$("#op5").removeClass("pure-menu-selected");
$("#op6").removeClass("pure-menu-selected");
$("#dashboard").addClass("show");
$("#dashboard").removeClass("hide");
$("#info").addClass("hide");
$("#info").removeClass("show");
$("#login").addClass("hide");
$("#login").removeClass("show");
$("#notif").addClass("hide");
$("#notif").removeClass("show");
if (userObj.status !== undefined) {
$("#dashStatus").text(userObj.status);
if (userObj.status === "CONFIRMED") {
$("#dashStatus").addClass("green");
$("#dashStatus").removeClass("dark");
$("#confirmCon").addClass("hide");
$("#confirmCon").removeClass("show");
$("#rejectCon").addClass("show");
$("#rejectCon").removeClass("hide");
} else if (userObj.status === "NOT ATTENDING") {
$("#dashStatus").removeClass("green");
$("#dashStatus").addClass("dark");
$("#confirmCon").addClass("show");
$("#confirmCon").removeClass("hide");
$("#rejectCon").addClass("hide");
$("#rejectCon").removeClass("show");
}
}
} else if (item === 2) {
$("#op2").addClass("pure-menu-selected");
$("#op3").removeClass("pure-menu-selected");
$("#op1").removeClass("pure-menu-selected");
$("#op5").removeClass("pure-menu-selected");
$("#op6").removeClass("pure-menu-selected");
$("#dashboard").addClass("hide");
$("#dashboard").removeClass("show");
$("#info").addClass("show");
$("#info").removeClass("hide");
$("#login").addClass("hide");
$("#login").removeClass("show");
$("#notif").addClass("hide");
$("#notif").removeClass("show");
$("#userEmail").val(userObj.email);
if (userObj.dietaryRestriction !== undefined) {
$("#diet").val(userObj.dietaryRestriction);
}
if (userObj.tshirtSize !== undefined) {
$("#shirtSize").val(userObj.tshirtSize);
}
if (userObj.extraInfo !== undefined) {
$("#extraInfo").val(userObj.extraInfo);
}
$("#profileStatusTxt").addClass("hide");
$("#profileStatusTxt").removeClass("show");
} else if (item === 3) {
// Show the confirm logout popup
$("#confirmLogoutPopup").removeClass("hide");
$("#confirmLogoutPopup").addClass("showflex");
} else if (item === 5) {
$("#op5").addClass("pure-menu-selected");
$("#op2").removeClass("pure-menu-selected");
$("#op1").removeClass("pure-menu-selected");
$("#op6").removeClass("pure-menu-selected");
$("#dashboard").addClass("hide");
$("#dashboard").removeClass("show");
$("#info").addClass("hide");
$("#info").removeClass("show");
$("#login").addClass("show");
$("#login").removeClass("hide");
$("#notif").addClass("hide");
$("#notif").removeClass("show");
appliedSchools = [];