fiexed: check-in allowing in logs
This commit is contained in:
parent
928a50432d
commit
3b933d513f
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user