fix(leave) : clip leave-tab absence fetch to selected phase bounds
The annual calendar in LeaveTab.vue was showing absences from outside the selected phase's lifespan. For an employee who switched contract type mid-year, this leaked the old phase's absences into the new phase's calendar view (and vice versa via the phase picker). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -91,8 +91,11 @@ export const useEmployeeLeave = (
|
|||||||
try {
|
try {
|
||||||
const isForfait = isForfaitOnPhase.value
|
const isForfait = isForfaitOnPhase.value
|
||||||
const leaveYear = selectedLeaveYear.value
|
const leaveYear = selectedLeaveYear.value
|
||||||
const from = isForfait ? `${leaveYear}-01-01` : `${leaveYear - 1}-06-01`
|
let from = isForfait ? `${leaveYear}-01-01` : `${leaveYear - 1}-06-01`
|
||||||
const to = isForfait ? `${leaveYear}-12-31` : `${leaveYear}-05-31`
|
let to = isForfait ? `${leaveYear}-12-31` : `${leaveYear}-05-31`
|
||||||
|
const phase = selectedPhase.value
|
||||||
|
if (phase?.startDate && phase.startDate > from) from = phase.startDate
|
||||||
|
if (phase?.endDate && phase.endDate < to) to = phase.endDate
|
||||||
const holidayYears = isForfait ? [leaveYear] : [leaveYear - 1, leaveYear]
|
const holidayYears = isForfait ? [leaveYear] : [leaveYear - 1, leaveYear]
|
||||||
|
|
||||||
const [absences, summary, ...holidayResults] = await Promise.all([
|
const [absences, summary, ...holidayResults] = await Promise.all([
|
||||||
|
|||||||
Reference in New Issue
Block a user