@php
$statusHistory = $match->status_history;
$statusLabels = [
'matched' => 'Matched',
'paid' => 'Payment Completed',
'accepted' => 'Accepted by Traveler',
'pickup_coordinated' => 'Pickup Coordinated',
'product_collected' => 'Product Collected',
'trip_in_progress' => 'Trip in Progress',
'arrived_dropoff' => 'Arrived at Drop-off',
'proof_of_delivery' => 'Proof of Delivery',
'delivered' => 'Delivered',
'cancelled' => 'Cancelled',
'rejected' => 'Rejected'
];
$statusColors = [
'matched' => 'primary',
'paid' => 'success',
'accepted' => 'info',
'pickup_coordinated' => 'warning',
'product_collected' => 'warning',
'trip_in_progress' => 'primary',
'arrived_dropoff' => 'info',
'proof_of_delivery' => 'warning',
'delivered' => 'success',
'cancelled' => 'danger',
'rejected' => 'danger'
];
@endphp
@if($statusHistory && is_array($statusHistory))
@foreach($statusHistory as $index => $history)
@if($index < count($statusHistory) - 1)
@endif
{{ $statusLabels[$history['new']] ?? ucfirst(str_replace('_', ' ', $history['new'])) }}
@if($history['old'])
Changed from: {{ $statusLabels[$history['old']] ?? ucfirst(str_replace('_', ' ', $history['old'])) }}
@endif
{{ \Carbon\Carbon::parse($history['updated_at'])->format('d M Y, h:i A') }}
@if($history['message'])
{{ $history['message'] }}
@endif
@if($history['file'] && is_array($history['file']))
Attachments:
@foreach($history['file'] as $file)
@php
$fileName = basename($file);
$fileExtension = pathinfo($fileName, PATHINFO_EXTENSION);
$isImage = in_array(strtolower($fileExtension), ['jpg', 'jpeg', 'png', 'gif', 'webp']);
@endphp
@endforeach
@endif
@if($history['updated_by'])
@php
$updatedByUser = \App\Models\User::find($history['updated_by']);
@endphp
Updated by: {{ $updatedByUser ? $updatedByUser->name : 'Unknown' }} ({{ $updatedByUser ? $updatedByUser->user_code : 'Unknown' }})
@endif
@endforeach
@else
No status history available for this match.
@endif