<?php require_once __DIR__ . '/includes/admin_bootstrap.php';
ugfx_require_permission('dashboard');
$adminTitle='Dashboard';
$news = ugfx_read_json($ugfx['storage']['news'], []);
$events = ugfx_read_json($ugfx['storage']['events'], []);
$requests = ugfx_read_json($ugfx['storage']['requests'], []);
$messages = ugfx_chat_messages(0);
$applications = ugfx_read_json($ugfx['storage']['applications'], []);
$pages = ugfx_get_pages(false);
$friends = ugfx_get_friends(999);
$djs = ugfx_read_json($ugfx['storage']['djs'], []);
$contact = ugfx_read_json($ugfx['storage']['contact'], []);
$chatStatus = ugfx_chat_public_status();
include __DIR__ . '/includes/admin_header.php';
?>
<div class="row g-4 mb-4">
  <div class="col-md-3"><div class="ugfx-card p-4"><div class="ugfx-micro-label">NEWS</div><h2><?= count($news) ?></h2><a class="btn ugfx-btn-outline btn-sm" href="news.php">Manage</a></div></div>
  <div class="col-md-3"><div class="ugfx-card p-4"><div class="ugfx-micro-label">EVENTS</div><h2><?= count($events) ?></h2><a class="btn ugfx-btn-outline btn-sm" href="events.php">Manage</a></div></div>
  <div class="col-md-3"><div class="ugfx-card p-4"><div class="ugfx-micro-label">PAGES</div><h2><?= count($pages) ?></h2><a class="btn ugfx-btn-outline btn-sm" href="pages.php">Manage</a></div></div>
  <div class="col-md-3"><div class="ugfx-card p-4"><div class="ugfx-micro-label">CHAT</div><h2><?= count($messages) ?></h2><div class="mb-2"><span class="ugfx-chip <?= $chatStatus['enabled'] ? 'ugfx-chip-blue' : '' ?>"><?= $chatStatus['enabled'] ? 'Public chat live' : 'Public chat off' ?></span></div><a class="btn ugfx-btn-outline btn-sm" href="chat.php">Moderate</a></div></div>
  <div class="col-md-3"><div class="ugfx-card p-4"><div class="ugfx-micro-label">FRIENDS</div><h2><?= count($friends) ?></h2><a class="btn ugfx-btn-outline btn-sm" href="friends.php">Manage</a></div></div>
  <div class="col-md-3"><div class="ugfx-card p-4"><div class="ugfx-micro-label">DJS / TEAM</div><h2><?= count($djs) ?></h2><a class="btn ugfx-btn-outline btn-sm" href="djs.php">Manage</a></div></div>
  <div class="col-md-3"><div class="ugfx-card p-4"><div class="ugfx-micro-label">REQUESTS</div><h2><?= count($requests) ?></h2><a class="btn ugfx-btn-outline btn-sm" href="requests.php">View queue</a></div></div>
  <div class="col-md-3"><div class="ugfx-card p-4"><div class="ugfx-micro-label">CONTACT</div><h2><?= count($contact) ?></h2><a class="btn ugfx-btn-outline btn-sm" href="contact.php">Review</a></div></div>
  <div class="col-md-4"><div class="ugfx-card p-4"><div class="ugfx-micro-label">APPLICATIONS</div><h2><?= count($applications) ?></h2><a class="btn ugfx-btn-outline btn-sm" href="applications.php">Review</a></div></div>
</div>
<div class="row g-4">
  <div class="col-lg-6"><div class="ugfx-card p-4"><div class="ugfx-micro-label">ADMIN UPGRADE</div><h3>What is live now</h3><div class="ugfx-admin-list"><div class="ugfx-admin-item">News now has create, edit, delete, and publish controls.</div><div class="ugfx-admin-item">Events and custom pages are now editable from the admin side.</div><div class="ugfx-admin-item">Friends/supporters cards are fully manageable.</div><div class="ugfx-admin-item">Team / DJ cards from the public team page now have their own editor.</div><div class="ugfx-admin-item">Contact form submissions from the public site now have their own queue.</div><div class="ugfx-admin-item">Schedule is editable for all 7 days with 24-hour slots.</div><div class="ugfx-admin-item">Chat moderation now includes delete, clear, system posts, promo schedules, and blocked words.</div></div></div></div>
  <div class="col-lg-6"><div class="ugfx-card p-4"><div class="ugfx-micro-label">NEXT NICE ADDITIONS</div><h3>Still worth doing later</h3><div class="ugfx-admin-list"><div class="ugfx-admin-item">WYSIWYG editor for pages and news.</div><div class="ugfx-admin-item">Image uploads for news, events, and pages.</div><div class="ugfx-admin-item">Role-based admin users and per-page permissions.</div><div class="ugfx-admin-item">Ban usernames / mute chat directly.</div></div></div></div>
</div>
<div class="row g-4 mt-1">
  <div class="col-lg-6"><div class="ugfx-card p-4"><div class="ugfx-micro-label">NEXT CHECKLIST</div><h3>Do these after upload</h3><div class="ugfx-admin-list"><div class="ugfx-admin-item">Hard refresh public chat and admin chat so the new chat switch and media loader are not cached.</div><div class="ugfx-admin-item">Test chat off → public chat page should show the offline card and posting should be blocked.</div><div class="ugfx-admin-item">Test one create/edit/delete cycle on news, events, pages, friends, DJs, requests, contact, and users.</div><div class="ugfx-admin-item">Add one new sticker and one new GIF file into the folders and confirm they appear automatically.</div><div class="ugfx-admin-item">Download one backup from the new Backup page before going live.</div></div></div></div>
  <div class="col-lg-6"><div class="ugfx-card p-4"><div class="ugfx-micro-label">SAFETY</div><h3>What was tightened in this pass</h3><div class="ugfx-admin-list"><div class="ugfx-admin-item">Old manual media manifest file can be removed now — folder scan is the source of truth.</div><div class="ugfx-admin-item">Public chat now respects the admin on/off switch at page level and API level.</div><div class="ugfx-admin-item">Requests admin now has status handling, filtering, delete, and clear done controls.</div><div class="ugfx-admin-item">Backup export now downloads your data and uploaded images in one zip.</div></div><div class="mt-3"><a class="btn ugfx-btn-primary btn-sm" href="backup.php"><i class="bi bi-download"></i> Download backup</a></div></div></div>
</div>
<?php include __DIR__ . '/includes/admin_footer.php'; ?>