spell correction
This commit is contained in:
parent
6d86362e9e
commit
f9876c6d52
@ -18,7 +18,7 @@ import {
|
||||
VIEW_ALL_EMPLOYEES,
|
||||
VIEW_TEAM_MEMBERS,
|
||||
} from "../../utils/constants";
|
||||
import { clearCacheKey, useSelectedproject } from "../../slices/apiDataManager";
|
||||
import { clearCacheKey, useSelectedProject } from "../../slices/apiDataManager";
|
||||
import { useHasUserPermission } from "../../hooks/useHasUserPermission";
|
||||
import SuspendEmp from "../../components/Employee/SuspendEmp"; // Keep if you use SuspendEmp
|
||||
import {
|
||||
@ -41,7 +41,7 @@ const EmployeeList = () => {
|
||||
// const selectedProjectId = useSelector(
|
||||
// (store) => store.localVariables.projectId
|
||||
// );
|
||||
const selectedProjectId = useSelectedproject();
|
||||
const selectedProjectId = useSelectedProject();
|
||||
const { projectNames, loading: projectLoading, fetchData } = useProjectName();
|
||||
|
||||
const dispatch = useDispatch();
|
||||
@ -177,10 +177,12 @@ 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);
|
||||
});
|
||||
|
||||
@ -278,8 +280,9 @@ const EmployeeList = () => {
|
||||
? "Suspend Employee"
|
||||
: "Reactivate Employee"
|
||||
}
|
||||
message={`Are you sure you want to ${selectedEmpFordelete?.isActive ? "suspend" : "reactivate"
|
||||
} this employee?`}
|
||||
message={`Are you sure you want to ${
|
||||
selectedEmpFordelete?.isActive ? "suspend" : "reactivate"
|
||||
} this employee?`}
|
||||
onSubmit={() =>
|
||||
suspendEmployee({
|
||||
employeeId: selectedEmpFordelete.id,
|
||||
|
@ -4,10 +4,9 @@ import {
|
||||
clearApiCacheKey,
|
||||
flushApiCache,
|
||||
} from "../slices/apiCacheSlice";
|
||||
import {setLoginUserPermmisions} from "./globalVariablesSlice";
|
||||
import { setLoginUserPermmisions } from "./globalVariablesSlice";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
|
||||
// Cache data
|
||||
export const cacheData = (key, data) => {
|
||||
store.dispatch(cacheApiResponse({ key, data }));
|
||||
@ -28,9 +27,7 @@ export const clearAllCache = () => {
|
||||
store.dispatch(flushApiCache());
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const cacheProfileData = ( data) => {
|
||||
export const cacheProfileData = (data) => {
|
||||
store.dispatch(setLoginUserPermmisions(data));
|
||||
};
|
||||
// Get cached data
|
||||
@ -39,14 +36,13 @@ export const getCachedProfileData = () => {
|
||||
};
|
||||
|
||||
export const useSelectedProject = () => {
|
||||
const selectedProject = useSelector((store)=> store.localVariables.projectId);
|
||||
const selectedProject = useSelector(
|
||||
(store) => store.localVariables.projectId
|
||||
);
|
||||
var project = localStorage.getItem("project");
|
||||
if(project){
|
||||
return project
|
||||
} else{
|
||||
return selectedProject
|
||||
if (project) {
|
||||
return project;
|
||||
} else {
|
||||
return selectedProject;
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user