@extends('layouts.app', ['title' => 'Review Usulan AI']) @section('content') @php $selectedSection = $selectedSection ?? 'all'; $reviewSections = $reviewSections ?? []; $consistencyReport = data_get($rps->ai_draft_payload, 'pipeline_meta.quality_meta.consistency_report', []); $sectionQuality = collect(data_get($consistencyReport, 'per_section', [])); $statusLabels = [ 'aman' => 'Aman', 'perlu_cek' => 'Perlu Cek', 'kurang_bukti' => 'Kurang Bukti', 'unknown' => 'Belum Dinilai', ]; $sectionPriority = [ 'kurang_bukti' => 0, 'perlu_cek' => 1, 'aman' => 2, 'unknown' => 3, ]; $sectionQuality = $sectionQuality ->sortBy(function ($section, $key) use ($sectionPriority, $reviewSections) { $statusKey = $section['status'] ?? 'unknown'; return [ $sectionPriority[$statusKey] ?? 99, $section['label'] ?? ($reviewSections[$key] ?? strtoupper((string) $key)), ]; }) ->map(fn ($section) => $section); $topPrioritySectionKey = $sectionQuality->keys()->first(); $visibleStatuses = collect(); if ($selectedSection === 'all') { $visibleStatuses = $visibleStatuses ->push($comparison['course_description']['status'] ?? 'same') ->concat(collect($comparison['study_materials']['suggested'] ?? [])->pluck('_status')) ->concat(collect($comparison['cpl']['suggested'] ?? [])->pluck('_status')) ->concat(collect($comparison['cpmk']['suggested'] ?? [])->pluck('_status')) ->concat(collect($comparison['sub_cpmk']['suggested'] ?? [])->pluck('_status')) ->concat(collect($comparison['main_references']['suggested'] ?? [])->pluck('_status')) ->concat(collect($comparison['supporting_references']['suggested'] ?? [])->pluck('_status')) ->concat(collect($comparison['meetings']['suggested'] ?? [])->pluck('_status')); } elseif ($selectedSection === 'study_materials') { $visibleStatuses = collect($comparison['study_materials']['suggested'] ?? [])->pluck('_status'); } elseif ($selectedSection === 'cpmk') { $visibleStatuses = collect($comparison['cpmk']['suggested'] ?? [])->pluck('_status'); } elseif ($selectedSection === 'meetings') { $visibleStatuses = collect($comparison['meetings']['suggested'] ?? [])->pluck('_status'); } $statusCounts = $visibleStatuses->filter()->countBy(); $selectedLabel = $selectedSection === 'all' ? 'Semua Bagian' : ($reviewSections[$selectedSection] ?? strtoupper($selectedSection)); @endphp
Kembali ke Detail RPS Edit Manual @if ($selectedSection === 'all')
@csrf
@else
@csrf
@endif

Review Usulan AI vs Draft Saat Ini

Halaman ini membantu membandingkan isi draft sekarang dengan usulan AI sebelum diterapkan. Fokus review saat ini: {{ $selectedLabel }}.

Status AI
{{ strtoupper($rps->ai_generation_status ?? 'idle') }}
Model
{{ $rps->ai_model ?: '-' }}
Generated At
{{ optional($rps->ai_generated_at)->format('d-m-Y H:i') ?: '-' }}
Response ID
{{ $rps->ai_response_id ?: '-' }}
Semua Bagian @foreach ($reviewSections as $key => $label) {{ $label }} @endforeach
@if ($sectionQuality->isNotEmpty())
@foreach ($sectionQuality as $key => $section) @php $statusKey = $section['status'] ?? 'unknown'; $sectionLabel = $section['label'] ?? ($reviewSections[$key] ?? strtoupper((string) $key)); $isPriorityFocus = $topPrioritySectionKey === $key && in_array($statusKey, ['kurang_bukti', 'perlu_cek'], true); @endphp
{{ $sectionLabel }} {{ $statusLabels[$statusKey] ?? ucfirst(str_replace('_', ' ', $statusKey)) }}
@if (! empty($section['notes']))
@foreach ($section['notes'] as $note)
{{ $note }}
@endforeach
@endif @if (isset($reviewSections[$key])) @endif
@endforeach
@endif
Baru Berbeda Sudah ada / sama
Baru {{ $statusCounts->get('new', 0) }} item
Berbeda {{ $statusCounts->get('changed', 0) }} item
Sudah ada {{ $statusCounts->get('same', 0) }} item
Item dengan status Sudah ada akan disembunyikan dari kolom usulan AI.
@if ($selectedSection === 'all')

