Rebuild notifications: bell panel and full page

- Bell opens a dropdown panel instead of a modal: Unread/All tabs, grouped
  by day, type icons, relative times, click-through marks read, per-row
  read/unread, mark all as read
- Unread badge refreshes every minute while the tab is visible
- Notifications page rebuilt on the same backend: search, type filter,
  date range, read/unread toggles, proper empty states
- Hide notifications for clients/modules the user cannot access
- Normalise relative notification links so they work from /admin pages
- Remove the old notifications modal and dismiss handlers
This commit is contained in:
johnnyq
2026-10-09 15:52:40 -04:00
parent f7e5655e05
commit bab3d73c86
14 changed files with 1166 additions and 363 deletions

View File

@@ -16,50 +16,6 @@ if(isset($_POST['change_records_per_page'])){
}
// In app notifications
if (isset($_GET['dismiss_notification'])) {
validateCSRFToken();
$notification_id = intval($_GET['dismiss_notification']);
mysqli_query($mysqli,"UPDATE notifications SET notification_dismissed_at = NOW(), notification_dismissed_by = $session_user_id WHERE notification_user_id = $session_user_id AND notification_id = $notification_id");
// Logging
logAudit("Notification", "Dismiss", "$session_name dismissed notification");
$_SESSION['alert_message'] = "Notification Dismissed";
redirect();
}
if (isset($_GET['dismiss_all_notifications'])) {
validateCSRFToken();
$sql = mysqli_query($mysqli,"SELECT notification_dismissed_at, notification_id FROM notifications WHERE notification_user_id = $session_user_id AND notification_dismissed_at IS NULL");
$num_notifications = mysqli_num_rows($sql);
while($row = mysqli_fetch_assoc($sql)) {
$notification_id = intval($row['notification_id']);
$notification_dismissed_at = escapeSql($row['notification_dismissed_at']);
mysqli_query($mysqli,"UPDATE notifications SET notification_dismissed_at = NOW(), notification_dismissed_by = $session_user_id WHERE notification_id = $notification_id");
}
// Logging
logAudit("Notification", "Dismiss", "$session_name dismissed $num_notifications notifications");
$_SESSION['alert_message'] = "<strong>$num_notifications</strong> Notifications Dismissed";
redirect();
}
// Revoke sharing (sharing itself is done via ajax.php)
if (isset($_GET['deactivate_shared_item'])) {