diff --git a/healthcare.sql b/healthcare.sql new file mode 100644 index 0000000000000000000000000000000000000000..518639e6244d2fd3fb908331dee75e7da6cc3789 --- /dev/null +++ b/healthcare.sql @@ -0,0 +1,231 @@ +/* + 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/html/CHApprovalSystem.html b/src/main/resources/static/html/CHApprovalSystem.html new file mode 100644 index 0000000000000000000000000000000000000000..4721c7ca068f303664491698059ec9141aa8d993 --- /dev/null +++ b/src/main/resources/static/html/CHApprovalSystem.html @@ -0,0 +1,380 @@ +<!DOCTYPE html> +<html lang="zh-CN"> + +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>Care Home Approval System</title> + <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" + integrity="sha384-KyZXEJr+fzzj7QPAAd6XJlNhh8Fj72V53fzmdeau9g7KZb6eYy2v8t+HjlFjzml0" crossorigin="anonymous"> + <style> + body { + background-color: #f4f9fc; + font-family: 'Arial', sans-serif; + color: #333; + } + + .container { + margin-top: 50px; + } + + .header { + text-align: center; + margin-bottom: 40px; + } + + .table th, + .table td { + vertical-align: middle; + } + + .card { + border: 1px solid #007BFF; + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); + } + + .btn { + border-radius: 25px; + padding: 8px 20px; + font-size: 14px; + transition: background-color 0.3s ease; + } + + .btn-primary { + background-color: #007BFF; + border-color: #007BFF; + } + + .btn-primary:hover { + background-color: #0056b3; + border-color: #0056b3; + } + + .btn-danger { + background-color: #dc3545; + border-color: #dc3545; + } + + .btn-danger:hover { + background-color: #c82333; + border-color: #c82333; + } + + .btn-warning { + background-color: #ffc107; + border-color: #ffc107; + } + + .btn-warning:hover { + background-color: #e0a800; + border-color: #e0a800; + } + + .alert-info { + font-size: 16px; + background-color: #e3f2fd; + border-color: #b3e5fc; + color: #0277bd; + } + + .modal-content { + background-color: #f8f9fa; + border-radius: 10px; + padding: 20px; + } + + .modal-header { + background-color: #007BFF; + color: white; + border-bottom: none; + padding-bottom: 10px; + border-radius: 8px; + } + + .modal-footer { + justify-content: space-between; + border-top: none; + padding-top: 15px; + } + + .modal-body { + font-size: 16px; + color: #555; + } + + .btn-group { + display: flex; + gap: 15px; + } + + .btn-group button { + flex: 1; + max-width: 120px; + } + + .btn-info { + background-color: #17a2b8; + border-color: #17a2b8; + } + + .btn-info:hover { + background-color: #138496; + border-color: #138496; + } + + .table { + border-radius: 10px; + overflow: hidden; + border: 1px solid #ddd; + width: 100%; + } + + .table th { + background-color: #007BFF; + color: white; + } + + .table td { + background-color: #ffffff; + } + + .table-container { + display: flex; + justify-content: center; + margin-top: 50px; + } + + .pagination { + display: flex; + gap: 10px; + justify-content: center; + padding: 10px 0; + } + + .pagination .page-item { + border-radius: 5px; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); + } + + .pagination .page-item.active .page-link { + background-color: #007BFF; + color: white; + } + + .pagination .page-item .page-link { + border-radius: 5px; + padding: 10px 15px; + background-color: white; + color: #007BFF; + border: 1px solid #007BFF; + transition: all 0.3s ease; + } + + .pagination .page-item:hover .page-link { + background-color: #007BFF; + color: white; + } + + .pagination .page-item.disabled .page-link { + background-color: #f4f9fc; + color: #ccc; + border: 1px solid #ccc; + } + </style> +</head> + +<body> +<div class="container"> + <div class="header"> + <h1 class="display-4">Care Home Approval System</h1> + <p class="lead">Admin can approve, reject or delete the requests of registration from care homes.</p> + </div> + + <!--E.g.--> + <div class="alert alert-info">There are currently 10 pending care home requests.</div> + + <div class="table-container"> + <table class="table table-striped table-bordered"> + <thead> + <tr> + <th>CHName</th> + <th>Address</th> + <th>Option</th> + </tr> + </thead> + <tbody id="hospitalTableBody"> + <!-- 动æ€ç”Ÿæˆè¡¨æ ¼å†…容 --> + </tbody> + </table> + </div> + + <!-- 分页控件 --> + <div class="d-flex justify-content-center"> + <nav aria-label="Page navigation"> + <ul class="pagination"> + <li class="page-item" id="prevPageBtn"> + <a class="page-link" href="#" aria-label="Previous"> + <span aria-hidden="true">«</span> + </a> + </li> + <li class="page-item"><a class="page-link" href="#" onclick="changePage(1)">1</a></li> + <li class="page-item"><a class="page-link" href="#" onclick="changePage(2)">2</a></li> + <li class="page-item"><a class="page-link" href="#" onclick="changePage(3)">3</a></li> + <li class="page-item" id="nextPageBtn"> + <a class="page-link" href="#" aria-label="Next"> + <span aria-hidden="true">»</span> + </a> + </li> + </ul> + </nav> + </div> +</div> + +<!-- æ¨¡æ€æ¡†ï¼šæ˜¾ç¤ºè¯¦ç»†è¯·æ±‚ä¿¡æ¯ --> +<div class="modal fade" id="requestDetailsModal" tabindex="-1" aria-labelledby="requestDetailsModalLabel" + aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <h5 class="modal-title" id="requestDetailsModalLabel">Details of Requests</h5> + <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> + </div> + <div class="modal-body"> + <div id="requestDetailsContent"></div> + </div> + <div class="modal-footer"> + <div class="btn-group"> + <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> + <button type="button" class="btn btn-primary" id="approveButton">Approve</button> + <button type="button" class="btn btn-danger" id="rejectButton">Reject</button> + <button type="button" class="btn btn-warning" id="deleteButton">Delete</button> + </div> + </div> + </div> + </div> +</div> + +<script> + let selectedHospitalId = null; + + // ç¤ºä¾‹åŒ»é™¢æ•°æ® + const hospitalData = [ + { id: 1, name: "Hospital 1", address: "Cardiff" }, + { id: 2, name: "Hospital 2", address: "Cardiff" }, + { id: 3, name: "Hospital 3", address: "Cardiff" }, + { id: 4, name: "Hospital 4", address: "London" }, + { id: 5, name: "Hospital 5", address: "London" }, + { id: 6, name: "Hospital 6", address: "Manchester" }, + { id: 7, name: "Hospital 7", address: "Bristol" }, + { id: 8, name: "Hospital 8", address: "London" }, + { id: 9, name: "Hospital 9", address: "Cardiff" }, + { id: 10, name: "Hospital 10", address: "Cardiff" } + ]; + + let currentPage = 1; + const itemsPerPage = 5; + + // 获å–当å‰é¡µé¢çš„åŒ»é™¢æ•°æ® + function getCurrentPageData(page) { + const startIndex = (page - 1) * itemsPerPage; + const endIndex = page * itemsPerPage; + return hospitalData.slice(startIndex, endIndex); + } + + // æ¸²æŸ“è¡¨æ ¼æ•°æ® + function renderTable(page) { + const currentData = getCurrentPageData(page); + const tableBody = document.getElementById('hospitalTableBody'); + tableBody.innerHTML = ''; + + currentData.forEach(hospital => { + const row = document.createElement('tr'); + row.innerHTML = ` + <td>${hospital.name}</td> + <td>${hospital.address}</td> + <td> + <button class="btn btn-info" onclick="showRequestDetails(${hospital.id}, '${hospital.name}', '${hospital.address}')">Check Requests</button> + </td> + `; + tableBody.appendChild(row); + }); + } + + // 切æ¢åˆ†é¡µ + function changePage(page) { + currentPage = page; + renderTable(currentPage); + updatePagination(); + } + + // æ›´æ–°åˆ†é¡µæŒ‰é’®çŠ¶æ€ + function updatePagination() { + const totalPages = Math.ceil(hospitalData.length / itemsPerPage); + + document.getElementById('prevPageBtn').classList.toggle('disabled', currentPage === 1); + document.getElementById('nextPageBtn').classList.toggle('disabled', currentPage === totalPages); + + // 更新分页按钮显示 + const pageLinks = document.querySelectorAll('.pagination .page-item'); + pageLinks.forEach(link =>{ + const pageNumber = link.querySelector('a').textContent; + if (parseInt(pageNumber) === currentPage) { + link.classList.add('active'); + } else { + link.classList.remove('active'); + } + }); + } + + // æ˜¾ç¤ºè¯·æ±‚è¯¦ç»†ä¿¡æ¯ + function showRequestDetails(id, name, address) { + selectedHospitalId = id; + const requestDetailsContent = ` + <h5>CH Name: ${name}</h5> + <p><strong>Address: </strong> ${address}</p> + <p><strong>State: </strong> Pending</p> + `; + document.getElementById('requestDetailsContent').innerHTML = requestDetailsContent; + + // æ˜¾ç¤ºæ¨¡æ€æ¡† + const modal = new bootstrap.Modal(document.getElementById('requestDetailsModal')); + modal.show(); + + // 设置按钮功能 + document.getElementById('approveButton').onclick = approveHospital; + document.getElementById('rejectButton').onclick = rejectHospital; + document.getElementById('deleteButton').onclick = deleteHospital; + } + + // 批准医院 + function approveHospital() { + alert('The Care Home has been approved!'); + window.location.reload(); + } + + // æ‹’ç»åŒ»é™¢ + function rejectHospital() { + alert('The Care Home has been rejected!'); + window.location.reload(); + } + + // åˆ é™¤åŒ»é™¢ + function deleteHospital() { + alert('The Care Home has been deleted!'); + window.location.reload(); + } + + // åˆå§‹åŒ–è¡¨æ ¼å’Œåˆ†é¡µ + renderTable(currentPage); + updatePagination(); + + + + +</script> + +<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> +</body> + +</html>