@extends('layouts.client') @include('client.financing-request._home_theme') @section('title', ln('My Financing Requests', 'طلباتي')) @section('page_title', ln('Financing Requests', 'طلبات التمويل')) @section('content')

{{ ln('Financing Requests', 'طلبات التمويل') }}

{{ ln('Track your requests, their status, and next actions in one place.', 'تابع طلباتك وحالتها والخطوات التالية من مكان واحد.') }}

{{ ln('New Request', 'طلب جديد') }}

{{ ln('All Requests', 'كل الطلبات') }}

{{ number_format($requests->total() ?? $requests->count()) }}
@if($requests->count() > 0) @php $statusColors = [ 'pending' => ['#FFF4E5', '#B25C00'], 'approved' => ['#E6F7EA', '#166534'], 'rejected' => ['#FEE2E2', '#991B1B'], 'canceled' => ['#F3F4F6', '#4B5563'], 'completed' => ['#DBEAFE', '#1D4ED8'], ]; $stageLabels = [ 'pending_payment' => ln('Pending Payment', 'بانتظار الدفع'), 'paid' => ln('Paid', 'مدفوع'), 'offers' => ln('Offers', 'العروض'), 'offer_selected' => ln('Offer Selected', 'تم اختيار العرض'), 'completed' => ln('Completed', 'مكتمل'), ]; @endphp
@foreach($requests as $r) @php $effectiveStatus = $r->stage === 'completed' ? 'completed' : $r->status; [$bg, $fg] = $statusColors[$effectiveStatus] ?? ['#F3F4F6', '#4B5563']; $statusLabel = $r->stage === 'completed' ? ln('Completed', 'مكتمل') : ($r->status_label ?? $r->status); $clientName = $r->client_name ?? '—'; $initial = mb_strtoupper(mb_substr($clientName, 0, 1)); $needsPay = $r->payment_status !== \App\Models\ClickPayPayments::STATUS_SUCCESS && in_array($r->stage, [\App\Models\FinancingRequest::STAGE_PENDING_PAYMENT, null], true) && !in_array($r->status, [\App\Models\FinancingRequest::STATUS_REJECTED, \App\Models\FinancingRequest::STATUS_CANCELED], true); $needsOffer = $r->payment_status === \App\Models\ClickPayPayments::STATUS_SUCCESS && empty($r->selected_offer_id); @endphp @endforeach
{{ ln('Request #', 'رقم الطلب') }} {{ ln('Client', 'العميل') }} {{ ln('Mobile', 'الجوال') }} {{ ln('Status', 'الحالة') }} {{ ln('Stage', 'المرحلة') }} {{ ln('Date', 'التاريخ') }} {{ ln('Actions', 'الإجراءات') }}
{{ $r->request_number }}
ID #{{ $r->id }}
{{ $initial }}
{{ $clientName }}
{{ $r->national_id ?? '—' }}
{{ $r->phone ?? '—' }} {{ $statusLabel }} {{ $stageLabels[$r->stage] ?? ($r->stage ?: '—') }} {{ optional($r->created_at)->format('Y-m-d') }}
{{ ln('View', 'عرض') }} @if($needsPay)
@csrf
@elseif($needsOffer) {{ ln('Offers', 'العروض') }} @endif
{{ $requests->links() }}
@else

{{ ln('No financing requests', 'لا توجد طلبات تمويل') }}

{{ ln('You have not submitted any financing request yet.', 'لم تقم بتقديم أي طلب تمويل بعد.') }}

{{ ln('Submit New Request', 'تقديم طلب جديد') }}
@endif
@endsection