@extends('layouts.master') @section('title', 'Teachingload') @section('style') @endsection @section('script') @endsection @section('content') @include('layouts.header') @include('layouts.title')
● Administrative Position ○ Teaching Load ○ Preview
@yield('title')

Workload Arrangement
A. Position
Administrative Position : {{ $adcontract->admin_position_name }}
Sub Position : {{ $adcontract->admin_position_sub_name }}
Appointment No. : {{ $adcontract->adcontract_no }}

B. Workload Arrangement for Administrative Position Type
Academic Year : {{ $adcontract_value->adcontract_value_year }}
Semester : {{ $adcontract_value->adcontract_value_semester }}
Administrative Position Type : {{ $adcontract_value->adposition_type_name }}
Workload Arrangement Table
@php $selectedType = $adcontract_value->adcontract_value_type_id; @endphp @foreach($adposition_types as $item) @endforeach @foreach($Wadpositions as $index => $w) @foreach($adposition_types as $item) @php $value = $wpositions ->where('wposition_name', $w->Wadposition_id) ->where('wposition_type_id', $item->adposition_type_id) ->first(); @endphp @endforeach @endforeach
No. Workload Arrangement Unit {{ $item->adposition_type_name }}
{{ $index + 1 }} {{ $w->Wadposition_title }} {{ $w->unit_name }} {{ $value->wposition_value ?? '-' }}

C. Period
Start Date : {{ $adcontract->adcontract_start_date }}
End Date : {{ $adcontract->adcontract_end_date }}


Teachingload
@csrf

@csrf @php $roman = [ 1 => 'I', 2 => 'II', 3 => 'III' ]; @endphp {{-- Section Title --}}
1. Teaching Load
a) Lecture
=
12 Credits, 24 Hours/Week
TOR
=
12 Credits, 24 Hours/Week
{{-- ===================== --}} {{-- Lecture --}} {{-- ===================== --}} @foreach([1, 2, 3] as $semester) @php $rows = $lecture[$semester] ?? collect(); $lectureContact = $rows->sum(function ($r){ return (int)$r->course_contact; }); @endphp
Academic Year {{ $adcontract_value->adcontract_value_year }} - Semester {{ $semester }}
@forelse($rows as $key => $row) {{-- Course No. --}} {{-- Course --}} {{-- Portions --}} {{-- Section --}} {{-- Students --}} {{-- Weeks --}} {{-- Lecture --}} {{-- Credit --}} {{-- Contact --}} {{-- Source --}} {{-- Action --}} @empty @endforelse
No. Course No. Course Portions (%) Sec.No. No. of Students No. of Weeks Lecture (Hr/Wk) Credits (Lect.-Pr) Contact (Hr/Wk) Source Action
{{ $key + 1 }} @if(($row->source ?? 'AUTO') == 'AUTO') AUTO @else MANUAL @endif
No lecture courses found for Semester {{ $semester }}
{{-- Remaining --}}
Remaining Semester {{ $semester }} =
4 Credits/Week

@endforeach

