@php
$kpis = [
['label' => 'Total Aset', 'key' => 'total_aset', 'icon' => 'bx-building-house', 'color' => 'indigo', 'is_rupiah' => true],
['label' => 'Total Pembiayaan', 'key' => 'total_pembiayaan', 'icon' => 'bx-wallet', 'color' => 'emerald', 'is_rupiah' => true],
['label' => 'SHU Berjalan', 'key' => 'shu', 'icon' => 'bx-line-chart', 'color' => 'amber', 'is_rupiah' => true],
['label' => 'Jumlah Anggota', 'key' => 'jumlah_anggota', 'icon' => 'bx-group', 'color' => 'teal', 'is_rupiah' => false],
['label' => 'Kas & Bank', 'key' => 'kas_bank', 'icon' => 'bx-money', 'color' => 'rose', 'is_rupiah' => true],
];
@endphp
@foreach($kpis as $kpi)
@php
$data = $kpiData[$kpi['key']] ?? ['value' => 0, 'yoy' => 0];
$val = $data['value'];
$yoy = $data['yoy'];
$colorMap = [
'indigo' => 'bg-indigo-500 text-indigo-500',
'emerald' => 'bg-emerald-500 text-emerald-500',
'amber' => 'bg-amber-500 text-amber-500',
'teal' => 'bg-teal-500 text-teal-500',
'rose' => 'bg-rose-500 text-rose-500',
];
$borderClasses = match($kpi['color']) {
'indigo' => 'border-l-indigo-500',
'emerald' => 'border-l-emerald-500',
'amber' => 'border-l-amber-500',
'teal' => 'border-l-teal-500',
'rose' => 'border-l-rose-500',
default => 'border-l-indigo-500'
};
@endphp
{{ $kpi['label'] }}
{{ $kpi['is_rupiah'] ? 'Rp ' . number_format($val, 0, ',', '.') : number_format($val, 0, ',', '.') }}
@if($yoy > 0)
{{ number_format($yoy, 1, ',', '.') }}%
@elseif($yoy < 0)
{{ number_format(abs($yoy), 1, ',', '.') }}%
@else
0%
@endif
vs tahun lalu
@endforeach