@if (session('success'))
{{ session('success') }}
@endif @php $pendingAssignments = $pendingAssignments ?? collect(); @endphp

Welcome to Your Dashboard

@php $allPerformance = $courses->map(fn($c) => $c->performance)->filter(); $overallAvgScore = $allPerformance->where('has_grades', true)->pluck('average_score')->filter()->avg(); $totalGraded = $allPerformance->sum('graded_count'); $totalSubmitted = $allPerformance->sum('submitted_count'); $totalAssignments = $allPerformance->sum('total_assignments'); $overallCompletion = $totalAssignments > 0 ? round(($totalSubmitted / $totalAssignments) * 100) : 0; $overallGrade = null; if ($overallAvgScore !== null) { if ($overallAvgScore >= 80) $overallGrade = 'A'; elseif ($overallAvgScore >= 70) $overallGrade = 'B'; elseif ($overallAvgScore >= 60) $overallGrade = 'C'; elseif ($overallAvgScore >= 50) $overallGrade = 'D'; else $overallGrade = 'F'; } @endphp @if($courses->count() > 0 && $overallAvgScore !== null)

📈 Overall Performance

Your academic performance across all courses

{{ round($overallAvgScore, 1) }} / 100 @if($overallGrade) ({{ $overallGrade }}) @endif
Completion Rate
{{ $overallCompletion }}%
Assignments Graded
{{ $totalGraded }}
Total Assignments
{{ $totalAssignments }}
@endif

Pending assignments

Assignments

{{ $pendingAssignments->count() }} pending
@if ($pendingAssignments->isEmpty())
You have no pending assignments. You're all caught up!
@else
@foreach ($pendingAssignments as $assignment) @php $status = $assignment->computed_status ?? 'Pending'; $statusClass = $status === 'Overdue' ? 'danger' : 'info'; @endphp @endforeach
Assignment Due Date Status
@if ($assignment->course)
{{ $assignment->course->course_name }}
@endif
{{ $assignment->due_date ? $assignment->due_date->format('M d, Y g:ia') : 'No due date set' }} {{ $status }}
@endif

Enrolled courses

My Courses

{{ $courses->count() }} courses
@if($courses->count() > 0)
@foreach($courses as $index => $course) @php // Calculate progress based on assignments $totalAssignments = $course->assignments_count ?? 0; $submittedCount = \App\Models\Submissions::whereIn('assignment_id', $course->assignments()->pluck('id')) ->where('student_id', Auth::id()) ->count(); $progress = $totalAssignments > 0 ? min(100, round(($submittedCount / $totalAssignments) * 100)) : 0; @endphp
{{ $course->course_code }}
{{ strtoupper($course->course_name) }}
FACULTY OF COMPUTING
{{ $progress }}% complete
@endforeach
@else

You are not enrolled in any courses yet.

@endif