@extends('layouts.admin-new') @section('content')

Active Loans

@foreach($loans->chunk(500) as $loanChunks) @forelse($loanChunks as $loan) @php // dd($loan->collector_type); if ($loan->collector_type == 'AppModelsUser') { $staff = 'no staff'; }elseif ('App\Models\Affiliate') { $staff = 'no staff'; } else { $staff = $loan->collector; } // $staff = $loan->collector_type == 'AppModelsUser' ? 'no staff' : $loan->collector; $user = $loan->user ?? null ; @endphp @empty @endforelse @endforeach
Reference # Borrower Payroll ID Staff Amount Tenure Employer Loan Status Manage
{{$loan->reference}} {{ $user ? $user->name : 'No User' }} {{ $user ? optional($user->employments->first())->payroll_id : ' No user'}} {{$staff->name ?? 'No staff'}} ₦{{ number_format($loan->amount, 2)}} {{$loan->due_date->diffInMonths($loan->created_at)}} Months ({{$loan->due_date->diffForHumans()}}) {{ $loan->EmployerName ?? '-' }} @component('components.admin-loan-status', ['loan' => $loan]) @endcomponent @if($loan->is_top_up) Top up @endif View
No active loans
@endsection @section('page-js') @endsection