added missing view_all_employee permissions
This commit is contained in:
parent
cdaf642eba
commit
7b1b360c78
@ -74,9 +74,11 @@ const EmployeeList = () => {
|
|||||||
const [selectedEmployee, setSelectedEmployee] = useState(null);
|
const [selectedEmployee, setSelectedEmployee] = useState(null);
|
||||||
const [IsDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
|
const [IsDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
|
||||||
const [selectedEmpFordelete, setSelectedEmpFordelete] = useState(null);
|
const [selectedEmpFordelete, setSelectedEmpFordelete] = useState(null);
|
||||||
const [showManageReportingModal, setShowManageReportingModal] = useState(false);
|
const [showManageReportingModal, setShowManageReportingModal] =
|
||||||
|
useState(false);
|
||||||
const [employeeLodaing, setemployeeLodaing] = useState(false);
|
const [employeeLodaing, setemployeeLodaing] = useState(false);
|
||||||
const ViewTeamMember = useHasUserPermission(VIEW_TEAM_MEMBERS);
|
const ViewTeamMember = useHasUserPermission(VIEW_TEAM_MEMBERS);
|
||||||
|
const ViewAllEmployee = useHasUserPermission(VIEW_ALL_EMPLOYEES);
|
||||||
const { mutate: suspendEmployee, isPending: empLodaing } = useSuspendEmployee(
|
const { mutate: suspendEmployee, isPending: empLodaing } = useSuspendEmployee(
|
||||||
{
|
{
|
||||||
setIsDeleteModalOpen,
|
setIsDeleteModalOpen,
|
||||||
@ -140,11 +142,15 @@ const EmployeeList = () => {
|
|||||||
|
|
||||||
const tableRef = useRef(null);
|
const tableRef = useRef(null);
|
||||||
const handleExport = (type) => {
|
const handleExport = (type) => {
|
||||||
handleEmployeeExport(type, employeeList, filteredData, searchText, tableRef);
|
handleEmployeeExport(
|
||||||
|
type,
|
||||||
|
employeeList,
|
||||||
|
filteredData,
|
||||||
|
searchText,
|
||||||
|
tableRef
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const handleAllEmployeesToggle = (e) => {
|
const handleAllEmployeesToggle = (e) => {
|
||||||
const isChecked = e.target.checked;
|
const isChecked = e.target.checked;
|
||||||
setShowInactive(false);
|
setShowInactive(false);
|
||||||
@ -173,9 +179,11 @@ const EmployeeList = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!loading && Array.isArray(employees)) {
|
if (!loading && Array.isArray(employees)) {
|
||||||
const sorted = [...employees].sort((a, b) => {
|
const sorted = [...employees].sort((a, b) => {
|
||||||
const nameA = `${a.firstName || ""}${a.middleName || ""}${a.lastName || ""
|
const nameA = `${a.firstName || ""}${a.middleName || ""}${
|
||||||
|
a.lastName || ""
|
||||||
}`.toLowerCase();
|
}`.toLowerCase();
|
||||||
const nameB = `${b.firstName || ""}${b.middleName || ""}${b.lastName || ""
|
const nameB = `${b.firstName || ""}${b.middleName || ""}${
|
||||||
|
b.lastName || ""
|
||||||
}`.toLowerCase();
|
}`.toLowerCase();
|
||||||
return nameA?.localeCompare(nameB);
|
return nameA?.localeCompare(nameB);
|
||||||
});
|
});
|
||||||
@ -266,7 +274,8 @@ const EmployeeList = () => {
|
|||||||
? "Suspend Employee"
|
? "Suspend Employee"
|
||||||
: "Reactivate Employee"
|
: "Reactivate Employee"
|
||||||
}
|
}
|
||||||
message={`Are you sure you want to ${selectedEmpFordelete?.isActive ? "suspend" : "reactivate"
|
message={`Are you sure you want to ${
|
||||||
|
selectedEmpFordelete?.isActive ? "suspend" : "reactivate"
|
||||||
} this employee?`}
|
} this employee?`}
|
||||||
onSubmit={(id) =>
|
onSubmit={(id) =>
|
||||||
suspendEmployee({
|
suspendEmployee({
|
||||||
@ -288,7 +297,7 @@ const EmployeeList = () => {
|
|||||||
]}
|
]}
|
||||||
></Breadcrumb>
|
></Breadcrumb>
|
||||||
|
|
||||||
{ViewTeamMember ? (
|
{ViewTeamMember || ViewAllEmployee ? (
|
||||||
// <div className="row">
|
// <div className="row">
|
||||||
<div className="card p-1 page-min-h">
|
<div className="card p-1 page-min-h">
|
||||||
<div className="card-datatable table-responsive pt-5 mx-5 py-10">
|
<div className="card-datatable table-responsive pt-5 mx-5 py-10">
|
||||||
@ -342,8 +351,10 @@ const EmployeeList = () => {
|
|||||||
>
|
>
|
||||||
<i className="bx bx-dots-vertical-rounded bx-md"></i>
|
<i className="bx bx-dots-vertical-rounded bx-md"></i>
|
||||||
</button>
|
</button>
|
||||||
<ul className="dropdown-menu dropdown-menu-end shadow-sm " style={{ minWidth: "220px" }}>
|
<ul
|
||||||
|
className="dropdown-menu dropdown-menu-end shadow-sm "
|
||||||
|
style={{ minWidth: "220px" }}
|
||||||
|
>
|
||||||
<li className="dropdown-item d-flex align-items-center justify-content-between">
|
<li className="dropdown-item d-flex align-items-center justify-content-between">
|
||||||
<div className="form-check form-switch mb-0">
|
<div className="form-check form-switch mb-0">
|
||||||
<input
|
<input
|
||||||
@ -352,39 +363,53 @@ const EmployeeList = () => {
|
|||||||
role="switch"
|
role="switch"
|
||||||
id="inactiveEmployeesCheckboxMenu"
|
id="inactiveEmployeesCheckboxMenu"
|
||||||
checked={showInactive}
|
checked={showInactive}
|
||||||
onChange={(e) => setShowInactive(e.target.checked)}
|
onChange={(e) =>
|
||||||
|
setShowInactive(e.target.checked)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<span className="ms-0">Show Inactive Employees</span>
|
<span className="ms-0">Show Inactive Employees</span>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
<li><hr className="dropdown-divider" /></li>
|
<hr className="dropdown-divider" />
|
||||||
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<button className="dropdown-item" onClick={() => handleExport("print")}>
|
<button
|
||||||
|
className="dropdown-item"
|
||||||
|
onClick={() => handleExport("print")}
|
||||||
|
>
|
||||||
<i className="bx bx-printer me-2"></i> Print
|
<i className="bx bx-printer me-2"></i> Print
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<button className="dropdown-item" onClick={() => handleExport("csv")}>
|
<button
|
||||||
|
className="dropdown-item"
|
||||||
|
onClick={() => handleExport("csv")}
|
||||||
|
>
|
||||||
<i className="bx bx-file me-2"></i> CSV
|
<i className="bx bx-file me-2"></i> CSV
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<button className="dropdown-item" onClick={() => handleExport("excel")}>
|
<button
|
||||||
|
className="dropdown-item"
|
||||||
|
onClick={() => handleExport("excel")}
|
||||||
|
>
|
||||||
<i className="bx bxs-file-export me-2"></i> Excel
|
<i className="bx bxs-file-export me-2"></i> Excel
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<button className="dropdown-item" onClick={() => handleExport("pdf")}>
|
<button
|
||||||
|
className="dropdown-item"
|
||||||
|
onClick={() => handleExport("pdf")}
|
||||||
|
>
|
||||||
<i className="bx bxs-file-pdf me-2"></i> PDF
|
<i className="bx bxs-file-pdf me-2"></i> PDF
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table
|
<table
|
||||||
@ -461,7 +486,8 @@ const EmployeeList = () => {
|
|||||||
Status
|
Status
|
||||||
</th>
|
</th>
|
||||||
<th
|
<th
|
||||||
className={`sorting_disabled ${!Manage_Employee && "d-none"
|
className={`sorting_disabled ${
|
||||||
|
!Manage_Employee && "d-none"
|
||||||
}`}
|
}`}
|
||||||
rowSpan="1"
|
rowSpan="1"
|
||||||
colSpan="1"
|
colSpan="1"
|
||||||
@ -476,29 +502,25 @@ const EmployeeList = () => {
|
|||||||
{loading && (
|
{loading && (
|
||||||
<tr>
|
<tr>
|
||||||
<td colSpan={8} className="text-center py-5">
|
<td colSpan={8} className="text-center py-5">
|
||||||
<div className="d-flex justify-content-center align-items-center py-5" style={{ minHeight: "50vh" }}>
|
<div
|
||||||
|
className="d-flex justify-content-center align-items-center py-5"
|
||||||
|
style={{ minHeight: "50vh" }}
|
||||||
|
>
|
||||||
<SpinnerLoader />
|
<SpinnerLoader />
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{!loading && displayData?.length === 0 && !searchText ? (
|
||||||
{!loading &&
|
|
||||||
displayData?.length === 0 &&
|
|
||||||
(!searchText) ? (
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colSpan={8} className="border-0 py-3">
|
<td colSpan={8} className="border-0 py-3">
|
||||||
<div className="py-4">
|
<div className="py-4">No Data Found</div>
|
||||||
No Data Found
|
|
||||||
</div>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{!loading &&
|
{!loading && displayData?.length === 0 && searchText ? (
|
||||||
displayData?.length === 0 &&
|
|
||||||
(searchText) ? (
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colSpan={8} className="border-0 py-3">
|
<td colSpan={8} className="border-0 py-3">
|
||||||
<div className="py-4">
|
<div className="py-4">
|
||||||
@ -527,7 +549,8 @@ const EmployeeList = () => {
|
|||||||
className="text-heading text-truncate cursor-pointer"
|
className="text-heading text-truncate cursor-pointer"
|
||||||
>
|
>
|
||||||
<span className="fw-normal">
|
<span className="fw-normal">
|
||||||
{capitalizeFirstLetter(item.firstName) } {capitalizeFirstLetter(item.middleName)}{" "}
|
{capitalizeFirstLetter(item.firstName)}{" "}
|
||||||
|
{capitalizeFirstLetter(item.middleName)}{" "}
|
||||||
{capitalizeFirstLetter(item.lastName)}
|
{capitalizeFirstLetter(item.lastName)}
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
@ -541,7 +564,9 @@ const EmployeeList = () => {
|
|||||||
{item.email}
|
{item.email}
|
||||||
</span>
|
</span>
|
||||||
) : (
|
) : (
|
||||||
<small className="d-block text-start text-muted small">-</small>
|
<small className="d-block text-start text-muted small">
|
||||||
|
-
|
||||||
|
</small>
|
||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
@ -562,7 +587,9 @@ const EmployeeList = () => {
|
|||||||
{item.joiningDate ? (
|
{item.joiningDate ? (
|
||||||
moment(item.joiningDate).format("DD-MMM-YYYY")
|
moment(item.joiningDate).format("DD-MMM-YYYY")
|
||||||
) : (
|
) : (
|
||||||
<span className="d-block text-center text-muted fst-italic">NA</span>
|
<span className="d-block text-center text-muted fst-italic">
|
||||||
|
NA
|
||||||
|
</span>
|
||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user