#120 - remote work (#127)

* #120 - wip

* #120 - add icon to home office

* #120 - wip

* #120 - wip

* #120 - wip

* #120 - wip

* #120 - wip

* #120 - ui fixes

* #120 - fix

* #120 - fix

* #120 - fix

* #120 - fix

* #120 - translation fix

* #120 - fix

Co-authored-by: EwelinaLasowy <ewelina.lasowy@blumilk.pl>
This commit is contained in:
Adrian Hopek
2022-04-21 07:44:22 +02:00
committed by GitHub
parent cc981b02b4
commit c95d08c861
34 changed files with 277 additions and 86 deletions

View File

@@ -34,10 +34,10 @@ class UserVacationStatsRetriever
public function getUsedVacationDaysByMonth(User $user, YearPeriod $yearPeriod): Collection
{
return $user->vacations()
->whereBelongsTo($yearPeriod)
->whereRelation(
"vacationRequest",
fn(Builder $query): Builder => $query
->whereBelongsTo($yearPeriod)
->whereIn("type", $this->getLimitableVacationTypes())
->states(VacationRequestStatesRetriever::successStates()),
)
@@ -69,11 +69,21 @@ class UserVacationStatsRetriever
"vacationRequest",
fn(Builder $query): Builder => $query
->whereIn("type", $this->getNotLimitableVacationTypes())
->whereNot("type", VacationType::HomeOffice)
->states(VacationRequestStatesRetriever::successStates()),
)
->count();
}
public function getHomeOfficeDays(User $user, YearPeriod $yearPeriod): int
{
return $user
->vacations()
->whereBelongsTo($yearPeriod)
->whereRelation("vacationRequest", "type", VacationType::HomeOffice)
->count();
}
public function getRemainingVacationDays(User $user, YearPeriod $yearPeriod): int
{
$limit = $this->getVacationDaysLimit($user, $yearPeriod);