forked from mansiruhil13/Bobble-AI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hospital.html
339 lines (299 loc) · 14.3 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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
<!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="preloaderStyle.css">
<link rel="stylesheet" href="src/css/hospital.css">
<link rel="stylesheet" href="src/css/manage.css">
<link rel="shortcut icon" href="ambulance.png" type="image/x-icon">
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCKR3agIMLtauzDhz4fCu3heww0BV_81H4" async defer></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" integrity="sha512-Kc323vGBEqzTmouAECnVceyQqyqdsSiqLQISBL29aUW4U/M7pSPA/gEUZQqv1cwx4OnYxTxve5UMg5GT6L4JJg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
<style>
/* Add this to your CSS file */
.toaster {
position: fixed;
top: 20px; /* Position it from the top */
right: 20px; /* Position it from the right */
background-color: #4caf50; /* Green background for success */
color: white; /* Text color */
padding: 16px;
border-radius: 5px;
z-index: 1000;
opacity: 0; /* Start with opacity 0 */
transition: opacity 0.5s ease-in-out; /* Smooth opacity transition */
}
.show {
animation: bounceIn 0.5s forwards; /* Bounce in animation */
opacity: 1; /* Make it visible */
}
.hidden {
animation: bounceOut 0.5s forwards; /* Bounce out animation */
opacity: 0; /* Fade out */
}
@keyframes bounceIn {
0% {
transform: translate(0, -100%); /* Start from above */
opacity: 0; /* Fully transparent */
}
60% {
transform: translate(0, 10%); /* Bounce down */
}
100% {
transform: translate(0, 0); /* Final position */
opacity: 1; /* Fully visible */
}
}
@keyframes bounceOut {
0% {
transform: translate(0, 0); /* Current position */
opacity: 1; /* Fully visible */
}
60% {
transform: translate(0, -10%); /* Bounce up slightly */
}
100% {
transform: translate(0, -100%); /* Move up out of view */
opacity: 0; /* Fully transparent */
}
}
</style>
<body>
<!-- preloader -->
<div id="preloader">
<div class="wrapper">
<div class="box-wrap">
<div class="box one"></div>
<div class="box two"></div>
<div class="box three"></div>
<div class="box four"></div>
<div class="box five"></div>
<div class="box six"></div>
</div>
</div>
</div>
<div id="toaster" class="toaster hidden"></div>
<header>
<nav class="navbar">
<div class="navbar-logo">
<a href="./hospital.html"><img src="./images/manageLogo.png"></img></a>
<a href="./hospital.html"><h2 style="display: flex;">ambu<p style="color: #3DBDEC;">Flow</p></h2></a>
</div>
<ul class="navbar-links">
<li><a href="hospital.html">Dashboard</a></li>
<li><a href="manage.html">Manage Status</a></li>
<li><a href="driver.html">Manage Driver</a></li>
<li><a href="ambtracker.html">Manage Ambulance</a></li>
<li id="logout"><a href="#" onclick="logout()"><i class="fa-solid fa-right-from-bracket"></i></a></li>
</ul>
<div class="resp">
<button id="dropdown"><i class="fa-solid fa-bars"></i></button>
<li id="logout"><a href="#" onclick="logout()"><i class="fa-solid fa-right-from-bracket" style="color: white;"></i></a></li>
</div>
</nav>
</header>
<!-- Dropdown -->
<div class="dropdown-menu">
<ul class="navbar-links2">
<li><a href="hospital.html">Dashboard</a></li>
<li><a href="manage.html">Manage Status</a></li>
<li><a href="driver.html">Manage Driver</a></li>
<li><a href="ambtracker.html">Manage Ambulance</a></li>
</ul>
</div>
<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 style="color: #1a2938;">Hospital Dashboard</h1>
<h2 style="font-family: 'Arial', sans-serif; font-size: 17px; color: #666; margin: 10px 0; text-align: center;">
Your personalized AI experience
</h2>
<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 to show toaster notification
function showToaster(message) {
const toaster = document.getElementById("toaster");
toaster.textContent = message;
toaster.classList.remove("hidden");
toaster.classList.add("show");
if(!localStorage.getItem('login')) {
toaster.classList.add("hidden");
}
// Hide the toaster after 3 seconds
setTimeout(() => {
toaster.classList.remove("show");
toaster.classList.add("hidden");
}, 3000);
}
if (localStorage.getItem('login') == 'success'){
showToaster('Login Successfull');
localStorage.removeItem('login');
}
let flag = false
document.getElementById('dropdown').addEventListener('click', () => {
const dropdown = document.querySelector('.dropdown-menu');
if (flag) {
dropdown.style.display = 'none';
flag = false;
} else {
dropdown.style.display = 'block';
flag = true;
}
});
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 style="color: #92c4d6;">Driver Name</th>
<th style="color: #92c4d6;">Status</th>
<th style="color: #92c4d6;">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 style="font-weight: 500;">
<li style="list-style: none;">Bed Availability: <span id="bedAvailabilityDriver">Loading...</span></li>
<li style="list-style: none;">Oxygen Supply: <span id="oxygenSupplyDriver">Loading...</span></li>
<li style="list-style: none;">Blood Units: <span id="bloodUnitsDriver">Loading...</span></li>
</ul>
</div>
<!-- Contact Details for Drivers -->
<div class="contact-details">
<h3>Contact Details</h3>
<p style="font-weight: 500;">Driver XYZ: (123) 456-7890</p>
<p style="font-weight: 500;">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 style="color: #92c4d6;">Ambulance ID</th>
<th style="color: #92c4d6;">Location</th>
<th style="color: #92c4d6;">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 style="font-weight: 500;">
<li style="list-style: none;">Bed Availability: <span id="bedAvailabilityAmbulance">Loading...</span></li>
<li style="list-style: none;">Oxygen Supply: <span id="oxygenSupplyAmbulance">Loading...</span></li>
<li style="list-style: none;">Blood Units: <span id="bloodUnitsAmbulance">Loading...</span></li>
</ul>
</div>
<!-- Contact Details for Ambulances -->
<div class="contact-details">
<h3>Contact Details</h3>
<p style="font-weight: 500;">Ambulance 1: (321) 654-0987</p>
<p style="font-weight: 500;">Ambulance 2: (789) 012-3456</p>
</div>
</div>
</div>
</div>
</main>
<script src="preloader.js"></script>
<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';
});
function logout() {
const confirmLogout = confirm('Are you sure you want to logout?');
if (confirmLogout) {
localStorage.removeItem('userID');
localStorage.removeItem('JWTtoken');
window.location.href = 'index.html';
alert("Logged out successfully!");
}
}
</script>
</body>
</html>