@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
@forelse($overdueData ?? [] as $billing) @empty @endforelse
Billing ID Amount Balance Days Overdue Late Fees Due Date Status
#{{ $billing->id ?? 'N/A' }} ₱{{ number_format($billing->amount ?? 0, 2) }} ₱{{ number_format($billing->balance ?? 0, 2) }} {{ $billing->getDaysOverdue() ?? 0 }} days ₱{{ number_format($billing->penalties ?? 0, 2) }} {{ $billing->due_date ? $billing->due_date->format('M d, Y') : 'N/A' }} @php $status = $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 overdue billings found.
@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: ₱{{ 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
₱{{ number_format(($lateFeesSummary['total_overdue_balance'] ?? 0) + ($reconnectionFee ?? 0), 2) }}
@csrf
@else

Access Denied

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

Back to Dashboard
@endif @endsection