completed room filter functionality

This commit is contained in:
Juthatip McDevitt 2024-07-08 20:21:33 -05:00
parent bfd996cf87
commit 9d08811f52
3 changed files with 42 additions and 45 deletions

View file

@ -100,6 +100,7 @@
<span class='badge text-dark mb-1' style='border-radius: 25px; background-color: #F3EEEA;'>Coffee & tea</span>
<span class='badge text-dark mb-1' style='border-radius: 25px; background-color: #F3EEEA;'>Desk</span>
<span class='badge text-dark mb-1' style='border-radius: 25px; background-color: #F3EEEA;'>Television</span>
<span class='badge text-dark mb-1' style='border-radius: 25px; background-color: #F3EEEA;'>toiletries</span>
<span class='badge text-dark mb-1' style='border-radius: 25px; background-color: #F3EEEA;'>Wi-Fi</span>
<span class='badge text-dark mb-1' style='border-radius: 25px; background-color: #F3EEEA;'>...</span>
</div>

View file

@ -51,7 +51,22 @@
</head>
<body>
<div class="booking-hero">
<?php require('./components/header.php') ?>
<?php
require('./components/header.php');
$checkin_default = '';
$checkout_default = '';
$adult_default = '';
$children_default = '';
if(isset($_GET['check_availability'])){
$frm_data = filteration($_GET);
$checkin_default = $frm_data['checkin'];
$checkout_default = $frm_data['checkout'];
$adult_default = $frm_data['adult'];
$children_default = $frm_data['children'];
}
?>
</div>
<p class="booking-title">Rooms available</p>
<div class="container-xxl">
@ -71,9 +86,9 @@
<button class="btn-set d-none" id='check-filter-btn' onclick='check_filter_clear()'><i class='bx bx-reset'></i></button>
</p>
<label class="form-label" style="font-size: 14px;">Check-in</label>
<input type="date" onchange="check_filter()" class="form-control shadow-none mb-4" id="checkin" style="font-size: 14px;"/>
<input type="date" onchange="check_filter()" class="form-control shadow-none mb-4" value="<?php echo $checkin_default ?>" id="checkin" style="font-size: 14px;"/>
<label class="form-label" style="font-size: 14px;">Check-out</label>
<input type="date" onchange="check_filter()" class="form-control shadow-none" id="checkout" style="font-size: 14px;"/>
<input type="date" onchange="check_filter()" class="form-control shadow-none" value="<?php echo $checkout_default ?>" id="checkout" style="font-size: 14px;"/>
</div>
<!--guest-->
<div class="border bg-white p-3 rounded mb-2">
@ -84,34 +99,14 @@
<div class="d-flex gap-2">
<div class="mb-2" style="font-size: 14px;">
<label class="form-label">Adults</label>
<input type="number" id="adult" oninput="guest_filter()" class="form-control shadow-none" min="1"/>
<input type="number" value="<?php echo $adult_default ?>" id="adult" oninput="guest_filter()" class="form-control shadow-none" min="1"/>
</div>
<div class="mb-2" style="font-size: 14px;">
<label class="form-label">Children</label>
<input type="number" id="children" oninput="guest_filter()" class="form-control shadow-none" min="1"/>
<input type="number" value="<?php echo $children_default ?>" id="children" oninput="guest_filter()" class="form-control shadow-none" min="1"/>
</div>
</div>
</div>
<!--room types-->
<div class="border bg-white p-3 rounded mb-2">
<p class="mb-2" style="font-weight: 600;">Room Types</p>
<div class="mb-1">
<input type="checkbox" id="room1" class="form-check-input shadow-none"/>
<label class="form-check-label" for="room1" style="font-size: 14px;">Standard room</label>
</div>
<div class="mb-1">
<input type="checkbox" id="room2" class="form-check-input shadow-none"/>
<label class="form-check-label" for="room2" style="font-size: 14px;">Deluxe room</label>
</div>
<div class="mb-1">
<input type="checkbox" id="room3" class="form-check-input shadow-none"/>
<label class="form-check-label" for="room3" style="font-size: 14px;">Double room</label>
</div>
<div class="mb-1">
<input type="checkbox" id="room4" class="form-check-input shadow-none"/>
<label class="form-check-label" for="room4" style="font-size: 14px;">Suit room</label>
</div>
</div>
<div class="border bg-white p-3 rounded mb-2">
<p class="mb-2" style="font-weight: 600;">Useful Infomation</p>
<div class="mb-2">
@ -214,9 +209,7 @@
guest_filter_btn.classList.add('d-none');
}
fetch_room();
</script>

View file

@ -21,39 +21,42 @@
<div class="container">
<div class="row row-form">
<div class="col-lg-12 bg-white shadow p-3 rounded">
<form>
<form action="booking.php">
<div class="row">
<p class="d-flex justify-content-center mb-4" style="color: #948979; font-size: 18px; font-weight: 600; text-transform: uppercase;">Quick Reservation</p>
<div class="col-lg-3">
<label class="form-label" style="color: black; font-weight: 500;">Check-in</label>
<input type="date" class="form-control shadow-none" style="font-size: 14px;"/>
<input type="date" class="form-control shadow-none" style="font-size: 14px;" name="checkin" required/>
</div>
<div class="col-lg-3">
<label class="form-label" style="color: black; font-weight: 500;">Check-out</label>
<input type="date" class="form-control shadow-none" style="font-size: 14px;"/>
<input type="date" class="form-control shadow-none" style="font-size: 14px;" name="checkout" required/>
</div>
<div class="col-lg-2">
<label class="form-label" style="color: black; font-weight: 500;">Adults</label>
<select class="form-select" style="font-size: 14px;">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">More than 5</option>
<select class="form-select" style="font-size: 14px;" name="adult">
<?php
$guest_query = mysqli_query($con, "SELECT MAX(adult) AS `max_adult`, MAX(children) AS `max_children` FROM `rooms` WHERE `status`=1 AND `removed` = 0");
$guest_res = mysqli_fetch_assoc($guest_query);
for($i = 1; $i <= $guest_res['max_adult']; $i++){
echo "<option value='$i'>$i</option>";
}
?>
</select>
</div>
<div class="col-lg-2">
<label class="form-label" style="color: black; font-weight: 500;">Children</label>
<select class="form-select" style="font-size: 14px;">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">More than 5</option>
<select class="form-select" style="font-size: 14px;" name="children">
<?php
$guest_query = mysqli_query($con, "SELECT MAX(adult) AS `max_adult`, MAX(children) AS `max_children` FROM `rooms` WHERE `status`=1 AND `removed` = 0");
$guest_res = mysqli_fetch_assoc($guest_query);
for($i = 1; $i <= $guest_res['max_children']; $i++){
echo "<option value='$i'>$i</option>";
}
?>
</select>
</div>
<input type='hidden' name="check_availability">
<div class="col-lg-2">
<div class="d-grid" style="align-items: center; margin-top: 30px;">
<button type="submit" class="btn btn-dark shadow-none d-block" style="font-size: 14px; font-weight: 500;">Search</button>