feat : ajout de la gestion RTT
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
import type { Contract } from '~/services/dto/contract'
|
||||
import type { Absence } from '~/services/dto/absence'
|
||||
import type { EmployeeLeaveSummary } from '~/services/dto/employee-leave-summary'
|
||||
import type { EmployeeRttSummary } from '~/services/dto/employee-rtt-summary'
|
||||
import type { ContractHistoryItem, Employee } from '~/services/dto/employee'
|
||||
import { CONTRACT_TYPES } from '~/services/dto/contract'
|
||||
import { listAbsences } from '~/services/absences'
|
||||
import { listContracts } from '~/services/contracts'
|
||||
import { getEmployeeLeaveSummary } from '~/services/employee-leave-summary'
|
||||
import { getEmployeeRttSummary } from '~/services/employee-rtt-summary'
|
||||
import { getEmployee, updateEmployee } from '~/services/employees'
|
||||
import { formatNullableYmdToFr, getTodayYmd, shiftYmd } from '~/utils/date'
|
||||
import { contractNatureLabel, isContractNature, requiresContractEndDate } from '~/utils/contract'
|
||||
@@ -19,6 +21,7 @@ export const useEmployeeDetailPage = () => {
|
||||
const contracts = ref<Contract[]>([])
|
||||
const employeeAbsences = ref<Absence[]>([])
|
||||
const leaveSummary = ref<EmployeeLeaveSummary | null>(null)
|
||||
const rttSummary = ref<EmployeeRttSummary | null>(null)
|
||||
const isContractDrawerOpen = ref(false)
|
||||
const isContractSubmitting = ref(false)
|
||||
const isCreateContractDrawerOpen = ref(false)
|
||||
@@ -188,13 +191,14 @@ export const useEmployeeDetailPage = () => {
|
||||
const leaveYear = isForfait
|
||||
? now.getFullYear()
|
||||
: (now.getMonth() >= 5 ? now.getFullYear() + 1 : now.getFullYear())
|
||||
const rttYear = now.getMonth() >= 5 ? now.getFullYear() + 1 : now.getFullYear()
|
||||
const from = isForfait
|
||||
? `${leaveYear}-01-01`
|
||||
: `${leaveYear - 1}-06-01`
|
||||
const to = isForfait
|
||||
? `${leaveYear}-12-31`
|
||||
: `${leaveYear}-05-31`
|
||||
const [absences, summary] = await Promise.all([
|
||||
const [absences, summary, rtt] = await Promise.all([
|
||||
listAbsences({
|
||||
from,
|
||||
to,
|
||||
@@ -202,10 +206,12 @@ export const useEmployeeDetailPage = () => {
|
||||
}),
|
||||
showLeaveTab.value
|
||||
? getEmployeeLeaveSummary(loadedEmployee.id, leaveYear)
|
||||
: Promise.resolve(null)
|
||||
: Promise.resolve(null),
|
||||
getEmployeeRttSummary(loadedEmployee.id, rttYear)
|
||||
])
|
||||
employeeAbsences.value = absences
|
||||
leaveSummary.value = summary
|
||||
rttSummary.value = rtt
|
||||
if (!showLeaveTab.value && activeTab.value === 'leave') {
|
||||
activeTab.value = 'contract'
|
||||
}
|
||||
@@ -302,6 +308,7 @@ export const useEmployeeDetailPage = () => {
|
||||
contracts,
|
||||
employeeAbsences,
|
||||
leaveSummary,
|
||||
rttSummary,
|
||||
showLeaveTab,
|
||||
contractHistory,
|
||||
employeeContractWorkLabel,
|
||||
|
||||
Reference in New Issue
Block a user