Add the task calendar, holidays, workflow templates and customer removal

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]>
This commit is contained in:
2026-11-24 18:13:11 +02:00
co-authored by Claude Opus 5.5
parent dfe4941f02
commit b4f2f1cfaa
134 changed files with 6930 additions and 45 deletions
@@ -0,0 +1,35 @@
<?php
use App\Modules\Jobs\Application\DTOs\CalendarAssignment;
use App\Modules\Jobs\Application\DTOs\CalendarTask;
use App\Modules\Jobs\Application\Services\TaskCalendarLayout;
use App\Modules\Jobs\Domain\Enums\TaskStatus;
/**
* @param list<CalendarAssignment> $assignments
*/
function calendarTask(int $id, string $from, string $to, array $assignments, ?string $dueOn = null): CalendarTask
{
return new CalendarTask($id, 1, '2026-001', 'Kampanja', 'Tehtävä '.$id, TaskStatus::Waiting, $dueOn, null, $from, $to, $assignments);
}
it('puts each task on its assignees rows and overlapping tasks on their own lanes', function () {
$days = ['2026-12-07', '2026-12-08', '2026-12-09', '2026-12-10'];
$tasks = [
calendarTask(1, '2026-12-07', '2026-12-08', [new CalendarAssignment(10, '2026-12-07', '2026-12-08', 480), new CalendarAssignment(11, '2026-12-07', '2026-12-09', 480)]),
calendarTask(2, '2026-12-08', '2026-12-08', [new CalendarAssignment(10, '2026-12-08', '2026-12-08', 120)]),
calendarTask(3, '2026-12-09', '2026-12-20', [new CalendarAssignment(10, null, null, 0)], dueOn: '2026-12-15'),
calendarTask(4, '2026-12-01', '2026-12-07', []),
];
$people = [['id' => 10, 'name' => 'Eero'], ['id' => 11, 'name' => 'Aino'], ['id' => null, 'name' => 'Ei tekijää']];
$rows = TaskCalendarLayout::build($days, $people, $tasks, [10 => ['2026-12-08' => 360]]);
$bars = fn (int $row): array => array_map(fn ($bar) => [$bar->task->taskId, $bar->start, $bar->span, $bar->lane, $bar->late], $rows[$row]->bars);
expect($bars(0))->toBe([[1, 0, 2, 0, false], [2, 1, 1, 1, false], [3, 2, 2, 0, true]])
->and($rows[0]->lanes)->toBe(2)
->and($rows[0]->minutesByDay)->toBe(['2026-12-07' => 0, '2026-12-08' => 360, '2026-12-09' => 0, '2026-12-10' => 0])
->and($bars(1))->toBe([[1, 0, 3, 0, false]])
->and($bars(2))->toBe([[4, 0, 1, 0, false]])
->and(array_map(fn ($bar) => $bar->task->taskId, $rows[0]->barsOn(1)))->toBe([1, 2]);
});