@@ -175,7 +198,7 @@ watch(() => form.items, () => {
:from-previous-year="item.fromPreviousYear"
:limit="item.limit"
:to-next-year="item.toNextYear"
- :year="years.selected.year"
+ :year="year"
class="w-full"
>
form.items, () => {
diff --git a/resources/js/Pages/VacationRequest/Create.vue b/resources/js/Pages/VacationRequest/Create.vue
index 2931bde3..626e1873 100644
--- a/resources/js/Pages/VacationRequest/Create.vue
+++ b/resources/js/Pages/VacationRequest/Create.vue
@@ -3,11 +3,11 @@ import { useForm } from '@inertiajs/inertia-vue3'
import FlatPickr from 'vue-flatpickr-component'
import { Listbox, ListboxButton, ListboxLabel, ListboxOption, ListboxOptions, Switch } from '@headlessui/vue'
import { CheckIcon, ChevronUpDownIcon, XCircleIcon } from '@heroicons/vue/24/solid'
-import { reactive, ref, watch } from 'vue'
+import { computed, reactive, ref, watch } from 'vue'
import axios from 'axios'
-import useCurrentYearPeriodInfo from '@/Composables/yearPeriodInfo.js'
import VacationChart from '@/Shared/VacationChart.vue'
import VacationType from '@/Shared/VacationType.vue'
+import { DateTime } from 'luxon'
const props = defineProps({
auth: Object,
@@ -29,6 +29,7 @@ const form = useForm({
})
let isDirty = ref(false)
+const currentDate = DateTime.now()
watch(form, formData => {
const { from, to } = formData.data()
@@ -46,17 +47,15 @@ const stats = ref({
remaining: 0,
})
-const { minDate, maxDate } = useCurrentYearPeriodInfo()
-
-const fromInputConfig = reactive({
- minDate,
- maxDate,
+const year = computed(() => {
+ return form.from === null
+ ? currentDate.year
+ : DateTime.fromISO(form.from).year
})
-const toInputConfig = reactive({
- minDate,
- maxDate,
-})
+const fromInputConfig = reactive({})
+
+const toInputConfig = reactive({})
watch(() => form.user, user => {
resetForm()
@@ -70,6 +69,13 @@ watch(() => form.vacationType, vacationType => {
refreshUnavailableDays(form.user, vacationType)
})
+watch(year, () => {
+ refreshEstimatedDays(form.from, form.to, form.vacationType)
+ refreshUnavailableDays(form.user, form.vacationType)
+ refreshVacationStats(form.user)
+})
+
+
function createForm() {
form
.transform(data => ({
@@ -96,6 +102,7 @@ function onToChange(selectedDates, dateStr) {
return
}
+
refreshEstimatedDays(form.from, form.to, form.vacationType)
}
@@ -121,7 +128,7 @@ async function refreshEstimatedDays(from, to, vacationType) {
}
async function refreshVacationStats(user) {
- const res = await axios.post('/api/vacation/calculate-stats', { user: user.id })
+ const res = await axios.post('/api/vacation/calculate-stats', { user: user.id, year: year.value })
stats.value = res.data
}
@@ -129,7 +136,7 @@ async function refreshVacationStats(user) {
async function refreshUnavailableDays(user) {
const res = await axios.post(
'/api/vacation/calculate-unavailable-days',
- { user: user.id, vacationType: form.vacationType?.value },
+ { user: user.id, vacationType: form.vacationType?.value, year: year.value },
)
const unavailableDays = res.data
@@ -474,6 +481,9 @@ async function refreshAvailableTypes(user) {
Moje dane o urlopie
+
+ w roku {{ year }}
+
diff --git a/resources/js/Pages/VacationRequest/Index.vue b/resources/js/Pages/VacationRequest/Index.vue
index 010f7918..f22ed7ff 100644
--- a/resources/js/Pages/VacationRequest/Index.vue
+++ b/resources/js/Pages/VacationRequest/Index.vue
@@ -8,6 +8,8 @@ import { reactive, watch } from 'vue'
import { debounce } from 'lodash'
import { Inertia } from '@inertiajs/inertia'
import EmptyState from '@/Shared/Feedbacks/EmptyState.vue'
+import { DateTime } from 'luxon'
+import YearPicker from '@/Shared/Forms/YearPicker.vue'
const props = defineProps({
requests: Object,
@@ -15,6 +17,8 @@ const props = defineProps({
filters: Object,
})
+const currentDate = DateTime.now()
+
const statuses = [
{
name: 'Wszystkie',
@@ -37,10 +41,11 @@ const statuses = [
const form = reactive({
status: statuses.find(status => status.value === props.filters.status) ?? statuses[0],
withoutRemote: props.filters.withoutRemote ?? false,
+ year: props.filters.year,
})
watch(form, debounce(() => {
- Inertia.get('/vacation/requests/me', { status: form.status.value, withoutRemote: form.withoutRemote }, {
+ Inertia.get('/vacation/requests/me', { status: form.status.value, year: form.year, withoutRemote: form.withoutRemote }, {
preserveState: true,
replace: false,
})
@@ -53,7 +58,13 @@ watch(form, debounce(() => {
- Moje wnioski
+ Moje wnioski w roku
+
user.id === props.filters.user) ?? null,
status: statuses.find(status => status.value === props.filters.status) ?? statuses[0],
type: props.types.find(type => type.value === props.filters.type) ?? null,
+ year: props.filters.year ?? null,
})
watch(form, debounce(() => {
@@ -50,6 +55,7 @@ watch(form, debounce(() => {
user: form.user?.id,
status: form.status.value,
type: form.type?.value,
+ year: form.year,
}, {
preserveState: true,
replace: true,
@@ -76,7 +82,7 @@ watch(form, debounce(() => {
diff --git a/resources/js/Shared/CalendarComponent.vue b/resources/js/Shared/CalendarComponent.vue
index 1ce458d5..0a7a8889 100644
--- a/resources/js/Shared/CalendarComponent.vue
+++ b/resources/js/Shared/CalendarComponent.vue
@@ -1,11 +1,11 @@
+
+
+
+
+
+ {{ label }}
+
+
+
+
+ {{ value !== null || !nullable ? value : 'Wszystkie' }}
+
+
+
+
+
+
+
+
+
+
+ Wszystkie
+
+
+
+
+
+
+
+
+ {{ item }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/resources/js/Shared/Layout/AppLayout.vue b/resources/js/Shared/Layout/AppLayout.vue
index 20ff0abe..32d537e2 100644
--- a/resources/js/Shared/Layout/AppLayout.vue
+++ b/resources/js/Shared/Layout/AppLayout.vue
@@ -9,7 +9,6 @@ import { updateFavicon } from '@/Shared/updateFavicon'
const props = defineProps({
flash: Object,
auth: Object,
- years: Object,
vacationRequestsCount: Number,
overtimeRequestsCount: Number,
deployInformation: Object,
@@ -53,7 +52,6 @@ function vacationPageOpened() {
:show-refresh-button="isUpdated"
:vacation-requests-count="vacationRequestsCount"
:overtime-requests-count="overtimeRequestsCount"
- :years="years"
@open="vacationPageOpened"
/>
diff --git a/resources/js/Shared/MainMenu.vue b/resources/js/Shared/MainMenu.vue
index 97489cb3..c2ddf4fc 100644
--- a/resources/js/Shared/MainMenu.vue
+++ b/resources/js/Shared/MainMenu.vue
@@ -33,11 +33,10 @@ import {
XMarkIcon,
ClockIcon,
} from '@heroicons/vue/24/outline'
-import { CheckIcon, ChevronDownIcon } from '@heroicons/vue/24/solid'
+import { ChevronDownIcon } from '@heroicons/vue/24/solid'
const props = defineProps({
auth: Object,
- years: Object,
vacationRequestsCount: Number,
overtimeRequestsCount: Number,
showRefreshButton: Boolean,
@@ -405,89 +404,20 @@ const emit = defineEmits(['open'])
>
-
-
-
-
-
-
+
+
+
+ Odśwież
+
+
+
- Przeniesione na {{ year + 1 }}
+ Przeniesione na {{ year }}
{{ toNextYear ?? 0 }}
diff --git a/resources/js/Shared/Widgets/VacationCalendar.vue b/resources/js/Shared/Widgets/VacationCalendar.vue
index 71a016fb..63e326b4 100644
--- a/resources/js/Shared/Widgets/VacationCalendar.vue
+++ b/resources/js/Shared/Widgets/VacationCalendar.vue
@@ -1,10 +1,9 @@