updaetd to roles and permissions

This commit is contained in:
Mark Gregory
2026-08-26 10:38:38 +01:00
parent af6ebe5730
commit 7fcef01be4
10 changed files with 456 additions and 21 deletions
@@ -0,0 +1,120 @@
@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
@@ -18,6 +18,16 @@
</div>
</section>
<div class="doc-actions" style="margin-top:18px;justify-content:flex-end;">
<form method="POST"
action="{{ route('documentation.documents.destroy', $document) }}"
onsubmit="return confirm('Archive this document? Its files and attachments will be retained.')">
@csrf
@method('DELETE')
<button class="doc-button warning" type="submit">Archive document</button>
</form>
</div>
@foreach ($document->attachments as $attachment)
<form id="delete-attachment-{{ $attachment->id }}" method="POST"
action="{{ route('documentation.documents.attachments.destroy', [$document, $attachment]) }}"
@@ -19,6 +19,7 @@
<article class="doc-card doc-stat"><strong>{{ $stats['published'] }}</strong><span>Published</span></article>
<article class="doc-card doc-stat"><strong>{{ $stats['drafts'] }}</strong><span>Drafts</span></article>
<article class="doc-card doc-stat"><strong>{{ $stats['categories'] }}</strong><span>Categories</span></article>
<article class="doc-card doc-stat"><strong>{{ $stats['archived'] }}</strong><span>Archived</span></article>
</section>
@if ($featuredDocuments->isNotEmpty())
@@ -40,7 +41,12 @@
<section class="doc-card">
<div class="doc-card-header">
<strong>Document register</strong>
<a class="doc-button success" href="{{ route('documentation.documents.create') }}">New document</a>
<div class="doc-actions">
<a class="doc-button secondary" href="{{ route('documentation.documents.archived') }}">
Archived documents ({{ $stats['archived'] }})
</a>
<a class="doc-button success" href="{{ route('documentation.documents.create') }}">New document</a>
</div>
</div>
<div class="doc-card-body">
<form class="doc-filter" method="GET" action="{{ route('documentation.documents.index') }}">
@@ -88,8 +94,19 @@
</td>
<td>{{ $document->version }}</td>
<td>{{ $document->updated_at?->format('d M Y H:i') }}</td>
<td><a class="doc-link"
href="{{ route('documentation.documents.edit', $document) }}">Edit</a></td>
<td>
<div class="doc-actions" style="justify-content:flex-end;">
<a class="doc-button primary"
href="{{ route('documentation.documents.edit', $document) }}">Edit</a>
<form method="POST"
action="{{ route('documentation.documents.destroy', $document) }}"
onsubmit="return confirm('Archive this document? Its files will be retained and it can be restored later.')">
@csrf
@method('DELETE')
<button class="doc-button warning" type="submit">Archive</button>
</form>
</div>
</td>
</tr>
@empty
<tr>
@@ -23,6 +23,20 @@
],
])
@if (session('status'))
<div class="doc-alert">{{ session('status') }}</div>
@endif
<div class="doc-actions" style="margin-bottom:18px;justify-content:flex-end;">
<form method="POST"
action="{{ route('documentation.documents.destroy', $document) }}"
onsubmit="return confirm('Archive this document? Its files and attachments will be retained.')">
@csrf
@method('DELETE')
<button class="doc-button warning" type="submit">Archive document</button>
</form>
</div>
<section class="doc-card">
<div class="doc-card-header">
<div>