#22 - wip
This commit is contained in:
		| @@ -7,7 +7,6 @@ namespace Toby\Infrastructure\Http\Controllers; | ||||
| use Carbon\CarbonImmutable; | ||||
| use Carbon\CarbonInterface; | ||||
| use Carbon\CarbonPeriod; | ||||
| use Illuminate\Database\Eloquent\Relations\BelongsTo; | ||||
| use Illuminate\Http\Request; | ||||
| use Inertia\Response; | ||||
| use Toby\Domain\Enums\VacationRequestState; | ||||
| @@ -29,7 +28,7 @@ class VacationCalendarController extends Controller | ||||
|             ->with([ | ||||
|                 "vacations" => fn($query) => $query | ||||
|                     ->whereBetween("date", [$period->start, $period->end]) | ||||
|                     ->whereRelation("vacationRequest", "state", VacationRequestState::APPROVED->value) | ||||
|                     ->whereRelation("vacationRequest", "state", VacationRequestState::APPROVED->value), | ||||
|             ]) | ||||
|             ->orderBy("last_name") | ||||
|             ->orderBy("first_name") | ||||
| @@ -54,7 +53,7 @@ class VacationCalendarController extends Controller | ||||
|         foreach ($users as $user) { | ||||
|             $userVacations[] = [ | ||||
|                 "user" => new UserResource($user), | ||||
|                 "vacations" => $user->vacations->map(fn (Vacation $vacation) => $vacation->date->toDateString()), | ||||
|                 "vacations" => $user->vacations->map(fn(Vacation $vacation) => $vacation->date->toDateString()), | ||||
|             ]; | ||||
|         } | ||||
|  | ||||
| @@ -67,7 +66,7 @@ class VacationCalendarController extends Controller | ||||
|  | ||||
|     protected function monthNameToNumber(?string $name): int | ||||
|     { | ||||
|         return match($name) { | ||||
|         return match ($name) { | ||||
|             default => CarbonInterface::JANUARY, | ||||
|             "february" => CarbonInterface::FEBRUARY, | ||||
|             "march" => CarbonInterface::MARCH, | ||||
|   | ||||
| @@ -80,7 +80,7 @@ class VacationRequestController extends Controller | ||||
|         $days = $vacationDaysCalculator->calculateDays( | ||||
|             $vacationRequest->yearPeriod, | ||||
|             $vacationRequest->from, | ||||
|             $vacationRequest->to | ||||
|             $vacationRequest->to, | ||||
|         ); | ||||
|  | ||||
|         foreach ($days as $day) { | ||||
|   | ||||
| @@ -13,9 +13,11 @@ class VacationRequestActivityResource extends JsonResource | ||||
|     public function toArray($request): array | ||||
|     { | ||||
|         return [ | ||||
|             "date" => $this->created_at->toDisplayString(), | ||||
|             "who" => $this->user ? $this->user->fullName : __("System"), | ||||
|             "to" => $this->to->label(), | ||||
|             "date" => $this->created_at->format("d.m.Y"), | ||||
|             "time" => $this->created_at->format("H:i"), | ||||
|             "user" => $this->user ? $this->user->fullName : __("System"), | ||||
|             "state" => $this->to, | ||||
|             "text" => $this->to->label(), | ||||
|         ]; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -17,7 +17,7 @@ class VacationRequestResource extends JsonResource | ||||
|             "name" => $this->name, | ||||
|             "user" => new UserResource($this->user), | ||||
|             "type" => $this->type->label(), | ||||
|             "state" => $this->state->label(), | ||||
|             "state" => $this->state, | ||||
|             "from" => $this->from->toDisplayString(), | ||||
|             "to" => $this->to->toDisplayString(), | ||||
|             "comment" => $this->comment, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user