-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* #108 - wip * #108 - add icon to absence * #108 - wip * #108 - fix * #108 - fix title Co-authored-by: EwelinaLasowy <ewelina.lasowy@blumilk.pl>
- Loading branch information
1 parent
fa244b9
commit 6af4380
Showing
22 changed files
with
208 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
app/Infrastructure/Http/Controllers/Api/GetAvailableVacationTypesController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Toby\Infrastructure\Http\Controllers\Api; | ||
|
||
use Illuminate\Http\JsonResponse; | ||
use Toby\Domain\Enums\VacationType; | ||
use Toby\Domain\VacationTypeConfigRetriever; | ||
use Toby\Eloquent\Models\User; | ||
use Toby\Infrastructure\Http\Controllers\Controller; | ||
use Toby\Infrastructure\Http\Requests\Api\GetAvailableVacationTypesRequest; | ||
|
||
class GetAvailableVacationTypesController extends Controller | ||
{ | ||
public function __invoke( | ||
GetAvailableVacationTypesRequest $request, | ||
VacationTypeConfigRetriever $configRetriever, | ||
): JsonResponse { | ||
/** @var User $user */ | ||
$user = User::query()->find($request->get("user")); | ||
|
||
$types = VacationType::all() | ||
->filter(fn(VacationType $type) => $configRetriever->isAvailableFor($type, $user->employment_form)) | ||
->map(fn(VacationType $type) => [ | ||
"label" => $type->label(), | ||
"value" => $type->value, | ||
]) | ||
->values(); | ||
|
||
return new JsonResponse($types); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
app/Infrastructure/Http/Requests/Api/GetAvailableVacationTypesRequest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Toby\Infrastructure\Http\Requests\Api; | ||
|
||
use Illuminate\Foundation\Http\FormRequest; | ||
|
||
class GetAvailableVacationTypesRequest extends FormRequest | ||
{ | ||
public function rules(): array | ||
{ | ||
return [ | ||
"user" => ["required", "exists:users,id"], | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.