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)
|
// 3. Already checked in and out → Handle activity === 4 (Approved)
|
||||||
if (checkInTime && checkOutTime && activity === 4) {
|
if (checkInTime && checkOutTime && activity === 4) {
|
||||||
if (!isSameDay(checkOutTime, now) && !timeElapsed(checkOutTime, THRESH_HOLD)) {
|
if (!isSameDay(checkInTime, now) && !timeElapsed(checkInTime, THRESH_HOLD)) {
|
||||||
return setStatus({
|
// Case: Past day, but still within threshold → Approved
|
||||||
status: "Approved",
|
return setStatus({
|
||||||
action: ACTIONS.APPROVED,
|
status: "Approved",
|
||||||
disabled: true,
|
action: ACTIONS.APPROVED,
|
||||||
text: "Approved",
|
disabled: true,
|
||||||
color: 'btn-success',
|
text: "Approved",
|
||||||
});
|
color: 'btn-success',
|
||||||
} else if (isSameDay(checkOutTime, now)) {
|
});
|
||||||
return setStatus({
|
} else if (isSameDay(checkOutTime, now)) {
|
||||||
status: "Check-In",
|
// Case: same day → allow check-in again
|
||||||
action: ACTIONS.CHECK_IN,
|
return setStatus({
|
||||||
disabled: false,
|
status: "Check In",
|
||||||
text: "Check In",
|
action: ACTIONS.CHECK_IN,
|
||||||
color: 'btn-primary',
|
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
|
// 4. Regularization Requested
|
||||||
if (activity === 2) {
|
if (activity === 2) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user