@extends('layouts.portal') @section('title', 'Agent Referrals') @section('page_title', 'My Referrals') @section('page_subtitle', 'Manage your referred clients') @section('sidebar') @include('agent.partials.sidebar', ['active' => 'clients']) @endsection @section('content')

My Referrals

View and manage clients you have referred

Refer New Client

Total Referrals

{{ $stats['total_referrals'] }}

This Month

{{ $stats['this_month'] }}

Total Commission

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

@if(!empty($draftClients) && $draftClients->count())

Unfinished Onboarding

Resume a client you started but haven't completed

@foreach($draftClients as $draft)

{{ $draft->first_name ?: 'Unnamed client' }}

IC: {{ $draft->ic_number ?: '—' }} · Started {{ $draft->created_at?->diffForHumans() }}

Continue
@csrf
@endforeach
@endif

Referred Clients

@forelse($clients as $client) @empty @endforelse
Client Contact Package Status Date Commission Actions
{{ substr($client->first_name, 0, 1) }}

{{ $client->full_name }}

ID: #{{ $client->id }}

{{ $client->email }}

{{ $client->phone }}

{{ ucfirst($client->account_type) }} {{ ucfirst($client->status) }}

{{ $client->created_at->format('M d, Y') }}

@php // Calculate commission earned from this client $commission = \App\Models\Commission::where('client_id', $client->id)->sum('amount'); @endphp

${{ number_format($commission, 2) }}

earned

@if($client->status == 'pending') @endif

No referrals yet

Start referring clients to see them here

Refer Your First Client
@if($clients->hasPages())

Showing {{ $clients->firstItem() }} to {{ $clients->lastItem() }} of {{ $clients->total() }} results

{{ $clients->links() }}
@endif
@endsection