@include('user.store._sidebar', ['current' => 'overview', 'cfg' => $cfg, 'sf' => $sf])
{{ __('Store / Overview') }}

{{ __('Sales') }} {{ __('overview') }}

{{ __('Last 30 days. Orders are merged from every channel — WABA, storefront, Twilio.') }}

{{ __('Add product') }}
@php // Currency used for storefront sales display. $storeCur = (string) ($sf->currency_code ?? \App\Models\SystemSetting::get('default_currency', 'USD')); $kpis = [ [ 'label' => 'Revenue (30d)', 'value' => \App\Support\FormatSettings::formatIn( ($stats['revenue30'] ?? 0) / 100, $storeCur, ), ], ['label' => 'Orders (30d)', 'value' => number_format($stats['orders30'] ?? 0)], [ 'label' => 'Avg order', 'value' => \App\Support\FormatSettings::formatIn(($stats['aov'] ?? 0) / 100, $storeCur), ], ['label' => 'Products', 'value' => number_format($stats['products'] ?? 0)], ['label' => 'Visits (30d)', 'value' => number_format($stats['storefrontViews30'] ?? 0)], ]; @endphp @foreach ($kpis as $k)
{{ $k['label'] }}
{{ $k['value'] }}
@endforeach
{{ __('Sales trend') }}

{{ __('Revenue over time') }}

{{ __('Top products (30d)') }}

{{ __('Bestsellers') }}

@forelse ($topProducts as $tp) @php $max = max(array_column($topProducts, 'qty') ?: [1]); @endphp
{{ $tp['name'] }} {{ $tp['qty'] }}
@empty
{{ __('No sales yet — share your store link.') }}
@endforelse

{{ __('Recent orders') }}

{{ __('View all') }}
@forelse ($recentOrders as $o) @empty @endforelse
{{ __('When') }} {{ __('Customer') }} {{ __('Source') }} {{ __('Items') }} {{ __('Total') }} {{ __('Status') }} {{ __('Open') }}
{{ $o->created_at->format('M d, H:i') }}
{{ $o->customer_name ?: '—' }}
{{ $o->customer_phone }}
{{ $o->source }} {{ count($o->items_json ?? []) }} item{{ count($o->items_json ?? []) === 1 ? '' : 's' }} {{ $o->total_display }} {{ $o->status }} Open
{{ __('No orders yet') }}

{{ __("Once customers order from your storefront or WhatsApp, they'll appear here.") }}