Files
2026-09-02 17:08:57 +00:00

121 lines
5.5 KiB
PHP
Executable File

@extends('documentation::layouts.master')
@section('title', 'Archived Documents')
@section('content')
<div class="doc-page">
@include('documentation::partials.hero', [
'title' => 'Archived documents',
'subtitle' =>
'Soft-deleted documents are retained here with their files and attachments until permanently deleted.',
'actions' => [
[
'label' => 'Active documents',
'url' => route('documentation.documents.index'),
'class' => 'primary',
],
],
])
@if (session('status'))
<div class="doc-alert">{{ session('status') }}</div>
@endif
<section class="doc-card">
<div class="doc-card-header">
<div>
<strong>Archive</strong>
<div class="doc-muted">
Restore documents or permanently remove them and their stored files.
</div>
</div>
<span class="doc-badge archived">{{ $documents->total() }} archived</span>
</div>
<div class="doc-card-body">
<form class="doc-filter" method="GET" action="{{ route('documentation.documents.archived') }}">
<input
class="doc-input"
name="search"
value="{{ request('search') }}"
placeholder="Search archived documents"
>
<select class="doc-select" name="category">
<option value="">All categories</option>
@foreach ($categories as $category)
<option value="{{ $category->id }}" @selected((string) request('category') === (string) $category->id)>
{{ $category->name }}
</option>
@endforeach
</select>
<button class="doc-button primary" type="submit">Filter</button>
@if (request()->filled('search') || request()->filled('category'))
<a class="doc-button secondary" href="{{ route('documentation.documents.archived') }}">Clear</a>
@endif
</form>
<table class="doc-table">
<thead>
<tr>
<th>Document</th>
<th>Category</th>
<th>Version</th>
<th>Archived</th>
<th>Files</th>
<th style="text-align:right;">Actions</th>
</tr>
</thead>
<tbody>
@forelse ($documents as $document)
<tr>
<td>
<strong>{{ $document->title }}</strong>
<div class="doc-muted">
{{ $document->reference ?: 'No reference' }} ·
{{ $document->summary ?: 'No summary' }}
</div>
</td>
<td>{{ $document->category?->name ?: 'Uncategorised' }}</td>
<td>{{ $document->version }}</td>
<td>{{ $document->deleted_at?->format('d M Y H:i') }}</td>
<td>
{{ ($document->attachment_name ? 1 : 0) + $document->attachments->count() }}
</td>
<td>
<div class="doc-actions" style="justify-content:flex-end;">
<form method="POST"
action="{{ route('documentation.documents.restore', $document->id) }}">
@csrf
@method('PATCH')
<button class="doc-button success" type="submit">Restore</button>
</form>
<form method="POST"
action="{{ route('documentation.documents.force-destroy', $document->id) }}"
onsubmit="return confirm('Permanently delete this document? This will also delete every stored attachment and cannot be undone.')">
@csrf
@method('DELETE')
<button class="doc-button danger" type="submit">Delete permanently</button>
</form>
</div>
</td>
</tr>
@empty
<tr>
<td colspan="6" class="doc-muted">No archived documents found.</td>
</tr>
@endforelse
</tbody>
</table>
<div style="margin-top:18px;">
{{ $documents->links() }}
</div>
</div>
</section>
</div>
@endsection