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 results = employeeList.filter((item) => {
const fullName = `${item.firstName} ${item.lastName}`.toLowerCase(); 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); setFilteredData(results);
@ -294,7 +303,8 @@ const EmployeeList = () => {
</label> </label>
</div> </div>
{/* Show Inactive Employees Switch */} {/* Show Inactive Employees Switch */}
{!showAllEmployees && (
<div className="form-check form-switch text-start"> <div className="form-check form-switch text-start">
<input <input
type="checkbox" type="checkbox"
@ -308,7 +318,8 @@ const EmployeeList = () => {
Show Inactive Employees Show Inactive Employees
</label> </label>
</div> </div>
)}
</div> </div>
{/* Right side: Search + Export + Add Employee */} {/* Right side: Search + Export + Add Employee */}