@extends('layouts.app') @section('title', 'Analytics & Insights') @section('page-title', 'Analytics & Insights') @section('content') {{-- Top stats --}}

Total Spent

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

₨{{ number_format($totalSpent * session('usd_pkr_rate',280), 0) }}

Total Orders

{{ number_format($totalOrders) }}

trending_up {{ $ordersThisMonth }} this month

Best Service

{{ $bestService ?? 'N/A' }}

Most ordered

{{-- Charts row --}}
{{-- Spending over time --}}

Spending (Last 30 Days)

USD
{{-- Orders by status --}}

Orders by Status

@foreach([['Completed','#4edea3',$completed],['Pending','#fcd34d',$pending],['Processing','#adc6ff',$processing],['Cancelled','#ffb4ab',$cancelled]] as [$label,$color,$count])
{{$label}} {{$count}}
@endforeach
{{-- Top services --}}

Top Services by Spend

@forelse($topServices as $svc) @php $pct = $totalSpent > 0 ? ($svc->total_spent / $totalSpent) * 100 : 0; @endphp
{{ $svc->service_name }}
${{ number_format($svc->total_spent, 2) }} {{ $svc->order_count }} orders
@empty

No order data yet

@endforelse
@endsection @section('scripts') @endsection