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

Pending Loans

New loan applications awaiting initial review

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

Review Required

{{ $loans->count() }} loan{{ $loans->count() !== 1 ? 's' : '' }} waiting for initial approval review.
Applications
{{ $loans->count() }}
Requested Amount
{{ formatAmount($loans->sum('loan_amount')) }}
Applicants
{{ $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() }}
Avg. Processing Time
{{ $loans->isNotEmpty() ? round($loans->avg(function($loan) { return $loan->created_at ? now()->diffInDays($loan->created_at) : 0; })) : 0 }} days

Loan Applications Queue

Awaiting Review @if($loans->count() > 0) Oldest: {{ $loans->min('created_at')?->diffForHumans() }} @endif
Loan Code Applicant(s) Type Product Principal ({{ getCurrencyCode() }}) Interest Rate Interest ({{ getCurrencyCode() }}) Total Amount ({{ getCurrencyCode() }}) Status Applied 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 }}
Individual Applicant
@else
@foreach ($loan?->groupClients as $index => $groupClient) @if ($index < 2)
{{ $groupClient?->client?->fullname }}
@elseif ($index == 2)
+{{ $loan?->groupClients->count() - 2 }} more applicants
@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-approve')) @endif
@endif
@empty

No pending loans found

All caught up! New loan applications will appear here.

Great job staying on top of your loan queue! 🎉
@endforelse
@endsection