@extends('layouts.admin') @section('title', $document->title) @section('breadcrumb') @endsection @section('content')

{{ $document->title }}

{{ $document->category->name }} @php $statusMap = [ 'active' => 'bg-success', 'inactive' => 'bg-secondary', 'processing' => 'bg-warning', 'failed' => 'bg-danger', ]; @endphp {{ ucfirst($document->status) }} @if($document->effective_date) Kuat kuasa: {{ $document->effective_date->format('d/m/Y') }} @endif
Edit @if(auth()->user()->isAdmin())
@csrf
@endif
@csrf @method('PATCH')
{{-- Info Dokumen --}}
Maklumat Dokumen
@if($document->description)

{{ $document->description }}

@endif
Bahasa
{{ $document->language == 'ms' ? 'Bahasa Melayu' : 'English' }}
@if($document->expiry_date)
Tarikh Luput
{{ $document->expiry_date->format('d/m/Y') }}
@endif
Dicipta
{{ $document->created_at->format('d/m/Y H:i') }}
@if($document->tags)
@foreach($document->tags as $tag) {{ $tag }} @endforeach
@endif
{{-- Upload versi baru --}}
Upload Versi Baru
@csrf
Versi lama tidak akan dipadam.
{{-- Senarai Versi --}}
Sejarah Versi
@foreach($document->versions->sortByDesc('version_number') as $version) @endforeach
Versi Fail Status Diupload Tindakan
v{{ $version->version_number }} @if($version->is_current) Semasa @endif
{{ $version->original_filename }}
{{ $version->file_size_formatted }} @if($version->page_count) ยท {{ $version->page_count }} ms. @endif
@php $ps = [ 'indexed' => ['bg-success', 'Selesai'], 'processing' => ['bg-warning', 'Diproses'], 'embedding' => ['bg-warning', 'Embedding'], 'extraction_failed' => ['bg-danger', 'Gagal Extract'], 'failed' => ['bg-danger', 'Gagal'], 'pending' => ['bg-secondary', 'Menunggu'], ]; $pInfo = $ps[$version->processing_status] ?? ['bg-light text-dark', $version->processing_status]; @endphp {{ $pInfo[1] }} @if($version->hasFailed() && $version->processing_error)
{{ Str::limit($version->processing_error, 50) }} @endif
{{ $version->created_at->format('d/m/Y') }} @if($version->uploader)
{{ $version->uploader->name }} @endif
@if($version->processing_status === 'indexed') @endif
{{-- Preview Chunks (versi semasa) --}} @if($document->currentVersion && $document->currentVersion->processing_status === 'indexed')
Chunk Terkini ({{ $document->currentVersion->chunks->count() }} preview)
Lihat semua
@foreach($document->currentVersion->chunks->take(5) as $chunk)
Chunk #{{ $chunk->chunk_index + 1 }} @if($chunk->page_number) ms. {{ $chunk->page_number }} @endif @if($chunk->section_heading) {{ $chunk->section_heading }} @endif {{ $chunk->is_embedded ? 'Embedded' : 'Belum Embed' }}

{{ Str::limit($chunk->content, 200) }}

@endforeach
@endif
@endsection