@php $rows = array_reverse($overageHistory ?? []); @endphp
Overage Payment History
@if(empty($rows))
কোন বকেয়া পেমেন্ট ইতিহাস পাওয়া যায়নি।
@else @php $totalAmount = collect($rows)->sum(fn ($r) => (float) ($r['payment_amount'] ?? 0)); $paidCount = collect($rows)->filter(fn ($r) => in_array($r['payment_status'] ?? '', ['approved', 'completed', 'paid'], true))->count(); $pendingCount = collect($rows)->filter(fn ($r) => ($r['payment_status'] ?? '') === 'pending')->count(); $rejectedCount = collect($rows)->filter(fn ($r) => ($r['payment_status'] ?? '') === 'rejected')->count(); @endphp
@foreach($rows as $row) @php $st = $row['payment_status'] ?? 'pending'; $stClass = match($st) { 'approved', 'completed', 'paid' => 'success', 'pending' => 'warning', 'rejected' => 'danger', default => 'secondary', }; $method = $row['payment_method'] ?? 'bank_transfer'; $overages = is_array($row['overages'] ?? null) ? $row['overages'] : []; @endphp @endforeach @if($paidCount > 0) @endif @if($pendingCount > 0) @endif @if($rejectedCount > 0) @endif
Payment # Payment Date Payment Method Payment Amount Overage Count Status Details
#{{ $row['payment_id'] ?? substr($row['id'] ?? '—', 0, 8) }} {{ isset($row['payment_date']) ? \Carbon\Carbon::parse($row['payment_date'])->format('d M Y, h:i A') : '—' }} {{ $row['payment_method_text'] ?? ($method === 'bank_transfer' ? 'Bank Transfer' : ucfirst($method)) }} {{ number_format($row['payment_amount'] ?? 0, 2) }} ৳ {{ (int) ($row['overage_count'] ?? count($overages)) }} টি বকেয়া {{ ucfirst($st) }} @if(! empty($row['status_text']))
{{ $row['status_text'] }} @endif
@if(! empty($overages)) @else @endif
Total Payments: {{ count($rows) }} times
Total Amount: {{ number_format($totalAmount, 2) }} ৳
Paid: {{ $paidCount }} times
Pending: {{ $pendingCount }} times
Rejected: {{ $rejectedCount }} times
@foreach($rows as $row) @php $overages = is_array($row['overages'] ?? null) ? $row['overages'] : []; @endphp @if(! empty($overages)) @endif @endforeach @endif