#22 - vacation calendar (#51)

* change layout

* change layout

* #22 - wip

* wip

* wip

* #22 - wip

* #22 - wip

* #22 - wip

* #22 - wip

* #22 - fix

* #22 - wip

* #22 - added some tests

* #22 - wip

* #22 - wip

* #22 - fix

* #22 - wip

* #22 - wip

* #22 - wip

* #22 - fix

* #22 - fix

* #22 - fix

* #22 - fix

* #22 - fix

* #22 - fix

* #22 - cr fixes

* #22 - cr fix

Co-authored-by: EwelinaLasowy <ewelina.lasowy@blumilk.pl>
This commit is contained in:
Adrian Hopek
2022-02-15 15:08:26 +01:00
committed by GitHub
parent b161981d5a
commit 6c352b629c
50 changed files with 1682 additions and 397 deletions

View File

@@ -23,7 +23,7 @@ class UserFactory extends Factory
"email" => $this->faker->unique()->safeEmail(),
"employment_form" => $this->faker->randomElement(EmploymentForm::cases()),
"position" => $this->faker->jobTitle(),
"role" => Role::EMPLOYEE,
"role" => Role::Employee,
"employment_date" => Carbon::createFromInterface($this->faker->dateTimeBetween("2020-10-27"))->toDateString(),
"remember_token" => Str::random(10),
];

View File

@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class VacationFactory extends Factory
{
public function definition(): array
{
return [];
}
}

View File

@@ -5,7 +5,6 @@ declare(strict_types=1);
namespace Database\Factories;
use Carbon\CarbonImmutable;
use Carbon\CarbonPeriod;
use Illuminate\Database\Eloquent\Factories\Factory;
use Toby\Domain\Enums\VacationRequestState;
use Toby\Domain\Enums\VacationType;
@@ -31,7 +30,6 @@ class VacationRequestFactory extends Factory
"state" => $this->faker->randomElement(VacationRequestState::cases()),
"from" => $from,
"to" => $from->addDays($days),
"estimated_days" => fn(array $attributes) => $this->estimateDays($attributes),
"comment" => $this->faker->boolean ? $this->faker->paragraph() : null,
];
}
@@ -43,11 +41,4 @@ class VacationRequestFactory extends Factory
return "{$number}/{$year}";
}
protected function estimateDays(array $attributes): int
{
$period = CarbonPeriod::create($attributes["from"], $attributes["to"]);
return $period->count();
}
}