fix : wip

This commit is contained in:
2026-02-19 17:44:37 +01:00
parent c2e118dc33
commit 13274ff297
31 changed files with 1539 additions and 126 deletions

View File

@@ -12,7 +12,7 @@ export const listAbsenceTypes = async () => {
}
export const createAbsenceType = async (
payload: Pick<AbsenceType, 'code' | 'label' | 'color'>
payload: Pick<AbsenceType, 'code' | 'label' | 'color' | 'countAsWorkedHours'>
) => {
const api = useApi()
return api.post<AbsenceType>('/absence_types', payload, {
@@ -23,7 +23,7 @@ export const createAbsenceType = async (
export const updateAbsenceType = async (
id: number,
payload: Pick<AbsenceType, 'code' | 'label' | 'color'>
payload: Pick<AbsenceType, 'code' | 'label' | 'color' | 'countAsWorkedHours'>
) => {
const api = useApi()
return api.patch<AbsenceType>(`/absence_types/${id}`, payload, {

View File

@@ -3,4 +3,5 @@ export type AbsenceType = {
code: string
label: string
color: string
countAsWorkedHours: boolean
}

View File

@@ -47,8 +47,10 @@ export type WeeklyWorkHourRowSummary = {
weeklyNightMinutes: number
weeklyTotalMinutes: number
weeklyPresenceCount?: number
weeklyOvertimeTotalMinutes?: number
weeklyOvertime25Minutes?: number
weeklyOvertime50Minutes?: number
weeklyRecoveryMinutes?: number
}
export type WeeklyWorkHourSummary = {
@@ -57,3 +59,18 @@ export type WeeklyWorkHourSummary = {
days: string[]
rows: WeeklyWorkHourRowSummary[]
}
export type WorkHourDayContextRow = {
employeeId: number
absenceLabel?: string | null
absenceHalf?: 'AM' | 'PM' | null
absentMorning: boolean
absentAfternoon: boolean
creditedMinutes: number
creditedPresenceUnits: number
}
export type WorkHourDayContext = {
workDate: string
rows: WorkHourDayContextRow[]
}

View File

@@ -1,4 +1,5 @@
import type {
WorkHourDayContext,
WorkHour,
WorkHourEntryPayload,
WeeklyWorkHourSummary
@@ -39,12 +40,17 @@ export const bulkUpsertWorkHours = async (payload: {
)
}
export const updateWorkHourValidation = async (id: number, isValid: boolean) => {
export const updateWorkHourValidation = async (
id: number,
isValid: boolean,
options?: { toast?: boolean }
) => {
const api = useApi()
return api.patch<WorkHour>(
`/work_hours/${id}`,
{ isValid },
{
toast: options?.toast ?? true,
toastSuccessMessage: isValid ? 'Ligne validée.' : 'Validation retirée.',
toastErrorMessage: 'Impossible de mettre à jour la validation.'
}
@@ -59,3 +65,12 @@ export const getWeeklyWorkHourSummary = async (weekStart: string) => {
{ toast: false }
)
}
export const getWorkHourDayContext = async (workDate: string) => {
const api = useApi()
return api.get<WorkHourDayContext>(
'/work-hours/day-context',
{ workDate },
{ toast: false }
)
}