#120 - wip
This commit is contained in:
parent
889af3aaa2
commit
a149f05b9b
@ -34,10 +34,10 @@ class UserVacationStatsRetriever
|
|||||||
public function getUsedVacationDaysByMonth(User $user, YearPeriod $yearPeriod): Collection
|
public function getUsedVacationDaysByMonth(User $user, YearPeriod $yearPeriod): Collection
|
||||||
{
|
{
|
||||||
return $user->vacations()
|
return $user->vacations()
|
||||||
|
->whereBelongsTo($yearPeriod)
|
||||||
->whereRelation(
|
->whereRelation(
|
||||||
"vacationRequest",
|
"vacationRequest",
|
||||||
fn(Builder $query): Builder => $query
|
fn(Builder $query): Builder => $query
|
||||||
->whereBelongsTo($yearPeriod)
|
|
||||||
->whereIn("type", $this->getLimitableVacationTypes())
|
->whereIn("type", $this->getLimitableVacationTypes())
|
||||||
->states(VacationRequestStatesRetriever::successStates()),
|
->states(VacationRequestStatesRetriever::successStates()),
|
||||||
)
|
)
|
||||||
@ -69,11 +69,21 @@ class UserVacationStatsRetriever
|
|||||||
"vacationRequest",
|
"vacationRequest",
|
||||||
fn(Builder $query): Builder => $query
|
fn(Builder $query): Builder => $query
|
||||||
->whereIn("type", $this->getNotLimitableVacationTypes())
|
->whereIn("type", $this->getNotLimitableVacationTypes())
|
||||||
|
->whereNot("type", VacationType::HomeOffice)
|
||||||
->states(VacationRequestStatesRetriever::successStates()),
|
->states(VacationRequestStatesRetriever::successStates()),
|
||||||
)
|
)
|
||||||
->count();
|
->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
|
public function getRemainingVacationDays(User $user, YearPeriod $yearPeriod): int
|
||||||
{
|
{
|
||||||
$limit = $this->getVacationDaysLimit($user, $yearPeriod);
|
$limit = $this->getVacationDaysLimit($user, $yearPeriod);
|
||||||
@ -106,4 +116,5 @@ class UserVacationStatsRetriever
|
|||||||
|
|
||||||
return $types->filter(fn(VacationType $type) => !$this->configRetriever->hasLimit($type));
|
return $types->filter(fn(VacationType $type) => !$this->configRetriever->hasLimit($type));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,7 @@ class DashboardController extends Controller
|
|||||||
$limit = $vacationStatsRetriever->getVacationDaysLimit($user, $yearPeriod);
|
$limit = $vacationStatsRetriever->getVacationDaysLimit($user, $yearPeriod);
|
||||||
$used = $vacationStatsRetriever->getUsedVacationDays($user, $yearPeriod);
|
$used = $vacationStatsRetriever->getUsedVacationDays($user, $yearPeriod);
|
||||||
$pending = $vacationStatsRetriever->getPendingVacationDays($user, $yearPeriod);
|
$pending = $vacationStatsRetriever->getPendingVacationDays($user, $yearPeriod);
|
||||||
|
$homeOffice = $vacationStatsRetriever->getHomeOfficeDays($user, $yearPeriod);
|
||||||
$other = $vacationStatsRetriever->getOtherApprovedVacationDays($user, $yearPeriod);
|
$other = $vacationStatsRetriever->getOtherApprovedVacationDays($user, $yearPeriod);
|
||||||
$remaining = $limit - $used - $pending;
|
$remaining = $limit - $used - $pending;
|
||||||
|
|
||||||
@ -69,6 +70,7 @@ class DashboardController extends Controller
|
|||||||
"remaining" => $remaining,
|
"remaining" => $remaining,
|
||||||
"used" => $used,
|
"used" => $used,
|
||||||
"pending" => $pending,
|
"pending" => $pending,
|
||||||
|
"homeOffice" => $homeOffice,
|
||||||
"other" => $other,
|
"other" => $other,
|
||||||
],
|
],
|
||||||
"can" => [
|
"can" => [
|
||||||
|
@ -25,6 +25,7 @@ return [
|
|||||||
VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [
|
VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [
|
||||||
EmploymentForm::EmploymentContract,
|
EmploymentForm::EmploymentContract,
|
||||||
],
|
],
|
||||||
|
VacationTypeConfigRetriever::KEY_IS_VACATION => true,
|
||||||
],
|
],
|
||||||
VacationType::TimeInLieu->value => [
|
VacationType::TimeInLieu->value => [
|
||||||
VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => false,
|
VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => false,
|
||||||
@ -34,6 +35,7 @@ return [
|
|||||||
VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [
|
VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [
|
||||||
EmploymentForm::EmploymentContract,
|
EmploymentForm::EmploymentContract,
|
||||||
],
|
],
|
||||||
|
VacationTypeConfigRetriever::KEY_IS_VACATION => true,
|
||||||
],
|
],
|
||||||
VacationType::Sick->value => [
|
VacationType::Sick->value => [
|
||||||
VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => false,
|
VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => false,
|
||||||
@ -83,6 +85,7 @@ return [
|
|||||||
VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [
|
VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [
|
||||||
EmploymentForm::EmploymentContract,
|
EmploymentForm::EmploymentContract,
|
||||||
],
|
],
|
||||||
|
VacationTypeConfigRetriever::KEY_IS_VACATION => true,
|
||||||
],
|
],
|
||||||
VacationTypeConfigRetriever::KEY_IS_VACATION => true,
|
VacationTypeConfigRetriever::KEY_IS_VACATION => true,
|
||||||
VacationType::Volunteering->value => [
|
VacationType::Volunteering->value => [
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
Twój roczny limit urlopu wypoczynkowego.
|
Twój roczny limit urlopu wypoczynkowego.
|
||||||
</dt>
|
</dt>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-span-2 py-5 px-4 bg-white shadow-md sm:p-6">
|
<div class="py-5 px-4 bg-white shadow-md sm:p-6">
|
||||||
<dt class="mt-1 text-4xl font-semibold text-gray-900">
|
<dt class="mt-1 text-4xl font-semibold text-gray-900">
|
||||||
{{ stats.other }}
|
{{ stats.other }}
|
||||||
</dt>
|
</dt>
|
||||||
@ -60,6 +60,17 @@
|
|||||||
Urlopy bezpłatne, okolicznościowe, zwolnienia lekarskie, itd., które zostały już zatwierdzone.
|
Urlopy bezpłatne, okolicznościowe, zwolnienia lekarskie, itd., które zostały już zatwierdzone.
|
||||||
</dt>
|
</dt>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="py-5 px-4 bg-white shadow-md sm:p-6">
|
||||||
|
<dt class="mt-1 text-4xl font-semibold text-gray-900">
|
||||||
|
{{ stats.homeOffice }}
|
||||||
|
</dt>
|
||||||
|
<dd class="font-medium text-gray-700 truncate text-md">
|
||||||
|
Biuro w domu
|
||||||
|
</dd>
|
||||||
|
<dt class="mt-2 text-sm font-medium text-gray-500">
|
||||||
|
Biuro w domku
|
||||||
|
</dt>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user