{{-- resources/views/documents/index.blade.php --}} @php $vehicle = app(\App\Support\VehicleContext::class)->current(); $title = ($vehicle?->call_sign ?? 'RTW') . ' – Dokumente'; $pageTitle = 'Dokumente'; $pageSubtitle = $vehicle ? trim( ($vehicle->call_sign ?? '') . ' • ' . ($vehicle->license_plate ?? '') . ' • Dokumentenablage nach Kategorien', ) : 'Dokumentenablage nach Kategorien'; $q = $filters['q'] ?? ''; $categoryId = $filters['category_id'] ?? null; // Counts für Sidebar (inkl. "Alle") $categoryCounts = []; foreach ($categories as $c) { $categoryCounts[$c->id] = 0; } foreach ($documents as $doc) { if ($doc->document_category_id) { $categoryCounts[$doc->document_category_id] = ($categoryCounts[$doc->document_category_id] ?? 0) + 1; } } $allCount = (int) ($documents->total() ?? $documents->count()); @endphp
{{-- Flash --}} @if (session('status'))
{{ session('status') }}
@endif {{-- Mobile: Kategorien & Filter Button --}}
{{-- Desktop Sidebar --}} {{-- Mobile Offcanvas Sidebar --}} {{-- Right: Liste --}}
{{-- Toolbar --}}
{{-- selected category bleibt erhalten --}} @if (!empty($categoryId)) @endif
@can('create', \App\Models\Document::class) @else @endcan
{{-- Table/Card Wrapper --}}

Dokumente

Anzeige: {{ empty($categoryId) ? 'Alle' : $categories->firstWhere('id', (int) $categoryId)?->name ?? 'Kategorie' }}
{{-- Mobile Cards --}}
@forelse($documents as $doc) @php $docDate = $doc->uploaded_at?->format('d.m.Y') ?? ($doc->created_at?->format('d.m.Y') ?? '—'); $uploaded = $doc->uploaded_at?->format('d.m.Y') ?? ($doc->created_at?->format('d.m.Y') ?? '—'); $uploader = $doc->uploader?->name ?? 'System'; $dl = \Illuminate\Support\Facades\URL::signedRoute('documents.download', [ 'document' => $doc->id, 'download' => 1, ]); $pv = \Illuminate\Support\Facades\URL::signedRoute('documents.download', [ 'document' => $doc->id, ]); @endphp
{{ $doc->original_name }}
{{ $doc->title }}
Kategorie
{{ $doc->category?->name ?? '—' }}
Upload
{{ $uploaded }}
Dok.-Datum
{{ $docDate }}
Von
{{ $uploader }}
Vorschau Download @can('delete', $doc)
@csrf @method('DELETE')
@endcan
@empty
Keine Dokumente vorhanden.
@endforelse
{{-- Desktop Table --}} @forelse($documents as $doc) @php $docDate = $doc->uploaded_at?->format('d.m.Y') ?? ($doc->created_at?->format('d.m.Y') ?? '—'); $uploaded = $doc->uploaded_at?->format('d.m.Y') ?? ($doc->created_at?->format('d.m.Y') ?? '—'); $uploader = $doc->uploader?->name ?? 'System'; $dl = \Illuminate\Support\Facades\URL::signedRoute('documents.download', [ 'document' => $doc->id, 'download' => 1, ]); $pv = \Illuminate\Support\Facades\URL::signedRoute('documents.download', [ 'document' => $doc->id, ]); @endphp @empty @endforelse {{-- Pagination --}}
{{ $documents->links() }}
{{-- Upload Modal (produktive Form) --}} {{-- Kategorien Modal (produktive Verwaltung) --}}