@extends('layouts.portal') @section('title', $agent->name . ' - Performance Details') @section('page_title', $agent->name) @section('page_subtitle', 'Detailed Performance Analysis & Commission Tracking') @section('sidebar') @include('admin.partials.sidebar', ['active' => 'agent-performance']) @endsection @section('content')

{{ $agent->name }}

{{ ucfirst($agent->role) }} Performance Details

Back to Dashboard

Total Clients

{{ $stats['total_clients'] }}

Total Wills

{{ $stats['total_wills'] }}

Total Commission

RM {{ number_format($stats['total_commission'], 2) }}

This Month

RM {{ number_format($stats['commission_this_month'], 2) }}

{{ $stats['clients_this_month'] }} clients

Monthly Referrals

@foreach($monthlyStats['months'] as $index => $month)
{{ $month }}
{{ $monthlyStats['referrals'][$index] }}
@endforeach

Monthly Wills Created

@foreach($monthlyStats['months'] as $index => $month)
{{ $month }}
{{ $monthlyStats['wills'][$index] }}
@endforeach

Monthly Commission Earned

@foreach($monthlyStats['months'] as $index => $month)
{{ $month }}
RM {{ number_format($monthlyStats['commissions'][$index], 2) }}
@endforeach

Commission Details

@forelse($commissionDetails as $commission) @empty @endforelse
Client Name Will ID Level Commission Amount Status Date
@if($commission->will && $commission->will->client) {{ $commission->will->client->first_name }} {{ $commission->will->client->last_name }} @else N/A @endif {{ $commission->will_id ?? 'N/A' }} Level {{ $commission->level }} RM {{ number_format($commission->amount, 2) }} @php $statusClass = match($commission->status ?? 'pending') { 'paid' => 'bg-green-100 text-green-800', 'pending' => 'bg-yellow-100 text-yellow-800', default => 'bg-gray-100 text-gray-800' }; @endphp {{ ucfirst($commission->status ?? 'pending') }} {{ $commission->created_at->format('d M Y') }}
No commission records found
@if($commissionDetails->total() > 0)
Showing {{ $commissionDetails->firstItem() }} to {{ $commissionDetails->lastItem() }} of {{ $commissionDetails->total() }} records
{{ $commissionDetails->links() }}
@endif
@endsection