@extends('layouts.teacher-portal') @section('title', 'Dashboard') @section('header', 'Dashboard') @section('content') {{-- Welcome --}}
@if ($teacher->photo) @else {{ $teacher->initials }} @endif

{{ now()->format('l, j F Y') }}

Welcome back, {{ $teacher->full_name }}

{{ $teacher->designation ?? 'Teacher' }} · Staff ID {{ $teacher->employee_id }} · {{ optional($currentYear)->name ?? '' }} {{ optional($currentTerm)->name ? 'ยท ' . $currentTerm->name : '' }}

{{-- Stat tiles (real counts) --}} @php $tiles = [ [ 'title' => 'Classes Assigned', 'value' => $classCount, 'chip' => 'bg-primary-50 text-primary-600', 'icon' => 'M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 00-1.883 2.542l.857 6a2.25 2.25 0 002.227 1.932H19.05a2.25 2.25 0 002.227-1.932l.857-6a2.25 2.25 0 00-1.883-2.542m-16.5 0V6A2.25 2.25 0 016 3.75h3.879a1.5 1.5 0 011.06.44l2.122 2.12a1.5 1.5 0 001.06.44H18A2.25 2.25 0 0120.25 9v.776', 'sub' => null, 'link' => ($perm['view_classes'] ?? false) ? ['route('tportal.classes', $school->id)', 'View my classes'] : null, ], [ 'title' => 'Subjects Assigned', 'value' => $subjectCount, 'chip' => 'bg-sky-100 text-sky-700', 'icon' => 'M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25', 'sub' => null, 'link' => (($perm['view_classes'] ?? false) && ($perm['enter_marks'] ?? false)) ? ['route('tportal.marks.entry', $school->id)', 'Enter marks'] : null, ], [ 'title' => 'Pending Marks', 'value' => $pendingMarks->count(), 'chip' => $pendingMarks->count() ? 'bg-amber-100 text-amber-700' : 'bg-emerald-100 text-emerald-700', 'icon' => 'M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10', 'valueClass' => $pendingMarks->count() ? 'text-amber-600' : 'text-green-600', 'sub' => optional($currentTerm)->name ? $currentTerm->name . ' combos with gaps' : 'No active term', 'link' => null, ], [ 'title' => 'Attendance Tasks', 'value' => $attendanceTasks->count(), 'chip' => $attendanceTasks->count() ? 'bg-rose-100 text-rose-700' : 'bg-emerald-100 text-emerald-700', 'icon' => 'M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5m-9-6h.008v.008H12v-.008zM12 15h.008v.008H12V15zm0 2.25h.008v.008H12v-.008zM9.75 15h.008v.008H9.75V15zm0 2.25h.008v.008H9.75v-.008zM7.5 15h.008v.008H7.5V15zm0 2.25h.008v.008H7.5v-.008z', 'valueClass' => $attendanceTasks->count() ? 'text-red-500' : 'text-green-600', 'sub' => $attendanceTasks->count() ? 'Registers missing today' : 'All registers taken today', 'link' => null, ], ]; @endphp
@foreach ($tiles as $tile)

{{ $tile['title'] }}

{{ $tile['value'] }}

@if ($tile['sub'])

{{ $tile['sub'] }}

@endif @if ($tile['link']) {{ $tile['link'][1] }} → @endif
@endforeach
{{-- Quick actions --}}
@if ($perm['take_attendance']) Take Attendance @endif @if ($perm['enter_marks']) Enter Marks @endif @if ($perm['view_classes']) View My Classes @endif @if ($perm['view_timetable']) View Timetable @endif
{{-- Today's timetable --}} @if ($perm['view_timetable'])

Today's Classes โ€” {{ now()->format('l, j M Y') }}

@forelse ($todayClasses as $entry)
{{ \Carbon\Carbon::parse($entry->start_time)->format('H:i') }}โ€“{{ \Carbon\Carbon::parse($entry->end_time)->format('H:i') }}

{{ $entry->subject?->name }}

{{ $entry->classroom?->name }} @if($entry->room) · {{ $entry->room }} @endif

@empty

No classes scheduled for today.

@endforelse
@endif {{-- Pending marks --}}

Pending Mark Entry

@forelse ($pendingMarks as $row)

{{ $row->subject->name }}

{{ $row->subject->classroom?->name }}

{{ $row->entered }}/{{ $row->total }}
@php($pct = $row->total > 0 ? (int) round($row->entered / $row->total * 100) : 0)
@empty

All mark entry up to date. ๐ŸŽ‰

@endforelse
{{-- Attendance tasks --}} @if ($perm['take_attendance'])

Attendance Tasks Today

@forelse ($attendanceTasks as $class)

{{ $class->name }}

Take now
@empty

Every register is taken for today.

@endforelse
@endif {{-- Announcements --}} @if ($perm['view_announcements'])

Announcements

See all
@forelse ($announcements as $announcement)

{{ $announcement->title }}

{{ Str::limit(strip_tags($announcement->body), 90) }}

{{ optional($announcement->published_at)->format('d M Y') }}

@empty

No announcements right now.

@endforelse
@endif {{-- Notifications --}} @unless ($notifications->isEmpty())

Notifications

@foreach ($notifications as $notification)

{{ $notification->title }}

{{ Str::limit($notification->body, 80) }}

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

@endforeach
@endunless
@endsection