{{-- One Paket Iklan card on the dashboard: the paket's price, its quota per service and validity, with "Berlangganan Disini" (opens the QRIS confirm modal), "Menunggu Pembayaran" (reopens the QRIS of its pending order), "Sudah Berlangganan" with the quota left while it is active, or why it cannot be bought now (a service of it still has an active quota from another paket). $paket: one of the API's GET /api/packages pakets. --}} @php $cardActive = is_array($paket['active'] ?? null) ? $paket['active'] : null; $cardOrder = is_array($paket['order'] ?? null) ? $paket['order'] : null; $cardBlocked = $cardActive || $cardOrder ? null : ($paket['blocked'] ?? null); $cardItems = collect($paket['items'] ?? [])->filter(fn ($item) => is_array($item)); // While active, each service shows what is left of the purchase. $cardLeft = collect($cardActive['items'] ?? [])->keyBy('service'); $cardState = $cardActive ? 'active' : ($cardOrder ? 'pending' : ($cardBlocked ? 'blocked' : 'offer')); // null = unlimited quota. $number = fn ($value) => $value === null ? 'Tanpa batas' : number_format((int) $value, 0, ',', '.'); $label = fn ($service) => \App\Support\PackageServices::label($service); @endphp

{{ $paket['name'] }}

@if ($cardActive) Aktif @elseif ($cardOrder) Belum dibayar @endif

Rp {{ number_format((float) ($paket['price'] ?? 0), 0, ',', '.') }}