@extends('layouts.app') @section('mobile-title', $folder->name) @section('mobile-subtitle', 'Folder contents') @section('mobile-back', $folder->parent_id ? route('documents.folders.show', $folder->parent_id) : route('documents.index')) @section('mobile-action-url', route('documents.upload.create', ['folder_id' => $folder->id])) @section('mobile-action-icon', 'upload') @section('mobile-action-label', 'Upload') @section('content') @php $fileIcon = function ($document) { $mime = $document->mime_type ?? ''; $name = strtolower($document->original_name ?? ''); return match (true) { str_contains($mime, 'pdf') || str_ends_with($name, '.pdf') => ['picture_as_pdf', 'text-red-700', 'bg-red-50'], str_starts_with($mime, 'image/') => ['image', 'text-[var(--construct-secondary)]', 'bg-[#e3f2ff]'], str_contains($mime, 'spreadsheet') || str_ends_with($name, '.csv') || str_ends_with($name, '.xlsx') => ['table_chart', 'text-emerald-800', 'bg-emerald-50'], str_contains($mime, 'word') || str_ends_with($name, '.doc') || str_ends_with($name, '.docx') => ['description', 'text-[var(--construct-secondary)]', 'bg-[#e3f2ff]'], str_contains($mime, 'message') || str_ends_with($name, '.eml') => ['mail', 'text-[var(--construct-secondary)]', 'bg-[#e3f2ff]'], default => ['draft', 'text-[var(--construct-muted)]', 'bg-[var(--construct-surface-container)]'], }; }; $humanSize = fn ($bytes) => $bytes >= 1048576 ? number_format($bytes / 1048576, 1).' MB' : number_format(max($bytes, 1) / 1024, 1).' KB'; $totalBytes = $folderDocumentStats['bytes'] ?? 0; $lastUpdated = $folderDocumentStats['updated_at'] ? \Illuminate\Support\Carbon::parse($folderDocumentStats['updated_at']) : $folder->updated_at; $recentActivity = $documents->getCollection() ->sortByDesc('updated_at') ->take(3) ->values(); $shareActivity = $documents->getCollection() ->flatMap(fn ($document) => $document->shares->flatMap(fn ($share) => $shareAuditLogs->get($share->id, collect()))) ->sortByDesc('created_at') ->take(4) ->values(); @endphp
Root @if ($folder->project) chevron_right {{ $folder->project->name }} @endif @if ($folder->parent) chevron_right {{ $folder->parent->name }} @endif chevron_right {{ $folder->name }}
folder_open

{{ $folder->name }}

{{ $folderDocumentStats['documents'] ?? $documents->total() }} document{{ ($folderDocumentStats['documents'] ?? $documents->total()) === 1 ? '' : 's' }} · {{ $humanSize($totalBytes) }} · Last updated {{ $lastUpdated->diffForHumans() }}

@can('update', $folder) create_new_folder New Sub-folder @endcan @can('upload', $folder) edit_document Create Document upload Upload Documents @endcan
@if ($folder->description)
{{ $folder->description }}
@endif
@can('update', $folder) @endcan
@if ($documents->isNotEmpty())
@csrf
@endif
@foreach ($children as $child) @endforeach @forelse ($documents as $document) @php [$icon, $iconColor, $iconBg] = $fileIcon($document); @endphp @empty @if ($children->isEmpty()) @endif @endforelse
@if ($documents->isNotEmpty()) @endif Name Status Owner Modified Size
folder_open {{ $child->name }} {{ $child->documents_count }} file{{ $child->documents_count === 1 ? '' : 's' }} - {{ $child->owner?->name ?? $child->creator->name }} {{ $child->updated_at->format('M j, Y') }} -
archived_at) class="rounded border-zinc-300 text-[var(--construct-primary)]"> {{ $icon }} {{ $document->title }} {{ $document->original_name }} · v{{ $document->version }} · {{ $document->document_type ?: 'Document' }}
@include('partials.status-badge', ['status' => $document->archived_at ? 'archived' : $document->status]) @if ($document->hasLegalHold()) @include('partials.status-badge', ['status' => 'legal_hold']) @elseif ($document->isExpired()) @include('partials.status-badge', ['status' => 'expired']) @elseif ($document->expiresSoon()) Expires soon @endif
{{ $document->owner?->name ?? $document->uploader->name }} {{ $document->updated_at->diffForHumans() }} {{ $humanSize($document->size) }}
No files or subfolders in this folder yet.
Showing {{ $documents->firstItem() ?? 0 }} to {{ $documents->lastItem() ?? 0 }} of {{ $documents->total() }} entries
{{ $documents->links() }}
@endsection