@extends('layouts.student_layout') @section('content')

Total Hours Attended

{{ $totalAttended ?? 0 }} hrs

Total Academic Hours

{{ $totalAcademic ?? 0 }} hrs

Overall Percentage

{{ number_format($overallPercentage, 2) ?? 0 }}%

Monthly Breakdown

@foreach ($attendanceByMonth as $month => $records) @php $year = $records->first()->year; $monthName = \Carbon\Carbon::createFromDate($year, $month, 1)->format('M Y'); $theory = $records->where('type', 'theory')->first(); $practical = $records->where('type', 'practical')->first(); $lab = $records->where('type', 'laboratory')->first(); $theoryTotal = (count(json_decode($theory->attendance_data ?? '[]', true)) * 8); $practicalTotal = (count(json_decode($practical->attendance_data ?? '[]', true)) * 8); $labTotal = (count(json_decode($lab->attendance_data ?? '[]', true)) * 8); $totalHours = $theoryTotal + $practicalTotal + $labTotal; $totalHoursAttended = $records->sum('total_hours'); $totalPercent = ($totalHoursAttended / $totalHours) * 100 ?? 0; $theoryPercent = $theory ? ($theory->total_hours / $theoryTotal) * 100 : 0; $practicalPercent = $practical ? ($practical->total_hours / $practicalTotal) * 100 : 0; $labPercent = $lab ? ($lab->total_hours / $labTotal) * 100 : 0; @endphp
{{ $monthName }}

Hours Attended

{{ $records->sum('total_hours') ?? 0 }}hrs

Total Hours

{{ ($theoryTotal + $practicalTotal + $labTotal) ?? 0}} hrs

Overall Attendance {{ number_format($totalPercent, 2) }}
@if ($totalPercent <= 40)
@elseif ($totalPercent > 40 && $totalPercent <=75)
@elseif ($totalPercent > 75 && $totalPercent <=100)
@endif
Theory Classes ({{ $theory->total_hours ?? 0 }}/{{ $theoryTotal ?? 0 }} hrs) {{ number_format($theoryPercent, 2) ?? 0 }}%
@if ($theoryPercent <= 40)
@elseif ($theoryPercent > 40 && $theoryPercent <=75)
@elseif ($theoryPercent > 75 && $theoryPercent <=100)
@endif
Practical Labs ({{ $practical->total_hours ?? 0 }}/{{ $practicalTotal ?? 0 }} hrs) {{ number_format($practicalPercent, 2) ?? 0 }}%
@if ($practicalPercent <= 40)
@elseif ($practicalPercent > 40 && $practicalPercent <=75)
@elseif ($practicalPercent > 75 && $practicalPercent <=100)
@endif
Laboratory ({{ $lab->total_hours ?? 0 }}/{{ $labTotal ?? 0 }} hrs) {{ number_format($labPercent, 2) ?? 0 }}%
@if ($labPercent <= 40)
@elseif ($labPercent > 40 && $labPercent <=75)
@elseif ($labPercent > 75 && $labPercent <=100)
@endif
@endforeach
@endsection @section('pages-scripts') @endsection