Task calendar (/jobs/calendar) replaces per-unit task Kanban columns (K34): a two-week Gantt of tasks per person. Bars move, resize and change person by dragging or through a keyboard dialog. Each task's estimate is booked evenly over working days into task_bookings, and what exceeds the daily maximum (jobs.daily_capacity_hours, 8 h) moves to the next working day. Tasks get planned_from/planned_to on the form. Holidays (/settings/holidays): Finnish public holidays calculated per year, which the admin can take out of use, plus company days off. Also includes the earlier uncommitted work: workflow templates with adding tasks from a template, and removing customers no module refers to. Co-Authored-By: Claude Opus 5.5 <[email protected]>
45 lines
1.6 KiB
PHP
45 lines
1.6 KiB
PHP
<?php
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Livewire\Livewire;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('lets only the admin open the holidays page', function () {
|
|
$this->actingAs(User::factory()->management()->create());
|
|
$this->get(route('settings.holidays'))->assertForbidden();
|
|
|
|
$this->actingAs(User::factory()->admin()->create());
|
|
$this->get(route('settings.holidays', ['year' => 2026]))
|
|
->assertOk()
|
|
->assertSee('Arkipyhät')
|
|
->assertSee('Vuosi 2026')
|
|
->assertSee('pe 3.4.2026')
|
|
->assertSee('Pitkäperjantai')
|
|
->assertSee('Juhannusaatto');
|
|
});
|
|
|
|
it('takes a holiday out of use and adds and removes a company day off', function () {
|
|
$this->actingAs(User::factory()->admin()->create());
|
|
|
|
Livewire::test('shared::holidays', ['year' => 2026])
|
|
->call('disable', '2026-12-24')
|
|
->assertSee('Jouluaatto (to 24.12.2026) poistettu käytöstä.')
|
|
->assertSee('Ei käytössä')
|
|
->set('date', '2026-12-23')
|
|
->set('name', 'Pikkujoulu')
|
|
->call('add')
|
|
->assertHasNoErrors()
|
|
->assertSee('Pikkujoulu (ke 23.12.2026) lisätty.')
|
|
->set('date', '2026-12-25')
|
|
->set('name', 'Joulu')
|
|
->call('add')
|
|
->assertHasErrors('date')
|
|
->call('remove', '2026-12-23')
|
|
->assertSee('Pikkujoulu (ke 23.12.2026) poistettu.');
|
|
|
|
$this->assertDatabaseHas('holiday_overrides', ['date' => '2026-12-24', 'is_holiday' => false]);
|
|
$this->assertDatabaseMissing('holiday_overrides', ['date' => '2026-12-23']);
|
|
});
|