Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Baakoma committed Oct 21, 2024
1 parent 93210fd commit d486131
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 2 deletions.
21 changes: 21 additions & 0 deletions app/Console/Commands/MigrateYearPeriodYearToVacationLimits.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

namespace Toby\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;

class MigrateYearPeriodYearToVacationLimits extends Command
{
protected $signature = "toby:migrate-year-period-year-to-vacation-limits";
protected $description = "Migrate year period to vacation limits";

public function handle(): void
{
DB::table("vacation_limits")
->join("year_periods", "year_periods.id", "=", "vacation_limits.year_period_id")
->update(["vacation_limits.year" => DB::raw("year_periods.year")]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});
}
};
8 changes: 8 additions & 0 deletions resources/js/Pages/MonthlyUsage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ watch(selectedYear, (value, oldValue) => {
</div>
</td>
</tr>
<tr v-if="!monthlyUsage.length">
<td
class="py-4 text-xl leading-5 text-center text-gray-700"
colspan="100%"
>
Brak danych
</td>
</tr>
</tbody>
</table>
</div>
Expand Down
1 change: 0 additions & 1 deletion resources/js/Pages/VacationRequest/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions resources/js/Pages/VacationRequest/IndexForApprovers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d486131

Please sign in to comment.