Merge branch 'polishing-calendar' into #74-vacation-calendar

# Conflicts:
#	resources/js/Pages/Calendar.vue
This commit is contained in:
Adrian Hopek
2022-03-16 14:54:30 +01:00
12 changed files with 316 additions and 21 deletions

View File

@@ -44,6 +44,7 @@ class CalendarGenerator
"isWeekend" => $day->isWeekend(),
"isHoliday" => $holidays->contains($day),
"vacations" => $vacationsForDay->pluck("user_id"),
"vacationTypes" => $vacationsForDay->pluck("vacationRequest.type", "user_id"),
];
}
@@ -55,6 +56,7 @@ class CalendarGenerator
return Vacation::query()
->whereBetween("date", [$period->start, $period->end])
->whereRelation("vacationRequest", fn(Builder $query) => $query->states(VacationRequestStatesRetriever::successStates()))
->with("vacationRequest")
->get()
->groupBy(fn(Vacation $vacation) => $vacation->date->toDateString());
}

View File

@@ -16,7 +16,7 @@ class VacationRequestResource extends JsonResource
"id" => $this->id,
"name" => $this->name,
"user" => new UserResource($this->user),
"type" => $this->type->label(),
"type" => $this->type,
"state" => $this->state,
"from" => $this->from->toDisplayString(),
"to" => $this->to->toDisplayString(),