-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappointments.html
More file actions
207 lines (187 loc) · 9.87 KB
/
Copy pathappointments.html
File metadata and controls
207 lines (187 loc) · 9.87 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MediOps - Appointments List</title>
<link href="style.css" rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Afacad+Flux:wght@100..1000&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined" />
<script src="menu.js" defer></script> <!-- Ensure script is loaded after the page is parsed -->
<script src="appointments.js"></script>
<script>
// Check if the user is logged in
if (!localStorage.getItem("isDoctorLoggedIn") && !localStorage.getItem("isAdminLoggedIn")) {
// Redirect to the login page if not logged in
window.location.href = "doctor-login.html";
}
</script>
</head>
<body>
<header id="menu">
<h1>
<img alt="MediOps logo" width="20" src="images/logo.svg"> Medi<strong>Ops</strong>
</h1>
<a href="javascript:void(0);" class="nav-toggle" onclick="toggleNav()">
<span class="material-symbols-outlined">apps</span>
</a>
<nav id="header_navigation">
<ul id="nav">
<li class="showtoall">
<a href="admin.html" title="Navigate to Home">
<span class="material-symbols-outlined">layers</span> Dashboard
</a>
</li>
<li class="loggedoutall">
<a href="patient-login.html" title="Navigate to Patient Login">
<span class="material-symbols-outlined">personal_injury</span> Patient Login
</a>
</li>
<li class="loggedoutall">
<a href="admin-login.html" title="Navigate to Admin Login">
<span class="material-symbols-outlined">admin_panel_settings</span> Admin Login
</a>
</li>
<li class="loggedoutall">
<a href="doctor-login.html" title="Navigate to Doctor Login">
<span class="material-symbols-outlined">stethoscope</span> Doctor Login
</a>
</li>
<li class="docandadmins">
<div class="toggleMenu">
<span class="material-symbols-outlined">group</span>
Patients
<span class="material-symbols-outlined expand-menu-icon">keyboard_arrow_down</span>
</div>
<ul class="submenu">
<li class="adminonly"> <a href="add-new-patient.html" title="Add New Patient">Add New Patient</a> </li>
<li class="docandadmins"> <a href="patients.html" title="View List of Patients">All Patients</a> </li>
<li class="adminonly"> <a href="edit-patient.html" title="Edit Patients">Edit Patients</a> </li>
</ul>
</li>
<li class="showloggedin">
<div class="toggleMenu">
<span class="material-symbols-outlined">today</span>
Appointments
<span class="material-symbols-outlined expand-menu-icon">keyboard_arrow_down</span>
</div>
<ul class="submenu">
<li class="docandadmins"> <a href="appointments.html" title="All appointments">All Appointments</a> </li>
<li class="docandadmins"> <a href="make-appointment.html" title="Create appointments">Create an Appointment</a> </li>
<li class="patientonly"> <a href="patient-appointment.html" title="As a patient you can create appointments">Create an Appointment</a> </li>
<li class="patientonly"> <a href="patient-history.html" title="View Patient History">View Patient History</a> </li>
<li class="docandadmins"> <a href="medicines.html" title="View Medicines">Medicine Reporting</a> </li>
</ul>
</li>
<li class="adminonly">
<div class="toggleMenu">
<span class="material-symbols-outlined">stethoscope</span>
Staff
<span class="material-symbols-outlined expand-menu-icon">keyboard_arrow_down</span>
</div>
<ul class="submenu">
<li class="adminonly"> <a href="add-new-doctor.html" title="Add New Doctor">Add New Doctor</a> </li>
<li class="adminonly"> <a href="doctors.html" title="View List of Doctors">All Doctors</a> </li>
<li class="adminonly"> <a href="edit-doctor.html" title="Edit Doctor">Edit Doctor</a> </li> <!-- Link to the new page -->
</ul>
</li>
<li class="adminonly">
<div class="toggleMenu">
<span class="material-symbols-outlined">support_agent</span>
Admin
<span class="material-symbols-outlined expand-menu-icon">keyboard_arrow_down</span>
</div>
<ul class="submenu">
<li class="adminonly"> <a href="add-new-patient.html" title="Add New Patient">Add New Patient</a> </li>
<li class="adminonly"> <a href="create-login-doctor.html" title="Create Login Details for Doctor">Create Login Details for Doctor</a> </li>
<li class="adminonly"> <a href="create-login-patient.html" title="Create Login Details for Patient">Create Login Details for Patient</a> </li> <!-- Link to the new page -->
</ul>
</li>
<li class="logout docandadmins showtopatient" onclick="logout()">
<span class="material-symbols-outlined">layers</span> Log out
</li>
</ul>
</nav>
</header>
<article id="main">
<div class="main-section-container page_container">
<section class="section fullwidth">
<div class="page-content">
<h2>Appointments List</h2>
<!-- Search form -->
<table>
<thead>
<tr>
<th>Appointment ID</th>
<th>Patient Name</th>
<th>Doctor Name</th>
<th>Appointment Date</th>
</tr>
</thead>
<tbody id="appointmentsTableBody">
<!-- Appointments will be dynamically loaded here -->
</tbody>
</table>
</div>
</section>
</div>
<footer>
<div class="footer-container">
<h3><img alt="MedAdmin logo" width="20" src="images/logo.svg"> Medi<strong>Ops</strong> </h3>
<p>Copyright © 2024 MediOps - Medical Admin Management System</p>
</div>
</footer>
<script>
// Search patients in IndexedDB by first or last name
function searchPatients() {
let searchValue = document.getElementById('search').value.toLowerCase();
let transaction = db.transaction(['appointments'], 'readonly');
let objectStore = transaction.objectStore('appointments');
let request = objectStore.getAll();
request.onsuccess = function(event) {
let patients = event.target.result;
let results = patients.filter(patient =>
patient.patient_id.toLowerCase().includes(searchValue) ||
patient.doctor_id.toLowerCase().includes(searchValue)
);
displayResults(results);
};
request.onerror = function(event) {
console.error('Error fetching patients:', event.target.errorCode);
};
return false; // Prevent form from submitting
}
// Display search results using document.write
function displayResults(results) {
let resultsDiv = document.getElementById('results');
resultsDiv.innerHTML = ''; // Clear previous results
if (results.length > 0) {
let html = '<h2>Search Results:</h2>';
html += '<ul>';
results.forEach(patient => {
html += `<li>
<strong>ID:</strong> ${patient.patient_id} <br/>
<strong>NHS:</strong> ${patient.NHS} <br/>
<strong>Title:</strong> ${patient.Title} <br/>
<strong>First Name:</strong> ${patient.First} <br/>
<strong>Last Name:</strong> ${patient.Last} <br/>
<strong>DOB:</strong> ${patient.DOB} <br/>
<strong>Gender:</strong> ${patient.Gender} <br/>
<strong>Address:</strong> ${patient.Address} <br/>
<strong>Email:</strong> ${patient.Email} <br/>
<strong>Telephone:</strong> ${patient.Telephone} <br/><br/>
</li>`;
});
html += '</ul>';
resultsDiv.innerHTML = html;
} else {
resultsDiv.innerHTML = '<p>No patients found.</p>';
}
}
</script>
<br/>
</article>
</body>
</html>