@if (session('status'))
{{ session('status') }}
@endif @if (session('error'))
{{ session('error') }}
@endif @php $displayInvoiceNumber = function ($invoice) { if ($invoice->whmcs_invoice_id) { return (string) $invoice->whmcs_invoice_id; } $digits = preg_replace('/\D+/', '', (string) $invoice->invoice_number); return $digits !== '' ? $digits : (string) $invoice->invoice_number; }; $displayMoney = function ($invoice) { $amount = number_format((float) $invoice->total, 2); return strtoupper((string) $invoice->currency) === 'USD' ? '$'.$amount.' USD' : strtoupper((string) $invoice->currency).' '.$amount; }; $invoiceStatusLabel = function ($status) { $key = strtolower(str_replace(' ', '_', trim((string) $status))); return [ 'payment_pending_whmcs' => 'Payment Processing', 'payment_received' => 'Payment Received', 'whmcs_sync_failed' => 'Processing', 'sync_failed' => 'Processing', 'manual_review' => 'Under Review', ][$key] ?? ucwords(str_replace('_', ' ', $key ?: 'pending')); }; $displayDate = function ($value, $fallback = null) { try { if ($value) { return \Illuminate\Support\Carbon::parse($value)->format('l, F jS, Y'); } } catch (\Throwable) { // Fall back below. } return $fallback ? $fallback->format('l, F jS, Y') : '-'; }; @endphp
Billing

My Invoices

View invoice history and pay any pending invoice securely.

@csrf
@forelse ($invoices as $invoice) @php $status = strtolower(str_replace(' ', '_', (string) $invoice->status)); $statusLabel = $invoiceStatusLabel($status); $canPay = $invoice->whmcs_invoice_id && ! in_array($status, ['paid', 'cancelled', 'refunded', 'payment_received', 'payment_pending_whmcs'], true); $invoiceDate = data_get($invoice->whmcs_payload, 'date') ?: data_get($invoice->whmcs_payload, 'datecreated') ?: data_get($invoice->whmcs_payload, 'created_at'); @endphp @empty @endforelse
Invoice # Invoice Date Due Date Total Status Action
{{ $displayInvoiceNumber($invoice) }} {{ $displayDate($invoiceDate, $invoice->created_at) }} {{ $displayDate($invoice->due_date) }} {{ $displayMoney($invoice) }} {{ $statusLabel }} @if ($canPay) Pay Now @else {{ $status === 'paid' ? 'Paid' : '-' }} @endif
No invoices yet.
{{ $invoices->links() }}