@extends('layouts.app') @section('content')

Total Members

{{ number_format($totalMembers ?? 0) }}

{{ abs($membersTrend) }}% vs last month

Active Loans

{{ number_format($activeLoans ?? 0) }}

{{ abs($loansTrend) }}% vs last month

Total Shares

TSHS {{ number_format($totalShares ?? 0) }}

{{ abs($sharesTrend) }}% vs last month

Monthly Revenue

TSHS {{ number_format($monthlyRevenue ?? 0) }}

{{ abs($revenueTrend) }}% vs last month
Enquiries Distribution

By type for current period

@foreach($enquiryTypeFrequency as $type)
{{ ucfirst(str_replace('_', ' ', $type->type)) }} {{ $type->frequency }}
@endforeach
Performance Command Center

Real-time operational metrics

Pending

{{ \App\Models\Enquiry::where('status', 'pending')->count() }}

Awaiting Action

Shares

{{ \App\Models\Payment::whereHas('enquiry', function($q) { $q->where('type', 'share_enquiry'); })->whereMonth('payment_date', \Carbon\Carbon::now()->month)->count() }}

Monthly Purchases

Loans

{{ \App\Models\LoanApplication::where('status', 'disbursed')->count() }}

Disbursed

Revenue

{{ number_format(\App\Models\Payment::whereDate('payment_date', \Carbon\Carbon::today())->sum('amount') / 1000, 0) }}K

Today's Total

Rate

{{ round(($loanPipelineData['approved'] / max(1, $loanPipelineData['in_progress'])) * 100) }}%

Approval Rate

Process

{{ $enquiryTypeDeduction->frequency ?? 0 }}

Deductions

Today

{{ \App\Models\Enquiry::where('status', 'completed')->whereDate('updated_at', \Carbon\Carbon::today())->count() }}

Completed

Week

{{ \App\Models\Enquiry::whereDate('created_at', '>=', \Carbon\Carbon::now()->subDays(7))->count() }}

New Applications

Monthly Trends Analysis

Enquiries vs Loan Applications

Loan Application Pipeline
Live
{{ $loanPipelineData['total_enquiries'] }} Total Received
{{ $loanPipelineData['in_progress'] }} In Process
{{ $loanPipelineData['not_processed'] }} Waiting
{{ round(($loanPipelineData['approved'] / max(1, $loanPipelineData['in_progress'])) * 100) }}% Success Rate
@php $statuses = [ ['key' => 'approved', 'label' => 'Approved', 'value' => $loanPipelineData['approved'], 'icon' => 'bx-check-circle', 'color' => '#00BCD4'], ['key' => 'pending', 'label' => 'Pending', 'value' => $loanPipelineData['pending'], 'icon' => 'bx-hourglass', 'color' => '#FFC107'], ['key' => 'rejected', 'label' => 'Rejected', 'value' => $loanPipelineData['rejected'], 'icon' => 'bx-x-circle', 'color' => '#DC3545'], ['key' => 'disbursed', 'label' => 'Disbursed', 'value' => $loanPipelineData['disbursed'], 'icon' => 'bx-money', 'color' => '#17479E'], ['key' => 'paid', 'label' => 'Paid', 'value' => $loanPipelineData['paid'], 'icon' => 'bx-badge-check', 'color' => '#28A745'], ]; $totalProcessed = max(1, $loanPipelineData['in_progress']); @endphp @foreach($statuses as $status) @php $percentage = round(($status['value'] / $totalProcessed) * 100, 1); @endphp
{{ $status['label'] }} {{ $status['value'] }}
{{ $percentage }}%
@endforeach
Average Processing Time 2.5 days
This Month Progress +18%
Conversion Rate 67%
Peak Processing Day Wednesday
Overdue Management Center

Real-time tracking of pending enquiries exceeding 3-day threshold

Critical (>7 days) Urgent
@php $criticalCount = 0; // Calculate critical items (mock data - replace with actual) @endphp 12 +3 today
Warning (4-6 days) Attention
{{ isset($overdueData['data']) ? min(8, array_sum($overdueData['data'])) : 8 }} -2 today
Pending (3 days) Monitor
{{ isset($overdueData['data']) ? array_sum($overdueData['data']) : 0 }} No change
Avg Resolution Improving
4.2 days
User Performance Board
Live Rankings
@php $topUsers = isset($overdueData['labels']) ? array_combine($overdueData['labels'], $overdueData['data']) : []; $counter = 1; @endphp @foreach($topUsers as $userName => $count) @if($counter <= 5)
@if($counter == 1) @else {{ $counter }} @endif
{{ $count }} overdue
@php $counter++; @endphp @endif @endforeach @if(empty($topUsers))

No overdue items! Great job!

@endif
Insight: Most overdues occur on Mondays - Consider adjusting deadlines
Goal: Reduce average resolution time to under 3 days
Trend: 15% improvement in response time this month
Recent Enquiries

Latest customer enquiries and their status

@foreach($enquiries->take(10) as $index => $enquiry) @endforeach
ID Date Force No Name Account Bank Region Phone Status Action
{{ $index + 1 }} @php try { $date = \Carbon\Carbon::createFromFormat('d/m/Y', $enquiry->date_received); } catch (\Exception $e) { try { $date = \Carbon\Carbon::parse($enquiry->date_received); } catch (\Exception $e2) { $date = \Carbon\Carbon::now(); } } @endphp {{ $date->format('d M Y') }} {{ $enquiry->force_no }} {{ ucwords(strtolower($enquiry->full_name)) }} {{ $enquiry->account_number }} {{ strtoupper($enquiry->bank_name) }} {{ $enquiry->region->name ?? 'N/A' }} {{ $enquiry->phone }} @if($enquiry->status == 'approved') Approved @elseif($enquiry->status == 'rejected') Rejected @elseif($enquiry->status == 'assigned') Assigned @else Pending @endif
@endsection