added user query page
This commit is contained in:
parent
0e5ec512e9
commit
21bbb2f370
1 changed files with 149 additions and 0 deletions
149
hotel_booking/admin/user_query.php
Normal file
149
hotel_booking/admin/user_query.php
Normal file
|
@ -0,0 +1,149 @@
|
|||
<?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 `user_query` SET `seen`=?";
|
||||
$values = [1];
|
||||
if(update($q, $values, 'i')){
|
||||
alert('success', 'Read all');
|
||||
} else{
|
||||
alert('error', 'Please try again!');
|
||||
}
|
||||
} else{
|
||||
$q = "UPDATE `user_query` 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 `user_query`";
|
||||
if(mysqli_query($con, $q)){
|
||||
alert('success', 'Delete all');
|
||||
} else{
|
||||
alert('error', 'Please try again!');
|
||||
}
|
||||
} else{
|
||||
$q = "DELETE FROM `user_query` 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>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">User Query</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-cancle'>Delete All</a>
|
||||
</div>
|
||||
<div class="table-responsive-md" style="height: 450px; overflow-y: scroll;">
|
||||
<table class="table table-hover border">
|
||||
<thead class="sticky-top">
|
||||
<tr style="background-color: #D3D3D3;">
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col">Email</th>
|
||||
<th scope="col" width="20%">Subject</th>
|
||||
<th scope="col" width="30%">Message</th>
|
||||
<th scope="col">Date</th>
|
||||
<th scope="col">Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$q = "SELECT * FROM `user_query` ORDER BY `sr_no` DESC";
|
||||
$data = mysqli_query($con, $q);
|
||||
$i = 1;
|
||||
|
||||
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='?del=$row[sr_no]' class='btn-cancle mx-1'>Delete</a>";
|
||||
|
||||
echo<<<query
|
||||
<tr>
|
||||
<td>$i</td>
|
||||
<td>$row[name]</td>
|
||||
<td>$row[email]</td>
|
||||
<td>$row[subject]</td>
|
||||
<td>$row[message]</td>
|
||||
<td>$row[date]</td>
|
||||
<td>$seen</td>
|
||||
</tr>
|
||||
query;
|
||||
$i++;
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<?php require('components/script.php') ?>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Reference in a new issue