@extends('layout.main') @section('content')

Approved Loans

Successfully approved loans ready for disbursement or actively running

@if (Auth::user()->can('loans-create')) Add New Loan @endif
@if($loans->count() > 0)

Approved and Active

{{ $loans->count() }} approved loan{{ $loans->count() !== 1 ? 's' : '' }} generating revenue for your institution.
@endif
Approved Loans
{{ $loans->count() }}
Total Portfolio
{{ formatAmount($loans->sum('loan_amount')) }}
Expected Revenue
{{ formatAmount($loans->sum('interest_amount')) }}
Active Clients
{{ $loans->where('loan_category_id', \App\Constants\LoanConstants::INDIVIDUAL_LOAN)->count() + $loans->where('loan_category_id', '!=', \App\Constants\LoanConstants::INDIVIDUAL_LOAN)->flatMap->groupClients->unique('client_id')->count() }}

Active Loan Portfolio

Approved @if($loans->count() > 0) Avg Rate: {{ number_format($loans->avg('interest_rate'), 1) }}% @endif
Loan Code Client(s) Type Product Principal ({{ getCurrencyCode() }}) Interest Rate Interest ({{ getCurrencyCode() }}) Total Amount ({{ getCurrencyCode() }}) Status Approved Date Actions @forelse ($loans as $loan)
{{ $loan?->loan_code }}
@if ($loan?->loan_category_id == \App\Constants\LoanConstants::INDIVIDUAL_LOAN)
{{ substr(optional($loan?->individualClient)?->client?->fullname, 0, 1) }}
{{ optional($loan?->individualClient)?->client?->fullname }}
Active Client
@else
Active Group
@foreach ($loan?->groupClients as $index => $groupClient) @if ($index < 2)
{{ $groupClient?->client?->fullname }}
@elseif ($index == 2)
+{{ $loan?->groupClients->count() - 2 }} more members
@break @endif @endforeach
@endif
{{ \App\Constants\LoanConstants::getLoanTypeName($loan?->loan_category_id) }}
{{ $loan?->loanType?->product_name }}
{{ formatAmount($loan?->principal_amount) }}
{{ $loan?->interest_rate }}%
{{ formatAmount($loan?->interest_amount) }}
{{ formatAmount($loan?->loan_amount) }}
{{ \App\Constants\LoanConstants::getStatusName($loan?->level_status_id) }}
{{ optional($loan?->created_at)->format('M j, Y') }}
{{ optional($loan?->created_at)->diffForHumans() }}
@if (Auth::user()->can('loans-show'))
@if (Auth::user()->can('loans-manage')) @endif
@endif
@empty

No approved loans found

Approved loans will appear here once they're active.

@endforelse
@endsection