Deskripsi Singkat MK

{{ $comparison['course_description']['current'] ?: '-' }}
{{ $comparison['course_description']['status'] === 'new' ? 'Baru' : ($comparison['course_description']['status'] === 'changed' ? 'Berbeda' : 'Sudah ada') }}
{{ $comparison['course_description']['suggested'] ?: '-' }}
@endif @if (in_array($selectedSection, ['all', 'study_materials'], true))

Bahan Kajian

@forelse ($comparison['study_materials']['current'] as $item)
{{ $item }}
@empty
Belum ada.
@endforelse
@forelse ($comparison['study_materials']['suggested'] as $item)
{{ $item['_status'] === 'new' ? 'Baru' : 'Sudah ada' }}
{{ $item['text'] }}
@empty
Belum ada.
@endforelse
@endif @if ($selectedSection === 'all') @foreach ([ 'cpl' => 'CPL', 'cpmk' => 'CPMK', 'sub_cpmk' => 'Sub-CPMK', ] as $key => $label)

{{ $label }}

@forelse ($comparison[$key]['current'] as $item)
{{ $item['code'] ?: 'Tanpa kode' }}
{{ $item['description'] }}
@empty
Belum ada.
@endforelse
@forelse ($comparison[$key]['suggested'] as $item)
{{ ($item['_status'] ?? 'same') === 'new' ? 'Baru' : 'Sudah ada' }} {{ $item['code'] ?: 'Tanpa kode' }}
{{ $item['description'] ?? '-' }}
@empty
Belum ada.
@endforelse
@endforeach @endif @if ($selectedSection === 'cpmk')

CPMK

@forelse ($comparison['cpmk']['current'] as $item)
{{ $item['code'] ?: 'Tanpa kode' }}
{{ $item['description'] }}
@empty
Belum ada.
@endforelse
@forelse ($comparison['cpmk']['suggested'] as $item)
{{ ($item['_status'] ?? 'same') === 'new' ? 'Baru' : 'Sudah ada' }} {{ $item['code'] ?: 'Tanpa kode' }}
{{ $item['description'] ?? '-' }}
@empty
Belum ada.
@endforelse
@endif @if ($selectedSection === 'all') @foreach ([ 'main_references' => 'Pustaka Utama', 'supporting_references' => 'Pustaka Pendukung', ] as $key => $label)

{{ $label }}

@forelse ($comparison[$key]['current'] as $item)
{{ $item['citation'] }}
@empty
Belum ada.
@endforelse
@forelse ($comparison[$key]['suggested'] as $item)
{{ ($item['_status'] ?? 'same') === 'new' ? 'Baru' : 'Sudah ada' }}
{{ $item['citation'] ?? '-' }}
@empty
Belum ada.
@endforelse
@endforeach @endif @if (in_array($selectedSection, ['all', 'meetings'], true))

Rencana Pembelajaran Mingguan 1–16

@foreach (range(1, 16) as $week) @php $current = $comparison['meetings']['current'][$week] ?? null; $suggested = $comparison['meetings']['suggested'][$week] ?? null; @endphp @endforeach
Pekan Draft Saat Ini Usulan AI
{{ $week }} @if ($current)
{{ strtoupper($current['session_type'] ?? 'regular') }}
Sub-CPMK: {{ $current['sub_cpmk'] ?: '-' }}
Indikator: {{ $current['indicator'] ?: '-' }}
Materi: {{ $current['study_material'] ?: '-' }}
Bobot: {{ $current['assessment_weight'] ?? '-' }}
@else - @endif
@if ($suggested)
{{ ($suggested['_status'] ?? 'same') === 'new' ? 'Baru' : (($suggested['_status'] ?? 'same') === 'changed' ? 'Berbeda' : 'Sudah ada') }}
{{ strtoupper($suggested['session_type'] ?? 'regular') }}
Sub-CPMK: {{ $suggested['sub_cpmk'] ?? '-' }}
Indikator: {{ $suggested['indicator'] ?? '-' }}
Materi: {{ $suggested['study_material'] ?? '-' }}
Bobot: {{ $suggested['assessment_weight'] ?? '-' }}
@else - @endif
@endif @endsection