-
Notifications
You must be signed in to change notification settings - Fork 1
/
search.php
191 lines (181 loc) · 7.34 KB
/
search.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
<?php
require_once "./php/config.php";
$link = connect();
// Fetch facility table
$sql = "SELECT * FROM facility";
$result = mysqli_query($link, $sql);
$all_facility = mysqli_fetch_all($result, MYSQLI_ASSOC);
// Close connection
mysqli_close($link);
?>
<!DOCTYPE html>
<html>
<head>
<?php include($_SERVER['DOCUMENT_ROOT'] . "/html/head.html") ?>
<script>
function iframeLoaded(iframeId) {
var iframe = document.getElementById(iframeId);
if (iframe) {
// clear the current height, and set height based on content
iframe.height = "";
iframe.height = iframe.contentWindow.document.body.scrollHeight + "px";
}
}
function clearIframe(iframeName) {
var iframe = window.frames[iframeName];
iframe.document.open();
iframe.document.close();
}
function validateForm(formName) {
var x = document.forms[formName];
if (x["date"] && x["date"].value == "") {
alert("Date cannot be empty");
return false;
}
}
</script>
</head>
<body>
<!-- Fixed navbar -->
<nav class="navbar navbar-expand-lg fixed-top">
<div class="container">
<a id="logo" class="navbar-brand" href="index.php">C19PVS</a>
<div class="collapse navbar-collapse " id="navbarText">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="index.php">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="booking.php">Booking</a>
</li>
<li class="nav-item">
<a class="nav-link" href="vaccine.php">Vaccine</a>
</li>
<li class="nav-item">
<div class="dropdown">
<a class="nav-link" href="#" data-toggle="dropdown">
Report <i class="fa fa-chevron-down"></i>
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="/php/report/nurse.php">Nurse Report</a>
<a class="dropdown-item" href="/php/report/facility.php">Facility Report</a>
<a class="dropdown-item" href="/php/report/person.php">Person Report</a>
</div>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="search.php">Search</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">|</a>
</li>
</ul>
</div>
</div>
</nav><!-- Fixed navbar end-->
<div class="container">
<!-- display nurses for facility -->
<table class="table table-bordered table-striped">
<thead data-toggle="collapse" href="#collapseTableFacilityDateNurse">
<tr>
<th>For a given facility and on a given date, display the Nurses that work for the facility but are not assigned to the facility on the specified date <i class="fa fa-chevron-down"></i></th>
</tr>
</thead>
<tbody class="collapse" id="collapseTableFacilityDateNurse">
<tr>
<td>
<form name="display_facility_date_nurse" action="./php/search/facility_date_nurse.php" target="ifFacilityDateNurse" onsubmit="return validateForm(this.name)" method="get">
<div class="form-group col-sm-6">
<label>Facility</label>
<select class="form-select browser-default custom-select" name="facility_name">
<?php
foreach ($all_facility as $facility) {
echo '<option values=\"' . $facility['name'] . '\">' . $facility['name'] . '</option>';
}
?>
</select>
</div>
<div class="form-group col-sm-6">
<label>Date</label>
<input type="date" class="form-control" placeholder="" name="date">
</div>
<button type="submit" class="btn aqua-gradient">Search</button>
</form>
</td>
</tr>
</tbody>
</table>
<a href='#' onclick='return clearIframe("ifFacilityDateNurse")'>clear</a>
<!-- iframe ifFacilityDateNurse-->
<div class="">
<iframe name="ifFacilityDateNurse" id="ifFacilityDateNurseId" width="100%" onload="iframeLoaded(this.getAttribute('id'))" frameborder="0" scrolling="auto">
</iframe>
</div>
<hr>
<!-- display facility has no nurse-->
<table class="table table-bordered table-striped">
<thead data-toggle="collapse" href="#collapseTableDateFacilityNoNurse">
<tr>
<th>For a given date, display all the facilities that do not have any nurse scheduled to work at the facility <i class="fa fa-chevron-down"></i></th>
</tr>
</thead>
<tbody class="collapse" id="collapseTableDateFacilityNoNurse">
<tr>
<td>
<form name="display_date_facility_no_nurse" action="./php/search/date_facility_no_nurse.php" target="ifDateFacilityNoNurse" onsubmit="return validateForm(this.name)" method="get">
<div class="form-group col-sm-6">
<label>Date</label>
<input type="date" class="form-control" placeholder="" name="date">
</div>
<button type="submit" class="btn aqua-gradient">Search</button>
</form>
</td>
</tr>
</tbody>
</table>
<a href='#' onclick='return clearIframe("ifDateFacilityNoNurse")'>clear</a>
<!-- iframe ifDateFacilityNoNurse-->
<div class="">
<iframe name="ifDateFacilityNoNurse" id="ifDateFacilityNoNurseId" width="100%" onload="iframeLoaded(this.getAttribute('id'))" frameborder="0" scrolling="auto">
</iframe>
</div>
<!-- display facility schedule-->
<table class="table table-bordered table-striped">
<thead data-toggle="collapse" href="#collapseTableFacilitySchedule">
<tr>
<th>For a given facility and on a given date, display the schedule for the facility <i class="fa fa-chevron-down"></i></th>
</tr>
</thead>
<tbody class="collapse" id="collapseTableFacilitySchedule">
<tr>
<td>
<form name="display_facility_schedule" action="./php/search/facility_schedule.php" target="ifFacilitySchedule" onsubmit="return validateForm(this.name)" method="get">
<div class="form-group col-sm-6">
<label>Facility</label>
<select class="form-select browser-default custom-select" name="facility_name">
<?php
foreach ($all_facility as $facility) {
echo '<option values=\"' . $facility['name'] . '\">' . $facility['name'] . '</option>';
}
?>
</select>
</div>
<div class="form-group col-sm-6">
<label>Date</label>
<input type="date" class="form-control" placeholder="" name="date">
</div>
<button type="submit" class="btn aqua-gradient">Search</button>
</form>
</td>
</tr>
</tbody>
</table>
<a href='#' onclick='return clearIframe("ifFacilitySchedule")'>clear</a>
<!-- iframe ifFacilitySchedule-->
<div class="">
<iframe name="ifFacilitySchedule" id="ifFacilityScheduleId" width="100%" onload="iframeLoaded(this.getAttribute('id'))" frameborder="0" scrolling="auto">
</iframe>
</div>
</div>
</body>
</html>