feat(overtime-contingent) : export drawer (année + sites) sur la liste employés
This commit is contained in:
@@ -240,6 +240,21 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div v-else-if="exportChoice === 'overtime-contingent'" class="flex flex-col gap-4">
|
||||||
|
<MalioSelect
|
||||||
|
:model-value="exportYear"
|
||||||
|
:options="exportYearOptions"
|
||||||
|
label="Année *"
|
||||||
|
min-width=""
|
||||||
|
@update:model-value="(v) => { if (v !== null) exportYear = Number(v) }"
|
||||||
|
/>
|
||||||
|
<MalioSelectCheckbox
|
||||||
|
v-model="exportSiteIds"
|
||||||
|
:options="siteOptions"
|
||||||
|
label="Sites"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="flex justify-center pt-2">
|
<div class="flex justify-center pt-2">
|
||||||
<MalioButton
|
<MalioButton
|
||||||
label="Valider"
|
label="Valider"
|
||||||
@@ -274,16 +289,18 @@ const isDrawerOpen = ref(false)
|
|||||||
const isSubmitting = ref(false)
|
const isSubmitting = ref(false)
|
||||||
const isLoading = ref(false)
|
const isLoading = ref(false)
|
||||||
const isExportDrawerOpen = ref(false)
|
const isExportDrawerOpen = ref(false)
|
||||||
const exportChoice = ref<'leave-recap' | 'salary-recap' | 'yearly-hours' | 'night-contingent' | ''>('')
|
const exportChoice = ref<'leave-recap' | 'salary-recap' | 'yearly-hours' | 'night-contingent' | 'overtime-contingent' | ''>('')
|
||||||
const exportYear = ref<number>(new Date().getFullYear())
|
const exportYear = ref<number>(new Date().getFullYear())
|
||||||
const exportMonth = ref<number | ''>(new Date().getMonth() + 1)
|
const exportMonth = ref<number | ''>(new Date().getMonth() + 1)
|
||||||
const exportSalaryMonth = ref<string>(`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, '0')}`)
|
const exportSalaryMonth = ref<string>(`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, '0')}`)
|
||||||
|
const exportSiteIds = ref<number[]>([])
|
||||||
|
|
||||||
const exportTypeOptions = [
|
const exportTypeOptions = [
|
||||||
{ label: 'Récap. congés', value: 'leave-recap' },
|
{ label: 'Récap. congés', value: 'leave-recap' },
|
||||||
{ label: 'Récap. salaire', value: 'salary-recap' },
|
{ label: 'Récap. salaire', value: 'salary-recap' },
|
||||||
{ label: 'Heures annuelles', value: 'yearly-hours' },
|
{ label: 'Heures annuelles', value: 'yearly-hours' },
|
||||||
{ label: 'Contingent H.nuit', value: 'night-contingent' }
|
{ label: 'Contingent H.nuit', value: 'night-contingent' },
|
||||||
|
{ label: 'Contingent H.supp.', value: 'overtime-contingent' }
|
||||||
]
|
]
|
||||||
const exportYearOptions = computed(() => {
|
const exportYearOptions = computed(() => {
|
||||||
const current = new Date().getFullYear()
|
const current = new Date().getFullYear()
|
||||||
@@ -315,11 +332,14 @@ const isExportValid = computed(() => {
|
|||||||
if (exportChoice.value === 'night-contingent') {
|
if (exportChoice.value === 'night-contingent') {
|
||||||
return exportYear.value > 0
|
return exportYear.value > 0
|
||||||
}
|
}
|
||||||
|
if (exportChoice.value === 'overtime-contingent') {
|
||||||
|
return exportYear.value > 0
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
||||||
const onExportChoiceChange = (value: string | number | null) => {
|
const onExportChoiceChange = (value: string | number | null) => {
|
||||||
exportChoice.value = (value === null ? '' : String(value)) as 'leave-recap' | 'salary-recap' | 'yearly-hours' | 'night-contingent' | ''
|
exportChoice.value = (value === null ? '' : String(value)) as 'leave-recap' | 'salary-recap' | 'yearly-hours' | 'night-contingent' | 'overtime-contingent' | ''
|
||||||
}
|
}
|
||||||
const { printPdf } = usePdfPrinter()
|
const { printPdf } = usePdfPrinter()
|
||||||
const sitesInitialized = ref(false)
|
const sitesInitialized = ref(false)
|
||||||
@@ -619,6 +639,7 @@ const openExportDrawer = () => {
|
|||||||
exportYear.value = now.getFullYear()
|
exportYear.value = now.getFullYear()
|
||||||
exportMonth.value = now.getMonth() + 1
|
exportMonth.value = now.getMonth() + 1
|
||||||
exportSalaryMonth.value = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}`
|
exportSalaryMonth.value = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}`
|
||||||
|
exportSiteIds.value = []
|
||||||
isExportDrawerOpen.value = true
|
isExportDrawerOpen.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -634,6 +655,9 @@ const handleExportValidate = async () => {
|
|||||||
await printPdf(`/yearly-hours/print-all?year=${exportYear.value}&month=${exportMonth.value}`)
|
await printPdf(`/yearly-hours/print-all?year=${exportYear.value}&month=${exportMonth.value}`)
|
||||||
} else if (choice === 'night-contingent') {
|
} else if (choice === 'night-contingent') {
|
||||||
await printPdf(`/night-hours-contingent/print?year=${exportYear.value}`)
|
await printPdf(`/night-hours-contingent/print?year=${exportYear.value}`)
|
||||||
|
} else if (choice === 'overtime-contingent') {
|
||||||
|
const siteParam = exportSiteIds.value.length > 0 ? `&siteIds=${exportSiteIds.value.join(',')}` : ''
|
||||||
|
await printPdf(`/overtime-contingent/print?year=${exportYear.value}${siteParam}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user