Initial Submission
@if($submission['form_name'])
Form: {{ $submission['form_name'] }}
@endif
@if(!empty($submission['fields']))
@else
No form fields recorded.
@endif
{{-- ══════════════════════════════════════════════════════
CHRONOLOGICAL EVENT STREAM
══════════════════════════════════════════════════════ --}}
@php $currentLevel = null; @endphp
@foreach($events as $event)
{{-- Level Section Header (when level changes) --}}
@if(in_array($event['type'], ['task_action', 'pending_task']) && $event['level_number'] !== $currentLevel)
@php $currentLevel = $event['level_number']; @endphp
{{-- Assignees --}}
Assignees
@if(!empty($event['assignees']) && count($event['assignees']) > 0)
{{ implode(' · ', array_map(fn($u) => ($u->name ?? $u['name'] ?? '') . ' (' . ($u->email ?? $u['email'] ?? '') . ')', (array)$event['assignees'])) }}
@else
—
@endif
{{-- Actioned By --}}
@if(!empty($event['actioned_by']))
Actioned By
{{ $event['actioned_by']['name'] }} ({{ $event['actioned_by']['email'] }})
@endif
{{-- Comments --}}
@if(!empty($event['comments']))
Comments
"{{ $event['comments'] }}"
@endif
{{-- Approver Form --}}
@if(!empty($event['form_fields']))
Approver Form{{ $event['form_name'] ? ': ' . $event['form_name'] : '' }}
@endif
{{-- Documents --}}
Documents
@if(!empty($event['documents']))
@foreach($event['documents'] as $doc)
{{ $doc['name'] ?? 'File' }}@if(!$loop->last), @endif
@endforeach
@else
None
@endif
{{-- Timing & SLA --}}
Completed At
{{ $event['completed_at'] ?: '—' }}
@if($event['expected_sla_at'])
Expected SLA
{{ $event['expected_sla_at'] }}
@if($event['sla_duration_minutes'])
({{ $event['sla_duration_minutes'] >= 60 ? intdiv($event['sla_duration_minutes'], 60) . 'h' . ($event['sla_duration_minutes'] % 60 > 0 ? ' ' . ($event['sla_duration_minutes'] % 60) . 'm' : '') : $event['sla_duration_minutes'] . ' min' }} from activation)
@endif
SLA Status
@if($event['sla_breached'] === true)
⚠ SLA Breached{{ $event['sla_overrun'] ? ' (by ' . $event['sla_overrun'] . ')' : '' }}
@elseif($event['sla_breached'] === false)
✓ Within SLA
@else
—
@endif
@endif
@endif
{{-- ── Send Back Block ── --}}
@if($event['type'] === 'send_back')
↩ Send Back #{{ $event['send_back_number'] }} · {{ $event['created_at'] }}
@if(!empty($event['recipients']))
Recipients
| Recipient | Return Route |
@foreach($event['recipients'] as $r)
|
{{ $r['label'] }}
@if(!empty($r['responsible_user']))
({{ $r['responsible_user']['name'] ?? $r['responsible_user']['email'] }})
@endif
|
{{ $r['return_route'] ?: '—' }} |
@endforeach
@endif
@endif
{{-- ── Correction Entry ── --}}
@if($event['type'] === 'correction')
🔄 Correction · Send Back #{{ $event['send_back_number'] }}
Recipient
{{ $event['recipient_label'] }}
@if($event['completed_at'])
Completed At
{{ $event['completed_at'] }}
@endif
@if(!empty($event['comments']))
Comments
"{{ $event['comments'] }}"
@endif
Documents
@if(!empty($event['documents']))
@foreach($event['documents'] as $doc)
{{ $doc['name'] }}@if(!$loop->last), @endif
@endforeach
@else
None
@endif
@if(!empty($event['form_fields']))
Updated Form Fields
@endif
@endif
{{-- ── Pending / Not-Yet-Reached Task ── --}}
@if($event['type'] === 'pending_task')
@php
$isNotReached = in_array($event['level_status'] ?? '', ['', 'not_reached']);
$pendingLabel = $isNotReached ? 'Not Yet Reached' : 'Pending';
@endphp
Assignees
@if(!empty($event['assignees']) && count($event['assignees']) > 0)
{{ implode(' · ', array_map(fn($u) => ($u->name ?? $u['name'] ?? '') . ' (' . ($u->email ?? $u['email'] ?? '') . ')', (array)$event['assignees'])) }}
@else
—
@endif
@if(!empty($event['form_fields']))
Form to Fill{{ $event['form_name'] ? ': ' . $event['form_name'] : '' }}
@endif
Expected SLA
@if($event['sla_duration_minutes'])
Once activated —
@php
$m = (int)$event['sla_duration_minutes'];
echo $m >= 60
? intdiv($m, 60) . ' hour' . (intdiv($m, 60) > 1 ? 's' : '') . ($m % 60 > 0 ? ' ' . ($m % 60) . ' min' : '')
: $m . ' minutes';
@endphp
@else
—
@endif
@endif
@endforeach
{{-- ══════════════════════════════════════════════════════
PAGE FOOTER
══════════════════════════════════════════════════════ --}}