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,13 @@
<?php
declare(strict_types=1);
namespace App\Modules\Shared\Domain\Exceptions;
final class HolidayAlreadyExists extends DomainException
{
public function __construct()
{
parent::__construct('The day is already a holiday.');
}
}
@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace App\Modules\Shared\Domain\Exceptions;
final class InvalidHolidayName extends DomainException
{
public function __construct()
{
parent::__construct('A company holiday needs a name of 1–100 characters.');
}
}
@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace App\Modules\Shared\Domain\Exceptions;
final class NotAHoliday extends DomainException
{
public function __construct()
{
parent::__construct('The day is not a holiday that can be changed this way.');
}
}
@@ -0,0 +1,85 @@
<?php
declare(strict_types=1);
namespace App\Modules\Shared\Domain\Services;
use DateInterval;
use DateTimeImmutable;
/**
* The Finnish public holidays (arkipyhät) of a year that can fall on a
* weekday, plus Midsummer Eve and Christmas Eve, which are days off in
* practice. Sunday and Saturday holidays (Easter Sunday, Whitsunday,
* Midsummer Day, All Saints' Day) are weekend days anyway.
*/
final class FinnishHolidays
{
public const array KEYS = [
'new_years_day',
'epiphany',
'good_friday',
'easter_monday',
'may_day',
'ascension_day',
'midsummer_eve',
'independence_day',
'christmas_eve',
'christmas_day',
'st_stephens_day',
];
/**
* @return array<string, string> Y-m-d date => holiday key, in date order.
*/
public static function forYear(int $year): array
{
$easter = self::easterSunday($year);
$midsummerEve = new DateTimeImmutable(sprintf('%04d-06-19', $year));
while ($midsummerEve->format('N') !== '5') {
$midsummerEve = $midsummerEve->add(new DateInterval('P1D'));
}
$holidays = [
sprintf('%04d-01-01', $year) => 'new_years_day',
sprintf('%04d-01-06', $year) => 'epiphany',
$easter->sub(new DateInterval('P2D'))->format('Y-m-d') => 'good_friday',
$easter->add(new DateInterval('P1D'))->format('Y-m-d') => 'easter_monday',
sprintf('%04d-05-01', $year) => 'may_day',
$easter->add(new DateInterval('P39D'))->format('Y-m-d') => 'ascension_day',
$midsummerEve->format('Y-m-d') => 'midsummer_eve',
sprintf('%04d-12-06', $year) => 'independence_day',
sprintf('%04d-12-24', $year) => 'christmas_eve',
sprintf('%04d-12-25', $year) => 'christmas_day',
sprintf('%04d-12-26', $year) => 'st_stephens_day',
];
ksort($holidays);
return $holidays;
}
/**
* Easter Sunday by the anonymous Gregorian algorithm (Meeus/Jones/Butcher).
*/
public static function easterSunday(int $year): DateTimeImmutable
{
$a = $year % 19;
$b = intdiv($year, 100);
$c = $year % 100;
$d = intdiv($b, 4);
$e = $b % 4;
$f = intdiv($b + 8, 25);
$g = intdiv($b - $f + 1, 3);
$h = (19 * $a + $b - $d - $g + 15) % 30;
$i = intdiv($c, 4);
$k = $c % 4;
$l = (32 + 2 * $e + 2 * $i - $h - $k) % 7;
$m = intdiv($a + 11 * $h + 22 * $l, 451);
$month = intdiv($h + $l - 7 * $m + 114, 31);
$day = (($h + $l - 7 * $m + 114) % 31) + 1;
return new DateTimeImmutable(sprintf('%04d-%02d-%02d', $year, $month, $day));
}
}