diff --git a/app/Domain/Enums/VacationType.php b/app/Domain/Enums/VacationType.php index 71bdd41..a93ca3d 100644 --- a/app/Domain/Enums/VacationType.php +++ b/app/Domain/Enums/VacationType.php @@ -18,6 +18,7 @@ enum VacationType: string case TimeInLieu = "time_in_lieu"; case Sick = "sick_vacation"; case Absence = "absence"; + case HomeOffice = "home_office"; public function label(): string { diff --git a/app/Domain/VacationTypeConfigRetriever.php b/app/Domain/VacationTypeConfigRetriever.php index 213fcc8..7865d41 100644 --- a/app/Domain/VacationTypeConfigRetriever.php +++ b/app/Domain/VacationTypeConfigRetriever.php @@ -15,6 +15,7 @@ class VacationTypeConfigRetriever public const KEY_BILLABLE = "billable"; public const KEY_HAS_LIMIT = "has_limit"; public const KEY_AVAILABLE_FOR = "available_for"; + public const KEY_IS_VACATION = "is_vacation"; public function __construct( protected Repository $config, @@ -40,6 +41,11 @@ class VacationTypeConfigRetriever return $this->getConfigFor($type)[static::KEY_HAS_LIMIT]; } + public function isVacation(VacationType $type): bool + { + return $this->getConfigFor($type)[static::KEY_IS_VACATION]; + } + public function isAvailableFor(VacationType $type, EmploymentForm $employmentForm): bool { return in_array($employmentForm, $this->getConfigFor($type)[static::KEY_AVAILABLE_FOR], true); diff --git a/app/Infrastructure/Http/Controllers/TimesheetController.php b/app/Infrastructure/Http/Controllers/TimesheetController.php index 3408bf5..16af5f6 100644 --- a/app/Infrastructure/Http/Controllers/TimesheetController.php +++ b/app/Infrastructure/Http/Controllers/TimesheetController.php @@ -35,7 +35,8 @@ class TimesheetController extends Controller $types = VacationType::all() ->filter( - fn(VacationType $type) => $configRetriever->isAvailableFor($type, EmploymentForm::EmploymentContract), + fn(VacationType $type) => $configRetriever->isAvailableFor($type, EmploymentForm::EmploymentContract) + && $configRetriever->isVacation($type), ); $filename = "{$carbonMonth->translatedFormat("F Y")}.xlsx"; diff --git a/app/Infrastructure/Http/Controllers/VacationLimitController.php b/app/Infrastructure/Http/Controllers/VacationLimitController.php index cb3c8ef..29c333e 100644 --- a/app/Infrastructure/Http/Controllers/VacationLimitController.php +++ b/app/Infrastructure/Http/Controllers/VacationLimitController.php @@ -11,7 +11,7 @@ use Toby\Eloquent\Helpers\YearPeriodRetriever; use Toby\Eloquent\Models\VacationLimit; use Toby\Eloquent\Models\YearPeriod; use Toby\Infrastructure\Http\Requests\VacationLimitRequest; -use Toby\Infrastructure\Http\Resources\SimpleUserResource; +use Toby\Infrastructure\Http\Resources\UserResource; class VacationLimitController extends Controller { @@ -32,7 +32,7 @@ class VacationLimitController extends Controller $limitsResource = $limits->map(fn(VacationLimit $limit) => [ "id" => $limit->id, - "user" => new SimpleUserResource($limit->user), + "user" => new UserResource($limit->user), "hasVacation" => $limit->hasVacation(), "days" => $limit->days, "remainingLastYear" => $previousYearPeriod diff --git a/config/vacation_types.php b/config/vacation_types.php index e9b4402..f890546 100644 --- a/config/vacation_types.php +++ b/config/vacation_types.php @@ -15,6 +15,7 @@ return [ VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [ EmploymentForm::EmploymentContract, ], + VacationTypeConfigRetriever::KEY_IS_VACATION => true, ], VacationType::OnRequest->value => [ VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => true, @@ -42,6 +43,7 @@ return [ VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [ EmploymentForm::EmploymentContract, ], + VacationTypeConfigRetriever::KEY_IS_VACATION => true, ], VacationType::Unpaid->value => [ VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => true, @@ -51,6 +53,7 @@ return [ VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [ EmploymentForm::EmploymentContract, ], + VacationTypeConfigRetriever::KEY_IS_VACATION => true, ], VacationType::Special->value => [ VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => true, @@ -60,6 +63,7 @@ return [ VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [ EmploymentForm::EmploymentContract, ], + VacationTypeConfigRetriever::KEY_IS_VACATION => true, ], VacationType::Childcare->value => [ VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => true, @@ -69,6 +73,7 @@ return [ VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [ EmploymentForm::EmploymentContract, ], + VacationTypeConfigRetriever::KEY_IS_VACATION => true, ], VacationType::Training->value => [ VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => true, @@ -79,6 +84,7 @@ return [ EmploymentForm::EmploymentContract, ], ], + VacationTypeConfigRetriever::KEY_IS_VACATION => true, VacationType::Volunteering->value => [ VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => true, VacationTypeConfigRetriever::KEY_ADMINISTRATIVE_APPROVAL => true, @@ -87,6 +93,7 @@ return [ VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [ EmploymentForm::EmploymentContract, ], + VacationTypeConfigRetriever::KEY_IS_VACATION => true, ], VacationType::Volunteering->value => [ VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => true, @@ -96,6 +103,7 @@ return [ VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [ EmploymentForm::EmploymentContract, ], + VacationTypeConfigRetriever::KEY_IS_VACATION => true, ], VacationType::Absence->value => [ VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => true, @@ -107,5 +115,19 @@ return [ EmploymentForm::B2bContract, EmploymentForm::BoardMemberContract, ], + VacationTypeConfigRetriever::KEY_IS_VACATION => true, + ], + VacationType::HomeOffice->value => [ + VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => false, + VacationTypeConfigRetriever::KEY_ADMINISTRATIVE_APPROVAL => false, + VacationTypeConfigRetriever::KEY_BILLABLE => true, + VacationTypeConfigRetriever::KEY_HAS_LIMIT => false, + VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [ + EmploymentForm::EmploymentContract, + EmploymentForm::CommissionContract, + EmploymentForm::B2bContract, + EmploymentForm::BoardMemberContract, + ], + VacationTypeConfigRetriever::KEY_IS_VACATION => false, ], ]; diff --git a/resources/js/Shared/VacationPopup.vue b/resources/js/Shared/VacationPopup.vue index 79aba5a..2ace025 100644 --- a/resources/js/Shared/VacationPopup.vue +++ b/resources/js/Shared/VacationPopup.vue @@ -16,7 +16,7 @@
- Rodzaj urlopu + Rodzaj wniosku
diff --git a/resources/lang/pl.json b/resources/lang/pl.json index 9cc41ae..5df56a5 100644 --- a/resources/lang/pl.json +++ b/resources/lang/pl.json @@ -15,6 +15,7 @@ "time_in_lieu": "Odbiór za święto", "sick_vacation": "Zwolnienie lekarskie", "absence": "Nieobecność", + "home_office": "Biuro w domu", "employee": "Pracownik", "administrator": "Administrator", "technical_approver": "Techniczny akceptujący",