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

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

Here's how your children are doing

{{-- Left: Children cards (2 cols) --}}
@foreach($children as $child) @php $att = $childAttendance[$child->id] ?? ['total' => 0, 'present' => 0, 'absent' => 0, 'late' => 0, 'percentage' => 0]; $childMarks = $child->marks->take(5); @endphp
{{-- Child Header --}}
{{ strtoupper(substr($child->name, 0, 1)) }}

{{ $child->name }}

{{ $child->studentProfile?->class_?->full_name ?? 'N/A' }} · {{ $child->studentProfile?->admission_number ?? '' }}

{{ $att['percentage'] }}%

Attendance

{{-- Attendance Mini Stats --}}

{{ $att['total'] }}

Total Days

{{ $att['present'] }}

Present

{{ $att['absent'] }}

Absent

{{ $att['late'] }}

Late

{{-- Recent Marks --}} @if($childMarks->isNotEmpty())

Recent Marks

@foreach($childMarks as $mark) @endforeach
{{ $mark->exam->subject->name ?? '—' }} {{ $mark->exam->name }} @if($mark->is_absent) ABSENT @else {{ $mark->marks_obtained }}/{{ $mark->exam->total_marks }} {{ $mark->grade }} @endif
@endif {{-- Quick Links --}}
{{-- Class Teacher Info --}} @php $childClass = $childClasses[$child->id] ?? null; @endphp @if($childClass && $childClass->classTeacher)
{{ strtoupper(substr($childClass->classTeacher->name, 0, 1)) }}{{ strtoupper(substr(explode(' ', $childClass->classTeacher->name)[1] ?? '', 0, 1)) }}

{{ $childClass->classTeacher->name }}

Class Teacher

@if($childClass->asstClassTeacher)

{{ $childClass->asstClassTeacher->name }}

Asst. CT

@endif
@endif All Marks Attendance Fees Apply Leave
@endforeach @if($children->isEmpty())

No children linked to your account yet.

Contact the school admin to link your children.

@endif
{{-- Right sidebar --}}
{{-- School Contact --}}

Need Help?

Contact the school directly

@if(!empty($schoolSettings['school_phone'])) {{ $schoolSettings['school_phone'] }} @endif Message Teacher
{{-- 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++)
@endfor @for($d = 1; $d <= $lastDay->day; $d++)
{{ $d }}
@endfor
{{-- Upcoming Events --}} @include('components.upcoming-events') {{-- Announcements --}}

Announcements

@forelse($announcements as $a)

{{ $a->title }}

{{ Str::limit($a->content, 80) }}

{{ $a->created_at->diffForHumans() }}

@empty
No announcements
@endforelse
@endsection