feat : ajout des commentaires à la semaine

This commit is contained in:
2026-04-17 09:53:09 +02:00
parent 51bf155b0e
commit ccd8e66dcd
19 changed files with 595 additions and 14 deletions

View File

@@ -88,6 +88,8 @@ export type WeeklyWorkHourRowSummary = {
weeklyOvernightCount?: number
hasContractForWeek?: boolean
contractNature?: 'CDI' | 'CDD' | 'INTERIM' | null
comment?: string | null
commentId?: number | null
}
export type WeeklyWorkHourSummary = {

View File

@@ -0,0 +1,24 @@
export type EmployeeWeekComment = {
id: number
weekStartDate: string
content: string
}
export const createWeekComment = async (payload: { employeeId: number; weekStartDate: string; content: string }) => {
const api = useApi()
return api.post<EmployeeWeekComment>('/employee_week_comments', {
employee: `/api/employees/${payload.employeeId}`,
weekStartDate: payload.weekStartDate,
content: payload.content
}, { toastSuccessKey: 'success.week-comment.save', toastErrorKey: 'errors.week-comment.save' })
}
export const updateWeekComment = async (id: number, content: string) => {
const api = useApi()
return api.patch<EmployeeWeekComment>(`/employee_week_comments/${id}`, { content }, { toastSuccessKey: 'success.week-comment.save', toastErrorKey: 'errors.week-comment.save' })
}
export const deleteWeekComment = async (id: number) => {
const api = useApi()
await api.delete(`/employee_week_comments/${id}`, {}, { toastSuccessKey: 'success.week-comment.delete', toastErrorKey: 'errors.week-comment.delete' })
}