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

💰 Controle Financeiro

Visão completa da saúde financeira do SaaS

Exportar CSV

MRR

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

Receita (Período)

R$ {{ number_format($financial['total_revenue_period'], 2, ',', '.') }}

Taxa de Conversão

{{ number_format($financial['conversion_rate'], 2, ',', '.') }}%

Trial → Pago

Inadimplentes

{{ $financial['delinquent_accounts'] }}

R$ {{ number_format($financial['delinquent_amount'], 2, ',', '.') }}

💳 Receita por Plano

@foreach($financial['revenue_by_plan'] as $plan)
{{ $plan['plan'] }} ({{ $plan['count'] }} contas)
R$ {{ number_format($plan['revenue'], 2, ',', '.') }}
@php $totalRevenue = collect($financial['revenue_by_plan'])->sum('revenue'); $percentage = $totalRevenue > 0 ? ($plan['revenue'] / $totalRevenue) * 100 : 0; @endphp
@endforeach

⭐ LTV por Plano

@forelse($financial['ltv_by_plan'] as $ltv)

{{ $ltv['plan'] }}

Lifetime médio: {{ $ltv['avg_lifetime_days'] }} dias

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

@empty

Sem dados suficientes

@endforelse

❌ Cancelamentos por Motivo

@if(count($financial['cancellations_by_reason']) > 0)
@foreach($financial['cancellations_by_reason'] as $cancellation)
{{ $cancellation['reason'] }} {{ $cancellation['count'] }}
@endforeach

Tempo médio até cancelamento: {{ $financial['avg_cancellation_time'] }} dias

@else

Nenhum cancelamento registrado

@endif

💳 Métodos de Pagamento

@if(count($financial['payment_methods']) > 0)
@foreach($financial['payment_methods'] as $method)

{{ $method['method'] }}

{{ $method['count'] }} transações

R$ {{ number_format($method['total'], 2, ',', '.') }}

@endforeach
@else

Nenhum pagamento registrado

@endif

🔄 Trial → Pago

Trial

{{ $financial['trial_to_paid_ratio']['trial'] }}

Pagos

{{ $financial['trial_to_paid_ratio']['paid'] }}

Total

{{ $financial['trial_to_paid_ratio']['total'] }}

📝 Últimos Pagamentos

@forelse($financial['recent_payments'] as $payment) @empty @endforelse
Clínica Valor Método Status Data
{{ $payment['clinic_name'] }} R$ {{ number_format($payment['amount'], 2, ',', '.') }} {{ $payment['payment_method'] }} {{ $payment['status'] }} {{ $payment['created_at'] }}
Nenhum pagamento registrado

🏆 Top Clínicas por Receita

💵 Receita recebida (12 meses)

📊 Receita MRR por plano

@php $chartConfigs = [ 'chart-revenue-trend' => [ 'type' => 'line', 'data' => [ 'labels' => collect($charts['revenue_trend'])->pluck('month'), 'datasets' => [[ 'label' => 'Receita (R$)', 'data' => collect($charts['revenue_trend'])->pluck('revenue'), 'borderColor' => '#059669', 'backgroundColor' => 'rgba(5, 150, 105, 0.1)', 'fill' => true, 'tension' => 0.3, ]], ], ], 'chart-plan-revenue' => [ 'type' => 'doughnut', 'data' => [ 'labels' => collect($charts['plan_revenue_distribution'])->pluck('plan'), 'datasets' => [[ 'data' => collect($charts['plan_revenue_distribution'])->pluck('revenue'), 'backgroundColor' => ['#6366f1', '#8b5cf6', '#ec4899', '#f59e0b'], ]], ], 'options' => ['plugins' => ['legend' => ['position' => 'bottom']]], ], ]; @endphp @include('super-admin.partials.charts-script', ['chartConfigs' => $chartConfigs]) @endsection