This commit is contained in:
Adrian Hopek 2022-04-07 12:50:44 +02:00
parent 760c9bf514
commit d24517271d
2 changed files with 3 additions and 10 deletions

View File

@ -5,7 +5,6 @@ declare(strict_types=1);
namespace Toby\Infrastructure\Http\Controllers; namespace Toby\Infrastructure\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
use Inertia\Response; use Inertia\Response;
use Toby\Eloquent\Helpers\YearPeriodRetriever; use Toby\Eloquent\Helpers\YearPeriodRetriever;
use Toby\Eloquent\Models\Holiday; use Toby\Eloquent\Models\Holiday;
@ -18,24 +17,20 @@ class AnnualSummaryController extends Controller
{ {
$yearPeriod = $yearPeriodRetriever->selected(); $yearPeriod = $yearPeriodRetriever->selected();
$startDate = Carbon::createFromDate($yearPeriod->year)->startOfYear()->startOfWeek();
$endDate = Carbon::createFromDate($yearPeriod->year)->endOfYear()->endOfWeek();
$holidays = $yearPeriod->holidays() $holidays = $yearPeriod->holidays()
->whereBetween("date", [$startDate, $endDate])
->get(); ->get();
$vacations = $request->user() $vacations = $request->user()
->vacations() ->vacations()
->with("vacationRequest.vacations") ->with("vacationRequest.vacations")
->whereBetween("date", [$startDate, $endDate]) ->whereBelongsTo($yearPeriod)
->approved() ->approved()
->get(); ->get();
$pendingVacations = $request->user() $pendingVacations = $request->user()
->vacations() ->vacations()
->with("vacationRequest.vacations") ->with("vacationRequest.vacations")
->whereBetween("date", [$startDate, $endDate]) ->whereBelongsTo($yearPeriod)
->pending() ->pending()
->get(); ->get();

View File

@ -35,7 +35,6 @@
<Popper <Popper
v-if="day.isVacation || day.isPendingVacation" v-if="day.isVacation || day.isPendingVacation"
open-delay="200" open-delay="200"
arrow
hover hover
offset-distance="0" offset-distance="0"
> >
@ -56,7 +55,6 @@
<Popper <Popper
v-else-if="day.isHoliday" v-else-if="day.isHoliday"
open-delay="200" open-delay="200"
arrow
hover hover
offset-distance="0" offset-distance="0"
> >
@ -68,7 +66,7 @@
{{ day.date.day }} {{ day.date.day }}
</time> </time>
</button> </button>
<template #popper> <template #content>
<div class="py-2 px-6 text-sm font-semibold text-left text-gray-700 bg-white rounded-lg border border-gray-400"> <div class="py-2 px-6 text-sm font-semibold text-left text-gray-700 bg-white rounded-lg border border-gray-400">
{{ holidays[day.date.toISODate()] }} {{ holidays[day.date.toISODate()] }}
</div> </div>