@extends('user.layouts.app') @section('css') @endsection @section('title') تفاصيل طلب الشحن @endsection @section('content')
@php $styles = config('credit_request_filters.status_type_styles', []); $status = $creditRequest->status ?? 'pending'; $style = $styles[$status] ?? null; $badgeIconParts = explode(' ', $style['iconClass'] ?? 'banknote'); $badgeIconName = $badgeIconParts[0]; $badgeIconExtraClass = implode(' ', array_slice($badgeIconParts, 1)); $amountClass = $style['amountClass'] ?? ''; $itemCardClass = $style['itemCardClass'] ?? ''; $createdAt = optional($creditRequest->created_at)->format('Y/m/d H:i:s'); // Build attachment name map from method attachments (active first, then all if available) $attachmentsCollection = optional($creditRequest->method)->activeAttachments ?? (optional($creditRequest->method)->attachments ?? collect()); $attachmentNames = []; try { foreach ($attachmentsCollection ?? [] as $att) { $attachmentNames[$att->id] = $att->name; } } catch (\Throwable $e) { } // Normalize attachments array (support JSON string or array) $attachments = $creditRequest->attachment_values; if (is_string($attachments)) { $decoded = json_decode($attachments, true); if (json_last_error() === JSON_ERROR_NONE) { $attachments = $decoded; } } if (!is_array($attachments)) { $attachments = (array) ($attachments ?? []); } @endphp
#{{ $creditRequest->id }}
{{ $createdAt }}
@svg('lucide-' . $badgeIconName, ['class' => $badgeIconExtraClass, 'width' => '16', 'height' => '16']) {{ config('credit_request_filters.status_types.' . $status . '.label', $status) }}
المبلغ المطلوب:
{{ number_format((float) $creditRequest->amount, 2, '.', ',') }} {{ $creditRequest->currency->name ?? '' }}
@if (!is_null($creditRequest->final_amount) && (float) $creditRequest->final_amount !== (float) $creditRequest->amount)
المبلغ النهائي:
{{ number_format((float) $creditRequest->final_amount, 2, '.', ',') }} {{ $creditRequest->currency->name ?? '' }}
@endif
طريقة الدفع:
{{ $creditRequest->method->name ?? '-' }}
العملة:
{{ $creditRequest->currency->name ?? '-' }}
@if (!empty($creditRequest->operation_number))
رقم العملية:
{{ $creditRequest->getOriginalOperationNumber() }}
@endif @if (!empty($creditRequest->payment_id))
معرف الدفع:
{{ $creditRequest->payment_id }}
@endif @if (!empty($creditRequest->note) && trim($creditRequest->note) !== '_') @if ($creditRequest->status === 'rejected')
@else
ملاحظة:
{{ $creditRequest->note }}
@endif @endif @if (!empty($creditRequest->image))
صورة:
attachment image
@endif
@if (!empty($attachments))
المرفقات
@foreach ($attachments as $key => $value) @php $label = $attachmentNames[$key] ?? 'المرفق #' . $key; $isFile = is_string($value) && \Illuminate\Support\Str::startsWith($value, 'file__'); $fileName = $isFile ? substr($value, 6) : null; $url = null; if ($isFile) { if ( is_string($fileName) && (\Illuminate\Support\Str::startsWith($fileName, 'http://') || \Illuminate\Support\Str::startsWith($fileName, 'https://')) ) { $url = $fileName; } else { $url = route('media.credit-request.attachment', [ 'creditRequest' => $creditRequest->id, 'field' => $key, ]); } } @endphp
{{ $label }} @if ($isFile && $url) {{ $label }} @else
{{ is_array($value) ? json_encode($value, JSON_UNESCAPED_UNICODE) : (string) $value }}
@endif
@endforeach
@endif
@endsection