Spaces:
Running
Running
temove the filter in students-ate.html and attendence.html and add back the students name list popup
Browse files- attendance.html +45 -117
- students-ate.html +44 -116
attendance.html
CHANGED
|
@@ -158,56 +158,10 @@
|
|
| 158 |
</select>
|
| 159 |
</div>
|
| 160 |
</div>
|
| 161 |
-
<
|
| 162 |
-
|
| 163 |
-
<
|
| 164 |
-
<div class="
|
| 165 |
-
<button onclick="filterByClass('')" class="px-3 py-1 rounded-full bg-blue-100 text-blue-700 hover:bg-blue-200 transition">
|
| 166 |
-
All Classes
|
| 167 |
-
</button>
|
| 168 |
-
<button onclick="filterByClass('BUDI')" class="px-3 py-1 rounded-full bg-blue-100 text-blue-700 hover:bg-blue-200 transition">
|
| 169 |
-
BUDI
|
| 170 |
-
</button>
|
| 171 |
-
<button onclick="filterByClass('USAHA')" class="px-3 py-1 rounded-full bg-blue-100 text-blue-700 hover:bg-blue-200 transition">
|
| 172 |
-
USAHA
|
| 173 |
-
</button>
|
| 174 |
-
<button onclick="filterByClass('MAJU')" class="px-3 py-1 rounded-full bg-blue-100 text-blue-700 hover:bg-blue-200 transition">
|
| 175 |
-
MAJU
|
| 176 |
-
</button>
|
| 177 |
-
<button onclick="filterByClass('JAYA')" class="px-3 py-1 rounded-full bg-blue-100 text-blue-700 hover:bg-blue-200 transition">
|
| 178 |
-
JAYA
|
| 179 |
-
</button>
|
| 180 |
-
</div>
|
| 181 |
-
</div>
|
| 182 |
-
|
| 183 |
-
<div class="mb-4">
|
| 184 |
-
<h3 class="text-gray-700 font-medium mb-2">Filter by Form:</h3>
|
| 185 |
-
<div class="flex flex-wrap gap-2">
|
| 186 |
-
<button onclick="filterByForm('')" class="px-3 py-1 rounded-full bg-green-100 text-green-700 hover:bg-green-200 transition">
|
| 187 |
-
All Forms
|
| 188 |
-
</button>
|
| 189 |
-
<button onclick="filterByForm('1')" class="px-3 py-1 rounded-full bg-green-100 text-green-700 hover:bg-green-200 transition">
|
| 190 |
-
Form 1
|
| 191 |
-
</button>
|
| 192 |
-
<button onclick="filterByForm('2')" class="px-3 py-1 rounded-full bg-green-100 text-green-700 hover:bg-green-200 transition">
|
| 193 |
-
Form 2
|
| 194 |
-
</button>
|
| 195 |
-
<button onclick="filterByForm('3')" class="px-3 py-1 rounded-full bg-green-100 text-green-700 hover:bg-green-200 transition">
|
| 196 |
-
Form 3
|
| 197 |
-
</button>
|
| 198 |
-
<button onclick="filterByForm('4')" class="px-3 py-1 rounded-full bg-green-100 text-green-700 hover:bg-green-200 transition">
|
| 199 |
-
Form 4
|
| 200 |
-
</button>
|
| 201 |
-
<button onclick="filterByForm('5')" class="px-3 py-1 rounded-full bg-green-100 text-green-700 hover:bg-green-200 transition">
|
| 202 |
-
Form 5
|
| 203 |
-
</button>
|
| 204 |
-
</div>
|
| 205 |
-
</div>
|
| 206 |
-
<div id="student-container" class="hidden">
|
| 207 |
-
<label for="student" class="block text-gray-700 font-medium mb-2">Student Name</label>
|
| 208 |
-
<select id="student" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 209 |
-
<option value="">Select Student</option>
|
| 210 |
-
</select>
|
| 211 |
</div>
|
| 212 |
</div>
|
| 213 |
<!-- Attendance Choice -->
|
|
@@ -753,80 +707,54 @@ method: 'PUT',
|
|
| 753 |
studentContainer.classList.add('hidden');
|
| 754 |
}
|
| 755 |
}
|
| 756 |
-
//
|
| 757 |
-
|
| 758 |
-
|
| 759 |
-
|
| 760 |
-
|
| 761 |
-
|
| 762 |
-
|
| 763 |
-
|
| 764 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 765 |
|
| 766 |
-
|
| 767 |
-
|
| 768 |
-
|
| 769 |
-
|
| 770 |
-
}
|
| 771 |
|
| 772 |
-
|
| 773 |
-
|
| 774 |
-
|
| 775 |
-
const classValue = btn.getAttribute('onclick').match(/'([^']+)'/)[1];
|
| 776 |
-
if (classValue === currentClassFilter) {
|
| 777 |
-
btn.classList.remove('bg-blue-100', 'text-blue-700');
|
| 778 |
-
btn.classList.add('bg-blue-600', 'text-white');
|
| 779 |
-
} else {
|
| 780 |
-
btn.classList.remove('bg-blue-600', 'text-white');
|
| 781 |
-
btn.classList.add('bg-blue-100', 'text-blue-700');
|
| 782 |
-
}
|
| 783 |
-
});
|
| 784 |
-
}
|
| 785 |
|
| 786 |
-
|
| 787 |
-
|
| 788 |
-
|
| 789 |
-
|
| 790 |
-
|
| 791 |
-
|
| 792 |
-
|
| 793 |
-
|
| 794 |
-
|
| 795 |
-
|
| 796 |
-
|
| 797 |
-
|
| 798 |
-
}
|
| 799 |
-
function updateStudentList(filterClass = '', filterForm = '') {
|
| 800 |
-
const studentSelect = document.getElementById('student');
|
| 801 |
-
studentSelect.innerHTML = '<option value="">Select Student</option>';
|
| 802 |
-
|
| 803 |
-
if (allStudents.length === 0) return;
|
| 804 |
-
|
| 805 |
-
let filteredStudents = [...allStudents];
|
| 806 |
-
|
| 807 |
-
if (filterClass) {
|
| 808 |
-
filteredStudents = filteredStudents.filter(student => {
|
| 809 |
-
const classMatch = student.includes(` ${filterClass}`);
|
| 810 |
-
return classMatch;
|
| 811 |
});
|
| 812 |
}
|
| 813 |
|
| 814 |
-
|
| 815 |
-
|
| 816 |
-
|
| 817 |
-
|
| 818 |
-
|
| 819 |
-
|
|
|
|
| 820 |
}
|
| 821 |
-
|
| 822 |
-
|
| 823 |
-
const option = document.createElement('option');
|
| 824 |
-
option.value = student;
|
| 825 |
-
option.textContent = student;
|
| 826 |
-
studentSelect.appendChild(option);
|
| 827 |
-
});
|
| 828 |
-
}
|
| 829 |
-
// Function to reset the form
|
| 830 |
function resetForm() {
|
| 831 |
// Clear form fields
|
| 832 |
document.getElementById('class').value = '';
|
|
|
|
| 158 |
</select>
|
| 159 |
</div>
|
| 160 |
</div>
|
| 161 |
+
<div id="student-container" class="relative">
|
| 162 |
+
<label for="student-search" class="block text-gray-700 font-medium mb-2">Student Name</label>
|
| 163 |
+
<input type="text" id="student-search" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder="Search student name...">
|
| 164 |
+
<div id="student-results" class="absolute z-10 w-full mt-1 bg-white border border-gray-300 rounded-lg shadow-lg hidden max-h-60 overflow-y-auto"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
</div>
|
| 166 |
</div>
|
| 167 |
<!-- Attendance Choice -->
|
|
|
|
| 707 |
studentContainer.classList.add('hidden');
|
| 708 |
}
|
| 709 |
}
|
| 710 |
+
// Student search functionality
|
| 711 |
+
document.getElementById('student-search').addEventListener('input', function() {
|
| 712 |
+
const searchTerm = this.value.toLowerCase();
|
| 713 |
+
const resultsContainer = document.getElementById('student-results');
|
| 714 |
+
const classVal = document.getElementById('class').value;
|
| 715 |
+
const formVal = document.getElementById('form').value;
|
| 716 |
+
|
| 717 |
+
resultsContainer.innerHTML = '';
|
| 718 |
+
|
| 719 |
+
if (!classVal || !formVal) {
|
| 720 |
+
resultsContainer.classList.add('hidden');
|
| 721 |
+
return;
|
| 722 |
+
}
|
| 723 |
|
| 724 |
+
if (searchTerm.length < 2) {
|
| 725 |
+
resultsContainer.classList.add('hidden');
|
| 726 |
+
return;
|
| 727 |
+
}
|
|
|
|
| 728 |
|
| 729 |
+
const filteredStudents = studentsByForm[formVal][classVal].filter(student =>
|
| 730 |
+
student.toLowerCase().includes(searchTerm)
|
| 731 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 732 |
|
| 733 |
+
if (filteredStudents.length === 0) {
|
| 734 |
+
resultsContainer.innerHTML = '<div class="p-2 text-gray-500">No students found</div>';
|
| 735 |
+
} else {
|
| 736 |
+
filteredStudents.forEach(student => {
|
| 737 |
+
const div = document.createElement('div');
|
| 738 |
+
div.className = 'p-2 hover:bg-gray-100 cursor-pointer';
|
| 739 |
+
div.textContent = student;
|
| 740 |
+
div.onclick = () => {
|
| 741 |
+
document.getElementById('student-search').value = student;
|
| 742 |
+
resultsContainer.classList.add('hidden');
|
| 743 |
+
};
|
| 744 |
+
resultsContainer.appendChild(div);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 745 |
});
|
| 746 |
}
|
| 747 |
|
| 748 |
+
resultsContainer.classList.remove('hidden');
|
| 749 |
+
});
|
| 750 |
+
|
| 751 |
+
// Close dropdown when clicking outside
|
| 752 |
+
document.addEventListener('click', function(e) {
|
| 753 |
+
if (!e.target.closest('#student-container')) {
|
| 754 |
+
document.getElementById('student-results').classList.add('hidden');
|
| 755 |
}
|
| 756 |
+
});
|
| 757 |
+
// Function to reset the form
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 758 |
function resetForm() {
|
| 759 |
// Clear form fields
|
| 760 |
document.getElementById('class').value = '';
|
students-ate.html
CHANGED
|
@@ -127,56 +127,10 @@
|
|
| 127 |
</select>
|
| 128 |
</div>
|
| 129 |
</div>
|
| 130 |
-
<
|
| 131 |
-
|
| 132 |
-
<
|
| 133 |
-
<div class="
|
| 134 |
-
<button onclick="filterByClass('')" class="px-3 py-1 rounded-full bg-blue-100 text-blue-700 hover:bg-blue-200 transition">
|
| 135 |
-
All Classes
|
| 136 |
-
</button>
|
| 137 |
-
<button onclick="filterByClass('BUDI')" class="px-3 py-1 rounded-full bg-blue-100 text-blue-700 hover:bg-blue-200 transition">
|
| 138 |
-
BUDI
|
| 139 |
-
</button>
|
| 140 |
-
<button onclick="filterByClass('USAHA')" class="px-3 py-1 rounded-full bg-blue-100 text-blue-700 hover:bg-blue-200 transition">
|
| 141 |
-
USAHA
|
| 142 |
-
</button>
|
| 143 |
-
<button onclick="filterByClass('MAJU')" class="px-3 py-1 rounded-full bg-blue-100 text-blue-700 hover:bg-blue-200 transition">
|
| 144 |
-
MAJU
|
| 145 |
-
</button>
|
| 146 |
-
<button onclick="filterByClass('JAYA')" class="px-3 py-1 rounded-full bg-blue-100 text-blue-700 hover:bg-blue-200 transition">
|
| 147 |
-
JAYA
|
| 148 |
-
</button>
|
| 149 |
-
</div>
|
| 150 |
-
</div>
|
| 151 |
-
|
| 152 |
-
<div class="mb-4">
|
| 153 |
-
<h3 class="text-gray-700 font-medium mb-2">Filter by Form:</h3>
|
| 154 |
-
<div class="flex flex-wrap gap-2">
|
| 155 |
-
<button onclick="filterByForm('')" class="px-3 py-1 rounded-full bg-green-100 text-green-700 hover:bg-green-200 transition">
|
| 156 |
-
All Forms
|
| 157 |
-
</button>
|
| 158 |
-
<button onclick="filterByForm('1')" class="px-3 py-1 rounded-full bg-green-100 text-green-700 hover:bg-green-200 transition">
|
| 159 |
-
Form 1
|
| 160 |
-
</button>
|
| 161 |
-
<button onclick="filterByForm('2')" class="px-3 py-1 rounded-full bg-green-100 text-green-700 hover:bg-green-200 transition">
|
| 162 |
-
Form 2
|
| 163 |
-
</button>
|
| 164 |
-
<button onclick="filterByForm('3')" class="px-3 py-1 rounded-full bg-green-100 text-green-700 hover:bg-green-200 transition">
|
| 165 |
-
Form 3
|
| 166 |
-
</button>
|
| 167 |
-
<button onclick="filterByForm('4')" class="px-3 py-1 rounded-full bg-green-100 text-green-700 hover:bg-green-200 transition">
|
| 168 |
-
Form 4
|
| 169 |
-
</button>
|
| 170 |
-
<button onclick="filterByForm('5')" class="px-3 py-1 rounded-full bg-green-100 text-green-700 hover:bg-green-200 transition">
|
| 171 |
-
Form 5
|
| 172 |
-
</button>
|
| 173 |
-
</div>
|
| 174 |
-
</div>
|
| 175 |
-
<div id="student-container" class="hidden">
|
| 176 |
-
<label for="student" class="block text-gray-700 font-medium mb-2">Student Name</label>
|
| 177 |
-
<select id="student" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 178 |
-
<option value="">Select Student</option>
|
| 179 |
-
</select>
|
| 180 |
</div>
|
| 181 |
</div>
|
| 182 |
|
|
@@ -690,79 +644,53 @@ method: 'PUT',
|
|
| 690 |
studentContainer.classList.add('hidden');
|
| 691 |
}
|
| 692 |
}
|
| 693 |
-
//
|
| 694 |
-
|
| 695 |
-
|
| 696 |
-
|
| 697 |
-
|
| 698 |
-
|
| 699 |
-
|
| 700 |
-
|
| 701 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 702 |
|
| 703 |
-
|
| 704 |
-
|
| 705 |
-
|
| 706 |
-
|
| 707 |
-
}
|
| 708 |
|
| 709 |
-
|
| 710 |
-
|
| 711 |
-
|
| 712 |
-
const classValue = btn.getAttribute('onclick').match(/'([^']+)'/)[1];
|
| 713 |
-
if (classValue === currentClassFilter) {
|
| 714 |
-
btn.classList.remove('bg-blue-100', 'text-blue-700');
|
| 715 |
-
btn.classList.add('bg-blue-600', 'text-white');
|
| 716 |
-
} else {
|
| 717 |
-
btn.classList.remove('bg-blue-600', 'text-white');
|
| 718 |
-
btn.classList.add('bg-blue-100', 'text-blue-700');
|
| 719 |
-
}
|
| 720 |
-
});
|
| 721 |
-
}
|
| 722 |
|
| 723 |
-
|
| 724 |
-
|
| 725 |
-
|
| 726 |
-
|
| 727 |
-
|
| 728 |
-
|
| 729 |
-
|
| 730 |
-
|
| 731 |
-
|
| 732 |
-
|
| 733 |
-
|
| 734 |
-
|
| 735 |
-
}
|
| 736 |
-
function updateStudentList(filterClass = '', filterForm = '') {
|
| 737 |
-
const studentSelect = document.getElementById('student');
|
| 738 |
-
studentSelect.innerHTML = '<option value="">Select Student</option>';
|
| 739 |
-
|
| 740 |
-
if (allStudents.length === 0) return;
|
| 741 |
-
|
| 742 |
-
let filteredStudents = [...allStudents];
|
| 743 |
-
|
| 744 |
-
if (filterClass) {
|
| 745 |
-
filteredStudents = filteredStudents.filter(student => {
|
| 746 |
-
const classMatch = student.includes(` ${filterClass}`);
|
| 747 |
-
return classMatch;
|
| 748 |
});
|
| 749 |
}
|
| 750 |
|
| 751 |
-
|
| 752 |
-
|
| 753 |
-
|
| 754 |
-
|
| 755 |
-
|
| 756 |
-
|
|
|
|
| 757 |
}
|
| 758 |
-
|
| 759 |
-
filteredStudents.forEach(student => {
|
| 760 |
-
const option = document.createElement('option');
|
| 761 |
-
option.value = student;
|
| 762 |
-
option.textContent = student;
|
| 763 |
-
studentSelect.appendChild(option);
|
| 764 |
-
});
|
| 765 |
-
}
|
| 766 |
// Function to reset the form
|
| 767 |
function resetForm() {
|
| 768 |
// Clear form fields
|
|
|
|
| 127 |
</select>
|
| 128 |
</div>
|
| 129 |
</div>
|
| 130 |
+
<div id="student-container" class="relative">
|
| 131 |
+
<label for="student-search" class="block text-gray-700 font-medium mb-2">Student Name</label>
|
| 132 |
+
<input type="text" id="student-search" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder="Search student name...">
|
| 133 |
+
<div id="student-results" class="absolute z-10 w-full mt-1 bg-white border border-gray-300 rounded-lg shadow-lg hidden max-h-60 overflow-y-auto"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
</div>
|
| 135 |
</div>
|
| 136 |
|
|
|
|
| 644 |
studentContainer.classList.add('hidden');
|
| 645 |
}
|
| 646 |
}
|
| 647 |
+
// Student search functionality
|
| 648 |
+
document.getElementById('student-search').addEventListener('input', function() {
|
| 649 |
+
const searchTerm = this.value.toLowerCase();
|
| 650 |
+
const resultsContainer = document.getElementById('student-results');
|
| 651 |
+
const classVal = document.getElementById('class').value;
|
| 652 |
+
const formVal = document.getElementById('form').value;
|
| 653 |
+
|
| 654 |
+
resultsContainer.innerHTML = '';
|
| 655 |
+
|
| 656 |
+
if (!classVal || !formVal) {
|
| 657 |
+
resultsContainer.classList.add('hidden');
|
| 658 |
+
return;
|
| 659 |
+
}
|
| 660 |
|
| 661 |
+
if (searchTerm.length < 2) {
|
| 662 |
+
resultsContainer.classList.add('hidden');
|
| 663 |
+
return;
|
| 664 |
+
}
|
|
|
|
| 665 |
|
| 666 |
+
const filteredStudents = studentsByForm[formVal][classVal].filter(student =>
|
| 667 |
+
student.toLowerCase().includes(searchTerm)
|
| 668 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 669 |
|
| 670 |
+
if (filteredStudents.length === 0) {
|
| 671 |
+
resultsContainer.innerHTML = '<div class="p-2 text-gray-500">No students found</div>';
|
| 672 |
+
} else {
|
| 673 |
+
filteredStudents.forEach(student => {
|
| 674 |
+
const div = document.createElement('div');
|
| 675 |
+
div.className = 'p-2 hover:bg-gray-100 cursor-pointer';
|
| 676 |
+
div.textContent = student;
|
| 677 |
+
div.onclick = () => {
|
| 678 |
+
document.getElementById('student-search').value = student;
|
| 679 |
+
resultsContainer.classList.add('hidden');
|
| 680 |
+
};
|
| 681 |
+
resultsContainer.appendChild(div);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 682 |
});
|
| 683 |
}
|
| 684 |
|
| 685 |
+
resultsContainer.classList.remove('hidden');
|
| 686 |
+
});
|
| 687 |
+
|
| 688 |
+
// Close dropdown when clicking outside
|
| 689 |
+
document.addEventListener('click', function(e) {
|
| 690 |
+
if (!e.target.closest('#student-container')) {
|
| 691 |
+
document.getElementById('student-results').classList.add('hidden');
|
| 692 |
}
|
| 693 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 694 |
// Function to reset the form
|
| 695 |
function resetForm() {
|
| 696 |
// Clear form fields
|