Retour RH: vue jour par date, RTT mi-semaine, récap salaire & exports, panier de nuit #21
@@ -350,11 +350,30 @@ export const useHoursPage = () => {
|
|||||||
updatedAt: null
|
updatedAt: null
|
||||||
})
|
})
|
||||||
|
|
||||||
const isPresenceTracking = (employee: Employee) => employee.contract?.trackingMode === TRACKING_MODES.PRESENCE
|
// Résout le contrat à la date affichée (ligne du jour), avec repli sur le contrat courant.
|
||||||
|
const resolveDayContract = (employee: Employee) => {
|
||||||
|
const dayRow = dayContextByEmployeeId.value.get(employee.id)
|
||||||
|
if (dayRow?.hasContractAtDate) {
|
||||||
|
return {
|
||||||
|
trackingMode: dayRow.trackingMode ?? null,
|
||||||
|
weeklyHours: dayRow.weeklyHours ?? null,
|
||||||
|
type: dayRow.contractType ?? null,
|
||||||
|
name: dayRow.contractName ?? ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
trackingMode: employee.contract?.trackingMode ?? null,
|
||||||
|
weeklyHours: employee.contract?.weeklyHours ?? null,
|
||||||
|
type: employee.contract?.type ?? null,
|
||||||
|
name: employee.contract?.name ?? ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const isPresenceTracking = (employee: Employee) => resolveDayContract(employee).trackingMode === TRACKING_MODES.PRESENCE
|
||||||
const isTimeTracking = (employee: Employee) => !isPresenceTracking(employee)
|
const isTimeTracking = (employee: Employee) => !isPresenceTracking(employee)
|
||||||
const is4hContract = (employeeId: number) => {
|
const is4hContract = (employeeId: number) => {
|
||||||
const employee = employees.value.find((e) => e.id === employeeId)
|
const employee = employees.value.find((e) => e.id === employeeId)
|
||||||
return employee?.contract?.weeklyHours === 4
|
return employee ? resolveDayContract(employee).weeklyHours === 4 : false
|
||||||
}
|
}
|
||||||
const isRowLocked = (employeeId: number) => {
|
const isRowLocked = (employeeId: number) => {
|
||||||
const row = rows.value[employeeId]
|
const row = rows.value[employeeId]
|
||||||
@@ -365,8 +384,8 @@ export const useHoursPage = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const contractLabel = (employee: Employee) => {
|
const contractLabel = (employee: Employee) => {
|
||||||
const contract = employee.contract
|
const contract = resolveDayContract(employee)
|
||||||
if (!contract) return '-'
|
if (!contract.type && !contract.name) return '-'
|
||||||
if (contract.type === CONTRACT_TYPES.INTERIM) {
|
if (contract.type === CONTRACT_TYPES.INTERIM) {
|
||||||
return contract.name
|
return contract.name
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,6 +115,10 @@ export type WorkHourDayContextRow = {
|
|||||||
formationLabel?: string | null
|
formationLabel?: string | null
|
||||||
virtualHolidayMinutes?: number
|
virtualHolidayMinutes?: number
|
||||||
contractNature?: 'CDI' | 'CDD' | 'INTERIM' | null
|
contractNature?: 'CDI' | 'CDD' | 'INTERIM' | null
|
||||||
|
trackingMode?: TrackingMode | null
|
||||||
|
weeklyHours?: number | null
|
||||||
|
contractType?: string | null
|
||||||
|
contractName?: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export type WorkHourDayContext = {
|
export type WorkHourDayContext = {
|
||||||
|
|||||||
Reference in New Issue
Block a user