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,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Jobs\Application\DTOs;
|
||||
|
||||
/**
|
||||
* One assignee's part of a scheduled task: the first and last booked day
|
||||
* (null when the task books no time, e.g. without an estimate) and the
|
||||
* booked minutes.
|
||||
*/
|
||||
final readonly class CalendarAssignment
|
||||
{
|
||||
public function __construct(
|
||||
public int $userId,
|
||||
public ?string $from,
|
||||
public ?string $to,
|
||||
public int $minutes,
|
||||
) {}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Jobs\Application\DTOs;
|
||||
|
||||
/**
|
||||
* A task's bar on one row of the task calendar. Start and span are in
|
||||
* visible day columns (0 = the first day shown); a bar that continues
|
||||
* past the shown days is cut at the edge. Lane is the bar's line inside
|
||||
* the row, so that overlapping tasks do not cover each other.
|
||||
*/
|
||||
final readonly class CalendarBar
|
||||
{
|
||||
public function __construct(
|
||||
public CalendarTask $task,
|
||||
public ?int $userId,
|
||||
public string $from,
|
||||
public string $to,
|
||||
public int $minutes,
|
||||
public int $start,
|
||||
public int $span,
|
||||
public int $lane,
|
||||
public bool $late,
|
||||
) {}
|
||||
|
||||
public function key(): string
|
||||
{
|
||||
return $this->task->taskId.'-'.($this->userId ?? 'none');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Jobs\Application\DTOs;
|
||||
|
||||
/**
|
||||
* One person's row of the task calendar (userId null: tasks without an
|
||||
* assignee), with the minutes their open tasks book per shown day.
|
||||
*/
|
||||
final readonly class CalendarRow
|
||||
{
|
||||
/**
|
||||
* @param array<string, int> $minutesByDay Y-m-d => minutes, for every shown day.
|
||||
* @param list<CalendarBar> $bars Ordered by start.
|
||||
*/
|
||||
public function __construct(
|
||||
public ?int $userId,
|
||||
public string $name,
|
||||
public array $minutesByDay,
|
||||
public array $bars,
|
||||
public int $lanes,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @return list<CalendarBar> The bars that are on the day.
|
||||
*/
|
||||
public function barsOn(int $dayIndex): array
|
||||
{
|
||||
return array_values(array_filter($this->bars, fn (CalendarBar $bar): bool => $bar->start <= $dayIndex && $dayIndex < $bar->start + $bar->span));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Jobs\Application\DTOs;
|
||||
|
||||
use App\Modules\Jobs\Domain\Enums\TaskStatus;
|
||||
|
||||
/**
|
||||
* A task as the task calendar shows it. Dates are Y-m-d.
|
||||
*/
|
||||
final readonly class CalendarTask
|
||||
{
|
||||
/**
|
||||
* @param list<CalendarAssignment> $assignments One per assignee.
|
||||
*/
|
||||
public function __construct(
|
||||
public int $taskId,
|
||||
public int $jobId,
|
||||
public string $jobNumber,
|
||||
public string $jobName,
|
||||
public string $title,
|
||||
public TaskStatus $status,
|
||||
public ?string $dueOn,
|
||||
public ?string $estimatedHours,
|
||||
public ?string $plannedFrom,
|
||||
public ?string $plannedTo,
|
||||
public array $assignments,
|
||||
) {}
|
||||
|
||||
public function assignmentOf(int $userId): ?CalendarAssignment
|
||||
{
|
||||
foreach ($this->assignments as $assignment) {
|
||||
if ($assignment->userId === $userId) {
|
||||
return $assignment;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Jobs\Application\DTOs;
|
||||
|
||||
/**
|
||||
* A task's planned schedule after it was moved, resized or given to
|
||||
* another person. Extended: the assignee's days were full, so the task
|
||||
* ends later than asked.
|
||||
*/
|
||||
final readonly class ScheduleResult
|
||||
{
|
||||
public function __construct(
|
||||
public string $plannedFrom,
|
||||
public string $plannedTo,
|
||||
public bool $extended,
|
||||
) {}
|
||||
}
|
||||
@@ -5,7 +5,8 @@ declare(strict_types=1);
|
||||
namespace App\Modules\Jobs\Application\DTOs;
|
||||
|
||||
/**
|
||||
* Input for adding or changing a task. The due date is Y-m-d.
|
||||
* Input for adding or changing a task. Dates are Y-m-d; a planned start
|
||||
* without an end plans one day.
|
||||
*/
|
||||
final readonly class TaskData
|
||||
{
|
||||
@@ -20,5 +21,7 @@ final readonly class TaskData
|
||||
public ?string $dueOn = null,
|
||||
public ?string $estimatedHours = null,
|
||||
public array $assigneeUserIds = [],
|
||||
public ?string $plannedFrom = null,
|
||||
public ?string $plannedTo = null,
|
||||
) {}
|
||||
}
|
||||
|
||||
@@ -24,5 +24,7 @@ final readonly class TaskSummary
|
||||
public ?string $estimatedHours,
|
||||
public NamedId $workType,
|
||||
public array $assignees,
|
||||
public ?string $plannedFrom = null,
|
||||
public ?string $plannedTo = null,
|
||||
) {}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Jobs\Application\DTOs;
|
||||
|
||||
/**
|
||||
* Due date (Y-m-d) and estimated hours ("1,5") entered for the task of one
|
||||
* workflow template step. Both are optional.
|
||||
*/
|
||||
final readonly class TemplateTaskSchedule
|
||||
{
|
||||
public function __construct(
|
||||
public ?string $dueOn = null,
|
||||
public ?string $estimatedHours = null,
|
||||
) {}
|
||||
}
|
||||
Reference in New Issue
Block a user