180 lines
7.4 KiB
PHP
180 lines
7.4 KiB
PHP
|
|
<?= $this->extend('admin/layout') ?>
|
||
|
|
|
||
|
|
<?= $this->section('content') ?>
|
||
|
|
<div class="space-y-5 sm:space-y-6">
|
||
|
|
<!-- Welcome Card -->
|
||
|
|
<div class="rounded-lg border border-gray-200 bg-white p-6 dark:border-gray-800 dark:bg-white/[0.03]">
|
||
|
|
<h2 class="text-xl font-semibold text-gray-800 dark:text-white mb-2">
|
||
|
|
Selamat Datang, <?= esc(session()->get('username') ?? 'User') ?>!
|
||
|
|
</h2>
|
||
|
|
<p class="text-gray-600 dark:text-gray-400">
|
||
|
|
Ini adalah dashboard admin Bapenda Garut. Gunakan menu di sidebar untuk navigasi.
|
||
|
|
</p>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Stats Cards -->
|
||
|
|
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 md:gap-6 lg:grid-cols-4">
|
||
|
|
<!-- Total News Card -->
|
||
|
|
<div class="rounded-2xl border border-gray-200 bg-white p-5 dark:border-gray-800 dark:bg-white/[0.03] md:p-6">
|
||
|
|
<div class="flex h-12 w-12 items-center justify-center rounded-xl bg-brand-100 dark:bg-brand-900/20">
|
||
|
|
<i class="fe fe-file-text text-brand-600 dark:text-brand-400 text-xl"></i>
|
||
|
|
</div>
|
||
|
|
<div class="mt-5 flex items-end justify-between">
|
||
|
|
<div>
|
||
|
|
<span class="text-sm text-gray-500 dark:text-gray-400">Total Berita</span>
|
||
|
|
<h4 class="mt-2 text-title-sm font-bold text-gray-800 dark:text-white/90">
|
||
|
|
<?= number_format($stats['news']['total']) ?>
|
||
|
|
</h4>
|
||
|
|
<div class="mt-2 flex gap-2 text-xs text-gray-500 dark:text-gray-400">
|
||
|
|
<span>Published: <?= $stats['news']['published'] ?></span>
|
||
|
|
<span>•</span>
|
||
|
|
<span>Draft: <?= $stats['news']['draft'] ?></span>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Total Pages Card -->
|
||
|
|
<div class="rounded-2xl border border-gray-200 bg-white p-5 dark:border-gray-800 dark:bg-white/[0.03] md:p-6">
|
||
|
|
<div class="flex h-12 w-12 items-center justify-center rounded-xl bg-success-100 dark:bg-success-900/20">
|
||
|
|
<i class="fe fe-file text-success-600 dark:text-success-400 text-xl"></i>
|
||
|
|
</div>
|
||
|
|
<div class="mt-5 flex items-end justify-between">
|
||
|
|
<div>
|
||
|
|
<span class="text-sm text-gray-500 dark:text-gray-400">Total Halaman</span>
|
||
|
|
<h4 class="mt-2 text-title-sm font-bold text-gray-800 dark:text-white/90">
|
||
|
|
<?= number_format($stats['pages']['total']) ?>
|
||
|
|
</h4>
|
||
|
|
<div class="mt-2 flex gap-2 text-xs text-gray-500 dark:text-gray-400">
|
||
|
|
<span>Published: <?= $stats['pages']['published'] ?></span>
|
||
|
|
<span>•</span>
|
||
|
|
<span>Draft: <?= $stats['pages']['draft'] ?></span>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Total Users Card -->
|
||
|
|
<div class="rounded-2xl border border-gray-200 bg-white p-5 dark:border-gray-800 dark:bg-white/[0.03] md:p-6">
|
||
|
|
<div class="flex h-12 w-12 items-center justify-center rounded-xl bg-purple-100 dark:bg-purple-900/20">
|
||
|
|
<i class="fe fe-users text-purple-600 dark:text-purple-400 text-xl"></i>
|
||
|
|
</div>
|
||
|
|
<div class="mt-5 flex items-end justify-between">
|
||
|
|
<div>
|
||
|
|
<span class="text-sm text-gray-500 dark:text-gray-400">Total Pengguna</span>
|
||
|
|
<h4 class="mt-2 text-title-sm font-bold text-gray-800 dark:text-white/90">
|
||
|
|
<?= number_format($stats['users']['total']) ?>
|
||
|
|
</h4>
|
||
|
|
<div class="mt-2 text-xs text-gray-500 dark:text-gray-400">
|
||
|
|
<span>Aktif: <?= $stats['users']['active'] ?></span>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Published News Card -->
|
||
|
|
<div class="rounded-2xl border border-gray-200 bg-white p-5 dark:border-gray-800 dark:bg-white/[0.03] md:p-6">
|
||
|
|
<div class="flex h-12 w-12 items-center justify-center rounded-xl bg-warning-100 dark:bg-warning-900/20">
|
||
|
|
<i class="fe fe-check-circle text-warning-600 dark:text-warning-400 text-xl"></i>
|
||
|
|
</div>
|
||
|
|
<div class="mt-5 flex items-end justify-between">
|
||
|
|
<div>
|
||
|
|
<span class="text-sm text-gray-500 dark:text-gray-400">Berita Published</span>
|
||
|
|
<h4 class="mt-2 text-title-sm font-bold text-gray-800 dark:text-white/90">
|
||
|
|
<?= number_format($stats['news']['published']) ?>
|
||
|
|
</h4>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Recent Activity Table -->
|
||
|
|
<div class="rounded-2xl border border-gray-200 bg-white dark:border-gray-800 dark:bg-white/[0.03]">
|
||
|
|
<div class="px-5 py-4 sm:px-6 sm:py-5">
|
||
|
|
<h3 class="text-lg font-semibold text-gray-800 dark:text-white/90">
|
||
|
|
Aktivitas Terbaru
|
||
|
|
</h3>
|
||
|
|
</div>
|
||
|
|
<div class="max-w-full overflow-x-auto">
|
||
|
|
<table class="min-w-full">
|
||
|
|
<thead>
|
||
|
|
<tr class="border-b border-gray-100 dark:border-gray-800">
|
||
|
|
<th class="px-5 py-3 sm:px-6">
|
||
|
|
<div class="flex items-center">
|
||
|
|
<p class="font-medium text-gray-500 text-xs dark:text-gray-400">
|
||
|
|
Waktu
|
||
|
|
</p>
|
||
|
|
</div>
|
||
|
|
</th>
|
||
|
|
<th class="px-5 py-3 sm:px-6">
|
||
|
|
<div class="flex items-center">
|
||
|
|
<p class="font-medium text-gray-500 text-xs dark:text-gray-400">
|
||
|
|
User
|
||
|
|
</p>
|
||
|
|
</div>
|
||
|
|
</th>
|
||
|
|
<th class="px-5 py-3 sm:px-6">
|
||
|
|
<div class="flex items-center">
|
||
|
|
<p class="font-medium text-gray-500 text-xs dark:text-gray-400">
|
||
|
|
Aksi
|
||
|
|
</p>
|
||
|
|
</div>
|
||
|
|
</th>
|
||
|
|
<th class="px-5 py-3 sm:px-6">
|
||
|
|
<div class="flex items-center">
|
||
|
|
<p class="font-medium text-gray-500 text-xs dark:text-gray-400">
|
||
|
|
IP Address
|
||
|
|
</p>
|
||
|
|
</div>
|
||
|
|
</th>
|
||
|
|
</tr>
|
||
|
|
</thead>
|
||
|
|
<tbody class="divide-y divide-gray-100 dark:divide-gray-800">
|
||
|
|
<?php if (empty($recentAuditLogs)): ?>
|
||
|
|
<tr>
|
||
|
|
<td colspan="4" class="px-5 py-8 text-center sm:px-6">
|
||
|
|
<p class="text-gray-500 dark:text-gray-400">Tidak ada aktivitas terbaru.</p>
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
<?php else: ?>
|
||
|
|
<?php foreach ($recentAuditLogs as $log): ?>
|
||
|
|
<tr>
|
||
|
|
<td class="px-5 py-4 sm:px-6">
|
||
|
|
<div class="flex items-center">
|
||
|
|
<p class="text-gray-500 text-sm dark:text-gray-400">
|
||
|
|
<?= date('d M Y H:i', strtotime($log['created_at'])) ?>
|
||
|
|
</p>
|
||
|
|
</div>
|
||
|
|
</td>
|
||
|
|
<td class="px-5 py-4 sm:px-6">
|
||
|
|
<div class="flex items-center">
|
||
|
|
<p class="font-medium text-gray-800 text-sm dark:text-white/90">
|
||
|
|
<?= esc($log['username'] ?? 'System') ?>
|
||
|
|
</p>
|
||
|
|
</div>
|
||
|
|
</td>
|
||
|
|
<td class="px-5 py-4 sm:px-6">
|
||
|
|
<div class="flex items-center">
|
||
|
|
<p class="rounded-full bg-brand-50 px-2 py-0.5 text-xs font-medium text-brand-700 dark:bg-brand-500/15 dark:text-brand-500">
|
||
|
|
<?= esc($log['action']) ?>
|
||
|
|
</p>
|
||
|
|
</div>
|
||
|
|
</td>
|
||
|
|
<td class="px-5 py-4 sm:px-6">
|
||
|
|
<div class="flex items-center">
|
||
|
|
<p class="text-gray-500 text-sm dark:text-gray-400">
|
||
|
|
<?= esc($log['ip_address']) ?>
|
||
|
|
</p>
|
||
|
|
</div>
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
<?php endforeach; ?>
|
||
|
|
<?php endif; ?>
|
||
|
|
</tbody>
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<?= $this->endSection() ?>
|
||
|
|
|