{{-- trseva/_partials/data_table.blade.php DataTable listing for trseva. Used by: trseva/list.blade.php --}} @php use App\Enums\EvaluationStatus; use App\Enums\TestType; @endphp
@foreach (($rows ?? $table_detail) as $i => $item) @endforeach
Action No Training Schedule Date TRN ID Training Type Test Type Participant Present Avg Score Essay
@php $detailUrl = !empty($item->exam_id) ? url($url_menu . '/detail/' . encrypt($item->exam_id)) : url($url_menu . '/detail/' . encrypt('SCH|' . $item->id_trn_schedule)); @endphp {{-- Show "koreksi Dulu" only if: ada essay yang dijawab AND belum semua Dikoreksi AND status masih pending --}} @php $hasAnsweredEssay = ($item->answered_essay_count ?? 0) > 0; $needsCorrection = !$item->is_fully_reviewed; $isPending = ($item->evaluation_status ?? EvaluationStatus::PENDING->value) == EvaluationStatus::PENDING->value; @endphp @if (!empty($item->exam_id) && $hasAnsweredEssay && $needsCorrection && $isPending) koreksi Dulu @endif
{{ $i + 1 }} {{ $item->training_name }} {{ $item->schedule_date ? \Carbon\Carbon::parse($item->schedule_date)->format('d/m/Y') : '-' }} {{ $item->id_trs_trn }} @if ((int) ($item->with_score ?? 0) === 1)
WITH SCORE
@else
WITHOUT SCORE
@endif
@if ($item->test_type) {{ strtoupper(str_replace('_', ' ', $item->test_type)) }} @else - @endif {{ $item->total_peserta ?? 0 }} {{ $item->total_hadir ?? 0 }} {{ ($item->avg_score ?? null) !== null ? number_format($item->avg_score, 1) : '-' }} @php $totalEssay = $item->total_essay ?? 0; $answeredEssay = $item->answered_essay_count ?? 0; @endphp @if ($totalEssay == 0) {{-- No essay questions --}} Tidak Ada @elseif ($answeredEssay == 0) {{-- Essay exists but no answers (tidak dijawab) --}} Tidak Dijawab
{{ $totalEssay }} soal @elseif ($item->is_fully_reviewed) {{-- All answered essays are reviewed --}} Dikoreksi
{{ $answeredEssay }}/{{ $totalEssay }} dijawab @else {{-- Some answered essays pending review --}} Belum Dikoreksi
{{ $answeredEssay }}/{{ $totalEssay }} dijawab @endif