@extends('layouts.promoter') @section('page-title', 'Dashboard') @push('styles') @endpush @section('content')
{{-- Welcome Section --}}
@php $user = auth()->user(); $avatarUrl = $user->avatar ? (str_starts_with($user->avatar, 'http') ? $user->avatar : (str_starts_with($user->avatar, '/') ? asset($user->avatar) : asset('storage/' . $user->avatar))) : ''; $initials = strtoupper(substr($user->name, 0, 1) . (strpos($user->name, ' ') !== false ? substr($user->name, strpos($user->name, ' ') + 1, 1) : '')); @endphp
@if($avatarUrl) {{ $user->name }} @else {{ $initials }} @endif
Welcome back
{{ $user->name }}
{{ now()->format('l, F j, Y') }}
{{-- KPI Cards --}}
{{ $totalChats }}
Total Chats {{ $activeChats }} active
{{ $totalSessions }}
Total Sessions {{ $activeSessions }} active
{{ number_format($totalViewers) }}
Total Viewers {{ $avgViewersPerSession }} avg/session
{{ price($totalReferralEarnings + $totalCommission, false) }}
Total Earnings {{ price($totalReferralEarnings, false) }} referrals
{{-- Referral Link Section --}} @if($referralLink)
Your Referral Link
Share this link to earn 5% commission on every order
Referral Balance
{{ price($referralBalance, false) }}
Total Referral Earnings
{{ price($totalReferralEarnings, false) }}
@endif {{-- Sessions Chart + Status Distribution --}}
Sessions Over Time
Last 30 days
Session Status
Current distribution
@foreach($statusDistribution as $status) @php $color = match($status->status) { 'active' => '#22c55e', 'completed' => '#3b82f6', 'scheduled' => '#eab308', 'cancelled' => '#ef4444', default => '#9ca3af' }; @endphp
{{ ucfirst($status->status) }} {{ $status->count }}
@endforeach
{{-- Recent Sessions + Top Products --}}
Recent Sessions
Latest activity
View All →
@forelse($sessions as $session) @php $badgeClass = match($session->status) { 'active' => 'badge-green', 'completed' => 'badge-blue', 'scheduled' => 'badge-yellow', 'cancelled' => 'badge-red', default => 'badge-gray' }; @endphp @empty @endforelse
SessionViewersSalesStatusDate
{{ Str::limit($session->title, 30) }} {{ number_format($session->viewers_count) }} {{ $session->sales_count }} {{ ucfirst($session->status) }} {{ $session->started_at?->diffForHumans() ?? $session->created_at->diffForHumans() }}
No sessions yet
Top Products
By sales from your sessions
@if($topProducts->count() > 0)
@foreach($topProducts as $i => $product) @php $rankClass = $i === 0 ? 'rank-1' : ($i === 1 ? 'rank-2' : ($i === 2 ? 'rank-3' : '')); @endphp
{{ $i + 1 }}
{{ $product->name }}
{{ price($product->revenue, false) }}
{{ $product->sales_count }} sold
@endforeach
@else
No product sales data available
@endif
{{-- Recent Referrals --}} @if($referralCommissions->count() > 0)
Recent Referrals
Orders from your referral link
@forelse($referralCommissions as $commission) @php $badgeClass = match($commission->status) { 'credited' => 'badge-green', 'pending' => 'badge-yellow', 'reversed' => 'badge-red', default => 'badge-gray' }; @endphp @empty @endforelse
OrderCustomerCommissionStatusDate
{{ $commission->order->order_number ?? 'N/A' }} {{ $commission->order->customer->name ?? 'N/A' }} {{ price($commission->commission_amount, false) }} {{ ucfirst($commission->status) }} {{ $commission->created_at->diffForHumans() }}
No referrals yet. Share your link to start earning!
@endif
@push('scripts') @endpush @endsection