diff --git a/healthcare.sql b/healthcare.sql deleted file mode 100644 index 8aafdcf321456597d0c351239b795c72015e0d0d..0000000000000000000000000000000000000000 --- a/healthcare.sql +++ /dev/null @@ -1,231 +0,0 @@ -/* - Navicat Premium Dump SQL - - Source Server : Root - Source Server Type : MariaDB - Source Server Version : 101107 (10.11.7-MariaDB) - Source Host : localhost:3306 - Source Schema : healthcare - - Target Server Type : MariaDB - Target Server Version : 101107 (10.11.7-MariaDB) - File Encoding : 65001 - - Date: 11/12/2024 22:08:40 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for care_homes --- ---------------------------- -DROP TABLE IF EXISTS `care_homes`; -CREATE TABLE `care_homes` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `address` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `status` enum('approved','rejected','pending') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT 'pending', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of care_homes --- ---------------------------- -INSERT INTO `care_homes` VALUES (1, 'Hospital1', 'Cardiff', 'pending'); -INSERT INTO `care_homes` VALUES (2, 'Hospital2', 'Cardiff', 'pending'); -INSERT INTO `care_homes` VALUES (3, 'Hospital3', 'London', 'pending'); -INSERT INTO `care_homes` VALUES (4, 'Hospital4', 'London', 'pending'); -INSERT INTO `care_homes` VALUES (5, 'Hospital5', 'Manchester', 'pending'); -INSERT INTO `care_homes` VALUES (6, 'Hospital6', 'Manchester', 'pending'); -INSERT INTO `care_homes` VALUES (7, 'Hospital7', 'Cardiff', 'pending'); -INSERT INTO `care_homes` VALUES (8, 'Hospital8', 'Cardiff', 'pending'); -INSERT INTO `care_homes` VALUES (9, 'Hospital9', 'Cardiff', 'pending'); -INSERT INTO `care_homes` VALUES (10, 'Hospital10', 'Cardiff', 'pending'); - --- ---------------------------- --- Table structure for common_admin --- ---------------------------- -DROP TABLE IF EXISTS `common_admin`; -CREATE TABLE `common_admin` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `email` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `password` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `type` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `roleId` int(11) NULL DEFAULT NULL, - `phone` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `status` int(11) NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of common_admin --- ---------------------------- -INSERT INTO `common_admin` VALUES (1, '26497@qq.com', '$2a$10$5UzuKUxgR8H0RzLYrP.BUu8.76yKwMD4XkvJIu/xxB7AAHWfphFQm', 'commonAdmin', 1, '111', 'justnoww', 1); -INSERT INTO `common_admin` VALUES (2, '1234@qq.com', '$2a$10$iW/zeL9TLq55SHFaOfyfr.xFMvB4aD3CL2layeAlGC7CqZ9kcscA.', 'commonAdmin', 1, '123', 'BAa', 1); -INSERT INTO `common_admin` VALUES (3, '123cmy@qq.com', '$2a$10$u2KxNBaHuTVwX7KudUgyNelp8j2lymarXKkkUXfWBMRAgbPNryTuW', 'commonAdmin', 1, '123', 'cmy', 1); - --- ---------------------------- --- Table structure for device --- ---------------------------- -DROP TABLE IF EXISTS `device`; -CREATE TABLE `device` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `hospitalId` int(11) NULL DEFAULT NULL, - `name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `type` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `freeTime` datetime NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of device --- ---------------------------- -INSERT INTO `device` VALUES (1, 0, 'bed1', 'bed', '2024-12-02 09:51:12'); -INSERT INTO `device` VALUES (2, 2, 'bed2', 'bed', '2024-12-03 09:30:00'); -INSERT INTO `device` VALUES (3, 2, 'bed3', 'bed', '2025-12-05 10:30:35'); -INSERT INTO `device` VALUES (4, 2, 'instrument1', 'instrument', '2024-12-05 07:15:59'); -INSERT INTO `device` VALUES (5, 2, 'instrument5', 'instrument', '2024-12-05 10:30:00'); - --- ---------------------------- --- Table structure for hospital --- ---------------------------- -DROP TABLE IF EXISTS `hospital`; -CREATE TABLE `hospital` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `amountPatient` int(11) NULL DEFAULT NULL, - `maxAmount` int(11) NULL DEFAULT NULL, - `type` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `address` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `phone` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `status` int(11) NULL DEFAULT NULL, - `roleId` int(11) NULL DEFAULT NULL, - `email` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `password` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `patientId` int(11) NULL DEFAULT NULL, - `deviceId` int(11) NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of hospital --- ---------------------------- -INSERT INTO `hospital` VALUES (1, 'hospital1', 5, 200, 'hospital', 'beijing', '6371', 1, 3, 'hospital1@qq.com', '$2a$10$wvAZoj4V51MH/MLhVIrnG.NrY07/.Gn9Ar6JsyzRAubWtqbWzgKie', 0, 0); -INSERT INTO `hospital` VALUES (2, 'hospital2', 10, 50, 'hospital', 'cardiff', '123', 1, 3, 'hospital2@qq.com', '$2a$10$wvAZoj4V51MH/MLhVIrnG.NrY07/.Gn9Ar6JsyzRAubWtqbWzgKie', 0, 0); - --- ---------------------------- --- Table structure for hospital_device --- ---------------------------- -DROP TABLE IF EXISTS `hospital_device`; -CREATE TABLE `hospital_device` ( - `hospitalId` int(11) NULL DEFAULT NULL, - `deviceId` int(11) NULL DEFAULT NULL -) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of hospital_device --- ---------------------------- - --- ---------------------------- --- Table structure for nurse --- ---------------------------- -DROP TABLE IF EXISTS `nurse`; -CREATE TABLE `nurse` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `status` int(11) NULL DEFAULT NULL, - `hospitalId` int(11) NULL DEFAULT NULL, - `type` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `age` int(11) NULL DEFAULT NULL, - `phone` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `email` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `address` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of nurse --- ---------------------------- -INSERT INTO `nurse` VALUES (1, 'nn', 0, 2, 'nurse', 23, '111', '23453', 'Cardiff'); -INSERT INTO `nurse` VALUES (2, 'Li Xiaoming', 1, 2, 'nurse', 25, '222', '4399', 'Cardiff'); -INSERT INTO `nurse` VALUES (3, 'Sun Hao', 1, 2, 'nurse', 24, '123', '23576', 'Bute'); -INSERT INTO `nurse` VALUES (4, 'Wang Xiaoming', 0, 2, 'nurse', 26, '333', '34578', 'Cardiff'); -INSERT INTO `nurse` VALUES (5, 'Tian Hao', 0, 2, 'nurse', 30, '321', '24353', 'Cardiff'); - --- ---------------------------- --- Table structure for patient --- ---------------------------- -DROP TABLE IF EXISTS `patient`; -CREATE TABLE `patient` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `password` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `roleId` int(11) NULL DEFAULT NULL, - `status` int(11) NULL DEFAULT NULL, - `hospitalId` int(11) NULL DEFAULT NULL, - `type` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `age` int(11) NULL DEFAULT NULL, - `phone` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `email` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of patient --- ---------------------------- -INSERT INTO `patient` VALUES (1, 'Li Ming', '$2a$10$obgmyiqAuhIkBjuw3bROr.LkCh.Nb70e4dL8lwKjSsPxS8gSpQxSC', 2, 1, 0, 'patient', 20, '135', 'wwgwg@outlook.com'); -INSERT INTO `patient` VALUES (2, 'Li Hua', '$2a$10$obgmyiqAuhIkBjuw3bROr.LkCh.Nb70e4dL8lwKjSsPxS8gSpQxSC', 2, 0, 0, 'patient', 21, '166', 'ss@qq.com'); -INSERT INTO `patient` VALUES (3, 'Huang Li', '$2a$10$obgmyiqAuhIkBjuw3bROr.LkCh.Nb70e4dL8lwKjSsPxS8gSpQxSC', 2, 0, 0, 'patient', 13, '111', '22@qq.com'); -INSERT INTO `patient` VALUES (4, 'Xia Ming', '$2a$10$obgmyiqAuhIkBjuw3bROr.LkCh.Nb70e4dL8lwKjSsPxS8gSpQxSC', 2, 1, 2, 'patient', 61, '15', '131@qq.com'); -INSERT INTO `patient` VALUES (5, 'Xia Yu', '$2a$10$obgmyiqAuhIkBjuw3bROr.LkCh.Nb70e4dL8lwKjSsPxS8gSpQxSC', 2, 1, 2, 'patient', 33, '14315', 'xx@qq.com'); - --- ---------------------------- --- Table structure for patient_hospital --- ---------------------------- -DROP TABLE IF EXISTS `patient_hospital`; -CREATE TABLE `patient_hospital` ( - `hosptialId` int(11) NULL DEFAULT NULL, - `patientId` int(11) NULL DEFAULT NULL -) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of patient_hospital --- ---------------------------- - --- ---------------------------- --- Table structure for role --- ---------------------------- -DROP TABLE IF EXISTS `role`; -CREATE TABLE `role` ( - `roleId` int(11) NULL DEFAULT NULL, - `type` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL -) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of role --- ---------------------------- -INSERT INTO `role` VALUES (0, 'SUPER'); -INSERT INTO `role` VALUES (1, 'ADMIN'); -INSERT INTO `role` VALUES (2, 'PATIENT'); -INSERT INTO `role` VALUES (3, 'HOSPITAL'); - --- ---------------------------- --- Table structure for super_admin --- ---------------------------- -DROP TABLE IF EXISTS `super_admin`; -CREATE TABLE `super_admin` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `password` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `roleId` int(11) NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of super_admin --- ---------------------------- -INSERT INTO `super_admin` VALUES (1, '2649783657@qq.com', '$2a$10$5UzuKUxgR8H0RzLYrP.BUu8.76yKwMD4XkvJIu/xxB7AAHWfphFQm', 0); - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/src/main/resources/static/css/admin.css b/src/main/resources/static/css/admin.css index b5acb2260ee53ca8d95a1e508b3eb82b2539ff2e..c24a4db3d2df05c6c52a38ca4f21d1efc9c0c039 100644 --- a/src/main/resources/static/css/admin.css +++ b/src/main/resources/static/css/admin.css @@ -4,39 +4,111 @@ body { padding: 0; background-color: #f4f4f4; } +/* Sidebar Styling */ .sidebar { position: fixed; top: 0; left: 0; - width: 250px; height: 100vh; - background-color: #1f2937; + width: 250px; + background: #1f2937; + padding: 1.5rem 1rem; color: white; - padding: 1rem; display: flex; flex-direction: column; - gap: 0.5rem; /* ä¸ºæŒ‰é’®ä¹‹é—´å¢žåŠ é—´è· */ + box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1); + z-index: 1000; } -.sidebar .text-lg { + +/* Logo/Brand section */ +.sidebar-brand { + color: white; font-size: 1.25rem; - font-weight: bold; - margin-bottom: 1rem; + font-weight: 600; + padding: 1rem; + margin-bottom: 2rem; + border-bottom: 1px solid rgba(255, 255, 255, 0.1); } -.sidebar a { - padding: 0.75rem 1rem; - margin-bottom: 0.5rem; - color: white; + + +.sidebar .nav-item { + display: flex; + align-items: center; + padding: 0.875rem 1rem; + color: rgba(255, 255, 255, 0.8); text-decoration: none; border-radius: 0.5rem; - transition: background-color 0.3s ease; + margin: 0.25rem 0; + transition: all 0.3s ease; + cursor: pointer; } -.sidebar a:hover { - background-color: #4b5563; + +.sidebar .nav-item:before { + font-family: "Font Awesome 5 Free"; + font-weight: 900; + margin-right: 0.75rem; +} + +.sidebar a[data-content="hospital"]:before { + content: "\f0f8"; /* hospital icon */ +} + +.sidebar a[data-content="nursing"]:before { + content: "\f0f0"; /* user-nurse icon */ +} + +.sidebar .sign-out:before { + content: "\f2f5"; /* sign-out icon */ } + +.sidebar .nav-item:hover { + background: rgba(255, 255, 255, 0.1); + color: white; + transform: translateX(5px); +} + +.sidebar .sign-out { + margin-top: auto; + color: #ef4444; +} + +.sidebar .sign-out:hover { + background: #ef4444; + color: white; +} + .content { margin-left: 250px; padding: 2rem; + min-height: 100vh; +} + +/* Active state for sidebar items */ +.sidebar .nav-item.active { + background: #3b82f6; + color: white; +} + +.sidebar div[onclick="chooseOut()"] { + margin-top: auto; + color: #ef4444; + border-top: 1px solid rgba(255, 255, 255, 0.1); + padding-top: 1rem; +} + +.sidebar div[onclick="chooseOut()"]:hover { + background-color: #ef4444; + color: white; +} + +/* Content area adjustment */ +.content { + margin-left: 250px; + padding: 2rem; + min-height: 100vh; + background-color: #f9fafb; } + .table-container { margin-top: 2rem; padding: 1rem; diff --git a/src/main/resources/static/css/shared-nav.css b/src/main/resources/static/css/shared-nav.css new file mode 100644 index 0000000000000000000000000000000000000000..5b0e2f9cfdd522e933909c37606ea83f60ee8455 --- /dev/null +++ b/src/main/resources/static/css/shared-nav.css @@ -0,0 +1,73 @@ +.top-nav { + background: #1f2937; + padding: 1rem 2rem; + display: flex; + justify-content: space-between; + align-items: center; + box-shadow: 0 2px 8px rgba(0,0,0,0.15); + position: fixed; + top: 0; + left: 0; + right: 0; + z-index: 1000; +} + +.nav-brand { + color: white; + font-size: 1.5rem; + font-weight: 600; + text-decoration: none; +} + +.nav-items { + display: flex; + gap: 1.5rem; + align-items: center; +} + +.nav-link { + color: white; + text-decoration: none; + padding: 0.75rem 1.25rem; + border-radius: 6px; + transition: all 0.3s ease; + display: flex; + align-items: center; + gap: 0.5rem; +} + +.nav-link:hover, .nav-link.active { + background: rgba(255,255,255,0.1); + transform: translateY(-1px); +} + +.user-info { + display: flex; + flex-direction: column; + align-items: flex-end; + color: white; + gap: 0.25rem; +} + +.content-wrapper { + margin-top: 80px; + padding: 2rem; + max-width: 1200px; + margin-left: auto; + margin-right: auto; +} + +.sign-out { + background: #ef4444; + border: none; + cursor: pointer; + padding: 0.75rem 1.25rem; + border-radius: 6px; + color: white; + transition: all 0.3s ease; +} + +.sign-out:hover { + background: #dc2626; + transform: translateY(-1px); +} \ No newline at end of file diff --git a/src/main/resources/static/css/style.css b/src/main/resources/static/css/style.css deleted file mode 100644 index f558ba59ee96cc12539796db46127d73e1334fbb..0000000000000000000000000000000000000000 --- a/src/main/resources/static/css/style.css +++ /dev/null @@ -1,18 +0,0 @@ -/* basic */ -.nav-item { - background-color: #93a5e7; - color: white; - padding: 15px; - text-align: center; - margin-bottom: 10px; - border-radius: 5px; - font-size: 18px; - font-weight: bold; - transition: background-color 0.3s ease, transform 0.2s ease; -} - -/* hover */ -.nav-item:hover { - background-color: #555; - transform: scale(1.05); /* Magnification effect */ -} diff --git a/src/main/resources/static/html/CHApprovalSystem.html b/src/main/resources/static/html/CHApprovalSystem.html index 1c54eaf783573d97157d8f8f5942b6a776911c1a..8c3f9385d078b16017fd1ea1250a8d28c739d0c4 100644 --- a/src/main/resources/static/html/CHApprovalSystem.html +++ b/src/main/resources/static/html/CHApprovalSystem.html @@ -9,6 +9,7 @@ <link rel="stylesheet" href="/css/common.css"> <link rel="stylesheet" href="/css/beds.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"> + <link rel="stylesheet" href="../css/shared-nav.css"> <style> .approval-dashboard { background-color: #ffffff; @@ -45,6 +46,7 @@ } </style> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> + <script src="../js/shared-nav.js"></script> </head> <body> @@ -101,6 +103,11 @@ <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> <script src="/js/approvalSystem.js"></script> + <script> + document.addEventListener('DOMContentLoaded', function() { + setupNavigation('currentPage'); // Replace currentPage with: dashboard, beds, or approvals + }); + </script> </body> </html> diff --git a/src/main/resources/static/html/admin.html b/src/main/resources/static/html/admin.html index ddbcbe0ab280ebe03989c1d5b0ff1c106c5bdce2..a7cd1e46a6678b67421c798421802f81689eb65d 100644 --- a/src/main/resources/static/html/admin.html +++ b/src/main/resources/static/html/admin.html @@ -4,14 +4,28 @@ <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Hospital Management</title> - <link rel="stylesheet" type="text/css" href="../css/admin.css"> + <link rel="stylesheet" href="../css/beds.css"> + <link rel="stylesheet" href="../css/admin.css"> + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"> + <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> + <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap" rel="stylesheet"> + <link rel="stylesheet" href="../css/shared-nav.css"> + <script src="../js/shared-nav.js"></script> </head> <body> +<!-- Update sidebar HTML structure --> <nav class="sidebar"> - <div class="text-lg font-semibold">System</div> - <a href="#" data-content="hospital">Hospital</a> - <a href="#" data-content="nursing">Nursing Staff</a> - <a><div onclick="chooseOut()">Sign Out</div></a> + <div class="text-lg">System</div> + <a href="#" data-content="hospital" class="nav-item"> + Hospital + </a> + <a href="#" data-content="nursing" class="nav-item"> + Nursing Staff + </a> + <div onclick="chooseOut()" class="nav-item sign-out"> + Sign Out + </div> +</nav> </nav> <div class="content"> <div id="user-info" style="text-align: right; padding: 10px; font-weight: bold;"></div> @@ -377,6 +391,10 @@ } }); }); + + document.addEventListener('DOMContentLoaded', function() { + setupNavigation('currentPage'); // Replace currentPage with: dashboard, beds, or approvals + }); </script> </body> </html> diff --git a/src/main/resources/static/html/beds.html b/src/main/resources/static/html/beds.html index d1a008e1384a899270fb2ce15230056cd25edc15..baa1411e8fc590d07e55a93bcc8c0639e822b114 100644 --- a/src/main/resources/static/html/beds.html +++ b/src/main/resources/static/html/beds.html @@ -8,6 +8,8 @@ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap" rel="stylesheet"> + <link rel="stylesheet" href="../css/shared-nav.css"> + <script src="../js/shared-nav.js"></script> </head> <body> <div class="main-container"> @@ -87,5 +89,10 @@ </div> <script src="../js/beds.js"></script> + <script> + document.addEventListener('DOMContentLoaded', function() { + setupNavigation('currentPage'); // Replace currentPage with: dashboard, beds, or approvals + }); + </script> </body> </html> diff --git a/src/main/resources/static/html/hospitalView.html b/src/main/resources/static/html/hospitalView.html index 9e7f296ea1a822039f1b94159f9447d5d9e62c9a..fec912c20bf3a142849bebbe7bbeefaea4932a46 100644 --- a/src/main/resources/static/html/hospitalView.html +++ b/src/main/resources/static/html/hospitalView.html @@ -4,6 +4,8 @@ <meta charset="UTF-8"> <title>Title</title> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> + <link rel="stylesheet" href="../css/shared-nav.css"> + <script src="../js/shared-nav.js"></script> <style> body{ background-image:url("/img/backpicture.jpg"); @@ -107,5 +109,9 @@ } }) + + document.addEventListener('DOMContentLoaded', function() { + setupNavigation('currentPage'); // Replace currentPage with: dashboard, beds, or approvals + }); </script> </html> \ No newline at end of file diff --git a/src/main/resources/static/html/superAdminView.html b/src/main/resources/static/html/superAdminView.html index 328844d8ca5077bec65b9b126897ab39a84eeac5..dc2b8cb7a72b9d5538d3167da03c9ad19f686fe8 100644 --- a/src/main/resources/static/html/superAdminView.html +++ b/src/main/resources/static/html/superAdminView.html @@ -4,6 +4,9 @@ <meta charset="UTF-8"> <title>Title</title> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> + <link rel="stylesheet" href="../css/admin.css"> + <link rel="stylesheet" href="../css/shared-nav.css"> + <script src="../js/shared-nav.js"></script> <style> body{ background-image:url("/img/backpicture.jpg"); @@ -76,5 +79,9 @@ } }) + + document.addEventListener('DOMContentLoaded', function() { + setupNavigation('currentPage'); // Replace currentPage with: dashboard, beds, or approvals + }); </script> </html> \ No newline at end of file diff --git a/src/main/resources/static/js/shared-nav.js b/src/main/resources/static/js/shared-nav.js new file mode 100644 index 0000000000000000000000000000000000000000..2f3a698573212a169f31cc56af16ed65b252ffcc --- /dev/null +++ b/src/main/resources/static/js/shared-nav.js @@ -0,0 +1,35 @@ +function setupNavigation(currentPage) { + const nav = ` + <nav class="top-nav"> + <a href="/superAdminView.html" class="nav-brand">Digital Insight for Health</a> + <div class="nav-items"> + <a href="/superAdminView.html" class="nav-link ${currentPage === 'dashboard' ? 'active' : ''}"> + <i class="fas fa-home"></i> Dashboard + </a> + <a href="/beds.html" class="nav-link ${currentPage === 'beds' ? 'active' : ''}"> + <i class="fas fa-bed"></i> Beds + </a> + <a href="/CHApprovalSystem.html" class="nav-link ${currentPage === 'approvals' ? 'active' : ''}"> + <i class="fas fa-check-circle"></i> Approvals + </a> + <div class="user-info"> + <span class="user-name">${localStorage.getItem('name') || 'User'}</span> + <span class="user-role">${localStorage.getItem('type') || 'Guest'}</span> + </div> + <button class="sign-out" onclick="handleSignOut()"> + <i class="fas fa-sign-out-alt"></i> Sign Out + </button> + </div> + </nav> + <div class="content-wrapper"> + <!-- Page content will go here --> + </div> + `; + + document.body.insertAdjacentHTML('afterbegin', nav); +} + +function handleSignOut() { + localStorage.clear(); + window.location.href = '/login.html'; +} \ No newline at end of file