@props(['document', 'label' => null, 'showDriver' => false]) {{-- One KYC document with preview and approve / reject actions. --}} @php($doc = $document)

{{ $label ?? __($doc?->document_type->label() ?? '') }}

@if ($doc && $showDriver) {{ $doc->driver->user->name ?? __('Unnamed driver') }} @endif
@if ($doc) @else @endif
@if ($doc)
@foreach (array_filter(['front' => $doc->file_front, 'back' => $doc->file_back]) as $side => $path) @php($url = private_file_url($path)) @if (str_ends_with(strtolower($path), '.pdf')) PDF @else {{ $side }} @endif {{ __($side) }} @endforeach
@if ($doc->document_number)
{{ __('Number') }}
{{ $doc->document_number }}
@endif @if ($doc->expires_at)
{{ __('Expires') }}
$doc->isExpired()])>{{ $doc->expires_at->toFormattedDateString() }}
@endif
{{ __('Uploaded') }}
{{ $doc->created_at->diffForHumans() }}
@if ($doc->reviewed_at)
{{ __('Reviewed') }}
{{ $doc->reviewer?->name }} ยท {{ $doc->reviewed_at->diffForHumans() }}
@endif
@if ($doc->rejection_reason && $doc->status->value === 'rejected')

{{ $doc->rejection_reason }}

@endif @can('documents.approve') @if ($doc->status->value !== 'approved' || $doc->isExpired())
@unless ($doc->isExpired())
@csrf {{ __('Approve') }}
@endunless @if ($doc->status->value !== 'rejected') {{ __('Reject') }} @endif
@endif @endcan @else @endif