-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreservation.php
343 lines (291 loc) · 17 KB
/
reservation.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
<?php
if (isset($_GET['room_id'])){
$get_room_id = $_GET['room_id'];
$get_room_sql = "SELECT * FROM room NATURAL JOIN room_type WHERE room_id = '$get_room_id'";
$get_room_result = mysqli_query($connection,$get_room_sql);
$get_room = mysqli_fetch_assoc($get_room_result);
$get_room_type_id = $get_room['room_type_id'];
$get_room_type = $get_room['room_type'];
$get_room_no = $get_room['room_no'];
$get_room_price = $get_room['price'];
}
?>
<div class="col-sm-9 col-sm-offset-3 col-lg-10 col-lg-offset-2 main">
<div class="row">
<ol class="breadcrumb">
<li><a href="#">
<em class="fa fa-home"></em>
</a></li>
<li class="active">Reservation</li>
</ol>
</div><!--/.row-->
<!-- <div class="row">
<div class="col-lg-12">
<h1 class="page-header">Reservation</h1>
</div>
</div>/.row -->
<div class="row">
<div class="col-lg-12">
<form role="form" id="booking" data-toggle="validator">
<div class="response"></div>
<div class="col-lg-12">
<?php
if (isset($_GET['room_id'])){?>
<div class="panel panel-default">
<div class="panel-heading">Room Information:
<a class="btn btn-secondary pull-right" href="index.php?room_mang">Replan Booking</a>
</div>
<div class="panel-body">
<div class="form-group col-lg-6">
<label>Room Type</label>
<select class="form-control" id="room_type" data-error="Select Room Type" required>
<option selected disabled>Select Room Type</option>
<option selected value="<?php echo $get_room_type_id; ?>"><?php echo $get_room_type; ?></option>
</select>
<div class="help-block with-errors"></div>
</div>
<div class="form-group col-lg-6">
<label>Room No</label>
<select class="form-control" id="room_no" onchange="fetch_price(this.value)" required data-error="Select Room No">
<option selected disabled>Select Room No</option>
<option selected value="<?php echo $get_room_id; ?>"><?php echo $get_room_no; ?></option>
</select>
<div class="help-block with-errors"></div>
</div>
<div class="form-group col-lg-6">
<label>Check In Date</label>
<input type="text" class="form-control" placeholder="mm/dd/yyyy" id="check_in_date" data-error="Select Check In Date" required>
<div class="help-block with-errors"></div>
</div>
<div class="form-group col-lg-6">
<label>Check Out Date</label>
<input type="text" class="form-control" placeholder="mm/dd/yyyy" id="check_out_date" data-error="Select Check Out Date" required>
<div class="help-block with-errors"></div>
</div>
<div class="col-lg-12">
<h4 style="font-weight: bold">Total Days : <span id="staying_day">0</span> Days</h4>
<h4 style="font-weight: bold">Price: <span id="price"><?php echo $get_room_price; ?></span> /-</h4>
<h4 style="font-weight: bold">Total Amount : <span id="total_price">0</span> /-</h4>
</div>
</div>
</div>
<?php } else{?>
<div class="panel panel-default">
<div class="panel-heading">Room Information:
<a class="btn btn-secondary pull-right" style="border-radius:0%" href="index.php?reservation">Replan Booking</a>
</div>
<div class="panel-body">
<div class="form-group col-lg-6">
<label>Room Type</label>
<select class="form-control" id="room_type" onchange="fetch_room(this.value);" required data-error="Select Room Type">
<option selected disabled>Select Room Type</option>
<?php
$query = "SELECT * FROM room_type";
$result = mysqli_query($connection,$query);
if (mysqli_num_rows($result) > 0){
while ($room_type = mysqli_fetch_assoc($result)){
echo '<option value="'.$room_type['room_type_id'].'">'.$room_type['room_type'].'</option>';
}}
?>
</select>
<div class="help-block with-errors"></div>
</div>
<div class="form-group col-lg-6">
<label>Room No</label>
<select class="form-control" id="room_no" onchange="fetch_price(this.value)" required data-error="Select Room No">
</select>
<div class="help-block with-errors"></div>
</div>
<div class="form-group col-lg-6">
<label>Check In Date</label>
<input type="text" class="form-control" placeholder="mm/dd/yyyy" id="check_in_date" data-error="Select Check In Date" required>
<div class="help-block with-errors"></div>
</div>
<div class="form-group col-lg-6">
<label>Check Out Date</label>
<input type="text" class="form-control" placeholder="mm/dd/yyyy" id="check_out_date" data-error="Select Check Out Date" required>
<div class="help-block with-errors"></div>
</div>
<div class="col-lg-12">
<h4 style="font-weight: bold">Total Days : <span id="staying_day">0</span> Days</h4>
<h4 style="font-weight: bold">Price: <span id="price">0</span> /-</h4>
<h4 style="font-weight: bold">Total Amount : <span id="total_price">0</span> /-</h4>
</div>
</div>
</div>
<?php }
?>
<div class="panel panel-default">
<div class="panel-heading">Customer Detail:</div>
<div class="panel-body">
<div class="form-group col-lg-6">
<label>First Name</label>
<input class="form-control" placeholder="First Name" id="first_name" data-error="Enter First Name" required>
<div class="help-block with-errors"></div>
</div>
<div class="form-group col-lg-6">
<label>Last Name</label>
<input class="form-control" placeholder="Last Name" id="last_name">
</div>
<div class="form-group col-lg-6">
<label>Contact Number</label>
<input type="number" class="form-control" data-error="Enter Min 10 Digit" data-minlength="10" placeholder="Contact No" id="contact_no" required>
<div class="help-block with-errors"></div>
</div>
<div class="form-group col-lg-6">
<label>Email Address</label>
<input type="email" class="form-control" placeholder="Email Address" id="email" data-error="Enter Valid Email Address" required>
<div class="help-block with-errors"></div>
</div>
<div class="form-group col-lg-6">
<label>ID Card Type</label>
<select class="form-control" id="id_card_id" data-error="Select ID Card Type" required onchange="validId(this.value);">
<option selected disabled>Select ID Card Type</option>
<?php
$query = "SELECT * FROM id_card_type";
$result = mysqli_query($connection,$query);
if (mysqli_num_rows($result) > 0){
while ($id_card_type = mysqli_fetch_assoc($result)){
echo '<option value="'.$id_card_type['id_card_type_id'].'">'.$id_card_type['id_card_type'].'</option>';
}}
?>
</select>
<div class="help-block with-errors"></div>
<!-- Ghamdan edit -->
<div class="form-group col-lg-6" >
<h4>face </h4>
<div id="face-container"></div>
</div>
<!-- Ghamdan edit -->
</div>
<div class="form-group col-lg-6">
<label>Selected ID Card Number</label>
<input type="text" class="form-control" placeholder="ID Card Number" id="id_card_no" data-error="Enter Valid ID Card No" required>
<div class="help-block with-errors"></div>
</div>
<div class="form-group col-lg-12">
<label>Residential Address</label>
<input type="text" class="form-control" placeholder="Full Address" id="address" required>
<div class="help-block with-errors"></div>
</div>
<div class="form-group col-lg-6">
<label>ID Card Type</label>
<select class="form-control" id="id_card_id" data-error="Select ID Card Type" required onchange="validId(this.value);">
<option selected disabled>Select ID Card Type</option>
<?php
$query = "SELECT * FROM id_card_type";
$result = mysqli_query($connection,$query);
if (mysqli_num_rows($result) > 0){
while ($id_card_type = mysqli_fetch_assoc($result)){
echo '<option value="'.$id_card_type['id_card_type_id'].'">'.$id_card_type['id_card_type'].'</option>';
}}
?>
</select>
<div class="help-block with-errors"></div>
</div>
</div>
<button type="submit" class="btn btn-lg btn-success pull-right" style="border-radius:0%">Submit</button>
</div>
</form>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<p class="back-link">Developed By Ghamdan</p>
</div>
</div>
</div> <!--/.main-->
<!-- Booking Confirmation-->
<div id="bookingConfirm" 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 text-center"><b>Room Booking</b></h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-lg-12">
<div class="alert bg-success alert-dismissable" role="alert"><em class="fa fa-lg fa-check-circle"> </em>Room Successfully Booked</div>
<table class="table table-striped table-bordered table-responsive">
<!-- <thead>
<tr>
<th>Name</th>
<th>Detail</th>
</tr>
</thead> -->
<tbody>
<tr>
<td><b>Customer Name</b></td>
<td id="getCustomerName"></td>
</tr>
<tr>
<td><b>Room Type</b></td>
<td id="getRoomType"></td>
</tr>
<tr>
<td><b>Room No</b></td>
<td id="getRoomNo"></td>
</tr>
<tr>
<td><b>Check In</b></td>
<td id="getCheckIn"></td>
</tr>
<tr>
<td><b>Check Out</b></td>
<td id="getCheckOut"></td>
</tr>
<tr>
<td><b>Total Amount</b></td>
<td id="getTotalPrice"></td>
</tr>
<tr>
<td><b>Payment Status</b></td>
<td id="getPaymentStaus"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn btn-primary" style="border-radius:60px;" href="index.php?reservation"><i class="fa fa-check-circle"></i></a>
</div>
</div>
</div>
</div>
<script>
function captureAndSave() {
fetch('/capture', { method: 'POST' })
.then(response => response.blob())
.then(blob => {
const imgUrl = URL.createObjectURL(blob);
const imageName = document.getElementById('imageName').value;
// Display the captured image
const faceContainer = document.getElementById('face-container');
const imgElement = document.createElement('img');
imgElement.src = imgUrl;
faceContainer.innerHTML = '';
faceContainer.appendChild(imgElement);
// Send the image data to server for saving
const formData = new FormData();
formData.append('name', imageName);
formData.append('image', blob);
fetch('/save', {
method: 'POST',
body: formData
}).then(response => {
if (response.ok) {
console.log('Image saved successfully');
// window.location.href = 'http://localhost/HotelMS-PHP/index.php?reservation';
} else {
console.error('Failed to save image');
}
}).catch(error => {
console.error('Error saving image:', error);
});
})
.catch(error => console.error('Error capturing face:', error));
}
</script>