{{ __('Admin') }} {{ __('Analytics') }}
{{ __('CMD K') }}
{{ __('Admin - Platform') }}

{{ __('Admin') }} {{ __('analytics') }}.

{{ __('A complete control-room view of revenue, workspace growth, WhatsApp usage, campaign delivery, device health, and support pressure.') }}

{{-- Date-range select wired via JS to a ?days=N query. Mirrors the original prototype dropdown but each option carries the days value. --}} {{-- "Filters" removed — the days dropdown above already filters the analytics window. --}} Export
refreshed just now
{{-- KPI 1: Revenue in window (was MRR placeholder) --}}
Revenue · {{ $days }}d
{{ __('paid') }}
{!! $kpi['revenue_window'] !== null ? \App\Support\FormatSettings::currency((float) $kpi['revenue_window']) : '—' !!}
{{ $kpi['workspaces_new'] }} {{ __('new workspaces') }}
{{-- KPI 2: Active workspaces --}}
{{ __('Workspaces') }}
+{{ $kpi['workspaces_new'] }}
{{ number_format($kpi['workspaces_total']) }}
{{ number_format($kpi['users_total']) }} {{ __('total users') }}
{{-- KPI 3: Messages --}}
{{ __('Messages') }}
{{ $days }}d
{{ $kpi['messages_sent'] === null ? '—' : number_format($kpi['messages_sent']) }}
{{ $kpi['messages_sent'] && $days ? number_format($kpi['messages_sent'] / $days) . ' / day avg' : '' }}
{{-- KPI 4: Devices online --}}
{{ __('Devices online') }}
{{ $kpi['devices_total'] ? round(($kpi['devices_online'] / max(1, $kpi['devices_total'])) * 100) . '%' : '—' }}
{{ number_format($kpi['devices_online']) }}/{{ number_format($kpi['devices_total']) }}
{{ __('connected now') }}
{{-- KPI 5: Users new --}}
New users · {{ $days }}d
{{ __('signups') }}
{{ number_format($kpi['users_new']) }}
{{ number_format($kpi['users_total']) }} {{ __('total') }}
{{-- KPI 6: Open tickets --}}
{{ __('Open tickets') }}
{{ $kpi['tickets_open'] > 0 ? 'watch' : 'clear' }}
{{ number_format($kpi['tickets_open']) }}
{{ __('support backlog') }}
{{ __('Growth command center') }}

User signups, last {{ $days }} days

Signups
{{ __('Live health') }}

{{ __('Platform pulse') }}

normal
{{ __('Workspaces online') }}{{ $kpi['workspaces_total'] }}
{{ __('Devices connected') }}{{ $kpi['devices_total'] ? round(($kpi['devices_online'] / max(1, $kpi['devices_total'])) * 100) : 0 }}%
{{ __('Open tickets') }}{{ $kpi['tickets_open'] }}
New signups · {{ $days }}d{{ $kpi['users_new'] }}
{{ __('Plan distribution') }}

{{ __('Workspaces by plan') }}

{{ __('live') }}
@php $planSum = max(1, (int) $planDistribution->sum('n')); $planColors = ['#075E54', '#128C7E', '#13478A', '#E5A04E', '#E87A5D']; @endphp @foreach ($planDistribution->take(5) as $i => $p)
{{ $p->plan }}{{ round(($p->n / $planSum) * 100) }}%
@endforeach
{{ __('Acquisition') }}

{{ __('Users → Workspace') }}

