-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathroom_mang.php
422 lines (392 loc) · 20 KB
/
room_mang.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
<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">Room Management</li>
</ol>
</div><!--/.row-->
<br>
<div class="row">
<div class="col-lg-12">
<div id="success"></div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">Room Management
<button class="btn btn-info pull-right" data-toggle="modal" data-target="#addRoom">Add Room</button>
</div>
<div class="panel-body">
<?php
if (isset($_GET['error'])) {
echo "<div class='alert alert-danger'>
<span class='glyphicon glyphicon-info-sign'></span> Error on Delete !
</div>";
}
if (isset($_GET['success'])) {
echo "<div class='alert alert-success'>
<span class='glyphicon glyphicon-info-sign'></span> Successfully Delete !
</div>";
}
?>
<table class="table table-striped table-bordered table-responsive" cellspacing="0" width="100%"
id="rooms">
<thead>
<tr>
<th>Room No</th>
<th>Room Type</th>
<th>Booking Status</th>
<th>Check In</th>
<th>Check Out</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$room_query = "SELECT * FROM room NATURAL JOIN room_type WHERE deleteStatus = 0";
$rooms_result = mysqli_query($connection, $room_query);
if (mysqli_num_rows($rooms_result) > 0) {
while ($rooms = mysqli_fetch_assoc($rooms_result)) { ?>
<tr>
<td><?php echo $rooms['room_no'] ?></td>
<td><?php echo $rooms['room_type'] ?></td>
<td>
<?php
if ($rooms['status'] == 0) {
echo '<a href="index.php?reservation&room_id=' . $rooms['room_id'] . '&room_type_id=' . $rooms['room_type_id'] . '" class="btn btn-success">Book Room</a>';
} else {
echo '<a href="#" class="btn btn-danger">Booked</a>';
}
?>
<td>
<?php
if ($rooms['status'] == 1 && $rooms['check_in_status'] == 0) {
echo '<button class="btn btn-success" id="checkInRoom" data-id="' . $rooms['room_id'] . '" data-toggle="modal" data-target="#checkIn">Check In</button>';
} elseif ($rooms['status'] == 0) {
echo '-';
} else {
echo '<a href="#" class="btn btn-danger">Checked In</a>';
}
?>
</td>
<td>
<?php
if ($rooms['status'] == 1 && $rooms['check_in_status'] == 1) {
echo '<button class="btn btn-success" id="checkOutRoom" data-id="' . $rooms['room_id'] . '">Check Out</button>';
} elseif ($rooms['status'] == 0) {
echo '-';
}
?>
</td>
<td>
<button title="Edit Room Information" data-toggle="modal"
data-target="#editRoom" data-id="<?php echo $rooms['room_id']; ?>"
id="roomEdit" class="btn btn-info"><i class="fa fa-pencil"></i></button>
<?php
if ($rooms['status'] == 1) {
echo '<button title="Customer Information" data-toggle="modal" data-target="#cutomerDetailsModal" data-id="' . $rooms['room_id'] . '" id="cutomerDetails" class="btn btn-warning"><i class="fa fa-eye"></i></button>';
}
?>
<a href="ajax.php?delete_room=<?php echo $rooms['room_id']; ?>"
class="btn btn-danger" onclick="return confirm('Are you Sure?')"><i
class="fa fa-trash" alt="delete"></i></a>
</td>
</tr>
<?php }
} else {
echo "No Rooms";
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Add Room Modal -->
<div id="addRoom" 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">Add New Room</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-lg-12">
<form id="addRoom" data-toggle="validator" role="form">
<div class="response"></div>
<div class="form-group">
<label>Room Type</label>
<select class="form-control" id="room_type_id" 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">
<label>Room No</label>
<input class="form-control" placeholder="Room No" id="room_no"
data-error="Enter Room No" required>
<div class="help-block with-errors"></div>
</div>
<button class="btn btn-success pull-right">Add Room</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<!--Edit Room Modal -->
<div id="editRoom" 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">Edit Room</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-lg-12">
<form id="roomEditFrom" data-toggle="validator" role="form">
<div class="edit_response"></div>
<div class="form-group">
<label>Room Type</label>
<select class="form-control" id="edit_room_type" 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">
<label>Room No</label>
<input class="form-control" placeholder="Room No" id="edit_room_no" required
data-error="Enter Room No">
<div class="help-block with-errors"></div>
</div>
<input type="hidden" id="edit_room_id">
<button class="btn btn-success pull-right">Edit Room</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<!---customer details-->
<div id="cutomerDetailsModal" 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">Customer Detail</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-lg-12">
<table class="table table-responsive table-bordered">
<thead>
<tr>
<th>Title</th>
<th>Detail</th>
</tr>
</thead>
<tbody>
<tr>
<td>Customer Name</td>
<td id="customer_name"></td>
</tr>
<tr>
<td>Contact Number</td>
<td id="customer_contact_no"></td>
</tr>
<tr>
<td>Email</td>
<td id="customer_email"></td>
</tr>
<tr>
<td>ID Card Type</td>
<td id="customer_id_card_type"></td>
</tr>
<tr>
<td>ID Card Number</td>
<td id="customer_id_card_number"></td>
</tr>
<tr>
<td>Address</td>
<td id="customer_address"></td>
</tr>
<tr>
<td>Remaining Amount</td>
<td id="remaining_price"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!---customer details ends here-->
<!-- Check In Modal -->
<div id="checkIn" 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">Check In Room</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-lg-12">
<table class="table table-responsive table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Detail</th>
</tr>
</thead>
<tbody>
<tr>
<td>Customer Name</td>
<td id="getCustomerName"></td>
</tr>
<tr>
<td>Room Type</td>
<td id="getRoomType"></td>
</tr>
<tr>
<td>Room No</td>
<td id="getRoomNo"></td>
</tr>
<tr>
<td>Check In</td>
<td id="getCheckIn"></td>
</tr>
<tr>
<td>Check Out</td>
<td id="getCheckOut"></td>
</tr>
<tr>
<td>Total Price</td>
<td id="getTotalPrice"></td>
</tr>
</tbody>
</table>
<form role="form" id="advancePayment">
<div class="payment-response"></div>
<div class="form-group col-lg-12">
<label>Advance Payment</label>
<input type="number" class="form-control" id="advance_payment"
placeholder="Advance Payment">
</div>
<input type="hidden" id="getBookingID" value="">
<button type="submit" class="btn btn-primary pull-right">Payment & Check In</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Check Out Modal-->
<div id="checkOut" 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">Check Out Room</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-lg-12">
<table class="table table-responsive table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Detail</th>
</tr>
</thead>
<tbody>
<tr>
<td>Customer Name</td>
<td id="getCustomerName_n"></td>
</tr>
<tr>
<td>Room Type</td>
<td id="getRoomType_n"></td>
</tr>
<tr>
<td>Room No</td>
<td id="getRoomNo_n"></td>
</tr>
<tr>
<td>Check In</td>
<td id="getCheckIn_n"></td>
</tr>
<tr>
<td>Check Out</td>
<td id="getCheckOut_n"></td>
</tr>
<tr>
<td>Total Amount</td>
<td id="getTotalPrice_n"></td>
</tr>
<tr>
<td>Remaining Amount</td>
<td id="getRemainingPrice_n"></td>
</tr>
</tbody>
</table>
<form role="form" id="checkOutRoom_n" data-toggle="validator">
<div class="checkout-response"></div>
<div class="form-group col-lg-12">
<label>Remaining Payment</label>
<input type="text" class="form-control" id="remaining_amount"
placeholder="Remaining Payment" required
data-error="Please Enter Remaining Amount">
<div class="help-block with-errors"></div>
</div>
<input type="hidden" id="getBookingId_n" value="">
<button type="submit" class="btn btn-primary pull-right">Payment & Checkout</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<p class="back-link">MIS Developed by <a href="https://www.pcsaini.in">pcsaini</a></p>
</div>
</div>
</div> <!--/.main-->