@extends('layouts.app') @section('title', 'Gestión de Archivos') @section('content')

Gestión de Archivos

@forelse($files as $file) @empty @endforelse
Tipo Archivo Categoría Tamaño Estado Subido por Fecha Acciones
{{ $file->original_name }}
{{ $file->file_name }}
{{ ucfirst($file->category) }} {{ formatBytes($file->file_size) }} {{ $file->is_verified ? 'Verificado' : 'Pendiente' }} {{ $file->uploadedBy->name ?? 'Sistema' }} {{ $file->created_at->format('d/m/Y H:i') }}
@if(!$file->is_verified) @endif @can('file-upload-delete') @endcan
No hay archivos disponibles
@if($files->hasPages())
{{ $files->links() }}
@endif
@endsection @push('scripts') @endpush @php function getFileIcon($type, $mimeType) { $icons = [ 'document' => 'fa-file-alt', 'image' => 'fa-file-image', 'backup' => 'fa-database', 'config' => 'fa-cog', 'report' => 'fa-chart-bar' ]; if (isset($icons[$type])) { return $icons[$type]; } if (strpos($mimeType, 'image/') === 0) return 'fa-file-image'; if (strpos($mimeType, 'text/') === 0) return 'fa-file-alt'; if (strpos($mimeType, 'application/pdf') === 0) return 'fa-file-pdf'; return 'fa-file'; } function getFileColor($type) { $colors = [ 'document' => 'primary', 'image' => 'success', 'backup' => 'warning', 'config' => 'info', 'report' => 'danger' ]; return $colors[$type] ?? 'secondary'; } function getCategoryColor($category) { $colors = [ 'contratos' => 'primary', 'pagos' => 'success', 'sistema' => 'warning', 'reportes' => 'info', 'backup' => 'danger', 'documentos' => 'secondary' ]; return $colors[$category] ?? 'dark'; } function formatBytes($bytes, $precision = 2) { $units = array('B', 'KB', 'MB', 'GB', 'TB'); for ($i = 0; $bytes > 1024 && $i < count($units) - 1; $i++) { $bytes /= 1024; } return round($bytes, $precision) . ' ' . $units[$i]; } function getMaxUploadSize() { return min( ini_get('upload_max_filesize'), ini_get('post_max_size'), ini_get('memory_limit') ); } @endphp