fiexed: check-in allowing in logs

This commit is contained in:
Pramod Mahajan 2025-06-24 12:07:34 +05:30
parent 928a50432d
commit 3b933d513f

View File

@ -61,25 +61,37 @@ const useAttendanceStatus = (attendanceData) => {
}
// 3. Already checked in and out → Handle activity === 4 (Approved)
if (checkInTime && checkOutTime && activity === 4) {
if (!isSameDay(checkOutTime, now) && !timeElapsed(checkOutTime, THRESH_HOLD)) {
return setStatus({
status: "Approved",
action: ACTIONS.APPROVED,
disabled: true,
text: "Approved",
color: 'btn-success',
});
} else if (isSameDay(checkOutTime, now)) {
return setStatus({
status: "Check-In",
action: ACTIONS.CHECK_IN,
disabled: false,
text: "Check In",
color: 'btn-primary',
});
}
}
if (checkInTime && checkOutTime && activity === 4) {
if (!isSameDay(checkInTime, now) && !timeElapsed(checkInTime, THRESH_HOLD)) {
// Case: Past day, but still within threshold → Approved
return setStatus({
status: "Approved",
action: ACTIONS.APPROVED,
disabled: true,
text: "Approved",
color: 'btn-success',
});
} else if (isSameDay(checkOutTime, now)) {
// Case: same day → allow check-in again
return setStatus({
status: "Check In",
action: ACTIONS.CHECK_IN,
disabled: false,
text: "Check In",
color: 'btn-primary',
});
} else {
// Case: not same day AND over 48 hours → freeze status as Approved
return setStatus({
status: "Approved",
action: ACTIONS.APPROVED,
disabled: true,
text: "Approved",
color: 'btn-success',
});
}
}
// 4. Regularization Requested
if (activity === 2) {