created admin dashboard-booking records page
This commit is contained in:
parent
5bb669f628
commit
83b122c4d1
4 changed files with 149 additions and 3 deletions
63
hotel_booking/admin/ajax/booking_record.php
Normal file
63
hotel_booking/admin/ajax/booking_record.php
Normal file
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
require('../components/utils.php');
|
||||
require('../components/db_config.php');
|
||||
adminLogin();
|
||||
|
||||
date_default_timezone_set("UTC");
|
||||
|
||||
|
||||
if(isset($_POST['get_booking'])){
|
||||
$frm_data = filteration($_POST);
|
||||
$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 ='pending' OR bo.booking_status ='cancel') ORDER BY bo.booking_id ASC";
|
||||
$res = select($query, ["%$frm_data[search]%", "%$frm_data[search]%", "%$frm_data[search]%", "%$frm_data[search]%"], 'ssss');
|
||||
$i = 1;
|
||||
$table_data = "";
|
||||
|
||||
if(mysqli_num_rows($res)==0){
|
||||
echo "No data available";
|
||||
exit;
|
||||
}
|
||||
|
||||
while($data = mysqli_fetch_assoc($res)){
|
||||
$date = date("M-d-Y", strtotime($data['datentime']));
|
||||
$checkin = date("M-d-Y", strtotime($data['check_in']));
|
||||
$checkout = date("M-d-Y", strtotime($data['check_out']));
|
||||
|
||||
if($data['booking_status'] == 'pending'){
|
||||
$status_bg = 'bg-success';
|
||||
$status = 'Booked';
|
||||
} else if($data['booking_status'] == 'cancel'){
|
||||
$status_bg = 'bg-danger';
|
||||
$status = 'Cancelled';
|
||||
} else{
|
||||
$status_bg = 'bg-warning text-dark';
|
||||
}
|
||||
|
||||
$table_data .= "
|
||||
<tr>
|
||||
<td>$i</td>
|
||||
<td> $data[user_name] $data[user_lastname]<br></td>
|
||||
<td style='font-size: 14px;'>$data[order_id]</td>
|
||||
<td style='font-size: 14px;'>
|
||||
<b>Room:</b> $data[room_name]<br>
|
||||
<b>Price:</b> $$data[price]/night<br>
|
||||
<b>Total:</b> $$data[total_pay]
|
||||
</td>
|
||||
<td style='font-size: 14px;'>
|
||||
<b>Book date:</b> $date<br>
|
||||
</td>
|
||||
<td>
|
||||
<span class='$status_bg text-white' style='padding: 5px; border-radius: 5px; font-size: 14px; font-weight: 600;'>$status</span>
|
||||
</td>
|
||||
<td>
|
||||
<button type='button' onclick='download_invoice($data[booking_id])' class='btn-second' style='font-size: 14px; padding: 5px; font-weight: 600;'> Invoice</button>
|
||||
</td>
|
||||
</tr>
|
||||
";
|
||||
$i++;
|
||||
}
|
||||
echo $table_data;
|
||||
|
||||
}
|
||||
|
||||
?>
|
80
hotel_booking/admin/booking_record.php
Normal file
80
hotel_booking/admin/booking_record.php
Normal file
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
require('components/utils.php');
|
||||
require('components/db_config.php');
|
||||
adminLogin();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Admin Dashboard-booking records | Midtown Hotel</title>
|
||||
<?php require('components/link.php') ?>
|
||||
<style>
|
||||
.custom-alert-t{
|
||||
position:fixed;
|
||||
top: 100px;
|
||||
right: 25px;
|
||||
z-index: 10000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<?php require('components/sidebar.php')?>
|
||||
<div class="container-fluid" id="dashboard-body">
|
||||
<div class="row">
|
||||
<div class="col-lg-10 ms-auto p-4 overflow-hidden">
|
||||
<h4 class="mb-4">Booking Records</h4>
|
||||
<div class="card mb-4">
|
||||
<div class="card-body">
|
||||
<div class="mb-4 text-end">
|
||||
<input type="text" oninput="get_booking(this.value)" class="form-control w-25 ms-auto shadow-none" placeholder="Search">
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover border">
|
||||
<thead>
|
||||
<tr style="background-color: #D3D3D3;">
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">User Detail</th>
|
||||
<th scope="col">Order Number</th>
|
||||
<th scope="col">Room Detail</th>
|
||||
<th scope="col">Booking Detail</th>
|
||||
<th scope="col">Status</th>
|
||||
<th scope="col">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="table_data">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php require('components/script.php') ?>
|
||||
<script>
|
||||
|
||||
function get_booking(search=''){
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "ajax/booking_record.php", true);
|
||||
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
||||
|
||||
xhr.onload = function(){
|
||||
document.getElementById('table_data').innerHTML = this.responseText;
|
||||
}
|
||||
xhr.send('get_booking&search='+search);
|
||||
}
|
||||
|
||||
function download_invoice(id){
|
||||
window.location.href = 'generate_invoice.php?gen_pdf&id='+id;
|
||||
}
|
||||
|
||||
window.onload = function(){
|
||||
get_booking();
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -27,7 +27,10 @@
|
|||
<div class="collapse px-3 show" id="bookings">
|
||||
<ul class="nav nav-pills flex-column">
|
||||
<li class="nav-item" id="new_booking">
|
||||
<a class="nav-link text-white" href="new_booking.php">New Booking</a>
|
||||
<a class="nav-link text-white" href="new_booking.php">New Bookings</a>
|
||||
</li>
|
||||
<li class="nav-item" id="booking_record">
|
||||
<a class="nav-link text-white" href="booking_record.php">Booking Records</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -111,9 +111,9 @@
|
|||
while($row = mysqli_fetch_assoc($data)){
|
||||
$seen = '';
|
||||
if($row['seen'] != 1){
|
||||
$seen = "<a href='?seen=$row[sr_no]' class='btn-seen'>Read</a>";
|
||||
$seen = "<a href='?seen=$row[sr_no]' class='btn-seen' style='font-size: 14px;'>Read</a>";
|
||||
}
|
||||
$seen.="<a href='?del=$row[sr_no]' class='btn-cancel mx-1'>Delete</a>";
|
||||
$seen.="<a href='?del=$row[sr_no]' class='btn-cancel mx-1' style='font-size: 14px;'>Delete</a>";
|
||||
|
||||
echo<<<query
|
||||
<tr>
|
||||
|
|
Loading…
Add table
Reference in a new issue