@extends('layouts.finance') @section('title', $card->issuer . ' · ' . $card->card_name) @section('subtitle', 'Invoices charged to this credit card') @section('content') @php $statusLabel = fn($status) => match($status) { 'paid' => 'Paid', 'transit' => 'Transit', 'release_on_credit' => 'On Credit', 'debt' => 'Debt', 'overdue' => 'Overdue', 'cancelled' => 'Cancelled', default => 'Unpaid', }; $statusClass = fn($status) => match($status) { 'paid' => 'pill-green', 'transit' => 'pill-cyan', 'release_on_credit' => 'pill-purple', 'debt' => 'pill-blue', 'overdue' => 'pill-red', 'cancelled' => 'pill-rose', default => 'pill-amber', }; // Sum of what each non-cancelled invoice contributed to the card (card currency). $chargedTotal = $invoices ->where('status', '!=', 'cancelled') ->sum(fn($i) => (float) $i->credit_card_charge_amount); $cardUtil = (float) $card->credit_limit > 0 ? ((float) $card->payable_balance / (float) $card->credit_limit) * 100 : 0; @endphp