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:
2026-11-24 19:01:11 +02:00
co-authored by Claude Opus 5.5
parent b4f2f1cfaa
commit 18598cc08e
45 changed files with 1133 additions and 248 deletions
@@ -5,7 +5,6 @@ use App\Modules\Catalog\Infrastructure\Persistence\Eloquent\WorkTypeModel;
use App\Modules\Jobs\Infrastructure\Persistence\Eloquent\CustomerJobModel;
use App\Modules\Jobs\Infrastructure\Persistence\Eloquent\TaskModel;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
uses(RefreshDatabase::class);
@@ -61,6 +60,28 @@ it('reschedules a task with the keyboard and returns focus to its bar', function
expect($this->task->refresh()->planned_from?->format('Y-m-d'))->toBe(now()->addDay()->toDateString());
});
it('shows the job details of a bar on hover and focus, and closes them with Escape', function (string $colorScheme) {
$key = $this->task->id.'-'.$this->user->id;
$open = "document.getElementById('bar-info-{$key}').matches(':popover-open')";
$visit = visit(route('jobs.calendar'))->on()->desktop();
$visit = $colorScheme === 'dark' ? $visit->inDarkMode() : $visit->inLightMode();
$visit->hover('#bar-'.$key)
->assertScript($open, true)
->assertSee('Messuvideo')
->assertSee('Johanna Johto')
->assertNoAccessibilityIssues(level: 2)
->hover('#bar-info-'.$key)
->assertScript($open, true)
->keys('#bar-'.$key, 'Escape')
->assertScript($open, false)
->keys('#bar-'.$key, 'Tab')
->keys('#bar-'.$key, 'Shift')
->assertScript($open, true)
->assertNoJavaScriptErrors();
})->with(['light', 'dark']);
it('moves a task to another person by dragging its bar', function () {
// The bar (today – today + 2) is grabbed at its middle day, so dropping it
// on today + 4 moves it three days later.
@@ -72,7 +93,7 @@ it('moves a task to another person by dragging its bar', function () {
->assertSee('Tehtävä Leikkaus: Aino Ahkera');
expect($this->task->refresh()->planned_from?->format('Y-m-d'))->toBe(now()->addDays(3)->toDateString())
->and(DB::table('task_assignees')->where('task_id', $this->task->id)->pluck('user_id')->all())->toBe([$this->other->id]);
->and($this->task->assignee_user_id)->toBe($this->other->id);
});
it('has no accessibility issues on the holidays page', function (string $colorScheme) {