@extends('admin.layouts.app')
@section('title', 'EMI CREDITS | Admin Dashboard')
@section('page-title', 'Admin Dashboard')
@section('page-description')
Welcome back, {{ Auth::user()->name }}
@endsection
@push('styles')
@endpush
@section('content')
{{-- =====================================================
WELCOME
====================================================== --}}
Dashboard Overview
Monitor clients, applications, loans, KYC verification and payments from one place.
{{-- =====================================================
8 STAT CARDS
====================================================== --}}
{{-- CLIENTS --}}
{{-- APPLICATIONS --}}
{{-- PENDING KYC --}}
{{-- PAYMENTS --}}
{{-- TOTAL LOANS --}}
{{-- PENDING LOANS --}}
{{-- ACTIVE LOANS --}}
{{-- OVERDUE LOANS --}}
{{-- =====================================================
GRAPH + LOAN STATUS
====================================================== --}}
@php
/*
* Only existing dashboard variables are used.
* No new database query / controller logic required.
*/
$loanGraphValues = [
(float) $pendingLoans,
(float) $approvedLoans,
(float) $activeLoans,
(float) $overdueLoans,
(float) $completedLoans,
];
$loanGraphMax = max(1, max($loanGraphValues));
$pendingPercent =
$totalLoans > 0
? min(100, ($pendingLoans / $totalLoans) * 100)
: 0;
$approvedPercent =
$totalLoans > 0
? min(100, ($approvedLoans / $totalLoans) * 100)
: 0;
$activePercent =
$totalLoans > 0
? min(100, ($activeLoans / $totalLoans) * 100)
: 0;
$overduePercent =
$totalLoans > 0
? min(100, ($overdueLoans / $totalLoans) * 100)
: 0;
$completedPercent =
$totalLoans > 0
? min(100, ($completedLoans / $totalLoans) * 100)
: 0;
@endphp
{{-- =================================================
LOAN GRAPH
================================================== --}}
Total Loan Value
{{ money($totalLoanAmount) }}
Disbursed
{{ money($totalDisbursedAmount) }}
Outstanding
{{ money($totalOutstandingAmount) }}
{{-- PENDING --}}
@php
$height =
max(
5,
($pendingLoans / $loanGraphMax) * 100
);
@endphp
{{ $pendingLoans }}
{{-- APPROVED --}}
@php
$height =
max(
5,
($approvedLoans / $loanGraphMax) * 100
);
@endphp
{{ $approvedLoans }}
{{-- ACTIVE --}}
@php
$height =
max(
5,
($activeLoans / $loanGraphMax) * 100
);
@endphp
{{ $activeLoans }}
{{-- OVERDUE --}}
@php
$height =
max(
5,
($overdueLoans / $loanGraphMax) * 100
);
@endphp
{{ $overdueLoans }}
{{-- COMPLETED --}}
@php
$height =
max(
5,
($completedLoans / $loanGraphMax) * 100
);
@endphp
{{ $completedLoans }}
Pending
Approved
Active
Overdue
Completed
{{-- =================================================
LOAN STATUS
================================================== --}}
{{-- PENDING --}}
Pending
{{ $pendingLoans }}
{{-- APPROVED --}}
Approved
{{ $approvedLoans }}
{{-- ACTIVE --}}
Active
{{ $activeLoans }}
{{-- OVERDUE --}}
Overdue
{{ $overdueLoans }}
{{-- COMPLETED --}}
Completed
{{ $completedLoans }}
{{-- =====================================================
FINANCIAL OVERVIEW
====================================================== --}}
๐ต
Total Loan Amount
{{ money($totalLoanAmount) }}
๐ค
Total Disbursed
{{ money($totalDisbursedAmount) }}
๐
Outstanding
{{ money($totalOutstandingAmount) }}
๐งพ
Processing Fees
{{ money($totalProcessingFees) }}
{{-- =====================================================
KYC + QUICK ACTIONS
====================================================== --}}
{{-- =================================================
KYC OVERVIEW
================================================== --}}
{{-- =================================================
QUICK ACTIONS
================================================== --}}
{{-- =====================================================
RECENT NOTIFICATIONS
====================================================== --}}
@php
$dashboardNotifications = Auth::user()
->notifications()
->latest()
->take(5)
->get();
@endphp
@forelse($dashboardNotifications as $notification)
@php
$notificationData =
$notification->data ?? [];
$notificationTitle =
data_get(
$notificationData,
'title',
'Notification'
);
$notificationMessage =
data_get(
$notificationData,
'message',
''
);
$notificationLevel =
data_get(
$notificationData,
'level',
'info'
);
if (
!in_array(
$notificationLevel,
[
'success',
'warning',
'error',
'info'
],
true
)
) {
$notificationLevel = 'info';
}
$notificationLoan =
data_get(
$notificationData,
'loan_number'
);
$notificationBg =
$notificationLevel === 'success'
? '#e8f8ef'
: (
$notificationLevel === 'warning'
? '#fff4df'
: (
$notificationLevel === 'error'
? '#fff1f2'
: '#eaf2ff'
)
);
$notificationIcon =
$notificationLevel === 'success'
? 'โ'
: (
$notificationLevel === 'warning'
? 'โ '
: (
$notificationLevel === 'error'
? '!'
: '๐'
)
);
@endphp
{{ $notificationIcon }}
{{ $notificationTitle }}
{{ $notificationMessage }}
{{ $notification->created_at?->diffForHumans() ?? '' }}
@if($notificationLoan)
ยท {{ $notificationLoan }}
@endif
@if(!$notification->read_at)
@endif
@empty
๐
No notifications
New loan and payment updates will appear here.
@endforelse
@endsection