Spaces:
Running
Running
add in the attendance form a a yes or no option for people who want to eat and those who dont
Browse files- attendance.html +35 -12
attendance.html
CHANGED
|
@@ -100,11 +100,24 @@
|
|
| 100 |
<p>Next meal: <span id="next-meal-time" class="font-medium"></span></p>
|
| 101 |
</div>
|
| 102 |
</div>
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
<div id="eating-details" class="space-y-4">
|
| 109 |
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 110 |
<div>
|
|
@@ -136,13 +149,12 @@
|
|
| 136 |
</select>
|
| 137 |
</div>
|
| 138 |
</div>
|
| 139 |
-
|
| 140 |
<div class="mt-6">
|
| 141 |
<button id="submit-btn" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-4 rounded-lg transition duration-200">
|
| 142 |
<i class="fas fa-paper-plane mr-2"></i> Submit Attendance
|
| 143 |
</button>
|
| 144 |
</div>
|
| 145 |
-
|
| 146 |
|
| 147 |
<!-- Success Message -->
|
| 148 |
<div id="success-message" class="hidden fade-in bg-green-50 border border-green-200 text-green-700 p-4 rounded-lg mb-8">
|
|
@@ -251,9 +263,9 @@ function updateDateTime() {
|
|
| 251 |
const studentClass = document.getElementById('class').value;
|
| 252 |
const form = document.getElementById('form').value;
|
| 253 |
const student = document.getElementById('student').value;
|
| 254 |
-
const attendance = '
|
| 255 |
|
| 256 |
-
if (!student) {
|
| 257 |
alert('Please select a student name');
|
| 258 |
return;
|
| 259 |
}
|
|
@@ -269,10 +281,9 @@ function updateDateTime() {
|
|
| 269 |
attendance: attendance,
|
| 270 |
class: studentClass,
|
| 271 |
form: form,
|
| 272 |
-
studentName: student
|
| 273 |
};
|
| 274 |
-
|
| 275 |
-
// Send data to GitHub
|
| 276 |
sendDataToGitHub(data);
|
| 277 |
|
| 278 |
// Show success message
|
|
@@ -654,6 +665,18 @@ function updateDateTime() {
|
|
| 654 |
studentSelect.disabled = true;
|
| 655 |
}
|
| 656 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 657 |
// Function to reset the form
|
| 658 |
function resetForm() {
|
| 659 |
// Clear form fields
|
|
|
|
| 100 |
<p>Next meal: <span id="next-meal-time" class="font-medium"></span></p>
|
| 101 |
</div>
|
| 102 |
</div>
|
| 103 |
+
<!-- Attendance Form -->
|
| 104 |
+
<div id="attendance-form" class="bg-white rounded-lg shadow-md p-6 mb-8">
|
| 105 |
+
<h2 class="text-xl font-semibold mb-4 text-gray-800">Attendance Form</h2>
|
| 106 |
+
<h3 class="text-lg font-medium mb-4 text-center text-blue-600">Record Student Meal Attendance</h3>
|
| 107 |
+
|
| 108 |
+
<div class="mb-6">
|
| 109 |
+
<label class="block text-gray-700 font-medium mb-2">Will the student be eating?</label>
|
| 110 |
+
<div class="flex gap-4">
|
| 111 |
+
<label class="flex items-center">
|
| 112 |
+
<input type="radio" name="eating" value="yes" checked class="mr-2" id="eating-yes">
|
| 113 |
+
<span>Yes</span>
|
| 114 |
+
</label>
|
| 115 |
+
<label class="flex items-center">
|
| 116 |
+
<input type="radio" name="eating" value="no" class="mr-2" id="eating-no">
|
| 117 |
+
<span>No</span>
|
| 118 |
+
</label>
|
| 119 |
+
</div>
|
| 120 |
+
</div>
|
| 121 |
<div id="eating-details" class="space-y-4">
|
| 122 |
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 123 |
<div>
|
|
|
|
| 149 |
</select>
|
| 150 |
</div>
|
| 151 |
</div>
|
|
|
|
| 152 |
<div class="mt-6">
|
| 153 |
<button id="submit-btn" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-4 rounded-lg transition duration-200">
|
| 154 |
<i class="fas fa-paper-plane mr-2"></i> Submit Attendance
|
| 155 |
</button>
|
| 156 |
</div>
|
| 157 |
+
</div>
|
| 158 |
|
| 159 |
<!-- Success Message -->
|
| 160 |
<div id="success-message" class="hidden fade-in bg-green-50 border border-green-200 text-green-700 p-4 rounded-lg mb-8">
|
|
|
|
| 263 |
const studentClass = document.getElementById('class').value;
|
| 264 |
const form = document.getElementById('form').value;
|
| 265 |
const student = document.getElementById('student').value;
|
| 266 |
+
const attendance = document.querySelector('input[name="eating"]:checked').value;
|
| 267 |
|
| 268 |
+
if (attendance === 'yes' && !student) {
|
| 269 |
alert('Please select a student name');
|
| 270 |
return;
|
| 271 |
}
|
|
|
|
| 281 |
attendance: attendance,
|
| 282 |
class: studentClass,
|
| 283 |
form: form,
|
| 284 |
+
studentName: attendance === 'yes' ? student : 'N/A'
|
| 285 |
};
|
| 286 |
+
// Send data to GitHub
|
|
|
|
| 287 |
sendDataToGitHub(data);
|
| 288 |
|
| 289 |
// Show success message
|
|
|
|
| 665 |
studentSelect.disabled = true;
|
| 666 |
}
|
| 667 |
}
|
| 668 |
+
|
| 669 |
+
// Show/hide student dropdown based on attendance choice
|
| 670 |
+
document.querySelectorAll('input[name="eating"]').forEach(radio => {
|
| 671 |
+
radio.addEventListener('change', function() {
|
| 672 |
+
const studentContainer = document.getElementById('student-container');
|
| 673 |
+
if (this.value === 'yes') {
|
| 674 |
+
studentContainer.classList.remove('hidden');
|
| 675 |
+
} else {
|
| 676 |
+
studentContainer.classList.add('hidden');
|
| 677 |
+
}
|
| 678 |
+
});
|
| 679 |
+
});
|
| 680 |
// Function to reset the form
|
| 681 |
function resetForm() {
|
| 682 |
// Clear form fields
|