@extends('teacher.teacher_dashboard') @section('customcss') @endsection @section('admin')
{{-- HERO BANNER --}}
Welcome to your teacher dashboard

{{ $teacher->name }}

{{ $todayName }} ยท {{ \Carbon\Carbon::parse($todayDate)->format('d M, Y') }}

Current time: {{ $now->format('h:i A') }}
Assigned periods today: {{ $routines->count() }}
{{-- ATTENDANCE REAL-TIME NOTIFICATIONS & SMART ALERTS --}} @if(isset($attendanceAlerts) && $attendanceAlerts->isNotEmpty())
@foreach($attendanceAlerts as $alert) @php $styleConfig = match($alert['type']) { 'danger' => [ 'bg' => '#fef2f2', 'border' => '#fecaca', 'left_border' => '#ef4444', 'icon_color' => '#dc2626', 'title_color' => '#7f1d1d', 'text_color' => '#991b1b', ], 'warning' => [ 'bg' => '#fffbeb', 'border' => '#fde68a', 'left_border' => '#f59e0b', 'icon_color' => '#d97706', 'title_color' => '#78350f', 'text_color' => '#92400e', ], 'success' => [ 'bg' => '#f0fdf4', 'border' => '#bbf7d0', 'left_border' => '#10b981', 'icon_color' => '#16a34a', 'title_color' => '#14532d', 'text_color' => '#166534', ], default => [ 'bg' => '#eff6ff', 'border' => '#bfdbfe', 'left_border' => '#3b82f6', 'icon_color' => '#2563eb', 'title_color' => '#1e3a8a', 'text_color' => '#1e40af', ], }; @endphp
@endforeach
@endif {{-- ROUTINE METRICS ROW --}}
Today's classes
{{ $routines->count() }}
All assigned routine rows for today.
Completed
{{ $completedRoutines->count() }}
Classes already finished.
Ongoing
{{ $ongoingRoutines->count() }}
Classes happening right now.
Remaining
{{ $remainingRoutines->count() }}
Classes still to come.
Diary given
{{ $diaryDoneRoutines->count() }}
Periods with a lesson plan entry.
Diary pending
{{ $diaryPendingRoutines->count() }}
Periods without a diary entry.
{{-- FIRST PERIOD ATTENDANCE --}} @if($firstPeriodAttendance->isNotEmpty())
First period attendance
First period classes are checked against student attendance records.
@foreach($firstPeriodAttendance as $firstPeriodItem)
{{ $firstPeriodItem['shift_name'] }} {{ $firstPeriodItem['status_label'] }}
Class: {{ $firstPeriodItem['class_name'] }}
Section: {{ $firstPeriodItem['section_name'] }}
Shift: {{ $firstPeriodItem['shift_name'] }}
Subject: {{ $firstPeriodItem['subject_name'] }}
Time: {{ $firstPeriodItem['time_range'] }}
@endforeach
@endif {{-- MAIN SECTION: ROUTINE & TEACHER ATTENDANCE DASHBOARD --}}
{{-- LEFT COLUMN: ROUTINE TABLE --}}
Today's Routine
{{ $todayName }} Routine
@forelse($routines as $routine) @php $routineStatusClass = match ($routine['status']) { 'completed' => 'badge-success', 'ongoing' => 'badge-warning', 'upcoming' => 'badge-info', default => 'badge-secondary', }; $diaryStatusClass = $routine['diary_status'] === 'done' ? 'badge-success' : 'badge-danger'; @endphp @empty @endforelse
Period Time Class Section Shift Subject Status Diary
{{ $routine['period_name'] }}
{{ $routine['time_range'] }}
{{ $routine['class_name'] }}
{{ $routine['section_name'] }} {{ $routine['shift_name'] }} {{ $routine['subject_name'] }} {{ $routine['status_label'] }} {{ $routine['diary_status_label'] }} @if($routine['diary_topic'])
{{ $routine['diary_topic'] }}
@endif
No routine is assigned for today.
{{-- QUICK SNAPSHOT CARD --}}
Today's Class Snapshot
Completed periods {{ $completedRoutines->count() }}
Remaining periods {{ $remainingRoutines->count() }}
Diary given {{ $diaryDoneRoutines->count() }}
Diary pending {{ $diaryPendingRoutines->count() }}
{{-- RIGHT COLUMN: TEACHER ATTENDANCE & SHIFT STATUS --}}
{{-- TODAY'S LIVE SHIFT STATUS CARD --}}
My Attendance Today
{{ \Carbon\Carbon::parse($todayDate)->format('d M, Y') }} ({{ $todayName }})
@php $dailyStatus = strtolower($todayTeacherAttendance->attendance_status ?? 'no_punch'); $dailyBadge = match($dailyStatus) { 'present', 'p' => 'bg-success', 'partial' => 'bg-warning text-dark', 'absent' => 'bg-danger', 'leave' => 'bg-info', 'off_day', 'weeklyoff' => 'bg-secondary', default => 'bg-light text-dark border', }; @endphp {{ ucfirst(str_replace('_', ' ', $todayTeacherAttendance->attendance_status ?? 'Not Marked')) }}
{{-- TODAY'S ASSIGNED SHIFTS --}} @if(isset($todayShiftsData) && $todayShiftsData->isNotEmpty())
Shift Punch Details:
@foreach($todayShiftsData as $sData) @php $isMorning = str_contains(strtolower($sData['shift']->name ?? ''), 'morning'); $cardClass = 'shift-punch-card'; if ($sData['in_time'] && $sData['out_time']) { $cardClass .= ' is-punched'; } elseif ($sData['late_minutes'] > 0) { $cardClass .= ' is-late'; } elseif (!$sData['in_time'] && !$sData['is_off']) { $cardClass .= ' is-missing'; } @endphp
{{ $sData['shift']->name }}
@if($sData['is_off']) Weekly Off @elseif($sData['in_time'] && $sData['out_time']) Complete @elseif($sData['in_time']) Missing Out @else Not Punched @endif
Schedule {{ $sData['start_time'] }}
Punch In {{ $sData['in_time'] ?? '-' }}
Punch Out {{ $sData['out_time'] ?? '-' }}
@if($sData['late_minutes'] > 0 || $sData['worked_minutes'] > 0)
@if($sData['late_minutes'] > 0) Late: {{ $sData['late_minutes'] }} mins @else On time @endif @if($sData['worked_minutes'] > 0) Worked: {{ $sData['worked_formatted'] }} @endif
@endif
@endforeach @else
No specific shift work rules assigned yet.
@endif {{-- MONTHLY SNAPSHOT SUMMARY --}}
Monthly Attendance Summary ({{ now()->format('F Y') }}):
Present
{{ $monthStats['present_days'] }}
Late
{{ $monthStats['late_days'] }}
Absent
{{ $monthStats['absent_days'] }}
Rate
{{ $monthStats['attendance_rate'] }}%
{{-- LAST 7 DAYS HISTORY TABLE --}}
Last 7 Recorded Days:
@forelse($teacherAttendance as $record) @php $attendanceClass = match (strtolower($record['status'])) { 'present', 'p' => 'badge-success', 'absent', 'a' => 'badge-danger', 'partial' => 'badge-warning text-dark', 'leave' => 'badge-info', 'off_day', 'weeklyoff' => 'badge-secondary', default => 'badge-light text-dark border', }; @endphp @empty @endforelse
Date Morning Day Hours Status
{{ $record['date'] }}
{{ $record['day'] }}
@if($record['morning_in'] !== '-') {{ $record['morning_in'] }} @else - @endif @if($record['day_in'] !== '-') {{ $record['day_in'] }} @else - @endif {{ $record['worked_formatted'] }} {{ $record['status_label'] }}
No attendance history found.
@endsection