Clear
@include('loan.book.applications.partials.pipeline-intelligence-strip')
@if ($applications->count() > 0 && ($applicationRegisterBulkActions ?? []) !== []) @endif

{{ $applications->total() }} file(s)

@if ($applications->count() > 0 && ($applicationRegisterBulkActions ?? []) !== []) @endif @php $applicationsAmountTotal = 0.0; $loanApplicationRibbonSteps = [ ['key' => 'draft', 'label' => 'Draft'], ['key' => 'submitted', 'label' => 'Submitted'], ['key' => 'credit_review', 'label' => 'Review'], ['key' => 'approved', 'label' => 'Approved'], ['key' => 'disbursed', 'label' => 'Disbursed'], ]; @endphp @forelse ($applications as $app) @php $rowMeta = ($applicationRowMeta ?? [])[$app->id] ?? null; $sourceLabel = match ((string) ($app->submission_source ?? '')) { 'group_lending' => 'Group lending', 'tenant_portal', 'landlord_portal' => 'Client portal', 'manual_internal' => 'Manual/Internal', default => (function () use ($app) { if ($app->isGroupOriginated()) { return 'Group lending'; } $notes = strtolower((string) ($app->notes ?? '')); if (str_contains($notes, 'tenant portal') || str_contains($notes, 'landlord portal')) { return 'Client portal'; } return 'Manual/Internal'; })(), }; $sourceClass = match (true) { $app->isGroupOriginated() => 'bg-teal-50 text-teal-800 ring-teal-200', str_contains($sourceLabel, 'portal') => 'bg-emerald-50 text-emerald-700 ring-emerald-200', default => 'bg-slate-100 text-slate-700 ring-slate-200', }; $chargesSummary = $app->listChargesSummary(); $guarantorPrimary = $app->listGuarantorName(0); $guarantorPrimaryContact = $app->listGuarantorPhone(0); $guarantorSecondary = $app->listGuarantorName(1); $guarantorSecondaryContact = $app->listGuarantorPhone(1); $residentialType = trim((string) ($app->loanClient?->address ?? '')); $businessPurpose = trim((string) ($app->purpose ?? '')); $assetList = trim((string) ($app->notes ?? '')); $amortizationMetaRaw = collect((array) ($app->form_meta ?? [])) ->filter(function ($value, $key): bool { $k = strtolower((string) $key); return str_contains($k, 'interest_type') || str_contains($k, 'rate_type') || str_contains($k, 'interest_method') || str_contains($k, 'amort') || str_contains($k, 'reducing') || str_contains($k, 'flat'); }) ->map(fn ($v): string => strtolower(trim((string) $v))) ->filter() ->first(); $amortizationModel = (is_string($amortizationMetaRaw) && (str_contains($amortizationMetaRaw, 'reduc') || str_contains($amortizationMetaRaw, 'diminish') || str_contains($amortizationMetaRaw, 'amort'))) ? 'reducing' : 'flat'; $applicationShowUrl = route('loan.book.applications.show', $app); $rowRedirectUrl = $applicationShowUrl; $applicationsAmountTotal += (float) $app->displayPrincipal(); $hasLinkedLoan = (bool) $app->loan; $awaitingDisbursement = $app->isAwaitingTreasuryDisbursement(); $ribbonStatus = (string) (($rowMeta['ribbonStatus'] ?? null) ?: $app->stage); $canBookLoan = in_array($app->stage, [\App\Models\LoanBookApplication::STAGE_APPROVED, \App\Models\LoanBookApplication::STAGE_DISBURSED], true) && ! $hasLinkedLoan; $canEditApplication = ! $hasLinkedLoan && $app->stage !== \App\Models\LoanBookApplication::STAGE_DISBURSED && $app->stage !== \App\Models\LoanBookApplication::STAGE_DECLINED; $isDraft = $app->stage === \App\Models\LoanBookApplication::STAGE_DRAFT; $feesPending = (bool) ($rowMeta['feesPending'] ?? ( ! $hasLinkedLoan && ! $isDraft && ! app(\App\Services\Loan\ApplicationOriginationGateService::class)->applicationFeesAreCovered($app) && app(\App\Services\Loan\ApplicationOriginationGateService::class)->requiredFeeTotalForApplication($app) > 0 )); $canDeleteApplication = (bool) ($rowMeta['canDeleteApplication'] ?? false); $deleteApplicationLabel = (string) ($rowMeta['deleteApplicationLabel'] ?? 'Delete unused draft'); $deleteBlockedReason = $rowMeta['deleteBlockedReason'] ?? null; $showScheduleAction = (bool) ($rowMeta['showScheduleAction'] ?? ((float) $app->displayPrincipal() > 0 || ! $isDraft)); $resumeDraftUrl = route('loan.book.applications.create', ['draft_id' => $app->id]); @endphp @if ($applications->count() > 0 && ($applicationRegisterBulkActions ?? []) !== []) @endif @empty @endforelse @if ($applications->count() > 0) @if ($applications->count() > 0 && ($applicationRegisterBulkActions ?? []) !== []) @endif @endif
Application Ref Client Client # Product Source Term Amount Guarantor Guarantor contact Residential type Business / purpose Asset list Loan runs Guarantor2 Guarantor2 contact Charges Attached media Deductions Assigned officer Status Stage controls Branch Submitted Actions
@if ($isDraft) {{ $app->updated_at?->format('d.m.Y, h:i A') ?? '—' }} @if ($app->updated_at) Last saved @endif @else {{ $app->submitted_at?->format('d.m.Y, h:i A') ?? '—' }} @endif {{ $app->reference }} @if ($app->loanClient) {{ $app->loanClient->full_name }} @else — @endif {{ $app->loanClient?->client_number ?? '—' }} {{ $app->product_name }}
{{ $sourceLabel }} @include('loan.book.partials.portfolio-origin-badge', ['application' => $app])
{{ (int) ($app->term_value ?: $app->term_months) }} {{ ucfirst((string) ($app->term_unit ?: 'months')) }} {{ number_format((float) $app->displayPrincipal(), 2) }} {{ $guarantorPrimary !== '' ? $guarantorPrimary : '—' }} {{ $residentialType !== '' ? \Illuminate\Support\Str::limit($residentialType, 22) : '—' }} {{ $businessPurpose !== '' ? \Illuminate\Support\Str::limit($businessPurpose, 24) : '—' }} {{ $assetList !== '' ? \Illuminate\Support\Str::limit($assetList, 24) : '—' }} 0 {{ $guarantorSecondary !== '' ? $guarantorSecondary : '—' }} {{ $chargesSummary !== '' ? \Illuminate\Support\Str::limit($chargesSummary, 30) : '—' }} — @php($checkoffAmount = (float) data_get($app->form_meta, 'balance_checkoff.amount', 0)) Checkoff({{ number_format($checkoffAmount, 2) }}), Prepayment(0) {{ $app->loanClient?->assignedEmployee?->full_name ?? 'None' }} @include('loan.book.applications.partials.pipeline-status-cell', [ 'application' => $app, 'status' => $rowMeta['pipelineStatus'] ?? null, ]) @if ($app->stage !== \App\Models\LoanBookApplication::STAGE_DECLINED) @endif
@csrf @method('patch') @if ($isDraft) Resume draft @elseif ($feesPending) Attach fees @elseif ($awaitingDisbursement) Awaiting disbursement @elseif ($app->stage === \App\Models\LoanBookApplication::STAGE_DISBURSED) Disbursed (locked) @else @endif
{{ $app->branch ?? '—' }} {{ $app->submitted_at?->format('Y-m-d') ?? '—' }} @include('loan.book.applications.partials.index-row-actions', [ 'app' => $app, 'canBookLoan' => $canBookLoan, 'canEditApplication' => $canEditApplication, 'canDeleteApplication' => $canDeleteApplication, 'deleteApplicationLabel' => $deleteApplicationLabel, 'deleteBlockedReason' => $deleteBlockedReason, 'showScheduleAction' => $showScheduleAction, 'feesPending' => $feesPending, 'isDraft' => $isDraft, 'resumeDraftUrl' => $resumeDraftUrl, 'amortizationModel' => $amortizationModel, 'applicationShowUrl' => $applicationShowUrl, ])
No applications yet. Create one to start LoanBook.
Totals (this page) {{ number_format($applicationsAmountTotal, 2) }}
@if ($applications->hasPages())
@endif