March 18 2026: Update attendance report filter multiple employees 2

This commit is contained in:
2026-03-18 10:14:07 -04:00
parent 10c2f09586
commit cf9e1fceac
+10 -4
View File
@@ -133,8 +133,12 @@ function applyFilters() {
const searchTerm = const searchTerm =
document.getElementById("searchInput")?.value.toLowerCase() || ""; document.getElementById("searchInput")?.value.toLowerCase() || "";
const locationFilter = document.getElementById("location")?.value || ""; const locationFilter = document.getElementById("location")?.value || "";
const employeeFilter = // Support comma-separated multi-employee filter
document.getElementById("employee")?.value.toLowerCase() || ""; const employeeFilterRaw =
document.getElementById("employee")?.value || "";
const employeeFilterIds = employeeFilterRaw
? employeeFilterRaw.split(",").map(function(s) { return s.trim().toLowerCase(); }).filter(Boolean)
: [];
filteredData = attendanceData.filter((record) => { filteredData = attendanceData.filter((record) => {
const matchesSearch = const matchesSearch =
@@ -146,8 +150,10 @@ function applyFilters() {
const matchesLocation = const matchesLocation =
!locationFilter || record.location === locationFilter; !locationFilter || record.location === locationFilter;
const matchesEmployee = const matchesEmployee =
!employeeFilter || employeeFilterIds.length === 0 ||
record.employeeId.toLowerCase().includes(employeeFilter); employeeFilterIds.some(function(id) {
return record.employeeId.toLowerCase() === id;
});
return matchesSearch && matchesLocation && matchesEmployee; return matchesSearch && matchesLocation && matchesEmployee;
}); });