Changes in Employee form allow searching form all the fields.

This commit is contained in:
Kartik sharma 2025-06-13 00:22:23 +05:30
parent 409d98f923
commit 70ac3e0344

View File

@ -61,7 +61,16 @@ const EmployeeList = () => {
const results = employeeList.filter((item) => {
const fullName = `${item.firstName} ${item.lastName}`.toLowerCase();
return fullName.includes(value);
const email = item.email ? item.email.toLowerCase() : "";
const phoneNumber = item.phoneNumber ? item.phoneNumber.toLowerCase() : "";
const jobRole = item.jobRole ? item.jobRole.toLowerCase() : ""; // Get jobRole and convert to lowercase
return (
fullName.includes(value) ||
email.includes(value) ||
phoneNumber.includes(value) ||
jobRole.includes(value) // Include jobRole in the search
);
});
setFilteredData(results);
@ -295,6 +304,7 @@ const EmployeeList = () => {
</div>
{/* Show Inactive Employees Switch */}
{!showAllEmployees && (
<div className="form-check form-switch text-start">
<input
type="checkbox"
@ -308,6 +318,7 @@ const EmployeeList = () => {
Show Inactive Employees
</label>
</div>
)}
</div>