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:
@@ -9,6 +9,7 @@ use App\Modules\Jobs\Domain\Enums\TaskStatus;
|
||||
use App\Modules\Jobs\Domain\Exceptions\InvalidEstimatedHours;
|
||||
use App\Modules\Jobs\Domain\Exceptions\InvalidTaskReference;
|
||||
use App\Modules\Jobs\Domain\Exceptions\InvalidTaskTitle;
|
||||
use App\Modules\Jobs\Domain\Exceptions\PlanEndsBeforeStart;
|
||||
use App\Modules\Jobs\Domain\Exceptions\TasksNotAllowedYet;
|
||||
use App\Modules\Shared\Domain\Exceptions\DomainException;
|
||||
use Illuminate\Validation\Rule;
|
||||
@@ -29,6 +30,10 @@ class TaskForm extends Form
|
||||
|
||||
public string $estimated_hours = '';
|
||||
|
||||
public string $planned_from = '';
|
||||
|
||||
public string $planned_to = '';
|
||||
|
||||
public string $description = '';
|
||||
|
||||
/** @var list<string> */
|
||||
@@ -41,6 +46,8 @@ class TaskForm extends Form
|
||||
$this->status = $task->status->value;
|
||||
$this->due_on = $task->dueOn ?? '';
|
||||
$this->estimated_hours = $task->estimatedHours ?? '';
|
||||
$this->planned_from = $task->plannedFrom ?? '';
|
||||
$this->planned_to = $task->plannedTo ?? '';
|
||||
$this->description = $task->description ?? '';
|
||||
$this->assignee_user_ids = array_map(fn (NamedId $user): string => (string) $user->id, $task->assignees);
|
||||
}
|
||||
@@ -57,6 +64,8 @@ class TaskForm extends Form
|
||||
dueOn: $this->due_on === '' ? null : $this->due_on,
|
||||
estimatedHours: trim($this->estimated_hours) === '' ? null : $this->estimated_hours,
|
||||
assigneeUserIds: array_map('intval', $this->assignee_user_ids),
|
||||
plannedFrom: $this->planned_from === '' ? null : $this->planned_from,
|
||||
plannedTo: $this->planned_from === '' || $this->planned_to === '' ? null : $this->planned_to,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -66,6 +75,7 @@ class TaskForm extends Form
|
||||
$exception instanceof InvalidTaskTitle => ['title', 'jobs.tasks.errors.invalid_title'],
|
||||
$exception instanceof InvalidEstimatedHours => ['estimated_hours', 'jobs.errors.invalid_hours'],
|
||||
$exception instanceof TasksNotAllowedYet => ['title', 'jobs.tasks.not_allowed_yet'],
|
||||
$exception instanceof PlanEndsBeforeStart => ['planned_to', 'jobs.calendar.errors.to'],
|
||||
$exception instanceof InvalidTaskReference => [$exception->field === 'work_type' ? 'work_type_id' : 'assignee_user_ids', 'jobs.errors.invalid_reference'],
|
||||
default => throw $exception,
|
||||
};
|
||||
@@ -83,6 +93,8 @@ class TaskForm extends Form
|
||||
'work_type_id' => ['required', 'integer'],
|
||||
'status' => ['required', Rule::enum(TaskStatus::class)],
|
||||
'due_on' => ['nullable', 'date_format:Y-m-d'],
|
||||
'planned_from' => ['nullable', 'date_format:Y-m-d'],
|
||||
'planned_to' => ['nullable', 'date_format:Y-m-d', 'after_or_equal:planned_from'],
|
||||
'estimated_hours' => ['nullable', 'numeric', 'min:0', 'max:99999'],
|
||||
'description' => ['nullable', 'string', 'max:10000'],
|
||||
'assignee_user_ids' => ['array'],
|
||||
@@ -100,6 +112,9 @@ class TaskForm extends Form
|
||||
'title.max' => __('jobs.tasks.errors.invalid_title'),
|
||||
'work_type_id.required' => __('jobs.tasks.errors.work_type_required'),
|
||||
'due_on.date_format' => __('jobs.errors.invalid_date'),
|
||||
'planned_from.date_format' => __('jobs.errors.invalid_date'),
|
||||
'planned_to.date_format' => __('jobs.errors.invalid_date'),
|
||||
'planned_to.after_or_equal' => __('jobs.calendar.errors.to'),
|
||||
'estimated_hours.numeric' => __('jobs.errors.invalid_hours'),
|
||||
'estimated_hours.min' => __('jobs.errors.invalid_hours'),
|
||||
'estimated_hours.max' => __('jobs.errors.invalid_hours'),
|
||||
|
||||
Reference in New Issue
Block a user