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

Loans Management

@if (Auth::user()->can('loans-create')) Add New Loan @endif
Total Loans
{{ $loans->count() }}

Loans List

Loan Code Client(s) Type Product Principal ({{getCurrencyCode()}}) Interest Rate ({{getCurrencyCode()}}) Interest Total Amount ({{getCurrencyCode()}}) Status Created Actions @forelse ($loans as $loan)
{{ $loan?->loan_code }}
@if ($loan?->loan_category_id == \App\Constants\LoanConstants::INDIVIDUAL_LOAN)
{{ optional($loan?->individualClient)?->client?->fullname }}
@else
@foreach ($loan?->groupClients as $index => $groupClient) @if ($index < 2)
{{ $groupClient?->client?->fullname }}
@elseif ($index == 2)
+{{ $loan?->groupClients->count() - 2 }} more
@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) }}
@php $statusClasses = [ 'pending' => 'bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200', 'approved' => 'bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200', 'rejected' => 'bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200', 'active' => 'bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200', 'completed' => 'bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-200' ]; $statusName = \App\Constants\LoanConstants::getStatusName($loan?->level_status_id); $statusClass = $statusClasses[strtolower($statusName)] ?? 'bg-gray-100 text-gray-800'; @endphp {{ $statusName }}
{{ optional($loan?->created_at)->format('M j, Y') }}
{{ optional($loan?->created_at)->format('g:i A') }}
@if (Auth::user()->can('loans-show'))
@endif
@empty

No loans found

Get started by creating your first loan.

@if (Auth::user()->can('loans-create')) Create First Loan @endif
@endforelse
@endsection