{{ __('Dashboard') }} {{-- ══ Operational pulse ═══════════════════════════════════════════════ Totals sit further down the page. This band answers the only question that matters when you open the dashboard: is anything wrong right now, and what came in today. ═══════════════════════════════════════════════════════════════════════ --}} @php $hour = now()->hour; $greeting = $hour < 12 ? __('Good morning') : ($hour < 17 ? __('Good afternoon') : __('Good evening')); $shift = $hour < 12 ? __('Morning shift') : ($hour < 17 ? __('Midday shift') : __('Evening shift')); $onlinePct = ($pulse['total_subscriptions'] ?? 0) > 0 ? round(($pulse['active_subscriptions'] / $pulse['total_subscriptions']) * 100) : 0; @endphp
{{ $shift }}

{{ $greeting }}, {{ siteUrlSettings('site_name') ?? config('app.name') }}.

@if (count($pulse['actions'])) {{ __('A few things need a minute.') }} @else {{ __('Nothing needs your attention right now.') }} @endif

{{ $pulse['routers_healthy'] }}/{{ $pulse['routers_total'] }} {{ __('routers healthy') }} @if ($pulse['expiring_24h'] > 0) {{ $pulse['expiring_24h'] }} {{ __('expiries due in 24h') }} @endif {{ $pulse['active_subscriptions'] }} {{ __('active right now') }}
{{-- ══ Live payments ticker ════════════════════════════════════════════ One payment at a time, cycling. A list of ten receipts is wallpaper; a single line that changes is something an operator actually notices from across the room. ═══════════════════════════════════════════════════════════════════════ --}}
{{ __('Live') }}
{{-- Keyed on the index so Alpine replays the transition on every change rather than only the first. --}}
{{ $pulse['routers_healthy'] }}/{{ $pulse['routers_total'] }} {{ __('routers healthy') }}
{{-- Headline numbers --}}
@if (!is_null($pulse['revenue_delta']))
{{ __('vs yesterday') }} {{ $pulse['revenue_delta'] >= 0 ? '+' : '' }}{{ $pulse['revenue_delta'] }}%
@endif
{{-- What needs a decision --}}
{{ __('What needs attention') }}
@if (count($pulse['actions'])) {{ count($pulse['actions']) }} {{ __('urgent') }} @endif
@forelse ($pulse['actions'] as $action) {{ $action['title'] }} {{ $action['hint'] }} @empty

{{ __('All clear — nothing needs a decision.') }}

@endforelse
{{-- Money in, today --}}
{{ __('Today') }}
{{ count($pulse['activity']) }} {{ __('payments since midnight') }}
@forelse ($pulse['activity'] as $event)
{{ money($event->collection_amount, 0) }} {{ __('from') }} {{ $event->customer_collection_unique_id }} {{ $event->payment_method ? strtoupper($event->payment_method) : '' }} · {{ \Carbon\Carbon::parse($event->collection_date)->diffForHumans(null, null, true) }} {{ __('ago') }}
@empty

{{ __('No payments recorded yet today.') }}

@endforelse
{{-- Renewals due --}} @if (count($pulse['renewals']))
{{ __('Renewals due') }}
{{ __('Next 48 hours') }} · {{ count($pulse['renewals']) }} {{ __('subscribers') }}
@foreach ($pulse['renewals'] as $r) @php $expires = \Carbon\Carbon::parse($r->auto_disable_date); @endphp @endforeach
{{ __('Subscriber') }} {{ __('Mobile') }} {{ __('Due') }} {{ __('Expires') }}
{{ $r->customer_name ?: $r->customer_unique_id }} {{ $r->customer_unique_id }} {{ $r->mobile }} {{ money($r->due_amount, 0) }} {{ $expires->diffForHumans() }}
@endif {{-- Network & revenue --}}

{{ __('Network & revenue') }}

