diff --git a/README.md b/README.md index 8d688c59..775db218 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.3.7-yellow.svg?style=flat)](https://github.com/xodivorce/infra-xodivorce-in/) +[![version](https://img.shields.io/badge/version-v1.3.8-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/_admin_overview.php b/src/assets/admin/_admin_overview.php index 4abec946..68b05c3e 100755 --- a/src/assets/admin/_admin_overview.php +++ b/src/assets/admin/_admin_overview.php @@ -1,4 +1,5 @@ query($sql); $deptStats = []; @@ -34,6 +32,15 @@ while ($row = $result->fetch_assoc()) { $deptStats[$row['category']] = $row; } +foreach ($departments as $dept) { + if (!isset($deptStats[$dept])) { + $deptStats[$dept] = [ + 'opened_count' => 0, + 'progress_count' => 0 + ]; + } +} + function getStatusConfig($status) { switch ($status) { case 'Operational': @@ -78,7 +85,7 @@ function getIconPath($name) { return 'M5 12h.01M12 12h.01M19 12h.01M6 12a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0z'; } - +$services = []; $activeServices = 0; $maintenanceCount = 0; $highPriority = 0; @@ -110,8 +117,6 @@ foreach ($departments as $dept) { $totalServices = count($services); -$activeIncidents = $maintenanceCount + $highPriority; - if ($highPriority > 0) { $sysData = [ 'status' => 'System Alert', @@ -143,6 +148,20 @@ if ($highPriority > 0) { 'svg' => '' ]; } + +if (isset($_GET['ajax']) && $_GET['ajax'] === '1') { + header('Content-Type: application/json'); + echo json_encode([ + 'services' => $services, + 'stats' => [ + 'activeServices' => $activeServices, + 'maintenance' => $maintenanceCount, + 'outage' => $highPriority, + 'system' => $sysData + ] + ]); + exit; +} ?>
@@ -197,7 +216,7 @@ if ($highPriority > 0) {

Active System

-

+

/

services inactive

@@ -210,7 +229,7 @@ if ($highPriority > 0) {

In Maintenance

-

+

Fixing the things

@@ -221,7 +240,7 @@ if ($highPriority > 0) {

Outage System

-

+

Take an action now

@@ -237,7 +256,7 @@ if ($highPriority > 0) { Services Status -
+
{ + const color = + s.status === 'Outage' ? 'red' : + s.status === 'Maintenance' ? 'yellow' : + 'green'; + + grid.innerHTML += ` +
+

${s.name}

+

${s.msg}

+ +
+ `; + }); + + } catch (e) { + console.error('Status refresh failed', e); + } +} + +setInterval(refreshStatus, 3000); \ No newline at end of file diff --git a/src/pages/token/google_oauth_token.php b/src/pages/token/google_oauth_token.php index ffcb5203..f7661af7 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.7 + 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.8