Added feature to close registration form remotely

This commit is contained in:
Kent Joseph T. Palima
2026-04-30 16:04:25 +08:00
parent 76cdeeded0
commit 1d7e0df6cd
2 changed files with 27 additions and 20 deletions
+22 -18
View File
@@ -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';
+5 -2
View File
@@ -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%);
} }
} }
} }