163bf0891a
LST-66 (2.3) front. Companion to the backend module migration. - Move pages (absences, team-absences), 8 components, the absences service + DTO and the useAbsenceHelpers composable into frontend/modules/absence/ (auto-detected layer; composable now auto-imported). - Rewrite consumers: AdminAbsencePolicyTab and the time-tracking calendar (getPublicHolidays) point to ~/modules/absence/... - Middlewares (employee/admin) and shared services (clients, users, user-data DTO) stay at the root. i18n stays global. - Routes /absences and /team-absences preserved. nuxt build passes; routes confirmed.
77 lines
3.8 KiB
Vue
77 lines
3.8 KiB
Vue
<template>
|
|
<div class="flex flex-col gap-4 pt-2">
|
|
<div>
|
|
<h2 class="text-lg font-semibold text-neutral-900">{{ $t('absences.policies.title') }}</h2>
|
|
<p class="text-sm text-neutral-500">{{ $t('absences.policies.subtitle') }}</p>
|
|
</div>
|
|
|
|
<div class="overflow-x-auto">
|
|
<table class="w-full border-collapse text-sm">
|
|
<thead>
|
|
<tr class="border-b border-neutral-200 text-left text-neutral-500">
|
|
<th class="py-2 pr-3">{{ $t('absences.policies.type') }}</th>
|
|
<th class="py-2 px-2">{{ $t('absences.policies.daysPerYear') }}</th>
|
|
<th class="py-2 px-2">{{ $t('absences.policies.daysPerEvent') }}</th>
|
|
<th class="py-2 px-2">{{ $t('absences.policies.noticeDays') }}</th>
|
|
<th class="py-2 px-2 text-center">{{ $t('absences.policies.justificationRequired') }}</th>
|
|
<th class="py-2 px-2 text-center">{{ $t('absences.policies.countWorkingDaysOnly') }}</th>
|
|
<th class="py-2 px-2 text-center">{{ $t('absences.policies.active') }}</th>
|
|
<th class="py-2 pl-2" />
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr v-for="row in rows" :key="row.id" class="border-b border-neutral-100">
|
|
<td class="py-2 pr-3 font-medium text-neutral-800">{{ row.label }}</td>
|
|
<td class="py-2 px-2">
|
|
<input v-model.number="row.daysPerYear" type="number" step="0.5" class="w-20 rounded border border-neutral-300 px-2 py-1">
|
|
</td>
|
|
<td class="py-2 px-2">
|
|
<input v-model.number="row.daysPerEvent" type="number" step="0.5" class="w-20 rounded border border-neutral-300 px-2 py-1">
|
|
</td>
|
|
<td class="py-2 px-2">
|
|
<input v-model.number="row.noticeDays" type="number" class="w-16 rounded border border-neutral-300 px-2 py-1">
|
|
</td>
|
|
<td class="py-2 px-2 text-center">
|
|
<input v-model="row.justificationRequired" type="checkbox" class="h-4 w-4">
|
|
</td>
|
|
<td class="py-2 px-2 text-center">
|
|
<input v-model="row.countWorkingDaysOnly" type="checkbox" class="h-4 w-4">
|
|
</td>
|
|
<td class="py-2 px-2 text-center">
|
|
<input v-model="row.active" type="checkbox" class="h-4 w-4">
|
|
</td>
|
|
<td class="py-2 pl-2 text-right">
|
|
<MalioButton :label="$t('absences.policies.save')" variant="secondary" @click="save(row)" />
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import type { AbsencePolicy } from '~/modules/absence/services/dto/absence'
|
|
import { useAbsenceService } from '~/modules/absence/services/absences'
|
|
|
|
const service = useAbsenceService()
|
|
const rows = ref<AbsencePolicy[]>([])
|
|
|
|
async function load() {
|
|
rows.value = await service.getPolicies()
|
|
}
|
|
|
|
async function save(row: AbsencePolicy) {
|
|
await service.updatePolicy(row.id, {
|
|
daysPerYear: row.daysPerYear === null || Number.isNaN(row.daysPerYear) ? null : Number(row.daysPerYear),
|
|
daysPerEvent: row.daysPerEvent === null || Number.isNaN(row.daysPerEvent) ? null : Number(row.daysPerEvent),
|
|
noticeDays: Number(row.noticeDays),
|
|
justificationRequired: row.justificationRequired,
|
|
countWorkingDaysOnly: row.countWorkingDaysOnly,
|
|
active: row.active,
|
|
})
|
|
}
|
|
|
|
onMounted(load)
|
|
</script>
|