@include('Partials.sidebar') @include('Partials.header') {{-- ── Page Title ── --}} My Performance Sales dashboard — {{ $admin->name }} › Reports › My Performance {{-- ── Period Filter ── --}} @foreach([ 'today' => 'Today', 'this_week' => 'This Week', 'this_month' => 'This Month', 'last_month' => 'Last Month', 'this_quarter' => 'This Quarter', 'this_year' => 'This Year', ] as $val => $label) {{ $label }} @endforeach {{ \Carbon\Carbon::parse($dateFrom)->format('d M') }} – {{ \Carbon\Carbon::parse($dateTo)->format('d M Y') }} {{-- ── KPI Cards ── --}} @foreach([ ['Leads This Period', $leadsInPeriod, '#3b82f6', 'fa-user-plus', null], ['Active Pipeline', $activeLeads, '#c9a96e', 'fa-funnel-dollar', null], ['Deals Won', $wonLeads, '#22c55e', 'fa-trophy', null], ['Deals Lost', $lostLeads, '#ef4444', 'fa-times-circle', null], ['Conversion Rate', $conversionRate.'%', '#8b5cf6', 'fa-percentage', null], ['Bookings Closed', $bookingsCount, '#f59e0b', 'fa-handshake', null], ['Revenue Generated', $currency.$totalRevenue, 0, '#10b981', 'fa-coins', null], ['Avg Deal Size', $currency.$avgDealSize, 0, '#6366f1', 'fa-chart-bar', null], ] as [$label, $val, $color, $icon, $_]) {{ $val }} {{ $label }} @endforeach {{-- ── Pipeline Funnel ── --}} Pipeline {{ $totalLeads }} total @php $stages = [ 'new' => ['New', '#3b82f6'], 'contacted' => ['Contacted', '#f59e0b'], 'site_visit' => ['Site Visit', '#8b5cf6'], 'negotiation' => ['Negotiation', '#ef4444'], 'won' => ['Won', '#22c55e'], 'lost' => ['Lost', '#94a3b8'], ]; $maxVal = max(array_values($pipeline) ?: [1]); @endphp @foreach($stages as $key => [$label, $color]) @php $count = $pipeline[$key] ?? 0; $pct = $maxVal > 0 ? round(($count/$maxVal)*100) : 0; @endphp {{ $label }} {{ $count }} @endforeach {{-- ── Follow-Up Activity ── --}} Follow-Up Activity {{ $totalFollowUps }} Total activities this period @foreach([ ['📞', 'Calls', $callCount, '#22c55e'], ['💬', 'WhatsApp', $whatsappCount, '#25d366'], ['📧', 'Emails', $emailCount, '#3b82f6'], ['🏠', 'Site Visits', $siteVisitCount, '#c9a96e'], ['🤝', 'Meetings', $meetingCount, '#8b5cf6'], ] as [$emoji, $label, $count, $color]) {{ $emoji }} {{ $label }} {{ $count }} @endforeach {{-- ── Upcoming Follow-Ups ── --}} Due Follow-Ups View All @forelse($upcomingFollowUps as $fu) {{ $fu->lead->name ?? 'Unknown' }} {{ ucfirst($fu->type) }} • {{ \Carbon\Carbon::parse($fu->next_follow_up_at)->diffForHumans() }} View @empty No upcoming follow-ups! @endforelse {{-- ── Monthly Trend + Recent Leads ── --}} {{-- Monthly Trend Chart ── --}} 6-Month Trend {{-- Recent Leads ── --}} Recent Leads All Leads @forelse($recentLeads as $lead) @php $statusColors = ['new'=>'#3b82f6','contacted'=>'#f59e0b','site_visit'=>'#8b5cf6','negotiation'=>'#ef4444','won'=>'#22c55e','lost'=>'#94a3b8']; $sc = $statusColors[$lead->status] ?? '#94a3b8'; @endphp {{ strtoupper(substr($lead->name, 0, 1)) }} {{ $lead->name }} {{ $lead->phone }} {{ ucfirst(str_replace('_',' ',$lead->status)) }} @empty No leads yet. @endforelse @include('Partials.footer')
Sales dashboard — {{ $admin->name }}