import React, { useEffect, useState } from 'react' import { useEmployeeAttendacesLog } from '../../hooks/useAttendance'; import { convertShortTime } from '../../utils/dateUtils'; const AttendLogs = ({ Id }) => { const {logs, loading} = useEmployeeAttendacesLog( Id ) const whichActivityPerform = ( actvity ) => { switch (actvity) { case 1: return "IN" break; case 2: return "Requested" break; case 3: return "Deleted" break; case 4: return "OUT" break; case 5: return "Regularized" break; default: break; } } return (
{loading &&

Loading..

} { logs && logs.length > 0 && ( <>

Date : {logs[0].activityTime.slice(0,10)}

{logs .slice() .sort((a, b) => b.id - a.id) .map((log, index) => ( ))}
Time Activity Date Description
{convertShortTime( log.activityTime )} {whichActivityPerform(log.activity)} {log.activityTime.slice(0, 10)} {log?.comment}
) }
); }; export default AttendLogs;