@php $customer = Auth::guard('customer')->user(); $hasProfilePicture = $customer->docpath && Storage::disk('public')->exists($customer->docpath); $profilePictureUrl = $hasProfilePicture ? asset('storage/' . $customer->docpath) : 'https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?auto=format&fit=crop&w=500&q=60'; // Count applications by status $totalApplications = $applications->count(); $pendingCount = $applications->where('status', 'submitted')->count(); $underReviewCount = $applications->where('status', 'under_review')->count(); $approvedCount = $applications->where('status', 'approved')->count(); $rejectedCount = $applications->where('status', 'rejected')->count(); $disbursedCount = $applications->where('status', 'disbursed')->count(); $withdrawnCount = $applications->where('status', 'withdrawn')->count(); $activeCount = $pendingCount + $underReviewCount + $approvedCount; @endphp

My Applications

View and manage your loan applications

@if(session('success'))

Success!

{{ session('success') }}

@endif @if(session('error'))

Error!

{{ session('error') }}

@endif

Total Applications

{{ $totalApplications }}

Pending Review

{{ $pendingCount }}

Approved

{{ $approvedCount }}

Active

{{ $activeCount }}

All Applications

Your complete loan application history

@if($applications->count() > 0)
@foreach($applications as $application) @php $statusConfig = match($application->status) { 'submitted' => [ 'bg' => 'blue', 'text' => 'blue', 'icon' => 'clock', 'label' => 'Submitted', 'color' => 'text-blue-600', 'bg_color' => 'bg-blue-50' ], 'under_review' => [ 'bg' => 'yellow', 'text' => 'yellow', 'icon' => 'search', 'label' => 'Under Review', 'color' => 'text-yellow-600', 'bg_color' => 'bg-yellow-50' ], 'approved' => [ 'bg' => 'green', 'text' => 'green', 'icon' => 'check-circle', 'label' => 'Approved', 'color' => 'text-green-600', 'bg_color' => 'bg-green-50' ], 'rejected' => [ 'bg' => 'red', 'text' => 'red', 'icon' => 'times-circle', 'label' => 'Rejected', 'color' => 'text-red-600', 'bg_color' => 'bg-red-50' ], 'disbursed' => [ 'bg' => 'purple', 'text' => 'purple', 'icon' => 'money-bill-wave', 'label' => 'Disbursed', 'color' => 'text-purple-600', 'bg_color' => 'bg-purple-50' ], 'withdrawn' => [ 'bg' => 'gray', 'text' => 'gray', 'icon' => 'undo', 'label' => 'Withdrawn', 'color' => 'text-gray-600', 'bg_color' => 'bg-gray-50' ], default => [ 'bg' => 'gray', 'text' => 'gray', 'icon' => 'file', 'label' => 'Draft', 'color' => 'text-gray-600', 'bg_color' => 'bg-gray-50' ] }; @endphp

{{ $application->product->product ?? 'Loan Application' }}

{{ $statusConfig['label'] }}
#{{ $application->application_number }} ZMW {{ number_format($application->loan_amount, 2) }} {{ $application->loan_tenure }} months {{ \Carbon\Carbon::parse($application->created_at)->format('M d, Y') }}
@if($application->loan_purpose)

{{ Str::limit($application->loan_purpose, 120) }}

@endif
@if(in_array($application->status, ['draft', 'submitted']))
@csrf
@endif
@if(in_array($application->status, ['submitted', 'under_review', 'approved'])) @php $progress = match($application->status) { 'submitted' => 33, 'under_review' => 66, 'approved' => 90, default => 0 }; @endphp
Application Progress {{ $progress }}%
Submitted Under Review Approved Completed
@endif
@endforeach
@if($applications->hasPages())
{{ $applications->links() }}
@endif @else

No Applications Yet

You haven't submitted any loan applications yet. Start your journey by applying for your first loan.

@endif
@if($applications->count() > 0)

Need Help?

Contact our support team for assistance with your applications

@endif