@props([ 'title' => ___('admin.overview_0efc2e'), 'stats' => [], // ['Label' => 'value', ...] small KPI tiles 'donut' => null, // ['labels' => [...], 'series' => [...]] status breakdown 'trend' => null, // ['labels' => [...], 'series' => [['name'=>'', 'data'=>[]]], 'type' => 'area'|'bar'] 'donutTitle' => null, // caption above the donut 'trendTitle' => null, // caption above the trend; defaults to the series name ]) @php // Unique suffix so multiple analytics blocks never collide on one page. $uid = 'la_' . substr(md5(uniqid('', true)), 0, 8); $chartDonutLabels = $donut ? array_map('admin_label', $donut['labels']) : []; $chartTrendSeries = $trend ? array_map(fn ($series) => array_replace($series, [ 'name' => admin_label($series['name'] ?? ''), ]), $trend['series']) : []; @endphp
{{ admin_label($title) }}
{{-- KPI tiles --}} @if(!empty($stats))
@foreach($stats as $label => $value)
{{ $value }}
{{ admin_label($label) }}
@endforeach
@endif {{-- Donut (breakdown) --}} @if($donut)
{{ admin_label($donutTitle ?? ___('admin.breakdown_fd91b3')) }}
@endif {{-- Trend (line/area/bar). The caption names the single series, so the chart itself does not carry a one-item legend. --}} @if($trend)
{{ admin_label($trendTitle ?? ($trend['series'][0]['name'] ?? ___('admin.trend_dae07c'))) }}
@endif
@once @push('scripts') @endpush @endonce @push('scripts') @endpush