Compare commits

...

8 Commits

Author SHA1 Message Date
Pramod Mahajan
7572ad0777 modified attend log, icons, correct for regualarize and check-out 2025-05-12 17:00:01 +05:30
Pramod Mahajan
6b8a314c25 Merge branch 'pramod_Task#207' of https://git.marcoaiot.com/admin/marco.pms.web into pramod_Task#207 2025-05-12 16:40:16 +05:30
Pramod Mahajan
d5d4cd0dc4 Merge branch 'Issue_May_2W' of https://git.marcoaiot.com/admin/marco.pms.web into pramod_Task#207 2025-05-12 16:39:40 +05:30
c481cd958a revert 1827757f19bd15c05029e1ca9c72de3a65a68bf1
revert updated regularization logic based on 48-hour checkout threshold


- This update was mistakenly implemented in the wrong branch. Moving it here to align with the correct workflow.-  pramod_Bug#-27
2025-05-12 06:15:04 +00:00
Pramod Mahajan
1827757f19 updated regularization logic based on 48-hour checkout threshold 2025-05-12 11:22:34 +05:30
Pramod Mahajan
03165f5eab disable Edit button and show "Please wait" message during activity update API call 2025-05-11 01:26:57 +05:30
Pramod Mahajan
3904c165c9 added loader during submitting form data. 2025-05-11 01:12:08 +05:30
Pramod Mahajan
7a7d612f0b ensure activity updates reflect in Daily Task Planning without page refresh 2025-05-11 01:04:40 +05:30

View File

@ -1,13 +1,28 @@
import React, { useEffect, useState } from "react";
import { useEmployeeAttendacesLog } from "../../hooks/useAttendance";
import { convertShortTime } from "../../utils/dateUtils";
import { useNavigate } from "react-router-dom";
import {useNavigate} from "react-router-dom";
import {THRESH_HOLD} from "../../utils/constants";
const AttendLogs = ({ Id }) => {
const { logs, loading } = useEmployeeAttendacesLog(Id);
const navigate = useNavigate();
const whichActivityPerform = (actvity) => {
const isCheckoutRegularized = (
activityTimeStr,
checkoutTimeStr,
threshHours
)=> {
if (!activityTimeStr || !checkoutTimeStr) return false;
const activityTime = new Date(activityTimeStr);
const checkoutTime = new Date(checkoutTimeStr);
const threshTimeMs = threshHours * 60 * 60 * 1000;
return checkoutTime - activityTime > threshTimeMs;
}
const whichActivityPerform = (actvity,checkOutTime) => {
switch (actvity) {
case 1:
return (
@ -24,12 +39,12 @@ const AttendLogs = ({ Id }) => {
case 2:
return (
<i
className="bx bx-help-circle text-secondary"
className="bx bx-help-circle text-danger"
data-bs-toggle="tooltip"
data-bs-offset="0,8"
data-bs-placement="top"
data-bs-custom-class="tooltip"
title="regularize Requested"
title="Regularized Requested"
></i>
);
break;
@ -41,27 +56,43 @@ const AttendLogs = ({ Id }) => {
data-bs-offset="0,8"
data-bs-placement="top"
data-bs-custom-class="tooltip"
title="Regularized"
title="Request Deleted !"
></i>
);
break;
case 4:
return (
<i
className="bx bx-left-arrow-circle text-danger "
data-bs-toggle="tooltip"
data-bs-offset="0,8"
data-bs-placement="top"
data-bs-custom-class="tooltip"
title="Check-Out"
></i>
);
if (
checkOutTime &&
isCheckoutRegularized(logs[0]?.activityTime, checkOutTime, THRESH_HOLD)
) {
return (
<i
className="bx bx-check-circle text-success"
data-bs-toggle="tooltip"
data-bs-offset="0,8"
data-bs-placement="top"
data-bs-custom-class="tooltip"
title="Regularized"
></i>
);
} else {
return (
<i
className="bx bx-left-arrow-circle text-danger"
data-bs-toggle="tooltip"
data-bs-offset="0,8"
data-bs-placement="top"
data-bs-custom-class="tooltip"
title="Check-Out"
></i>
);
}
break;
case 5:
return (
<i
className="bx bx-x-circle text-danger"
className="bx bx-x-circle text-danger"
data-bs-toggle="tooltip"
data-bs-offset="0,8"
data-bs-placement="top"
@ -122,11 +153,11 @@ const AttendLogs = ({ Id }) => {
<tr key={index}>
<td>{log.activityTime.slice(0, 10)}</td>
<td>{convertShortTime(log.activityTime)}</td>
<td>{whichActivityPerform(log.activity)}</td>
<td>{whichActivityPerform(log.activity,log.activityTime)}</td>
<td>
{log?.latitude != 0 ? (
{(log?.latitude && log?.longitude) ? (
<i
className="bx bx-location-plus text-danger cursor-pointer"
className="bx bx-map text-danger cursor-pointer"
data-bs-toggle="tooltip"
data-bs-offset="0,8"
data-bs-placement="top"