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]>
39 lines
1.2 KiB
PHP
39 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Tests\Fakes;
|
|
|
|
use App\Modules\Catalog\Domain\Contracts\WorkflowTemplateRepository;
|
|
use App\Modules\Catalog\Domain\Entities\WorkflowTemplate;
|
|
|
|
class InMemoryWorkflowTemplateRepository implements WorkflowTemplateRepository
|
|
{
|
|
/** @var array<int, WorkflowTemplate> */
|
|
public array $items = [];
|
|
|
|
private int $nextId = 1;
|
|
|
|
public function findById(int $id): ?WorkflowTemplate
|
|
{
|
|
return isset($this->items[$id]) ? clone $this->items[$id] : null;
|
|
}
|
|
|
|
public function save(WorkflowTemplate $template): WorkflowTemplate
|
|
{
|
|
$id = $template->id() ?? $this->nextId++;
|
|
$this->items[$id] = WorkflowTemplate::reconstitute($id, $template->workTypeId(), $template->name(), $template->isActive(), $template->steps());
|
|
|
|
return clone $this->items[$id];
|
|
}
|
|
|
|
public function isNameTaken(int $workTypeId, string $name, ?int $exceptId = null): bool
|
|
{
|
|
foreach ($this->items as $id => $template) {
|
|
if ($id !== $exceptId && $template->workTypeId() === $workTypeId && mb_strtolower($template->name()->value) === mb_strtolower($name)) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|