@extends('layouts.admin') @section('title', trans('admin.Dashboard')) @section('page-title', trans('admin.Overview')) @section('page-subtitle', trans('admin.platform snapshot')) @section('content')

{{ trans('admin.Welcome back') }}, {{ auth('user')->user()->name }} ๐Ÿ‘‹

{{ trans('admin.platform snapshot') }}

@if($period !== 'month') โœ• {{ trans('admin.Clear filter') }} @endif
@php $arrow = fn ($direction) => $direction === 'up' ? 'โ†‘' : 'โ†“'; $periodLabel = match($period) { 'quarter' => trans('admin.Last 3 months'), 'year' => trans('admin.This year'), 'custom' => \Carbon\Carbon::parse($periodFrom ?? now()->startOfMonth())->format('d M Y') . ' โ€“ ' . \Carbon\Carbon::parse($periodTo ?? now())->format('d M Y'), default => trans('admin.this month'), }; @endphp
@if($trend = $overview['revenue']['trend']) {{ $arrow($trend['direction']) }} {{ $trend['label'] }} @endif
{{ trans('admin.currency') }} {{ number_format($overview['revenue']['value']) }}
{{ trans('admin.Total revenue') }} ยท {{ $periodLabel }}
@if($trend = $overview['active_students']['trend']) {{ $arrow($trend['direction']) }} {{ $trend['label'] }} @endif
{{ number_format($overview['active_students']['value']) }}
{{ trans('admin.Active students') }}
@if($trend = $overview['published_courses']['trend']) {{ $arrow($trend['direction']) }} {{ $trend['label'] }} @endif
{{ $overview['published_courses']['value'] }}
{{ trans('admin.Published courses') }}
@if($trend = $overview['completion_rate']['trend']) {{ $arrow($trend['direction']) }} {{ $trend['label'] }} @endif
{{ $overview['completion_rate']['value'] !== null ? $overview['completion_rate']['value'].'%' : 'โ€”' }}
{{ trans('admin.Avg completion rate') }}

{{ trans('admin.New users') }}

{{ trans('admin.Last 6 months') }}
{{ trans('admin.Users') }}
@foreach($userGrowth as $point) {{ $point['label'] }}: {{ $point['count'] }} @endforeach

{{ trans('admin.Instructor leaderboard') }}

@forelse($leaderboardInstructors as $i => $instructor)
{{ $i + 1 }}
{{ $instructor->user?->name }}
{{ $instructor->students_count }} ๐ŸŽ“
@empty
๐ŸŽ“
{{ trans('admin.No instructors yet') }}
@endforelse

{{ trans('admin.Student leaderboard') }}

@forelse($leaderboardStudents as $i => $student)
{{ $i + 1 }}
{{ $student->user?->name }}
{{ number_format($student->period_points) }} โญ
@empty
โญ
{{ trans('admin.No points earned yet') }}
@endforelse

{{ trans('admin.Top performing courses') }}

{{ trans('admin.View all') }}
@if($topCourses->isEmpty())
๐Ÿ“š
{{ trans('admin.No courses yet') }}
@else @foreach($topCourses as $course) @endforeach
{{ $course->title }}
{{ $course->instructor?->user?->name }}
{{ trans('admin.currency') }} {{ number_format($course->revenue_sum ?? 0) }}
@endif
@endsection @section('script') @endsection