From d24517271d4db4a3d82617bea463b4a7a183cc58 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Thu, 7 Apr 2022 12:50:44 +0200 Subject: [PATCH] fix --- .../Http/Controllers/AnnualSummaryController.php | 9 ++------- resources/js/Pages/AnnualSummary.vue | 4 +--- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/app/Infrastructure/Http/Controllers/AnnualSummaryController.php b/app/Infrastructure/Http/Controllers/AnnualSummaryController.php index b911615..c8394c6 100644 --- a/app/Infrastructure/Http/Controllers/AnnualSummaryController.php +++ b/app/Infrastructure/Http/Controllers/AnnualSummaryController.php @@ -5,7 +5,6 @@ declare(strict_types=1); namespace Toby\Infrastructure\Http\Controllers; use Illuminate\Http\Request; -use Illuminate\Support\Carbon; use Inertia\Response; use Toby\Eloquent\Helpers\YearPeriodRetriever; use Toby\Eloquent\Models\Holiday; @@ -18,24 +17,20 @@ class AnnualSummaryController extends Controller { $yearPeriod = $yearPeriodRetriever->selected(); - $startDate = Carbon::createFromDate($yearPeriod->year)->startOfYear()->startOfWeek(); - $endDate = Carbon::createFromDate($yearPeriod->year)->endOfYear()->endOfWeek(); - $holidays = $yearPeriod->holidays() - ->whereBetween("date", [$startDate, $endDate]) ->get(); $vacations = $request->user() ->vacations() ->with("vacationRequest.vacations") - ->whereBetween("date", [$startDate, $endDate]) + ->whereBelongsTo($yearPeriod) ->approved() ->get(); $pendingVacations = $request->user() ->vacations() ->with("vacationRequest.vacations") - ->whereBetween("date", [$startDate, $endDate]) + ->whereBelongsTo($yearPeriod) ->pending() ->get(); diff --git a/resources/js/Pages/AnnualSummary.vue b/resources/js/Pages/AnnualSummary.vue index 5ad34fc..72b7dba 100644 --- a/resources/js/Pages/AnnualSummary.vue +++ b/resources/js/Pages/AnnualSummary.vue @@ -35,7 +35,6 @@ @@ -56,7 +55,6 @@ @@ -68,7 +66,7 @@ {{ day.date.day }} -