@extends('layouts.app') @section('title', 'Dashboard - Super Admin') @section('content')

Visão Executiva

Acompanhe a saúde do seu SaaS em tempo real

Total de Contas Ativas

{{ number_format($kpis['active_accounts'], 0, ',', '.') }}

Crescimento Mensal

{{ $kpis['monthly_growth'] >= 0 ? '+' : '' }}{{ number_format($kpis['monthly_growth'], 2, ',', '.') }}%

MRR (Receita Recorrente Mensal)

R$ {{ number_format($kpis['mrr'], 2, ',', '.') }}

ARR (Receita Recorrente Anual)

R$ {{ number_format($kpis['arr'], 2, ',', '.') }}

Churn Rate

{{ number_format($kpis['churn_rate'], 2, ',', '.') }}%

{{ $kpis['churn_rate'] <= 5 ? '✅ Saudável' : '⚠️ Atenção' }}

Ticket Médio

R$ {{ number_format($kpis['average_ticket'], 2, ',', '.') }}

LTV (Lifetime Value)

R$ {{ number_format($kpis['ltv'], 2, ',', '.') }}

CAC (Custo de Aquisição)

R$ {{ number_format($kpis['cac'], 2, ',', '.') }}

@php $ltv_cac_ratio = $kpis['cac'] > 0 ? $kpis['ltv'] / $kpis['cac'] : 0; @endphp

LTV/CAC: {{ number_format($ltv_cac_ratio, 1) }}x

Total de Pacientes

{{ number_format($kpis['total_patients'], 0, ',', '.') }}

Análises de IA (mês)

{{ number_format($kpis['monthly_ai_analyses'], 0, ',', '.') }}

Prescrições (mês)

{{ number_format($kpis['monthly_prescriptions'], 0, ',', '.') }}

@include('dashboard.partials.ai-dashboard', ['aiDashboard' => $aiDashboard ?? null])

📈 Receita recorrente (MRR)

🏢 Contas ativas acumuladas

🏆 Top 5 Clínicas por Pacientes

@forelse($charts['top_clinics'] as $clinic)

{{ $clinic['name'] }}

Plano: {{ $clinic['plan'] }}

{{ $clinic['patients'] }}

pacientes

@empty

Nenhuma clínica cadastrada

@endforelse

📊 Distribuição de Planos

@foreach($charts['plan_distribution'] as $plan)
{{ $plan['plan'] }} {{ $plan['count'] }}
@php $total = collect($charts['plan_distribution'])->sum('count'); $percentage = $total > 0 ? ($plan['count'] / $total) * 100 : 0; @endphp
@endforeach

⚡ Ações Rápidas

@php $chartConfigs = [ 'chart-mrr' => [ 'type' => 'line', 'data' => [ 'labels' => collect($charts['monthly_revenue'])->pluck('month'), 'datasets' => [[ 'label' => 'MRR (R$)', 'data' => collect($charts['monthly_revenue'])->pluck('revenue'), 'borderColor' => '#6366f1', 'backgroundColor' => 'rgba(99, 102, 241, 0.1)', 'fill' => true, 'tension' => 0.3, ]], ], ], 'chart-accounts' => [ 'type' => 'bar', 'data' => [ 'labels' => collect($charts['accounts_growth'])->pluck('month'), 'datasets' => [[ 'label' => 'Contas', 'data' => collect($charts['accounts_growth'])->pluck('accounts'), 'backgroundColor' => '#10b981', ]], ], ], ]; @endphp @include('super-admin.partials.charts-script', ['chartConfigs' => $chartConfigs]) @endsection