@php $current = $this->current; $stats = $this->stats; $live = $this->liveConnection; $label = $current?->username ?: $handle; $initials = strtoupper(mb_substr(preg_replace('/[^A-Za-z0-9]/', '', $label) ?: '?', 0, 2)); $hue = crc32($handle) % 360; $counts = [ 'sessions' => $this->connections->count(), 'payments' => $this->sessions->where('amount', '>', 0)->count(), 'packages' => $this->sessions->whereNotNull('package_id')->count(), 'sms' => $this->messages->count(), 'tickets' => $this->tickets->count(), 'devices' => $this->devices->count(), 'notes' => $this->notes->count(), ]; @endphp
{{-- ── Header ─────────────────────────────────────────────────── --}}
{{ __('Subscribers') }} #{{ $current?->id }}
{{ $initials }}
@{{ $current?->username ?: $handle }} @if ($stats['is_live']) {{ __('Online') }} @if ($stats['live_since']) · {{ $stats['live_since']->diffForHumans(null, true, true) }} @endif @elseif ($stats['blocked']) {{ __('Blocked') }} @elseif ($stats['paused']) {{ __('Paused') }} @endif @if ($current?->router) {{ $current->router->router_name }} @endif {{ bytes_human($stats['bytes_month']) }} {{ __('this month') }} {{ __('Hotspot') }} @if ($current?->package) {{-- Clickable: the plan is the thing an operator most often needs to check while looking at somebody, and sending them to the Plans page to find it loses their place. --}} @endif
@if ($current?->phone) {{ $current->phone }} @endif @if ($stats['first_seen']) {{ __('Member since :when', ['when' => $stats['first_seen']->format('M j, Y')]) }} @endif
{{-- ── Actions ────────────────────────────────────────────── --}}
@if ($flash)
{{ $flash }}
@endif @include('livewire.subscribers.partials.panels') {{-- ── Summary cards ──────────────────────────────────────────── --}}
{{ __('Subscription') }} @if ($stats['expires_at']?->isFuture()) {{ $stats['expires_at']->diffForHumans(null, true, true) }} @else {{ __('Expired') }} @endif {{ $stats['expires_at'] ? __('expires :when', ['when' => $stats['expires_at']->format('M j, Y, g:i A')]) : __('no active package') }}
{{ __('Last session') }} {{ $stats['is_live'] ? __('Online') : ($stats['last_seen'] ? $stats['last_seen']->diffForHumans(null, true) : __('Never')) }} @if ($stats['is_live'] && $stats['live_since']) {{ __('Live · :for', ['for' => $stats['live_since']->diffForHumans(null, true, true)]) }} @elseif ($stats['last_seen']) {{ $stats['last_seen']->format('M j, g:i A') }} @else {{ __('has never connected') }} @endif
{{ __('Lifetime value') }} {{ money($stats['spent'], 0) }} @if ($stats['spent_month'] > 0) @endif {{ money($stats['spent_month'], 0) }} {{ __('this month') }}
{{ __('Data used') }} {{ bytes_human($stats['bytes_month']) }} {{ bytes_human($stats['bytes_total']) }} {{ __('all time') }}
{{-- ── Tabs ───────────────────────────────────────────────────── --}}
@foreach ([ 'overview' => __('Overview'), 'reports' => __('Reports'), 'sessions' => __('Sessions'), 'payments' => __('Payments'), 'packages' => __('Package history'), 'sms' => __('SMS'), 'tickets' => __('Tickets'), 'devices' => __('Devices'), 'notes' => __('Notes'), ] as $key => $title) @endforeach
@include('livewire.subscribers.tabs.'.$tab)