-
Notifications
You must be signed in to change notification settings - Fork 1
/
booking.php
185 lines (176 loc) · 6.8 KB
/
booking.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
<?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["start_date"] && x["start_date"].value == "") {
alert("Start Date cannot be empty");
return false;
}
if (x["end_date"] && x["end_date"].value == "") {
alert("End 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 booking for facility -->
<table class="table table-bordered table-striped">
<thead data-toggle="collapse" href="#collapseTableFacility">
<tr>
<th>Display Booking And Total Available Spots For Facility <i class="fa fa-chevron-down"></i></th>
</tr>
</thead>
<tbody class="collapse" id="collapseTableFacility">
<tr>
<td>
<form name="display_facility" action="./php/booking/read_facility.php" target="ifFacilityBooking" 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>Start Date</label>
<input type="date" class="form-control" placeholder="" name="start_date">
</div>
<div class="form-group col-sm-6">
<label>End Date</label>
<input type="date" class="form-control" placeholder="" name="end_date">
</div>
<button type="submit" class="btn aqua-gradient">Search</button>
</form>
</td>
</tr>
</tbody>
</table>
<a href='#' onclick='return clearIframe("ifFacilityBooking")'>clear</a>
<!-- iframe ifFacilityBooking-->
<div class="">
<iframe name="ifFacilityBooking" id="ifFacilityBookingId" width="100%" onload="iframeLoaded(this.getAttribute('id'))" background-color:#b0c4de; frameborder="0" scrolling="auto">
</iframe>
</div>
<hr>
<!-- display the first available spot -->
<table class="table table-bordered table-striped">
<thead data-toggle="collapse" href="#collapseTableFirstSpot">
<tr>
<th>Quick Search For Facility First Available Spot <i class="fa fa-chevron-down"></i></th>
</tr>
</thead>
<tbody class="collapse" id="collapseTableFirstSpot">
<tr>
<td>
<form name="first_spot" action="./php/booking/read_first_spot.php" target="ifFirstSpot" onsubmit="return validateForm(this.name)" method="get">
<div class="form-group">
<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">
<label>Start Date</label>
<input type="date" class="form-control" placeholder="" name="start_date">
</div>
<button type="submit" class="btn aqua-gradient">Search</button>
</form>
</td>
</tr>
</tbody>
</table>
<a href='#' onclick='return clearIframe("ifFirstSpot")'>clear</a>
<!-- iframe ifFirstSpot-->
<div class="">
<iframe name="ifFirstSpot" id="ifFirstSpotId" width="100%" onload="iframeLoaded(this.getAttribute('id'))" background-color:#b0c4de; frameborder="0" scrolling="auto">
</iframe>
</div>
<hr>
<!-- Booking Management iframe-->
<div class="container">
<div class="row">
<div class="col-sm">
<h2>Booking Management</h2>
</div>
<div class="col-sm">
<a href="/php/booking/check_avaliability.php" class="btn btn-success pull-right"><i class="fa fa-plus"></i> Create Booking</a>
</div>
</div>
<iframe src="/php/booking/booking.php" name="ifBookingManagement" id="ifBookingManagementId" width="100%" onload="iframeLoaded(this.getAttribute('id'))" background-color:#b0c4de; frameborder="0" scrolling="auto">
</iframe>
</div>
</div>
</body>
</html>