@extends('layouts.admin') @section('title', $task->ref_no) @section('heading', $task->ref_no.' — '.$task->title) @section('breadcrumb') @endsection @section('content') @php $stepColors = [ 'active' => '#4d9eed', 'waiting' => '#8d939c', 'approved' => '#3cba6f', 'sent_back' => '#e0a045', 'escalated' => '#e95f71', ]; $escalatePayload = []; foreach ($escalateUsers as $person) { $escalatePayload[] = [ 'id' => $person->id, 'name' => $person->name, 'role_id' => $person->role_id, 'role' => $person->role->name ?? 'No role', ]; } @endphp
Job
Customer
{{ $task->customer->name ?? '—' }} @if($task->customer && (auth()->user()->allows('view-customers') || auth()->user()->allows('manage-customers'))) View @endif
Phone
{{ $task->customer->phone ?? '—' }}
Priority
{{ ucfirst($task->priority) }}
Status
{{ $task->statusLabel() }}
Due
{{ optional($task->due_date)->format('d M Y') ?: '—' }}
Created by
{{ $task->creator->name ?? '—' }}
Pending with
{{ $task->pendingWithLabel() }}
Reference
{{ $task->ref_no }}
@if($task->description)
{{ $task->description }}
@endif @if($canEdit) @endif
Assignment chain
@foreach($task->steps as $step)
{{ $step->step_order }}
{{ $step->assignee->name ?? '—' }} @if($step->is_escalation) Escalation @endif
{{ $step->assignee->role->name ?? 'No role' }}
@if($step->can_approve)Approve@endif @if($step->can_view)View@endif @if($step->can_edit)Edit@endif
{{ $step->statusLabel() }}
@endforeach
@if($canEscalate)
@csrf
Escalate to another user

Hand this step to someone else. Pick a role to narrow the list, or choose any user below.

@include('admin.partials.dropzone', ['id' => 'escalate-files'])
@endif
Documents
@forelse($task->attachments as $file)
{{ $file->original_name }} {{ $file->user->name ?? '—' }} · {{ $file->created_at->format('d M Y H:i') }}
@empty

No documents yet.

@endforelse
@csrf @include('admin.partials.dropzone', ['required' => true])
History
@forelse($task->logs as $log)
{{ str_replace('_', ' ', ucfirst($log->action)) }}
{{ $log->actor->name ?? 'System' }} @if($log->toUser) to {{ $log->toUser->name }} @endif
@if($log->comment)
{{ $log->comment }}
@endif
{{ $log->created_at->format('d M Y H:i') }}
@empty

No history yet.

@endforelse
@if($canApprove || $canSendBack || $canResubmit) @if($canApprove)
@csrf
Approve

Accept this step and send the job to the next person.

@include('admin.partials.dropzone', ['id' => 'approve-files'])
@endif @if($canSendBack)
@csrf
Reject and send back

Return the job to the person who created it. A reason is required.

@include('admin.partials.dropzone', ['id' => 'reject-files'])
@endif @if($canResubmit)
@csrf
Resubmit

Send the corrected job back to the assignee.

@include('admin.partials.dropzone', ['id' => 'resubmit-files'])
@endif @elseif(!$canEscalate)
This job is with {{ $task->pendingWithLabel() }}. Approve, reject, and escalate appear here for the person who can act on the current step.
@endif
Comments
@forelse($task->comments as $comment)
{{ $comment->user->name ?? 'User' }}
{{ $comment->body }}
{{ $comment->created_at->format('d M Y H:i') }}
@empty

No comments yet.

@endforelse
@csrf
@endsection @push('scripts') @endpush