diff --git a/src/pages/Activities/AttendancePage.jsx b/src/pages/Activities/AttendancePage.jsx index 9e260433..ff9cf504 100644 --- a/src/pages/Activities/AttendancePage.jsx +++ b/src/pages/Activities/AttendancePage.jsx @@ -33,11 +33,12 @@ const AttendancePage = () => { const dispatch = useDispatch(); const [formData, setFormData] = useState({ - markTime: "", - description: "", - date: new Date().toLocaleDateString(), - }); + time: "", + description: "", + date: new Date().toLocaleDateString(), + }); + const getRole = (roleId) => { if (!empRoles) return "Unassigned"; if (!roleId) return "Unassigned"; @@ -66,26 +67,24 @@ const AttendancePage = () => { document.querySelector(".modal-backdrop").remove(); } }; - - const handleSubmit = ( formData ) => - { - dispatch(markCurrentAttendance(formData)) - .then((action) => { - const updatedAttendance = attendances.map((item) => - item.employeeId === action.payload.employeeId - ? { ...item, ...action.payload } - : item - ); - cacheData("Attendance", { - data: updatedAttendance, - projectId: selectedProject, - }); - setAttendances(updatedAttendance); - showToast("Attedance Marked Successfully", "success"); - }) - .catch((error) => { - showToast(error.message, "error"); - }); + + + const handleSubmit = ( formData ) =>{ + dispatch( markCurrentAttendance( formData ) ).then( ( action ) => + { + const updatedAttendance = attendances.map(item => + item.employeeId === action.payload.employeeId + ? { ...item, ...action.payload } + : item + ); + cacheData("Attendance", { data: updatedAttendance, projectId: selectedProject }) + setAttendances(updatedAttendance) + showToast("Attedance Marked Successfully","success") + }) + .catch( ( error ) => + { + showToast(error.message,"error") + }); }; useEffect(() => { @@ -126,70 +125,60 @@ const AttendancePage = () => { { label: "Home", link: "/dashboard" }, { label: "Attendance", link: null }, ]} - > -