@extends('central.super.layout') @section('title', __('super.dashboard.title')) @push('styles') @endpush @php $statusLabels = ['active' => __('super.status.active'), 'trial' => __('super.status.trial'), 'cancelled' => __('super.status.cancelled'), 'suspended' => __('super.status.suspended')]; $statusColors = ['active' => '#10b981', 'trial' => '#3b82f6', 'cancelled' => '#ef4444', 'suspended' => '#f59e0b']; $subscriptionChartLabels = []; $subscriptionChartSeries = []; $subscriptionChartColors = []; foreach ($statusLabels as $key => $label) { $count = $subscriptionStatusCounts[$key] ?? 0; if ($count > 0 || $key === 'active' || $key === 'trial') { $subscriptionChartLabels[] = $label; $subscriptionChartSeries[] = (int) $count; $subscriptionChartColors[] = $statusColors[$key]; } } if (empty($subscriptionChartSeries)) { $subscriptionChartLabels = [__('central.NoData')]; $subscriptionChartSeries = [1]; $subscriptionChartColors = ['#e2e8f0']; } $tenantsChartCategories = array_keys($tenantsByMonth); $tenantsChartData = array_values($tenantsByMonth); $plansChartCategories = array_keys($subscriptionsByPlan); $plansChartData = array_values($subscriptionsByPlan); $hour = now()->hour; $greeting = $hour < 12 ? __('super.dashboard.good_morning') : ($hour < 18 ? __('super.dashboard.good_afternoon') : __('super.dashboard.good_evening')); $adminUser = auth()->guard('central')->user(); $envDbHost = config('database.connections.central.host', '127.0.0.1'); $envDbPort = config('database.connections.central.port', '3306'); $envDbUser = config('database.connections.central.username', ''); $envDbPass = config('database.connections.central.password', ''); @endphp @section('content') {{-- Dashboard Header --}}

{{ $greeting }}, {{ $adminUser->name ?? 'Admin' }}

{{ __('super.dashboard.welcome') }}

{{ now()->translatedFormat('l, M d, Y') }}
{{-- Key Metric Cards --}}
{{ $tenantsCount }}
{{ __('super.dashboard.total_tenants') }}
{{ $activeSubscriptions }}
{{ __('super.dashboard.active_trial') }}
{{ $plansCount }}
{{ __('super.dashboard.active_plans') }}
{{ array_sum($subscriptionStatusCounts ?? []) }}
{{ __('super.dashboard.total_subscriptions') }}
{{-- Health Alert Strip --}} @if($inactiveTenantsCount > 0 || $expiredSubscriptions > 0 || $suspendedTenantsCount > 0)
@if($inactiveTenantsCount > 0)
{{ $inactiveTenantsCount }} {{ __('super.dashboard.inactive_tenants') }}
{{ __('super.dashboard.inactive_tenants_desc') }}
{{ __('super.dashboard.view_inactive') }}
@endif @if($expiredSubscriptions > 0)
{{ $expiredSubscriptions }} {{ __('super.dashboard.expired_subs') }}
{{ __('super.dashboard.view_expired') }}
@endif @if($suspendedTenantsCount > 0)
{{ $suspendedTenantsCount }} {{ __('super.dashboard.suspended_tenants') }}
{{ __('super.dashboard.view_suspended') }}
@endif
@endif {{-- Pending Tenants --}} @if($pendingTenants->count() > 0)

{{ __('central.PendingTenants') }} {{ $pendingTenants->count() }}

@foreach($pendingTenants as $pt) {{-- Database configuration row (hidden by default) --}} @endforeach
{{ __('central.TenantName') }} {{ __('central.Subdomain') }} {{ __('central.Email') }} {{ __('central.RegistrationDate') }} {{ __('central.Actions') }}
{{ $pt->company_name ?? $pt->id }} {{ $pt->domains->first()->domain ?? '—' }} {{ $pt->admin_email ?? '—' }} {{ $pt->created_at->format('M d, Y H:i') }}
{{ __('central.DatabaseConfigFor', ['name' => $pt->company_name ?? $pt->id]) }}
@csrf {{-- Subdomain reminder (shared hosting only) --}} @if(\App\Models\Central\GeneralSetting::instance()->isSharedHosting()) @php $subdomainName = $pt->domains->first()->domain ?? null; @endphp @if($subdomainName)

{{ __('central.SubdomainSetupRequired') }}

{{ __('central.SubdomainSetupDesc') }}

{{ $subdomainName }}.{{ parse_url(config('app.url', 'http://localhost'), PHP_URL_HOST) ?? 'localhost' }}
@endif @endif
{{ __('central.DbNameHint', ['suggestion' => 'tenant_' . ($pt->domains->first()->domain ?? 'name')]) }}
{{-- Reject Modal --}} @endif {{-- Charts Row 1: Tenant Growth + Subscription Status --}}

{{ __('super.dashboard.tenants_chart') }}

{{ __('super.dashboard.last_6_months') }}

{{ __('super.dashboard.subscription_status') }}

{{-- Charts Row 2: Subs by Plan + Quick Actions --}}

{{ __('super.dashboard.subs_by_plan') }}

Top 5
@push('scripts') @endpush @endsection