From 93f0151b14d32677983ddbe5edbf33031ed55151 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 29 Mar 2022 13:40:56 +0200 Subject: [PATCH] wip --- app/Eloquent/Helpers/YearPeriodRetriever.php | 8 +- .../Http/Controllers/GoogleController.php | 2 +- resources/js/Composables/yearPeriodInfo.js | 4 +- resources/js/Pages/Calendar.vue | 21 +++-- resources/js/Pages/VacationLimits.vue | 2 +- resources/js/Pages/VacationRequest/Create.vue | 8 +- resources/js/Pages/VacationRequest/Index.vue | 8 +- .../VacationRequest/IndexForApprovers.vue | 10 +-- resources/js/Pages/VacationRequest/Show.vue | 23 +++--- resources/js/Shared/MainMenu.vue | 73 +++++++++-------- .../Widgets/PendingVacationRequests.vue | 4 +- .../Shared/Widgets/UserVacationRequests.vue | 4 +- resources/js/app.js | 2 +- routes/web.php | 78 +++++++++---------- 14 files changed, 126 insertions(+), 121 deletions(-) diff --git a/app/Eloquent/Helpers/YearPeriodRetriever.php b/app/Eloquent/Helpers/YearPeriodRetriever.php index 1cf3999..ad8b98f 100644 --- a/app/Eloquent/Helpers/YearPeriodRetriever.php +++ b/app/Eloquent/Helpers/YearPeriodRetriever.php @@ -30,13 +30,15 @@ class YearPeriodRetriever public function links(): array { - $current = $this->selected(); + $selected = $this->selected(); + $current = $this->current(); - $years = YearPeriod::query()->whereIn("year", $this->offset($current->year))->get(); + $years = YearPeriod::query()->whereIn("year", $this->offset($selected->year))->get(); $navigation = $years->map(fn(YearPeriod $yearPeriod) => $this->toNavigation($yearPeriod)); return [ - "current" => $current->year, + "current" => $this->toNavigation($current), + "selected" => $this->toNavigation($selected), "navigation" => $navigation->toArray(), ]; } diff --git a/app/Infrastructure/Http/Controllers/GoogleController.php b/app/Infrastructure/Http/Controllers/GoogleController.php index 6f15e8d..7733e7c 100644 --- a/app/Infrastructure/Http/Controllers/GoogleController.php +++ b/app/Infrastructure/Http/Controllers/GoogleController.php @@ -36,6 +36,6 @@ class GoogleController extends Controller $auth->guard()->login($user, true); - return redirect()->route("dashboard"); + return redirect()->intended(); } } diff --git a/resources/js/Composables/yearPeriodInfo.js b/resources/js/Composables/yearPeriodInfo.js index ec799da..b62eb05 100644 --- a/resources/js/Composables/yearPeriodInfo.js +++ b/resources/js/Composables/yearPeriodInfo.js @@ -2,8 +2,8 @@ import { computed } from 'vue' import { usePage } from '@inertiajs/inertia-vue3' export default function useCurrentYearPeriodInfo() { - const minDate = computed(() => new Date(usePage().props.value.years.current, 0, 1)) - const maxDate = computed(() => new Date(usePage().props.value.years.current, 11, 31)) + const minDate = computed(() => new Date(usePage().props.value.years.selected.year, 0, 1)) + const maxDate = computed(() => new Date(usePage().props.value.years.selected.year, 11, 31)) return { minDate, diff --git a/resources/js/Pages/Calendar.vue b/resources/js/Pages/Calendar.vue index 812055f..6014f57 100644 --- a/resources/js/Pages/Calendar.vue +++ b/resources/js/Pages/Calendar.vue @@ -10,7 +10,7 @@ @@ -23,7 +23,7 @@