@extends('layouts.admin')
@section('title','Dashboard') @section('page_title','Dashboard MWCNU Tugu') @section('page_subtitle','Monitoring, Action Center dan aktivitas organisasi')
@section('content')
<div class="grid dashboard-top"><section class="card hero-card"><h2>Assalamu'alaikum, {{ auth()->user()->name }} 👋</h2><p>{{ now()->translatedFormat('l, d F Y') }} • Ringkasan kerja organisasi hari ini.</p><div class="stat-grid">
<div class="stat"><span>👥</span><small>Pengurus</small><strong>{{ $stats['members'] }}</strong></div><div class="stat"><span>⌂</span><small>Ranting Aktif</small><strong>{{ $stats['rantings'] }}</strong></div><div class="stat"><span>▦</span><small>Banom/Lembaga</small><strong>{{ $stats['units'] }}</strong></div><div class="stat"><span>📈</span><small>Progres Program</small><strong>{{ $stats['program_progress'] }}%</strong></div><div class="stat"><span>✉</span><small>Surat Perlu Tindak</small><strong>{{ $stats['letters_pending'] }}</strong></div><div class="stat"><span>💬</span><small>WA 7 Hari</small><strong>{{ $stats['wa_clicks'] }}</strong></div>
</div></section><section class="card attention"><div class="section-head"><h3>Perlu Perhatian</h3><a href="{{ route('programs.index') }}">Lihat semua</a></div>@forelse($attention as $p)<div class="attention-row"><span class="warn">!</span><div><b>{{ $p->organization?->acronym }}</b><small>{{ $p->name }} • {{ $p->due_date?->format('d M Y') }}</small></div><span class="pill danger">{{ $p->progress }}%</span></div>@empty<div class="empty">Tidak ada program terlambat.</div>@endforelse</section></div>
<div class="grid performance"><section class="card span-2"><div class="section-head"><h3>Ringkasan Unit Aktif</h3><a href="{{ route('units.index') }}">Atur unit</a></div><div class="unit-performance">@foreach($orgs->whereNotNull('parent_id')->take(10) as $org) @php $pp=$org->programs()->avg('progress')??0; @endphp<div class="unit-score"><div class="donut" style="--p:{{ (int)$pp }}"><span>{{ (int)$pp }}%</span></div><b>{{ $org->acronym ?: $org->name }}</b><small>{{ $org->programs()->count() }} program</small></div>@endforeach</div></section><section class="card"><div class="section-head"><h3>Status Sistem</h3></div><div class="mini-row"><span class="dot"></span><span>Kegiatan bulan ini</span><b>{{ $stats['activities_month'] }}</b></div><div class="mini-row"><span class="dot"></span><span>Berita bulan ini</span><b>{{ $stats['news_month'] }}</b></div><div class="mini-row"><span class="dot"></span><span>Presensi aktif</span><b>{{ $stats['attendance_open'] }}</b></div><div class="mini-row"><span class="dot"></span><span>Popup aktif</span><b>{{ $stats['popup_active'] }}</b></div></section></div>
<div class="grid main-grid"><section class="card span-2"><div class="section-head"><h3>Live Audit Log</h3><a href="{{ route('audit.index') }}">Lihat semua</a></div>@forelse($audit as $log)<div class="audit-row"><time>{{ $log->created_at?->format('H:i') }}</time><span class="audit-icon">•</span><div><b>{{ $log->description }}</b><small>{{ $log->user?->name }} • {{ $log->organization?->acronym ?? 'MWCNU' }}</small></div><span class="pill">{{ ucfirst($log->module) }}</span></div>@empty<div class="empty">Belum ada aktivitas.</div>@endforelse</section><section class="card"><div class="section-head"><h3>Agenda Terdekat</h3><a href="{{ route('activities.index') }}">Kelola</a></div>@forelse($activities as $a)<div class="calendar-mini"><div class="calendar-box"><b>{{ $a->start_at?->format('d') }}</b><span>{{ strtoupper($a->start_at?->format('M')) }}</span></div><div><b>{{ $a->title }}</b><small>{{ $a->start_at?->format('H:i') }} • {{ $a->location ?: '-' }}</small></div></div>@empty<div class="empty">Belum ada agenda mendatang.</div>@endforelse</section></div>
<div class="card timeline"><div class="section-head"><h3>Akses Cepat</h3></div><div class="timeline-items"><a href="{{ route('attendance.index') }}"><span>✓</span><b>Generate Presensi</b><small>Link + lokasi + foto</small></a><a href="{{ route('letters.index') }}"><span>✉</span><b>Buat Surat</b><small>Administrasi unit</small></a><a href="{{ route('news.index') }}"><span>▰</span><b>Tulis Berita</b><small>MWCNU/Ranting/Unit</small></a><a href="{{ route('popups.index') }}"><span>▣</span><b>Popup</b><small>Aktif/nonaktif</small></a><a href="{{ route('rantings.index') }}"><span>⌂</span><b>Ranting</b><small>Tambah/nonaktifkan</small></a></div></div>
@endsection
