Merge branch 'main' into #153-behaviour-of-buttons

This commit is contained in:
2022-06-08 14:14:30 +02:00
10 changed files with 92 additions and 16 deletions

View File

@@ -344,19 +344,23 @@ const props = defineProps({
users: Object,
holidays: Object,
can: Object,
vacationUserId: [Number, null],
vacationFromDate: [String, null],
})
const form = useForm({
user: props.can.createOnBehalfOfEmployee
? props.users.data.find(user => user.id === props.auth.user.id) ?? props.users.data[0]
? props.users.data.find(user => user.id === (checkUserId(props.vacationUserId) ?? props.auth.user.id)) ?? props.users.data[0]
: props.auth.user,
from: null,
to: null,
from: props.vacationFromDate,
to: props.vacationFromDate,
vacationType: null,
comment: null,
flowSkipped: false,
})
refreshEstimatedDays(form.from, form.to)
const estimatedDays = ref([])
const vacationTypes = ref([])
@@ -424,6 +428,10 @@ function resetForm() {
estimatedDays.value = []
}
function checkUserId(userId) {
return userId > 0 ? userId: null
}
async function refreshEstimatedDays(from, to) {
if (from && to) {
const res = await axios.post('/api/vacation/calculate-days', { from, to })

View File

@@ -176,7 +176,14 @@
colspan="100%"
class="py-4 text-xl leading-5 text-center text-gray-700"
>
Brak danych
<EmptyState>
<template #title>
Brak wniosków
</template>
<template #text>
Nie znaleziono wniosków o danym statusie
</template>
</EmptyState>
</td>
</tr>
</tbody>
@@ -195,6 +202,7 @@ import { Listbox, ListboxButton, ListboxLabel, ListboxOption, ListboxOptions } f
import { reactive, watch } from 'vue'
import { debounce } from 'lodash'
import { Inertia } from '@inertiajs/inertia'
import EmptyState from '@/Shared/Feedbacks/EmptyState'
const props = defineProps({
requests: Object,