@extends('layouts.app') @section('title', 'Loan '.$loan->loan_number) @section('page-title', 'Loan Detail') @section('content')
Back
Loan {{ $loan->loan_number }}
Applied {{ $loan->created_at->format('F j, Y') }} · {{ $loan->currency }} · Rate: L${{ number_format($loan->getEffectiveRate(),2) }}=US$1
{{ ucfirst($loan->status) }}
{{-- Dual currency summary strip --}}
@foreach([ ['Principal','#c9a84c',$loan->formattedAmountBoth(),'fa-coins'], ['Outstanding','#c0392b',\App\Services\CurrencyService::formatUsd((float)$loan->outstanding_balance).' / '.\App\Services\CurrencyService::formatLrd((float)$loan->outstanding_balance_lrd),'fa-scale-unbalanced-flip'], ['Monthly Install.','#1565c0',$loan->formattedInstallmentBoth(),'fa-calendar-check'], ['Amount Paid','#2e7d52',\App\Services\CurrencyService::formatUsd((float)$loan->amount_paid).' / '.\App\Services\CurrencyService::formatLrd((float)$loan->amount_paid_lrd),'fa-rotate-left'], ] as [$label,$color,$value,$icon])
{{ $label }}
{{ $value }}
@endforeach
{{-- Details card --}}
Loan Details
@foreach([ ['Loan Type', $loan->loan_type_label], ['Currency', $loan->currency.' ('.\App\Services\CurrencyService::label($loan->currency).')'], ['Exchange Rate', 'L$'.number_format($loan->getEffectiveRate(),2).' = US$1.00'], ['Interest Rate', $loan->interest_rate.'% per annum'], ['Term', $loan->term_months.' months'], ['Purpose', $loan->purpose], ['Disbursed', $loan->disbursed_at?->format('M d, Y') ?? '—'], ['Final Due Date', $loan->due_date?->format('M d, Y') ?? '—'], ] as [$lbl,$val])
{{ $lbl }}
{{ $val }}
@endforeach
@if(in_array($loan->status,['approved','disbursed']))
@php $pct = $loan->amountInUsd() > 0 ? min(100,((float)$loan->amount_paid / $loan->amountInUsd())*100) : 0; @endphp
Repayment Progress
{{ \App\Services\CurrencyService::formatUsd((float)$loan->amount_paid) }} paid {{ round($pct) }}%
{{ \App\Services\CurrencyService::formatUsd((float)$loan->outstanding_balance) }} remaining ({{ \App\Services\CurrencyService::formatLrd((float)$loan->outstanding_balance_lrd) }})
@endif @if($loan->rejection_reason)
Rejection Reason: {{ $loan->rejection_reason }}
@endif
{{-- Repayment Schedule --}} @if($loan->status !== 'pending' && $loan->status !== 'rejected')
Repayment Schedule
@if($loan->status === 'disbursed') Record Payment @endif @if($loan->repaymentSchedules->count()) Export Excel @endif
@forelse($loan->repaymentSchedules()->orderBy('due_date')->get() as $i => $s) @empty @endforelse
#Due Date InstallmentPrincipalInterest LRD InstallmentBalance PaidStatus
{{ $i+1 }} {{ $s->due_date->format('d M Y') }} ${{ number_format($s->amount,2) }} ${{ number_format($s->principal_component,2) }} ${{ number_format($s->interest_component,2) }} L${{ number_format($s->amount_lrd,2) }} ${{ number_format($s->running_balance,2) }} ${{ number_format($s->amount_paid,2) }} {{ ucfirst($s->status) }}
Schedule not generated
@endif @if($loan->documents->count())
Documents
@foreach($loan->documents as $doc) {{ $doc->name }} @endforeach
@endif
{{-- Member --}}
Applicant
{{ strtoupper(substr($loan->member->name,0,2)) }}
{{ $loan->member->name }}
{{ $loan->member->member_id }}
{{ $loan->member->department }}
Savings (USD): ${{ number_format($loan->member->savings_balance,2) }}
Savings (LRD): L${{ number_format($loan->member->savings_balance_lrd ?? $loan->member->savings_balance * $rate,2) }}
Monthly Salary: ${{ number_format($loan->member->monthly_salary,2) }}
View Profile
{{-- Guarantor --}} @if($loan->guarantor_name)
Guarantor
{{ $loan->guarantor_name }}
{{ $loan->guarantor_phone }}
@if($loan->guarantor_member_id)
ID: {{ $loan->guarantor_member_id }}
@endif
@endif {{-- Approval Actions --}} @if($loan->status === 'pending')
Review Application
@csrf
@csrf
@endif @if($loan->status === 'approved')
@csrf
@endif {{-- Excel Export panel --}} @if(in_array($loan->status,['disbursed','settled']) && $loan->repaymentSchedules->count())
Excel Exports
Repayment Schedule (Excel) Monthly Salary Debit
Includes USD & LRD columns for payroll
@endif
@endsection