-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDoctor_Dashboard.php
434 lines (368 loc) · 14 KB
/
Doctor_Dashboard.php
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
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
<?php
session_start();
include 'db_connection.php';
// Check if the user is logged in
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit();
}
// Retrieve the logged-in user's ID
$user_id = $_SESSION['user_id'];
// Query to check the user's role
$sql_role = "SELECT role FROM users WHERE id = ?";
$stmt_role = $conn->prepare($sql_role);
$stmt_role->bind_param("i", $user_id);
$stmt_role->execute();
$result_role = $stmt_role->get_result();
$user = $result_role->fetch_assoc();
if ($user['role'] === 'doctor' || $user['role'] === 'Caregiver' || $user['role'] === 'Supervisor') {
$sql = "SELECT employeeID, fName, lName, role, salary, email, DOB, phone, hire_date
FROM employees WHERE user_id = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("i", $user_id);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows > 0) {
$employee = $result->fetch_assoc();
} else {
$employee = null;
$error_message = "No data found for this user.";
}
// Get user details for settings
$sql_user = "SELECT name, email, password FROM users WHERE id = ?";
$stmt_user = $conn->prepare($sql_user);
$stmt_user->bind_param("i", $user_id);
$stmt_user->execute();
$result_user = $stmt_user->get_result();
$user_info = $result_user->fetch_assoc();
} else {
echo "You do not have permission to access this page.";
exit();
}
?>
<?php //TEMPLATES
include 'templates_html/header.html';
if (isset($_SESSION['user_role'])) {
switch ($_SESSION['user_role']) {
case 'admin':
include 'templates_html/main-grid-content-2columns.html';
include 'templates_html/admin-side-bar.html';
default:
include 'templates_html/alert-dashboard.php';
include 'templates_html/employee.php';
include 'templates_html/main-grid-content-1column.html';
}
} else {
include 'templates_html/main-grid-content-1column.html';
}
include 'templates_html/main-content.html';
?>
<h1 class="text-center pb-5">ElderlyCare Management System</h1>
<hr>
<ul class="nav col-13 col-lg-auto me-lg-auto mb-2 justify-content-center mb-md-0">
<li><a href="health_record_dashboard.php" class="nav-link px-2 text-dark"> health_records management</a></li>
<li><a href="elderly_profiles_dashpoard.php" class="nav-link px-2 text-dark"> Elderly_Profiles_management</a></li>
<li><a href="insert_medication_schedule.php" class="nav-link px-2 text-dark"> medication_Schedule_management</a></li>
</ul>
<hr>
<br>
<div class="mb-5 text-start p-5">
<h2>Overview</h2>
<br>
<h3> Advanced Software Project 01</h3>
<p>This project aims to replicate the workflow of a
real-world development agency by planning, designing,
and implementing a functional web application based
on client needs and organizational methodologies. It
integrates all the skills and concepts we've developed
throughout this year.</p>
<h4>Timeline</h4>
<p>The project spans five weeks. Each week begins with a
strategic planning session to organize tasks and
evaluate the progress of the previous week's release.</p>
<hr>
<h3>Technologies</h2>
<ul>
<li>HTML5</li>
<li>CSS3</li>
<li>JavaScript</li>
<li>PHP</li>
<li>phpMyAdmin</li>
<li>MySQL</li>
<li>Agile Process</li>
<li>Feature Branch Git Workflow</li>
</ul>
<hr>
<h3>Software Engineer</h2>
<ul>
<li>Ala Al_Dain</li>
<h6>Contact Us</<h6>
<li>917558575378</li>
<hr>
</div>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Employee Profile</title>
<!-- FontAwesome for the profile icon -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
direction: ltr;
}
/* Profile icon design */
.profile-container {
position: fixed; /* تثبيت الحاوية في الزاوية */
top: 20px; /* المسافة من الأعلى */
right: 20px; /* المسافة من اليمين */
text-align: center; /* محاذاة النص في المنتصف */
}
.profile-icon {
font-size: 24px; /* حجم الأيقونة */
color: white; /* لون الأيقونة */
cursor: pointer; /* تغيير المؤشر عند المرور فوق الأيقونة */
background-color: rgba(0, 0, 0, 0.5); /* خلفية داكنة مع شفافية (اختياري) */
padding: 10px; /* إضافة padding */
border-radius: 10px; /* لجعل الخلفية مستديرة */
}
.profile-text {
color: white; /* لون النص */
font-size: 16px; /* حجم النص */
margin-top: 5px; /* إضافة مسافة بين الأيقونة والنص */
display: block; /* جعل النص كتلة ليكون في سطر جديد */
}
/* Sidebar design */
.profile-sidebar {
height: 100%;
width: 0;
position: fixed;
top: 0;
left: 0;
background-color: #f4f4f4;
overflow-x: hidden;
transition: 0.5s;
padding-top: 60px;
z-index: 9999;
}
.profile-sidebar table {
width: 100%;
padding: 10px;
border-collapse: collapse;
}
.profile-sidebar table, th, td {
border: 1px solid #ddd;
padding: 8px;
}
th {
background-color: #f2f2f2;
text-align: left;
}
/* Close button for the sidebar */
.close-btn {
position: absolute;
top: 10px;
right: 15px;
font-size: 36px;
cursor: pointer;
}
/* Sidebar active state */
.profile-sidebar.active {
width: 300px;
}
/* Settings icon */
.settings-icon {
margin-top: 20px;
font-size: 20px;
cursor: pointer;
}
/* Hidden section for user settings */
.settings-section {
display: none;
padding: 10px;
}
.settings-section.active {
display: block;
}
.error {
color: red;
font-weight: bold;
text-align: center;
}
</style>
</head>
<body>
<!-- Profile icon -->
<!-- Profile icon container -->
<div class="profile-container">
<div class="profile-icon" onclick="toggleSidebar()">
<i class="fas fa-user"></i>
</div>
<span class="profile-text">Profile</span> <!-- نص "Profile" -->
</div>
<!-- Profile sidebar -->
<div id="profileSidebar" class="profile-sidebar">
<span class="close-btn" onclick="toggleSidebar()">×</span>
<?php if (isset($employee)) { ?>
<table>
<tr>
<th>Employee ID</th>
<td><?php echo $employee['employeeID']; ?></td>
</tr>
<tr>
<th>First Name</th>
<td><?php echo $employee['fName']; ?></td>
</tr>
<tr>
<th>Last Name</th>
<td><?php echo $employee['lName']; ?></td>
</tr>
<tr>
<th>Role</th>
<td><?php echo $employee['role']; ?></td>
</tr>
<tr>
<th>Salary</th>
<td><?php echo $employee['salary']; ?></td>
</tr>
<tr>
<th>Email</th>
<td><?php echo $employee['email']; ?></td>
</tr>
<tr>
<th>Date of Birth</th>
<td><?php echo $employee['DOB']; ?></td>
</tr>
<tr>
<th>Phone</th>
<td><?php echo $employee['phone']; ?></td>
</tr>
<tr>
<th>Hire Date</th>
<td><?php echo $employee['hire_date']; ?></td>
</tr>
</table>
<!-- Settings Icon -->
<div class="settings-icon" onclick="toggleSettings()">
<i class="fas fa-cog"></i> Settings
</div>
<!-- Settings Section -->
<!-- Settings Section -->
<div id="settingsSection" class="settings-section">
<h3>User Settings</h3>
<p>
<strong>Username:</strong>
<input type="text" id="usernameInput" value="<?php echo $user_info['name']; ?>" style="display:none;">
<span id="usernameDisplay"><?php echo $user_info['name']; ?></span>
</p>
<p>
<strong>Email:</strong>
<input type="email" id="emailInput" value="<?php echo $user_info['email']; ?>" style="display:none;">
<span id="emailDisplay"><?php echo $user_info['email']; ?></span>
</p>
<p>
<strong>Password:</strong>
<input type="password" id="passwordInput" style="display:none;" placeholder="Enter new password">
<span id="passwordDisplay">********</span>
<i id="togglePassword" class="fas fa-eye-slash" onclick="togglePasswordVisibility()" style="cursor:pointer;"></i>
</p>
<button id="editButton" onclick="editSettings()">Edit</button>
<button id="saveButton" onclick="saveSettings()" style="display:none;">Save</button>
<button id="cancelButton" onclick="cancelSettings()" style="display:none;">Cancel</button>
</div>
<script>
// Function to toggle the settings section
function toggleSettings() {
var settingsSection = document.getElementById("settingsSection");
settingsSection.classList.toggle("active");
}
function editSettings() {
// Show input fields and buttons
document.getElementById("usernameInput").style.display = 'inline';
document.getElementById("emailInput").style.display = 'inline';
document.getElementById("passwordInput").style.display = 'inline';
document.getElementById("usernameDisplay").style.display = 'none';
document.getElementById("emailDisplay").style.display = 'none';
document.getElementById("editButton").style.display = 'none';
document.getElementById("saveButton").style.display = 'inline';
document.getElementById("cancelButton").style.display = 'inline';
// Show the password toggle icon when editing
document.getElementById("togglePassword").style.display = 'inline';
}
function saveSettings() {
var newUsername = document.getElementById("usernameInput").value;
var newEmail = document.getElementById("emailInput").value;
var newPassword = document.getElementById("passwordInput").value;
// Here you would typically send the new username, email, and password to the server via AJAX or form submission.
// For now, just update the displayed values (this should be replaced with an actual save mechanism).
if (newUsername && newEmail) {
document.getElementById("usernameDisplay").textContent = newUsername;
document.getElementById("emailDisplay").textContent = newEmail;
document.getElementById("passwordDisplay").textContent = '********'; // Don't show the actual password
document.getElementById("usernameInput").style.display = 'none';
document.getElementById("emailInput").style.display = 'none';
document.getElementById("passwordInput").style.display = 'none';
document.getElementById("editButton").style.display = 'inline';
document.getElementById("saveButton").style.display = 'none';
document.getElementById("cancelButton").style.display = 'none';
alert('Settings saved successfully!'); // Replace with a proper success message
} else {
alert('Please fill in all fields.');
}
}
function cancelSettings() {
// Reset input fields and hide them
document.getElementById("usernameInput").style.display = 'none';
document.getElementById("emailInput").style.display = 'none';
document.getElementById("passwordInput").style.display = 'none';
document.getElementById("usernameDisplay").style.display = 'inline';
document.getElementById("emailDisplay").style.display = 'inline';
document.getElementById("editButton").style.display = 'inline';
document.getElementById("saveButton").style.display = 'none';
document.getElementById("cancelButton").style.display = 'none';
// Hide the password toggle icon when canceling
document.getElementById("togglePassword").style.display = 'none';
}
function togglePasswordVisibility() {
var passwordInput = document.getElementById("passwordInput");
var toggleIcon = document.getElementById("togglePassword");
// Check if the password is currently hidden
if (passwordInput.type === "password") {
// Show the actual password entered by the user
passwordInput.type = "text";
toggleIcon.classList.remove("fa-eye-slash"); // Change to "show" icon
toggleIcon.classList.add("fa-eye"); // Add "hide" icon
} else {
// Hide the password and show '********'
passwordInput.type = "password";
toggleIcon.classList.remove("fa-eye"); // Change to "hide" icon
toggleIcon.classList.add("fa-eye-slash"); // Add "show" icon
}
}
</script>
<?php } else { ?>
<div class="error"><?php echo $error_message; ?></div>
<?php } ?>
</div>
<script>
// Function to toggle the sidebar
function toggleSidebar() {
var sidebar = document.getElementById("profileSidebar");
sidebar.classList.toggle("active");
}
// Function to toggle the settings section
function toggleSettings() {
var settingsSection = document.getElementById("settingsSection");
settingsSection.classList.toggle("active");
}
</script>
</body>
</html>
<?php // TEMPLATES
include 'templates_html/end-main-content.html';
include 'templates_html/footer.html';
?>