updated code
This commit is contained in:
parent
7ce99863e0
commit
f44748c5d5
3 changed files with 125 additions and 7 deletions
|
@ -53,9 +53,9 @@
|
|||
|
||||
if(isset($_POST['room_number'])){
|
||||
$frm_data = filteration($_POST);
|
||||
$query = "UPDATE `booking_order` bo INNER JOIN `booking_detail` bd ON bo.booking_id = bd.booking_id SET bo.arrival = ?, bd.room_no = ? WHERE bo.booking_id = ?";
|
||||
$values = [1, $frm_data['room_no'], $frm_data['booking_id']];
|
||||
$res = update($query, $values, 'isi');
|
||||
$query = "UPDATE `booking_order` bo INNER JOIN `booking_detail` bd ON bo.booking_id = bd.booking_id SET bo.arrival = ?, bo.review = ?, bd.room_no = ? WHERE bo.booking_id = ?";
|
||||
$values = [1, 0, $frm_data['room_no'], $frm_data['booking_id']];
|
||||
$res = update($query, $values, 'iisi');
|
||||
|
||||
echo ($res == 2) ? 1 : 0;
|
||||
}
|
||||
|
|
|
@ -162,7 +162,6 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
let data = new FormData();
|
||||
data.append('password_form', '');
|
||||
data.append('new_password', new_password);
|
||||
|
|
|
@ -49,6 +49,12 @@
|
|||
.booking-order{
|
||||
font-size: 14px;
|
||||
}
|
||||
.custom-alert{
|
||||
position:fixed;
|
||||
top: 100px;
|
||||
right: 25px;
|
||||
z-index: 10000;
|
||||
}
|
||||
@media (max-width:765px){
|
||||
.booking-hero{
|
||||
height: 100px;
|
||||
|
@ -81,12 +87,18 @@
|
|||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
if(isset($_GET['cancel_status'])){
|
||||
alert('success', 'Booking cancelled');
|
||||
} else if(isset($_GET['review_status'])){
|
||||
alert('success', 'Thank you for your review!');
|
||||
}
|
||||
?>
|
||||
<div class="container mb-5">
|
||||
<div class="row">
|
||||
<div class="col-12 mt-5 mb-4">
|
||||
<h4 style="text-transform: uppercase; letter-spacing: 2px; color: #194141;">Booking<h4>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$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') OR (bo.booking_status ='cancel')) AND (bo.user_id=?) ORDER BY bo.booking_id DESC";
|
||||
|
@ -128,8 +140,10 @@
|
|||
$status = 'Booked';
|
||||
$btn = "
|
||||
<a href='generate_invoice.php?gen_pdf&id=$data[booking_id]' class='badge btn-minor' ><i class='bx bx-download'></i></a>
|
||||
<button type='button' class='badge btn-main' style='font-weight: 600;'>Review</button>
|
||||
";
|
||||
if($data['review'] == 0){
|
||||
$btn .= "<button type='button' onclick='review_room($data[booking_id], $data[room_id])' class='badge btn-main' style='font-weight: 600;' data-bs-toggle='modal' data-bs-target='#reviewBackdrop'>Review</button>";
|
||||
}
|
||||
}
|
||||
echo <<< data
|
||||
<div class='table-responsive col-12'>
|
||||
|
@ -147,10 +161,76 @@
|
|||
data;
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="reviewBackdrop" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form id="review-form">
|
||||
<div class="modal-header" style="border: none;">
|
||||
<button type="reset" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<h5 class="text-center" style="font-size: 22px;">Review</h5>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="mb-3">
|
||||
<label class="form-label" style='font-weight: 600;'>Room</label>
|
||||
<select class="form-select shadow-none" style='font-size: 14px;' name='room_review' required>
|
||||
<option value="5">Excellent</option>
|
||||
<option value="4">Very Good</option>
|
||||
<option value="3">Good</option>
|
||||
<option value="5">Fair</option>
|
||||
<option value="1">Poor</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" style='font-weight: 600;'>Cleanliness</label>
|
||||
<select class="form-select shadow-none" style='font-size: 14px;' name='clean_review' required>
|
||||
<option value="5">Excellent</option>
|
||||
<option value="4">Very Good</option>
|
||||
<option value="3">Good</option>
|
||||
<option value="5">Fair</option>
|
||||
<option value="1">Poor</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" style='font-weight: 600;'>Staff Friendliness</label>
|
||||
<select class="form-select shadow-none" style='font-size: 14px;' name='staff_review' required>
|
||||
<option value="5">Excellent</option>
|
||||
<option value="4">Very Good</option>
|
||||
<option value="3">Good</option>
|
||||
<option value="5">Fair</option>
|
||||
<option value="1">Poor</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" style='font-weight: 600;'>Service</label>
|
||||
<select class="form-select shadow-none" style='font-size: 14px;' name='service_review' required>
|
||||
<option value="5">Excellent</option>
|
||||
<option value="4">Very Good</option>
|
||||
<option value="3">Good</option>
|
||||
<option value="5">Fair</option>
|
||||
<option value="1">Poor</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" style='font-weight: 600;'>Comment</label>
|
||||
<textarea type="text" name="review" rows="3" class="form-control shadow-none" style="resize: none;" required></textarea>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="booking_id">
|
||||
<input type="hidden" name="room_id">
|
||||
|
||||
<div class="mb-3 d-grid">
|
||||
<button type="submit" class="btn btn-dark shadow-none d-block ">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--footer-->
|
||||
<?php require('./components/footer.php'); ?>
|
||||
<?php require('./components/script.php') ?>
|
||||
|
@ -171,6 +251,45 @@
|
|||
xhr.send('cancel_booking&id='+id);
|
||||
}
|
||||
}
|
||||
|
||||
let review_form = document.getElementById('review-form');
|
||||
|
||||
function review_room(bookingID, roomID){
|
||||
review_form.elements['booking_id'].value = bookingID;
|
||||
review_form.elements['room_id'].value = roomID;
|
||||
}
|
||||
|
||||
review_form.addEventListener('submit', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
let data = new FormData();
|
||||
data.append('review_form', '');
|
||||
data.append('room_review', review_form.elements['room_review'].value);
|
||||
data.append('clean_review', review_form.elements['clean_review'].value);
|
||||
data.append('staff_review', review_form.elements['staff_review'].value);
|
||||
data.append('service_review', review_form.elements['service_review'].value);
|
||||
data.append('review', review_form.elements['review'].value);
|
||||
data.append('booking_id', review_form.elements['booking_id'].value);
|
||||
data.append('room_id', review_form.elements['room_id'].value);
|
||||
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "ajax/review_room.php", true);
|
||||
xhr.onload = function(){
|
||||
if(this.responseText == 1){
|
||||
window.location.href = 'user_booking.php?review_status=true';
|
||||
} else{
|
||||
var myModal = document.getElementById('reviewBackdrop');
|
||||
var modal = bootstrap.Modal.getInstance(myModal);
|
||||
modal.hide();
|
||||
|
||||
alert('error', 'Something went wrong, please try again later');
|
||||
}
|
||||
}
|
||||
xhr.send(data);
|
||||
})
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Reference in a new issue