diff --git a/resources/js/Pages/VacationRequest/Create.vue b/resources/js/Pages/VacationRequest/Create.vue index 499234d..b990620 100644 --- a/resources/js/Pages/VacationRequest/Create.vue +++ b/resources/js/Pages/VacationRequest/Create.vue @@ -349,7 +349,7 @@ const props = defineProps({ const form = useForm({ user: props.can.createOnBehalfOfEmployee - ? props.users.data.find(user => user.id === (props.vacationUserId ?? 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: props.vacationFromDate, to: props.vacationFromDate, @@ -427,6 +427,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 })