@php $customer = Auth::guard('customer')->user(); // Fix the profile picture URL generation $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

Loan Details

Loan #{{ $loan->loannumber ?? $loan->loanid }}

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

Loan #{{ $loan->loannumber ?? $loan->loanid }}

{{ ucfirst($loan->status) }} @if($loan->is_overdue) Overdue by {{ $loan->days_overdue }} days @endif

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

Original Loan Amount

Loan Details

Loan Amount

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

Interest Rate

{{ $loan->rate }}%

Duration

{{ $loan->duration }} months

Loan Product

{{ $loan->loanProduct->product ?? $loan->product ?? 'N/A' }}

Disbursed Date

@if($loan->disburseddate) {{ \Carbon\Carbon::parse($loan->disburseddate)->format('M d, Y') }} @else Not disbursed @endif

Maturity Date

@if($loan->maturitydate) {{ \Carbon\Carbon::parse($loan->maturitydate)->format('M d, Y') }} @else N/A @endif

Loan Status

{{ $loan->status }}

Application Number

{{ $loan->applicationno ?? 'N/A' }}

Collection Progress

{{ $collectionProgress }}%
Amount Disbursed ZMW {{ number_format($loan->amount, 2) }}
Total Interest Charged ZMW {{ number_format($loan->total_interest_charged, 2) }}
Total Repayment Due ZMW {{ number_format($totalRepayment, 2) }}
Amount Repaid ZMW {{ number_format($loan->total_repaid, 2) }}
Outstanding Balance ZMW {{ number_format($loan->outstanding_balance, 2) }}

Repayment History

All your repayment transactions

@if($repaymentHistory->count() > 0)
@foreach($repaymentHistory as $repayment)

{{ $repayment->rdate->format('M d, Y') }}

{{ $repayment->pmethod ?? 'Payment' }} • {{ $repayment->transtype ?? 'repayment' }}

Transaction ID: {{ $repayment->rpid ?? 'N/A' }}

ZMW {{ number_format($repayment->rtotal, 2) }}

Principal: ZMW {{ number_format($repayment->rprincipal, 2) }} Interest: ZMW {{ number_format($repayment->rinterest, 2) }}
@if($repayment->status) {{ ucfirst($repayment->status) }} @endif
@endforeach
@if($repaymentHistory->count() >= 10)

Showing latest 10 repayments

@endif @else

No repayment history found

Your repayment transactions will appear here once you start making payments.

@endif

Interest Charges

Interest applied to your loan

@if($interestCharges->count() > 0)
@foreach($interestCharges as $interest)

Interest Charge

{{ $interest->chargeddate->format('M d, Y') }}

Charge ID: {{ $interest->ipid ?? 'N/A' }}

ZMW {{ number_format($interest->charge, 2) }}

Applied on {{ $interest->chargeddate->format('M d, Y') }}

@endforeach
@else

No interest charges recorded

@endif

Quick Actions

Loan Information

Loan Number

{{ $loan->loannumber ?? $loan->loanid }}

Application Number

{{ $loan->applicationno ?? 'N/A' }}

Status

{{ $loan->status }}

Branch

{{ $loan->branchid ? 'Branch ' . $loan->branchid : 'N/A' }}

Created Date

@if($loan->created_at) {{ $loan->created_at->format('M d, Y') }} @else N/A @endif

Payment Summary

Principal Repaid ZMW {{ number_format($loan->principal_repaid, 2) }}
Interest Repaid ZMW {{ number_format($loan->interest_repaid, 2) }}
Total Repaid ZMW {{ number_format($loan->total_repaid, 2) }}
Remaining Principal ZMW {{ number_format($loan->amount - $loan->principal_repaid, 2) }}
Outstanding Balance ZMW {{ number_format($loan->outstanding_balance, 2) }}
@if($loan->next_payment_due_date)

Next Payment

Due Date

{{ $loan->next_payment_due_date->format('M d, Y') }}

@if($loan->is_overdue) Payment is overdue @else {{ $loan->next_payment_due_date->diffForHumans() }} @endif

@endif

Loan Performance

Key metrics and performance indicators

Collection Rate

{{ $collectionProgress }}%

Monthly Payment

ZMW {{ number_format($loan->estimated_monthly_payment ?? ($totalRepayment / $loan->duration), 2) }}

Months Remaining

@php $monthsRemaining = max(0, $loan->duration - ($loan->total_repaid / ($totalRepayment / $loan->duration))); @endphp {{ round($monthsRemaining) }}

Interest Rate

{{ $loan->rate }}%