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:
@@ -5,21 +5,19 @@ use App\Modules\Jobs\Application\DTOs\CalendarTask;
|
||||
use App\Modules\Jobs\Application\Services\TaskCalendarLayout;
|
||||
use App\Modules\Jobs\Domain\Enums\TaskStatus;
|
||||
|
||||
/**
|
||||
* @param list<CalendarAssignment> $assignments
|
||||
*/
|
||||
function calendarTask(int $id, string $from, string $to, array $assignments, ?string $dueOn = null): CalendarTask
|
||||
function calendarTask(int $id, string $from, string $to, ?CalendarAssignment $assignment, ?string $dueOn = null): CalendarTask
|
||||
{
|
||||
return new CalendarTask($id, 1, '2026-001', 'Kampanja', 'Tehtävä '.$id, TaskStatus::Waiting, $dueOn, null, $from, $to, $assignments);
|
||||
return new CalendarTask($id, 1, '2026-001', 'Kampanja', 'Tehtävä '.$id, TaskStatus::Waiting, $dueOn, null, $from, $to, $assignment);
|
||||
}
|
||||
|
||||
it('puts each task on its assignees rows and overlapping tasks on their own lanes', function () {
|
||||
it('puts each task on its assignee row and overlapping tasks on their own lanes', function () {
|
||||
$days = ['2026-12-07', '2026-12-08', '2026-12-09', '2026-12-10'];
|
||||
$tasks = [
|
||||
calendarTask(1, '2026-12-07', '2026-12-08', [new CalendarAssignment(10, '2026-12-07', '2026-12-08', 480), new CalendarAssignment(11, '2026-12-07', '2026-12-09', 480)]),
|
||||
calendarTask(2, '2026-12-08', '2026-12-08', [new CalendarAssignment(10, '2026-12-08', '2026-12-08', 120)]),
|
||||
calendarTask(3, '2026-12-09', '2026-12-20', [new CalendarAssignment(10, null, null, 0)], dueOn: '2026-12-15'),
|
||||
calendarTask(4, '2026-12-01', '2026-12-07', []),
|
||||
calendarTask(1, '2026-12-07', '2026-12-08', new CalendarAssignment(10, '2026-12-07', '2026-12-08', 480)),
|
||||
calendarTask(2, '2026-12-08', '2026-12-08', new CalendarAssignment(10, '2026-12-08', '2026-12-08', 120)),
|
||||
calendarTask(3, '2026-12-09', '2026-12-20', new CalendarAssignment(10, null, null, 0), dueOn: '2026-12-15'),
|
||||
calendarTask(4, '2026-12-01', '2026-12-07', null),
|
||||
calendarTask(5, '2026-12-07', '2026-12-08', new CalendarAssignment(11, '2026-12-07', '2026-12-09', 480)),
|
||||
];
|
||||
$people = [['id' => 10, 'name' => 'Eero'], ['id' => 11, 'name' => 'Aino'], ['id' => null, 'name' => 'Ei tekijää']];
|
||||
|
||||
@@ -29,7 +27,7 @@ it('puts each task on its assignees rows and overlapping tasks on their own lane
|
||||
expect($bars(0))->toBe([[1, 0, 2, 0, false], [2, 1, 1, 1, false], [3, 2, 2, 0, true]])
|
||||
->and($rows[0]->lanes)->toBe(2)
|
||||
->and($rows[0]->minutesByDay)->toBe(['2026-12-07' => 0, '2026-12-08' => 360, '2026-12-09' => 0, '2026-12-10' => 0])
|
||||
->and($bars(1))->toBe([[1, 0, 3, 0, false]])
|
||||
->and($bars(1))->toBe([[5, 0, 3, 0, false]])
|
||||
->and($bars(2))->toBe([[4, 0, 1, 0, false]])
|
||||
->and(array_map(fn ($bar) => $bar->task->taskId, $rows[0]->barsOn(1)))->toBe([1, 2]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user