Compare commits
10 commits
f44748c5d5
...
7a870089a2
Author | SHA1 | Date | |
---|---|---|---|
7a870089a2 | |||
4e155682fe | |||
96d76083ed | |||
fefb1dabeb | |||
3c941714ae | |||
9d08811f52 | |||
bfd996cf87 | |||
24ff4cf9e7 | |||
19375cb450 | |||
5781bc0097 |
15 changed files with 931 additions and 139 deletions
2
epic_recipes/.gitignore
vendored
Normal file
2
epic_recipes/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
README.md
|
||||
images/*
|
50
epic_recipes/index.php
Normal file
50
epic_recipes/index.php
Normal file
|
@ -0,0 +1,50 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Epic Culinary Recipes</title>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400..900;1,400..900&family=Quicksand:wght@300..700&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
|
||||
|
||||
<style>
|
||||
*{
|
||||
font-family: "Quicksand", serif;
|
||||
}
|
||||
.special-font{
|
||||
font-family: "Playfair Display", serif;
|
||||
}
|
||||
.btn-main{
|
||||
background-color: #BB0036;
|
||||
border: none;
|
||||
color: white;
|
||||
padding: 6px 12px;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.btn-main:hover{
|
||||
background-color: #842029;
|
||||
color: white;
|
||||
transition: all 0.5s ease;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- navbar -->
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="#" style="color: #BB0036; font-weight: 600; font-size: 22px; font-style: italic">
|
||||
<img src="./images/img_logo.png" style="height: 50px;"></img> Curlinary Recipes
|
||||
</a>
|
||||
<form class="d-flex">
|
||||
<input class="form-control me-2" style="box-shadow: none;" type="search" placeholder="Search" aria-label="Search">
|
||||
<button class="btn btn-main" type="submit">Search</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</body>
|
||||
</html>
|
43
hotel_booking/README.md
Normal file
43
hotel_booking/README.md
Normal file
|
@ -0,0 +1,43 @@
|
|||
# Hotel booking web application with PHP
|
||||
|
||||
This project is a fullstack hotel booking and admin dashboard using PHP and MySQL. It involves building a web application where users can search for available rooms, book rooms, and manage their reservations. The admin dashboard allows the hotel management to manage bookings, rooms, and handle user accounts.
|
||||
|
||||
## User overview
|
||||
This typically includes feature such as room availability checking, booking confirmation, and user authentication.
|
||||
|
||||
#### User interface
|
||||
* Homepage => display the hotel information and search functionality.
|
||||
* Room search => allows user to search for available tooms based on dates and guests.
|
||||
* User registeration and login => users can create account and log in to their account and book rooms.
|
||||
* Booking form => collects user details and booking information.
|
||||
* Booking confirmation => shows the booking details.
|
||||
* User account => allows users to view and manage their booking.
|
||||
|
||||
#### Backend
|
||||
* PHP scripts => handle form submission and database interaction.
|
||||
* MySQL => store information about rooms, bookings, users, etc.
|
||||
|
||||
## Admin dashboard overview
|
||||
This typically includes features for viewing and managing bookings, adding or updating room details, and manage user accounts.
|
||||
|
||||
#### User interface
|
||||
* Dashboard => provides and overview of system status.
|
||||
* Manage rooms => allows adding, updating and deleting rooms.
|
||||
* Manage bookings => provides a list of booking with options to update or cancel.
|
||||
* Manage users => allows viewing and manging user accounts.
|
||||
|
||||
#### Backend
|
||||
* PHP scripts => handle admin actions, form submissions, and database interactions.
|
||||
* MySQL => uses the same schema as the booking system.
|
||||
|
||||
## Web application architecture diagram
|
||||
The diagram shows the overall web application with both user and admin interface.
|
||||
|
||||
<p><img src="./diagram/web_app_architect_diagram.png" width="800" height="380" /></p>
|
||||
|
||||
## Database architecture diagram
|
||||
The diagram shows the structural design of a database system. Please see a \.sql file to create tables.
|
||||
<p><img src="./diagram/database_architecture_diagram.png" width="800" height="380" /></p>
|
||||
|
||||
## Additional information
|
||||
This project uses [SendGrid](https://sendgrid.com/en-us) for sending emails to users for email verification during account registration. To implement SendGrid with PHP, please read [The Official Twilio SendGrid PHP API Library](https://github.com/sendgrid/sendgrid-php).
|
36
hotel_booking/admin/ajax/dashboard.php
Normal file
36
hotel_booking/admin/ajax/dashboard.php
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
require('../components/utils.php');
|
||||
require('../components/db_config.php');
|
||||
adminLogin();
|
||||
|
||||
if(isset($_POST['dashboard_booking'])){
|
||||
$frm_data = filteration($_POST);
|
||||
$timeline = "";
|
||||
if($frm_data['period'] == 1){
|
||||
$timeline = "WHERE datentime BETWEEN NOW() - INTERVAL 7 DAY AND NOW()";
|
||||
} else if($frm_data['period'] == 2){
|
||||
$timeline = "WHERE datentime BETWEEN NOW() - INTERVAL 30 DAY AND NOW()";
|
||||
} else if($frm_data['period'] == 3){
|
||||
$timeline = "WHERE datentime BETWEEN NOW() - INTERVAL 1 YEAR AND NOW()";
|
||||
}
|
||||
|
||||
$result = mysqli_fetch_assoc(mysqli_query($con, "SELECT
|
||||
COUNT(booking_id) AS `total_bookings`,
|
||||
SUM(payment) AS `total_payment`,
|
||||
|
||||
|
||||
COUNT(CASE WHEN booking_status = 'pending' AND arrival = 0 THEN 1 END) AS `pending_bookings`,
|
||||
SUM(CASE WHEN booking_status = 'pending' AND arrival = 0 THEN `payment` END) AS `pending_payment`,
|
||||
|
||||
COUNT(CASE WHEN booking_status = 'pending' AND arrival = 1 THEN 1 END) AS `active_bookings`,
|
||||
SUM(CASE WHEN booking_status = 'pending' AND arrival = 1 THEN `payment` END) AS `active_payment`,
|
||||
|
||||
COUNT(CASE WHEN booking_status = 'cancel' AND arrival = 0 THEN 0 END) AS `cancel_bookings`,
|
||||
IFNULL(SUM(CASE WHEN booking_status = 'cancel' AND arrival = 0 THEN `payment` END), 0) AS `cancel_payment`
|
||||
FROM `booking_order` $timeline"));
|
||||
|
||||
$output_booking = json_encode($result);
|
||||
|
||||
echo $output_booking;
|
||||
}
|
||||
?>
|
|
@ -41,6 +41,9 @@
|
|||
<li class="nav-item" id="user_query">
|
||||
<a class="nav-link text-white" href="user_query.php">User Query</a>
|
||||
</li>
|
||||
<li class="nav-item" id="user_review">
|
||||
<a class="nav-link text-white" href="user_review.php">Reviews</a>
|
||||
</li>
|
||||
<li class="nav-item" id="rooms">
|
||||
<a class="nav-link text-white" href="rooms.php">Rooms</a>
|
||||
</li>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
require('components/utils.php');
|
||||
require('components/db_config.php');
|
||||
adminLogin();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
|
@ -8,21 +9,346 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Admin Dashboard | Midtown Hotel</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
<?php require('components/link.php') ?>
|
||||
</head>
|
||||
<body>
|
||||
<?php require('components/sidebar.php')?>
|
||||
<?php
|
||||
require('components/sidebar.php');
|
||||
|
||||
$is_inactive = mysqli_fetch_assoc(mysqli_query($con ,"SELECT `shutdown` FROM `settings`"));
|
||||
$current_booking = mysqli_fetch_assoc(mysqli_query($con, "SELECT COUNT(CASE WHEN booking_status = 'pending' AND arrival = 0 THEN 1 END) AS `new_bookings` FROM `booking_order`"));
|
||||
|
||||
$dashboard_query = mysqli_fetch_assoc(mysqli_query($con ,"SELECT COUNT(sr_no) AS `count_query` FROM `user_query` WHERE `seen` = 0"));
|
||||
$dashboard_review = mysqli_fetch_assoc(mysqli_query($con ,"SELECT COUNT(sr_no) AS `count_review` FROM `review` WHERE `seen` = 0"));
|
||||
$current_user = mysqli_fetch_assoc(mysqli_query($con, "SELECT COUNT(CASE WHEN `status` = 1 THEN 1 END) AS `active`, COUNT(CASE WHEN `status` = 0 THEN 1 END) AS `inactive`,
|
||||
COUNT(id) AS `total` FROM `user_creds`"));
|
||||
?>
|
||||
|
||||
<div class="container-fluid" id="dashboard-body">
|
||||
<div class="row">
|
||||
<div class="col-lg-10 ms-auto p-4 overflow-hidden">
|
||||
This is a dashboard page!
|
||||
<div class="d-flex align-items-center justify-content-between mb-4">
|
||||
<h4 class="mb-4">Dashboard</h4>
|
||||
<?php
|
||||
if($is_inactive['shutdown']){
|
||||
echo <<<data
|
||||
<p class="badge bg-danger py-2 px-2">Inactive Mode</p>
|
||||
data;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="row mb-2">
|
||||
<div class="col-md-4 mb-4">
|
||||
<a href="new_booking.php" style="text-decoration: none;">
|
||||
<div class="card border-light text-center p-3 shadow-sm">
|
||||
<i class='bx bxs-bell-ring mb-2' style="font-size: 46px; color: #3D30A2;"></i>
|
||||
<p class="mb-2 text-dark" style="font-size: 24px;"><?php echo $current_booking['new_bookings']?></p>
|
||||
<p class="mb-2 text-secondary">New Bookings</p>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-md-4 mb-4">
|
||||
<a href="user_query.php" style="text-decoration: none;">
|
||||
<div class="card border-light text-center p-3 shadow-sm">
|
||||
<i class='bx bxs-file-find mb-2' style="font-size: 46px; color: #FC4100;"></i>
|
||||
<p class="mb-2 text-dark" style="font-size: 24px;"><?php echo $dashboard_query['count_query']?></p>
|
||||
<p class="mb-2 text-secondary">Queries</p>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-md-4 mb-4">
|
||||
<a href="user_review.php" style="text-decoration: none;">
|
||||
<div class="card border-light text-center p-3 shadow-sm">
|
||||
<i class='bx bxs-comment mb-2' style="font-size: 46px; color: #FFC55A;"></i>
|
||||
<p class="mb-2 text-dark" style="font-size: 24px;"><?php echo $dashboard_review['count_review']?></p>
|
||||
<p class="mb-2 text-secondary">Reviews</p>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 mb-4">
|
||||
<div class="card text-center p-3">
|
||||
<i class='bx bxs-user-circle mb-2' style="font-size: 46px; color: #758694;"></i>
|
||||
<p class="mb-2 text-dark" style="font-size: 24px;"><?php echo $current_user['total']?></p>
|
||||
<p class="mb-2 text-secondary">User Total</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 mb-4">
|
||||
<div class="card text-center p-3">
|
||||
<i class='bx bxs-user-check mb-2' style="font-size: 46px; color: #50B498;"></i>
|
||||
<p class="mb-2 text-dark" style="font-size: 24px;"><?php echo $current_user['active']?></p>
|
||||
<p class="mb-2 text-secondary">User Active</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 mb-4">
|
||||
<div class="card text-center p-3 ">
|
||||
<i class='bx bxs-user-x mb-2' style="font-size: 46px; color: #E4003A;"></i>
|
||||
<p class="mb-2 text-dark" style="font-size: 24px;"><?php echo $current_user['inactive']?></p>
|
||||
<p class="mb-2 text-secondary">User Inactive</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 mb-4">
|
||||
<div class="card border-light p-3 shadow-sm">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<p style="font-size: 20px;">Overview</p>
|
||||
<select class="p-1" onchange = "dashboard_booking(this.value)" style="background-color: transparent; border: 1px solid gray; border-radius: 3px; font-size: 14px;">
|
||||
<option value="1">Past 7 days</option>
|
||||
<option value="2">Past 30 days</option>
|
||||
<option value="3">For the past year</option>
|
||||
<option value="4">All time</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="d-flex">
|
||||
<i class='bx bxs-circle p-1' style="color: #3FA2F6;"></i>
|
||||
<div>
|
||||
<p class="text-secondary">Total Booking (<span id="total_bookings">0</span>)</p>
|
||||
<p id="total_payment"style="font-size: 18px;"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
<i class='bx bxs-circle p-1' style="color: #FFC55A;"></i>
|
||||
<div>
|
||||
<p class="text-secondary">Pending (<span id="pending_bookings">0</span>)</p>
|
||||
<p id="pending_payment" style="font-size: 18px;"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
<i class='bx bxs-circle p-1' style="color: #50B498;"></i>
|
||||
<div>
|
||||
<p class="text-secondary">Booked (<span id="active_bookings">0</span>)</p>
|
||||
<p id="active_payment" style="font-size: 18px;"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
<i class='bx bxs-circle p-1' style="color: #E4003A;"></i>
|
||||
<div>
|
||||
<p class="text-secondary">Cancelled (<span id="cancel_bookings">0</span>)</p>
|
||||
<p id="cancel_payment" style="font-size: 18px;"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<?php
|
||||
$main_query = "
|
||||
SELECT SUM(payment) as `total_payment_q`,
|
||||
COUNT(CASE WHEN booking_status = 'pending' AND arrival = 0 THEN 0 END) AS `booking_pending`,
|
||||
COUNT(CASE WHEN booking_status = 'pending' AND arrival = 1 THEN 1 END) AS `active_bookings`,
|
||||
COUNT(CASE WHEN booking_status = 'cancel' AND arrival = 0 THEN 0 END) AS `cancel_bookings`
|
||||
";
|
||||
|
||||
$query_str="$main_query FROM booking_order;";
|
||||
$query_7_days="$main_query FROM booking_order WHERE datentime BETWEEN NOW() - INTERVAL 7 DAY AND NOW();";
|
||||
$query_30_days="$main_query FROM booking_order WHERE datentime BETWEEN NOW() - INTERVAL 30 DAY AND NOW();";
|
||||
$query_1_year="$main_query FROM booking_order WHERE datentime BETWEEN NOW() - INTERVAL 1 YEAR AND NOW();";
|
||||
|
||||
// all query
|
||||
$query_booking = mysqli_fetch_all(mysqli_query($con, $query_str));
|
||||
$payment = [];
|
||||
$booking_pending = [];
|
||||
$active_bookings = [];
|
||||
$cancel_bookings = [];
|
||||
foreach($query_booking as $data){
|
||||
$payment[] = $data[0];
|
||||
$booking_pending[] = $data[1];
|
||||
$active_bookings[] = $data[2];
|
||||
$cancel_bookings[] = $data[3];
|
||||
}
|
||||
|
||||
// 7 day query
|
||||
$query_booking_7 = mysqli_fetch_all(mysqli_query($con, $query_7_days));
|
||||
$payment_7 = [];
|
||||
$booking_pending_7 = [];
|
||||
$active_bookings_7 = [];
|
||||
$cancel_bookings_7 = [];
|
||||
foreach($query_booking_7 as $data){
|
||||
$payment_7[] = $data[0];
|
||||
$booking_pending_7[] = $data[1];
|
||||
$active_bookings_7[] = $data[2];
|
||||
$cancel_bookings_7[] = $data[3];
|
||||
}
|
||||
|
||||
// 30 day query
|
||||
$query_booking_30 = mysqli_fetch_all(mysqli_query($con, $query_30_days));
|
||||
$payment_30 = [];
|
||||
$booking_pending_30 = [];
|
||||
$active_bookings_30 = [];
|
||||
$cancel_bookings_30 = [];
|
||||
foreach($query_booking_30 as $data){
|
||||
$payment_30[] = $data[0];
|
||||
$booking_pending_30[] = $data[1];
|
||||
$active_bookings_30[] = $data[2];
|
||||
$cancel_bookings_30[] = $data[3];
|
||||
}
|
||||
|
||||
// 1 year query
|
||||
$query_booking_1_year = mysqli_fetch_all(mysqli_query($con, $query_1_year));
|
||||
$payment_1_year = [];
|
||||
$booking_pending_1_year = [];
|
||||
$active_bookings_1_year = [];
|
||||
$cancel_bookings_1_year = [];
|
||||
foreach($query_booking_1_year as $data){
|
||||
$payment_1_year[] = $data[0];
|
||||
$booking_pending_1_year[] = $data[1];
|
||||
$active_bookings_1_year[] = $data[2];
|
||||
$cancel_bookings_1_year[] = $data[3];
|
||||
}
|
||||
?>
|
||||
<div>
|
||||
<canvas id="myChart" style="position: relative; max-height: 600px;"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php require('components/script.php') ?>
|
||||
<script>
|
||||
const labels = [];
|
||||
labels.push("Pending", "Booked", "Cancelled");
|
||||
|
||||
const data_all = {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
label: 'Total Booking',
|
||||
data: <?php echo json_encode(array($booking_pending, $active_bookings, $cancel_bookings)) ?>,
|
||||
backgroundColor: [
|
||||
'#FFC55A',
|
||||
'#50B498',
|
||||
'#E4003A'
|
||||
],
|
||||
tension: 0.1
|
||||
}]
|
||||
};
|
||||
|
||||
const data_7 = {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
label: 'Total Booking: 7 Days',
|
||||
data: <?php echo json_encode(array($booking_pending_7, $active_bookings_7, $cancel_bookings_7)) ?>,
|
||||
fill: false,
|
||||
backgroundColor: [
|
||||
'#FFC55A',
|
||||
'#50B498',
|
||||
'#E4003A'
|
||||
],
|
||||
tension: 0.1
|
||||
}]
|
||||
};
|
||||
|
||||
const data_30 = {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
label: 'Total Booking: 30 Days',
|
||||
data: <?php echo json_encode(array($booking_pending_30, $active_bookings_30, $cancel_bookings_30)) ?>,
|
||||
fill: false,
|
||||
backgroundColor: [
|
||||
'#FFC55A',
|
||||
'#50B498',
|
||||
'#E4003A'
|
||||
],
|
||||
tension: 0.1
|
||||
}]
|
||||
};
|
||||
|
||||
const data_year = {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
label: 'Total Booking: 1 Year',
|
||||
data: <?php echo json_encode(array($booking_pending_1_year, $active_bookings_1_year, $cancel_bookings_1_year)) ?>,
|
||||
fill: false,
|
||||
backgroundColor: [
|
||||
'#FFC55A',
|
||||
'#50B498',
|
||||
'#E4003A'
|
||||
],
|
||||
tension: 0.1
|
||||
}]
|
||||
};
|
||||
|
||||
const config_all = {
|
||||
type: 'pie',
|
||||
data: data_all
|
||||
};
|
||||
|
||||
const config_7 = {
|
||||
type: 'pie',
|
||||
data: data_7
|
||||
};
|
||||
|
||||
const config_30 = {
|
||||
type: 'pie',
|
||||
data: data_30
|
||||
};
|
||||
|
||||
const config_year = {
|
||||
type: 'pie',
|
||||
data: data_year
|
||||
};
|
||||
|
||||
function draw_chart(config) {
|
||||
var myChart = new Chart(
|
||||
document.getElementById('myChart'),
|
||||
config
|
||||
);
|
||||
return myChart;
|
||||
}
|
||||
|
||||
function destroy_chart_if_exists() {
|
||||
var myChart = Chart.getChart("myChart");
|
||||
if (typeof myChart == 'undefined') {
|
||||
console.log("myChart does not exist. Cannot destroy non-existing chart.");
|
||||
} else {
|
||||
myChart.destroy();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function dashboard_booking(period = 1){
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "ajax/dashboard.php", true);
|
||||
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
||||
|
||||
xhr.onload = function(){
|
||||
let data = JSON.parse(this.responseText);
|
||||
document.getElementById('total_bookings').textContent = data.total_bookings;
|
||||
document.getElementById('total_payment').textContent = '$'+data.total_payment;
|
||||
document.getElementById('pending_bookings').textContent = data.pending_bookings;
|
||||
document.getElementById('pending_payment').textContent = '$'+data.pending_payment;
|
||||
document.getElementById('active_bookings').textContent = data.active_bookings;
|
||||
document.getElementById('active_payment').textContent = '$'+data.active_payment;
|
||||
document.getElementById('cancel_bookings').textContent = data.cancel_bookings;
|
||||
document.getElementById('cancel_payment').textContent = '$'+data.cancel_payment;
|
||||
}
|
||||
// code to draw and destroy our chart on same canvas
|
||||
// note: we have to destroy the chart before redrawing on the same canvas or we will receive
|
||||
// Uncaught Error: Canvas is already in use. Chart with ID '0' must be destroyed before the canvas with ID 'myChart' can be reused.
|
||||
if (period == 1) {
|
||||
destroy_chart_if_exists();
|
||||
draw_chart(config_7);
|
||||
} else if (period == 2) {
|
||||
destroy_chart_if_exists();
|
||||
draw_chart(config_30);
|
||||
} else if (period == 2) {
|
||||
destroy_chart_if_exists();
|
||||
draw_chart(config_year);
|
||||
} else {
|
||||
destroy_chart_if_exists();
|
||||
draw_chart(config_all);
|
||||
};
|
||||
|
||||
xhr.send('dashboard_booking&period='+period);
|
||||
}
|
||||
window.onload = function(){
|
||||
dashboard_booking();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -91,7 +91,7 @@
|
|||
</div>
|
||||
<div class="table-responsive-md" style="height: 450px; overflow-y: scroll;">
|
||||
<table class="table table-hover border">
|
||||
<thead class="sticky-top">
|
||||
<thead>
|
||||
<tr style="background-color: #D3D3D3;">
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">Name</th>
|
||||
|
|
150
hotel_booking/admin/user_review.php
Normal file
150
hotel_booking/admin/user_review.php
Normal file
|
@ -0,0 +1,150 @@
|
|||
<?php
|
||||
require('components/utils.php');
|
||||
require('components/db_config.php');
|
||||
adminLogin();
|
||||
|
||||
if(isset($_GET['seen'])){
|
||||
$frm_data = filteration($_GET);
|
||||
|
||||
if($frm_data['seen'] == 'all'){
|
||||
$q = "UPDATE `review` SET `seen`=?";
|
||||
$values = [1];
|
||||
if(update($q, $values, 'i')){
|
||||
alert('success', 'Read all');
|
||||
} else{
|
||||
alert('error', 'Please try again!');
|
||||
}
|
||||
} else{
|
||||
$q = "UPDATE `review` SET `seen`=? WHERE `sr_no`=?";
|
||||
$values = [1, $frm_data['seen']];
|
||||
if(update($q, $values, 'ii')){
|
||||
alert('success', 'Mark as read');
|
||||
} else{
|
||||
alert('error', 'Please try again!');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_GET['del'])){
|
||||
$frm_data = filteration($_GET);
|
||||
|
||||
if($frm_data['del'] == 'all'){
|
||||
$q = "DELETE FROM `review`";
|
||||
if(mysqli_query($con, $q)){
|
||||
alert('success', 'Delete all');
|
||||
} else{
|
||||
alert('error', 'Please try again!');
|
||||
}
|
||||
} else{
|
||||
$q = "DELETE FROM `review` WHERE `sr_no`=?";
|
||||
$values = [$frm_data['del']];
|
||||
if(delete($q, $values, 'i')){
|
||||
alert('success', 'Delete');
|
||||
} else{
|
||||
alert('error', 'Please try again!');
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Admin Dashboard-user Query | Midtown Hotel</title>
|
||||
<?php require('components/link.php')?>
|
||||
<style>
|
||||
.btn-seen{
|
||||
background-color: #77B0AA;
|
||||
border: none;
|
||||
color: white;
|
||||
padding: 5px 10px;
|
||||
text-align: center;
|
||||
font-weight: 500;
|
||||
border-radius: 3px;
|
||||
text-decoration: none;
|
||||
}
|
||||
.btn-seen:hover{
|
||||
background-color: #E3FEF7;
|
||||
color: black;
|
||||
transition: all 0.5s ease;
|
||||
}
|
||||
.custom-alert{
|
||||
position:fixed;
|
||||
top: 50px;
|
||||
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">Reviews</h4>
|
||||
<div class="card mb-4">
|
||||
<div class="card-body">
|
||||
<div class="text-end mb-4">
|
||||
<a href="?seen=all" class='btn-seen'>Read All</a>
|
||||
<a href="?del=all" class='btn-cancel'>Delete All</a>
|
||||
</div>
|
||||
<div class="table-responsive-md">
|
||||
<table class="table table-hover border">
|
||||
<thead>
|
||||
<tr style="background-color: #D3D3D3;">
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">Username</th>
|
||||
<th scope="col">Type</th>
|
||||
<th scope="col">Room</th>
|
||||
<th scope="col">Cleanliness</th>
|
||||
<th scope="col">Staff</th>
|
||||
<th scope="col">Service</th>
|
||||
<th scope="col" width="25%">Comment</th>
|
||||
<th scope="col">Date</th>
|
||||
<th scope="col">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$q = "SELECT re. *, uc.firstname AS uname, rs.name AS rname FROM `review` re INNER JOIN `user_creds` uc ON re.user_id = uc.id INNER JOIN `rooms` rs ON re.room_id = rs.id ORDER BY `sr_no` DESC";
|
||||
$data = mysqli_query($con, $q);
|
||||
$i = 1;
|
||||
|
||||
while($row = mysqli_fetch_assoc($data)){
|
||||
$date = date('F j, Y', strtotime($row['datentime']));
|
||||
$seen = '';
|
||||
if($row['seen'] != 1){
|
||||
$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' style='font-size: 14px;'>Delete</a>";
|
||||
|
||||
echo<<<query
|
||||
<tr>
|
||||
<td>$i</td>
|
||||
<td>$row[uname]</td>
|
||||
<td>$row[rname]</td>
|
||||
<td>$row[room_review]</td>
|
||||
<td>$row[clean_review]</td>
|
||||
<td>$row[staff_review]</td>
|
||||
<td>$row[service_review]</td>
|
||||
<td>$row[review]</td>
|
||||
<td>$date</td>
|
||||
<td>$seen</td>
|
||||
</tr>
|
||||
query;
|
||||
$i++;
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php require('components/script.php') ?>
|
||||
</body>
|
||||
</html>
|
26
hotel_booking/ajax/review_room.php
Normal file
26
hotel_booking/ajax/review_room.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
require('../admin/components/db_config.php');
|
||||
require('../admin/components/utils.php');
|
||||
|
||||
date_default_timezone_set("America/Chicago");
|
||||
|
||||
session_start();
|
||||
if(!(isset($_SESSION['login']) && $_SESSION['login'] == true)){
|
||||
redirect('index.php');
|
||||
}
|
||||
|
||||
if(isset($_POST['review_form'])){
|
||||
$frm_data = filteration($_POST);
|
||||
$update_query = "UPDATE `booking_order` SET `review`=? WHERE `booking_id`=? AND `user_id`=?";
|
||||
$update_values = [1, $frm_data['booking_id'], $_SESSION['uerID']];
|
||||
$update_result = update($update_query, $update_values, 'iii');
|
||||
|
||||
$insert_query = "INSERT INTO `review`(`booking_id`, `room_id`, `user_id`, `room_review`, `clean_review`, `staff_review`, `service_review`, `review`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
$insert_values = [$frm_data['booking_id'], $frm_data['room_id'], $_SESSION['uerID'], $frm_data['room_review'], $frm_data['clean_review'], $frm_data['staff_review'], $frm_data['service_review'], $frm_data['review']];
|
||||
$insert_result = insert($insert_query, $insert_values, 'iiiiiiis');
|
||||
|
||||
echo $insert_result;
|
||||
}
|
||||
|
||||
?>
|
127
hotel_booking/ajax/room.php
Normal file
127
hotel_booking/ajax/room.php
Normal file
|
@ -0,0 +1,127 @@
|
|||
<?php
|
||||
|
||||
require('../admin/components/db_config.php');
|
||||
require('../admin/components/utils.php');
|
||||
date_default_timezone_set("America/Chicago");
|
||||
session_start();
|
||||
|
||||
if(isset($_GET['fetch_room'])){
|
||||
//check room availability
|
||||
$check_filter = json_decode($_GET['check_filter'], true);
|
||||
if($check_filter['checkin'] != '' && $check_filter['checkout'] != ''){
|
||||
$today_date = new DateTime(date("F j, Y"));
|
||||
$checkin_date = new DateTime($check_filter['checkin']);
|
||||
$checkout_date = new DateTime($check_filter['checkout']);
|
||||
|
||||
if($checkin_date == $checkout_date){
|
||||
echo "<p>No options matching your search, please make sure your check-in and check-out date is not the same!</p>";
|
||||
exit;
|
||||
} else if($checkout_date < $checkin_date){
|
||||
echo "<p>No options matching your search, please check your check-out date</p>";
|
||||
exit;;
|
||||
} else if($checkin_date < $today_date){
|
||||
echo "<p>No options matching your search, please check your check-in date</p>";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//check guest filter
|
||||
$guest_filter = json_decode($_GET['guest_filter'], true);
|
||||
$adult = ($guest_filter['adult']!='') ? $guest_filter['adult'] : 0;
|
||||
$children = ($guest_filter['children']!='') ? $guest_filter['children'] : 0;
|
||||
|
||||
//output available room
|
||||
$count_room = 0;
|
||||
$setting_query = "SELECT *FROM `settings` WHERE `sr_no` = 1";
|
||||
$settings_result = mysqli_fetch_assoc(mysqli_query($con, $setting_query));
|
||||
$output = "";
|
||||
|
||||
$room_res = select("SELECT * FROM `rooms` WHERE `adult` >=? AND `children` >=? AND `status`=? AND `removed`=?", [$adult, $children, 1, 0], 'iiii');
|
||||
while($room_data = mysqli_fetch_assoc($room_res)){
|
||||
//fetch room availability
|
||||
if($check_filter['checkin'] != '' && $check_filter['check-out'] != ''){
|
||||
$data_query = "SELECT COUNT(*) AS `total_booking` FROM `booking_order` WHERE booking_status=? AND room_id=? AND check_out > ? AND check_in < ?";
|
||||
$values = ['pending', $room_data['id'], $check_filter['checkin'], $check_filter['checkout']];
|
||||
$data_fetch = mysqli_fetch_assoc(select($data_query, $values, 'siss'));
|
||||
|
||||
if(($room_data['quantity'] - $data_fetch['total_booking']) == 0){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//get accommodation data from database
|
||||
$accom_q = mysqli_query($con, "SELECT a.name FROM `accommodation` a INNER JOIN `room_accommodation` raccom ON a.id = raccom.accommodation_id WHERE raccom.room_id = '$room_data[id]'");
|
||||
$accommodation_data = "";
|
||||
|
||||
while($accom_row = mysqli_fetch_assoc($accom_q)){
|
||||
$accommodation_data .="<span class='badge text-dark mb-1' style='border-radius: 25px; background-color: #F3EEEA;'>$accom_row[name]</span>";
|
||||
}
|
||||
|
||||
//get additional accommodation data from database
|
||||
$addi_q = mysqli_query($con, "SELECT a.name FROM `additional_accomm` a INNER JOIN `room_additionalAccom` raddi ON a.id = raddi.additionalAccom_id WHERE raddi.room_id = '$room_data[id]'");
|
||||
$additionalAccom_data = "";
|
||||
|
||||
while($addi_row = mysqli_fetch_assoc($addi_q)){
|
||||
$additionalAccom_data .="<span class='badge text-dark mb-1 mx-1' style='border-radius: 25px; background-color: #F3EEEA;'>$addi_row[name]</span>";
|
||||
}
|
||||
|
||||
//get cover image
|
||||
$room_cover = ROOM_IMG_PATH."logo.png";
|
||||
$cover_q = mysqli_query($con, "SELECT * FROM `room_images` WHERE `room_id`='$room_data[id]' AND `upload`='1'");
|
||||
|
||||
if(mysqli_num_rows($cover_q) > 0){
|
||||
$cover_res = mysqli_fetch_assoc($cover_q);
|
||||
$room_cover = ROOM_IMG_PATH.$cover_res['image'];
|
||||
}
|
||||
|
||||
//booking & shutdown booking process
|
||||
$booking = "";
|
||||
if(!$settings_r['shutdown']){
|
||||
$login = 0;
|
||||
if(isset($_SESSION['login']) && $_SESSION['login'] == true){
|
||||
$login=1;
|
||||
}
|
||||
$booking = "<button onclick='loginToBook($login, $room_data[id])' class='btn-main d-block mb-2' style='font-size: 14px;'>Book</button>";
|
||||
}
|
||||
|
||||
//display room (---**accommodation section did not use from database**---)
|
||||
$output .= "
|
||||
<div class='card mb-3 shadow'>
|
||||
<div class='row g-0 p-2 align-items-center'>
|
||||
<div class='col-lg-4 col-md-5 mb-lg-0 mb-3'>
|
||||
<img src='$room_cover' class='img-fluid rounded' alt='room' style='height: 220px; width: 100%; object-fit: cover;'>
|
||||
</div>
|
||||
<div class='col-lg-7 col-md-6 px-lg-2 px-md-2 px-0'>
|
||||
<p class='mb-1' style='font-size: 20px; font-weight: 600;'>$room_data[name]</p>
|
||||
<div class='accommodation'>
|
||||
<p class='fw-bold' style='color: #31363F; font-size: 14px; margin-bottom: 5px;'>Accommodation</p>
|
||||
<span class='badge text-dark mb-1' style='border-radius: 25px; background-color: #F3EEEA;'>Heating and air conditioning</span>
|
||||
<span class='badge text-dark mb-1' style='border-radius: 25px; background-color: #F3EEEA;'>Mini-fridge</span>
|
||||
<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>
|
||||
<div class='extra-accommodation mt-2 mb-2'>
|
||||
<p class='fw-bold' style='color: #31363F; font-size: 14px; margin-bottom: 5px;'>Additional Accommodation</p>$additionalAccom_data
|
||||
</div>
|
||||
</div>
|
||||
<div class='col-md-1'>
|
||||
<p class='mb-4 text-center mt-lg-0 mt-4' style='font-size: 14px;'>$$room_data[price]/night</p>
|
||||
$booking
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
";
|
||||
$count_room++;
|
||||
}
|
||||
if($count_room > 0 ){
|
||||
echo $output;
|
||||
} else{
|
||||
echo 'We are sorry, but there is no room available at this moment!';
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
|
@ -28,6 +28,20 @@
|
|||
right: 25px;
|
||||
z-index: 10000;
|
||||
}
|
||||
.btn-set{
|
||||
background-color: #3C3633;
|
||||
border: none;
|
||||
color: white;
|
||||
padding: 2px 4px;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.btn-set:hover{
|
||||
background-color: #625e5b;
|
||||
color: white;
|
||||
transition: all 0.5s ease;
|
||||
}
|
||||
@media (max-width:765px){
|
||||
.booking-hero{
|
||||
height: 100px;
|
||||
|
@ -37,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">
|
||||
|
@ -50,45 +79,34 @@
|
|||
<i class="bi bi-sort-down"></i>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse flex-column align-items-stretch" id="filterDropdown">
|
||||
<!--room availability-->
|
||||
<div class="border bg-white p-3 rounded mb-2">
|
||||
<p class="mb-2" style="font-weight: 600;">Availability</p>
|
||||
<p class="mb-2 d-flex justify-content-between" style="font-weight: 600;">
|
||||
<span>Availability</span>
|
||||
<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" class="form-control shadow-none mb-4" 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" class="form-control shadow-none" 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">
|
||||
<p class="mb-2" style="font-weight: 600;">Guests</p>
|
||||
<p class="mb-2 d-flex justify-content-between" style="font-weight: 600;">
|
||||
<span>Guest</span>
|
||||
<button class="btn-set d-none" id='guest-filter-btn' onclick='guest_filter_clear()'><i class='bx bx-reset'></i></button>
|
||||
</p>
|
||||
<div class="d-flex gap-2">
|
||||
<div class="mb-2" style="font-size: 14px;">
|
||||
<label class="form-label">Adults</label>
|
||||
<input type="number" 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" class="form-control shadow-none" min="0"/>
|
||||
<input type="number" value="<?php echo $children_default ?>" id="children" oninput="guest_filter()" class="form-control shadow-none" min="1"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<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">
|
||||
|
@ -106,77 +124,7 @@
|
|||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="col-lg-9 col-md-12">
|
||||
<?php
|
||||
$room_res = select("SELECT * FROM `rooms` WHERE `status`=? AND `removed`=?", [1, 0], 'ii');
|
||||
while($room_data = mysqli_fetch_assoc($room_res)){
|
||||
//get accommodation data from database
|
||||
$accom_q = mysqli_query($con, "SELECT a.name FROM `accommodation` a INNER JOIN `room_accommodation` raccom ON a.id = raccom.accommodation_id WHERE raccom.room_id = '$room_data[id]'");
|
||||
$accommodation_data = "";
|
||||
|
||||
while($accom_row = mysqli_fetch_assoc($accom_q)){
|
||||
$accommodation_data .="<span class='badge text-dark mb-1' style='border-radius: 25px; background-color: #F3EEEA;'>$accom_row[name]</span>";
|
||||
}
|
||||
//get additional accommodation data from database
|
||||
$addi_q = mysqli_query($con, "SELECT a.name FROM `additional_accomm` a INNER JOIN `room_additionalAccom` raddi ON a.id = raddi.additionalAccom_id WHERE raddi.room_id = '$room_data[id]'");
|
||||
$additionalAccom_data = "";
|
||||
|
||||
while($addi_row = mysqli_fetch_assoc($addi_q)){
|
||||
$additionalAccom_data .="<span class='badge text-dark mb-1 mx-1' style='border-radius: 25px; background-color: #F3EEEA;'>$addi_row[name]</span>";
|
||||
}
|
||||
//get cover image
|
||||
$room_cover = ROOM_IMG_PATH."logo.png";
|
||||
$cover_q = mysqli_query($con, "SELECT * FROM `room_images` WHERE `room_id`='$room_data[id]' AND `upload`='1'");
|
||||
|
||||
if(mysqli_num_rows($cover_q) > 0){
|
||||
$cover_res = mysqli_fetch_assoc($cover_q);
|
||||
$room_cover = ROOM_IMG_PATH.$cover_res['image'];
|
||||
}
|
||||
//booking & shutdown booking process
|
||||
$booking = "";
|
||||
if(!$settings_r['shutdown']){
|
||||
$login = 0;
|
||||
if(isset($_SESSION['login']) && $_SESSION['login'] == true){
|
||||
$login=1;
|
||||
}
|
||||
$booking = "<button onclick='loginToBook($login, $room_data[id])' class='btn-main d-block mb-2' style='font-size: 14px;'>Book</button>";
|
||||
}
|
||||
//display room (---**accommodation section did not use from database**---)
|
||||
echo <<< data
|
||||
<div class="card mb-3 shadow">
|
||||
<div class="row g-0 p-2 align-items-center">
|
||||
<div class="col-lg-4 col-md-5 mb-lg-0 mb-3">
|
||||
<img src="$room_cover" class="img-fluid rounded" alt="room" style="height: 220px; width: 100%; object-fit: cover;">
|
||||
</div>
|
||||
<div class="col-lg-7 col-md-6 px-lg-2 px-md-2 px-0">
|
||||
<p class="mb-1" style="font-size: 20px; font-weight: 600;">$room_data[name]</p>
|
||||
<div class="accommodation">
|
||||
<p class="fw-bold" style="color: #31363F; font-size: 14px; margin-bottom: 5px;">Accommodation</p>
|
||||
<span class="badge text-dark mb-1" style="border-radius: 25px; background-color: #F3EEEA;">Heating and air conditioning</span>
|
||||
<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;">Mini-fridge</span>
|
||||
<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;">Hairdryer</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;">Wi-Fi</span>
|
||||
<span class="badge text-dark mb-1" style="border-radius: 25px; background-color: #F3EEEA;">...</span>
|
||||
</div>
|
||||
<div class="extra-accommodation mt-2 mb-2">
|
||||
<p class="fw-bold" style="color: #31363F; font-size: 14px; margin-bottom: 5px;">Additional Accommodation</p>
|
||||
$additionalAccom_data
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<p class="mb-4 text-center mt-lg-0 mt-4" style="font-size: 14px;">$$room_data[price]/night</p>
|
||||
$booking
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
data;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="col-lg-9 col-md-12" id="room-data"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -185,6 +133,17 @@
|
|||
<?php require('./components/script.php') ?>
|
||||
|
||||
<script>
|
||||
//fetch room
|
||||
let room_data = document.getElementById('room-data');
|
||||
//check-in & check-out filter
|
||||
let checkin = document.getElementById('checkin');
|
||||
let checkout = document.getElementById('checkout');
|
||||
let check_filter_btn = document.getElementById('check-filter-btn');
|
||||
//guest filter
|
||||
let adult = document.getElementById('adult');
|
||||
let children = document.getElementById('children');
|
||||
let guest_filter_btn = document.getElementById('guest-filter-btn');
|
||||
|
||||
function loginToBook(status, room_id){
|
||||
if(status){
|
||||
window.location.href='confirm_booking.php?id='+room_id;
|
||||
|
@ -192,6 +151,66 @@
|
|||
alert('error', 'Please login to reserve a room');
|
||||
}
|
||||
}
|
||||
|
||||
//fetch room
|
||||
function fetch_room(){
|
||||
let check_filter = JSON.stringify({
|
||||
checkin: checkin.value,
|
||||
checkout: checkout.value
|
||||
});
|
||||
|
||||
let guest_filter = JSON.stringify({
|
||||
adult: adult.value,
|
||||
children: children.value
|
||||
});
|
||||
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "ajax/room.php?fetch_room&check_filter="+check_filter+"&guest_filter="+guest_filter, true);
|
||||
|
||||
xhr.onprogress = function(){
|
||||
room_data.innerHTML = `
|
||||
<div class="m-3">
|
||||
<span class="spinner-border spinner-border-sm mx-2" role="status" aria-hidden="true" id="room_loading"></span>Loading...
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
xhr.onload = function(){
|
||||
room_data.innerHTML = this.responseText;
|
||||
}
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
//check-in & check-out filter
|
||||
function check_filter(){
|
||||
if(checkin.value != '' && checkout.value != ''){
|
||||
fetch_room()
|
||||
check_filter_btn.classList.remove('d-none');
|
||||
}
|
||||
}
|
||||
function check_filter_clear(){
|
||||
checkin.value = '';
|
||||
checkout.value ='';
|
||||
check_filter_btn.classList.add('d-none');
|
||||
fetch_room();
|
||||
}
|
||||
|
||||
//guest filter
|
||||
function guest_filter(){
|
||||
if(adult.value > 0 || children.value > 0){
|
||||
fetch_room();
|
||||
guest_filter_btn.classList.remove('d-none');
|
||||
}
|
||||
}
|
||||
function guest_filter_clear(){
|
||||
adult.value = '';
|
||||
children.value = '';
|
||||
fetch_room();
|
||||
guest_filter_btn.classList.add('d-none');
|
||||
|
||||
}
|
||||
|
||||
fetch_room();
|
||||
|
||||
</script>
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
<div class="footer">
|
||||
<div class="footer-grid">
|
||||
<div class="footer-grid-1">
|
||||
<a href="#room">Rooms</a>
|
||||
<a href="../rooms.php">Rooms</a>
|
||||
<a href="../services.php">Services</a>
|
||||
<a href="#">News</a>
|
||||
<a href="#">Gallery</a>
|
||||
<a href="#">About</a>
|
||||
<a href="../dining.php">Dining&Bar</a>
|
||||
<a href="../about.php">About</a>
|
||||
<a href="../contact.php">Contact</a>
|
||||
</div>
|
||||
<div class="footer-grid-2">
|
||||
<div class="footer-grid-2-title">
|
||||
<a href="#">Information<i class="bi bi-arrow-right-circle"></i></a>
|
||||
</div>
|
||||
<a href="#">General information</a>
|
||||
<a href="#">Loyalty program</a>
|
||||
<a href="../contact.php">General information</a>
|
||||
<a href="../contact.php">Loyalty program</a>
|
||||
</div>
|
||||
<div class="footer-grid-3">
|
||||
<img src="./images/logo-white.png" class="pre-header-img" style="width: 120px; margin-bottom:80px; margin-top:50px;"/>
|
||||
|
|
BIN
hotel_booking/diagram/database_architecture_diagram.png
Normal file
BIN
hotel_booking/diagram/database_architecture_diagram.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 159 KiB |
BIN
hotel_booking/diagram/web_app_architect_diagram.png
Normal file
BIN
hotel_booking/diagram/web_app_architect_diagram.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 104 KiB |
|
@ -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>
|
||||
|
@ -202,24 +205,31 @@
|
|||
</div>
|
||||
</div>
|
||||
<!--testimonials-->
|
||||
<?php
|
||||
$review_qurey = "SELECT re. *, uc.firstname AS uname, rs.name AS rname FROM `review` re INNER JOIN `user_creds` uc ON re.user_id = uc.id INNER JOIN `rooms` rs ON re.room_id = rs.id ORDER BY `sr_no` DESC LIMIT 3";
|
||||
$review_res = mysqli_query($con, $review_qurey);
|
||||
if(mysqli_num_rows($review_res) == 0){
|
||||
echo 'There is no review at this moment!';
|
||||
} else{
|
||||
while($row = mysqli_fetch_assoc($review_res)){
|
||||
|
||||
$slide .= "
|
||||
<div class='swiper-slide'>
|
||||
<div class='profile'>
|
||||
<p class='testimonials-text'>$row[review]</p>
|
||||
<p class='testimonials-user'>$row[uname]</p>
|
||||
</div>
|
||||
</div>
|
||||
";
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="panel" data-color="white">
|
||||
<img src="./images/logo.png" class="pre-header-testimonials"/>
|
||||
<div class="swiper swiper-testimonials">
|
||||
<div class="swiper-wrapper">
|
||||
<div class="swiper-slide">
|
||||
<div class="profile">
|
||||
<p class="testimonials-text">I recently had the pleasure of staying at the midtown hotel and was blown away by the exceptional service and comfortable accommodations.
|
||||
I would highly recommend this hotel to anyone looking for a relaxing and enjoyable stay.</p>
|
||||
<p class="testimonials-user">-Jennifer</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="swiper-slide">
|
||||
<div class="profile">
|
||||
<p class="testimonials-text">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
||||
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||
<p class="testimonials-user">-anonymous</p>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo $slide ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue