Viewing file: leave_requests.php (9.39 KB) -rw-rw-r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
session_start();
include('includes/header.php');
?>
<?php
// Storing session data
$_SESSION["role"];
if(!isset($_SESSION["role"]))
{
header("location:admin_login.php");
?>
<script type="text/javascript">
window.location.href = "admin_login.php";
</script>
<?php
}
else
{
?>
<div class="page-container">
<div class="left-content">
<div class="mother-grid-inner">
<!--header start here-->
<div class="header-main">
<div class="header-left">
<div class="logo-name">
<a href="admin_index.php"> <h3>SICS ADMIN</h3>
</br>
</a>
</div>
<div class="clearfix"> </div>
</div>
<!--notification menu end -->
<div class="profile_details">
<ul>
<li class="dropdown profile_details_drop">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<div class="profile_img">
<span class="prfil-img"><!-- <img src="images/p1.png" alt=""> --> </span>
<div class="user-name">
<p>Srishti Innovative</p>
<span><?php echo $_SESSION["name"];?></span>
</div>
<i class="fa fa-angle-down lnr"></i>
<i class="fa fa-angle-up lnr"></i>
<div class="clearfix"></div>
</div>
</a>
<ul class="dropdown-menu drp-mnu">
<!-- <li> <a href="#"><i class="fa fa-cog"></i> Settings</a> </li>
<li> <a href="#"><i class="fa fa-user"></i> Profile</a> </li> -->
<li> <a href="logout.php"><i class="fa fa-sign-out"></i> Logout</a> </li>
</ul>
</li>
</ul>
</div>
</div>
<div class="inner-block">
<h3 style="text-align: left;color: #337ab7;margin-bottom: 1%;">Leave Requests</h3>
<strong id="success"></strong>
<?php
// $query = "select * from student_requests where request_type=1 and approve_status=0 order by created_at desc";
$query = "select * from student_requests where request_type=1 order by created_at desc";
$result = $con->query($query);
?>
<table id="requests" class="table table-striped table-bordered table-condensed">
<thead style="background: #7ab9f3;">
<tr>
<th>Sl.No</th>
<th>Name</th>
<th>Email</th>
<th>Course</th>
<th>Date</th>
<th>Message</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$i=1;
while ($row = $result->fetch_assoc()) {
?>
<tr id="row_<?php echo $row["student_id"]; ?>">
<td><?php echo $i; ?></td>
<td><?php
$user_id=$row["student_id"];
$query1 = "select * from user_details where user_id='$user_id' ";
$result1 = $con->query($query1);
while ($row1 = $result1->fetch_assoc()) {
echo $name=$row1["name"];
}
?>
</td>
<td><?php
$user_id=$row["student_id"];
$query11 = "select * from user_details where user_id='$user_id' ";
$result11 = $con->query($query11);
while ($row11 = $result11->fetch_assoc()) {
echo $email=$row11["email"];
}
?></td>
<td><?php //echo $row["course_id"]; ?>
<?php
$course_id=$row["course_id"];
$query1 = "select name from course_details where id='$course_id' ";
$result1 = $con->query($query1);
while ($row1 = $result1->fetch_assoc()) {
echo $name=$row1["name"];
}
?>
</td>
<td>
<?php echo $row["created_at"]; ?>
</td>
<td>
<?php echo $row["message"]; ?>
</td>
<td>
<?php
if($row["approve_status"]==0)
{
?>
<button type="button" data-id="<?php echo $row["id"]; ?>" onclick="aprove('<?php echo $row["id"]; ?>')" class="btn btn-info Edit" >Approve </button>
<button type="button" data-id="<?php echo $row["id"]; ?>" class="btn btn-danger delete" >Delete </button>
<?php
}
else
{
Echo "Approved";
}
?>
<!-- <button type="button" data-id="<?php echo $row["id"]; ?>" class="btn btn-danger delete" >Delete </button> -->
</td>
<?php
$i++;
}
?>
</tr>
</tbody>
</table>
</div>
</div>
<!--heder end here-->
<!-- script-for sticky-nav -->
<div class="inner-block">
</section>
</div>
</div>
</div>
<!--slider menu-->
<?php include('includes/sidebar.php'); ?>
<!--slide bar menu end here-->
<?php include('includes/footer.php'); ?>
<?php
}
?>
<script type="text/javascript">
function aprove(id)
{
//alert(id);
$.ajax({
url: "aprove_leave.php",
type: "POST",
data: {
id: id
},
cache: false,
success: function(dataResult){
var dataResult = JSON.parse(dataResult);
console.log(dataResult);
console.log(dataResult.statusCode);
var code=dataResult.statusCode;
// alert(dataResult.statusCode);
if(dataResult.statusCode!=0){
$('#success').html('Leave Approved successfully !');
swal('Leave Approved successfully !');
setTimeout(function(){
window.location.reload(true);
}, 3000);
//window.open('admin_receipt.php?id='+code, '_blank');
}
else if(dataResult.statusCode==0){
alert("Error occured !");
}
}
});
}
</script>
|