diff --git a/README.md b/README.md index f3bcdc85..a99267d7 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. [](https://github.com/xodivorce/infra-xodivorce-in/) -[](https://github.com/xodivorce/infra-xodivorce-in/) +[](https://github.com/xodivorce/infra-xodivorce-in/) [](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/schema/infra-xodivorce.sql b/schema/infra-xodivorce-in.sql similarity index 99% rename from schema/infra-xodivorce.sql rename to schema/infra-xodivorce-in.sql index b1dce7ec..8213ab3b 100644 --- a/schema/infra-xodivorce.sql +++ b/schema/infra-xodivorce-in.sql @@ -3,7 +3,7 @@ -- https://www.phpmyadmin.net/ -- -- Host: localhost --- Generation Time: Dec 30, 2025 at 05:41 PM +-- Generation Time: Dec 31, 2025 at 09:27 PM -- Server version: 10.4.28-MariaDB -- PHP Version: 8.2.4 @@ -18,7 +18,7 @@ SET time_zone = "+00:00"; /*!40101 SET NAMES utf8mb4 */; -- --- Database: `infra-xodivorce` +-- Database: `infra-xodivorce-in` -- -- -------------------------------------------------------- @@ -142,7 +142,7 @@ CREATE TABLE `reports` ( `title` varchar(255) NOT NULL, `category` varchar(100) NOT NULL, `priority` enum('Low','Medium','High') NOT NULL DEFAULT 'Low', - `status` enum('Open','In Progress','Resolved') NOT NULL DEFAULT 'Open', + `status` enum('Opened','In Progress','Resolved') NOT NULL DEFAULT 'Opened', `location` varchar(255) NOT NULL, `image_path` varchar(255) DEFAULT NULL, `map_link` text DEFAULT NULL, @@ -3382,13 +3382,13 @@ ALTER TABLE `languages` -- AUTO_INCREMENT for table `password_resets` -- ALTER TABLE `password_resets` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=88; + MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=89; -- -- AUTO_INCREMENT for table `reports` -- ALTER TABLE `reports` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14; + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22; -- -- AUTO_INCREMENT for table `translations` @@ -3400,7 +3400,7 @@ ALTER TABLE `translations` -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=69; + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=71; -- -- Constraints for dumped tables diff --git a/src/.env.example b/src/.env.example index 1276993d..faa2a5d3 100644 --- a/src/.env.example +++ b/src/.env.example @@ -23,8 +23,8 @@ GOOGLE_REFRESH_TOKEN= "Your Google Refresh Token Here" GOOGLE_DRIVE_FOLDER_ID= "Your Google Drive Folder ID Here" # Contact Information of various departments -HELPDESK_EMAIL= "Your Helpdesk Email Here" -HELPDESK_PHONE= "Your Helpdesk Phone Here" +IT_HELPDESK_EMAIL= "Your Helpdesk Email Here" +IT_HELPDESK_PHONE= "Your Helpdesk Phone Here" MANAGEMENT_EMAIL= "Your Management Email Here" MANAGEMENT_PHONE= "Your Management Phone Here" HEALTH_EMAIL= "Your Health Email Here" diff --git a/src/assets/users/_overview.php b/src/assets/users/_overview.php index 23531bfc..7a0e11ea 100755 --- a/src/assets/users/_overview.php +++ b/src/assets/users/_overview.php @@ -1,3 +1,49 @@ +query("SET time_zone = '+05:30'"); + +$totalResult = $conn->query("SELECT COUNT(*) FROM reports"); +$totalReports = $totalResult->fetch_row()[0]; + +$activeResult = $conn->query("SELECT COUNT(*) FROM reports WHERE status IN ('Opened', 'In Progress')"); +$activeReports = $activeResult->fetch_row()[0]; + +$resolvedResult = $conn->query("SELECT COUNT(*) FROM reports WHERE status = 'Resolved'"); +$resolvedReports = $resolvedResult->fetch_row()[0]; + +$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"; + +$recentResult = $conn->query($recentSql); +$recentActivity = $recentResult->fetch_all(MYSQLI_ASSOC); + +if (!function_exists('time_elapsed_string')) { + function time_elapsed_string($datetime, $full = false) { + $now = new DateTime; + $ago = new DateTime($datetime); + $diff = $now->diff($ago); + + $diff->w = floor($diff->d / 7); + $diff->d -= $diff->w * 7; + + $string = array('y' => 'yr', 'm' => 'mo', 'w' => 'wk', 'd' => 'd', 'h' => 'h', 'i' => 'min', 's' => 'sec'); + foreach ($string as $k => &$v) { + if ($diff->$k) { + $v = $diff->$k . '' . $v; + } else { + unset($string[$k]); + } + } + + if (!$full) $string = array_slice($string, 0, 1); + return $string ? implode(', ', $string) . ' ago' : 'just now'; + } +} +?> +
128
+= $totalReports ?>
All submissions overview
42
+= $activeReports ?>
In progress / Open
86
+= $resolvedReports ?>
Successfully closed
- Issue #1231 Resolved -
- 2h ago -Water leakage in park • 23/v/kpc-cst/33
-Issue 1234 submitted
- 5h ago ++ Issue #= $row['id'] ?> = htmlspecialchars($row['status']) ?> +
+ + = time_elapsed_string($row['updated_at']) ?> + ++ = htmlspecialchars($row['title']) ?> • = htmlspecialchars($row['username']) ?> +
+Pothole on Main Street • 23/v/kpc-cst/36
+ + +Status: In Progress
- 1d ago -Broken Street Light • 23/v/kpc-cst/37
-