feat : ajout des suspensions et des jours de présence
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
This commit is contained in:
38
frontend/services/contractSuspensions.ts
Normal file
38
frontend/services/contractSuspensions.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import type { ContractSuspension } from './dto/employee'
|
||||
|
||||
export const createSuspension = async (payload: {
|
||||
contractPeriodId: number
|
||||
startDate: string
|
||||
endDate?: string | null
|
||||
comment?: string | null
|
||||
}) => {
|
||||
const api = useApi()
|
||||
return api.post<ContractSuspension>('/contract_suspensions', {
|
||||
contractPeriodId: payload.contractPeriodId,
|
||||
startDate: payload.startDate,
|
||||
endDate: payload.endDate ?? null,
|
||||
comment: payload.comment ?? null
|
||||
}, {
|
||||
toastSuccessKey: 'Suspension créée',
|
||||
toastErrorKey: 'Erreur lors de la création de la suspension'
|
||||
})
|
||||
}
|
||||
|
||||
export const updateSuspension = async (
|
||||
id: number,
|
||||
payload: {
|
||||
startDate: string
|
||||
endDate?: string | null
|
||||
comment?: string | null
|
||||
}
|
||||
) => {
|
||||
const api = useApi()
|
||||
return api.patch<ContractSuspension>(`/contract_suspensions/${id}`, {
|
||||
startDate: payload.startDate,
|
||||
endDate: payload.endDate ?? null,
|
||||
comment: payload.comment ?? null
|
||||
}, {
|
||||
toastSuccessKey: 'Suspension modifiée',
|
||||
toastErrorKey: 'Erreur lors de la modification de la suspension'
|
||||
})
|
||||
}
|
||||
@@ -10,5 +10,6 @@ export type EmployeeLeaveSummary = {
|
||||
takenSaturdays: number
|
||||
fractionedDays: number
|
||||
accruingDays: number
|
||||
presenceDaysByMonth: Record<string, number>
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
import type { Site } from './site'
|
||||
import type { Contract } from './contract'
|
||||
|
||||
export type ContractSuspension = {
|
||||
id: number
|
||||
startDate: string
|
||||
endDate?: string | null
|
||||
comment?: string | null
|
||||
}
|
||||
|
||||
export type ContractHistoryItem = {
|
||||
contractId?: number | null
|
||||
contractName?: string | null
|
||||
@@ -9,6 +16,8 @@ export type ContractHistoryItem = {
|
||||
startDate: string
|
||||
endDate?: string | null
|
||||
comment?: string | null
|
||||
periodId?: number | null
|
||||
suspensions?: ContractSuspension[]
|
||||
}
|
||||
|
||||
export type Employee = {
|
||||
@@ -23,4 +32,5 @@ export type Employee = {
|
||||
contractHistory?: ContractHistoryItem[]
|
||||
displayOrder?: number
|
||||
entryDate?: string | null
|
||||
currentSuspensions?: ContractSuspension[]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user