@extends('layouts.app') @section('title', 'Dashboard Admin - SIAKAD') @section('page-title', 'Dashboard Admin') @section('content') @php $unreadNotifications = $notifications ?? collect(); $totalUnread = $unreadCount ?? 0; use App\Models\AcademicCalendar; // Data statistik mahasiswa per prodi $prodiStats = \App\Models\Prodi::withCount('mahasiswas')->get(); $totalMahasiswa = $prodiStats->sum('mahasiswas_count'); $maxCount = $prodiStats->max('mahasiswas_count') ?: 1; // Calendar data $upcomingEvents = AcademicCalendar::active() ->inRange(now()->format('Y-m-d'), now()->addDays(30)->format('Y-m-d')) ->orderBy('start_date') ->take(5) ->get(); $eventTypes = AcademicCalendar::getEventTypes(); @endphp

{{ \App\Models\Prodi::count() }}

Program Studi

{{ \App\Models\Dosen::count() }}

Dosen

{{ $totalMahasiswa }}

Mahasiswa

{{ \App\Models\Matakuliah::count() }}

Mata Kuliah

{{ $totalUnread }}

Notifikasi Baru

Statistik Mahasiswa per Program Studi

{{ $totalMahasiswa }}

Total Mahasiswa

{{ $prodiStats->count() }}

Program Studi

{{ $prodiStats->max('mahasiswas_count') ?: 0 }}

Prodi Terbanyak

{{ $prodiStats->min('mahasiswas_count') ?: 0 }}

Prodi Tersedikit
@php $topProdi = $prodiStats->sortByDesc('mahasiswas_count')->first(); @endphp @if($topProdi)
Prodi Paling Populer
{{ $topProdi->nama }}

{{ $topProdi->mahasiswas_count }} mahasiswa terdaftar

@endif
Notifikasi Terbaru
Lihat Semua
@forelse($unreadNotifications as $notif)
@if($notif->type == 'krs_approved')
@elseif($notif->type == 'krs_rejected')
@elseif($notif->type == 'krs_request')
@elseif($notif->type == 'nilai_new')
@elseif($notif->type == 'nilai_reminder')
@elseif($notif->type == 'jadwal_change')
@else
@endif
{{ $notif->title }}

{{ Str::limit($notif->message, 80) }}

{{ $notif->created_at->diffForHumans() }}
@empty

Belum ada notifikasi baru

@endforelse
Kalender Akademik
Jadwal kegiatan semester
Lihat Detail
Event Mendatang {{ $upcomingEvents->count() }}
@forelse($upcomingEvents as $event)
{{ Str::limit($event->title, 30) }}
{{ $event->start_date->format('d M') }} @if($event->start_date->format('Y-m-d') != $event->end_date->format('Y-m-d')) - {{ $event->end_date->format('d M Y') }} @endif
{{ $eventTypes[$event->event_type] ?? 'Event' }}
@empty

Tidak ada event terdekat

@endforelse
@push('scripts') @endpush @endsection