feat: notification dropdown panel and /notifications page

This commit is contained in:
2026-06-13 16:48:05 -04:00
parent 25dfb517ee
commit e1b6650454
6 changed files with 450 additions and 40 deletions

View File

@@ -7,6 +7,7 @@ namespace ServerManager\Controllers;
use ServerManager\Core\App;
use ServerManager\Core\Session;
use ServerManager\Models\Server;
use ServerManager\Models\Notification;
use ServerManager\Services\MonitoringService;
use ServerManager\Services\AuditService;
@@ -80,4 +81,22 @@ class DashboardController
'data' => $data,
]);
}
public function notifications(): void
{
$userId = (int) Session::get('user_id');
$page = (int) ($_GET['page'] ?? 1);
$perPage = 20;
$notificationModel = new Notification();
$result = $notificationModel->getForUser($userId, $page, $perPage);
$unreadCount = $notificationModel->getUnreadCount($userId);
$this->view->display('notifications.index', [
'title' => 'Notifications - ServerManager',
'notifications' => $result['data'],
'pagination' => $result,
'unreadCount' => $unreadCount,
]);
}
}