From 5ded4008c725a5446d5390670405d090e0e78ec7 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Fri, 25 Feb 2022 10:29:45 +0100 Subject: [PATCH 01/26] wip --- .../Http/Controllers/DashboardController.php | 116 +++++ .../Http/Resources/AbsenceResource.php | 22 + package-lock.json | 4 +- package.json | 2 +- resources/js/Pages/Dashboard.vue | 434 ++++++------------ resources/js/Shared/Layout/AppLayout.vue | 2 +- resources/js/Shared/VacationChart.vue | 81 ++++ routes/web.php | 3 +- 8 files changed, 373 insertions(+), 291 deletions(-) create mode 100644 app/Infrastructure/Http/Controllers/DashboardController.php create mode 100644 app/Infrastructure/Http/Resources/AbsenceResource.php create mode 100644 resources/js/Shared/VacationChart.vue diff --git a/app/Infrastructure/Http/Controllers/DashboardController.php b/app/Infrastructure/Http/Controllers/DashboardController.php new file mode 100644 index 0000000..59291af --- /dev/null +++ b/app/Infrastructure/Http/Controllers/DashboardController.php @@ -0,0 +1,116 @@ +with(["user", "vacationRequest"]) + ->whereDate("date", Carbon::now()) + ->whereRelation( + "vacationRequest", + fn(Builder $query) => $query->states(VacationRequestState::successStates()) + ) + ->get(); + + $vacationRequests = VacationRequest::query() + ->latest("updated_at") + ->limit(3) + ->get(); + + $holidays = Holiday::query() + ->whereDate("date", ">=", Carbon::now()) + ->latest() + ->limit(3) + ->get(); + + $limit = $request->user() + ->vacationLimits() + ->where("year_period_id", $this->yearPeriodRetriever->current()->id) + ->first() + ->days ?? 0; + + $used = $request->user() + ->vacations() + ->whereRelation( + "vacationRequest", + fn(Builder $query) => $query + ->whereIn("type", $this->getLimitableVacationTypes()) + ->noStates(VacationRequestState::successStates()), + ) + ->count(); + + $pending = $request->user() + ->vacations() + ->whereRelation( + "vacationRequest", + fn(Builder $query) => $query + ->whereIn("type", $this->getLimitableVacationTypes()) + ->noStates(VacationRequestState::pendingStates()), + ) + ->count(); + + $other = $request->user() + ->vacations() + ->whereRelation( + "vacationRequest", + fn(Builder $query) => $query + ->whereIn("type", $this->getNotLimitableVacationTypes()) + ->noStates(VacationRequestState::successStates()), + ) + ->count(); + + return inertia("Dashboard", [ + "absences" => AbsenceResource::collection($absences), + "vacationRequests" => VacationRequestResource::collection($vacationRequests), + "holidays" => HolidayResource::collection($holidays), + "stats" => [ + "limit" => $limit, + "remaining" => $limit - $used - $pending, + "used" => $used, + "pending" => $pending, + "other" => $other, + ], + ]); + } + + protected function getLimitableVacationTypes(): Collection + { + $types = new Collection(VacationType::cases()); + + return $types->filter(fn(VacationType $type) => $this->configRetriever->hasLimit($type)); + } + + protected function getNotLimitableVacationTypes(): Collection + { + $types = new Collection(VacationType::cases()); + + return $types->filter(fn(VacationType $type) => !$this->configRetriever->hasLimit($type)); + } +} diff --git a/app/Infrastructure/Http/Resources/AbsenceResource.php b/app/Infrastructure/Http/Resources/AbsenceResource.php new file mode 100644 index 0000000..519ef40 --- /dev/null +++ b/app/Infrastructure/Http/Resources/AbsenceResource.php @@ -0,0 +1,22 @@ + $this->id, + "user" => new UserResource($this->user), + "date" => $this->date->toDisplayString(), + "cause" => $this->vacationRequest->type, + ]; + } +} diff --git a/package-lock.json b/package-lock.json index 1d8d8f7..8994c3c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "application", + "name": "toby", "lockfileVersion": 2, "requires": true, "packages": { @@ -16,7 +16,7 @@ "@vue/compiler-sfc": "^3.2.26", "autoprefixer": "^10.4.2", "axios": "^0.25.0", - "echarts": "^5.2.2", + "echarts": "^5.3.0", "flatpickr": "^4.6.9", "laravel-mix": "^6.0.6", "lodash": "^4.17.21", diff --git a/package.json b/package.json index 9588eff..f35c216 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "@vue/compiler-sfc": "^3.2.26", "autoprefixer": "^10.4.2", "axios": "^0.25.0", - "echarts": "^5.2.2", + "echarts": "^5.3.0", "flatpickr": "^4.6.9", "laravel-mix": "^6.0.6", "lodash": "^4.17.21", diff --git a/resources/js/Pages/Dashboard.vue b/resources/js/Pages/Dashboard.vue index 9051660..0587ba2 100644 --- a/resources/js/Pages/Dashboard.vue +++ b/resources/js/Pages/Dashboard.vue @@ -1,17 +1,9 @@ diff --git a/routes/web.php b/routes/web.php index a94d8aa..154523e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -3,6 +3,7 @@ declare(strict_types=1); use Illuminate\Support\Facades\Route; +use Toby\Infrastructure\Http\Controllers\DashboardController; use Toby\Infrastructure\Http\Controllers\GoogleController; use Toby\Infrastructure\Http\Controllers\HolidayController; use Toby\Infrastructure\Http\Controllers\LogoutController; @@ -14,7 +15,7 @@ use Toby\Infrastructure\Http\Controllers\VacationLimitController; use Toby\Infrastructure\Http\Controllers\VacationRequestController; Route::middleware("auth")->group(function (): void { - Route::get("/", fn() => inertia("Dashboard")) + Route::get("/", DashboardController::class) ->name("dashboard"); Route::post("/logout", LogoutController::class); -- 2.52.0 From 7381556f31810d3fde403033a095aa8fdbaef842 Mon Sep 17 00:00:00 2001 From: EwelinaLasowy Date: Fri, 25 Feb 2022 14:23:50 +0100 Subject: [PATCH 02/26] wip --- app/Domain/Enums/EmploymentForm.php | 2 +- .../Models/VacationRequestActivity.php | 9 + .../Http/Controllers/DashboardController.php | 18 +- .../VacationRequestActivityFactory.php | 22 ++ database/seeders/DemoSeeder.php | 225 ++++++++++++++++++ resources/js/Pages/Dashboard.vue | 2 +- 6 files changed, 267 insertions(+), 11 deletions(-) create mode 100644 database/factories/VacationRequestActivityFactory.php create mode 100644 database/seeders/DemoSeeder.php diff --git a/app/Domain/Enums/EmploymentForm.php b/app/Domain/Enums/EmploymentForm.php index 625b801..daf671d 100644 --- a/app/Domain/Enums/EmploymentForm.php +++ b/app/Domain/Enums/EmploymentForm.php @@ -7,7 +7,7 @@ namespace Toby\Domain\Enums; enum EmploymentForm: string { case EmploymentContract = "employment_contract"; - case ComissionContract = "commission_contract"; + case CommissionContract = "commission_contract"; case B2bContract = "b2b_contract"; case BoardMemberContract = "board_member_contract"; diff --git a/app/Eloquent/Models/VacationRequestActivity.php b/app/Eloquent/Models/VacationRequestActivity.php index 8425d99..69201d2 100644 --- a/app/Eloquent/Models/VacationRequestActivity.php +++ b/app/Eloquent/Models/VacationRequestActivity.php @@ -4,6 +4,8 @@ declare(strict_types=1); namespace Toby\Eloquent\Models; +use Database\Factories\VacationRequestActivityFactory; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Toby\Domain\Enums\VacationRequestState; @@ -17,6 +19,8 @@ use Toby\Domain\Enums\VacationRequestState; */ class VacationRequestActivity extends Model { + use HasFactory; + protected $guarded = []; protected $casts = [ @@ -33,4 +37,9 @@ class VacationRequestActivity extends Model { return $this->belongsTo(VacationRequest::class); } + + protected static function newFactory(): VacationRequestActivityFactory + { + return VacationRequestActivityFactory::new(); + } } diff --git a/app/Infrastructure/Http/Controllers/DashboardController.php b/app/Infrastructure/Http/Controllers/DashboardController.php index 59291af..4dda8e2 100644 --- a/app/Infrastructure/Http/Controllers/DashboardController.php +++ b/app/Infrastructure/Http/Controllers/DashboardController.php @@ -24,7 +24,7 @@ class DashboardController extends Controller { public function __construct( protected VacationTypeConfigRetriever $configRetriever, - protected YearPeriodRetriever $yearPeriodRetriever + protected YearPeriodRetriever $yearPeriodRetriever, ) { } @@ -35,7 +35,7 @@ class DashboardController extends Controller ->whereDate("date", Carbon::now()) ->whereRelation( "vacationRequest", - fn(Builder $query) => $query->states(VacationRequestState::successStates()) + fn(Builder $query) => $query->states(VacationRequestState::successStates()), ) ->get(); @@ -51,10 +51,10 @@ class DashboardController extends Controller ->get(); $limit = $request->user() - ->vacationLimits() - ->where("year_period_id", $this->yearPeriodRetriever->current()->id) - ->first() - ->days ?? 0; + ->vacationLimits() + ->where("year_period_id", $this->yearPeriodRetriever->current()->id) + ->first() + ->days ?? 0; $used = $request->user() ->vacations() @@ -62,7 +62,7 @@ class DashboardController extends Controller "vacationRequest", fn(Builder $query) => $query ->whereIn("type", $this->getLimitableVacationTypes()) - ->noStates(VacationRequestState::successStates()), + ->states(VacationRequestState::successStates()), ) ->count(); @@ -72,7 +72,7 @@ class DashboardController extends Controller "vacationRequest", fn(Builder $query) => $query ->whereIn("type", $this->getLimitableVacationTypes()) - ->noStates(VacationRequestState::pendingStates()), + ->states(VacationRequestState::pendingStates()), ) ->count(); @@ -82,7 +82,7 @@ class DashboardController extends Controller "vacationRequest", fn(Builder $query) => $query ->whereIn("type", $this->getNotLimitableVacationTypes()) - ->noStates(VacationRequestState::successStates()), + ->states(VacationRequestState::successStates()), ) ->count(); diff --git a/database/factories/VacationRequestActivityFactory.php b/database/factories/VacationRequestActivityFactory.php new file mode 100644 index 0000000..c4b8c50 --- /dev/null +++ b/database/factories/VacationRequestActivityFactory.php @@ -0,0 +1,22 @@ + $this->faker->randomElement(VacationRequestState::cases()), + "to" => $this->faker->randomElement(VacationRequestState::cases()), + ]; + } +} diff --git a/database/seeders/DemoSeeder.php b/database/seeders/DemoSeeder.php new file mode 100644 index 0000000..5f96ff7 --- /dev/null +++ b/database/seeders/DemoSeeder.php @@ -0,0 +1,225 @@ + "Jan", + "last_name" => "Kowalski", + "email" => env("LOCAL_EMAIL_FOR_LOGIN_VIA_GOOGLE"), + "employment_form" => EmploymentForm::EmploymentContract, + "position" => "programista", + "role" => Role::Employee, + "employment_date" => Carbon::createFromDate(2021, 12, 31), + "remember_token" => Str::random(10), + ]) + ->create(); + + $employee2 = User::factory([ + "first_name" => "Anna", + "last_name" => "Nowak", + "email" => "anna.nowak@example.com", + "employment_form" => EmploymentForm::CommissionContract, + "position" => "tester", + "role" => Role::Employee, + "employment_date" => Carbon::createFromDate(2021, 5, 10), + "remember_token" => Str::random(10), + ]) + ->create(); + + $employee3 = User::factory([ + "first_name" => "Tola", + "last_name" => "Sawicka", + "email" => "tola.sawicka@example.com", + "employment_form" => EmploymentForm::B2bContract, + "position" => "programista", + "role" => Role::Employee, + "employment_date" => Carbon::createFromDate(2021, 1, 4), + "remember_token" => Str::random(10), + ]) + ->create(); + + $technicalApprover = User::factory([ + "first_name" => "Maciej", + "last_name" => "Ziółkowski", + "email" => "maciej.ziolkowski@example.com", + "employment_form" => EmploymentForm::BoardMemberContract, + "position" => "programista", + "role" => Role::TechnicalApprover, + "employment_date" => Carbon::createFromDate(2021, 1, 4), + "remember_token" => Str::random(10), + ]) + ->create(); + + $administrativeApprover = User::factory([ + "first_name" => "Katarzyna", + "last_name" => "Zając", + "email" => "katarzyna.zajac@example.com", + "employment_form" => EmploymentForm::EmploymentContract, + "position" => "dyrektor", + "role" => Role::AdministrativeApprover, + "employment_date" => Carbon::createFromDate(2021, 1, 4), + "remember_token" => Str::random(10), + ]) + ->create(); + + $admin = User::factory([ + "first_name" => "Miłosz", + "last_name" => "Borowski", + "email" => "milosz.borowski@example.com", + "employment_form" => EmploymentForm::EmploymentContract, + "position" => "administrator", + "role" => Role::Administrator, + "employment_date" => Carbon::createFromDate(2021, 1, 4), + "remember_token" => Str::random(10), + ]) + ->create(); + + $users = User::all(); + + $this->generateAvatarsForUsers($users); + + $year = 2021; + + YearPeriod::factory() + ->count(2) + ->sequence( + [ + "year" => Carbon::createFromDate($year)->year, + ], + [ + "year" => Carbon::createFromDate($year + 1)->year, + ], + ) + ->afterCreating(function (YearPeriod $yearPeriod) use ($users): void { + foreach ($users as $user) { + VacationLimit::factory([ + "days" => $user->employment_form === EmploymentForm::EmploymentContract ? 26 : null, + ]) + ->for($yearPeriod) + ->for($user) + ->create(); + } + }) + ->afterCreating(function (YearPeriod $yearPeriod): void { + $polishHolidaysRetriever = new PolishHolidaysRetriever(); + + foreach ($polishHolidaysRetriever->getForYearPeriod($yearPeriod) as $holiday) { + $yearPeriod->holidays()->create([ + "name" => $holiday["name"], + "date" => $holiday["date"], + ]); + } + }) + ->create(); + + $currentYearPeriod = YearPeriod::query()->where("year", 2022)->first(); + + /** @var VacationRequest $vacationRequest */ + $vacationRequest = VacationRequest::factory([ + "type" => VacationType::Vacation->value, + "state" => VacationRequestState::Created, + "from" => Carbon::create($currentYearPeriod->year, 1, 31)->toDateString(), + "to" => Carbon::create($currentYearPeriod->year, 2, 4)->toDateString(), + "comment" => "Komentarz do wniosku urlopowego.", + ]) + ->for($employee1) + ->for($employee1, "creator") + ->for($currentYearPeriod) + ->afterCreating(function (VacationRequest $vacationRequest): void { + $days = app(VacationDaysCalculator::class)->calculateDays( + $vacationRequest->yearPeriod, + $vacationRequest->from, + $vacationRequest->to, + ); + + foreach ($days as $day) { + $vacationRequest->vacations()->create([ + "date" => $day, + "user_id" => $vacationRequest->user->id, + "year_period_id" => $vacationRequest->yearPeriod->id, + ]); + } + }) + ->create(); + + VacationRequestActivity::factory([ + "from" => null, + "to" => VacationRequestState::Created, + ])->for($vacationRequest) + ->for($employee1) + ->create(); + + VacationRequestActivity::factory([ + "from" => VacationRequestState::Created, + "to" => VacationRequestState::WaitingForTechnical, + ])->for($vacationRequest) + ->create(); + + VacationRequestActivity::factory([ + "from" => VacationRequestState::WaitingForTechnical, + "to" => VacationRequestState::AcceptedByTechnical, + ])->for($vacationRequest) + ->for($technicalApprover) + ->create(); + + VacationRequestActivity::factory([ + "from" => VacationRequestState::AcceptedByTechnical, + "to" => VacationRequestState::WaitingForAdministrative, + ])->for($vacationRequest) + ->create(); + + VacationRequestActivity::factory([ + "from" => VacationRequestState::WaitingForAdministrative, + "to" => VacationRequestState::AcceptedByAdministrative, + ])->for($vacationRequest) + ->for($administrativeApprover) + ->create(); + + VacationRequestActivity::factory([ + "from" => VacationRequestState::AcceptedByAdministrative, + "to" => VacationRequestState::Approved, + ])->for($vacationRequest) + ->create(); + + $vacationRequest->changeStateTo(VacationRequestState::Approved); + } + + protected function generateAvatarsForUsers(Collection $users): void + { + foreach ($users as $user) { + $user->saveAvatar($this->avatarGenerator->generateFor($user)); + } + } +} diff --git a/resources/js/Pages/Dashboard.vue b/resources/js/Pages/Dashboard.vue index 0587ba2..62f9576 100644 --- a/resources/js/Pages/Dashboard.vue +++ b/resources/js/Pages/Dashboard.vue @@ -221,7 +221,7 @@ export default { default: () => ({ used: 0, pending: 0, - other: 0, + remaining: 0, }), }, }, -- 2.52.0 From e442da9303eb4ef6f98fa5e9541cbf3798ca08dd Mon Sep 17 00:00:00 2001 From: EwelinaLasowy Date: Fri, 25 Feb 2022 16:20:08 +0100 Subject: [PATCH 03/26] wip --- .../Http/Controllers/DashboardController.php | 11 ++ database/seeders/DemoSeeder.php | 124 ++++++++++++++++-- resources/js/Pages/Dashboard.vue | 74 ++++++++--- resources/js/Shared/MainMenu.vue | 2 +- 4 files changed, 181 insertions(+), 30 deletions(-) diff --git a/app/Infrastructure/Http/Controllers/DashboardController.php b/app/Infrastructure/Http/Controllers/DashboardController.php index 4dda8e2..053fcf4 100644 --- a/app/Infrastructure/Http/Controllers/DashboardController.php +++ b/app/Infrastructure/Http/Controllers/DashboardController.php @@ -66,6 +66,16 @@ class DashboardController extends Controller ) ->count(); + $onRequest = $request->user() + ->vacations() + ->whereRelation( + "vacationRequest", + fn(Builder $query) => $query + ->where("type", VacationType::OnRequest) + ->states(VacationRequestState::successStates()), + ) + ->count(); + $pending = $request->user() ->vacations() ->whereRelation( @@ -96,6 +106,7 @@ class DashboardController extends Controller "used" => $used, "pending" => $pending, "other" => $other, + "onRequest" => 4 - $onRequest, ], ]); } diff --git a/database/seeders/DemoSeeder.php b/database/seeders/DemoSeeder.php index 5f96ff7..4b210c7 100644 --- a/database/seeders/DemoSeeder.php +++ b/database/seeders/DemoSeeder.php @@ -146,8 +146,8 @@ class DemoSeeder extends Seeder $currentYearPeriod = YearPeriod::query()->where("year", 2022)->first(); - /** @var VacationRequest $vacationRequest */ - $vacationRequest = VacationRequest::factory([ + /** @var VacationRequest $vacationRequestApproved */ + $vacationRequestApproved = VacationRequest::factory([ "type" => VacationType::Vacation->value, "state" => VacationRequestState::Created, "from" => Carbon::create($currentYearPeriod->year, 1, 31)->toDateString(), @@ -177,43 +177,149 @@ class DemoSeeder extends Seeder VacationRequestActivity::factory([ "from" => null, "to" => VacationRequestState::Created, - ])->for($vacationRequest) + ])->for($vacationRequestApproved) ->for($employee1) ->create(); VacationRequestActivity::factory([ "from" => VacationRequestState::Created, "to" => VacationRequestState::WaitingForTechnical, - ])->for($vacationRequest) + ])->for($vacationRequestApproved) ->create(); VacationRequestActivity::factory([ "from" => VacationRequestState::WaitingForTechnical, "to" => VacationRequestState::AcceptedByTechnical, - ])->for($vacationRequest) + ])->for($vacationRequestApproved) ->for($technicalApprover) ->create(); VacationRequestActivity::factory([ "from" => VacationRequestState::AcceptedByTechnical, "to" => VacationRequestState::WaitingForAdministrative, - ])->for($vacationRequest) + ])->for($vacationRequestApproved) ->create(); VacationRequestActivity::factory([ "from" => VacationRequestState::WaitingForAdministrative, "to" => VacationRequestState::AcceptedByAdministrative, - ])->for($vacationRequest) + ])->for($vacationRequestApproved) ->for($administrativeApprover) ->create(); VacationRequestActivity::factory([ "from" => VacationRequestState::AcceptedByAdministrative, "to" => VacationRequestState::Approved, - ])->for($vacationRequest) + ])->for($vacationRequestApproved) ->create(); - $vacationRequest->changeStateTo(VacationRequestState::Approved); + $vacationRequestApproved->changeStateTo(VacationRequestState::Approved); + + /** @var VacationRequest $vacationRequestWaitsForAdminApproval */ + $vacationRequestWaitsForAdminApproval = VacationRequest::factory([ + "type" => VacationType::Vacation->value, + "state" => VacationRequestState::Created, + "from" => Carbon::create($currentYearPeriod->year, 2, 14)->toDateString(), + "to" => Carbon::create($currentYearPeriod->year, 2, 14)->toDateString(), + "comment" => "Komentarz do wniosku urlopowego.", + ]) + ->for($employee1) + ->for($employee1, "creator") + ->for($currentYearPeriod) + ->afterCreating(function (VacationRequest $vacationRequest): void { + $days = app(VacationDaysCalculator::class)->calculateDays( + $vacationRequest->yearPeriod, + $vacationRequest->from, + $vacationRequest->to, + ); + + foreach ($days as $day) { + $vacationRequest->vacations()->create([ + "date" => $day, + "user_id" => $vacationRequest->user->id, + "year_period_id" => $vacationRequest->yearPeriod->id, + ]); + } + }) + ->create(); + + VacationRequestActivity::factory([ + "from" => null, + "to" => VacationRequestState::Created, + ])->for($vacationRequestWaitsForAdminApproval) + ->for($employee1) + ->create(); + + VacationRequestActivity::factory([ + "from" => VacationRequestState::Created, + "to" => VacationRequestState::WaitingForTechnical, + ])->for($vacationRequestWaitsForAdminApproval) + ->create(); + + VacationRequestActivity::factory([ + "from" => VacationRequestState::WaitingForTechnical, + "to" => VacationRequestState::AcceptedByTechnical, + ])->for($vacationRequestWaitsForAdminApproval) + ->for($technicalApprover) + ->create(); + + VacationRequestActivity::factory([ + "from" => VacationRequestState::AcceptedByTechnical, + "to" => VacationRequestState::WaitingForAdministrative, + ])->for($vacationRequestWaitsForAdminApproval) + ->create(); + + $vacationRequestWaitsForAdminApproval->changeStateTo(VacationRequestState::WaitingForAdministrative); + + /** @var VacationRequest $vacationRequestRejected */ + $vacationRequestRejected = VacationRequest::factory([ + "type" => VacationType::Vacation->value, + "state" => VacationRequestState::Created, + "from" => Carbon::create($currentYearPeriod->year, 2, 7)->toDateString(), + "to" => Carbon::create($currentYearPeriod->year, 2, 7)->toDateString(), + "comment" => "", + ]) + ->for($employee1) + ->for($employee1, "creator") + ->for($currentYearPeriod) + ->afterCreating(function (VacationRequest $vacationRequest): void { + $days = app(VacationDaysCalculator::class)->calculateDays( + $vacationRequest->yearPeriod, + $vacationRequest->from, + $vacationRequest->to, + ); + + foreach ($days as $day) { + $vacationRequest->vacations()->create([ + "date" => $day, + "user_id" => $vacationRequest->user->id, + "year_period_id" => $vacationRequest->yearPeriod->id, + ]); + } + }) + ->create(); + + VacationRequestActivity::factory([ + "from" => null, + "to" => VacationRequestState::Created, + ])->for($vacationRequestRejected) + ->for($employee1) + ->create(); + + VacationRequestActivity::factory([ + "from" => VacationRequestState::Created, + "to" => VacationRequestState::WaitingForTechnical, + ])->for($vacationRequestRejected) + ->create(); + + VacationRequestActivity::factory([ + "from" => VacationRequestState::WaitingForTechnical, + "to" => VacationRequestState::Rejected, + ])->for($vacationRequestRejected) + ->for($technicalApprover) + ->create(); + + $vacationRequestRejected->changeStateTo(VacationRequestState::Rejected); } protected function generateAvatarsForUsers(Collection $users): void diff --git a/resources/js/Pages/Dashboard.vue b/resources/js/Pages/Dashboard.vue index 62f9576..ffca69f 100644 --- a/resources/js/Pages/Dashboard.vue +++ b/resources/js/Pages/Dashboard.vue @@ -38,36 +38,70 @@
-
- Limit urlopów -
-
- {{ stats.limit }} -
-
-
-
- Dni do wykorzystania -
-
+
{{ stats.remaining }}
+
+ Pozostało +
+
+ Dni do wykorzystania teraz. +
-
- Dni wykorzystane -
-
+
{{ stats.used }}
+
+ Dni wykorzystane +
+
+ Dni, które zostały już wykorzystane na urlop wypoczynkowy. +
-
- Inne urlopy +
+ {{ stats.pending }}
-
- {{ stats.other }} +
+ Rozpatrywane
+
+ Dni czekające na akceptację przełożonych +
+
+
+
+ {{ stats.limit }} +
+
+ Limit urlopu +
+
+ Twój roczny limit urlopu wypoczynkowego. +
+
+
+
+ {{ stats.onRequest }} +
+
+ Urlop na żądanie +
+
+ Ilość dni urlopu na żądanie, który wlicza się w limit urlopu wypoczynkowego. +
+
+
+
+ {{ stats.other }} +
+
+ Inne urlopy +
+
+ Urlopy bezpłatne, okolicznościowe, zwolnienia lekarskie, itd., które zostały już zatwierdzone. +
diff --git a/resources/js/Shared/MainMenu.vue b/resources/js/Shared/MainMenu.vue index 28f501c..7e91e3b 100644 --- a/resources/js/Shared/MainMenu.vue +++ b/resources/js/Shared/MainMenu.vue @@ -110,7 +110,7 @@ :class="[$page.url === '/' ? 'bg-blumilk-800 text-white' : 'text-blumilk-100 hover:text-white hover:bg-blumilk-600', 'group flex items-center px-2 py-2 text-sm leading-6 font-medium rounded-md']" > - Dashboard + Strona główna
-- 2.52.0 From c050c4c42d7ebdaa575dfa7a791e5d94c1835848 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Mon, 28 Feb 2022 07:33:47 +0100 Subject: [PATCH 04/26] wip --- composer.lock | 144 +++-- package-lock.json | 4 +- package.json | 2 +- resources/js/Pages/VacationRequest/Create.vue | 528 +++++++++--------- resources/js/Shared/Test.vue | 84 +++ routes/api.php | 8 + 6 files changed, 466 insertions(+), 304 deletions(-) create mode 100644 resources/js/Shared/Test.vue diff --git a/composer.lock b/composer.lock index bf41929..802db96 100644 --- a/composer.lock +++ b/composer.lock @@ -6,6 +6,62 @@ ], "content-hash": "09609461b05d589abb8bc0cbac9c653c", "packages": [ + { + "name": "asm89/stack-cors", + "version": "v2.1.1", + "source": { + "type": "git", + "url": "https://github.com/asm89/stack-cors.git", + "reference": "73e5b88775c64ccc0b84fb60836b30dc9d92ac4a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/asm89/stack-cors/zipball/73e5b88775c64ccc0b84fb60836b30dc9d92ac4a", + "reference": "73e5b88775c64ccc0b84fb60836b30dc9d92ac4a", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0", + "symfony/http-foundation": "^4|^5|^6", + "symfony/http-kernel": "^4|^5|^6" + }, + "require-dev": { + "phpunit/phpunit": "^7|^9", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "autoload": { + "psr-4": { + "Asm89\\Stack\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alexander", + "email": "iam.asm89@gmail.com" + } + ], + "description": "Cross-origin resource sharing library and stack middleware", + "homepage": "https://github.com/asm89/stack-cors", + "keywords": [ + "cors", + "stack" + ], + "support": { + "issues": "https://github.com/asm89/stack-cors/issues", + "source": "https://github.com/asm89/stack-cors/tree/v2.1.1" + }, + "time": "2022-01-18T09:12:03+00:00" + }, { "name": "azuyalabs/yasumi", "version": "2.5.0", @@ -763,20 +819,20 @@ }, { "name": "fruitcake/laravel-cors", - "version": "v2.1.0", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/fruitcake/laravel-cors.git", - "reference": "361d71f00a0eea8b74da26ae75d0d207c53aa5b3" + "reference": "783a74f5e3431d7b9805be8afb60fd0a8f743534" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fruitcake/laravel-cors/zipball/361d71f00a0eea8b74da26ae75d0d207c53aa5b3", - "reference": "361d71f00a0eea8b74da26ae75d0d207c53aa5b3", + "url": "https://api.github.com/repos/fruitcake/laravel-cors/zipball/783a74f5e3431d7b9805be8afb60fd0a8f743534", + "reference": "783a74f5e3431d7b9805be8afb60fd0a8f743534", "shasum": "" }, "require": { - "fruitcake/php-cors": "^1", + "asm89/stack-cors": "^2.0.1", "illuminate/contracts": "^6|^7|^8|^9", "illuminate/support": "^6|^7|^8|^9", "php": ">=7.2" @@ -826,7 +882,7 @@ ], "support": { "issues": "https://github.com/fruitcake/laravel-cors/issues", - "source": "https://github.com/fruitcake/laravel-cors/tree/v2.1.0" + "source": "https://github.com/fruitcake/laravel-cors/tree/v2.2.0" }, "funding": [ { @@ -838,7 +894,7 @@ "type": "github" } ], - "time": "2022-02-19T14:17:28+00:00" + "time": "2022-02-23T14:25:13+00:00" }, { "name": "fruitcake/php-cors", @@ -1295,12 +1351,12 @@ } }, "autoload": { - "psr-4": { - "GuzzleHttp\\Promise\\": "src/" - }, "files": [ "src/functions_include.php" - ] + ], + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1622,16 +1678,16 @@ }, { "name": "laravel/framework", - "version": "v9.1.0", + "version": "v9.2.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "ca7ddd4782f120ae50569d04eb9e40e52f67a9d9" + "reference": "13372872bed31ae75df8709b9de5cde01d50646e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/ca7ddd4782f120ae50569d04eb9e40e52f67a9d9", - "reference": "ca7ddd4782f120ae50569d04eb9e40e52f67a9d9", + "url": "https://api.github.com/repos/laravel/framework/zipball/13372872bed31ae75df8709b9de5cde01d50646e", + "reference": "13372872bed31ae75df8709b9de5cde01d50646e", "shasum": "" }, "require": { @@ -1640,6 +1696,7 @@ "egulias/email-validator": "^3.1", "ext-mbstring": "*", "ext-openssl": "*", + "fruitcake/php-cors": "^1.2", "laravel/serializable-closure": "^1.0", "league/commonmark": "^2.2", "league/flysystem": "^3.0", @@ -1714,7 +1771,7 @@ "league/flysystem-ftp": "^3.0", "league/flysystem-sftp-v3": "^3.0", "mockery/mockery": "^1.4.4", - "orchestra/testbench-core": "^7.0", + "orchestra/testbench-core": "^7.1", "pda/pheanstalk": "^4.0", "phpstan/phpstan": "^1.0", "phpunit/phpunit": "^9.5.8", @@ -1796,20 +1853,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2022-02-15T15:06:44+00:00" + "time": "2022-02-22T15:30:23+00:00" }, { "name": "laravel/sanctum", - "version": "v2.14.1", + "version": "v2.14.2", "source": { "type": "git", "url": "https://github.com/laravel/sanctum.git", - "reference": "89937617fa144ddb759a740861a47c4f2fd2245b" + "reference": "dc5d749ba9bfcfd68d8f5c272238f88bea223e66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/sanctum/zipball/89937617fa144ddb759a740861a47c4f2fd2245b", - "reference": "89937617fa144ddb759a740861a47c4f2fd2245b", + "url": "https://api.github.com/repos/laravel/sanctum/zipball/dc5d749ba9bfcfd68d8f5c272238f88bea223e66", + "reference": "dc5d749ba9bfcfd68d8f5c272238f88bea223e66", "shasum": "" }, "require": { @@ -1860,7 +1917,7 @@ "issues": "https://github.com/laravel/sanctum/issues", "source": "https://github.com/laravel/sanctum" }, - "time": "2022-02-15T08:08:57+00:00" + "time": "2022-02-16T14:40:23+00:00" }, { "name": "laravel/serializable-closure", @@ -2477,16 +2534,16 @@ }, { "name": "league/flysystem", - "version": "3.0.8", + "version": "3.0.9", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "30f2c7069b2625da5b126ac66cbea7618a3db8b6" + "reference": "fb0801a60b7f9ea4188f01c25cb48aed26db7fb6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/30f2c7069b2625da5b126ac66cbea7618a3db8b6", - "reference": "30f2c7069b2625da5b126ac66cbea7618a3db8b6", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/fb0801a60b7f9ea4188f01c25cb48aed26db7fb6", + "reference": "fb0801a60b7f9ea4188f01c25cb48aed26db7fb6", "shasum": "" }, "require": { @@ -2546,7 +2603,7 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/3.0.8" + "source": "https://github.com/thephpleague/flysystem/tree/3.0.9" }, "funding": [ { @@ -2562,7 +2619,7 @@ "type": "tidelift" } ], - "time": "2022-02-16T18:51:54+00:00" + "time": "2022-02-22T07:37:40+00:00" }, { "name": "league/mime-type-detection", @@ -7739,9 +7796,6 @@ "require": { "php": "^7.1 || ^8.0" }, - "replace": { - "myclabs/deep-copy": "self.version" - }, "require-dev": { "doctrine/collections": "^1.0", "doctrine/common": "^2.6", @@ -8272,16 +8326,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.11", + "version": "9.2.13", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "665a1ac0a763c51afc30d6d130dac0813092b17f" + "reference": "deac8540cb7bd40b2b8cfa679b76202834fd04e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/665a1ac0a763c51afc30d6d130dac0813092b17f", - "reference": "665a1ac0a763c51afc30d6d130dac0813092b17f", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/deac8540cb7bd40b2b8cfa679b76202834fd04e8", + "reference": "deac8540cb7bd40b2b8cfa679b76202834fd04e8", "shasum": "" }, "require": { @@ -8337,7 +8391,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.11" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.13" }, "funding": [ { @@ -8345,7 +8399,7 @@ "type": "github" } ], - "time": "2022-02-18T12:46:09+00:00" + "time": "2022-02-23T17:02:38+00:00" }, { "name": "phpunit/php-file-iterator", @@ -8590,16 +8644,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.14", + "version": "9.5.16", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "1883687169c017d6ae37c58883ca3994cfc34189" + "reference": "5ff8c545a50226c569310a35f4fa89d79f1ddfdc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1883687169c017d6ae37c58883ca3994cfc34189", - "reference": "1883687169c017d6ae37c58883ca3994cfc34189", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5ff8c545a50226c569310a35f4fa89d79f1ddfdc", + "reference": "5ff8c545a50226c569310a35f4fa89d79f1ddfdc", "shasum": "" }, "require": { @@ -8615,7 +8669,7 @@ "phar-io/version": "^3.0.2", "php": ">=7.3", "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2.7", + "phpunit/php-code-coverage": "^9.2.13", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -8677,7 +8731,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.14" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.16" }, "funding": [ { @@ -8689,7 +8743,7 @@ "type": "github" } ], - "time": "2022-02-18T12:54:07+00:00" + "time": "2022-02-23T17:10:58+00:00" }, { "name": "sebastian/cli-parser", @@ -10055,5 +10109,5 @@ "ext-pdo": "*" }, "platform-dev": [], - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.2.0" } diff --git a/package-lock.json b/package-lock.json index 1d8d8f7..8994c3c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "application", + "name": "toby", "lockfileVersion": 2, "requires": true, "packages": { @@ -16,7 +16,7 @@ "@vue/compiler-sfc": "^3.2.26", "autoprefixer": "^10.4.2", "axios": "^0.25.0", - "echarts": "^5.2.2", + "echarts": "^5.3.0", "flatpickr": "^4.6.9", "laravel-mix": "^6.0.6", "lodash": "^4.17.21", diff --git a/package.json b/package.json index 9588eff..f35c216 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "@vue/compiler-sfc": "^3.2.26", "autoprefixer": "^10.4.2", "axios": "^0.25.0", - "echarts": "^5.2.2", + "echarts": "^5.3.0", "flatpickr": "^4.6.9", "laravel-mix": "^6.0.6", "lodash": "^4.17.21", diff --git a/resources/js/Pages/VacationRequest/Create.vue b/resources/js/Pages/VacationRequest/Create.vue index d36105c..62711d9 100644 --- a/resources/js/Pages/VacationRequest/Create.vue +++ b/resources/js/Pages/VacationRequest/Create.vue @@ -1,273 +1,287 @@