Newly Checked-In Employees and log Displaying in Descending Order

This commit is contained in:
Pramod Mahajan 2025-04-02 18:57:14 +05:30
parent f7f1f8d083
commit 73ffbe9bf4
3 changed files with 19 additions and 17 deletions

View File

@ -5,7 +5,8 @@ import { convertShortTime } from '../../utils/dateUtils';
const AttendLogs = ({ Id }) => {
const {logs,loading} = useEmployeeAttendacesLog(Id)
const {logs, loading} = useEmployeeAttendacesLog( Id )
return (
<div className="table-responsive">
{loading && <p>Loading..</p>}
@ -26,19 +27,18 @@ const AttendLogs = ({ Id }) => {
</tr>
</thead>
<tbody>
{logs?.length > 0 ? (
logs?.map((log, index) => (
{logs
.slice()
.sort((a, b) => new Date(b.activityTime) - new Date(a.activityTime))
.map((log, index) => (
<tr key={index}>
<td>{convertShortTime(log.activityTime)}</td>
<td>{log.activityTime.slice(0,10)}</td>
<td className="text-wrap" colSpan={3}>{log?.comment}</td>
<td>{log.activityTime.slice(0, 10)}</td>
<td className="text-wrap" colSpan={3}>
{log?.comment}
</td>
</tr>
))
) : (
<tr>
<td colSpan="3">No Data Available</td>
</tr>
)}
))}
</tbody>
</table>
</>

View File

@ -1,5 +1,7 @@
import { useProfile } from "../../hooks/useProfile";
const Dashboard = () => {
const {profile,loading} = useProfile()
return (
<>
@ -11,7 +13,7 @@ const Dashboard = () => {
<div className="d-flex align-items-end row">
<div className="col-sm-7">
<div className="card-body">
<h5 className="card-title text-primary">Congratulations Ramchandra! 🎉</h5>
<h5 className="card-title text-primary">Congratulations {profile?.employeeInfo?.firstName }! 🎉</h5>
<p className="mb-4">
You have done <span className="fw-bold">72%</span> more sales today. Check your new badge in
your profile.

View File

@ -188,7 +188,7 @@ const AttendancePage = () =>
{(!projectLoading && !attendances) && <span>Not Found</span>}
{ (projects && projects.length > 0 ) && (
<>
<div className="tab-pane fade show active py-0" id="navs-top-home" role="tabpanel">
<div className="tab-pane fade show active py-0" id="navs-top-home" role="tabpanel" key={projects.id}>
<Attendance attendance={attendances} handleModalData={handleModalData} getRole={getRole} />
</div>