@extends('layouts.admin') @section('title', __('Financial dashboard')) @section('content')

๐Ÿ“Š {{ __('Financial dashboard') }}

@if($pendingProofs > 0)
๐Ÿงพ {{ __(':n payment proof(s) awaiting your review.', ['n' => $pendingProofs]) }} {{ __('Review now') }}
@endif {{-- KPI row --}}
{{ __('Monthly recurring revenue') }}
{{ number_format($mrr) }} IQD
{{ __('Annual run-rate') }}
{{ number_format($arr) }} IQD
{{ __('Active subscriptions') }}
{{ $counts['active'] }}
{{ __('Monthly churn') }}
{{ $churn }}%
{{-- Subscription status counts --}}
@foreach([ [__('Trialing'), $counts['trialing'], '#0EA5E9'], [__('Active'), $counts['active'], '#22C55E'], [__('Grace'), $counts['grace'], '#F5A524'], [__('Suspended'), $counts['suspended'], '#EF4444'], [__('Cancelled'), $counts['cancelled'], '#94A3B8'], [__('Expiring (7d)'), $expiringCount, '#EC4899'], [__('Trial โ†’ paid'), $conversion.'%', '#8B5CF6'], ] as $c)
{{ $c[0] }}
{{ $c[1] }}
@endforeach

{{ __('Revenue โ€” last 6 months') }} (IQD, {{ __('approx') }})

{{ __('MRR by gateway') }}

@forelse($mrrByGateway as $g)
{{ \App\Enums\SubscriptionGateway::from($g->gateway ?? 'paddle')->label() }} ({{ $g->count }}) {{ number_format($g->total) }} IQD
@empty

{{ __('No active paid subscriptions yet.') }}

@endforelse

{{ __('Revenue by payment method') }}

@forelse($revenueByMethod as $m)
{{ \App\Enums\SubscriptionGateway::from($m['gateway'] ?? 'paddle')->label() }} ({{ $m['count'] }}) {{ number_format($m['total_iqd']) }} IQD
@empty

{{ __('No approved payments yet.') }}

@endforelse

{{ __('Trial conversion') }}

๐ŸŸข {{ __('Trials started') }}{{ $trialFunnel['started'] }}
๐Ÿ’ฐ {{ __('Converted') }}{{ $trialFunnel['converted'] }}
โŒ› {{ __('Expired without converting') }}{{ $trialFunnel['expired'] }}

{{ __('Conversion rate') }}{{ $trialFunnel['rate'] }}%

โฐ {{ __('Expiring within 7 days') }}

@forelse($expiringClinics as $sub) @empty @endforelse
{{ __('Clinic') }}{{ __('Status') }}{{ __('Expires') }}
{{ $sub->tenant?->name }} {{ __(ucfirst($sub->status)) }} {{ $sub->current_period_ends_at->format('d M Y') }} ({{ $sub->current_period_ends_at->diffForHumans() }})
{{ __('No clinics expiring this week.') }}

{{ __('Recent clinics') }}

@foreach($recentClinics as $clinic) @endforeach
{{ __('Clinic') }}{{ __('Status') }}{{ __('Joined') }}
{{ $clinic->name }} @if($clinic->is_demo){{ __('Demo') }}@endif
{{ $clinic->slug }}
{{ __(ucfirst($clinic->subscription?->status ?? 'n/a')) }} {{ $clinic->created_at->format('d M Y') }}
@push('page-scripts') @endpush @endsection