-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist.php
91 lines (80 loc) · 3.43 KB
/
list.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
<?php
$date_in = isset($_POST['date_in']) ? $_POST['date_in'] : date('Y-m-d');
$date_out = isset($_POST['date_out']) ? $_POST['date_out'] : date('Y-m-d',strtotime(date('Y-m-d').' + 3 days'));
?>
<!-- Masthead-->
<header class="masthead">
<div class="container h-100">
<div class="row h-100 align-items-center justify-content-center text-center">
<div class="col-lg-10 align-self-end mb-4" style="background: #0000002e;">
<h1 class="text-uppercase text-white font-weight-bold">Rooms</h1>
<hr class="divider my-4" />
</div>
</div>
</div>
</header>
<section class="page-section bg-dark">
<div class="container">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<form action="index.php?page=list" id="filter" method="POST">
<div class="row">
<div class="col-md-3">
<label for="">Chech-in Date</label>
<input type="text" class="form-control datepicker" name="date_in" autocomplete="off" value="<?php echo isset($date_in) ? date("Y-m-d",strtotime($date_in)) : "" ?>">
</div>
<div class="col-md-3">
<label for="">Chech-out Date</label>
<input type="text" class="form-control datepicker" name="date_out" autocomplete="off" value="<?php echo isset($date_out) ? date("Y-m-d",strtotime($date_out)) : "" ?>">
</div>
<div class="col-md-3">
<br>
<button class="btn-btn-block btn-primary mt-3">Check Availability</button>
</div>
</div>
</form>
</div>
</div>
<hr>
<?php
$cat = $conn->query("SELECT * FROM room_categories");
$cat_arr = array();
while($row = $cat->fetch_assoc()){
$cat_arr[$row['id']] = $row;
}
$qry = $conn->query("SELECT distinct(category_id),category_id from rooms where id not in (SELECT room_id from checked where '$date_in' BETWEEN date(date_in) and date(date_out) and '$date_out' BETWEEN date(date_in) and date(date_out) )");
while($row= $qry->fetch_assoc()):
?>
<div class="card item-rooms mb-3">
<div class="card-body">
<div class="row">
<div class="col-md-5">
<img src="assets/img/<?php echo $cat_arr[$row['category_id']]['cover_img'] ?>" alt="">
</div>
<div class="col-md-5" height="100%">
<h3><b><?php echo '$ '.number_format($cat_arr[$row['category_id']]['price'],2) ?></b><span> / per day</span></h3>
<h4><b>
<?php echo $cat_arr[$row['category_id']]['name'] ?>
</b></h4>
<div class="align-self-end mt-5">
<button class="btn btn-primary float-right book_now" type="button" data-id="<?php echo $row['category_id'] ?>">Book now</button>
</div>
</div>
</div>
</div>
</div>
<?php endwhile; ?>
</div>
</div>
</section>
<style type="text/css">
.item-rooms img {
width: 23vw;
}
</style>
<script>
$('.book_now').click(function(){
uni_modal('Book','admin/book.php?in=<?php echo $date_in ?>&out=<?php echo $date_out ?>&cid='+$(this).attr('data-id'))
})
</script>