@extends('layouts.dashboard') @section('title', 'Dashboard') @section('page-title', 'Dashboard') @section('content') @php $firstName = explode(' ', auth()->user()->name)[0]; $activeCount = $enrollments->where('status', '!=', 'completed')->count(); $certsCount = $certificates->count(); $totalCount = $enrollments->count(); $overallPct = $totalCount > 0 ? round($certsCount / $totalCount * 100) : 0; @endphp {{-- WELCOME BANNER --}}

โœฆ Welcome Back

Good morning, {{ $firstName }}

@if($activeCount > 0) You have {{ $activeCount }} active {{ Str::plural('course', $activeCount) }} in progress. Keep going! @else You have no active courses. Enroll in a course to get started! @endif
{{ $overallPct }}%
Overall Progress
{{-- STATS ROW --}}
๐Ÿ“š
{{ $activeCount }}
Active Courses
๐ŸŽ“
{{ $certsCount }}
Certificates Earned
โœ…
{{ $certsCount }}
Courses Completed
๐Ÿ“‹
{{ $totalCount }}
Total Enrolled
{{-- MAIN TWO-COL GRID --}}
{{-- ENROLLED COURSES --}}
My Enrolled Courses View All โ†’
@forelse($enrollments as $enrollment)
{{ $enrollment->course->type === 'diploma' ? '๐Ÿ“Š' : '๐Ÿ”ง' }}
{{ $enrollment->course->title }}
{{ ucfirst($enrollment->course->type) }} ยท {{ $enrollment->course->duration_weeks }} Weeks
@php $pct = $enrollment->status === 'completed' ? 100 : 0; @endphp
Progress{{ $pct }}%
@empty
๐Ÿ“š

You haven't enrolled in any courses yet.
Browse courses โ†’

@endforelse
{{-- CERTIFICATES --}}
My Certificates View All โ†’
@forelse($certificates as $enrollment)
๐Ÿ…
{{ $enrollment->course->title }}
Issued ยท {{ $enrollment->completed_at ? \Carbon\Carbon::parse($enrollment->completed_at)->format('d M Y') : 'N/A' }} @if($enrollment->certificate) ยท #{{ $enrollment->certificate->certificate_number }} @endif
@if($enrollment->certificate) โฌ‡ @endif
@empty
๐ŸŽ“

Complete a course to earn your first certificate.

@endforelse
{{-- BROWSE MORE COURSES --}} @if($courses->count() > 0)
Browse More Courses
@foreach($courses as $course)
{{ $course->type === 'diploma' ? '๐Ÿ“Š' : '๐Ÿ”ง' }}
{{ ucfirst($course->type) }}
{{ $course->title }}
{{ $course->duration_weeks }} Weeks ยท KES {{ number_format($course->fee) }}
@csrf
@endforeach
@endif @endsection @push('scripts') @endpush