@extends('layouts.portal') @section('title', 'Agent Reports') @section('page_title', 'Agent Reports') @section('page_subtitle', 'Agent performance, client referrals, and commission details') @section('sidebar') @include('admin.partials.sidebar', ['active' => 'reports-agents']) @endsection @section('content')
Agent performance, client referrals, and commission details
| ID | Name | Phone | Status | Referral Code | Clients Referred | Active Clients | Completed Wills | Commissions | Paid Amount | Pending Amount | Join Date | Actions | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| {{ $agent->id }} |
{{ $agent->first_name }} {{ $agent->last_name }} @if($agent->address) {{ Str::limit($agent->address, 50) }} @endif |
{{ $agent->email }} | {{ $agent->phone ?? 'N/A' }} | {{ ucfirst($agent->status) }} |
{{ $agent->referral_code ?? 'N/A' }}
|
{{ $agent->clients()->whereNotNull('referred_by')->count() }} | {{ $agent->clients()->where('status', 'active')->count() }} | {{ $agent->clients()->whereHas('wills', function($q) { $q->where('status', 'completed'); })->count() }} | {{ $agent->commissions()->count() }} | RM {{ number_format($agent->commissions()->where('status', 'paid')->sum('amount'), 0) }} | RM {{ number_format($agent->commissions()->where('status', 'pending')->sum('amount'), 0) }} | {{ $agent->created_at->format('M d, Y') }} | N/A |