Files
petriandClaude Sonnet 5.5 f906f9a43f Add notifications: header bell, task start run and assignment notices
A new Notifications module shows a bell beside the profile menu with the
number of unseen notifications and a panel of the last 7 days; opening
it marks them seen, and each notification links to its job or task.

- A daily run at 14.00 (notifications:task-starts) tells the assignee
  and members of tasks that start by the next working day, skipping
  holidays and days off, done tasks and archived jobs.
- Jobs publishes PeopleAddedToTask and PeopleAddedToJob when someone
  else makes a user a task's assignee or member or gives them a role on
  a job; those users are notified at once. UpdateTask and ScheduleTask
  now take the acting user.
- A notification link to #task-<id> opens that task card on the job page.

Also: simplifying job fields per service unit (K31) moves to the end of
phase 4, and the workflow template browser test waits for Livewire's
progress bar before its last accessibility check.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-11-25 08:28:01 +02:00

40 lines
1018 B
PHP

<?php
declare(strict_types=1);
namespace App\Modules\Notifications\Application\Services;
use App\Modules\Shared\Application\UseCases\HolidayCalendar;
use DateTimeImmutable;
/**
* Working days: Monday to Friday except holidays in use and the company's
* days off.
*/
final readonly class WorkingDays
{
public function __construct(private HolidayCalendar $holidays) {}
public function isWorkingDay(DateTimeImmutable $day): bool
{
$date = $day->format('Y-m-d');
return (int) $day->format('N') <= 5 && $this->holidays->activeDatesBetween($date, $date) === [];
}
/**
* The first working day after the given day.
*/
public function nextAfter(DateTimeImmutable $day): DateTimeImmutable
{
$next = $day->modify('+1 day');
// A month of days off in a row would be a mistake in the settings.
for ($i = 0; $i < 31 && ! $this->isWorkingDay($next); $i++) {
$next = $next->modify('+1 day');
}
return $next;
}
}