@extends('layouts.app') @section('title','Loan Details') @section('page-title','Loan Details') @section('content')
Back
Loan {{ $loan->loan_number }}
{{ $loan->currency }} · Applied {{ $loan->created_at->format('F j, Y') }}
{{ ucfirst($loan->status) }}
{{-- Summary --}}
Loan Summary
@foreach([ ['Principal (USD)', '$'.number_format($loan->amountInUsd(),2)], ['Principal (LRD)', 'L$'.number_format($loan->amountInLrd(),2)], ['Interest Rate', $loan->interest_rate.'% p.a.'], ['Term', $loan->term_months.' months'], ['Monthly (USD)', '$'.number_format($loan->monthly_installment,2)], ['Monthly (LRD)', 'L$'.number_format($loan->monthly_installment_lrd,2)], ['Exchange Rate', 'L$'.number_format($loan->getEffectiveRate(),2).'=US$1'], ['Amount Paid (USD)', '$'.number_format($loan->amount_paid,2)], ['Outstanding (USD)', '$'.number_format($loan->outstanding_balance,2)], ['Outstanding (LRD)', 'L$'.number_format($loan->outstanding_balance_lrd,2)], ['Disbursed', $loan->disbursed_at?->format('M d, Y') ?? 'Pending'], ['Final Due Date', $loan->due_date?->format('M d, Y') ?? '—'], ] as [$label,$value])
{{ $label }} {{ $value }}
@endforeach @if($loan->rejection_reason)
Rejection Reason: {{ $loan->rejection_reason }}
@endif @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 {{ round($pct) }}%
@endif
@if($loan->documents->count())
Documents
@foreach($loan->documents as $doc) {{ $doc->name }} @endforeach
@endif
@if($loan->repaymentSchedules->count())
Repayment Schedule
Export Excel
@foreach($loan->repaymentSchedules->sortBy('due_date') as $i => $s) @endforeach
#Due Date Inst. (USD)Inst. (LRD) PrincipalInterest BalanceStatus
{{ $i+1 }} {{ $s->due_date->format('d M Y') }} ${{ number_format($s->amount,2) }} L${{ number_format($s->amount_lrd,2) }} ${{ number_format($s->principal_component,2) }} ${{ number_format($s->interest_component,2) }} ${{ number_format($s->running_balance,2) }} {{ ucfirst($s->status) }}
@else
Repayment schedule will be generated once the loan is disbursed.
@endif
@endsection