@extends('layouts.app') @section('mobile-title', $document->title) @section('mobile-subtitle', 'Document details') @section('mobile-back', route('documents.folders.show', $folder)) @section('mobile-action-url', route('documents.download', $document)) @section('mobile-action-icon', 'download') @section('mobile-action-label', 'Download') @section('content') @php $mime = $document->mime_type ?? ''; $name = strtolower($document->original_name ?? ''); $isPdf = str_contains($mime, 'pdf') || str_ends_with($name, '.pdf'); $isImage = str_starts_with($mime, 'image/'); $isText = in_array($mime, ['text/plain', 'text/csv', 'message/rfc822'], true); $previewUrl = $document->canPreview() && ! $document->archived_at ? route('documents.preview', $document) : null; $humanSize = $document->size >= 1048576 ? number_format($document->size / 1048576, 2).' MB' : number_format($document->size / 1024, 1).' KB'; $shareActivity = $document->shares->flatMap(fn ($share) => $shareAuditLogs->get($share->id, collect()))->take(6); $fileKind = match (true) { $isPdf => 'PDF', $isImage => 'Image', str_contains($mime, 'spreadsheet') || str_ends_with($name, '.csv') || str_ends_with($name, '.xlsx') => 'Spreadsheet', str_contains($mime, 'word') || str_ends_with($name, '.doc') || str_ends_with($name, '.docx') => 'Document', str_contains($mime, 'message') || str_ends_with($name, '.eml') => 'Email', default => 'File', }; @endphp
{{ $document->original_name }} · {{ $fileKind }} · v{{ $document->version }} · {{ $humanSize }}
{{ $mime ?: 'application/octet-stream' }}