@extends('layouts.app', ['class' => 'g-sidenav-show bg-gray-100']) @section('content') @include('layouts.navbars.auth.topnav', ['title' => '']) {{-- Top Action Bar --}}
@if ($authorize->edit == '1' && $list->status != 'finish' && $list->approval_hrd != 'approved') @if ($is_hrd_approver && $list->approval_hrd === 'pending') @endif {{-- --}} @endif
{{-- Unsaved Changes Banner --}}
{{-- Tab Navigation --}}
@php $editDetail = $details->first(); $unifiedSchedules = $schedules ->map(function ($schedule) { return [ 'id' => $schedule->id, 'tna_date' => $schedule->tna_date, 'tna_start_time' => $schedule->tna_start_time ? substr($schedule->tna_start_time, 0, 5) : '', 'tna_end_time' => $schedule->tna_end_time ? substr($schedule->tna_end_time, 0, 5) : '', 'duration_minutes' => $schedule->duration_minutes, 'institution_name' => $schedule->institution_name ?? 'internal', 'trainer_name' => $schedule->trainer_name ?? '', 'trainer_nik' => $schedule->trainer_nik ?? '', 'participants' => json_decode($schedule->nik, true) ?: [], 'status' => $schedule->status, ]; }) ->values(); @endphp {{-- Unified editor: mirrors the create form and is only visible in Edit Mode. --}}
TNA Header

Suggested from Organization Structure; it can still be changed.
Add Participants Based On
By Name By Department
Gunakan kolom pencarian untuk memilih participant berdasarkan nama atau NIK.
Semua karyawan aktif pada departemen terpilih akan ditampilkan untuk dikonfirmasi.
Required — every participant must be allocated to one schedule.
0 participant
TNA Detail

Training Schedule

Participant Allocation Drag participant ke schedule tujuan atau gunakan tombol Pilih via Modal.
0 / 0 scheduled
Belum Terjadwal 0
Pilih participant pada Header terlebih dahulu.
Satu participant hanya dapat ditempatkan pada satu schedule.
{{-- Tab Content --}}
{{-- HEADER TAB --}} {{-- DETAIL TAB --}} @php $detailSingle = $details->first(); @endphp
TNA Detail

@if ($detailSingle) {{-- Detail sudah ada: tampilkan sebagai form read-only, bisa di-edit --}}
@else {{-- Belum ada detail: tampilkan form input langsung --}} @if ($list->status != 'finish' && $authorize->add == '1')
@else

No TNA detail yet.

@endif @endif
{{-- SCHEDULE TAB --}}
Training Schedule
@if ($schedules->isNotEmpty()) @php $totalMinutes = 0; foreach ($schedules as $schedule) { $minutes = $schedule->duration_minutes; if ( $minutes === null && $schedule->tna_start_time && $schedule->tna_end_time ) { $startMinutes = (int) substr($schedule->tna_start_time, 0, 2) * 60 + (int) substr($schedule->tna_start_time, 3, 2); $endMinutes = (int) substr($schedule->tna_end_time, 0, 2) * 60 + (int) substr($schedule->tna_end_time, 3, 2); $minutes = max(0, $endMinutes - $startMinutes); } $totalMinutes += (int) $minutes; } $totalHours = $totalMinutes ? intdiv($totalMinutes, 60) : 0; $totalRemainder = $totalMinutes ? $totalMinutes % 60 : 0; @endphp Total Durasi: {{ $totalHours ? $totalHours . ' jam' . ($totalRemainder ? ' ' . $totalRemainder . ' menit' : '') : ($totalRemainder ? $totalRemainder . ' menit' : '0 menit') }} @endif @if ($list->status != 'finish' && $authorize->add == '1') @endif

@if (count($participant_pool) == 0)
Notice: Add TNA participants in the Header tab first before adding schedules.
@endif
@forelse ($schedules as $index => $schedule) @php $durationMinutes = $schedule->duration_minutes; if ( $durationMinutes === null && $schedule->tna_start_time && $schedule->tna_end_time ) { $startMinutes = (int) substr($schedule->tna_start_time, 0, 2) * 60 + (int) substr($schedule->tna_start_time, 3, 2); $endMinutes = (int) substr($schedule->tna_end_time, 0, 2) * 60 + (int) substr($schedule->tna_end_time, 3, 2); $durationMinutes = max(0, $endMinutes - $startMinutes); } $durationHours = $durationMinutes ? intdiv((int) $durationMinutes, 60) : 0; $durationRemainder = $durationMinutes ? (int) $durationMinutes % 60 : 0; $durationLabel = !$durationMinutes ? '-' : ($durationHours ? $durationHours . ' jam' . ($durationRemainder ? ' ' . $durationRemainder . ' menit' : '') : $durationRemainder . ' menit'); @endphp @empty @endforelse
No Date Duration Trainer Participants Status
{{ $index + 1 }} {{ \Carbon\Carbon::parse($schedule->tna_date)->translatedFormat('l, d F Y') }}
{{ $schedule->tna_start_time ? substr($schedule->tna_start_time, 0, 5) : '-' }} - {{ $schedule->tna_end_time ? substr($schedule->tna_end_time, 0, 5) : '-' }}
{{ $durationLabel }} {{ $schedule->trainer_name ?: '-' }}
{{ ucfirst($schedule->institution_name ?? 'internal') }}{{ $schedule->trainer_nik ? ' · ' . $schedule->trainer_nik : '' }}
@foreach ($schedule->participant_list as $participant) {{ $participant['name'] }} @endforeach @if ($schedule->status == 'aktif') Active @else Completed @endif

No schedules yet

{{-- Unified edit: choose participants by department --}} {{-- Unified edit: choose participants for a schedule --}} {{-- Description Modal --}} {{-- Edit Participants Modal --}} {{-- Add Schedule Modal --}} {{-- Reschedule Modal --}} @endsection @push('js') {{-- Select2 JS (local asset) --}} @endpush