@extends('layout.layout') @section('content')
{{-- Back Button --}}
Session Details
@php $sessionDate = \Carbon\Carbon::parse($session->session_date)->startOfDay(); $today = \Carbon\Carbon::today(); if ($sessionDate->equalTo($today)) { $label = "Back to Today Sessions"; $filter = "today"; } elseif ($sessionDate->greaterThan($today)) { $label = "Back to Upcoming Sessions"; $filter = "upcoming"; } else { $label = "Back to Previous Sessions"; $filter = "previous"; } @endphp {{ $label }}
{{-- Session Info --}}
Session Information
Session Number: {{ $session->session_number }}
Course Name: {{ $session->staffScheduled->course_name_en ?? 'N/A' }}
Session Date: {{ \Carbon\Carbon::parse($session->session_date)->format('d M Y') }}
Time: {{ \Carbon\Carbon::parse($session->start_time)->format('h:i A') }} - {{ \Carbon\Carbon::parse($session->end_time)->format('h:i A') }}
Teacher: {{ $session->staffScheduled->staff->first_name ?? '' }} {{ $session->staffScheduled->staff->last_name ?? '' }}
Track Type: {{ $session->staffScheduled->trackType->name ?? 'N/A' }}
Track Level: {{ $session->staffScheduled->trackLevel->name_en ?? 'N/A' }}
@if($session->extra_link) @endif @if($session->attached)
Attached File: View Attachment
@endif @if($session->extra_file)
Extra File: View Extra File
@endif

@php $now = now(); $time = \Carbon\Carbon::parse($session->session_date . ' ' . $session->end_time); $isPast = $now->greaterThan($time); @endphp @if($isPast)
@endif
{{-- Students Table --}}
Students in This Session
@php $todayDate = \Carbon\Carbon::today(); $firstDate = $firstSessionDate ? \Carbon\Carbon::parse($firstSessionDate) : null; $thirdDate = $thirdSessionDate ? \Carbon\Carbon::parse($thirdSessionDate) : null; $showMisplaced = $firstDate && $thirdDate && $todayDate->between($firstDate, $thirdDate); $shouldAddStudentRequest = DB::table('urgents')->where('message',"Student Didn't Show-Up")->where('session_id',$session->id)->where('created_by',Auth::id())->exists(); $shouldAddTeacherRequest = DB::table('urgents')->where('message',"Teacher Didn't Show-Up")->where('session_id',$session->id)->where('created_by',Auth::id())->exists(); @endphp @forelse ($session->staffScheduled->courseStudent as $index => $courseStudent) @empty @endforelse
# Student Name Action
{{ $index + 1 }} {{ $courseStudent->student->first_name ?? '' }} {{ $courseStudent->student->last_name ?? '' }} @if($showMisplaced)
@csrf
@endif @if($courseStudent->should_add_feedback) @php $feedbackType = null; if ($courseStudent->nextFeedback == "initial" && $session['session_number'] == 2) $feedbackType = 'Initial'; elseif($courseStudent->nextFeedback == "mid" && $session['session_number'] == 4) $feedbackType = 'Mid-Course'; elseif($courseStudent->nextFeedback == "final" && $session['session_number'] == 8) $feedbackType = 'Final'; $sessionDate = \Carbon\Carbon::parse($session->session_date); $today = \Carbon\Carbon::today(); // Condition 1: Past session $isPastSession = $sessionDate->lessThan($today); // Condition 2: Today session & now > end_time $isTodaySessionAndFinished = $sessionDate->equalTo($today) && now()->greaterThan( \Carbon\Carbon::parse($session->end_time)); // Final result $canGiveFeedback = $isPastSession || $isTodaySessionAndFinished; $now = now(); $deadline = \Carbon\Carbon::parse($courseStudent->feedback_target_date . ' ' . $session->end_time); $deadlinePlus24 = $deadline->copy()->addHours(24); $isLate = $now->greaterThan($deadlinePlus24); @endphp @if($feedbackType && $canGiveFeedback) {{ $feedbackType }} Feedback @endif @endif @if( in_array($session->session_number, [2, 4, 8]) && ( (is_array($courseStudent->existing_feedbacks) && !empty($courseStudent->existing_feedbacks)) || (is_object($courseStudent->existing_feedbacks) && method_exists($courseStudent->existing_feedbacks, 'isNotEmpty') && $courseStudent->existing_feedbacks->isNotEmpty()) ) ) @endif @if(!$shouldAddStudentRequest && $session->session_date == $todayDate && in_array($staff->jobTitle->slug, ['supervisor', 'teacher']) )
@csrf
@endif @if(!$shouldAddTeacherRequest && $session->session_date == $todayDate && in_array($staff->jobTitle->slug, ['supervisor']) )
@csrf
@endif
No students enrolled in this session.
@endsection