@if(count($history ?? []) > 0)
@php
$statusIcons = [
'notice_sent' => ['icon' => 'fas fa-bell', 'color' => 'warning', 'label' => 'Disconnection Notice Sent'],
'disconnected' => ['icon' => 'fas fa-times-circle', 'color' => 'danger', 'label' => 'Service Disconnected'],
'reconnected' => ['icon' => 'fas fa-check-circle', 'color' => 'success', 'label' => 'Service Reconnected'],
'late_fee' => ['icon' => 'fas fa-money-bill', 'color' => 'warning', 'label' => 'Late Fee Applied'],
'none' => ['icon' => 'fas fa-info-circle', 'color' => 'secondary', 'label' => 'System Event']
];
@endphp
@foreach($history as $index => $event)
@php
$eventType = $event->disconnection_status ?? 'none';
$eventConfig = $statusIcons[$eventType] ?? $statusIcons['none'];
@endphp
@if($event->billing_id)
@endif
@if($event->amount)
Amount
₱{{ number_format($event->amount ?? 0, 2) }}
@endif
@if($event->payment_type)
Payment Type
{{ ucfirst(str_replace('_', ' ', $event->payment_type)) }}
@endif
{{ ucfirst($event->status ?? 'added') }}
@if($event->notes)
Notes: {{ $event->notes }}
@endif
@if($event->reference_number)
Ref: {{ $event->reference_number }}
@endif
@endforeach
History Summary
@php
$historyItems = collect($history->items());
$disconnectEvents = $historyItems->filter(fn($h) => $h->disconnection_status === 'disconnected')->count();
$reconnectEvents = $historyItems->filter(fn($h) => $h->disconnection_status === 'reconnected')->count();
$noticeEvents = $historyItems->filter(fn($h) => $h->disconnection_status === 'notice_sent')->count();
$lateFeeEvents = $historyItems->filter(fn($h) => $h->payment_type === 'late_fee')->count();
$totalFeeAmount = $historyItems->filter(fn($h) => $h->payment_type === 'late_fee')->sum('amount');
@endphp
Disconnections
{{ $disconnectEvents }}
Reconnections
{{ $reconnectEvents }}
Notices Sent
{{ $noticeEvents }}
Late Fees
{{ $lateFeeEvents }}
₱{{ number_format($totalFeeAmount, 2) }}
Export Options
@else
No disconnection history
This client hasn't had any disconnection events.
@endif