- Ajoute les clés i18n manquantes (success/errors weekComment.save/delete) qui faisaient afficher la clé brute dans le toast.
- Titre du drawer simplifié à "Commentaire" ; semaine (S{n}) et plage de dates affichées sous le nom de l'employé.
- Drawer, textarea et boutons migrés vers les composants Malio UI ; bouton Annuler supprimé.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
25 lines
1.0 KiB
TypeScript
25 lines
1.0 KiB
TypeScript
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.weekComment.save', toastErrorKey: 'errors.weekComment.save' })
|
|
}
|
|
|
|
export const updateWeekComment = async (id: number, content: string) => {
|
|
const api = useApi()
|
|
return api.patch<EmployeeWeekComment>(`/employee_week_comments/${id}`, { content }, { toastSuccessKey: 'success.weekComment.save', toastErrorKey: 'errors.weekComment.save' })
|
|
}
|
|
|
|
export const deleteWeekComment = async (id: number) => {
|
|
const api = useApi()
|
|
await api.delete(`/employee_week_comments/${id}`, {}, { toastSuccessKey: 'success.weekComment.delete', toastErrorKey: 'errors.weekComment.delete' })
|
|
}
|