Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Login Functionality for Batch 2022 #214

Open
wants to merge 1 commit into
base: update
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 38 additions & 23 deletions src/pages/login/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ const branch = document.querySelector("#branch");
const batch = document.querySelector("#batch");
const password = document.querySelector("#password");
const btn = document.getElementById("mb");
let pattern = /20(19BCS((000[1-9])|(00[1-9][0-9])|(01[01][0-9])|(012[0-2]))|(20BCS)((000[1-9])|(00[1-9][0-9])|(01[0-8][0-9])|(0190))|(21BCS)((000[1-9])|(00[1-9][0-9])|(01[0-9][0-9]))|(21BCY)((000[1-9])|(00[1-3][0-9])|(004[0-6]))|(20BEC)((000[1-9])|(00[1-3][0-9]))|(21BEC)((000[1-9])|(00[1-3][0-9])|(004[0-4])))/gim;
let pattern = /(20(19BCS((000[1-9])|(00[1-9][0-9])|(01[01][0-9])|(012[0-2]))|(20BCS)((000[1-9])|(00[1-9][0-9])|(01[0-8][0-9])|(0190))|(21BCS)((000[1-9])|(00[1-9][0-9])|(01[0-9][0-9]))|(21BCY)((000[1-9])|(00[1-3][0-9])|(004[0-6]))|(20BEC)((000[1-9])|(00[1-3][0-9]))|(21BEC)((000[1-9])|(00[1-3][0-9])|(004[0-4]))|((22BCY|22BDC)(000[1-9]|00[1-5][0-9]|006[0-4]))|((22BEC)(000[1-9]|00[1-4][0-9]|005[0-7]))|((22BCS)(000[1-9]|00\d{2}|01\d{2}|02[0-2][0-6]))))/gim;
const elements = document.getElementsByTagName('input');
let firstChange = 0;

//disabling them
year.disabled = true;
branch.disabled = true;
batch.disabled = true;
let logo = document.getElementById("nav_logo");
// let logo = document.getElementById("nav_logo");

logo.addEventListener("click", open_autojoomer);
// logo.addEventListener("click", open_autojoomer);

function open_autojoomer() {
window.open("https://www.autojoomer.co/", (target = "_blank"));
}
// function open_autojoomer() {
// window.open("https://www.autojoomer.co/", (target = "_blank"));
// }

for(let i = 0; i < elements.length; i++) {
elements[i].addEventListener("keyup", () => {
Expand Down Expand Up @@ -49,6 +49,9 @@ roll.addEventListener("keyup", () => {
else if (yearValue == 2021) {
year.value = "2021";
}
else if (yearValue == 2022){
year.value = "2022"
}
});

// branch
Expand All @@ -69,6 +72,11 @@ roll.addEventListener("keyup", () => {
branch.value = "CSY";
}
}
else if (branchValue == "BDC") {
if( Number(year.value) >= 2022) {
branch.value = "AI/DS"
}
}
});

//batch
Expand All @@ -78,6 +86,7 @@ roll.addEventListener("keyup", () => {
let inputValue = roll.value.toUpperCase();
if (inputValue.length > 10) {
batchValue = inputValue[10];

if (year.value != "2019") {
if (batchValue % 2 == 0) {
batch.value = "2";
Expand All @@ -87,6 +96,15 @@ roll.addEventListener("keyup", () => {
}
}
else batch.value = "";

if (year.value == "2022") {
batchValue = inputValue.slice(-3) % 3
if(batchValue == 0) {
batchValue = "3"

}
batch.value = batchValue
}
}
});

Expand Down Expand Up @@ -114,24 +132,21 @@ btn.addEventListener("click", () => {
);
btn.disabled = true;
btn.innerText = "Saved";
<<<<<<< HEAD
=======

//Create button to go back
const div = document.getElementsByClassName("form-container")[0];
const back_button = document.createElement('BUTTON');
back_button.className = "submit-btn";
back_button.id = "back";
const text = document.createTextNode("Home");
back_button.onclick = function() { //Redirect to popup
window.open("/src/js/popup.html", "_self");
}
back_button.appendChild(text);
//append line break
div.appendChild(document.createElement("br"));
div.appendChild(back_button);

>>>>>>> 850dcf9c53653dec8319828d176dd47911d81d87

//Create button to go back
const div = document.getElementsByClassName("form-container")[0];
const back_button = document.createElement('BUTTON');
back_button.className = "submit-btn";
back_button.id = "back";
const text = document.createTextNode("Home");
back_button.onclick = function() { //Redirect to popup
window.open("/src/js/popup.html", "_self");
}
back_button.appendChild(text);
//append line break
div.appendChild(document.createElement("br"));
div.appendChild(back_button);
} else {
alert("The Roll number does not exist");
return;
Expand Down
5 changes: 4 additions & 1 deletion src/pages/login/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<div class="form-container">
<h1>Login</h1>
<form name="login_form" method="post">

<div class="form-group">
<label for="roll">LMS Roll No.</label>
<input type="text" class="form-input" name="roll" id="roll" maxlength="11"
Expand All @@ -33,6 +33,7 @@ <h1>Login</h1>
<option value="2019">2019</option>
<option value="2020">2020</option>
<option value="2021">2021</option>
<option value="2022">2022</option>
</select>
</div>

Expand All @@ -43,6 +44,7 @@ <h1>Login</h1>
<option value="CSE">CSE</option>
<option value="ECE">ECE</option>
<option value="CSY">CSY</option>
<option value="AI/DS">AI/DS</option>
</select>

</div>
Expand All @@ -52,6 +54,7 @@ <h1>Login</h1>
<option value="">Select batch</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</div>
</div>
Expand Down