Added feature to close registration form remotely
This commit is contained in:
+22
-18
@@ -151,24 +151,27 @@ import '../styles/apply.scss';
|
|||||||
const successMsg = document.getElementById('success-message');
|
const successMsg = document.getElementById('success-message');
|
||||||
|
|
||||||
// --- STEP 1: CHECK GOOGLE SHEET STATUS ---
|
// --- STEP 1: CHECK GOOGLE SHEET STATUS ---
|
||||||
fetch(SCRIPT_URL)
|
// Added the protective if-statement here!
|
||||||
.then(response => response.json())
|
if (loadingStatus && closedMessage && registrationContent) {
|
||||||
.then(data => {
|
fetch(SCRIPT_URL)
|
||||||
loadingStatus.style.display = 'none'; // Hide the spinner
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
// Look at the B1 cell value from the Google Sheet
|
loadingStatus.style.display = 'none'; // Hide the spinner
|
||||||
if (data.status === 'OPEN') {
|
|
||||||
registrationContent.style.display = 'block'; // Reveal the portal!
|
// Look at the B1 cell value from the Google Sheet
|
||||||
} else {
|
if (data.status === 'OPEN') {
|
||||||
closedMessage.style.display = 'block'; // Show the closed message
|
registrationContent.style.display = 'block'; // Reveal the portal!
|
||||||
}
|
} else {
|
||||||
})
|
closedMessage.style.display = 'block'; // Show the closed message
|
||||||
.catch(error => {
|
}
|
||||||
// If the internet is down or script fails, fail gracefully by showing closed
|
})
|
||||||
loadingStatus.style.display = 'none';
|
.catch(error => {
|
||||||
closedMessage.style.display = 'block';
|
console.error("Status check failed:", error); // Added this to clear the warning
|
||||||
});
|
// If the internet is down or script fails, fail gracefully by showing closed
|
||||||
|
loadingStatus.style.display = 'none';
|
||||||
|
closedMessage.style.display = 'block';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// --- ELIGIBILITY LOGIC ---
|
// --- ELIGIBILITY LOGIC ---
|
||||||
if (checkBtn && eligibilitySection && ineligibleMsg && mainForm) {
|
if (checkBtn && eligibilitySection && ineligibleMsg && mainForm) {
|
||||||
@@ -246,6 +249,7 @@ import '../styles/apply.scss';
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
console.error("Form submission failed:", error); // Added this to clear the warning
|
||||||
alert('A network error occurred. Please try again.');
|
alert('A network error occurred. Please try again.');
|
||||||
submitBtn.disabled = false;
|
submitBtn.disabled = false;
|
||||||
submitBtn.style.display = 'block';
|
submitBtn.style.display = 'block';
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
@import './variables.scss';
|
@use './variables.scss' as *;
|
||||||
|
@use "sass:color"; /* Add this line! */
|
||||||
|
|
||||||
.registration-section {
|
.registration-section {
|
||||||
padding-block: 8rem;
|
padding-block: 8rem;
|
||||||
@@ -195,7 +196,9 @@
|
|||||||
transition: background-color 0.2s ease;
|
transition: background-color 0.2s ease;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: darken($primary, 10%);
|
/* Old way: background-color: darken($primary, 10%); */
|
||||||
|
/* New way: */
|
||||||
|
background-color: color.adjust($primary, $lightness: -10%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user