diff --git a/README.md b/README.md index dcab1c4f..b7c0afea 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ #### A real-time map-based reporting system for campus infrastructure issues, built to improve visibility, accountability, and resolution efficiency. [![status](https://img.shields.io/badge/status-active-brightgreen.svg?style=flat)](https://github.com/xodivorce/infra-xodivorce-in/) -[![version](https://img.shields.io/badge/version-v1.4.0-yellow.svg?style=flat)](https://github.com/xodivorce/infra-xodivorce-in/) +[![version](https://img.shields.io/badge/version-v1.3.5-yellow.svg?style=flat)](https://github.com/xodivorce/infra-xodivorce-in/) [![PRs](https://img.shields.io/badge/PRs-welcome-blue.svg?style=flat)](https://github.com/xodivorce/infra-xodivorce-in/) > **🥰 Like this project? Please consider giving it a Star (🌟) on GitHub to show us your appreciation. Thank you!** diff --git a/src/assets/admin/_system_logs.php b/src/assets/admin/_system_logs.php index 6aa77255..d0463bbc 100755 --- a/src/assets/admin/_system_logs.php +++ b/src/assets/admin/_system_logs.php @@ -1,244 +1,191 @@ +Access Denied"; + exit; +} + +$sql = "SELECT r.id, r.title, r.priority, r.status, r.created_at, r.updated_at, u.username, u.email, u.is_admin + FROM reports r + JOIN users u ON r.user_id = u.id"; +$result = $conn->query($sql); + +$logs = []; + +if ($result->num_rows > 0) { + while ($row = $result->fetch_assoc()) { + + $logs[] = [ + 'timestamp' => strtotime($row['created_at']), + 'formatted_time' => date("M j, Y • H:i", strtotime($row['created_at'])), + 'actor_name' => $row['username'], + 'actor_email' => $row['email'], + 'actor_role' => $row['is_admin'] ? 'Administrator' : 'User', + 'action' => 'Created report', + 'report_id' => $row['id'], + 'title' => htmlspecialchars($row['title']), + 'priority' => $row['priority'], + 'status' => 'Opened', + 'is_update' => false + ]; + + if (strtotime($row['updated_at']) > strtotime($row['created_at'])) { + $actionText = 'Updated status'; + if ($row['status'] === 'Resolved') $actionText = 'Resolved report'; + if ($row['status'] === 'In Progress') $actionText = 'Marked In Progress'; + + $logs[] = [ + 'timestamp' => strtotime($row['updated_at']), + 'formatted_time' => date("M j, Y • H:i", strtotime($row['updated_at'])), + 'actor_name' => 'System Admin', + 'actor_email' => 'admin@system', + 'actor_role' => 'Administrator', + 'action' => $actionText, + 'report_id' => $row['id'], + 'title' => htmlspecialchars($row['title']), + 'priority' => $row['priority'], + 'status' => $row['status'], + 'is_update' => true + ]; + } + } +} + +usort($logs, function($a, $b) { + return $b['timestamp'] - $a['timestamp']; +}); + +$itemsPerPage = 6; +$totalItems = count($logs); +$totalPages = ceil($totalItems / $itemsPerPage); + +$page = isset($_GET['p']) ? (int)$_GET['p'] : 1; + +if ($page < 1) $page = 1; +if ($page > $totalPages && $totalPages > 0) $page = $totalPages; + +$offset = ($page - 1) * $itemsPerPage; +$currentLogs = array_slice($logs, $offset, $itemsPerPage); +?> +
+
-

Activity Logs

-

Recent system and user activities

+

System Logs

+

+ Administrative and user actions across reports +

-
-
-
- - -
-
- - -
-
- - -
-
- - -
-
-
- -
-
+
+
- + - + - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + 'text-red-400', + 'Medium' => 'text-yellow-400', + 'Low' => 'text-blue-400', + default => 'text-neutral-400' + }; + + $statusConfig = match($log['status']) { + 'Resolved' => ['text' => 'text-green-400', 'bg' => 'bg-green-500/10', 'border' => 'border-green-500/20', 'icon' => 'text-green-500', 'path' => 'M5 13l4 4L19 7'], + 'In Progress' => ['text' => 'text-yellow-400', 'bg' => 'bg-yellow-500/10', 'border' => 'border-yellow-500/20', 'icon' => 'text-yellow-500', 'path' => 'M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z'], + 'Opened' => ['text' => 'text-blue-400', 'bg' => 'bg-blue-500/10', 'border' => 'border-blue-500/20', 'icon' => 'text-blue-500', 'path' => 'M12 4v16m8-8H4'], + default => ['text' => 'text-neutral-400', 'bg' => 'bg-neutral-500/10', 'border' => 'border-neutral-500/20', 'icon' => 'text-neutral-500', 'path' => 'M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z'] + }; + ?> + + + + + + + + + + + + + + + + + +
TimestampTime Actor ActionRelated EntitySeverityReportPriorityStatus
2025-12-27 14:32:15admin@systemUpdated service configurationAPI Gateway - US-East - Info -
2025-12-27 14:28:43SystemService health check failedDatabase - EU-West - Warning -
2025-12-27 14:15:22john.doe@company.comGenerated monthly reportReport #1247 - Info -
2025-12-27 13:58:09SystemCritical alert triggeredLoad Balancer - APAC - Critical -
2025-12-27 13:45:31admin@systemModified user permissionsUser: jane.smith@company.com - Info -
2025-12-27 13:22:17SystemBackup completed successfullyAll Services - Info -
2025-12-27 12:58:44mark.wilson@company.comUpdated service statusCDN - US-West - Info -
2025-12-27 12:31:05SystemHigh memory usage detectedCache Server - EU-Central - Warning -
+ No system logs found. +
+ + +
+
+
+ + + # + + + + + + +
+
+ + + +
+ + + +
+
-
-
\ No newline at end of file diff --git a/src/assets/users/_overview.php b/src/assets/users/_overview.php index 053f4a52..d9b8a908 100755 --- a/src/assets/users/_overview.php +++ b/src/assets/users/_overview.php @@ -13,7 +13,7 @@ $recentSql = "SELECT r.*, u.username FROM reports r JOIN users u ON r.user_id = u.id ORDER BY r.updated_at DESC - LIMIT 5"; + LIMIT 6"; $recentResult = $conn->query($recentSql); $recentActivity = $recentResult->fetch_all(MYSQLI_ASSOC); diff --git a/src/pages/token/google_oauth_token.php b/src/pages/token/google_oauth_token.php index 9d9b63e9..09ba13ed 100644 --- a/src/pages/token/google_oauth_token.php +++ b/src/pages/token/google_oauth_token.php @@ -229,7 +229,7 @@ if (isset($_GET['code'])) { Need Help? Checkout Github Docs v1.3.3 + class="text-xs font-bold text-blue-400 bg-blue-500/10 px-2 py-0.5 rounded-full border border-blue-500/20">v1.3.5