From 3cfbc826722806522a7432b1e09a1cc54c4abf52 Mon Sep 17 00:00:00 2001 From: Kartik Sharma Date: Tue, 19 Aug 2025 11:17:09 +0530 Subject: [PATCH 1/2] Display Only "Re-activate" Button for Inactive Employees in Action Column --- src/pages/employee/EmployeeList.jsx | 92 +++++++++++++++-------------- 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/src/pages/employee/EmployeeList.jsx b/src/pages/employee/EmployeeList.jsx index ad54ce20..be586d18 100644 --- a/src/pages/employee/EmployeeList.jsx +++ b/src/pages/employee/EmployeeList.jsx @@ -176,12 +176,10 @@ const EmployeeList = () => { useEffect(() => { if (!loading && Array.isArray(employees)) { const sorted = [...employees].sort((a, b) => { - const nameA = `${a.firstName || ""}${a.middleName || ""}${ - a.lastName || "" - }`.toLowerCase(); - const nameB = `${b.firstName || ""}${b.middleName || ""}${ - b.lastName || "" - }`.toLowerCase(); + const nameA = `${a.firstName || ""}${a.middleName || ""}${a.lastName || "" + }`.toLowerCase(); + const nameB = `${b.firstName || ""}${b.middleName || ""}${b.lastName || "" + }`.toLowerCase(); return nameA?.localeCompare(nameB); }); @@ -503,9 +501,8 @@ const EmployeeList = () => { Status { )} {/* Conditional messages for no data or no search results */} {!loading && - displayData?.length === 0 && - searchText && - !showAllEmployees ? ( + displayData?.length === 0 && + searchText && + !showAllEmployees ? ( @@ -537,8 +534,8 @@ const EmployeeList = () => { ) : null} {!loading && - displayData?.length === 0 && - (!searchText || showAllEmployees) ? ( + displayData?.length === 0 && + (!searchText || showAllEmployees) ? ( {
+ {/* View always visible */} - - {!item.isSystem && ( + + {/* If ACTIVE employee */} + {item.isActive && ( <> + + {/* Suspend only when active */} + + + )} + + {/* If INACTIVE employee AND inactive toggle is ON */} + {!item.isActive && showInactive && ( + + )}
@@ -687,9 +692,8 @@ const EmployeeList = () => {