@php $usersCount = max(0, (int) $kpi['users_total']); $usersNew = max(0, (int) $kpi['users_new']); $wsCount = max(0, (int) $kpi['workspaces_total']); $wsNew = max(0, (int) $kpi['workspaces_new']); $denomA = max(1, $usersCount); $denomB = max(1, $usersNew); $denomC = max(1, $wsNew); @endphp
{{ __('Total users') }}{{ number_format($usersCount) }}
New users · {{ $days }}d{{ number_format($usersNew) }} · {{ round(($usersNew / $denomA) * 100, 1) }}%
{{ __('Workspaces created') }}{{ number_format($wsCount) }}
New workspaces · {{ $days }}d{{ number_format($wsNew) }} · {{ round(($wsNew / max(1, $usersNew)) * 100, 1) }}% of new users
{{ __('Devices connected') }}{{ number_format($kpi['devices_online']) }} / {{ number_format($kpi['devices_total']) }}
{{ number_format($kpi['users_new']) }}
new users · {{ $days }}d
{{ number_format($kpi['workspaces_new']) }}
new workspaces · {{ $days }}d
{{ __('Top devices · 24h') }}

{{ __('Send volume') }}

{{ __('Workspaces') }}
{{ $devicesTotalCount }}
{{ __('devices') }}
{{ $devicesOnlineCount }}
{{ __('online') }}
{{ number_format(array_sum($deviceData)) }}
{{ __('24h sends') }}
{{ __('Workspace leaderboard') }}

Top workspaces by paid revenue · last {{ $days }}d

{{ __('View all') }}
@forelse ($topWorkspaces as $w) @empty @endforelse
{{ __('Workspace') }} {{ __('Orders') }} {{ __('Paid revenue') }}
{{ $w->name }}
{{ number_format($w->n) }} {!! \App\Support\FormatSettings::currency((float) $w->paid) !!} {{ __('Open →') }}
{{ __('No paid orders in this window.') }}
{{ __('Signup cohorts') }}

Recent {{ $days }} days

{{ __('daily') }}
{{ __('Revenue composition') }}

Top contributors · {{ $days }}d

@php $revSum = max(1, (float) $topWorkspaces->sum('paid')); @endphp @forelse ($topWorkspaces->take(5) as $w)
{{ $w->name }}{!! \App\Support\FormatSettings::currency((float) $w->paid) !!} · {{ round(($w->paid / $revSum) * 100) }}%
@empty
{{ __('No paid revenue yet.') }}
@endforelse
{{ __('Support load') }}

{{ __('Tickets state') }}

@php try { $ticketStates = \DB::table('support_tickets') ->select('status', \DB::raw('COUNT(*) as n')) ->groupBy('status') ->get(); $maxState = max(1, (int) $ticketStates->max('n')); } catch (\Throwable $e) { $ticketStates = collect(); $maxState = 1; } @endphp
@forelse ($ticketStates as $s)
{{ str_replace('_', ' ', $s->status) }}{{ $s->n }}
@empty
{{ __('No tickets yet.') }}
@endforelse
{{ $kpi['tickets_open'] }}
{{ __('open') }}
{{ (int) ($ticketStates->where('status', 'resolved')->first()->n ?? 0) }}
{{ __('resolved') }}
{{ __('inbox') }}
{{ __('Admin attention') }}

{{ __('Action queue') }}

{{ $kpi['tickets_open'] }} {{ __('open') }}
@if ($kpi['tickets_open'] > 0)
{{ $kpi['tickets_open'] }} open support ticket(s)
{{ __('urgent') }}
{{ __('Triage at /admin/support before SLA breach.') }}
@endif @if ($kpi['devices_total'] > 0 && $kpi['devices_online'] / max(1, $kpi['devices_total']) < 0.5)
{{ $kpi['devices_total'] - $kpi['devices_online'] }} {{ __('devices offline') }}
{{ __('watch') }}
{{ __('Customers may not be receiving messages.') }}
@endif @if ($kpi['users_new'] > 0)
{{ $kpi['users_new'] }} new user(s) this window
{{ __('queue') }}
{{ __('Review at /admin/users — check KYC if required.') }}
@endif @if ($kpi['tickets_open'] === 0 && $kpi['users_new'] === 0)
{{ __('All clear') }}
{{ __('normal') }}
{{ __('No open tickets and no pending reviews.') }}
@endif
{{-- Charts wired by resources/js/charts/admin-analytics-index.js (auto-loaded via the page="admin-analytics-index" key in app.js). --}}