@extends('layouts.app') @section('title', 'Client Details') @section('content')

{{ $client->name }}

Account: {{ $client->account_number }}
Edit @if(Auth::user()->hasCompanyAdminAccess() || Auth::user()->isSuperAdmin())
@csrf @method('DELETE')
@endif
Status

{{ ucfirst($client->status) }}

Outstanding Balance

₱{{ number_format($client->outstanding_balance, 2) }}

Member Since

@if($client->registered_at) @if($client->registered_at instanceof \DateTime) {{ $client->registered_at->format('M d, Y') }} @else {{ \Carbon\Carbon::parse($client->registered_at)->format('M d, Y') }} @endif @else N/A @endif

Contact Information
Email

{{ $client->email ?? 'Not provided' }}

Phone

{{ $client->phone ?? 'Not provided' }}

Address

{{ $client->full_address ?: 'Not provided' }}

Location
Barangay

{{ $client->barangay ?? 'Not provided' }}

City / Municipality

{{ $client->city ?? 'Not provided' }}

Province

{{ $client->province ?? 'Not provided' }}

Zip Code

{{ $client->zip_code ?? 'Not provided' }}

Meter Information
Add Reading
Meter Number

{{ $client->meter_number ?? 'Not provided' }}

Recent Billings
@forelse($client->billings()->latest()->take(5)->get() as $billing) @empty @endforelse
Billing Number Date Amount Due Status Action
{{ $billing->billing_number }} {{ $billing->billing_date->format('M d, Y') }} ₱{{ number_format($billing->total_amount_due, 2) }} {{ ucfirst($billing->status) }} View
No billings yet
Overdue Billings
@php $overdueCount = $client->billings() ->where('status', '!=', 'paid') ->where('due_date', '<', now()) ->where('balance', '>', 0) ->count(); @endphp @if($overdueCount > 0) {{ $overdueCount }} @endif
@php $overdueBills = $client->billings() ->where('status', '!=', 'paid') ->where('due_date', '<', now()) ->where('balance', '>', 0) ->orderBy('due_date') ->get(); @endphp @forelse($overdueBills as $billing) @empty @endforelse
Billing # Due Date Days Overdue Amount Balance Disconnection Status Action
{{ $billing->billing_number }} {{ $billing->due_date->format('M d, Y') }} @php $daysOverdue = (int) abs($billing->due_date->diffInDays(now())); @endphp {{ $daysOverdue }} days ₱{{ number_format($billing->total_amount_due, 2) }} ₱{{ number_format($billing->balance, 2) }} @php $discStatus = $billing->disconnection_status ?? 'none'; @endphp {{ ucfirst(str_replace('_', ' ', $discStatus)) }} View
No overdue billings
Late Fees & Notices Charged
@php $latePaymentCount = \App\Models\BillingCharge::where('client_id', $client->id) ->lateFees()->where('status', '!=', 'voided')->count(); @endphp @if($latePaymentCount > 0) {{ $latePaymentCount }} @endif
@php // Fees and notices charged onto this client's billings — // amounts owed, not money received. $latePayments = \App\Models\BillingCharge::where('client_id', $client->id) ->with('billing') ->orderBy('created_at', 'desc') ->take(10) ->get(); @endphp @forelse($latePayments as $payment) @empty @endforelse
Date Billing # Charge Type Amount Status Notes
{{ $payment->created_at->format('M d, Y') }} {{ $payment->billing?->billing_number ?? 'N/A' }} {{ ucfirst(str_replace('_', ' ', $payment->type)) }} ₱{{ number_format($payment->amount, 2) }} {{ ucfirst($payment->status) }} {{ $payment->notes ?? '-' }}
No late fees or notices charged
Meter Readings
@forelse($client->meterReadings()->latest('reading_date')->take(5)->get() as $reading) @empty @endforelse
Reading Date Value Units Consumed Status Action
{{ $reading->reading_date->format('M d, Y') }} {{ $reading->reading_value }} cu.m {{ $reading->units_consumed ?? '—' }} cu.m {{ ucfirst($reading->status) }} View
No meter readings yet
Recent Payments (Statement of Account)
@forelse($client->payments()->latest()->take(10)->get() as $payment) @empty @endforelse
Reference Date Amount Type Method Status
{{ $payment->reference_number ?? '—' }} {{ $payment->payment_date->format('M d, Y') }} ₱{{ number_format($payment->amount, 2) }} @php $typeLabels = [ 'billing' => 'Billing', 'installation' => 'Installation', 'reconnection' => 'Reconnection', 'late_fee' => 'Late Fee', 'deposit' => 'Deposit', 'other' => 'Other' ]; $typeColors = [ 'billing' => 'primary', 'installation' => 'success', 'reconnection' => 'warning', 'late_fee' => 'danger', 'deposit' => 'info', 'other' => 'secondary' ]; $paymentType = $payment->payment_type ?? 'billing'; $label = $typeLabels[$paymentType] ?? ucfirst(str_replace('_', ' ', $paymentType)); $color = $typeColors[$paymentType] ?? 'secondary'; @endphp {{ $label }} {{ ucfirst(str_replace('_', ' ', $payment->payment_method)) }} {{ ucfirst($payment->status) }}
No payments recorded yet
@endsection