Issues_Aug_2W #371
@ -1,6 +1,6 @@
|
|||||||
import React, { useEffect } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useEmployeeAttendacesLog } from "../../hooks/useAttendance";
|
import { useEmployeeAttendacesLog } from "../../hooks/useAttendance";
|
||||||
import { convertShortTime } from "../../utils/dateUtils";
|
import { convertShortTime, formatUTCToLocalTime } from "../../utils/dateUtils";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { THRESH_HOLD } from "../../utils/constants";
|
import { THRESH_HOLD } from "../../utils/constants";
|
||||||
|
|
||||||
@ -8,16 +8,6 @@ const AttendLogs = ({ Id }) => {
|
|||||||
const { logs, loading } = useEmployeeAttendacesLog(Id);
|
const { logs, loading } = useEmployeeAttendacesLog(Id);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
// 🔹 Utility: format date as DD-MM-YYYY
|
|
||||||
const formatDate = (dateStr) => {
|
|
||||||
if (!dateStr) return "";
|
|
||||||
const date = new Date(dateStr);
|
|
||||||
const day = String(date.getDate()).padStart(2, "0");
|
|
||||||
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
||||||
const year = date.getFullYear();
|
|
||||||
return `${day}-${month}-${year}`;
|
|
||||||
};
|
|
||||||
|
|
||||||
const isCheckoutRegularized = (
|
const isCheckoutRegularized = (
|
||||||
activityTimeStr,
|
activityTimeStr,
|
||||||
checkoutTimeStr,
|
checkoutTimeStr,
|
||||||
@ -138,7 +128,7 @@ const AttendLogs = ({ Id }) => {
|
|||||||
<p>
|
<p>
|
||||||
Attendance logs for{" "}
|
Attendance logs for{" "}
|
||||||
{logs[0]?.employee?.firstName + " " + logs[0]?.employee?.lastName}{" "}
|
{logs[0]?.employee?.firstName + " " + logs[0]?.employee?.lastName}{" "}
|
||||||
on {formatDate(logs[0]?.activityTime)}
|
on {formatUTCToLocalTime(logs[0]?.activityTime)}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@ -166,13 +156,13 @@ const AttendLogs = ({ Id }) => {
|
|||||||
.sort((a, b) => b.id - a.id)
|
.sort((a, b) => b.id - a.id)
|
||||||
.map((log, index) => (
|
.map((log, index) => (
|
||||||
<tr key={index}>
|
<tr key={index}>
|
||||||
<td>{formatDate(log.activityTime)}</td>
|
<td>{formatUTCToLocalTime(log.activityTime)}</td>
|
||||||
<td>{convertShortTime(log.activityTime)}</td>
|
<td>{convertShortTime(log.activityTime)}</td>
|
||||||
<td>
|
<td>
|
||||||
{whichActivityPerform(log.activity, log.activityTime)}
|
{whichActivityPerform(log.activity, log.activityTime)}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{log?.latitude !== 0 ? (
|
{log?.latitude != 0 ? (
|
||||||
<i
|
<i
|
||||||
className="bx bx-map text-danger cursor-pointer"
|
className="bx bx-map text-danger cursor-pointer"
|
||||||
data-bs-toggle="tooltip"
|
data-bs-toggle="tooltip"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useState, useEffect, useCallback, useMemo } from "react";
|
import React, { useState, useEffect, useCallback, useMemo } from "react";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import Avatar from "../common/Avatar";
|
import Avatar from "../common/Avatar";
|
||||||
import { convertShortTime } from "../../utils/dateUtils";
|
import { convertShortTime, formatUTCToLocalTime } from "../../utils/dateUtils";
|
||||||
import RenderAttendanceStatus from "./RenderAttendanceStatus";
|
import RenderAttendanceStatus from "./RenderAttendanceStatus";
|
||||||
import usePagination from "../../hooks/usePagination";
|
import usePagination from "../../hooks/usePagination";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
@ -116,7 +116,7 @@ const Attendance = ({ getRole, handleModalData, searchTerm }) => {
|
|||||||
<>
|
<>
|
||||||
<div className="table-responsive text-nowrap h-100" >
|
<div className="table-responsive text-nowrap h-100" >
|
||||||
<div className="d-flex text-start align-items-center py-2">
|
<div className="d-flex text-start align-items-center py-2">
|
||||||
<strong>Date : {todayDate.toLocaleDateString("en-GB")}</strong>
|
<strong>Date : {formatUTCToLocalTime(todayDate)}</strong>
|
||||||
<div className="form-check form-switch text-start m-0 ms-5">
|
<div className="form-check form-switch text-start m-0 ms-5">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user