@extends('layouts.app') @section('title','Document') @section('content')
Back to documents @can('update',$document)@if(!$document->trashed())
Edit details & dates

Delete this document?

{{ $document->title }} will be removed from the active list. Protected files and history remain until the retention policy allows permanent removal.

@csrf @method('DELETE')
@endif@endcan @if($document->trashed())
Archived record. Files cannot be downloaded. Retention protection continues to apply.
@endif
Expiry status{{ $document->expiry_status }}{{ $document->metadata_confirmed_at ? 'Dates saved for expiry alerts' : 'Enter and save the document dates' }}
Expiry date{{ $document->expires_on?->format('d M Y') ?? '—' }}Dates follow the company timezone

Document number: {{ $document->reference ?? '—' }} · Issue date: {{ $document->issued_on?->format('d M Y') ?? '—' }}

@if($document->category)

Company category: {{ $document->category->name }}

@endif @if($document->note)

Note: {{ $document->note }}

@endif
@php($latestFile=$versions->first()) @php($currentFiles=$latestFile?->upload_group ? $versions->where('upload_group',$latestFile->upload_group) : $versions->take(1)) @php($historyFiles=$versions->whereNotIn('id',$currentFiles->pluck('id')))
whereIn('status',['quarantined','scan_failed'])->isNotEmpty()) data-document-availability="{{ $base }}/documents/{{ $document->id }}/availability" @endif>

Document files

All pages and files belong to this document.

Private files
@include('documents.files-table',['fileRows'=>$currentFiles->sortBy(fn($file)=>$file->file_position ?? $file->id)])
@if($historyFiles->isNotEmpty())

Previous uploads

{{ $historyFiles->count() }} {{ $historyFiles->count()===1?'file':'files' }} retained in history

@php($historyPage=\App\Support\ListView::rows($historyFiles,'document_versions')) @include('documents.files-table',['fileRows'=>$historyPage])
@endif @can('update',$document)@if(!$document->trashed() && ($document->type->renewal_policy || $document->renewals()->exists()))

Compliance verification

Review required compliance details

@csrf @include('documents.metadata-form')
@if($ocrEnabled)View encrypted OCR suggestions@else

OCR is disabled for this workspace. Enter issue and expiry dates manually above.

@endif@if($ocr!==null)
{{ $ocr }}
@endif

To save dates before scanning finishes, use Edit details & dates above. Saving the main form activates ordinary expiry alerts. Compliance verification has stricter safety requirements.

@endif @if($document->legal_hold)

This document has an existing deletion hold. Release it only when the record no longer needs protection.

@csrf
@endif@endcan @can('compliance.manage')@if(!$document->trashed())

Renewal tasks

Assign responsibility and track renewal progress.

@foreach($document->renewals()->latest('id')->get() as $renewal)

Renewal #{{ $renewal->id }} · {{ str_replace('_',' ',$renewal->status) }}

Owner: {{ $owners->firstWhere('id',$renewal->owner_id)?->name }} · Due {{ app(\App\Domain\Organization\WorkspaceFormat::class)->date($renewal->due_on) }} · {{ $renewal->currency }} {{ $renewal->cost ?? '—' }}

@if($renewal->status==='open')
@csrf
@elseif($renewal->status==='pending_verification')
@csrf @include('documents.metadata-form')
@endif
@endforeach
Assign a renewal · Choose who will handle it

Use this when a new document or validity period is needed. Approval alone does not complete renewal.

@csrf
@endif @endcan @can('documents.manage')

Access audit

Who accessed this document

A read-only history of file access, including the user, time, action and whether access was allowed.

@php($uiRows2=\App\Support\ListView::rows($access,'document_access_logs'))
@forelse($uiRows2 as $log)@empty@endforelse
Time (UTC)User IDActionResult
{{ $log->created_at->format('d M Y H:i:s') }}{{ $log->user_id }}{{ $log->action }}{{ $log->result }}
No content accesses yet.
@endcan

Change history

@forelse($history as $entry)

{{ $entry->created_at->format('d M Y H:i') }} UTC · {{ $owners->firstWhere('id',$entry->actor_id)?->name ?? 'System / former user' }} · {{ ucfirst(str_replace(['document.','_'],['',' '],$entry->action)) }}

@empty

No recorded changes.

@endforelse{{ $history->withQueryString()->links() }}
@endsection