-
Notifications
You must be signed in to change notification settings - Fork 0
/
application.html
379 lines (344 loc) · 21.5 KB
/
application.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
<!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 Application</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.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>
<div class="container-fluid notif-con">
<div class="row">
<!-- <div class="col-md-3">
<button class="button green" onclick="toDashboard()">Return to Dashboard</button>
</div> -->
<div class="col-md-12">
<button class="button green" onclick="toDashboard()" style="width:20%; float: right"><p>Return to Dashboard</p></button>
<!-- <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 class="col-md-6 top-margin">
<label class="form-lbl" for="q1" name="">First name</label> <span class="required redTxt">* Required</span>
<input class="form-field" id="firstName" name="q1" type="text" placeholder="" required/>
</div>
<div class="col-md-6 top-margin">
<label class="form-lbl" for="q1" name="">Last name</label> <span class="required redTxt">* Required</span>
<input class="form-field" id="lastName" name="q1" type="text" placeholder="" required/>
</div>
<div class="col-md-12 top-margin">
<label class="form-lbl" for="q1" name="">Gender</label> <span class="required redTxt">* Required</span><br>
<!-- TODO: make select for this -->
<input id="gender" name="gender" type="radio" value="Male" required/> Male <br>
<input id="gender" name="gender" type="radio" value="Female" required/> Female <br>
<input id="gender" name="gender" type="radio" value="None-binary/third gender" required/> None-binary/third gender <br>
<input id="gender" name="gender" type="radio" value="Other" required/> Other <br>
</div>
<div class="col-md-12 top-margin">
<label class="form-lbl" for="q1" name="">Race/Ethnicity</label> <span class="required redTxt">* Required</span><br>
<input id="race" name="race" type="checkbox" value="Non-Hispanic White" required/> Non-Hispanic White <br>
<input id="race" name="race" type="checkbox" value="Black or African American" required/> Black or African American <br>
<input id="race" name="race" type="checkbox" value="Latinx or Hispanic American" required/> Latinx or Hispanic American <br>
<input id="race" name="race" type="checkbox" value="South Asian or Indian American" required/> South Asian or Indian American <br>
<input id="race" name="race" type="checkbox" value="East Asian or Asian American" required/> East Asian or Asian American <br>
<input id="race" name="race" type="checkbox" value="Middle Eastern or Arab American" required/> Middle Eastern or Arab American <br>
<input id="race" name="race" type="checkbox" value="Native American or Alaskan Native" required/> Native American or Alaskan Native <br>
<input id="race" name="race" type="checkbox" value="Hawaiian or Pacific Islander" required/> Hawaiian or Pacific Islander <br>
<input id="race" name="race" type="checkbox" value="Other" required/> Other <br>
</div>
<div class="col-md-12 top-margin">
<label class="form-lbl" for="q1" name="">Your School</label> <span class="required redTxt">* Required</span><br>
<select name="schools" required>
<option value="University of Florida">University of Florida</option>
<option value="University of South Florida">University of South Florida</option>
<option value="University of Central Florida">University of Central Florida</option>
<option value="MIT">MIT</option>
</select> <br>
<!-- TODO: make select for this, get school list -->
<label class="form-lbl" for="q1" name="">What year are you?</label> <br>
<select name="schoolYear" required>
<option value="Freshman">Freshman</option>
<option value="Sophmore">Sophmore</option>
<option value="Junior">Junior</option>
<option value="Senior">Senior</option>
<option value="PHD/Master">PHD/Master</option>
</select> <br>
</div>
<div class="col-md-12 top-margin">
<label class="form-lbl" for="q1" name="">Is this your first time hacking?</label> <span class="required redTxt">* Required</span><br>
<!-- TODO: make select for this -->
<input id="firstTimeHacker" name="firstTimeHacker" type="radio" value="yes" required/> Yes
<input id="firstTimeHacker" name="firstTimeHacker" type="radio" value="no" required/> No <br>
</div>
<div class="col-md-12 top-margin">
<label class="form-lbl" for="q1" name="">Resume</label> <span class="required redTxt">* Required</span>
<!-- TODO: make file explorer for this -->
<input id="resume" name="q1" type="file" placeholder="Choose File" required/>
</div>
<div class="col-md-12 top-margin">
<label class="form-lbl" for="q1" name="">Github Profile</label>
<!-- TODO: make select for this -->
<input class="form-field" id="github" name="github" type="text" placeholder=""/>
</div>
<div class="col-md-12 top-margin">
<label class="form-lbl" for="q1" name="">LinkedIn Profile</label>
<!-- TODO: make select for this -->
<input class="form-field" id="linkedin" name="linkedin" type="text" placeholder=""/>
</div>
<div id="shirtCol" class="col-md-12 top-margin">
<label class="form-lbl" for="q1" name="">T-Shirt Size</label> <span class="required redTxt">* Required</span>
<!-- <input class="form-field" id="shirtSize" name="q1" type="text" placeholder="Medium" required/> -->
<select class="form-field" id="shirtSize" name="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-12 top-margin">
<label class="form-lbl" for="q1" name="">Dietary Restrictions</label> <span class="required redTxt">* Required</span>
<!-- <input class="form-field" id="diet" name="q1" type="text" placeholder="Halal" required/> -->
<select class="form-field" id="diet" name="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 class="col-md-12 top-margin">
<label class="form-lbl" for="q1" name="">Do you need transportation to SwampHacks?(FYI carpool and buses w/ 400 mile radius) - outside that we do a travel reimbursement</label>
<span class="required redTxt">* Required</span>
<!-- TODO: make select for this -->
<br>
<input id="transportation" name="transportation" type="radio" value="yes" required/> Yes
<input id="transportation" name="transportation" type="radio" value="no" required/> No <br>
</div>
<div class="col-md-12 top-margin">
<label class="form-lbl" for="q1" name="">Why would you like to participate in SwampHacks?</label>
<textarea class="form-field form-textbox" id="interest" name="interest" type="text" placeholder="" rows="5" cols="20"></textarea>
</div>
<div class="col-md-12 top-margin">
<label class="form-lbl" for="q1" name="">What’s an everyday problem that tech could solve?</label>
<textarea class="form-field form-textbox" id="everydayProblem" name="everydayProblem" type="text" placeholder="" rows="5" cols="20"></textarea>
</div>
<div class="col-md-12 top-margin">
<label class="form-lbl" for="q1" name="">What do you hope to gain out of SwampHacks?</label>
<textarea class="form-field form-textbox" id="hopes" name="hopes" type="text" placeholder="" rows="5" cols="20"></textarea>
</div>
<div class="col-md-12 top-margin">
<label class="form-lbl" for="q1" name="">Other comments? - what workshops, mentors, activities, etc. would you want to see?</label>
<textarea class="form-field form-textbox" id="comments" name="comments" type="text" placeholder="" rows="5" cols="20"></textarea>
</div>
<div class="col-md-12 top-margin">
<label class="form-lbl" for="q1" name="">How did you hear about SwampHacks? </label>
<textarea class="form-field form-textbox" id="news" name="news" type="text" placeholder="" rows="5" cols="20"></textarea>
</div>
<div class="col-md-12 top-margin">
<label class="form-lbl" for="q1" name="">Do you agree to the MLH Code of Conduct?</label> <span class="required redTxt">* Required</span>
<!-- TODO: add link to it and a checkbox maybe -->
<br> <input id="codeOfConduct" name="codeOfConduct" type="checkbox" value="true" required/> I agree <br>
</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 class="button green" onclick="submit()"><p class="makeactbtn">Submit</p></button>
</div>
</div>
</div>
</div>
<script src="js/jquery.js"></script>
<script src="js/classie.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 src="firebaseconfig.js"></script>
<script>
// add user information to database
var ref = firebase.database().ref();
const userId = localStorage.getItem('loggedInUserKey');
if (!userId) {
window.location.href = "makeaccount.html";
}
function storeResume(userId) {
const storageRef = firebase.storage().ref();
const resume = $('#resume').get(0).files[0];
if(!resume) {return;}
const metadata = {contentType: resume.type};
const task = storageRef.child("resumes/"+userId).put(resume, metadata);
task
// .then(snapshot => snapshot.ref.getDownloadURL())
// .then((url) => {
// resumeUrl = url;
// })
.catch((error) => {
// A full list of error codes is available at
// https://firebase.google.com/docs/storage/web/handle-errors
switch (error.code) {
case 'storage/unauthorized':
// User doesn't have permission to access the object
break;
case 'storage/canceled':
// User canceled the upload
break;
case 'storage/unknown':
// Unknown error occurred, inspect error.serverResponse
break;
}
});
}
function checkRequiredFields(fname, lname, gender, raceEthnicity, resume, firstTimeHacker, transportation, codeOfConduct) {
var canSubmit = true;
if (fname == "") {
canSubmit = false;
// mark as required
console.log('fname');
}
if (lname == "") {
canSubmit = false;
// mark as required
console.log('lname');
}
if (!gender) {
canSubmit = false;
// mark as required
console.log('gender');
}
if (!raceEthnicity) {
canSubmit = false;
// mark as required
console.log('raceEthnicity');
}
if (!resume) {
canSubmit = false;
// mark as required
console.log('resume');
}
if (!firstTimeHacker) {
canSubmit = false;
// mark as required
console.log('firstTimeHacker');
}
if (!transportation) {
canSubmit = false;
// mark as required
console.log('transportation');
}
if (!codeOfConduct) {
canSubmit = false;
// mark as required
console.log('codeOfConduct');
}
return canSubmit;
}
// TODO: Show user what fields they are missing and alerting user that their application was successful if it was
function submit() {
// Get form values
const fname = $("#firstName").val();
const lname = $("#lastName").val();
const gender = $('input[name="gender"]:checked').val(); //returns undefined if none clicked
// array of all race/ethnicities selected
const raceEthnicity = $('input[name="race"]:checked').map(function() {
return this.value;
}).get();
const school = $('select[name="schools"]').val();
const schoolYear = $('select[name="schoolYear"]').val();
const firstTimeHacker = $('input[name="firstTimeHacker"]:checked').val();
const githubProfile = $('input[name="github"]').val();
const linkedinProfile = $('input[name="linkedin"]').val();
const shirtSize = $('select[name="shirtSize"]').val();
const diet = $('select[name="diet"]').val();
const transportation = $('input[name="transportation"]:checked').val();
const interestReason = $('textarea[name="interest"]').val();
const everydayProblem = $('textarea[name="everydayProblem"]').val();
const hopeToGain = $('textarea[name="hopes"]').val();
const comments = $('textarea[name="comments"]').val();
const hearAbout = $('textarea[name="news"]').val();
const codeOfConduct = $('input[name="codeOfConduct"]:checked').val();
var canSubmit = checkRequiredFields(fname, lname, gender, raceEthnicity,
$('#resume').get(0).files[0], firstTimeHacker, transportation, codeOfConduct);
if (canSubmit) {
// store resume in database
storeResume(userId);
// get user email
ref.child("users/"+userId).once('value').then(function(snapshot){
const email = snapshot.val().email;
// create user obj
const user = {
email: email,
fname: fname,
lname: lname,
gender: gender,
raceEthnicity: raceEthnicity,
school: school,
schoolYear: schoolYear,
firstTimeHacker: firstTimeHacker,
githubProfile: githubProfile,
tshirtSize: shirtSize,
dietaryRestrictions: diet,
transportation: transportation,
interestReason: interestReason,
everydayProblem: everydayProblem,
hopeToGain: hopeToGain,
hearAbout: hearAbout,
extraInfo: comments,
isVolunteer: false,
status: "PENDING",
applied: true
};
// save user on database
var userRef = ref.child("users");
var updates = {};
updates[userId] = user;
// Show loading screen
userRef.update(updates).then(function() {
//notify user that the application was successful
});
// update user data on local
localStorage.setItem('loggedInUser', JSON.stringify(user));
localStorage.setItem('loggedInUserKey', userId);
// send to log in page
const delay = 2000;
setTimeout(function(){
window.location.href = "login.html";
}, delay);
});
}
}
function toDashboard() {
window.location.href = "index.html";
}
</script>
</html>