From e365de21cfc912bdc287292326b0dda686f32da0 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Wed, 16 Mar 2022 13:39:27 +0100 Subject: [PATCH] #74 - wip --- .../VacationCalendarController.php | 4 ++++ resources/js/Pages/Calendar.vue | 19 ++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/app/Infrastructure/Http/Controllers/VacationCalendarController.php b/app/Infrastructure/Http/Controllers/VacationCalendarController.php index 95353b3..c3d72a9 100644 --- a/app/Infrastructure/Http/Controllers/VacationCalendarController.php +++ b/app/Infrastructure/Http/Controllers/VacationCalendarController.php @@ -22,15 +22,19 @@ class VacationCalendarController extends Controller ?string $month = null, ): Response { $month = Month::fromNameOrCurrent((string)$month); + $currentUser = $request->user(); $yearPeriod = $yearPeriodRetriever->selected(); $carbonMonth = Carbon::create($yearPeriod->year, $month->toCarbonNumber()); $users = User::query() + ->where("id", "!=", $currentUser->id) ->orderBy("last_name") ->orderBy("first_name") ->get(); + $users->prepend($currentUser); + $calendar = $calendarGenerator->generate($carbonMonth); return inertia("Calendar", [ diff --git a/resources/js/Pages/Calendar.vue b/resources/js/Pages/Calendar.vue index 4c0ade2..20ae66a 100644 --- a/resources/js/Pages/Calendar.vue +++ b/resources/js/Pages/Calendar.vue @@ -17,7 +17,7 @@
- +
@@ -71,7 +71,8 @@ v-for="day in calendar" :key="day.dayOfMonth" class="border border-gray-300 text-lg font-semibold text-gray-900 py-4 px-2" - :class="{ 'text-blumilk-600 bg-blumilk-25 font-black': day.isToday }" + style="min-width: 46px;" + :class="{ 'bg-red-100 text-red-800': day.isWeekend || day.isHoliday, 'text-blumilk-600 bg-blumilk-25': day.isToday }" >
{{ day.dayOfMonth }} @@ -87,7 +88,9 @@ v-for="user in users.data" :key="user.id" > -
+
-
+
{{ user.name }}
@@ -106,7 +111,7 @@ v-for="day in calendar" :key="day.dayOfMonth" class="border border-gray-300" - :class="{'bg-red-100': day.isWeekend || day.isHoliday, 'bg-blumilk-500': day.vacations.includes(user.id) }" + :class="{ 'bg-blumilk-25': day.isToday, 'bg-red-100': day.isWeekend || day.isHoliday, 'bg-blumilk-500': day.vacations.includes(user.id) }" >
null, }, + auth: { + type: Object, + default: () => null, + }, calendar: { type: Object, default: () => null,