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