{{-- ─── Headline KPIs ─── --}}
{{-- ─── Chart + status donut ─── --}}
{{-- Recent orders (14 days) — REAL data on the shared interactive area chart (impulsa_chart geometry + rfChartHover crosshair/tooltip), the same component the client dashboard uses. --}} @php $cOpts = ['vh' => 250, 'padX' => 30, 'padTop' => 14, 'padBottom' => 34, 'showAxis' => true]; $geo = impulsa_chart($chart['points'], $cOpts); // The tooltip's revenue is formatted HERE, not in the cached KPI // payload, so a change to Settings → Currency shows on the next // render instead of waiting out the cache. $chartPoints = array_map( fn ($p) => $p + ['extra' => money((string) ($p['extra_value'] ?? 0), $currency)], $chart['points'], ); $geo2 = impulsa_chart($chart['revenue'], ['showAxis' => false] + $cOpts); @endphp

{{ __('Recent Orders') }}

{{ __('Orders') }} @if ($chart['hasRevenue']) {{ __('Revenue') }} @endif
@foreach ($geo['gridYs'] as $gy) @endforeach @if ($chart['hasRevenue']) @endif @foreach ($geo['coords'] as $pt) @endforeach @foreach ($geo['axis'] as $a) {{ $a['label'] }} @endforeach
{{-- Order status donut --}}

{{ __('Order Status') }}

@php $families = [ 'completed' => ['success', __('Completed')], 'in_progress' => ['info', __('In progress')], 'processing' => ['info', __('Processing')], 'pending' => ['warning', __('Pending')], 'awaiting' => ['warning', __('Awaiting')], 'partial' => ['partial', __('Partial')], 'active' => ['active', __('Active')], 'canceled' => ['neutral', __('Canceled')], 'refunded' => ['refund', __('Refunded')], 'error' => ['danger', __('Error')], 'simulated' => ['danger', __('Simulated')], ]; $toneVar = [ 'success' => 'var(--state-success-fg)', 'info' => 'var(--state-info-fg)', 'warning' => 'var(--state-warning-fg)', 'partial' => 'var(--state-partial-fg)', 'active' => 'var(--color-primary-500)', 'neutral' => 'var(--state-neutral-fg)', 'refund' => 'var(--state-refund-fg)', 'danger' => 'var(--state-danger-fg)', ]; @endphp @if ($orders_total > 0) @php $segments = ''; $acc = 0; foreach ($status as $st => $count) { $tone = $families[$st][0] ?? 'neutral'; $color = $toneVar[$tone]; $pct = $count / $orders_total * 100; $segments .= "$color {$acc}% ".($acc + $pct)."%,"; $acc += $pct; } $segments = rtrim($segments, ','); @endphp
@foreach ($status as $st => $count) @php [$tone, $label] = $families[$st] ?? ['neutral', ucfirst($st)]; @endphp
{{ $label }} {{ number_format($count) }}
@endforeach
@else

{{ __('No orders yet') }}

{{ __('The status split appears once orders come in.') }}

@endif
{{-- ─── Recent users + best sellers ─── --}}

{{ __('Latest Users') }}

{{ __('View all') }}
@forelse ($recent_users as $u) @empty @endforelse
{{ $u->display_name }}
{{ $u->email }}
{{ $u->created_at?->diffForHumans() }}

{{ __('Best Sellers') }}

{{ __('Services') }}
@forelse ($best_sellers as $s) @empty @endforelse
{{ __('Service') }} {{ __('Orders') }} {{ __('Revenue') }}
{{ \Illuminate\Support\Str::limit($s->service?->name ?? '—', 34) }} {{ number_format($s->orders) }} {{ money($s->revenue, $currency) }}