@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'; @endphp

Dashboard

Welcome back, {{ $customer->customer }}

@if(session('success'))
{!! session('success') !!}
@endif @if(session('error'))
{{ session('error') }}
@endif

Quick Actions

Frequently used features

Active Applications

{{ count($activeApplications) }}

Total: ZMW {{ number_format($totalApprovedAmount, 2) }} approved

Total Applications

{{ $applicationStats['total_applications'] ?? 0 }}

{{ $applicationStats['approved_applications'] ?? 0 }} approved

Active Loans

{{ $loanStats['active_loans_count'] }}

Total: ZMW {{ number_format($loanStats['total_active_loan_amount'], 2) }} @if($loanStats['active_loans_count'] > 0)
Collection Progress {{ $loanStats['average_collection_progress'] }}%
Repaid: ZMW {{ number_format($loanStats['total_actual_repayment'], 2) }}
Outstanding: ZMW {{ number_format($loanStats['total_outstanding_balance'], 2) }}
@if($loanStats['overdue_loans_count'] > 0)
{{ $loanStats['overdue_loans_count'] }} loan(s) overdue
@endif @endif

Total Due

ZMW {{ number_format($loanStats['total_due_balance'], 2) }}

Next Due: ZMW {{ number_format($loanStats['total_next_due_amount'], 2) }}
Overdue: ZMW {{ number_format($loanStats['total_overdue_amount'], 2) }}
@if($loanStats['total_overdue_amount'] > 0)
Payment overdue
@elseif($loanStats['total_next_due_amount'] > 0)
Payment due soon
@else
All payments up to date
@endif

Active Applications

Your current loan applications

@if(count($activeApplications) > 0)
@foreach($activeApplications as $application) @php $appColor = match($application->status) { 'submitted' => ['bg' => 'blue', 'text' => 'blue'], 'under_review' => ['bg' => 'yellow', 'text' => 'yellow'], 'approved' => ['bg' => 'green', 'text' => 'green'], default => ['bg' => 'gray', 'text' => 'gray'] }; @endphp

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

App #{{ $application->application_number ?? $application->id }}

{{ ucfirst(str_replace('_', ' ', $application->status)) }}

ZMW {{ number_format($application->loan_amount, 2) }}

Applied {{ \Carbon\Carbon::parse($application->created_at)->format('M d, Y') }}

@endforeach
@else

No active applications found

Apply for Your First Loan
@endif @if(count($activeApplications) > 0) @endif

Active Loans Summary

Your current loan portfolio

@if($loanStats['active_loans_count'] > 0)
@foreach($loanStats['active_loans']->take(3) as $loan) @php $totalRepayment = $loan->getTotalRepaymentAttribute(); $collectionProgress = $loan->getCollectionProgressAttribute(); $outstandingBalance = $loan->getOutstandingBalanceAttribute(); $nextPaymentDate = $loan->getNextPaymentDueDateAttribute(); $nextDueAmount = $loan->next_due_amount; $overdueAmount = $loan->overdue_amount; @endphp

{{ $loan->loanType->product ?? 'Loan' }}

Loan #{{ $loan->loannumber }}

ZMW {{ number_format($loan->amount, 2) }}

{{ ucfirst($loan->status) }}
Disbursed: {{ \Carbon\Carbon::parse($loan->disburseddate)->format('M d, Y') }}
Interest Rate: {{ $loan->interestrate }}%
Term: {{ $loan->loanterm }} months
Next Payment: {{ $nextPaymentDate ? \Carbon\Carbon::parse($nextPaymentDate)->format('M d, Y') : 'N/A' }}
Next Due: ZMW {{ number_format($nextDueAmount, 2) }}
Overdue: ZMW {{ number_format($overdueAmount, 2) }}
Collection Progress {{ $collectionProgress }}%
Repaid: ZMW {{ number_format($loan->totalpaid, 2) }} Total: ZMW {{ number_format($totalRepayment, 2) }}
View Details @if($loan->is_overdue) Overdue ({{ $loan->days_overdue }} days) @endif @if($nextDueAmount > 0 || $overdueAmount > 0) Make Payment @endif
@endforeach
@if($loanStats['active_loans_count'] > 3) @endif @else

No active loans found

Once your applications are approved and disbursed, they will appear here.

Apply for a Loan
@endif

Recent Activity

Latest applications

@if(count($recentApplications) > 0)
@foreach($recentApplications as $application)
@php $statusColor = match($application->status) { 'approved' => 'green', 'rejected' => 'red', 'under_review' => 'yellow', default => 'blue' }; @endphp

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

ZMW {{ number_format($application->loan_amount, 2) }} - {{ \Carbon\Carbon::parse($application->created_at)->format('M d, Y') }}

{{ ucfirst(str_replace('_', ' ', $application->status)) }}
@endforeach
@else

No recent applications

@endif
@if(count($upcomingPayments) > 0)

Upcoming Payments

Next payment due dates

@foreach($upcomingPayments as $payment)

Loan #{{ $payment['loan_number'] }}

Installment {{ $payment['installment_number'] }}

ZMW {{ number_format($payment['amount'], 2) }}

{{ \Carbon\Carbon::parse($payment['due_date'])->format('M d, Y') }}

@endforeach
@endif

Notifications

Important updates

@if(count($activeApplications) > 0)

Active Applications

You have {{ count($activeApplications) }} active application(s)

@endif @if($loanStats['active_loans_count'] > 0)

Active Loans

You have {{ $loanStats['active_loans_count'] }} active loan(s)

@endif @if($loanStats['overdue_loans_count'] > 0)

Overdue Loans

{{ $loanStats['overdue_loans_count'] }} loan(s) require attention

@endif @if($loanStats['total_overdue_amount'] > 0)

Overdue Payment

ZMW {{ number_format($loanStats['total_overdue_amount'], 2) }} overdue

@elseif($loanStats['total_next_due_amount'] > 0)

Upcoming Payment

ZMW {{ number_format($loanStats['total_next_due_amount'], 2) }} due soon

@endif

Account Active

Your account is in good standing

Loan Overview

Your loan portfolio at a glance

Total Loan Amount ZMW {{ number_format($loanStats['total_active_loan_amount'], 2) }}
Amount Repaid ZMW {{ number_format($loanStats['total_actual_repayment'], 2) }}
Outstanding Balance ZMW {{ number_format($loanStats['total_outstanding_balance'], 2) }}
Collection Progress {{ $loanStats['average_collection_progress'] }}%
Next Due Amount ZMW {{ number_format($loanStats['total_next_due_amount'], 2) }}
Overdue Amount ZMW {{ number_format($loanStats['total_overdue_amount'], 2) }}
@if($loanStats['active_loans_count'] > 0)
Active Loans {{ $loanStats['active_loans_count'] }}
@endif