)}
- {contactProfile?.tags?.length > 0 && (
-
-
-
Tags :
+
+ {profileContactState?.tags?.length > 0 && (
+
+
+
+
+ Tags
+
+ :
+
- {contactProfile.tags.map((tag, index) => (
+ {profileContactState.tags.map((tag, index) => (
-
-
{tag.name}
))}
@@ -178,75 +243,93 @@ const ProfileContactDirectory = ({ contact, setOpen_contact, closeModal }) => {
)}
- {contactProfile?.buckets?.length > 0 && (
-
- {contactProfile?.contactEmails?.length > 0 && (
-
-
-
-
- {contactProfile.buckets.map((bucket) => (
- -
-
- {bucket.name}
-
-
- ))}
-
-
-
- )}
+ {profileContactState?.buckets?.length > 0 && (
+
+
+
+
+ Buckets
+
+ :
+
+
+
+
+ {profileContactState.buckets.map((bucket) => (
+ -
+
+ {bucket.name}
+
+
+ ))}
+
+
)}
-
- {contactProfile?.projects?.length > 0 && (
-
-
-
-
- {contactProfile.projects.map((project, index) => (
- -
- {project.name}
- {index < contactProfile.projects.length - 1 && ","}
-
- ))}
-
-
-
- )}
-
-
-
Description :
+ {profileContactState?.projects?.length > 0 && (
+
+
+
+
+ Projects
+
+ :
+
+
+
+
+ {profileContactState.projects.map((project, index) => (
+ -
+ {project.name}
+ {index < profileContactState.projects.length - 1 && ","}
+
+ ))}
+
+
+
+ )}
+
+
+
+
+
+
+ Description
+
+ :
+
{displayText}
{isLong && (
-
- {expanded ? "Read less" : "Read more"}
-
+ <>
+
+
+ {expanded ? "Read less" : "Read more"}
+
+ >
)}
+
+
+
);
};
-export default ProfileContactDirectory;
+export default ProfileContactDirectory;
\ No newline at end of file
diff --git a/src/pages/Activities/AttendancePage.jsx b/src/pages/Activities/AttendancePage.jsx
index f65d06c8..65cd069d 100644
--- a/src/pages/Activities/AttendancePage.jsx
+++ b/src/pages/Activities/AttendancePage.jsx
@@ -8,7 +8,6 @@ import {
import Breadcrumb from "../../components/common/Breadcrumb";
import AttendanceLog from "../../components/Activities/AttendcesLogs";
import Attendance from "../../components/Activities/Attendance";
-// import AttendanceModel from "../../components/Activities/AttendanceModel";
import showToast from "../../services/toastService";
import Regularization from "../../components/Activities/Regularization";
import { useAttendance } from "../../hooks/useAttendance";
@@ -18,12 +17,12 @@ import { markCurrentAttendance } from "../../slices/apiSlice/attendanceAllSlice"
import { useHasUserPermission } from "../../hooks/useHasUserPermission";
import { REGULARIZE_ATTENDANCE } from "../../utils/constants";
import eventBus from "../../services/eventBus";
-// import AttendanceRepository from "../../repositories/AttendanceRepository";
+import AttendanceRepository from "../../repositories/AttendanceRepository"; // Make sure this is imported if used
import { useProjectName } from "../../hooks/useProjects";
import GlobalModel from "../../components/common/GlobalModel";
import CheckCheckOutmodel from "../../components/Activities/CheckCheckOutForm";
import AttendLogs from "../../components/Activities/AttendLogs";
-// import Confirmation from "../../components/Activities/Confirmation";
+import Confirmation from "../../components/Activities/Confirmation"; // Make sure this is imported if used
import { useQueryClient } from "@tanstack/react-query";
const AttendancePage = () => {
@@ -37,7 +36,7 @@ const AttendancePage = () => {
attendance,
loading: attLoading,
recall: attrecall,
- } = useAttendace(selectedProject);
+ } = useAttendance(selectedProject); // Corrected typo: useAttendace to useAttendance
const [attendances, setAttendances] = useState();
const [empRoles, setEmpRoles] = useState(null);
const [isCreateModalOpen, setIsCreateModalOpen] = useState(false);
@@ -58,10 +57,10 @@ const AttendancePage = () => {
// Ensure attendances is not null before mapping
const updatedAttendance = attendances
? attendances.map((item) =>
- item.employeeId === msg.response.employeeId
- ? { ...item, ...msg.response }
- : item
- )
+ item.employeeId === msg.response.employeeId
+ ? { ...item, ...msg.response }
+ : item
+ )
: [msg.response]; // If attendances is null, initialize with new response
cacheData("Attendance", {
@@ -71,12 +70,13 @@ const AttendancePage = () => {
setAttendances(updatedAttendance);
}
},
- [selectedProject, attendances] // Removed attrecall as it's not a direct dependency for this state update
+ [selectedProject, attendances]
);
const employeeHandler = useCallback(
(msg) => {
if (attendances?.some((item) => item.employeeId === msg.employeeId)) {
+ // Ensure AttendanceRepository is imported and available
AttendanceRepository.getAttendance(selectedProject)
.then((response) => {
cacheData("Attendance", { data: response.data, selectedProject });
@@ -127,10 +127,10 @@ const AttendancePage = () => {
if (action.payload && action.payload.employeeId) {
const updatedAttendance = attendances
? attendances.map((item) =>
- item.employeeId === action.payload.employeeId
- ? { ...item, ...action.payload }
- : item
- )
+ item.employeeId === action.payload.employeeId
+ ? { ...item, ...action.payload }
+ : item
+ )
: [action.payload]; // If attendances is null, initialize with new payload
cacheData("Attendance", {
@@ -151,6 +151,7 @@ const AttendancePage = () => {
const handleToggle = (event) => {
setShowPending(event.target.checked);
};
+
useEffect(() => {
if (selectedProject === null && projectNames.length > 0) {
dispatch(setProjectId(projectNames[0]?.id));
@@ -162,8 +163,8 @@ const AttendancePage = () => {
if (modelConfig !== null) {
openModel();
}
- }, [modelConfig]); // Removed isCreateModalOpen from here as it's set by openModel()
-
+ }, [modelConfig]);
+
useEffect(() => {
setAttendances(attendance);
}, [attendance]);
@@ -204,27 +205,8 @@ const AttendancePage = () => {
return () => eventBus.off("attendance", handler);
}, [handler]);
- // useEffect(() => {
- // eventBus.on("employee", employeeHandler);
- // return () => eventBus.off("employee", employeeHandler);
- // }, [employeeHandler]);
return (
<>
- {/* {isCreateModalOpen && modelConfig && (
-
- )} */}
{isCreateModalOpen && modelConfig && (
{
{activeTab === "all" && (
-
- )}
+
+
{!attLoading && filteredAndSearchedTodayAttendance()?.length === 0 && (
{" "}
@@ -327,7 +307,7 @@ const AttendancePage = () => {
: "No Employee assigned yet."}{" "}
)}
- >
+
)}
{activeTab === "logs" && (