Files
2026-09-21 14:43:32 +01:00

110 lines
5.9 KiB
PHP
Executable File

@extends('documentation::layouts.master')
@section('title', 'Documentation')
@section('content')
<div class="doc-page">
@include('documentation::partials.hero', [
'title' => 'Documentation Centre',
'subtitle' =>
'Create, control, publish, and archive operational documents from a clean professional register.',
])
@if (session('status'))
<div class="doc-alert">{{ session('status') }}</div>
@endif
<section class="doc-grid stats">
<article class="doc-card doc-stat"><strong>{{ $stats['total'] }}</strong><span>Total documents</span></article>
<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>
</section>
@if ($featuredDocuments->isNotEmpty())
<section class="doc-card" style="margin-bottom:18px;">
<div class="doc-card-header"><strong>Featured documents</strong></div>
<div class="doc-card-body doc-grid" style="grid-template-columns:repeat(auto-fit,minmax(220px,1fr));">
@foreach ($featuredDocuments as $featured)
<a class="doc-card doc-card-body" style="text-decoration:none;color:inherit;box-shadow:none;"
href="{{ route('documentation.documents.show', $featured) }}">
<span class="doc-badge {{ $featured->status }}">{{ ucfirst($featured->status) }}</span>
<h3 style="margin:12px 0 6px;">{{ $featured->title }}</h3>
<p class="doc-muted" style="margin:0;">{{ $featured->summary ?: 'No summary provided.' }}</p>
</a>
@endforeach
</div>
</section>
@endif
<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>
<div class="doc-card-body">
<form class="doc-filter" method="GET" action="{{ route('documentation.documents.index') }}">
<label for="sonar-input-9f8539cc9d" class="visually-hidden">Search title, reference, summary or body</label>
<input class="doc-input" name="search" value="{{ request('search') }}"
placeholder="Search title, reference, summary or body" id="sonar-input-9f8539cc9d">
<label class="sr-only" for="document_status">Status</label>
<select id="document_status" class="doc-select" name="status">
<option value="">All statuses</option>
@foreach ($statuses as $value => $label)
<option value="{{ $value }}" @selected(request('status') === $value)>{{ $label }}</option>
@endforeach
</select>
<label class="sr-only" for="document_category">Category</label>
<select id="document_category" 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>
</form>
<table class="doc-table">
<caption class="sr-only">Data table</caption>
<thead>
<tr>
<th>Document</th>
<th>Category</th>
<th>Status</th>
<th>Version</th>
<th>Updated</th>
<th></th>
</tr>
</thead>
<tbody>
@forelse($documents as $document)
<tr>
<td>
<a
href="{{ route('documentation.documents.show', $document) }}">{{ $document->title }}</a>
<div class="doc-muted">{{ $document->reference ?: 'No reference' }} ·
{{ $document->summary ?: 'No summary' }}</div>
</td>
<td>{{ $document->category?->name ?: 'Uncategorised' }}</td>
<td><span
class="doc-badge {{ $document->status }}">{{ ucfirst($document->status) }}</span>
</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>
</tr>
@empty
<tr>
<td colspan="6" class="doc-muted">No documents found.</td>
</tr>
@endforelse
</tbody>
</table>
<div style="margin-top:18px;">{{ $documents->links() }}</div>
</div>
</section>
</div>
@endsection