@extends('layouts.master') @section('title', 'Teaching Load Preview') @section('style') @endsection @section('content') @include('layouts.header') @include('layouts.title')
{{-- ===================================================== --}} {{-- PAGE TITLE --}} {{-- ===================================================== --}}

Teaching Load Preview

Please review all information before sending it for approval.

{{-- Define this in the parent view: variables created inside @include do not propagate back to the parent Blade scope. The status badge below uses it. --}} @php $teachingRevision = \App\Services\TeachingLoadRejectionNotice::current( $teachingLoad->teaching_load_id ); @endphp @include('load.partials.teaching_load_rejection_banner') {{-- ===================================================== --}} {{-- TEACHING LOAD INFORMATION --}} {{-- ===================================================== --}}
Teaching Load Information
{{-- Academic Year --}}
Academic Year
{{ $teachingLoad->teaching_load_year }}
{{-- Semester --}}
Current Semester
Semester {{ $teachingLoad->teaching_load_semester }}
{{-- Teaching Load Status --}}
Teaching Load Status
@if($teachingRevision) Rejected — Needs Revision @elseif($teachingLoad->teaching_load_status == 'Draft') Draft @elseif($teachingLoad->teaching_load_status == 'Pending') Pending @elseif($teachingLoad->teaching_load_status == 'Approved') Approved @elseif($teachingLoad->teaching_load_status == 'Rejected') Rejected @else {{ $teachingLoad->teaching_load_status ?? '-' }} @endif
{{-- Employee Contract --}}
Employee Contract
@if($fcontract) {{ $fcontract->fcontract_start_date ?? '-' }} - {{ $fcontract->fcontract_end_date ?? '-' }} @else - @endif
{{-- Faculty --}}
Faculty Member
{{ $faculty->faculty_title ?? '' }} {{ $faculty->faculty_firstname ?? '' }} {{ $faculty->faculty_lastname ?? '' }}
{{-- School --}}
School
{{ $faculty->school_name ?? '-' }}
{{-- ===================================================== --}} {{-- WORKLOAD ARRANGEMENT CONTEXT --}} {{-- ===================================================== --}} @if($adcontract_value)
Workload Arrangement Administrative Position Context
Administrative Position
{{ $adcontract_value ->admin_position_name ?? '-' }}
Arrangement Type
{{ $adcontract_value ->adposition_type_name ?? '-' }}
Arrangement Status
{{ $adcontract_value->status ?? '-' }}
Appointment No.
{{ $adcontract_value ->adcontract_no ?? '-' }}
Workload Arrangement and Teaching Load use separate approval workflows.
@endif {{-- ===================================================== --}} {{-- 1. TEACHING LOAD --}} {{-- ===================================================== --}}
1. Teaching Load
@php /* |-------------------------------------------------------------------------- | TOTAL LECTURE : Semester 1 + 2 + 3 |-------------------------------------------------------------------------- | | Credits | = ผลรวม course_lecture ของทั้ง 3 Semester | | Hours/Week | = ผลรวม course_contact ของทั้ง 3 Semester | */ $totalLectureCredit = 0; $totalLectureContact = 0; foreach ([1, 2, 3] as $lectureSemester) { $lectureRows = $lecture[$lectureSemester] ?? collect(); $totalLectureCredit += $lectureRows->sum(function ($row) { return (float) ( $row->course_lecture ?? 0 ); }); $totalLectureContact += $lectureRows->sum(function ($row) { return (float) ( $row->course_contact ?? 0 ); }); } /* |-------------------------------------------------------------------------- | จัดรูปแบบตัวเลข |-------------------------------------------------------------------------- | | 12.00 -> 12 | 12.50 -> 12.5 | */ $formatTeachingNumber = function ($value) { if ( floor($value) == $value ) { return number_format( $value, 0 ); } return rtrim( rtrim( number_format( $value, 2, '.', '' ), '0' ), '.' ); }; @endphp
a) Lecture
=
{{ $formatTeachingNumber($totalLectureCredit) }} Credits, {{ $formatTeachingNumber($totalLectureContact) }} Hours/Week
TOR
=
6 Credits, 12 Hours/Week
{{-- ================================================= --}} {{-- 1a Lecture --}} {{-- ================================================= --}} @foreach([1,2,3] as $semester) @php $rows = $lecture[$semester] ?? collect(); @endphp
Academic Year {{ $teachingLoad->teaching_load_year }} - Semester {{ $semester }}
@forelse($rows as $key => $row) @empty @endforelse
No. Course No. Course Course Level Portions (%) Sec.No. No. of Students No. of Weeks Lecture (Hr/Wk) Credits Contact (Hr/Wk) Source
{{ $key + 1 }} {{ $row->course_code }} {{ $row->course_name }} {{ $row->course_level ?? '-' }} {{ $row->course_portions }} {{ $row->course_section }} {{ $row->course_student }} {{ $row->course_week }} {{ $row->course_lecture }} {{ $row->course_credit }} {{ $row->course_contact }} @if(($row->source ?? 'AUTO') == 'AUTO') AUTO @else MANUAL @endif
No lecture data.
@endforeach
{{-- ================================================= --}} {{-- 1b Laboratory --}} {{-- ================================================= --}} {{-- Section Title --}}
@php /* |-------------------------------------------------------------------------- | TOTAL LABORATORY : Semester 1 + 2 + 3 |-------------------------------------------------------------------------- | | รวม Contact (Hr/Wk) for Lab | จาก course_lab_lect ของทั้ง 3 Semester | */ $totalLabContact = 0; foreach ([1, 2, 3] as $labSemester) { $labRows = $laboratory[$labSemester] ?? collect(); $totalLabContact += $labRows->sum(function ($row) { return (float) ( $row->course_lab_lect ?? 0 ); }); } $formatLabNumber = function ($value) { if (floor($value) == $value) { return number_format( $value, 0 ); } return rtrim( rtrim( number_format( $value, 2, '.', '' ), '0' ), '.' ); }; @endphp
b) Laboratory
=
{{ $formatLabNumber($totalLabContact) }} Credits, {{ $formatLabNumber($totalLabContact) }} Hours/Week
TOR
=
7 Credits, 24 Hours/Week
@foreach([1,2,3] as $semester) @php $rows = $laboratory[$semester] ?? collect(); /* Same Total a + b formula as teachingload_fixed.blade.php: Semester Lecture Contact + Semester Laboratory Contact. */ $labContactTotal = ($lecture[$semester] ?? collect())->sum(function ($row) { return (float) ($row->course_contact ?? 0); }) + $rows->sum(function ($row) { return (float) ($row->course_lab_lect ?? 0); }); @endphp
Academic Year {{ $teachingLoad->teaching_load_year }} - Semester {{ $semester }}
@forelse($rows as $key => $row) @empty @endforelse {{-- View/Preview: 12 visible columns. Align label under Credits and the result under Contact, as on Teaching Load. --}}
No. Course No. Course Course Level Portions (%) Sec.No. No. of Students No. of Lecturers Lab.&Lect (Hr/Wk) Credits Contact (Hr/Wk) Source
{{ $key + 1 }} {{ $row->course_code }} {{ $row->course_name }} {{ $row->course_level ?? '-' }} {{ $row->course_portions }} {{ $row->course_section }} {{ $row->course_student }} {{ $row->course_lect_ta }} {{ $row->course_lab_lect }} {{ $row->course_credit }} {{ $row->course_lab_lect }} @if(($row->source ?? 'AUTO') == 'AUTO') AUTO @else MANUAL @endif
No laboratory data.
Total a + b {{ $formatTeachingNumber($labContactTotal) }}
@endforeach
{{-- ===================================================== --}} {{-- 2. SUPERVISION --}} {{-- ===================================================== --}}
2. Supervision of Senior Project/ Extended Training/ Special Problems/ Selected Topic/ Others
a) Senior Project/ Extended Training Requirement
=
10 Credits, 24 Hours/Week
TOR
=
10 Credits, 24 Hours/Week
@foreach([1,2,3] as $semester) @php $rows = $senior[$semester] ?? collect(); @endphp
Semester {{ $semester }}
@forelse($rows as $key => $row) @empty @endforelse
No. Course No. Course No. of Students Credits Contact (Hr/Wk) Source
{{ $key + 1 }} {{ $row->senior_course_code }} {{ $row->senior_course_name }} {{ $row->senior_student_no }} {{ $row->senior_credits }} {{ $row->senior_contact === null || $row->senior_contact === '' ? 2 : (float) $row->senior_contact }} @if(($row->source ?? 'AUTO') == 'AUTO') AUTO @else MANUAL @endif
No Senior Project data.
@endforeach
{{-- ================================================= --}} {{-- 2b Supervision --}} {{-- ================================================= --}}
b) Supervision for Master and Doctoral Students
=
3 Groups/Year, 12 Hours/Year
TOR
=
3 Groups/Year, 12 Hours/Year
@foreach([1,2,3] as $semester) @php $rows = $supervision[$semester] ?? collect(); @endphp
Semester {{ $semester }}
@forelse($rows as $key => $row) @empty @endforelse
No. Student Code Name Level No. of Students Credits Contact (Hr/Wk) Source
{{ $key + 1 }} {{ $row->supervision_student_code }} {{ $row->supervision_title }} {{ $row->supervision_fullname }} {{ $row->supervision_level }} {{ $row->supervision_student_no }} {{ $row->supervision_credits === null || $row->supervision_credits === '' ? '' : (float) $row->supervision_credits }} {{ $row->supervision_contact === null || $row->supervision_contact === '' ? 2 : (float) $row->supervision_contact }} @if(($row->source ?? 'AUTO') == 'AUTO') AUTO @else MANUAL @endif
No supervision data.
@endforeach
{{-- ===================================================== --}} {{-- 3. INTERNAL COMMITTEES --}} {{-- ===================================================== --}}

