-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
543 lines (492 loc) · 24 KB
/
index.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
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
<?php include('session.php'); ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- style sheets -->
<link rel="stylesheet" type="text/css" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="bower_components/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="bower_components/fullcalendar/dist/fullcalendar.css">
<link rel="stylesheet" type="text/css" href="styles/mainstyle.css">
<!-- <link href='http://fonts.googleapis.com/css?family=Lato' rel='stylesheet' type='text/css'> -->
<title>Dashboard</title>
<script type="text/javascript">
function getModalPatient(SSN) {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("searchContainer").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET","searchPatientBySSN.php?SSN="+SSN,true);
xmlhttp.send();
}
function spListChange() {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("facilityList").innerHTML = xmlhttp.responseText;
}
}
console.log("getFacilitiesBySpecialty.php?region="+document.getElementById("regionList").value+"&specialty="+document.getElementById('spList').value);
xmlhttp.open("GET","getFacilitiesBySpecialty.php?region="+document.getElementById("regionList").value+"&specialty="+document.getElementById('spList').value,true);
xmlhttp.send();
}
function searchSSN() {
$('#myModal').modal('toggle');
$('#patModal').modal('toggle');
console.log("event fired");
}
function saveAppointment() {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("errorContainer").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET","saveAppointment.php?title="+document.getElementById("eventTitle").value+"&date="+document.getElementById("dateSelection").value+"&Patient_SSN="+document.getElementById("searchSSN").value+"&time="+document.getElementById("timeList").value+":"+document.getElementById("minuteList").value+"®ion="+document.getElementById("regionList").value+"&specialty="+document.getElementById("spList").value+"&facility="+document.getElementById("facList").value,true);
xmlhttp.send();
}
function getAppointment(ID) {
document.getElementById("aptDeleteBtn").onclick = function() {
deleteAppointment(ID);
};
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("aptContainer").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET","getAppointment.php?id="+ID,true);
xmlhttp.send();
}
function deleteAppointment(ID) {
if (confirm("Are you sure you want to delete that?")){
window.location.href = 'deleteAppointment.php?id='+ID;
}
}
</script>
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.php"><span class="fa fa-user-md navIcon"></span>I.H.S </a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active">
<a href="index.php"> <span class="fa fa-calendar navIcon"></span>Appointments <span class="sr-only">(current)</span></a>
</li>
<li><a href="patients.php" <?php if ($type == "patient") { echo ("style=\"display:none\""); }?>><span class="fa fa-users navIcon"></span>Patients</a></li>
<li><a href="profile.php"><span class="fa fa-universal-access navIcon"></span>Profile</a></li>
</ul>
<!-- <form class="nav navbar-nav navbar-form" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search...">
</div> -->
<!-- <button type="submit" class="btn btn-default">Submit</button> -->
<!-- </form> -->
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> <span class="fa fa-user navIcon"></span><?php echo $first_name . ' ' . $surname; ?> <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="profile.php"><span class="fa fa-cog navIcon"></span> Profile</a></li>
<li class="divider"></li>
<li><a href="logout.php"><span class="fa fa-power-off navIcon"></span> Logout</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<!-- Appointment Modal -->
<div id="aptModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Appointment Info</h4>
</div>
<div class="modal-body" id="aptContainer">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" id="aptDeleteBtn">Delete Appointment</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Patient Modal -->
<div class="modal fade" style="overflow-y:auto;" id="patModal" tabindex="-1" role="dialog" aria-labelledby="patModal">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="patModal">Patient Info</h4>
</div>
<div class="modal-body" id="searchContainer">
<div class="row">
<div class="col-md-3 col-xs-3">
<label for="searchpat">Search Patient:</label>
</div>
<div class="col-md-3 col-xs-1">
<input id="searchpat" type="text" name="searchpat" placeholder="search ssn">
</div>
<div class="col-md-1 col-md-offset-1 col-xs-1 col-xs-offset-6">
<button id="searchpatbtn" type="button" class="btn btn-primary btn-sm" onclick="getModalPatient(document.getElementById('searchpat').value)"><span id="searchIcon" class="fa fa-search"></span></button>
</div>
</div>
<hr>
<div class="row cusrow">
<div class="col-md-2 col-xs-4">
<label for="name">SSN: </label>
</div>
<div class="col-md-2 col-xs-4 col-xs-offset-4">
<input class="inStyle" type="text" name="name">
</div>
</div>
<div class="row cusrow">
<div class="col-md-2 col-xs-4">
<label for="name">Patient Name: </label>
</div>
<div class="col-md-2 col-xs-4 col-xs-offset-4">
<input class="inStyle" type="text" name="name">
</div>
</div>
<div class="row">
<div class="col-md-2 col-xs-4">
<label for="name">Patient Surname: </label>
</div>
<div class="col-md-2 col-xs-4 col-xs-offset-4">
<input class="inStyle" type="text" name="name">
</div>
</div>
<div class="row">
<div class="col-md-2 col-xs-4">
<label for="name">Father's Name: </label>
</div>
<div class="col-md-2 col-xs-4 col-xs-offset-4">
<input class="inStyle" type="text" name="name">
</div>
</div>
<div class="row">
<div class="col-md-2 col-xs-4">
<label for="name">Mother's Name: </label>
</div>
<div class="col-md-2 col-xs-4 col-xs-offset-4">
<input class="inStyle" type="text" name="name">
</div>
</div>
<div class="row">
<div class="col-md-2 col-xs-4">
<label for="name">Gender: </label>
</div>
<div class="col-md-2 col-xs-4 col-xs-offset-4">
<input class="inStyle" type="text" name="name">
</div>
</div>
<div class="row cusrow">
<div class="col-md-2 col-xs-4">
<label for="name">Date of birth: </label>
</div>
<div class="col-md-2 col-xs-4 col-xs-offset-4">
<input class="inStyle" type="date" name="name">
</div>
</div>
<div class="row">
<div class="col-md-2 col-xs-4">
<label for="name">Home Address: </label>
</div>
<div class="col-md-2 col-xs-4 col-xs-offset-4">
<input class="inStyle" type="text" name="name">
</div>
</div>
<div class="row">
<div class="col-md-2 col-xs-4">
<label for="name">Phone Number: </label>
</div>
<div class="col-md-2 col-xs-4 col-xs-offset-4">
<input class="inStyle" type="text" name="name">
</div>
</div>
<div class="row">
<div class="col-md-2 col-xs-4">
<label for="name">Mobile Number: </label>
</div>
<div class="col-md-2 col-xs-4 col-xs-offset-4">
<input class="inStyle" type="text" name="name">
</div>
</div>
<div class="row">
<div class="col-md-2 col-xs-4">
<label for="name">Work Number: </label>
</div>
<div class="col-md-2 col-xs-4 col-xs-offset-4">
<input class="inStyle" type="text" name="name">
</div>
</div>
<div class="row cusrow">
<div class="col-md-2">
<label for="issues">Critical Issues:</label>
</div>
<div class="col-md-10">
<textarea name="issues" id="issues" olaceholder="Critical Health Issues" cols="40" rows="10"></textarea>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" id="saveBtn" class="btn btn-primary" >Save</button>
<button type="button" id="backBtn" class="btn btn-warning" data-dismiss="modal">Back</button>
</div>
</div>
</div>
</div>
<!-- Event Modal -->
<div class="modal fade" tabindex="-1" role="dialog" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Schedule Appointment</h4>
</div>
<div class="modal-body">
<div class="form">
<div class="form-group col-md-12">
<div class="col-md-3">
<label for="title">Event title:</label>
</div>
<div class="col-md-9">
<input type="text" name="title" class="form-control" id="eventTitle" required>
</div>
</div>
<div class="form-group col-md-12">
<div class="col-md-1">
<label for="title">Date:</label>
</div>
<div class="col-md-5">
<input type="date" name="title" id="dateSelection" class="form-control" required>
</div>
<div class="col-md-1">
<label for="timeList">Time:</label>
</div>
<div class="col-md-2">
<select class="form-control" id="timeList" required>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
</select>
</div>
<div class="col-md-2">
<select class="form-control" id="minuteList" required>
<option>00</option>
<option>30</option>
</select>
</div>
</div>
<div class="form-group col-md-12">
<div class="col-md-3 col-xs-9">
<label for="title">Patient SSN:</label>
</div>
<div class="col-md-9">
<?php if ($type == 'patient'){
echo("<input type=\"text\" id=\"searchSSN\" name=\"title\" class=\"form-control\" value=\"".$SSN."\">");
}
else {
echo("<input type=\"text\" id=\"searchSSN\" name=\"title\" class=\"form-control\" placeholder=\"Click to search\" required>");
}
?>
</div>
</div>
<div class="form-group">
<label for="regionList">Select region:</label> <!-- Fist Here -->
<select class="form-control" id="regionList" required>
<option>--</option>
<?php
$sql = "SELECT DISTINCT area FROM Health_Inst";
$result = mysqli_query($connection,$sql);
while ($row = mysqli_fetch_array($result)) {
echo ("<option>".$row['area']."</option>");
}
?>
</select>
</div>
<div class="form-group" id="specialtyList">
<label for="specList">Select Specialty:</label>
<select class="form-control" id="spList" required>
<option>--</option>
</select>
</div>
<div class="form-group" id="facilityList">
<label for="hospList">Select Facility:</label>
<select class="form-control" id="facList" required>
<option>--</option>
</select>
</div>
<br>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary" onclick="saveAppointment()">Schedule</button>
<button type="button" class="btn btn-warning" data-dismiss="modal">Cancel</button>
<div id="errorContainer"> <span style="color:red; margin-left: 10px;"></span> </div>
</div>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<!-- Calendar -->
<div class="container">
<div class="row">
<div class="col-md-12" id="calDiv">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Calendar</h3>
<button id="newBtn" type="button" class="btn btn-primary btn-xs"><span class="fa fa-plus"></span> NEW</button>
</div>
<div class="panel-body">
<div id="calendar"></div>
</div>
</div>
</div>
</div>
</div>
<!-- scripts -->
<script type="text/javascript" src="bower_components/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="bower_components/moment/min/moment.min.js"></script>
<script type="text/javascript" src="bower_components/fullcalendar/dist/fullcalendar.js"></script>
<script>
/* Initializing Calendar */
$(document).ready(function() {
$('#calendar').fullCalendar({
schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
// businessHours:true,
contentHeight: 480,
weekNumbers: true,
hiddenDays: [0],
header: {
left: 'prev,next today',
center: "title",
right: 'month,basicWeek,basicDay'
},
dayClick: function(date, jsEvent, view) {
console.log("dayclicked" + date.format());
document.getElementById("dateSelection").value = date.format();
$('#myModal').modal('toggle');
},
eventClick: function(calEvent, jsEvent, view) {
$('#aptModal').modal('toggle');
getAppointment(calEvent.id);
// change the border color just for fun
// $(this).css('border-color', 'red');
}
,
events: [
{
title: "Null Event",
start: "1969-01-01",
description: "this is niar"
}
<?php
if ($type == "patient"){
$sql="SELECT * FROM Appointment, Health_Inst WHERE Health_Inst_idHealth_Inst = idHealth_Inst AND Patient_SSN='".$SSN."'";
}
else {
$sql="SELECT * FROM Appointment, Health_Inst WHERE Health_Inst_idHealth_Inst = idHealth_Inst";
}
$result = mysqli_query($connection, $sql);
while($row = mysqli_fetch_array($result)) {
echo(",");
echo("{ title: '".$row['title']."',");
echo("start: '".$row['atDateTime']."',");
echo("description: '".$row['specialty']." at ".$row['area']."',");
echo("id: '".$row['idAppointment']."',");
echo("title: '".$row['title']."'}");
}
?>// more events here
],
eventMouseover: function(event, element) {
$(this).tooltip({title:event.description, html: true, container: "body"});
$(this).tooltip('show');
}
}); //end calendar
<?php
if ($type == "doctor") {
echo("document.getElementById(\"searchSSN\").onclick = function() {
searchSSN();
};");
}
?>
document.getElementById("backBtn").onclick = function() {
searchSSN();
};
document.getElementById("saveBtn").onclick = function() {
document.getElementById('searchSSN').value = document.getElementById('resultSSN').value;
searchSSN();
};
document.getElementById("newBtn").onclick = function() {
$('#myModal').modal('toggle');
};
document.getElementById("regionList").onchange = function() {
document.getElementById('facList').selectedIndex = 0;
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("specialtyList").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET","getSpecialtiesByArea.php?region="+this.value,true);
xmlhttp.send();
};
});
</script>
</body>
</html>