* #120 - wip * #120 - add icon to home office * #120 - wip * #120 - wip * #120 - wip * #120 - wip * #120 - wip * #120 - ui fixes * #120 - fix * #120 - fix * #120 - fix * #120 - fix * #120 - translation fix * #120 - fix Co-authored-by: EwelinaLasowy <ewelina.lasowy@blumilk.pl>
This commit is contained in:
parent
cc981b02b4
commit
c95d08c861
@ -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,16 +16,19 @@ 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);
|
||||
|
||||
if ($this->configRetriever->isVacation($vacationRequest->type)) {
|
||||
SendVacationRequestDaysToGoogleCalendar::dispatch($vacationRequest);
|
||||
|
||||
$this->notify($vacationRequest);
|
||||
}
|
||||
}
|
||||
|
||||
protected function notify(VacationRequest $vacationRequest): void
|
||||
{
|
||||
|
@ -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\ClearVacationRequestDaysInGoogleCalendar;
|
||||
@ -15,6 +16,7 @@ class CancelAction
|
||||
{
|
||||
public function __construct(
|
||||
protected VacationRequestStateManager $stateManager,
|
||||
protected VacationTypeConfigRetriever $configRetriever,
|
||||
) {}
|
||||
|
||||
public function execute(VacationRequest $vacationRequest, User $user): void
|
||||
@ -23,8 +25,10 @@ class CancelAction
|
||||
|
||||
ClearVacationRequestDaysInGoogleCalendar::dispatch($vacationRequest);
|
||||
|
||||
if ($this->configRetriever->isVacation($vacationRequest->type)) {
|
||||
$this->notify($vacationRequest);
|
||||
}
|
||||
}
|
||||
|
||||
protected function notify(VacationRequest $vacationRequest): void
|
||||
{
|
||||
|
@ -32,7 +32,10 @@ class CreateAction
|
||||
{
|
||||
$vacationRequest = $this->createVacationRequest($data, $creator);
|
||||
$this->handleCreatedVacationRequest($vacationRequest);
|
||||
|
||||
if ($this->configRetriever->isVacation($vacationRequest->type)) {
|
||||
$this->notify($vacationRequest);
|
||||
}
|
||||
|
||||
return $vacationRequest;
|
||||
}
|
||||
|
@ -23,10 +23,12 @@ class WaitForAdminApprovalAction
|
||||
{
|
||||
$this->stateManager->waitForAdministrative($vacationRequest);
|
||||
|
||||
$this->waitForAdminApprovers($vacationRequest);
|
||||
if ($this->configRetriever->isVacation($vacationRequest->type)) {
|
||||
$this->notifyAdminApprovers($vacationRequest);
|
||||
}
|
||||
}
|
||||
|
||||
protected function waitForAdminApprovers(VacationRequest $vacationRequest): void
|
||||
protected function notifyAdminApprovers(VacationRequest $vacationRequest): void
|
||||
{
|
||||
$users = User::query()
|
||||
->whereIn("role", [Role::AdministrativeApprover, Role::Administrator])
|
||||
|
@ -23,8 +23,10 @@ class WaitForTechApprovalAction
|
||||
{
|
||||
$this->stateManager->waitForTechnical($vacationRequest);
|
||||
|
||||
if ($this->configRetriever->isVacation($vacationRequest->type)) {
|
||||
$this->notifyTechApprovers($vacationRequest);
|
||||
}
|
||||
}
|
||||
|
||||
protected function notifyTechApprovers(VacationRequest $vacationRequest): void
|
||||
{
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -34,10 +34,10 @@ class UserVacationStatsRetriever
|
||||
public function getUsedVacationDaysByMonth(User $user, YearPeriod $yearPeriod): Collection
|
||||
{
|
||||
return $user->vacations()
|
||||
->whereBelongsTo($yearPeriod)
|
||||
->whereRelation(
|
||||
"vacationRequest",
|
||||
fn(Builder $query): Builder => $query
|
||||
->whereBelongsTo($yearPeriod)
|
||||
->whereIn("type", $this->getLimitableVacationTypes())
|
||||
->states(VacationRequestStatesRetriever::successStates()),
|
||||
)
|
||||
@ -69,11 +69,21 @@ class UserVacationStatsRetriever
|
||||
"vacationRequest",
|
||||
fn(Builder $query): Builder => $query
|
||||
->whereIn("type", $this->getNotLimitableVacationTypes())
|
||||
->whereNot("type", VacationType::HomeOffice)
|
||||
->states(VacationRequestStatesRetriever::successStates()),
|
||||
)
|
||||
->count();
|
||||
}
|
||||
|
||||
public function getHomeOfficeDays(User $user, YearPeriod $yearPeriod): int
|
||||
{
|
||||
return $user
|
||||
->vacations()
|
||||
->whereBelongsTo($yearPeriod)
|
||||
->whereRelation("vacationRequest", "type", VacationType::HomeOffice)
|
||||
->count();
|
||||
}
|
||||
|
||||
public function getRemainingVacationDays(User $user, YearPeriod $yearPeriod): int
|
||||
{
|
||||
$limit = $this->getVacationDaysLimit($user, $yearPeriod);
|
||||
|
@ -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);
|
||||
|
31
app/Domain/Validation/Rules/VacationTypeCanBeSelected.php
Normal file
31
app/Domain/Validation/Rules/VacationTypeCanBeSelected.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Toby\Domain\Validation\Rules;
|
||||
|
||||
use Toby\Domain\Enums\VacationType;
|
||||
use Toby\Domain\VacationTypeConfigRetriever;
|
||||
use Toby\Eloquent\Models\VacationRequest;
|
||||
|
||||
class VacationTypeCanBeSelected implements VacationRequestRule
|
||||
{
|
||||
public function __construct(
|
||||
protected VacationTypeConfigRetriever $configRetriever,
|
||||
) {}
|
||||
|
||||
public function check(VacationRequest $vacationRequest): bool
|
||||
{
|
||||
$employmentForm = $vacationRequest->user->profile->employment_form;
|
||||
|
||||
$availableTypes = VacationType::all()
|
||||
->filter(fn(VacationType $type) => $this->configRetriever->isAvailableFor($type, $employmentForm));
|
||||
|
||||
return $availableTypes->contains($vacationRequest->type);
|
||||
}
|
||||
|
||||
public function errorMessage(): string
|
||||
{
|
||||
return __("You cannot create vacation request of this type.");
|
||||
}
|
||||
}
|
@ -12,6 +12,7 @@ use Toby\Domain\Validation\Rules\NoApprovedVacationRequestsInRange;
|
||||
use Toby\Domain\Validation\Rules\NoPendingVacationRequestInRange;
|
||||
use Toby\Domain\Validation\Rules\VacationRangeIsInTheSameYearRule;
|
||||
use Toby\Domain\Validation\Rules\VacationRequestRule;
|
||||
use Toby\Domain\Validation\Rules\VacationTypeCanBeSelected;
|
||||
use Toby\Eloquent\Models\VacationRequest;
|
||||
|
||||
class VacationRequestValidator
|
||||
@ -19,6 +20,7 @@ class VacationRequestValidator
|
||||
protected array $rules = [
|
||||
VacationRangeIsInTheSameYearRule::class,
|
||||
MinimumOneVacationDayRule::class,
|
||||
VacationTypeCanBeSelected::class,
|
||||
DoesNotExceedLimitRule::class,
|
||||
NoPendingVacationRequestInRange::class,
|
||||
NoApprovedVacationRequestsInRange::class,
|
||||
|
@ -9,6 +9,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Collection;
|
||||
use Toby\Domain\VacationRequestStatesRetriever;
|
||||
|
||||
/**
|
||||
@ -58,4 +59,12 @@ class Vacation extends Model
|
||||
fn(Builder $query): Builder => $query->states(VacationRequestStatesRetriever::pendingStates()),
|
||||
);
|
||||
}
|
||||
|
||||
public function scopeWhereTypes(Builder $query, Collection $types): Builder
|
||||
{
|
||||
return $query->whereRelation(
|
||||
"vacationRequest",
|
||||
fn(Builder $query): Builder => $query->whereIn("type", $types),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -7,14 +7,16 @@ namespace Toby\Infrastructure\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Inertia\Response;
|
||||
use Toby\Domain\Enums\VacationType;
|
||||
use Toby\Domain\UserVacationStatsRetriever;
|
||||
use Toby\Domain\VacationRequestStatesRetriever;
|
||||
use Toby\Domain\VacationTypeConfigRetriever;
|
||||
use Toby\Eloquent\Helpers\YearPeriodRetriever;
|
||||
use Toby\Eloquent\Models\Vacation;
|
||||
use Toby\Eloquent\Models\VacationRequest;
|
||||
use Toby\Infrastructure\Http\Resources\AbsenceResource;
|
||||
use Toby\Infrastructure\Http\Resources\HolidayResource;
|
||||
use Toby\Infrastructure\Http\Resources\VacationRequestResource;
|
||||
use Toby\Infrastructure\Http\Resources\VacationResource;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
@ -22,6 +24,7 @@ class DashboardController extends Controller
|
||||
Request $request,
|
||||
YearPeriodRetriever $yearPeriodRetriever,
|
||||
UserVacationStatsRetriever $vacationStatsRetriever,
|
||||
VacationTypeConfigRetriever $configRetriever,
|
||||
): Response {
|
||||
$user = $request->user();
|
||||
$now = Carbon::now();
|
||||
@ -31,6 +34,14 @@ class DashboardController extends Controller
|
||||
->with(["user", "vacationRequest"])
|
||||
->whereDate("date", $now)
|
||||
->approved()
|
||||
->whereTypes(VacationType::all()->filter(fn(VacationType $type) => $configRetriever->isVacation($type)))
|
||||
->get();
|
||||
|
||||
$remoteDays = Vacation::query()
|
||||
->with(["user", "vacationRequest"])
|
||||
->whereDate("date", $now)
|
||||
->approved()
|
||||
->whereTypes(VacationType::all()->filter(fn(VacationType $type) => !$configRetriever->isVacation($type)))
|
||||
->get();
|
||||
|
||||
if ($user->can("listAll", VacationRequest::class)) {
|
||||
@ -57,11 +68,13 @@ class DashboardController extends Controller
|
||||
$limit = $vacationStatsRetriever->getVacationDaysLimit($user, $yearPeriod);
|
||||
$used = $vacationStatsRetriever->getUsedVacationDays($user, $yearPeriod);
|
||||
$pending = $vacationStatsRetriever->getPendingVacationDays($user, $yearPeriod);
|
||||
$homeOffice = $vacationStatsRetriever->getHomeOfficeDays($user, $yearPeriod);
|
||||
$other = $vacationStatsRetriever->getOtherApprovedVacationDays($user, $yearPeriod);
|
||||
$remaining = $limit - $used - $pending;
|
||||
|
||||
return inertia("Dashboard", [
|
||||
"absences" => AbsenceResource::collection($absences),
|
||||
"absences" => VacationResource::collection($absences),
|
||||
"remoteDays" => VacationResource::collection($remoteDays),
|
||||
"vacationRequests" => VacationRequestResource::collection($vacationRequests),
|
||||
"holidays" => HolidayResource::collection($holidays),
|
||||
"stats" => [
|
||||
@ -69,6 +82,7 @@ class DashboardController extends Controller
|
||||
"remaining" => $remaining,
|
||||
"used" => $used,
|
||||
"pending" => $pending,
|
||||
"homeOffice" => $homeOffice,
|
||||
"other" => $other,
|
||||
],
|
||||
"can" => [
|
||||
|
@ -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";
|
||||
|
@ -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
|
||||
|
@ -12,6 +12,7 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response as LaravelResponse;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Inertia\Response;
|
||||
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
|
||||
use Toby\Domain\Actions\VacationRequest\AcceptAsAdministrativeAction;
|
||||
use Toby\Domain\Actions\VacationRequest\AcceptAsTechnicalAction;
|
||||
use Toby\Domain\Actions\VacationRequest\CancelAction;
|
||||
@ -23,6 +24,7 @@ use Toby\Domain\States\VacationRequest\AcceptedByTechnical;
|
||||
use Toby\Domain\States\VacationRequest\Cancelled;
|
||||
use Toby\Domain\States\VacationRequest\Rejected;
|
||||
use Toby\Domain\VacationRequestStatesRetriever;
|
||||
use Toby\Domain\VacationTypeConfigRetriever;
|
||||
use Toby\Eloquent\Helpers\YearPeriodRetriever;
|
||||
use Toby\Eloquent\Models\User;
|
||||
use Toby\Eloquent\Models\VacationRequest;
|
||||
@ -148,8 +150,14 @@ class VacationRequestController extends Controller
|
||||
/**
|
||||
* @throws AuthorizationException
|
||||
*/
|
||||
public function download(VacationRequest $vacationRequest): LaravelResponse
|
||||
{
|
||||
public function download(
|
||||
VacationRequest $vacationRequest,
|
||||
VacationTypeConfigRetriever $configRetriever,
|
||||
): LaravelResponse {
|
||||
if (!$configRetriever->isVacation($vacationRequest->type)) {
|
||||
return abort(SymfonyResponse::HTTP_NOT_FOUND);
|
||||
}
|
||||
|
||||
$this->authorize("show", $vacationRequest);
|
||||
|
||||
$pdf = PDF::loadView("pdf.vacation-request", [
|
||||
|
@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Toby\Infrastructure\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class AbsenceResource extends JsonResource
|
||||
{
|
||||
public static $wrap = null;
|
||||
|
||||
public function toArray($request): array
|
||||
{
|
||||
return [
|
||||
"id" => $this->id,
|
||||
"user" => new SimpleUserResource($this->user),
|
||||
"date" => $this->date->toDisplayString(),
|
||||
];
|
||||
}
|
||||
}
|
@ -5,10 +5,19 @@ declare(strict_types=1);
|
||||
namespace Toby\Infrastructure\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Toby\Domain\VacationTypeConfigRetriever;
|
||||
|
||||
class VacationRequestResource extends JsonResource
|
||||
{
|
||||
public static $wrap = null;
|
||||
protected VacationTypeConfigRetriever $configRetriever;
|
||||
|
||||
public function __construct($resource)
|
||||
{
|
||||
parent::__construct($resource);
|
||||
|
||||
$this->configRetriever = app(VacationTypeConfigRetriever::class);
|
||||
}
|
||||
|
||||
public function toArray($request): array
|
||||
{
|
||||
@ -17,6 +26,7 @@ class VacationRequestResource extends JsonResource
|
||||
"name" => $this->name,
|
||||
"user" => new SimpleUserResource($this->user),
|
||||
"type" => $this->type,
|
||||
"isVacation" => $this->configRetriever->isVacation($this->type),
|
||||
"state" => $this->state,
|
||||
"from" => $this->from->toDisplayString(),
|
||||
"to" => $this->to->toDisplayString(),
|
||||
|
@ -14,6 +14,7 @@ class VacationResource extends JsonResource
|
||||
{
|
||||
return [
|
||||
"id" => $this->id,
|
||||
"user" => new SimpleUserResource($this->user),
|
||||
"displayDate" => $this->date->toDisplayString(),
|
||||
"date" => $this->date->toDateString(),
|
||||
];
|
||||
|
@ -15,6 +15,7 @@ return [
|
||||
VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [
|
||||
EmploymentForm::EmploymentContract,
|
||||
],
|
||||
VacationTypeConfigRetriever::KEY_IS_VACATION => true,
|
||||
],
|
||||
VacationType::OnRequest->value => [
|
||||
VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => true,
|
||||
@ -24,6 +25,7 @@ return [
|
||||
VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [
|
||||
EmploymentForm::EmploymentContract,
|
||||
],
|
||||
VacationTypeConfigRetriever::KEY_IS_VACATION => true,
|
||||
],
|
||||
VacationType::TimeInLieu->value => [
|
||||
VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => false,
|
||||
@ -33,6 +35,7 @@ return [
|
||||
VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [
|
||||
EmploymentForm::EmploymentContract,
|
||||
],
|
||||
VacationTypeConfigRetriever::KEY_IS_VACATION => true,
|
||||
],
|
||||
VacationType::Sick->value => [
|
||||
VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => false,
|
||||
@ -42,6 +45,7 @@ return [
|
||||
VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [
|
||||
EmploymentForm::EmploymentContract,
|
||||
],
|
||||
VacationTypeConfigRetriever::KEY_IS_VACATION => true,
|
||||
],
|
||||
VacationType::Unpaid->value => [
|
||||
VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => true,
|
||||
@ -51,6 +55,7 @@ return [
|
||||
VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [
|
||||
EmploymentForm::EmploymentContract,
|
||||
],
|
||||
VacationTypeConfigRetriever::KEY_IS_VACATION => true,
|
||||
],
|
||||
VacationType::Special->value => [
|
||||
VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => true,
|
||||
@ -60,6 +65,7 @@ return [
|
||||
VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [
|
||||
EmploymentForm::EmploymentContract,
|
||||
],
|
||||
VacationTypeConfigRetriever::KEY_IS_VACATION => true,
|
||||
],
|
||||
VacationType::Childcare->value => [
|
||||
VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => true,
|
||||
@ -69,6 +75,7 @@ return [
|
||||
VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [
|
||||
EmploymentForm::EmploymentContract,
|
||||
],
|
||||
VacationTypeConfigRetriever::KEY_IS_VACATION => true,
|
||||
],
|
||||
VacationType::Training->value => [
|
||||
VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => true,
|
||||
@ -78,6 +85,18 @@ return [
|
||||
VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [
|
||||
EmploymentForm::EmploymentContract,
|
||||
],
|
||||
VacationTypeConfigRetriever::KEY_IS_VACATION => true,
|
||||
],
|
||||
VacationTypeConfigRetriever::KEY_IS_VACATION => true,
|
||||
VacationType::Volunteering->value => [
|
||||
VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => true,
|
||||
VacationTypeConfigRetriever::KEY_ADMINISTRATIVE_APPROVAL => true,
|
||||
VacationTypeConfigRetriever::KEY_BILLABLE => true,
|
||||
VacationTypeConfigRetriever::KEY_HAS_LIMIT => false,
|
||||
VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [
|
||||
EmploymentForm::EmploymentContract,
|
||||
],
|
||||
VacationTypeConfigRetriever::KEY_IS_VACATION => true,
|
||||
],
|
||||
VacationType::Volunteering->value => [
|
||||
VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => true,
|
||||
@ -87,15 +106,7 @@ return [
|
||||
VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [
|
||||
EmploymentForm::EmploymentContract,
|
||||
],
|
||||
],
|
||||
VacationType::Volunteering->value => [
|
||||
VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => true,
|
||||
VacationTypeConfigRetriever::KEY_ADMINISTRATIVE_APPROVAL => true,
|
||||
VacationTypeConfigRetriever::KEY_BILLABLE => true,
|
||||
VacationTypeConfigRetriever::KEY_HAS_LIMIT => false,
|
||||
VacationTypeConfigRetriever::KEY_AVAILABLE_FOR => [
|
||||
EmploymentForm::EmploymentContract,
|
||||
],
|
||||
VacationTypeConfigRetriever::KEY_IS_VACATION => true,
|
||||
],
|
||||
VacationType::Absence->value => [
|
||||
VacationTypeConfigRetriever::KEY_TECHNICAL_APPROVAL => true,
|
||||
@ -107,5 +118,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,
|
||||
],
|
||||
];
|
||||
|
@ -8,6 +8,7 @@ import HandHeartOutlineIcon from 'vue-material-design-icons/HandHeartOutline.vue
|
||||
import CalendarCheckIcon from 'vue-material-design-icons/CalendarCheck.vue'
|
||||
import MedicalBagIcon from 'vue-material-design-icons/MedicalBag.vue'
|
||||
import CalendarRemoveIcon from 'vue-material-design-icons/CalendarRemove.vue'
|
||||
import LaptopIcon from 'vue-material-design-icons/Laptop.vue'
|
||||
|
||||
const types = [
|
||||
{
|
||||
@ -80,6 +81,13 @@ const types = [
|
||||
color: 'text-cyan-500',
|
||||
border: 'border-cyan-500',
|
||||
},
|
||||
{
|
||||
text: 'Praca zdalna',
|
||||
value: 'home_office',
|
||||
icon: LaptopIcon,
|
||||
color: 'text-fuchsia-500',
|
||||
border: 'border-fuchsia-500',
|
||||
},
|
||||
]
|
||||
|
||||
export default function useVacationTypeInfo() {
|
||||
|
@ -15,9 +15,13 @@
|
||||
:requests="vacationRequests.data"
|
||||
/>
|
||||
<AbsenceList
|
||||
v-if="years.current.year === years.selected.year"
|
||||
v-if="years.current.year === years.selected.year && absences.data.length"
|
||||
:absences="absences.data"
|
||||
/>
|
||||
<HomeOfficeList
|
||||
v-if="years.current.year === years.selected.year && remoteDays.data.length"
|
||||
:remote-days="remoteDays.data"
|
||||
/>
|
||||
<UpcomingHolidays
|
||||
v-if="years.current.year === years.selected.year"
|
||||
:holidays="holidays.data"
|
||||
@ -30,6 +34,7 @@
|
||||
import Welcome from '@/Shared/Widgets/Welcome'
|
||||
import VacationStats from '@/Shared/Widgets/VacationStats'
|
||||
import AbsenceList from '@/Shared/Widgets/AbsenceList'
|
||||
import HomeOfficeList from '@/Shared/Widgets/HomeOfficeList'
|
||||
import UpcomingHolidays from '@/Shared/Widgets/UpcomingHolidays'
|
||||
import UserVacationRequests from '@/Shared/Widgets/UserVacationRequests'
|
||||
import PendingVacationRequests from '@/Shared/Widgets/PendingVacationRequests'
|
||||
@ -37,6 +42,7 @@ import PendingVacationRequests from '@/Shared/Widgets/PendingVacationRequests'
|
||||
defineProps({
|
||||
auth: Object,
|
||||
absences: Object,
|
||||
remoteDays: Object,
|
||||
vacationRequests: Object,
|
||||
holidays: Object,
|
||||
can: Object,
|
||||
|
@ -133,14 +133,14 @@
|
||||
as="template"
|
||||
: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']">
|
||||
{{ role.label }}
|
||||
</span>
|
||||
|
||||
<span
|
||||
v-if="selected"
|
||||
:class="[active ? 'text-white' : 'text-blumilk-600', 'absolute inset-y-0 right-0 flex items-center pr-4']"
|
||||
:class="['text-blumilk-600 absolute inset-y-0 right-0 flex items-center pr-4']"
|
||||
>
|
||||
<CheckIcon class="w-5 h-5" />
|
||||
</span>
|
||||
@ -188,14 +188,14 @@
|
||||
as="template"
|
||||
: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']">
|
||||
{{ employmentForm.label }}
|
||||
</span>
|
||||
|
||||
<span
|
||||
v-if="selected"
|
||||
:class="[active ? 'text-white' : 'text-blumilk-600', 'absolute inset-y-0 right-0 flex items-center pr-4']"
|
||||
:class="['text-blumilk-600 absolute inset-y-0 right-0 flex items-center pr-4']"
|
||||
>
|
||||
<CheckIcon class="w-5 h-5" />
|
||||
</span>
|
||||
|
@ -136,7 +136,7 @@
|
||||
:value="role"
|
||||
>
|
||||
<li
|
||||
:class="[active ? 'text-white bg-blumilk-600' : 'text-gray-900', 'cursor-default select-none relative py-2 pl-3 pr-9']"
|
||||
: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']">
|
||||
{{ role.label }}
|
||||
@ -144,7 +144,7 @@
|
||||
|
||||
<span
|
||||
v-if="selected"
|
||||
:class="[active ? 'text-white' : 'text-blumilk-600', 'absolute inset-y-0 right-0 flex items-center pr-4']"
|
||||
:class="['text-blumilk-600 absolute inset-y-0 right-0 flex items-center pr-4']"
|
||||
>
|
||||
<CheckIcon class="w-5 h-5" />
|
||||
</span>
|
||||
@ -194,7 +194,7 @@
|
||||
:value="employmentForm"
|
||||
>
|
||||
<li
|
||||
:class="[active ? 'text-white bg-blumilk-600' : 'text-gray-900', 'cursor-default select-none relative py-2 pl-3 pr-9']"
|
||||
: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']">
|
||||
{{ employmentForm.label }}
|
||||
@ -202,7 +202,7 @@
|
||||
|
||||
<span
|
||||
v-if="selected"
|
||||
:class="[active ? 'text-white' : 'text-blumilk-600', 'absolute inset-y-0 right-0 flex items-center pr-4']"
|
||||
:class="['text-blumilk-600 absolute inset-y-0 right-0 flex items-center pr-4']"
|
||||
>
|
||||
<CheckIcon class="w-5 h-5" />
|
||||
</span>
|
||||
|
@ -72,7 +72,7 @@
|
||||
as="template"
|
||||
: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">
|
||||
<img
|
||||
:src="user.avatar"
|
||||
@ -86,7 +86,7 @@
|
||||
|
||||
<span
|
||||
v-if="selected"
|
||||
:class="[active ? 'text-white' : 'text-blumilk-600', 'absolute inset-y-0 right-0 flex items-center pr-4']"
|
||||
:class="['text-blumilk-600 absolute inset-y-0 right-0 flex items-center pr-4']"
|
||||
>
|
||||
<CheckIcon class="w-5 h-5" />
|
||||
</span>
|
||||
@ -142,7 +142,9 @@
|
||||
:class="{ 'border-red-300 text-red-900 focus:ring-red-500 focus:border-red-500': form.errors.type, 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors.type }"
|
||||
>
|
||||
<template v-if="form.vacationType">
|
||||
<span class="block truncate">{{ form.vacationType.label }}</span>
|
||||
<span class="block truncate">
|
||||
<VacationType :type="form.vacationType.value" />
|
||||
</span>
|
||||
<span class="flex absolute inset-y-0 right-0 items-center pr-2 pointer-events-none">
|
||||
<SelectorIcon class="w-5 h-5 text-gray-400" />
|
||||
</span>
|
||||
@ -164,14 +166,14 @@
|
||||
as="template"
|
||||
: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']">
|
||||
{{ vacationType.label }}
|
||||
<VacationType :type="vacationType.value" />
|
||||
</span>
|
||||
|
||||
<span
|
||||
v-if="selected"
|
||||
:class="[active ? 'text-white' : 'text-blumilk-600', 'absolute inset-y-0 right-0 flex items-center pr-4']"
|
||||
:class="['text-blumilk-600 absolute inset-y-0 right-0 flex items-center pr-4']"
|
||||
>
|
||||
<CheckIcon class="w-5 h-5" />
|
||||
</span>
|
||||
@ -331,6 +333,7 @@ import { reactive, ref, watch } from 'vue'
|
||||
import axios from 'axios'
|
||||
import useCurrentYearPeriodInfo from '@/Composables/yearPeriodInfo'
|
||||
import VacationChart from '@/Shared/VacationChart'
|
||||
import VacationType from '@/Shared/VacationType'
|
||||
|
||||
const props = defineProps({
|
||||
auth: Object,
|
||||
|
@ -70,13 +70,13 @@
|
||||
:value="status"
|
||||
>
|
||||
<li
|
||||
:class="[active ? 'text-white bg-blumilk-600' : 'text-gray-900', 'cursor-default truncate select-none relative py-2 pl-3 pr-9']"
|
||||
:class="[active ? 'bg-gray-100' : 'text-gray-900', 'cursor-default truncate select-none relative py-2 pl-3 pr-9']"
|
||||
>
|
||||
{{ status.name }}
|
||||
|
||||
<span
|
||||
v-if="selected"
|
||||
:class="[active ? 'text-white' : 'text-blumilk-600', 'absolute inset-y-0 right-0 flex items-center pr-4']"
|
||||
:class="['text-blumilk-600 absolute inset-y-0 right-0 flex items-center pr-4']"
|
||||
>
|
||||
<CheckIcon class="w-5 h-5" />
|
||||
</span>
|
||||
|
@ -61,7 +61,7 @@
|
||||
:value="null"
|
||||
>
|
||||
<li
|
||||
:class="[active ? 'text-white bg-blumilk-600' : 'text-gray-900', 'cursor-default select-none relative py-2 pl-3 pr-9']"
|
||||
:class="[active ? 'bg-gray-100' : 'text-gray-900', 'cursor-default select-none relative py-2 pl-3 pr-9']"
|
||||
>
|
||||
<div class="flex items-center">
|
||||
Wszyscy
|
||||
@ -69,7 +69,7 @@
|
||||
|
||||
<span
|
||||
v-if="form.user === null"
|
||||
:class="[active ? 'text-white' : 'text-blumilk-600', 'absolute inset-y-0 right-0 flex items-center pr-4']"
|
||||
:class="['text-blumilk-600 absolute inset-y-0 right-0 flex items-center pr-4']"
|
||||
>
|
||||
<CheckIcon class="w-5 h-5" />
|
||||
</span>
|
||||
@ -83,7 +83,7 @@
|
||||
:value="user"
|
||||
>
|
||||
<li
|
||||
:class="[active ? 'text-white bg-blumilk-600' : 'text-gray-900', 'cursor-default select-none relative py-2 pl-3 pr-9']"
|
||||
:class="[active ? 'bg-gray-100' : 'text-gray-900', 'cursor-default select-none relative py-2 pl-3 pr-9']"
|
||||
>
|
||||
<div class="flex items-center">
|
||||
<img
|
||||
@ -98,7 +98,7 @@
|
||||
</div>
|
||||
<span
|
||||
v-if="form.user?.id === user.id"
|
||||
:class="[active ? 'text-white' : 'text-blumilk-600', 'absolute inset-y-0 right-0 flex items-center pr-4']"
|
||||
:class="['text-blumilk-600 absolute inset-y-0 right-0 flex items-center pr-4']"
|
||||
>
|
||||
<CheckIcon class="w-5 h-5" />
|
||||
</span>
|
||||
@ -143,13 +143,13 @@
|
||||
:value="status"
|
||||
>
|
||||
<li
|
||||
:class="[active ? 'text-white bg-blumilk-600' : 'text-gray-900', 'cursor-default truncate select-none relative py-2 pl-3 pr-9']"
|
||||
:class="[active ? 'bg-gray-100' : 'text-gray-900', 'cursor-default truncate select-none relative py-2 pl-3 pr-9']"
|
||||
>
|
||||
{{ status.name }}
|
||||
|
||||
<span
|
||||
v-if="selected"
|
||||
:class="[active ? 'text-white' : 'text-blumilk-600', 'absolute inset-y-0 right-0 flex items-center pr-4']"
|
||||
:class="['text-blumilk-600 absolute inset-y-0 right-0 flex items-center pr-4']"
|
||||
>
|
||||
<CheckIcon class="w-5 h-5" />
|
||||
</span>
|
||||
|
@ -88,7 +88,10 @@
|
||||
-
|
||||
</dd>
|
||||
</div>
|
||||
<div class="py-5 px-4 bg-white sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||
<div
|
||||
v-if="VacationType.isVacation"
|
||||
class="py-5 px-4 bg-white sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"
|
||||
>
|
||||
<dt class="flex items-center text-sm font-medium text-gray-500">
|
||||
Załączniki
|
||||
</dt>
|
||||
|
@ -27,7 +27,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<template #content>
|
||||
<div class="py-2 px-4 text-gray-900 bg-white rounded-md shadow-md text-md">
|
||||
<div class="py-2 px-4 text-gray-900 bg-white rounded-lg border border-gray-400 text-md">
|
||||
<div class="flex items-center font-normal">
|
||||
<i
|
||||
class="inline-block mr-3 w-5 h-3"
|
||||
|
@ -16,7 +16,7 @@
|
||||
</div>
|
||||
<div class="py-2 space-y-1">
|
||||
<dt class="text-sm font-medium text-gray-500">
|
||||
Rodzaj urlopu
|
||||
Rodzaj wniosku
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">
|
||||
<VacationType :type="vacation.type" />
|
||||
|
@ -25,11 +25,6 @@
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
<li v-if="! absences.length">
|
||||
<p class="py-2">
|
||||
Brak danych
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
37
resources/js/Shared/Widgets/HomeOfficeList.vue
Normal file
37
resources/js/Shared/Widgets/HomeOfficeList.vue
Normal file
@ -0,0 +1,37 @@
|
||||
<template>
|
||||
<section class="bg-white shadow-md">
|
||||
<div class="p-4 sm:px-6">
|
||||
<h2 class="text-lg font-medium leading-6 text-gray-900">
|
||||
Dzisiejsza praca zdalna
|
||||
</h2>
|
||||
</div>
|
||||
<div class="px-4 border-t border-gray-200 sm:px-6">
|
||||
<ul class="divide-y divide-gray-200">
|
||||
<li
|
||||
v-for="day in remoteDays"
|
||||
:key="day.user.id"
|
||||
class="flex py-4"
|
||||
>
|
||||
<img
|
||||
class="w-10 h-10 rounded-full"
|
||||
:src="day.user.avatar"
|
||||
>
|
||||
<div class="ml-3">
|
||||
<p class="text-sm font-medium text-gray-900">
|
||||
{{ day.user.name }}
|
||||
</p>
|
||||
<p class="text-sm text-gray-500">
|
||||
{{ day.user.email }}
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
defineProps({
|
||||
remoteDays: Object,
|
||||
})
|
||||
</script>
|
@ -39,7 +39,7 @@
|
||||
</dt>
|
||||
</div>
|
||||
<div class="py-5 px-4 bg-white shadow-md sm:p-6">
|
||||
<dt class="mt-1 text-4xl font-semibold text-gray-900">
|
||||
<dt class="mt-1 text-4xl font-semibold text-blumilk-800">
|
||||
{{ stats.limit }}
|
||||
</dt>
|
||||
<dd class="font-medium text-gray-700 truncate text-md">
|
||||
@ -49,8 +49,8 @@
|
||||
Twój roczny limit urlopu wypoczynkowego.
|
||||
</dt>
|
||||
</div>
|
||||
<div class="col-span-2 py-5 px-4 bg-white shadow-md sm:p-6">
|
||||
<dt class="mt-1 text-4xl font-semibold text-gray-900">
|
||||
<div class="py-5 px-4 bg-white shadow-md sm:p-6">
|
||||
<dt class="mt-1 text-4xl font-semibold text-gray-500">
|
||||
{{ stats.other }}
|
||||
</dt>
|
||||
<dd class="font-medium text-gray-700 truncate text-md">
|
||||
@ -60,6 +60,17 @@
|
||||
Urlopy bezpłatne, okolicznościowe, zwolnienia lekarskie, itd., które zostały już zatwierdzone.
|
||||
</dt>
|
||||
</div>
|
||||
<div class="py-5 px-4 bg-white shadow-md sm:p-6">
|
||||
<dt class="mt-1 text-4xl font-semibold text-fuchsia-700">
|
||||
{{ stats.homeOffice }}
|
||||
</dt>
|
||||
<dd class="font-medium text-gray-700 truncate text-md">
|
||||
Praca zdalna
|
||||
</dd>
|
||||
<dt class="mt-2 text-sm font-medium text-gray-500">
|
||||
Dni przepracowane poza biurem.
|
||||
</dt>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -15,6 +15,7 @@
|
||||
"time_in_lieu": "Odbiór za święto",
|
||||
"sick_vacation": "Zwolnienie lekarskie",
|
||||
"absence": "Nieobecność",
|
||||
"home_office": "Praca zdalna",
|
||||
"employee": "Pracownik",
|
||||
"administrator": "Administrator",
|
||||
"technical_approver": "Techniczny akceptujący",
|
||||
@ -63,7 +64,7 @@
|
||||
"Vacation request :title is waiting for your administrative approval": "Wniosek urlopowy :title czeka na akceptację administracyjną",
|
||||
"The vacation request :title from user :requester is waiting for your technical approval.": "Wniosek urlopowy :title użytkownika :requester czeka na Twoją akceptację techniczną.",
|
||||
"The vacation request :title from user :requester is waiting for your administrative approval.": "Wniosek urlopowy :title użytkownika :requester czeka na Twoją akceptację administracyjną.",
|
||||
"Vacation request :title has been :status": "Wniosek urlopowy :title został :status",
|
||||
"Vacation request :title has been :status": "Wniosek :title został :status",
|
||||
"The vacation request :title from user :requester has been :status.": "Wniosek urlopowy :title użytkownika :requester został :status.",
|
||||
"Vacation request :title has been created on your behalf": "Wniosek urlopowy :title został utworzony w Twoim imieniu",
|
||||
"The vacation request :title has been created correctly by user :creator on your behalf in the :appName.": "W systemie :appName został poprawnie utworzony wniosek urlopowy :title w Twoim imieniu przez użytkownika :creator."
|
||||
|
@ -10,6 +10,7 @@ use Illuminate\Support\Facades\Bus;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
use Tests\FeatureTestCase;
|
||||
use Toby\Domain\Enums\EmploymentForm;
|
||||
use Toby\Domain\Enums\VacationType;
|
||||
use Toby\Domain\PolishHolidaysRetriever;
|
||||
use Toby\Domain\States\VacationRequest\Approved;
|
||||
@ -17,6 +18,7 @@ use Toby\Domain\States\VacationRequest\Cancelled;
|
||||
use Toby\Domain\States\VacationRequest\Rejected;
|
||||
use Toby\Domain\States\VacationRequest\WaitingForAdministrative;
|
||||
use Toby\Domain\States\VacationRequest\WaitingForTechnical;
|
||||
use Toby\Eloquent\Models\Profile;
|
||||
use Toby\Eloquent\Models\User;
|
||||
use Toby\Eloquent\Models\VacationLimit;
|
||||
use Toby\Eloquent\Models\VacationRequest;
|
||||
@ -61,7 +63,9 @@ class VacationRequestTest extends FeatureTestCase
|
||||
|
||||
public function testUserCanCreateVacationRequest(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$user = User::factory()
|
||||
->has(Profile::factory(["employment_form" => EmploymentForm::EmploymentContract]))
|
||||
->create();
|
||||
|
||||
$currentYearPeriod = YearPeriod::current();
|
||||
|
||||
@ -80,6 +84,7 @@ class VacationRequestTest extends FeatureTestCase
|
||||
"to" => Carbon::create($currentYearPeriod->year, 2, 11)->toDateString(),
|
||||
"comment" => "Comment for the vacation request.",
|
||||
])
|
||||
->assertSessionHasNoErrors()
|
||||
->assertRedirect();
|
||||
|
||||
$this->assertDatabaseHas("vacation_requests", [
|
||||
@ -96,7 +101,9 @@ class VacationRequestTest extends FeatureTestCase
|
||||
public function testUserCanCreateVacationRequestOnEmployeeBehalf(): void
|
||||
{
|
||||
$creator = User::factory()->admin()->create();
|
||||
$user = User::factory()->create();
|
||||
$user = User::factory()
|
||||
->has(Profile::factory(["employment_form" => EmploymentForm::EmploymentContract]))
|
||||
->create();
|
||||
|
||||
$currentYearPeriod = YearPeriod::current();
|
||||
|
||||
@ -132,7 +139,9 @@ class VacationRequestTest extends FeatureTestCase
|
||||
public function testUserCanCreateVacationRequestOnEmployeeBehalfAndSkipAcceptanceFlow(): void
|
||||
{
|
||||
$creator = User::factory()->admin()->create();
|
||||
$user = User::factory()->create();
|
||||
$user = User::factory()
|
||||
->has(Profile::factory(["employment_form" => EmploymentForm::EmploymentContract]))
|
||||
->create();
|
||||
|
||||
$currentYearPeriod = YearPeriod::current();
|
||||
|
||||
@ -245,7 +254,9 @@ class VacationRequestTest extends FeatureTestCase
|
||||
|
||||
public function testUserCannotCreateVacationRequestIfHeExceedsHisVacationLimit(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$user = User::factory()
|
||||
->has(Profile::factory(["employment_form" => EmploymentForm::EmploymentContract]))
|
||||
->create();
|
||||
$currentYearPeriod = YearPeriod::current();
|
||||
|
||||
VacationLimit::factory([
|
||||
@ -327,7 +338,9 @@ class VacationRequestTest extends FeatureTestCase
|
||||
|
||||
public function testUserCannotCreateVacationRequestIfHeHasPendingVacationRequestInThisRange(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$user = User::factory()
|
||||
->has(Profile::factory(["employment_form" => EmploymentForm::EmploymentContract]))
|
||||
->create();
|
||||
$currentYearPeriod = YearPeriod::current();
|
||||
|
||||
VacationLimit::factory([
|
||||
@ -363,7 +376,9 @@ class VacationRequestTest extends FeatureTestCase
|
||||
|
||||
public function testUserCannotCreateVacationRequestIfHeHasApprovedVacationRequestInThisRange(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$user = User::factory()
|
||||
->has(Profile::factory(["employment_form" => EmploymentForm::EmploymentContract]))
|
||||
->create();
|
||||
$currentYearPeriod = YearPeriod::current();
|
||||
|
||||
VacationLimit::factory([
|
||||
|
Loading…
x
Reference in New Issue
Block a user