@extends('layouts.agent') @section('title', 'Agent Dashboard - M-Ajira') @section('content')

Welcome back, {{ $agent->user->name }}! 👋

Agent Code: {{ $agent->agent_code }}

{{ $agent->county }}{{ $agent->sub_county ? ', ' . $agent->sub_county : '' }}

🎯

Your Referral Code

Share this code or link with candidates to earn commissions when they get deployed!

Referral Code

{{ $stats['referral_code'] }}

Referral Link

💡 How it works: When a candidate registers using your code/link, they'll be assigned to you. You earn commission when they get approved and deployed to work abroad!

📊 Your Performance

👥 {{ $stats['total_referrals'] }}

Total Referrals

All candidates you brought

{{ $stats['approved_candidates'] }}

Approved

Ready for deployment

{{ $stats['pending_candidates'] }}

Pending

Awaiting approval

📝 {{ $stats['registered_candidates'] }}

Registered

Newly added

💰 Commission Earnings

💵
TOTAL EARNED KES {{ number_format($stats['total_commission_earned'], 2) }}

All-time commission earnings

PAID OUT KES {{ number_format($stats['commission_paid'], 2) }}

Already received by you

PENDING KES {{ number_format($stats['commission_pending'], 2) }}

Awaiting payout approval

👥 Recent Candidates

@if($recentCandidates->count() > 0) View All @endif
@if($recentCandidates->count() > 0)
@foreach($recentCandidates as $candidate)
@if($candidate->photo_path) {{ $candidate->first_name }} @else
{{ substr($candidate->first_name, 0, 1) }}{{ substr($candidate->last_name ?? 'X', 0, 1) }}
@endif

{{ $candidate->first_name }} {{ $candidate->last_name }}

{{ $candidate->gender }} {{ $candidate->age }} years {{ $candidate->county }}
📱 {{ $candidate->phone }} @if($candidate->email) 📧 {{ $candidate->email }} @endif 🆔 {{ $candidate->majira_id }}
Registered: {{ $candidate->created_at->format('d M Y, h:i A') }}
{{ ucfirst($candidate->status) }} View Details
@endforeach
@else
👥

No Candidates Yet

Start earning commissions by sharing your referral code with potential candidates. When they register and get deployed, you earn!

@endif
@endsection