@php $dashboardCurrency = currency_code($currency ?? default_currency()); $metricsList = [ [ 'key' => 'revenue', 'label' => __('Revenue'), 'icon' => 'fa-money-bill-wave', 'primary' => money($metrics['revenue']['period'] ?? 0, $dashboardCurrency), 'secondary' => __('Total: :amount', [ 'amount' => money($metrics['revenue']['total'] ?? 0, $dashboardCurrency), ]), 'change' => $comparison['revenue']['change'] ?? 0, 'color' => 'primary', 'extra' => __('Avg: :amount', [ 'amount' => money($metrics['revenue']['avg_order_value'] ?? 0, $dashboardCurrency), ]), ], [ 'key' => 'orders', 'label' => __('Orders'), 'icon' => 'fa-shopping-bag', 'primary' => number_format((int) ($metrics['orders']['total'] ?? 0)), 'secondary' => __('Pending: :count', [ 'count' => number_format((int) ($metrics['orders']['pending'] ?? 0)), ]), 'change' => $metrics['orders']['growth'] ?? 0, 'color' => 'info', 'extra' => __('Completed: :count', [ 'count' => number_format((int) ($metrics['orders']['completed'] ?? 0)), ]), ], [ 'key' => 'users', 'label' => __('Users'), 'icon' => 'fa-users', 'primary' => number_format((int) ($metrics['users']['total'] ?? 0)), 'secondary' => __('New: :count', [ 'count' => number_format((int) ($metrics['users']['new'] ?? 0)), ]), 'change' => $metrics['users']['growth'] ?? 0, 'color' => 'success', 'extra' => __('Retention: :rate%', [ 'rate' => number_format((float) ($metrics['conversion']['retention_rate'] ?? 0), 1), ]), ], [ 'key' => 'products', 'label' => __('Products'), 'icon' => 'fa-cube', 'primary' => number_format((int) ($metrics['products']['total'] ?? 0)), 'secondary' => __(':count active', [ 'count' => number_format((int) ($metrics['products']['active'] ?? 0)), ]), 'change' => null, 'color' => 'warning', 'extra' => __('New: :count', [ 'count' => number_format((int) ($metrics['products']['new'] ?? 0)), ]), ], ]; @endphp
@foreach($metricsList as $metric)

{{ $metric['label'] }}

{{ $metric['primary'] }}

@if($metric['change'] !== null) @php $change = (float) $metric['change']; @endphp
{{ number_format(abs($change), 1) }}% {{ __('vs last period') }}
@endif
{{ $metric['secondary'] }} {{ $metric['extra'] }}
@endforeach