{{-- Tenants. Platform-wide figures: how many sellers there are, what they collectively hold. Meaningless on a seller's own dashboard, and it would show them the size of the platform and of their competitors, so it is not merely hidden — it is not rendered at all. --}} @if (auth()->user()?->hasRole('Super Admin') && ! auth()->user()?->reseller)

{{ __('Tenants') }}

@endif
{{-- Unified Row for Routers and Graphs to allow dynamic "weight" adjustment --}} @foreach ($systemOverview as $routerName => $routerData) @php if (! ($routerData['status'] ?? false)) { continue; } $info = $routerData['data'][0] ?? $routerData['data'] ?? []; $cpuLoad = (int) filter_var($info['cpu-load'] ?? 0, FILTER_SANITIZE_NUMBER_INT); $cpuColor = $cpuLoad > 80 ? 'bg-danger' : ($cpuLoad > 50 ? 'bg-warning' : 'bg-success'); // Memory Math $memTotal = (int)($info['total-memory'] ?? 1); $memFree = (int)($info['free-memory'] ?? 0); $memUsed = $memTotal - $memFree; $memPct = $memTotal > 0 ? round(($memUsed / $memTotal) * 100) : 0; // HDD Math $hddTotal = (int)($info['total-hdd-space'] ?? 1); $hddFree = (int)($info['free-hdd-space'] ?? 0); $hddUsed = $hddTotal - $hddFree; $hddPct = $hddTotal > 0 ? round(($hddUsed / $hddTotal) * 100) : 0; $cardId = 'router_' . \Illuminate\Support\Str::slug($routerName); if (!function_exists('formatRouterBytesLg')) { function formatRouterBytesLg($bytes) { if ($bytes == 0) return '0 B'; $k = 1024; $sizes = ['B', 'KiB', 'MiB', 'GiB', 'TiB']; $i = floor(log($bytes) / log($k)); return round($bytes / pow($k, $i), 2) . ' ' . $sizes[$i]; } } @endphp
{{-- Refined Router Card with Full Details --}}
{{ $info['board-name'] ?? $routerName }}
{{ strtoupper($info['platform'] ?? 'N/A') }} · {{ $info['architecture-name'] ?? 'N/A' }} · {{ __(':type Connection', ['type' => $routerData['type'] ?? 'N/A']) }}
{{ __('Uptime') }} {{ str_replace(['w', 'd', 'h', 'm', 's'], ['w ', 'd ', 'h ', 'm ', 's '], $info['uptime'] ?? 'N/A') }}
{{ __('Version') }} {{ $info['version'] ?? 'N/A' }}
{{ __('CPU Usage') }} {{ ($info['cpu-count'] ?? '?') . ' × ' . ($info['cpu-frequency'] ?? '?') }} MHz({{ $cpuLoad }}%)
{{ __('Memory Usage') }} {{ formatRouterBytesLg($memUsed) }} / {{ formatRouterBytesLg($memTotal) }} ({{ $memPct }}%)
{{ __('Storage Usage') }} {{ formatRouterBytesLg($hddUsed) }} / {{ formatRouterBytesLg($hddTotal) }} ({{ $hddPct }}%)
{{-- Part 1: Platform & Architecture --}}

{{ __('Board Name') }}{{ $info['board-name'] ?? 'N/A' }}
{{ __('Platform') }}{{ $info['platform'] ?? 'N/A' }}
{{ __('Architecture') }}{{ $info['architecture-name'] ?? 'N/A' }}
{{-- Part 2: System & Software --}}

{{ __('OS Version') }}{{ $info['version'] ?? 'N/A' }}
{{ __('Factory OS') }}{{ $info['factory-software'] ?? 'N/A' }}
{{ __('Build Timestamp') }}{{ $info['build-time'] ?? 'N/A' }}
{{ __('Uptime') }}{{ $info['uptime'] ?? 'N/A' }}
{{-- Part 3: Hardware Information --}}

{{ __('CPU') }}{{ $info['cpu'] ?? 'N/A' }}
{{ __('CPU count/freq/load') }}{{ ($info['cpu-count'] ?? '?') }} / {{ ($info['cpu-frequency'] ?? '?') }} / {{ $info['cpu-load'] ?? '0' }}%
{{ __('Hdd') }}{{ formatRouterBytesLg($hddUsed) }} / {{ formatRouterBytesLg($hddTotal) }}
{{ __('Write Total') }}{{ $info['write-sect-total'] ?? '0' }}
{{ __('Write Since Reboot') }}{{ $info['write-sect-since-reboot'] ?? '0' }}
{{ __('Temp / Voltage') }}{{ isset($info['temperature']) ? $info['temperature'].'°C' : 'N/A' }} | {{ isset($info['voltage']) ? $info['voltage'].'V' : 'N/A' }}
@endforeach {{-- Analytical Graphs Section --}}
{{ __('Customer Segmentation') }}
{{-- Billing Overview: full-width, two-panel --}}
{{ __('Billing Overview') }}
{{ __('Active') }} {{ __('Free') }} {{ __('Inactive') }} {{ __('Pending') }}
{{-- LEFT: Global Summary Chart (all 8 metrics) --}}

{{ __('Global Summary') }}

{{-- RIGHT: Per-Status Grouped Chart + Mini-tiles --}}

{{ __('By Status') }}

{{-- Summary mini-tiles --}}
@php $tileConfig = [ 'active' => ['color'=>'#16a34a','bg'=>'rgba(34,197,94,0.08)','icon'=>'bi-check-circle-fill'], 'free' => ['color'=>'#4f46e5','bg'=>'rgba(99,102,241,0.08)','icon'=>'bi-gift-fill'], 'inactive' => ['color'=>'#dc2626','bg'=>'rgba(239,68,68,0.08)','icon'=>'bi-x-circle-fill'], 'pending' => ['color'=>'#ea580c','bg'=>'rgba(251,146,60,0.08)','icon'=>'bi-hourglass-split'], ]; @endphp @foreach(['active','free','inactive','pending'] as $st) @php $tc = $tileConfig[$st]; $bd = $billInformationData['by_status'][$st]; @endphp
{{ __($st) }}
{{ __('Rent:') }} {{ number_format($bd['monthly_rent'],0) }}
{{ __('Adv:') }} {{ number_format($bd['advance'],0) }}
{{ __('Due:') }} {{ number_format(abs($bd['due_amount']),0) }}
@endforeach
{{ __('Income & Revenue Overview') }}
@push('scripts') @endpush @push('styles') @endpush @push('scripts') @endpush