diff --git a/app/Domain/Actions/VacationRequest/ApproveAction.php b/app/Domain/Actions/VacationRequest/ApproveAction.php index 3d55542..a6d5896 100644 --- a/app/Domain/Actions/VacationRequest/ApproveAction.php +++ b/app/Domain/Actions/VacationRequest/ApproveAction.php @@ -7,6 +7,7 @@ namespace Toby\Domain\Actions\VacationRequest; use Toby\Domain\Enums\Role; use Toby\Domain\Notifications\VacationRequestStatusChangedNotification; use Toby\Domain\VacationRequestStateManager; +use Toby\Domain\VacationTypeConfigRetriever; use Toby\Eloquent\Models\User; use Toby\Eloquent\Models\VacationRequest; use Toby\Infrastructure\Jobs\SendVacationRequestDaysToGoogleCalendar; @@ -15,15 +16,18 @@ class ApproveAction { public function __construct( protected VacationRequestStateManager $stateManager, + protected VacationTypeConfigRetriever $configRetriever, ) {} public function execute(VacationRequest $vacationRequest, ?User $user = null): void { $this->stateManager->approve($vacationRequest, $user); - SendVacationRequestDaysToGoogleCalendar::dispatch($vacationRequest); + if ($this->configRetriever->isVacation($vacationRequest->type)) { + SendVacationRequestDaysToGoogleCalendar::dispatch($vacationRequest); - $this->notify($vacationRequest); + $this->notify($vacationRequest); + } } protected function notify(VacationRequest $vacationRequest): void diff --git a/resources/js/Pages/Users/Create.vue b/resources/js/Pages/Users/Create.vue index d56ca33..8962bda 100644 --- a/resources/js/Pages/Users/Create.vue +++ b/resources/js/Pages/Users/Create.vue @@ -133,7 +133,7 @@ as="template" :value="role" > -