@extends('layouts.app') @section('title', 'Admin Dashboard') @section('page-title', 'Dashboard') @section('content') @php $hour = now()->hour; $greeting = $hour < 12 ? 'Good Morning' : ($hour < 17 ? 'Good Afternoon' : 'Good Evening'); $maxAttendance = collect($chartData)->max('total') ?: 1; @endphp
{{-- Greeting --}}

{{ $greeting }}, {{ explode(' ', auth()->user()->name)[0] }}

Welcome to {{ $schoolSettings['school_name'] ?? 'School' }} Admin Panel

{{-- Stats Cards --}}
{{-- Students --}}
Active

Total Students

{{ number_format($totalStudents) }}

{{-- Teachers --}}
Active

Total Teachers

{{ number_format($totalTeachers) }}

{{-- Classes --}}

Total Classes

{{ $totalClasses }}

{{-- Fees --}}

Fee Collected

₹{{ number_format($totalCollected / 1000, 1) }}k

of ₹{{ number_format($totalBilled / 1000, 1) }}k billed

{{-- LEFT: Charts area (2 cols) --}}
{{-- Attendance Chart --}}

Attendance Report

Last 10 school days

Present Absent
{{-- Bar Chart --}}
@forelse($chartData as $day)
@if($day['absent'] > 0)
@endif
{{ $day['date'] }}
@empty
No attendance data yet
@endforelse
{{-- Student Performance --}}

Top Student Performance

@forelse($topStudents as $i => $student) @empty @endforelse
Name Class Average Performance
{{ strtoupper(substr($student->name, 0, 1)) }}
{{ $student->name }}
{{ $student->class_name }} {{ $student->section }} {{ $student->avg_pct }}%
No performance data yet
{{-- RIGHT: Sidebar (1 col) --}}
{{-- Gender Distribution --}}

Student Distribution

@php $boys = $genderData['male'] ?? 0; $girls = $genderData['female'] ?? 0; $totalGender = $boys + $girls; $boysPct = $totalGender > 0 ? round($boys / $totalGender * 100) : 0; $girlsPct = $totalGender > 0 ? round($girls / $totalGender * 100) : 0; @endphp
{{ $totalGender }} Students
Boys: {{ $boys }} Girls: {{ $girls }}
{{-- Mini Calendar --}}
@php $today = now(); $firstDay = $today->copy()->startOfMonth(); $lastDay = $today->copy()->endOfMonth(); @endphp

{{ $today->format('F Y') }}

@foreach(['S','M','T','W','T','F','S'] as $d)
{{ $d }}
@endforeach @for($i = 0; $i < $firstDay->dayOfWeek; $i++)
{{ $firstDay->copy()->subDays($firstDay->dayOfWeek - $i)->day }}
@endfor @for($d = 1; $d <= $lastDay->day; $d++)
{{ $d }}
@endfor
{{-- Upcoming Events --}}

Upcoming Events

@forelse($upcomingEvents as $event)

{{ $event->title }}

{{ $event->start_date->format('d M, Y') }}

@empty
No upcoming events
@endforelse
{{-- Quick Actions --}}
@endsection