@extends('layouts.admin') @section('title', 'Dashboard') @section('content')

Dashboard Pentadbir

{{ now()->format('d M Y, H:i') }}
{{-- Baris 1: Pengguna & Projek --}}
{{ $stats['users_active'] }}
Pengguna Aktif
{{ $stats['users_total'] }} jumlah • {{ $stats['users_inactive'] }} dinyahaktif
{{ $stats['projects_total'] }}
Jumlah Projek
+{{ $stats['projects_last_7'] }} (7 hari) • +{{ $stats['projects_last_30'] }} (30 hari)
{{ $stats['projects_completed'] }}
Transkripsi Selesai
@php $pct = $stats['projects_total'] > 0 ? round($stats['projects_completed'] / $stats['projects_total'] * 100) : 0; @endphp
{{ $pct }}% kadar kejayaan
@php $totalBytes = $stats['storage_bytes']; if ($totalBytes >= 1073741824) { $storageLabel = number_format($totalBytes / 1073741824, 2) . ' GB'; } elseif ($totalBytes >= 1048576) { $storageLabel = number_format($totalBytes / 1048576, 1) . ' MB'; } else { $storageLabel = number_format($totalBytes / 1024, 0) . ' KB'; } $durationH = intdiv($stats['duration_total_seconds'], 3600); $durationM = intdiv($stats['duration_total_seconds'] % 3600, 60); @endphp
{{ $storageLabel }}
Storan Digunakan
{{ $durationH }}j {{ $durationM }}m jumlah audio
{{-- Baris 2: Status + Trend --}}
Status Transkripsi
@php $statusRows = [ ['bg-secondary', 'Menunggu', $stats['projects_pending']], ['bg-warning text-dark', 'Sedang Diproses', $stats['projects_processing']], ['bg-success', 'Selesai', $stats['projects_completed']], ['bg-danger', 'Gagal', $stats['projects_failed']], ['bg-light text-muted border', 'Dipadam (soft)', $stats['projects_deleted']], ]; @endphp @foreach($statusRows as [$cls, $label, $count]) @endforeach
{{ $label }} {{ $count }} @if($stats['projects_total'] > 0) {{ round($count / ($stats['projects_total'] ?: 1) * 100) }}% @endif
Trend 30 Hari Lepas
@if($trendRaw->isEmpty())
Tiada data projek dalam 30 hari lepas.
@else
@foreach($trendRaw->sortByDesc('date') as $row) @endforeach
Tarikh Baru Selesai Gagal
{{ \Carbon\Carbon::parse($row->date)->format('d/m') }} {{ $row->total }} {{ $row->completed }} {{ $row->failed }}
@endif
Pengguna Paling Aktif
@if($topUsers->isEmpty())
Tiada data pengguna.
@else @foreach($topUsers as $i => $u) @endforeach
{{ $i + 1 }}
{{ $u->name }}
{{ $u->email }}
{{ $u->owned_projects_count }}
@endif
{{-- Baris 3: Jabatan + Tindakan Pantas --}}
Projek Mengikut Jabatan
@if($deptStats->isEmpty())
Tiada data jabatan.
@else @foreach($deptStats as $dept) @endforeach
{{ $dept->name }} {{ $dept->project_count }}
@endif
@endsection