@extends('layouts.app') @section('content') @if(in_array(auth()->user()->role->name, ['super_admin', 'company_admin', 'company_owner']))
Back to Disconnections

Client Details

Late fees, overdue billings, and history for {{ $client->name ?? 'Client' }}

Client Name

{{ $client->name ?? 'Unknown' }}

Account Number

{{ $client->account_number ?? 'N/A' }}

Contact

{{ $client->phone ?? 'N/A' }}

{{ $client->email ?? 'N/A' }}

Address

{{ $client->address ?? 'N/A' }}

@php $riskLevel = $lateFeesSummary['risk_level'] ?? 'low'; $riskAlertClass = [ 'critical' => 'danger', 'high' => 'warning', 'medium' => 'warning', 'low' => 'success' ]; $alertClass = $riskAlertClass[$riskLevel] ?? 'secondary'; @endphp
Total Overdue Balance

₱{{ number_format($lateFeesSummary['total_overdue_balance'] ?? 0, 2) }}

Total Late Fees

₱{{ number_format($lateFeesSummary['total_late_fees'] ?? 0, 2) }}

Overdue Billings

{{ $lateFeesSummary['overdue_billings_count'] ?? 0 }}

Days Since First Overdue

{{ $lateFeesSummary['days_overdue'] ?? 0 }}

Latest Due Date

{{ isset($lateFeesSummary['latest_due_date']) ? $lateFeesSummary['latest_due_date'] : 'N/A' }}

Disconnection Settings & History
Current Disconnection Status
@php $currentDisconnection = $client->billings() ->where('disconnection_status', '!=', 'none') ->where('balance', '>', 0) ->orderBy('updated_at', 'desc') ->first(); $disconnectionStatus = $currentDisconnection?->disconnection_status ?? 'none'; $statusBadgeClass = $disconnectionStatus === 'disconnected' ? 'bg-danger' : ($disconnectionStatus === 'notice_sent' ? 'bg-warning' : 'bg-success'); $statusText = $disconnectionStatus === 'disconnected' ? 'Disconnected' : ($disconnectionStatus === 'notice_sent' ? 'Notice Sent' : 'Active'); @endphp
{{ $statusText }} Status:
@if($currentDisconnection)
{{ $currentDisconnection->updated_at?->format('M d, Y H:i A') ?? 'N/A' }} Last Updated:
{{ $currentDisconnection->disconnection_reason ?? 'N/A' }} Reason:
@endif
Quick Actions
View Full History @if($disconnectionStatus === 'disconnected')
@csrf
@elseif($disconnectionStatus === 'none' && $lateFeesSummary['total_overdue_balance'] > 0)
@csrf
@endif
All Unpaid Billings
Every billing this account still owes on — including ones not yet past due — net of all payments received. This is the amount that must be settled to avoid disconnection.
@forelse($statement['lines'] ?? [] as $line) @empty @endforelse @if(($statement['lines'] ?? collect())->count() > 0) @endif
Billing No. Period Amount Due Paid Balance Days Overdue Late Fees Due Date Status
{{ $line['billing_number'] }} {{ $line['billing_period'] }} ₱{{ number_format($line['total_amount_due'], 2) }} ₱{{ number_format($line['amount_paid'], 2) }} ₱{{ number_format($line['balance'], 2) }} @if($line['days_overdue'] > 0) {{ $line['days_overdue'] }} days @else Not yet due @endif ₱{{ number_format($line['penalties'], 2) }} {{ $line['due_date'] }} @php $status = $line['billing']->disconnection_status ?? 'none'; $statusClass = [ 'none' => 'secondary', 'notice_sent' => 'warning', 'disconnected' => 'danger', 'reconnected' => 'success' ]; $statusBg = $statusClass[$status] ?? 'secondary'; $statusLabel = [ 'none' => 'Active', 'notice_sent' => 'Notice Sent', 'disconnected' => 'Disconnected', 'reconnected' => 'Reconnected' ]; @endphp {{ $statusLabel[$status] ?? ucfirst($status) }}
No unpaid billings found.
TOTAL FOR ALL BILLINGS ₱{{ number_format($statement['totalBilled'], 2) }} ₱{{ number_format($statement['totalPaid'], 2) }} ₱{{ number_format($statement['totalOutstanding'], 2) }} ₱{{ number_format($statement['totalPenalties'], 2) }}
@if(($statement['payments'] ?? collect())->count() > 0)
Payments Received on These Billings
The balances above are already net of these payments.
@foreach($statement['payments'] as $statementPayment) @endforeach
Date Reference Billing No. Method Amount
{{ $statementPayment->payment_date?->format('M d, Y') ?? '—' }} {{ $statementPayment->reference_number }} {{ $statementPayment->billing?->billing_number ?? '—' }} {{ ucfirst(str_replace('_', ' ', $statementPayment->payment_method)) }} ₱{{ number_format($statementPayment->amount, 2) }}
TOTAL RECEIVED ₱{{ number_format($statement['payments']->sum('amount'), 2) }}
@endif
@forelse($lateFeeHistory ?? [] as $payment) @empty @endforelse
Date Billing Fee Amount Type Notes
{{ $payment->created_at ? $payment->created_at->format('M d, Y H:i') : 'N/A' }} #{{ $payment->billing_id ?? 'N/A' }} ₱{{ number_format($payment->amount ?? 0, 2) }} {{ ucfirst($payment->payment_type ?? 'N/A') }} {{ $payment->notes ?? '-' }}
No late fee history found.
Late Payments Tracking

This list tracks all late payments for this client, including payments made after reconnection to help monitor recurring patterns.

@forelse($latePaymentsList ?? [] as $payment) @empty @endforelse
Date Billing Due Date Days Late Amount Status Notes
{{ $payment->created_at ? $payment->created_at->format('M d, Y') : 'N/A' }} #{{ $payment->billing_id }} {{ $payment->due_date ? $payment->due_date->format('M d, Y') : 'N/A' }} {{ $payment->days_late ?? 0 }} days ₱{{ number_format($payment->amount ?? 0, 2) }} {{ ucfirst($payment->payment_status ?? 'pending') }} {{ $payment->notes ?? '-' }}
No late payments recorded.
Current Status
Outstanding Balance (all unpaid billings): ₱{{ number_format($statement['totalOutstanding'] ?? 0, 2) }}
— of which already overdue: ₱{{ number_format($lateFeesSummary['total_overdue_balance'] ?? 0, 2) }}
Late Fees Applied: ₱{{ number_format($lateFeesSummary['total_late_fees'] ?? 0, 2) }}
Reconnection Fee: ₱{{ number_format($reconnectionFee ?? 0, 2) }}
Total Payment Required
{{-- Reconnection clears the account, so this is every unpaid billing plus the reconnection fee — not the overdue part alone. --}}
₱{{ number_format(($statement['totalOutstanding'] ?? 0) + ($reconnectionFee ?? 0), 2) }}

₱{{ number_format($statement['totalOutstanding'] ?? 0, 2) }} across {{ $statement['unpaidCount'] ?? 0 }} unpaid billing/s @if(($reconnectionFee ?? 0) > 0) + ₱{{ number_format($reconnectionFee, 2) }} reconnection fee @endif

@csrf
@else

Access Denied

Only Super Admin and Company Admin users can access the Disconnection Management system.

Back to Dashboard
@endif @endsection