#120 - wip
This commit is contained in:
parent
4c5627c067
commit
2c86cd0269
@ -7,6 +7,7 @@ namespace Toby\Domain\Actions\VacationRequest;
|
|||||||
use Toby\Domain\Enums\Role;
|
use Toby\Domain\Enums\Role;
|
||||||
use Toby\Domain\Notifications\VacationRequestStatusChangedNotification;
|
use Toby\Domain\Notifications\VacationRequestStatusChangedNotification;
|
||||||
use Toby\Domain\VacationRequestStateManager;
|
use Toby\Domain\VacationRequestStateManager;
|
||||||
|
use Toby\Domain\VacationTypeConfigRetriever;
|
||||||
use Toby\Eloquent\Models\User;
|
use Toby\Eloquent\Models\User;
|
||||||
use Toby\Eloquent\Models\VacationRequest;
|
use Toby\Eloquent\Models\VacationRequest;
|
||||||
use Toby\Infrastructure\Jobs\SendVacationRequestDaysToGoogleCalendar;
|
use Toby\Infrastructure\Jobs\SendVacationRequestDaysToGoogleCalendar;
|
||||||
@ -15,15 +16,18 @@ class ApproveAction
|
|||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected VacationRequestStateManager $stateManager,
|
protected VacationRequestStateManager $stateManager,
|
||||||
|
protected VacationTypeConfigRetriever $configRetriever,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public function execute(VacationRequest $vacationRequest, ?User $user = null): void
|
public function execute(VacationRequest $vacationRequest, ?User $user = null): void
|
||||||
{
|
{
|
||||||
$this->stateManager->approve($vacationRequest, $user);
|
$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
|
protected function notify(VacationRequest $vacationRequest): void
|
||||||
|
@ -133,7 +133,7 @@
|
|||||||
as="template"
|
as="template"
|
||||||
:value="role"
|
:value="role"
|
||||||
>
|
>
|
||||||
<li :class="[active ? 'text-white bg-blumilk-600' : 'text-gray-900', 'cursor-default select-none relative py-2 pl-3 pr-9']">
|
<li :class="[active ? 'bg-gray-100' : 'text-gray-900', 'cursor-default select-none relative py-2 pl-3 pr-9']">
|
||||||
<span :class="[selected ? 'font-semibold' : 'font-normal', 'block truncate']">
|
<span :class="[selected ? 'font-semibold' : 'font-normal', 'block truncate']">
|
||||||
{{ role.label }}
|
{{ role.label }}
|
||||||
</span>
|
</span>
|
||||||
@ -188,7 +188,7 @@
|
|||||||
as="template"
|
as="template"
|
||||||
:value="employmentForm"
|
:value="employmentForm"
|
||||||
>
|
>
|
||||||
<li :class="[active ? 'text-white bg-blumilk-600' : 'text-gray-900', 'cursor-default select-none relative py-2 pl-3 pr-9']">
|
<li :class="[active ? 'bg-gray-100' : 'text-gray-900', 'cursor-default select-none relative py-2 pl-3 pr-9']">
|
||||||
<span :class="[selected ? 'font-semibold' : 'font-normal', 'block truncate']">
|
<span :class="[selected ? 'font-semibold' : 'font-normal', 'block truncate']">
|
||||||
{{ employmentForm.label }}
|
{{ employmentForm.label }}
|
||||||
</span>
|
</span>
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
as="template"
|
as="template"
|
||||||
:value="user"
|
:value="user"
|
||||||
>
|
>
|
||||||
<li :class="[active ? 'text-white bg-blumilk-600' : 'text-gray-900', 'cursor-default select-none relative py-2 pl-3 pr-9']">
|
<li :class="[active ? 'bg-gray-100' : 'text-gray-900', 'cursor-default select-none relative py-2 pl-3 pr-9']">
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<img
|
<img
|
||||||
:src="user.avatar"
|
:src="user.avatar"
|
||||||
@ -166,7 +166,7 @@
|
|||||||
as="template"
|
as="template"
|
||||||
:value="vacationType"
|
:value="vacationType"
|
||||||
>
|
>
|
||||||
<li :class="[active ? 'text-white bg-blumilk-600' : 'text-gray-900', 'cursor-default select-none relative py-2 pl-3 pr-9']">
|
<li :class="[active ? 'bg-gray-100' : 'text-gray-900', 'cursor-default select-none relative py-2 pl-3 pr-9']">
|
||||||
<span :class="[selected ? 'font-semibold' : 'font-normal', 'block truncate']">
|
<span :class="[selected ? 'font-semibold' : 'font-normal', 'block truncate']">
|
||||||
<VacationType :type="vacationType.value" />
|
<VacationType :type="vacationType.value" />
|
||||||
</span>
|
</span>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user