<?php  if (!defined('DASHBOARD_ROOT')) { http_response_code(403); exit; } RBAC::enforce('manage.accounts'); $admins = Database::fetchAll("SELECT id, username, admin_level, account_type, status, last_login, created_at FROM users WHERE admin_level > 0 ORDER BY created_at"); $roleMap = [1 => 'Owner', 2 => 'Admin', 3 => 'Operator', 4 => 'Viewer']; $rows = []; foreach ($admins as $a) { $rows[] = [ $a["id"], UI::e($a["username"]), $roleMap[(int)$a["admin_level"]] ?? 'Level ' . $a["admin_level"], UI::e($a["account_type"] ?? 'staff'), UI::e($a["status"]), UI::e($a["last_login"] ?? 'Never'), UI::e($a["created_at"]), "<a class='btn btn-sm' href='javascript:void(0)' data-action='edit-admin' data-id='{$a["id"]}'><span>Edit</span></a>" ]; } echo UI::table(['ID', 'Username', 'Role', 'Type', 'Status', 'Last Login', 'Created', 'Actions'], $rows); 