added search functionality for admin dashboard (new booking page)
This commit is contained in:
parent
d9e8e58ed9
commit
5bb669f628
2 changed files with 14 additions and 6 deletions
|
@ -7,11 +7,17 @@
|
||||||
|
|
||||||
|
|
||||||
if(isset($_POST['get_booking'])){
|
if(isset($_POST['get_booking'])){
|
||||||
$query = "SELECT bo.*, bd.* FROM `booking_order` bo INNER JOIN `booking_detail` bd ON bo.booking_id = bd.booking_id WHERE bo.booking_status = 'pending' AND bo.arrival = 0 ORDER BY bo.booking_id ASC";
|
$frm_data = filteration($_POST);
|
||||||
$res = mysqli_query($con, $query);
|
$query = "SELECT bo.*, bd.* FROM `booking_order` bo INNER JOIN `booking_detail` bd ON bo.booking_id = bd.booking_id WHERE (bo.order_id LIKE ? OR bd.phone LIKE ? OR bd.user_name LIKE ? OR bd.user_lastname LIKE ?) AND (bo.booking_status =? AND bo.arrival =?) ORDER BY bo.booking_id ASC";
|
||||||
|
$res = select($query, ["%$frm_data[search]%", "%$frm_data[search]%", "%$frm_data[search]%", "%$frm_data[search]%", "pending", 0], 'ssssss');
|
||||||
$i = 1;
|
$i = 1;
|
||||||
|
|
||||||
$table_data = "";
|
$table_data = "";
|
||||||
|
|
||||||
|
if(mysqli_num_rows($res)==0){
|
||||||
|
echo "No data available";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
while($data = mysqli_fetch_assoc($res)){
|
while($data = mysqli_fetch_assoc($res)){
|
||||||
$date = date("M-d-Y", strtotime($data['datentime']));
|
$date = date("M-d-Y", strtotime($data['datentime']));
|
||||||
$checkin = date("M-d-Y", strtotime($data['check_in']));
|
$checkin = date("M-d-Y", strtotime($data['check_in']));
|
||||||
|
@ -63,4 +69,6 @@
|
||||||
echo $res;
|
echo $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -28,7 +28,7 @@
|
||||||
<div class="card mb-4">
|
<div class="card mb-4">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="mb-4 text-end">
|
<div class="mb-4 text-end">
|
||||||
<input type="text" oninput="search_users(this.value)" class="form-control w-25 ms-auto shadow-none" placeholder="Search">
|
<input type="text" oninput="get_booking(this.value)" class="form-control w-25 ms-auto shadow-none" placeholder="Search">
|
||||||
</div>
|
</div>
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-hover border">
|
<table class="table table-hover border">
|
||||||
|
@ -82,7 +82,7 @@
|
||||||
|
|
||||||
let room_number_form = document.getElementById('room_number_form');
|
let room_number_form = document.getElementById('room_number_form');
|
||||||
|
|
||||||
function get_booking(){
|
function get_booking(search=''){
|
||||||
let xhr = new XMLHttpRequest();
|
let xhr = new XMLHttpRequest();
|
||||||
xhr.open("POST", "ajax/new_booking.php", true);
|
xhr.open("POST", "ajax/new_booking.php", true);
|
||||||
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
||||||
|
@ -90,7 +90,7 @@
|
||||||
xhr.onload = function(){
|
xhr.onload = function(){
|
||||||
document.getElementById('table_data').innerHTML = this.responseText;
|
document.getElementById('table_data').innerHTML = this.responseText;
|
||||||
}
|
}
|
||||||
xhr.send('get_booking');
|
xhr.send('get_booking&search='+search);
|
||||||
}
|
}
|
||||||
|
|
||||||
function room_number(id){
|
function room_number(id){
|
||||||
|
|
Loading…
Add table
Reference in a new issue