3. Internal Committees

@forelse($committee as $key => $row) @empty @endforelse
No. Internal Committees Name Document
{{ $key + 1 }} {{ $row->ic_name ?? '-' }} @if(!empty($row->ic_documents)) View File @else - @endif
No Internal Committees found.
{{-- ===================================================== --}} {{-- 4. TIMETABLE --}} {{-- ===================================================== --}}

4. Timetable

@foreach([1,2,3] as $semester) @php $rows = $timetable[$semester] ?? collect(); $regularRows = $rows ->filter(function ($row) { return trim( $row->timetable_activity ?? '' ) === 'Regular Teaching Schedule'; }) ->values(); $extraRows = $rows ->filter(function ($row) { return trim( $row->timetable_activity ?? '' ) === 'Extra Teaching Schedule'; }) ->values(); $scheduleGroups = [ 'Regular Teaching Schedule' => $regularRows, 'Extra Teaching Schedule' => $extraRows ]; @endphp
Teaching Schedule Preview - Semester {{ $semester }}
@foreach($scheduleGroups as $scheduleName => $gridRows)
@if($scheduleName == 'Regular Teaching Schedule') Regular @else Extra @endif
{{ $scheduleName }}
@if($gridRows->isEmpty())
No {{ $scheduleName }} found for Semester {{ $semester }}.
@else @php $days = [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' ]; $timeToMinutes = function ($time) { if (empty($time)) { return null; } $time = substr($time, 0, 5); [$hour, $minute] = array_map( 'intval', explode(':', $time) ); return ($hour * 60) + $minute; }; $slotMinutes = 30; $minStart = $gridRows ->map(function ($row) use ($timeToMinutes) { return $timeToMinutes( $row->timetable_time_start ); }) ->filter(function ($value) { return $value !== null; }) ->min(); $maxEnd = $gridRows ->map(function ($row) use ($timeToMinutes) { return $timeToMinutes( $row->timetable_time_end ); }) ->filter(function ($value) { return $value !== null; }) ->max(); $gridStart = $minStart ?? (8 * 60); $gridEnd = $maxEnd ?? (17 * 60); $gridStart = floor( $gridStart / $slotMinutes ) * $slotMinutes; $gridEnd = ceil( $gridEnd / $slotMinutes ) * $slotMinutes; $slotCount = ($gridEnd - $gridStart) / $slotMinutes; @endphp
@for($column = 0; $column < $slotCount; $column++) @endfor @for($slot = 0; $slot < $slotCount; $slot++) @php $startMinutes = $gridStart + ($slot * $slotMinutes); $endMinutes = $startMinutes + $slotMinutes; $startHour = floor($startMinutes / 60); $startMinute = $startMinutes % 60; $endHour = floor($endMinutes / 60); $endMinute = $endMinutes % 60; $startLabel = sprintf( '%02d:%02d', $startHour, $startMinute ); $endLabel = sprintf( '%02d:%02d', $endHour, $endMinute ); @endphp @endfor @foreach($days as $day) @include('load.partials.teaching_schedule_day', [ 'day' => $day, 'gridRows' => $gridRows, 'timeToMinutes' => $timeToMinutes, 'gridStart' => $gridStart, 'gridEnd' => $gridEnd, 'slotCount' => $slotCount, ]) @endforeach
Day / Time
{{ $startLabel }}
-
{{ $endLabel }}
@endif
@endforeach
@endforeach
{{-- ===================================================== --}} {{-- ACTION --}} {{-- ===================================================== --}}
{{-- Back --}} Back to Edit {{-- ===================================================== --}} {{-- WORKFLOW ACTION --}} {{-- ===================================================== --}} @if($workflowSubmitMode == 'REVIEW')
@csrf
@elseif($workflowSubmitMode == 'APPROVE')
@csrf
@else @endif
@endsection