@extends('layouts.app') @section('title', 'Student Dashboard') @section('page-title', 'Student Dashboard') @section('content')

Welcome back, {{ Auth::user()->student->name }}! 👋

Here's what's happening with your classes today.

Enrolled Classes
{{ $enrolledClassesCount ?? 0 }}
Pending Assignments
{{ $pendingAssignmentsCount ?? 0 }}
Attendance Rate
{{ $attendanceRate ?? 0 }}%
Study Materials
{{ $studyMaterialsCount ?? 0 }}
Today's Classes
{{ $todaysClasses->count() ?? 0 }}
@if($todaysClasses && $todaysClasses->count() > 0)
@foreach($todaysClasses as $class)
{{ $class->subject->name ?? $class->subject->title ?? 'N/A' }}
{{ $class->start_time ? \Carbon\Carbon::parse($class->start_time)->format('h:i A') : 'Time not set' }}
{{ $class->teacher->user->name ?? $class->teacher->user->username ?? 'Teacher not assigned' }}
{{ $class->batch->name ?? 'N/A' }}
@endforeach
@else

No classes scheduled for today

Take this time to catch up on assignments or study materials
@endif
Recent Assignments
{{ $recentAssignments->count() ?? 0 }}
@if($recentAssignments && $recentAssignments->count() > 0)
@foreach($recentAssignments as $assignment)
{{ $assignment->title }}
Due: {{ $assignment->due_date ? $assignment->due_date->format('M d, Y') : 'No due date' }}
{{ $assignment->due_date && $assignment->due_date->isPast() ? 'Overdue' : 'Pending' }}

{{ $assignment->subject->name ?? $assignment->subject->title ?? 'N/A' }}

{{ Str::limit($assignment->description, 120) }}

{{ $assignment->teacher->user->name ?? $assignment->teacher->user->username ?? 'N/A' }}
@if($assignment->is_submitted) Submitted @else Submit @endif
@endforeach
@else

No recent assignments

You're all caught up! Check back later for new assignments.
@endif
Attendance Summary
@if(isset($attendanceSummary) && count($attendanceSummary) > 0)
@foreach($attendanceSummary as $subject) @endforeach
Subject Present Absent Rate
{{ $subject['name'] }} {{ $subject['present'] }} {{ $subject['absent'] }} {{ $subject['rate'] }}%
@else

No attendance records found

@endif
Recent Study Materials
{{ $recentMaterials->count() ?? 0 }}
@if($recentMaterials && $recentMaterials->count() > 0)
@foreach($recentMaterials as $material)
@php // Determine file type icon and color $fileExtension = pathinfo($material->file_path, PATHINFO_EXTENSION); $fileType = strtolower($fileExtension); if (in_array($fileType, ['pdf'])) { $icon = 'file-pdf'; $color = 'danger'; } elseif (in_array($fileType, ['doc', 'docx'])) { $icon = 'file-word'; $color = 'primary'; } elseif (in_array($fileType, ['xls', 'xlsx'])) { $icon = 'file-excel'; $color = 'success'; } elseif (in_array($fileType, ['ppt', 'pptx'])) { $icon = 'file-powerpoint'; $color = 'warning'; } elseif (in_array($fileType, ['jpg', 'jpeg', 'png', 'gif'])) { $icon = 'file-image'; $color = 'info'; } else { $icon = 'file-alt'; $color = 'secondary'; } @endphp {{ $material->title }}
{{ $material->created_at->diffForHumans() }}

{{ $material->class->subject->name ?? $material->class->subject->title ?? 'General' }}

{{ $material->file_size ? $material->file_size_formatted : 'Size not available' }}

{{ $material->teacher->user->name ?? $material->teacher->user->username ?? 'N/A' }}
@endforeach
@else

No study materials available

Your teachers will upload materials here
@endif
@endsection @section('scripts') @endsection