Give tasks one assignee and members, and schedule template tasks to due dates
- A task now has one optional assignee (tasks.assignee_user_id), whose calendar row it is on and whose days its estimate books, and members (task_members) who see it among their own jobs and in the weekly sheet but get no bookings. A migration moves existing assignees over: the one with most booked time becomes the assignee, the others members. - Adding tasks from a workflow template asks for each step's assignee and, by default, schedules tasks with a due date to end on it, booking the estimate backwards from the due date (not before today); what does not fit runs past the due date and is reported as late. - The task calendar leaves quick sale tasks out of the unscheduled list, shows a bar's job details in a popover on hover and focus, and shows the day load on its own grid line. - The template table stacks its cells on narrow screens to reflow at 320 px. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -36,8 +36,10 @@ class TaskForm extends Form
|
||||
|
||||
public string $description = '';
|
||||
|
||||
public string $assignee_user_id = '';
|
||||
|
||||
/** @var list<string> */
|
||||
public array $assignee_user_ids = [];
|
||||
public array $member_user_ids = [];
|
||||
|
||||
public function fillFromSummary(TaskSummary $task): void
|
||||
{
|
||||
@@ -49,7 +51,8 @@ class TaskForm extends Form
|
||||
$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);
|
||||
$this->assignee_user_id = $task->assignee === null ? '' : (string) $task->assignee->id;
|
||||
$this->member_user_ids = array_map(fn (NamedId $user): string => (string) $user->id, $task->members);
|
||||
}
|
||||
|
||||
public function toData(): TaskData
|
||||
@@ -63,7 +66,8 @@ class TaskForm extends Form
|
||||
description: trim($this->description) === '' ? null : $this->description,
|
||||
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),
|
||||
assigneeUserId: $this->assignee_user_id === '' ? null : (int) $this->assignee_user_id,
|
||||
memberUserIds: array_map('intval', $this->member_user_ids),
|
||||
plannedFrom: $this->planned_from === '' ? null : $this->planned_from,
|
||||
plannedTo: $this->planned_from === '' || $this->planned_to === '' ? null : $this->planned_to,
|
||||
);
|
||||
@@ -76,7 +80,11 @@ class TaskForm extends Form
|
||||
$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'],
|
||||
$exception instanceof InvalidTaskReference => [match ($exception->field) {
|
||||
'work_type' => 'work_type_id',
|
||||
'assignee' => 'assignee_user_id',
|
||||
default => 'member_user_ids',
|
||||
}, 'jobs.errors.invalid_reference'],
|
||||
default => throw $exception,
|
||||
};
|
||||
|
||||
@@ -97,8 +105,9 @@ class TaskForm extends Form
|
||||
'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'],
|
||||
'assignee_user_ids.*' => ['integer'],
|
||||
'assignee_user_id' => ['nullable', 'integer'],
|
||||
'member_user_ids' => ['array'],
|
||||
'member_user_ids.*' => ['integer'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user