{{-- resources/views/agent/files/index.blade.php --}} @extends('layouts.contentLayoutMaster') @section('title', 'Files') @php use Illuminate\Support\Facades\Route as Routes; use Illuminate\Support\Facades\Storage as Disk; use Illuminate\Support\Str; // Human-readable size function human_size($bytes) { $bytes = (int) ($bytes ?? 0); $units = ['B', 'KB', 'MB', 'GB', 'TB']; $i = 0; while ($bytes >= 1024 && $i < count($units) - 1) { $bytes /= 1024; $i++; } return number_format($bytes, $i ? 1 : 0) . ' ' . $units[$i]; } // Exclude archives/snapshots from this page $isArchiveFile = function ($file) { $cat = (string) ($file->category ?? ''); if (str_starts_with($cat, 'archive-') || $cat === 'purchased_archive') return true; if (!empty($file->snapshot_json)) return true; $notes = (string) ($file->notes ?? ''); return str_contains($notes, 'purchased_archive'); }; // Label for "Document" column $docLabelFor = function ($f) { return $f->document_type ?? ($f->doc_type ?? ($f->mime ?? ($f->category ?? '—'))); }; // Restrict to real file types for filter & upload $docTypes = ['pdf','word','excel','csv','image','text','ppt','zip','audio','video','json','xml','html','other']; // Archive link (use params if provided by controller) $archiveUrl = isset($archParams) ? route('agent.files.archive', $archParams) : route('agent.files.archive'); // Index URL (for "Clear display") $indexUrl = Routes::has('agent.files.index') ? route('agent.files.index') : (Routes::has('agent.files') ? route('agent.files') : url()->current()); // Only show rows when filters exist; otherwise leave body blank // NOTE: back to a single date range: upload_from / upload_to $showResults = request()->filled('title') || request()->filled('document_type') || request()->filled('upload_from') || request()->filled('upload_to') || request()->filled('q'); // flexible keyword @endphp @section('content')
| Title | Document | Upload Date | Last Modified Date | Size | Notes | Actions | |
|---|---|---|---|---|---|---|---|
| {{ $title }} | {{ is_string($doc) ? strtoupper($doc) : '—' }} | {{ optional($f->created_at)->format('Y-m-d H:i') }} | {{ optional($f->updated_at)->format('Y-m-d H:i') }} | {{ human_size($size) }} | {{ $notes !== '' ? Str::limit($notes, 120) : '—' }} |
|
|
| No matching documents. | |||||||