@php $statsCards = [ [ 'label' => 'Total Clicks', 'value' => number_format($stats['total_clicks']), 'trend' => 'Lifetime', 'color' => 'indigo', 'icon' => 'M15 15l-2 5L9 9l11 4-5 2zm0 0l5 5' ], [ 'label' => 'Conversions', 'value' => number_format($stats['total_conversions']), 'trend' => number_format($stats['conversion_rate'], 1) . '% CR', 'color' => 'emerald', 'icon' => 'M9 12l2 2 4-4M7.835 4.697a3.42 3.42 0 001.946-.806 3.42 3.42 0 014.438 0 3.42 3.42 0 001.946.806 3.42 3.42 0 013.138 3.138 3.42 3.42 0 00.806 1.946 3.42 3.42 0 010 4.438 3.42 3.42 0 00-.806 1.946 3.42 3.42 0 01-3.138 3.138 3.42 3.42 0 00-1.946.806 3.42 3.42 0 01-4.438 0 3.42 3.42 0 00-1.946-.806 3.42 3.42 0 01-3.138-3.138 3.42 3.42 0 00-.806-1.946 3.42 3.42 0 010-4.438 3.42 3.42 0 00.806-1.946 3.42 3.42 0 013.138-3.138z' ], [ 'label' => 'Available Balance', 'value' => '$' . number_format($stats['available_balance'], 2), 'trend' => 'Ready to Payout', 'color' => 'amber', 'icon' => 'M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z' ], [ 'label' => 'Total Earned', 'value' => '$' . number_format($stats['total_earned'], 2), 'trend' => 'Lifetime Earnings', 'color' => 'purple', 'icon' => 'M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z' ], ]; $financialStats = [ ['label' => 'Pending', 'value' => '$' . number_format($stats['pending_commission'], 2), 'color' => 'neutral-500'], ['label' => 'Approved', 'value' => '$' . number_format($stats['approved_commission'], 2), 'color' => 'indigo-400'], ['label' => 'Paid', 'value' => '$' . number_format($stats['paid_commission'], 2), 'color' => 'emerald-400'], ['label' => 'Requested', 'value' => '$' . number_format($stats['requested_payouts'], 2), 'color' => 'amber-400'], ['label' => 'Paid Out', 'value' => '$' . number_format($stats['paid_out_total'], 2), 'color' => 'blue-400'], ]; @endphp
{{-- Header Section --}}

Affiliate Partner Center

Monitor your traffic, conversions, and earnings in real-time.

{{-- Stats Grid --}}
@foreach ($statsCards as $card)

{ { $card['label'] }}

{{ $card['value'] }}

{{ $card['trend'] }}
@endforeach
{{-- Financial Summary --}}
@foreach ($financialStats as $f)

{{ $f['label'] }}

{{ $f['value'] }}

@endforeach
{{-- Referral Link Box --}}

Referral Assets

{{ route('home', ['ref' => $affiliate->affiliate_code]) }}
{{ $affiliate->affiliate_code }}
{{-- Recent Conversions Feed --}}

Recent Sales

Full Ledger
@if($stats['recent_conversions']->count() > 0) @foreach ($stats['recent_conversions'] as $conv) @endforeach
Referral Amount Earnings Date

{{ $conv->conversion_type === 'order' ? 'Customer Purchase' : 'New Sign-up' }}

#{{ substr($conv->source_reference_id ?? 'N/A', -8) }}

${{ number_format($conv->amount, 2) }} +${{ number_format($conv->commission_amount, 2) }} {{ $conv->created_at->format('M d, H:i') }}
@else

No sales yet

Share your link to start earning!

@endif
{{-- Right Column: Side Activity --}}
{{-- Quick Stats Chart (Simulated) --}}

Traffic Trend

@foreach ([30, 45, 60, 40, 75, 90, 65, 80, 50, 100] as $h)
@endforeach

Avg CR

{{ number_format($stats['conversion_rate'], 1) }}%

EPC

${{ $stats['total_clicks'] > 0 ? number_format($stats['total_earned'] / $stats['total_clicks'], 2) : '0.00' }}

{{-- Recent Clicks Feed --}}

Recent Traffic

Details
@foreach ($stats['recent_clicks'] as $click)
{{ $click->country ?? 'UN' }}

{{ $click->browser ?? 'Browser' }}

{{ $click->created_at->diffForHumans() }}

@if($click->is_unique)
@endif
@endforeach