{{-- ///////////////////////////////////////////////////////////////////////// --}} {{-- Section Title --}}
b) Laboratory
=
7 Credits, 24 Hours/Week
TOR
=
7 Credits, 24 Hours/Week
{{-- ========================================================= --}} {{-- LABORATORY --}} {{-- ========================================================= --}} @foreach([1, 2, 3] as $semester) @php $rows = $laboratory[$semester] ?? collect(); @endphp
Academic Year {{ $adcontract_value->adcontract_value_year }} - Semester {{ $semester }}
@forelse($rows as $key => $row) {{-- Course No. --}} {{-- Course --}} {{-- Portions --}} {{-- Section --}} {{-- Students --}} {{-- No. of Lecturers --}} {{-- Lab & Lect Hr/Wk --}} {{-- Credits --}} {{-- Contact --}} {{-- Source --}} {{-- Action --}} @empty @endforelse
No. Course No. Course Portions (%) Sec.No. No. of Students No. of Lecturers Lab.&Lect (Hr/Wk) Credits (Lect.-Pr) Contact (Hr/Wk) Source Action
{{ $key + 1 }} @if(($row->source ?? 'AUTO') == 'AUTO') AUTO @else MANUAL @endif
No laboratory courses found for Semester {{ $semester }}
@endforeach
{{-- ========================================================= --}} {{-- 2a. SENIOR PROJECT --}} {{-- ========================================================= --}} {{-- Section Title --}}
2. Supervision of Senior Project/ Extended Training/ Special Problems/ Selected Topic/ Others
a) Senior Project/ Extended Training Requirement
=
3 Groups/Year, 12 Hours/Year
TOR
=
3 Groups/Year, 12 Hours/Year
@foreach([1, 2, 3] as $semester) @php $rows = $senior[$semester] ?? collect(); $seniorContactTotal = $rows->sum(function ($r) { return (float) ($r->senior_contact ?? 0); }); @endphp
Academic Year {{ $adcontract_value->adcontract_value_year }} - Semester {{ $semester }}
@forelse($rows as $key => $row) {{-- Course No. --}} {{-- Course --}} {{-- Student --}} {{-- Credit --}} {{-- Contact --}} {{-- Source --}} {{-- Action --}} @empty @endforelse
No. Course No. Course No. of Students Credits Contact (Hr/Wk) Source Action
{{ $key + 1 }} @if(($row->source ?? 'AUTO') == 'AUTO') AUTO @else MANUAL @endif
No Senior Project found for Semester {{ $semester }}
Total Contact {{ $seniorContactTotal }}
@endforeach
{{-- ========================================================= --}} {{-- 2b. MASTER / DOCTORAL SUPERVISION --}} {{-- ========================================================= --}} {{-- Section Title --}}
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
Academic Year {{ $adcontract_value->adcontract_value_year }} - Semester {{ $semester }}
@forelse($rows as $key => $row) @empty @endforelse
No. Student Code Title First Name Last Name Level No. of Students Credits Contact (Hr/Wk) Source Action
{{ $key + 1 }} {{-- disabled ไม่ submit ดังนั้นมี hidden --}} @if(($row->source ?? 'AUTO') == 'AUTO') AUTO @else MANUAL @endif
No supervision data found for Semester {{ $semester }}
@endforeach {{-- ========================================================= --}} {{-- 3. Internal Committees --}} {{-- ========================================================= --}}
3. Internal Committees
@forelse($committee as $key => $row) @empty @endforelse
No. Name File
{{ $key + 1 }} {{ $row->ic_name ?? '-' }} @if(!empty($row->ic_file)) View File @else - @endif
No Internal Committees found.

{{-- ========================================================= --}} {{-- 4. TIMETABLE --}} {{-- ========================================================= --}}
4. Timetable
Teaching Schedule
@foreach([1, 2, 3] as $semester) @php $rows = $timetable[$semester] ?? collect(); @endphp
{{-- Header --}}
Academic Year {{ $adcontract_value->adcontract_value_year }} - Semester {{ $semester }}
@forelse($rows as $key => $row) {{-- Course No --}} {{-- Course --}} {{-- Teaching Type --}} {{-- Day --}} {{-- Start --}} {{-- End --}} {{-- Room --}} {{-- Activity --}} {{-- Source --}} {{-- Action --}} @empty @endforelse
No. Course No. Course Teaching Type Day Start Time End Time Room Activity Source Action
{{ $key + 1 }} @if(($row->source ?? 'AUTO') == 'AUTO') AUTO @else MANUAL @endif
No timetable found for Semester {{ $semester }}
{{-- ========================================================= --}} {{-- TIMETABLE GRID PREVIEW --}} {{-- ========================================================= --}} @php $gridRows = $timetable[$semester] ?? collect(); $days = [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' ]; $timeSlots = [ '08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00' ]; @endphp
Teaching Schedule Preview
@foreach($timeSlots as $time) @endforeach @foreach($days as $day) @foreach($timeSlots as $time) @php $slotStart = strtotime($time); $slotEnd = strtotime( $time . ' +1 hour' ); $classes = $gridRows->filter( function ($row) use ( $day, $slotStart, $slotEnd ) { if ( strtoupper( trim( $row->timetable_date ) ) !== strtoupper($day) ) { return false; } $start = strtotime( $row->timetable_time_start ); $end = strtotime( $row->timetable_time_end ); return ( $start < $slotEnd && $end > $slotStart ); } ); @endphp @endforeach @endforeach
Day / Time {{ $time }}
{{ $day }} @foreach($classes as $class)
{{ $class->timetable_course_code }}
{{ $class->timetable_course_name }}
{{ substr( $class->timetable_time_start, 0, 5 ) }} - {{ substr( $class->timetable_time_end, 0, 5 ) }}
@if(!empty($class->timetable_room))
Room: {{ $class->timetable_room }}
@endif
@if( $class->timetable_teaching_type == 'Lecture' ) Lecture @else Laboratory @endif
@endforeach


@endforeach
Preview
@include('layouts.footer') @endsection