{{ __('Dashboard') }} {{-- Modern Stat Cards Row --}}
{{ __('Active PPPoE Users') }}

{{ $customersData['active'] ?? 0 }} / {{ $customersData['total'] ?? 0 }}

{{ $customersData['recent'] ?? 0 }} {{ __('New this month') }} {{ __('Inactive') }}
{{ __("Today's PPPoE Sales") }}

৳{{ number_format($billInformationData['today_paid_amount'] ?? 0, 0) }}

{{ __('Total Mo:') }} ৳{{ number_format($billInformationData['paid_amount'] ?? 0, 0) }} {{ __('PPPoE Only') }}
{{ __("Today's Hotspot Sales") }}

৳{{ number_format($billInformationData['hotspot_today'] ?? 0, 0) }}

{{ __('Total Mo:') }} ৳{{ number_format($billInformationData['hotspot_total'] ?? 0, 0) }} {{ __('Hotspot Only') }}
{{ __('Total Global Revenue') }}

৳{{ number_format(($billInformationData['paid_amount'] ?? 0) + ($billInformationData['hotspot_total'] ?? 0), 0) }}

{{ __('Pending Due:') }} ৳{{ number_format($billInformationData['due_amount'] ?? 0, 0) }} {{ __('Total Arrears') }}
{{-- Reseller Overview Stat Cards Row --}}
{{ __('Total Resellers') }}

{{ $resellerData['total_resellers'] ?? 0 }}

{{ __('Active:') }} {{ $resellerData['active_resellers'] ?? 0 }} {{ __('Suspended:') }} {{ $resellerData['suspended_resellers'] ?? 0 }}
{{ __('Reseller Customers') }}

{{ $resellerData['total_customers'] ?? 0 }}

{{ __('Active:') }} {{ $resellerData['active_customers'] ?? 0 }} {{ __('Pending:') }} {{ $resellerData['pending_customers'] ?? 0 }}
{{ __('Wallet Balances') }}

৳{{ number_format($resellerData['total_balance'] ?? 0, 2) }}

{{ __('Cumulative reseller wallet balance.') }}
{{ __('Total Commissions') }}

৳{{ number_format($resellerData['total_commission'] ?? 0, 2) }}

{{ __('Total reseller commission awarded.') }}
{{-- 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