@extends('layouts.admin')
@section('page-title', 'Client Conveyance')
@section('page-subtitle', 'Primary dashboard for month-wise client conveyance')
@section('content')
@php
$activeSession = \App\Models\Session::active();
$totalClients = $clientSummaries->count();
$totalAmount = $clientSummaries->sum('total_amount');
$totalEmpMapped = $clientSummaries->sum('employee_count');
@endphp
{{-- WRAPPER --}}
{{-- 1. TOP STATS ROW (VIBRANT & COMPACT) --}}
{{-- Stat 1 --}}
Total Claims
{{ $currentMonthLabel }}
{{-- Stat 2 --}}
Active Clients
in current month
{{-- Stat 3 (Employees) --}}
Employees
Total Registered
{{-- Stat 4 (Session) --}}
Active Session
{{ $activeSession->name ?? 'None' }}
Current Fiscal
{{-- 2. CHART & INSIGHTS GRID (COMPACT) --}}
{{-- 2. INSIGHTS GRID (MONTHLY & ALL TIME) --}}
{{-- 1. Top Employees (This Month) --}}
🏆 Users (Month)
@forelse($topEmployeesMonth as $index => $emp)
{{ $index + 1 }}
{{ $emp->user->name ?? '-' }}
₹{{ number_format($emp->total_payout/1000, 1) }}k
@empty
No data
@endforelse
{{-- 2. Top Clients (This Month) --}}
🏢 Clients (Month)
@forelse($topClientsMonth as $index => $cli)
{{ $index + 1 }}
{{ $cli->client->name ?? '-' }}
₹{{ number_format($cli->total_payout/1000, 1) }}k
@empty
No data
@endforelse
{{-- 3. Top Employees (All Time) --}}
🏆 Users (All)
@foreach($topEmployees->take(5) as $index => $emp)
₹{{ number_format($emp->total_payout/1000, 1) }}k
@endforeach
@if($topEmployees->isEmpty())
No data
@endif
{{-- 4. Top Clients (All Time) --}}
🏢 Clients (All)
@foreach($topClients->take(5) as $index => $cli)
₹{{ number_format($cli->total_payout/1000, 1) }}k
@endforeach
@if($topClients->isEmpty())
No data
@endif
{{-- 3. CLIENT CARDS GRID (COMPACT) --}}
Client Summaries ({{ $currentMonthLabel }})
@php
// Softer gradients for compact feel
$cardStyles = [
['bg' => 'bg-white border-l-4 border-l-cyan-500', 'text' => 'text-cyan-600'],
['bg' => 'bg-white border-l-4 border-l-violet-500', 'text' => 'text-violet-600'],
['bg' => 'bg-white border-l-4 border-l-pink-500', 'text' => 'text-pink-600'],
['bg' => 'bg-white border-l-4 border-l-emerald-500', 'text' => 'text-emerald-600'],
['bg' => 'bg-white border-l-4 border-l-amber-500', 'text' => 'text-amber-600'],
];
@endphp
@if ($clientSummaries->isEmpty())
No client conveyance recorded for this month.
@else
@endif
@endsection