{{-- Disk sayfasının altındaki kullanılan alan özeti. Beklenen: $stats (DiskController::getStorageStatistics) --}} @php $fmt = function ($bytes) { $bytes = (float) $bytes; $units = ['B', 'KB', 'MB', 'GB', 'TB']; $i = 0; while ($bytes >= 1024 && $i < count($units) - 1) { $bytes /= 1024; $i++; } return ($i === 0 ? number_format($bytes, 0) : number_format($bytes, 1, ',', '.')) . ' ' . $units[$i]; }; $typeMeta = [ 'image' => ['Görseller', '#22c55e', 'fa-image'], 'document' => ['Belgeler', '#3b82f6', 'fa-file-alt'], 'spreadsheet' => ['Tablolar', '#10b981', 'fa-file-excel'], 'presentation' => ['Sunumlar', '#f97316', 'fa-file-powerpoint'], 'video' => ['Videolar', '#ef4444', 'fa-video'], 'audio' => ['Sesler', '#8b5cf6', 'fa-music'], 'archive' => ['Arşivler', '#f59e0b', 'fa-file-archive'], 'other' => ['Diğer', '#64748b', 'fa-file'], ]; $used = (int) ($stats['used_size'] ?? 0); $quota = (int) ($stats['quota_size'] ?? 0); $pct = (float) ($stats['used_percent'] ?? 0); $level = $pct >= 95 ? 'danger' : ($pct >= 80 ? 'warn' : 'ok'); $segments = []; foreach (($stats['by_type'] ?? collect()) as $type => $row) { [$label, $color, $icon] = $typeMeta[$type] ?? $typeMeta['other']; $segments[] = ['label' => $label, 'color' => $color, 'icon' => $icon, 'bytes' => (int) $row->size, 'count' => (int) $row->count]; } usort($segments, fn ($a, $b) => $b['bytes'] <=> $a['bytes']); if (($stats['versions_size'] ?? 0) > 0) { $segments[] = ['label' => 'Eski sürümler', 'color' => '#a855f7', 'icon' => 'fa-clock-rotate-left', 'bytes' => (int) $stats['versions_size'], 'count' => null]; } if (($stats['other_size'] ?? 0) > 0) { $segments[] = ['label' => 'Küçük resim ve diğer', 'color' => '#94a3b8', 'icon' => 'fa-images', 'bytes' => (int) $stats['other_size'], 'count' => null]; } @endphp
Kullanılan toplam alan
{{ $fmt($used) }} @if($quota)/ {{ $fmt($quota) }}@endif
@if($quota) %{{ rtrim(rtrim(number_format($pct, 1, ',', ''), '0'), ',') }} dolu
{{ $fmt($stats['free_size'] ?? 0) }} boş alan
@endif
{{ number_format($stats['total_items'] ?? 0, 0, ',', '.') }} dosya · {{ number_format($stats['total_folders'] ?? 0, 0, ',', '.') }} klasör
{{-- Çubuk kotanın tamamını temsil eder; dolu kısım türlere bölünür --}} @if($level !== 'ok')
{{ $level === 'danger' ? 'Disk alanınız doldu sayılır; yeni yüklemeler reddedilebilir.' : 'Disk alanınızın büyük kısmı dolu.' }} Alan artırmak için sistem yöneticisiyle görüşün.
@endif @if($used > 0)
@foreach($segments as $seg)
{{ $seg['label'] }} {{ $fmt($seg['bytes']) }} @if($seg['count'] !== null)· {{ $seg['count'] }} dosya@endif
@endforeach
@else
Henüz dosya yüklenmedi; kullanılan alan 0 B.
@endif
@push('styles') @endpush