Merge branch 'main' into #43-vacation-summary-for-employee

# Conflicts:
#	app/Infrastructure/Http/Controllers/HolidayController.php
#	app/Infrastructure/Http/Controllers/VacationLimitController.php
#	app/Infrastructure/Http/Controllers/VacationRequestController.php
#	composer.lock
#	resources/js/Pages/Holidays/Index.vue
#	resources/js/Pages/VacationRequest/Create.vue
This commit is contained in:
Adrian Hopek
2022-03-02 10:01:14 +01:00
51 changed files with 1993 additions and 1401 deletions

View File

@@ -1,56 +0,0 @@
<?php
declare(strict_types=1);
namespace Toby\Domain\Enums;
enum VacationRequestState: string
{
case Created = "created";
case Cancelled = "cancelled";
case Rejected = "rejected";
case Approved = "approved";
case WaitingForTechnical = "waiting_for_technical";
case WaitingForAdministrative = "waiting_for_administrative";
case AcceptedByTechnical = "accepted_by_technical";
case AcceptedByAdministrative = "accepted_by_administrative";
public function label(): string
{
return __($this->value);
}
public static function pendingStates(): array
{
return [
self::Created,
self::WaitingForTechnical,
self::WaitingForAdministrative,
self::AcceptedByTechnical,
self::AcceptedByAdministrative,
];
}
public static function successStates(): array
{
return [self::Approved];
}
public static function failedStates(): array
{
return [
self::Rejected,
self::Cancelled,
];
}
public static function filterByStatus(string $filter): array
{
return match ($filter) {
"pending" => VacationRequestState::pendingStates(),
"success" => VacationRequestState::successStates(),
"failed" => VacationRequestState::failedStates(),
default => VacationRequestState::cases(),
};
}
}