Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
New version #4 #18
Browse files Browse the repository at this point in the history
  • Loading branch information
aravindvnair99 committed Oct 30, 2018
1 parent 4e5d322 commit ab0afd8
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 100 deletions.
2 changes: 1 addition & 1 deletion functions/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aarohan2018",
"version": "2.0.0",
"version": "3.0.0",
"description": "Code for Aarohan 2018 (10th edition of Aarohan)",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 0 additions & 4 deletions functions/views/circuitrix.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@
<i class="material-icons right">send</i>
</button>
</div>
<div class="input-field">
<input value=count id="t1" name="schoolId" type="hidden" class="validate" required>
<label class="active" for="t1"></label>
</div>
</div>
</form>
</div>
Expand Down
5 changes: 0 additions & 5 deletions functions/views/codeBound.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@
<i class="material-icons right">send</i>
</button>
</div>

<div class="input-field">
<input .value=count id="t1" name="schoolId" type="hidden" class="validate" required>
<label class="active" for="t1"></label>
</div>
</div>
</form>
</div>
Expand Down
26 changes: 19 additions & 7 deletions functions/views/kerbalSpaceProgram.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
});
</script>

<head>
<title>Event Registration Form</title>

</head>

<div class="container">
<div class="row"></div>
<div class="row">
Expand All @@ -31,7 +26,6 @@
</div>
<% include Student1.ejs %>
<% include Student2.ejs %>
<!-- <a id="filldetails" onclick="addFields()">Fill Details</a> -->
<div class="card-action">
<button class="btn waves-effect waves-light" type="submit" name="action" onclick="Materialize.toast('Registered', 400)">Submit
<i class="material-icons right">send</i>
Expand All @@ -42,7 +36,7 @@
<input .value=count id="t1" name="schoolId" type="hidden" class="validate" required>
<label class="active" for="t1"></label>
</div>
<div id="container" />
</div>
</form>
</div>
</div>
Expand All @@ -63,6 +57,15 @@
}).catch((err) => {
console.log(err);
});
db.collection("Students").doc("ARHN" + student1).get().then((doc) => {
if (doc.exists) {
document.getElementById("lb1").innerText = doc.data().studentName;
}
else
document.getElementById("lb1").innerText = 'Student not registered. Contact Aravind or Abhishek.';
}).catch((err) => {
console.log(err);
});
db.collection("events").doc(eventName).collection("Students").doc(student2).get().then((doc) => {
if (doc.exists) {
Materialize.toast("Student already exists", 1500);
Expand All @@ -71,5 +74,14 @@
}).catch((err) => {
console.log(err);
});
db.collection("Students").doc("ARHN" + student2).get().then((doc) => {
if (doc.exists) {
document.getElementById("lb2").innerText = doc.data().studentName;
}
else
document.getElementById("lb2").innerText = 'Student not registered. Contact Aravind or Abhishek.';
}).catch((err) => {
console.log(err);
});
}
</script>
71 changes: 60 additions & 11 deletions functions/views/projectExhibition.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,33 @@
</div>
<div class="input-field">
<input id="Student1" onchange="check()" name="Student1" type="text" maxlength="4" minlength="4" class="validate">
<label for="Student1">Student 1</label>
<label id="lb1" for="Student1">Student 1</label>
</div>
<div class="input-field">
<input id="Student2" onchange="check()" name="Student2" type="text" maxlength="4" minlength="4" class="validate">
<label for="Student2">Student 2</label>
<label id="lb2" for="Student2">Student 2</label>
</div>
<div class="input-field">
<input id="Student3" onchange="check()" name="Student3" type="text" maxlength="4" minlength="4" class="validate">
<label for="Student3">Student 3</label>
<label id="lb3" for="Student3">Student 3</label>
</div>
<div class="input-field">
<input id="Student4" onchange="check()" name="Student4" type="text" maxlength="4" minlength="4" class="validate">
<label for="Student4">Student 4</label>
<label id="lb4" for="Student4">Student 4</label>
</div>
<div class="input-field">
<input id="Student5" onchange="check()" name="Student5" type="text" maxlength="4" minlength="4" class="validate">
<label for="Student5">Student 5</label>
<label id="lb5" for="Student5">Student 5</label>
</div>
<div class="input-field">
<input id="Student6" onchange="check()" name="Student6" type="text" maxlength="4" minlength="4" class="validate">
<label for="Student6">Student 6</label>
<label id="lb6" for="Student6">Student 6</label>
</div>
<!-- <a id="filldetails" onclick="addFields()">Fill Details</a> -->
<div class="card-action">
<button class="btn waves-effect waves-light" type="submit" name="action" onclick="Materialize.toast('Registered', 400)">Submit
<i class="material-icons right">send</i>
</button>
</div>
<div class="input-field">
<input .value=count id="t1" name="schoolId" type="hidden" class="validate" required>
<label class="active" for="t1"></label>
</div>
</form>
</div>
</div>
Expand All @@ -81,6 +76,15 @@
}).catch((err) => {
console.log(err);
});
db.collection("Students").doc("ARHN" + student1).get().then((doc) => {
if (doc.exists) {
document.getElementById("lb1").innerText = doc.data().studentName;
}
else
document.getElementById("lb1").innerText = 'Student not registered. Contact Aravind or Abhishek.';
}).catch((err) => {
console.log(err);
});
db.collection("events").doc(eventName).collection("Students").doc(student2).get().then((doc) => {
if (doc.exists) {
Materialize.toast("Student already exists", 1500);
Expand All @@ -89,6 +93,15 @@
}).catch((err) => {
console.log(err);
});
db.collection("Students").doc("ARHN" + student2).get().then((doc) => {
if (doc.exists) {
document.getElementById("lb2").innerText = doc.data().studentName;
}
else
document.getElementById("lb2").innerText = 'Student not registered. Contact Aravind or Abhishek.';
}).catch((err) => {
console.log(err);
});
db.collection("events").doc(eventName).collection("Students").doc(student3).get().then((doc) => {
if (doc.exists) {
Materialize.toast("Student already exists", 1500);
Expand All @@ -97,6 +110,15 @@
}).catch((err) => {
console.log(err);
});
db.collection("Students").doc("ARHN" + student3).get().then((doc) => {
if (doc.exists) {
document.getElementById("lb3").innerText = doc.data().studentName;
}
else
document.getElementById("lb3").innerText = 'Student not registered. Contact Aravind or Abhishek.';
}).catch((err) => {
console.log(err);
});
db.collection("events").doc(eventName).collection("Students").doc(student4).get().then((doc) => {
if (doc.exists) {
Materialize.toast("Student already exists", 1500);
Expand All @@ -105,6 +127,15 @@
}).catch((err) => {
console.log(err);
});
db.collection("Students").doc("ARHN" + student4).get().then((doc) => {
if (doc.exists) {
document.getElementById("lb4").innerText = doc.data().studentName;
}
else
document.getElementById("lb4").innerText = 'Student not registered. Contact Aravind or Abhishek.';
}).catch((err) => {
console.log(err);
});
db.collection("events").doc(eventName).collection("Students").doc(student5).get().then((doc) => {
if (doc.exists) {
Materialize.toast("Student already exists", 1500);
Expand All @@ -113,6 +144,15 @@
}).catch((err) => {
console.log(err);
});
db.collection("Students").doc("ARHN" + student5).get().then((doc) => {
if (doc.exists) {
document.getElementById("lb5").innerText = doc.data().studentName;
}
else
document.getElementById("lb5").innerText = 'Student not registered. Contact Aravind or Abhishek.';
}).catch((err) => {
console.log(err);
});
db.collection("events").doc(eventName).collection("Students").doc(student6).get().then((doc) => {
if (doc.exists) {
Materialize.toast("Student already exists", 1500);
Expand All @@ -121,5 +161,14 @@
}).catch((err) => {
console.log(err);
});
db.collection("Students").doc("ARHN" + student6).get().then((doc) => {
if (doc.exists) {
document.getElementById("lb6").innerText = doc.data().studentName;
}
else
document.getElementById("lb6").innerText = 'Student not registered. Contact Aravind or Abhishek.';
}).catch((err) => {
console.log(err);
});
}
</script>
97 changes: 25 additions & 72 deletions functions/views/raceForGlory.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -31,83 +31,17 @@
</div>
<% include Student1.ejs %>
<% include Student2.ejs %>
<!-- <a id="filldetails" onclick="addFields()">Fill Details</a> -->
<div class="card-action">
<button class="btn waves-effect waves-light" type="submit" name="action" onclick="Materialize.toast('Registered', 400)">Submit
<i class="material-icons right">send</i>
</button>
</div>
<div class="input-field">
<input .value=count id="t1" name="schoolId" type="hidden" class="validate" required>
<label class="active" for="t1"></label>
<div class="card-action">
<button class="btn waves-effect waves-light" type="submit" name="action" onclick="Materialize.toast('Registered', 400)">Submit
<i class="material-icons right">send</i>
</button>
</div>
</div>
<div id="container" />
</form>
</div>
</div>
</div>
</div>
<script defer src="/__/firebase/5.5.5/firebase-app.js"></script>
<script defer src="/__/firebase/5.5.5/firebase-firestore.js"></script>
<script defer src="/__/firebase/init.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
/*function addFields() {
var e = document.getElementById('nameEvent');
var eventName = e.options[e.selectedIndex].value;
console.log(eventName);
console.log("CHecking");
firebase.firestore().collection("events").doc(eventName).get().then((doc) => {
if (doc.exists) {
max = doc.data().Max;
min = doc.data().Min;
count = doc.data().count;
console.log(max);
if (max == min) {
while (container.hasChildNodes()) {
container.removeChild(container.lastChild);
}
for (i = 1; i <= max; i++) {
container.appendChild(document.createTextNode("Student " + (i) + " "));
var input = document.createElement("input");
input.type = "text";
input.name = "Student" + i;
container.appendChild(input);
container.appendChild(document.createElement("br"));
}
}
else {
while (container.hasChildNodes()) {
container.removeChild(container.lastChild);
}
number = max;
for (i = 1; i <= max; i++) {
container.appendChild(document.createTextNode("Student " + (i) + " "));
var input = document.createElement("input");
input.type = "text";
input.name = "Student" + i;
container.appendChild(input);
container.appendChild(document.createElement("br"));
}
}
return (doc.data());
} else {
throw new Error("Event does not exist");
}
}).catch((err) => {
console.log(err);
});
} */
$('#form').on('keyup keypress', function (e) {
var keyCode = e.keyCode || e.which;
if (keyCode === 13) {
e.preventDefault();
return false;
}
});
</script>

<%include foot.ejs %>
<script>
var db = firebase.firestore();
function check() {
Expand All @@ -122,6 +56,15 @@
}).catch((err) => {
console.log(err);
});
db.collection("Students").doc("ARHN" + student1).get().then((doc) => {
if (doc.exists) {
document.getElementById("lb1").innerText = doc.data().studentName;
}
else
document.getElementById("lb1").innerText = 'Student not registered. Contact Aravind or Abhishek.';
}).catch((err) => {
console.log(err);
});
db.collection("events").doc(eventName).collection("Students").doc(student2).get().then((doc) => {
if (doc.exists) {
Materialize.toast("Student already exists", 1500);
Expand All @@ -130,5 +73,15 @@
}).catch((err) => {
console.log(err);
});
db.collection("Students").doc("ARHN" + student2).get().then((doc) => {
if (doc.exists) {
document.getElementById("lb2").innerText = doc.data().studentName;
}
else
document.getElementById("lb2").innerText = 'Student not registered. Contact Aravind or Abhishek.';
}).catch((err) => {
console.log(err);
});
}
</script>
</script>
<%include foot.ejs %>

0 comments on commit ab0afd8

Please sign in to comment.