@extends('layouts.admin') @section('page-title', 'Analytics') @section('content')
{{-- Header --}}

Analytics

Track your store's performance and growth

{{-- Stat Cards --}}
@if($revenueChange != 0) {{ abs($revenueChange) }}% @endif

{{ price($periodRevenue) }}

Revenue this period

@if($ordersChange != 0) {{ abs($ordersChange) }}% @endif

{{ number_format($periodOrders) }}

Orders this period

@if($customersChange != 0) {{ abs($customersChange) }}% @endif

{{ number_format($periodCustomers) }}

New customers

{{ price($periodAvgOrderValue) }}

Average order value

{{-- Charts Row --}}

Sales Over Time

Revenue trend for the selected period

Revenue

Orders by Status

Distribution of order statuses

@foreach($ordersByStatus as $status)
@php $statusColorMap = ['pending' => 'bg-yellow-400', 'processing' => 'bg-blue-400', 'shipped' => 'bg-purple-400', 'delivered' => 'bg-emerald-400', 'cancelled' => 'bg-red-400']; $statusColor = $statusColorMap[$status->status] ?? 'bg-gray-400'; @endphp
{{ $status->status }}
{{ $status->count }}
@endforeach
{{-- Second Row --}}

Conversion Funnel

Order pipeline overview

@php $funnelSteps = [ ['label' => 'Pending', 'count' => $conversionData['pending'], 'color' => 'yellow', 'icon' => ''], ['label' => 'Processing', 'count' => $conversionData['processing'], 'color' => 'blue', 'icon' => ''], ['label' => 'Shipped', 'count' => $conversionData['shipped'], 'color' => 'purple', 'icon' => ''], ['label' => 'Delivered', 'count' => $conversionData['delivered'], 'color' => 'emerald', 'icon' => ''], ['label' => 'Cancelled', 'count' => $conversionData['cancelled'], 'color' => 'red', 'icon' => ''], ]; $totalOrdersInFunnel = max(array_sum($conversionData), 1); @endphp @foreach($funnelSteps as $step)
{!! $step['icon'] !!} {{ $step['label'] }}
{{ $step['count'] }}
@endforeach

Payment Methods

Revenue breakdown by payment type

@foreach($revenueByPaymentMethod as $method)

{{ $method->payment_method ?? 'Other' }}

{{ price($method->total) }}

{{ $method->count }} transactions

@endforeach
{{-- Third Row: Top Products & Vendors --}}
{{-- Top Products --}}

Top Products

Best selling products by sales count

@forelse($topProducts as $index => $product) @empty @endforelse
# Product Vendor Sales
{{ $index + 1 }}

{{ $product->name }}

{{ $product->vendor?->name ?? 'Admin' }} {{ number_format($product->sales_count) }}
No sales data available
{{-- Top Vendors --}}

Top Vendors

Highest revenue generating vendors

@forelse($topVendors as $index => $vendor) @empty @endforelse
# Vendor Products Total Sales
{{ $index + 1 }}
@if($vendor->user?->avatar) @else
{{ strtoupper(substr($vendor->name, 0, 1)) }}
@endif

{{ $vendor->name }}

{{ $vendor->user?->email ?? '' }}

{{ $vendor->products->count() ?? '-' }} {{ price($vendor->total_sales) }}
No vendor data available
@php $currency = currentCurrency(); $currencySymbol = $currency->symbol; $exchangeRate = (float) $currency->exchange_rate; @endphp @push('scripts') @endpush @endsection