Files
Toiminnanohjaus/app/Modules/Jobs/Infrastructure/Persistence/Eloquent/TaskModel.php
T
petriandClaude Opus 5.5 18598cc08e 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]>
2026-11-24 19:01:11 +02:00

57 lines
1.8 KiB
PHP

<?php
namespace App\Modules\Jobs\Infrastructure\Persistence\Eloquent;
use App\Modules\Jobs\Domain\Enums\TaskStatus;
use Carbon\CarbonImmutable;
use Database\Factories\TaskFactory;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Attributes\Table;
use Illuminate\Database\Eloquent\Attributes\UseFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
/**
* Persistence model of a task, used only inside the Jobs Infrastructure
* layer. Members are in task_members, the assignee's day bookings in
* task_bookings.
*
* @property int $id
* @property int $customer_job_id
* @property int $work_type_id
* @property string $title
* @property string|null $description
* @property TaskStatus $status
* @property CarbonImmutable|null $due_on
* @property CarbonImmutable|null $planned_from
* @property CarbonImmutable|null $planned_to
* @property string|null $estimated_hours
* @property int|null $assignee_user_id
* @property int $created_by
*/
#[Table('tasks')]
#[Fillable(['customer_job_id', 'work_type_id', 'title', 'description', 'status', 'due_on', 'planned_from', 'planned_to', 'estimated_hours', 'assignee_user_id', 'created_by'])]
#[UseFactory(TaskFactory::class)]
class TaskModel extends Model
{
/** @use HasFactory<TaskFactory> */
use HasFactory;
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'customer_job_id' => 'integer',
'work_type_id' => 'integer',
'status' => TaskStatus::class,
'due_on' => 'immutable_date',
'planned_from' => 'immutable_date',
'planned_to' => 'immutable_date',
'assignee_user_id' => 'integer',
'created_by' => 'integer',
];
}
}