@if(!$customer)

Customer Profile Not Found

Your PPPoE account is active, but it is not linked to a customer profile. Please contact support to complete your profile.

@elseif(!$billing)

Billing Record Not Found

We couldn't locate your billing records. Please contact support to set up your billing profile.

@else @php $dueAmount = (float)($billing->due_amount ?? 0); $totalAmount = (float)($billing->total_amount ?? 0); $paidAmount = (float)($billing->paid_amount ?? 0); $statusActive = ($customer->status ?? '') === 'active'; @endphp {{-- Header Banner --}}

Account: {{ $customer->customer_unique_id ?? 'N/A' }}

Billing Details

Current billing cycle breakdown for {{ $customer->customer_name ?? $pppUser->username }}

{{-- 3-Column Summary Cards --}}
Outstanding Due Ksh {{ number_format($dueAmount, 2) }} @if($dueAmount > 0) Please pay to avoid disconnection @else No outstanding dues ✓ @endif
Monthly Rent Ksh {{ number_format($billing->monthly_rent ?? 0, 2) }} {{ $customer->pppUser?->profile ?? 'N/A' }}
Account Expiry {{ $billing->auto_disable_date ? \Carbon\Carbon::parse($billing->auto_disable_date)->format('d M, Y') : 'N/A' }} {{ $billing->auto_disable_date ? 'Month: '.\Carbon\Carbon::parse($billing->auto_disable_date)->format('F Y') : '' }}
{{-- Main Grid --}}
{{-- Detailed Billing Table --}}

Charge Breakdown

@php $rows = [ ['label' => 'Monthly Rent', 'value' => $billing->monthly_rent ?? 0, 'type' => 'charge'], ['label' => 'Additional Charge', 'value' => $billing->additional_charge ?? 0, 'type' => 'charge'], ['label' => 'VAT', 'value' => $billing->vat ?? 0, 'type' => 'charge'], ['label' => 'Previous Due', 'value' => $billing->previous_due ?? 0, 'type' => 'due'], ['label' => 'Discount', 'value' => $billing->discount ?? 0, 'type' => 'credit'], ['label' => 'Advance', 'value' => $billing->advance ?? 0, 'type' => 'credit'], ['label' => 'Paid Amount', 'value' => $billing->paid_amount ?? 0, 'type' => 'credit'], ]; @endphp @foreach($rows as $row)
{{ $row['label'] }} {{ $row['type'] === 'credit' ? '-' : '+' }} Ksh {{ number_format($row['value'], 2) }}
@endforeach
Total Outstanding Due Ksh {{ number_format($dueAmount, 2) }}
{{-- Account & Payment Info --}}
{{-- Account Info --}}

Account Info

@php $acctRows = [ ['label' => 'Account No', 'value' => $customer->customer_unique_id ?? 'N/A'], ['label' => 'PPPoE Username', 'value' => $pppUser->username ?? 'N/A'], ['label' => 'Package', 'value' => $customer->pppUser?->profile ?? ($customer->package?->package ?? 'N/A')], ['label' => 'Billing Type', 'value' => ucfirst($billing->billing_type ?? 'Prepaid')], ['label' => 'Auto Disable', 'value' => $billing->auto_disable ? 'Yes' : 'No'], ['label' => 'Disable Month', 'value' => $billing->auto_disable_month ?? 'N/A'], ]; @endphp @foreach($acctRows as $row)
{{ $row['label'] }} {{ $row['value'] }}
@endforeach
{{-- Last Payment --}} @if($lastPayment)

Last Payment

@php $lastRows = [ ['label' => 'Amount', 'value' => 'Ksh '.number_format($lastPayment->collection_amount, 2)], ['label' => 'Date', 'value' => $lastPayment->collection_date ? \Carbon\Carbon::parse($lastPayment->collection_date)->format('d M, Y') : '—'], ['label' => 'Method', 'value' => ucfirst($lastPayment->payment_method ?? '—')], ['label' => 'Transaction', 'value' => $lastPayment->transaction_id ?? '—'], ['label' => 'Invoice No', 'value' => $lastPayment->invoice_no ?? '—'], ]; @endphp @foreach($lastRows as $row)
{{ $row['label'] }} {{ $row['value'] }}
@endforeach
@endif {{-- Pay Now CTA --}} @if($dueAmount > 0) Pay Ksh {{ number_format($dueAmount, 2) }} Now @endif
@endif