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:
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Fakes;
|
||||
|
||||
use App\Modules\Catalog\Application\Contracts\WorkflowTemplateQueries;
|
||||
use App\Modules\Catalog\Application\DTOs\WorkflowStepSummary;
|
||||
use App\Modules\Catalog\Application\DTOs\WorkflowTemplateDetails;
|
||||
use App\Modules\Catalog\Application\DTOs\WorkflowTemplateSummary;
|
||||
|
||||
class FakeWorkflowTemplateQueries implements WorkflowTemplateQueries
|
||||
{
|
||||
/** @var array<int, WorkflowTemplateDetails> */
|
||||
public array $templates = [];
|
||||
|
||||
/**
|
||||
* @param list<array{0: string, 1?: int|null}> $steps Title and the step's own work type.
|
||||
*/
|
||||
public function addTemplate(int $id, string $name, int $workTypeId, int $serviceUnitId, array $steps, bool $active = true): void
|
||||
{
|
||||
$this->templates[$id] = new WorkflowTemplateDetails(
|
||||
$id,
|
||||
$name,
|
||||
$workTypeId,
|
||||
'työtehtävä '.$workTypeId,
|
||||
$serviceUnitId,
|
||||
$active,
|
||||
array_map(fn (array $step): WorkflowStepSummary => new WorkflowStepSummary(
|
||||
$step[0],
|
||||
null,
|
||||
$step[1] ?? null,
|
||||
$step[1] ?? $workTypeId,
|
||||
'työtehtävä '.($step[1] ?? $workTypeId),
|
||||
), $steps),
|
||||
);
|
||||
}
|
||||
|
||||
public function all(): array
|
||||
{
|
||||
return array_values(array_map(fn (WorkflowTemplateDetails $template): WorkflowTemplateSummary => new WorkflowTemplateSummary(
|
||||
$template->id,
|
||||
$template->name,
|
||||
$template->workTypeId,
|
||||
$template->workTypeName,
|
||||
$template->serviceUnitId,
|
||||
'yksikkö '.$template->serviceUnitId,
|
||||
$template->isActive,
|
||||
count($template->steps),
|
||||
), $this->templates));
|
||||
}
|
||||
|
||||
public function find(int $id): ?WorkflowTemplateDetails
|
||||
{
|
||||
return $this->templates[$id] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unit 9 plays the shared unit.
|
||||
*/
|
||||
public function activeFor(array $serviceUnitIds): array
|
||||
{
|
||||
return array_values(array_filter(
|
||||
$this->templates,
|
||||
fn (WorkflowTemplateDetails $template): bool => $template->isActive
|
||||
&& (in_array($template->serviceUnitId, $serviceUnitIds, true) || $template->serviceUnitId === 9),
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user