March 18 2026: Update attendance report filter multiple employees 2
This commit is contained in:
@@ -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;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user