From d4861317ace12c8ff5c8023cfbd708e634805e4a Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Mon, 21 Oct 2024 09:15:28 +0200 Subject: [PATCH] wip --- .../MigrateYearPeriodYearToVacationLimits.php | 21 +++++++++++++++++++ ..._and_add_year_to_vacation_limits_table.php | 8 ++++++- resources/js/Pages/MonthlyUsage.vue | 8 +++++++ resources/js/Pages/VacationRequest/Create.vue | 1 - .../VacationRequest/IndexForApprovers.vue | 1 + 5 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 app/Console/Commands/MigrateYearPeriodYearToVacationLimits.php diff --git a/app/Console/Commands/MigrateYearPeriodYearToVacationLimits.php b/app/Console/Commands/MigrateYearPeriodYearToVacationLimits.php new file mode 100644 index 00000000..f8573953 --- /dev/null +++ b/app/Console/Commands/MigrateYearPeriodYearToVacationLimits.php @@ -0,0 +1,21 @@ +join("year_periods", "year_periods.id", "=", "vacation_limits.year_period_id") + ->update(["vacation_limits.year" => DB::raw("year_periods.year")]); + } +} diff --git a/database/migrations/2024_10_14_110718_delete_year_period_foreign_and_add_year_to_vacation_limits_table.php b/database/migrations/2024_10_14_110718_delete_year_period_foreign_and_add_year_to_vacation_limits_table.php index b4922ee1..cdbfccd6 100644 --- a/database/migrations/2024_10_14_110718_delete_year_period_foreign_and_add_year_to_vacation_limits_table.php +++ b/database/migrations/2024_10_14_110718_delete_year_period_foreign_and_add_year_to_vacation_limits_table.php @@ -4,14 +4,20 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Schema; +use Toby\Console\Commands\MigrateYearPeriodYearToVacationLimits; return new class() extends Migration { public function up(): void { Schema::table("vacation_limits", function (Blueprint $table): void { + $table->integer("year")->nullable(); + + Artisan::call(MigrateYearPeriodYearToVacationLimits::class); + + $table->integer("year")->nullable(false)->change(); $table->dropConstrainedForeignId("year_period_id"); - $table->integer("year"); }); } }; diff --git a/resources/js/Pages/MonthlyUsage.vue b/resources/js/Pages/MonthlyUsage.vue index b520c07a..b4b68c12 100644 --- a/resources/js/Pages/MonthlyUsage.vue +++ b/resources/js/Pages/MonthlyUsage.vue @@ -116,6 +116,14 @@ watch(selectedYear, (value, oldValue) => { + + + Brak danych + + diff --git a/resources/js/Pages/VacationRequest/Create.vue b/resources/js/Pages/VacationRequest/Create.vue index bd3b7801..626e1873 100644 --- a/resources/js/Pages/VacationRequest/Create.vue +++ b/resources/js/Pages/VacationRequest/Create.vue @@ -130,7 +130,6 @@ async function refreshEstimatedDays(from, to, vacationType) { async function refreshVacationStats(user) { const res = await axios.post('/api/vacation/calculate-stats', { user: user.id, year: year.value }) - console.log(res.data) stats.value = res.data } diff --git a/resources/js/Pages/VacationRequest/IndexForApprovers.vue b/resources/js/Pages/VacationRequest/IndexForApprovers.vue index f89ffa13..52e2b634 100644 --- a/resources/js/Pages/VacationRequest/IndexForApprovers.vue +++ b/resources/js/Pages/VacationRequest/IndexForApprovers.vue @@ -55,6 +55,7 @@ watch(form, debounce(() => { user: form.user?.id, status: form.status.value, type: form.type?.value, + year: form.year, }, { preserveState: true, replace: true,