{{-- Job Tasks Tab — embedded inside the job detail page Include this partial or use it as a standalone view. Usage in job show page: @include('tasks.job_tasks', ['tasks' => $tasks, 'jobId' => $job->id, 'isAdmin' => $isAdmin]) --}} @php $isAdmin = $isAdmin ?? (auth()->user()->role->name === 'office_admin'); @endphp
{{-- Header --}}
Tasks

{{ $tasks->count() }} task{{ $tasks->count()===1?'':'s' }} linked to this job

@if($isAdmin) + Add Task @endif
@if($tasks->isEmpty())

No tasks for this job yet.

@if($isAdmin) Create the first task → @endif
@else {{-- Task List --}}
@foreach($tasks as $task) @php $isOverdue = $task->isOverdue(); @endphp
{{ $task->title }} @if($task->description)

{{ Str::limit($task->description, 80) }}

@endif
{{ $task->priorityLabel() }} @if($isOverdue) △ {{ $task->daysOverdue() }}d overdue @elseif($task->status === 'done' && $task->done_at) Done {{ $task->done_at->format('d M') }} @elseif($task->due_date) Due {{ $task->due_date->format('d M Y') }} @endif
{{-- Assignee avatar --}}
{{ strtoupper(substr($task->assignee->name,0,1)) }}{{ strtoupper(substr(explode(' ',$task->assignee->name)[1]??'',0,1)) }}
{{-- Status dropdown (inline quick change) --}}
@endforeach
@endif