@props([ 'cards' => null, 'icon' => 'fas fa-chart-bar', 'title' => 'Judul Card', 'value' => 0, 'description' => 'Deskripsi Card', 'color' => 'primary', ]) @php $colors = [ 'primary' => '#2563eb', 'success' => '#16a34a', 'warning' => '#d97706', 'danger' => '#dc2626', 'info' => '#0891b2', ]; @endphp @if ($cards)
@foreach ($cards as $key => $card) @php if (is_array($card)) { $cTitle = $card['title'] ?? ucwords(str_replace('_', ' ', $key)); $cValue = $card['value'] ?? 0; $cIcon = $card['icon'] ?? 'fas fa-chart-bar'; $cColor = $card['color'] ?? 'primary'; $cDesc = $card['description'] ?? 'Informasi Data'; $cColumn = $card['column'] ?? 'col-lg-3 col-md-6'; } else { $cTitle = ucwords(str_replace('_', ' ', $key)); $cValue = $card; $cIcon = 'fas fa-chart-bar'; $cColor = 'primary'; $cDesc = 'Informasi Data'; $cColumn = 'col-md-3'; } $mappedColor = str_starts_with($cColor, 'bg-') ? substr($cColor, 3) : $cColor; $theme = $colors[$mappedColor] ?? ($colors[$cColor] ?? '#2563eb'); @endphp
{{ $cTitle }}

{{ number_format($cValue) }}

{{ $cDesc }}

@endforeach
@else @php $mappedColor = str_starts_with($color, 'bg-') ? substr($color, 3) : $color; $theme = $colors[$mappedColor] ?? ($colors[$color] ?? '#2563eb'); @endphp
{{ $title }}

{{ number_format($value) }}

{{ $description }}

{{ $slot ?? '' }}
@endif