forked from mansiruhil13/Bobble-AI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hospital.html
223 lines (191 loc) · 10 KB
/
hospital.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hospital Dashboard</title>
<link rel="stylesheet" href="src/css/hospital.css">
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCKR3agIMLtauzDhz4fCu3heww0BV_81H4" async defer></script>
</head>
<body>
<div class="dashboard-container">
<img src="images/Ambulance Tracker.png" alt="Bobble-AI Logo" style="width: 250px; height: auto; margin-bottom: 10px; margin-left: 30px;";>
<h1>Hospital Dashboard</h1>
<h2 style="font-family: 'Arial', sans-serif; font-size: 24px; color: #666; margin: 10px 0; text-align: center;">
Your personalized AI experience
</h2>
<div class="action-buttons" id="actionButtons" style="display: flex; justify-content: center; margin-top: 20px;">
<button class="action-btn" id="manageDriversBtn" style="margin-right: 10px; padding: 10px 20px; font-size: 16px;" onclick="showDriversDashboard()">Manage Drivers</button>
<button class="action-btn" id="manageAmbulancesBtn" style="padding: 10px 20px; font-size: 16px;" onclick="showAmbulancesDashboard()">Manage Ambulances</button>
</div>
<!-- Hidden dashboards initially -->
<div id="driversDashboard" style="display:none; padding: 20px; border: 1px solid #ccc; margin-top: 20px;">
<h2>Drivers Dashboard</h2>
<a href="driver.html">you can manage drivers</a>
<!-- Add your dashboard content here -->
</div>
<div id="ambulancesDashboard" style="display:none; padding: 20px; border: 1px solid #ccc; margin-top: 20px;">
<h2>Ambulances Dashboard</h2>
<!-- Add your dashboard content here -->
<a href="ambtracker.html">you can manage ambulances</a>
</div>
<script>
function showDriversDashboard() {
// Hide the buttons and show the drivers dashboard
document.getElementById("actionButtons").style.display = "none";
document.getElementById("driversDashboard").style.display = "block";
}
function showAmbulancesDashboard() {
// Hide the buttons and show the ambulances dashboard
document.getElementById("actionButtons").style.display = "none";
document.getElementById("ambulancesDashboard").style.display = "block";
}
</script>
<script>
function manageDrivers() {
// Action to manage drivers, such as opening a page or modal
alert('Manage Drivers button clicked!');
// Example: window.location.href = 'manage-drivers.html';
}
function manageAmbulances() {
// Action to manage ambulances, such as opening a page or modal
alert('Manage Ambulances button clicked!');
// Example: window.location.href = 'manage-ambulances.html';
}
</script>
<!-- Driver and Ambulance Status Section -->
<div class="status-container">
<!-- Driver Status Section -->
<div id="driverStatus" class="status-section active">
<h2>Driver Status</h2>
<table>
<thead>
<tr>
<th>Driver Name</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody id="driversTableBody">
<!-- Dynamic Driver Rows Will Be Injected Here -->
</tbody>
</table>
<!-- Nearby Hospital Facilities for Drivers -->
<div class="nearby-facilities">
<h3>Nearby Hospital Facilities</h3>
<ul>
<li>Bed Availability: <span id="bedAvailabilityDriver">Loading...</span></li>
<li>Oxygen Supply: <span id="oxygenSupplyDriver">Loading...</span></li>
<li>Blood Units: <span id="bloodUnitsDriver">Loading...</span></li>
</ul>
</div>
<!-- Contact Details for Drivers -->
<div class="contact-details">
<h3>Contact Details</h3>
<p>Driver XYZ: (123) 456-7890</p>
<p>Driver ABC: (098) 765-4321</p>
</div>
</div>
<!-- Ambulance Status Section -->
<div id="ambulanceStatus" class="status-section active">
<h2>Ambulance Status</h2>
<table>
<thead>
<tr>
<th>Ambulance ID</th>
<th>Location</th>
<th>Action</th>
</tr>
</thead>
<tbody id="ambulancesTableBody">
<!-- Dynamic Ambulance Rows Will Be Injected Here -->
</tbody>
</table>
<!-- Nearby Hospital Facilities for Ambulances -->
<div class="nearby-facilities">
<h3>Nearby Hospital Facilities</h3>
<ul>
<li>Bed Availability: <span id="bedAvailabilityAmbulance">Loading...</span></li>
<li>Oxygen Supply: <span id="oxygenSupplyAmbulance">Loading...</span></li>
<li>Blood Units: <span id="bloodUnitsAmbulance">Loading...</span></li>
</ul>
</div>
<!-- Contact Details for Ambulances -->
<div class="contact-details">
<h3>Contact Details</h3>
<p>Ambulance 1: (321) 654-0987</p>
<p>Ambulance 2: (789) 012-3456</p>
</div>
</div>
</div>
</div>
</main>
<script>
// Elements
const manageBtn = document.getElementById('manageBtn');
const driversTableBody = document.getElementById('driversTableBody');
const ambulancesTableBody = document.getElementById('ambulancesTableBody');
// Mock Data for Nearby Facilities (Replace with dynamic data if available)
document.getElementById('bedAvailabilityDriver').textContent = "20";
document.getElementById('oxygenSupplyDriver').textContent = "Sufficient";
document.getElementById('bloodUnitsDriver').textContent = "15";
document.getElementById('bedAvailabilityAmbulance').textContent = "15";
document.getElementById('oxygenSupplyAmbulance').textContent = "Limited";
document.getElementById('bloodUnitsAmbulance').textContent = "10";
// Function to Load Drivers from localStorage
function loadDrivers() {
const drivers = JSON.parse(localStorage.getItem('drivers')) || [];
driversTableBody.innerHTML = ''; // Clear existing rows
drivers.forEach((driver, index) => {
const tr = document.createElement('tr');
const nameTd = document.createElement('td');
nameTd.textContent = driver.name;
tr.appendChild(nameTd);
const statusTd = document.createElement('td');
const statusSpan = document.createElement('span');
statusSpan.classList.add('status', driver.status.toLowerCase());
statusSpan.textContent = driver.status;
statusTd.appendChild(statusSpan);
tr.appendChild(statusTd);
const actionTd = document.createElement('td');
const manageLink = document.createElement('a');
manageLink.href = `manage.html?type=driver&index=${index}`;
manageLink.classList.add('manage-link');
manageLink.textContent = 'Manage';
actionTd.appendChild(manageLink);
tr.appendChild(actionTd);
driversTableBody.appendChild(tr);
});
}
// Function to Load Ambulances from localStorage
function loadAmbulances() {
const ambulances = JSON.parse(localStorage.getItem('ambulances')) || [];
ambulancesTableBody.innerHTML = ''; // Clear existing rows
ambulances.forEach((ambulance, index) => {
const tr = document.createElement('tr');
const idTd = document.createElement('td');
idTd.textContent = ambulance.id;
tr.appendChild(idTd);
const locationTd = document.createElement('td');
locationTd.textContent = ambulance.location;
tr.appendChild(locationTd);
const actionTd = document.createElement('td');
const manageLink = document.createElement('a');
manageLink.href = `manage.html?type=ambulance&index=${index}`;
manageLink.classList.add('manage-ambulance');
manageLink.textContent = 'Manage';
actionTd.appendChild(manageLink);
tr.appendChild(actionTd);
ambulancesTableBody.appendChild(tr);
});
}
// Initial Load
loadDrivers();
loadAmbulances();
// Event Listener for Manage Button
manageBtn.addEventListener('click', () => {
window.location.href = 'manage.html';
});
</script>
</body>
</html>