<?php
date_default_timezone_set('Asia/Kolkata'); 
//echo $date = date("Y-m-d", time());
include ('../config.php');
@session_start();
@$user_id1=$_SESSION['user_id1'];
@$idvfied1=$_SESSION['idverified1'];
@$namevfied1=$_SESSION['namevfied1'];
if(!isset($_SESSION['user_id1'])){
	header("Location: index.php");
}

$timeout = 60 * 60 * 24 * 365;
$s_name = session_name();
if(isset( $_COOKIE[ $s_name ] )) {
  setcookie( $s_name, $_COOKIE[ $s_name ], time() + $timeout, '/' );
}

$sel1=mysqli_query($conn,"select * from hr_dump where empid='".@$user_id1."'");
$fetch1=mysqli_fetch_array($sel1);

$queryFR=mysqli_query($conn,"select * from tracker where Functional_Reporting='$fetch1[Employee_Number]'");
$dataFR=mysqli_fetch_array($queryFR);

$queryFR=mysqli_query($conn,"select * from emp_leave where Functional_Reporting='$fetch1[Employee_Number]'");
$dataFR=mysqli_fetch_array($queryFR);
?>

<!doctype html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, viewport-fit=cover" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <title>Support Track IC AMS</title>
	
	<?php	include ('header.php');	?>
	
	<div id="appCapsule">
        <div class="section wallet-card-section pt-1">
            <div class="wallet-card">
				<!--<div class="balance">
                    <div class="left">
                        <span class="title"></?php echo $fetch1['Employee_Full_Name']; ?></span>
                        <h4></?php echo $fetch1['Team_Name']; ?></h4>
                        <h6></?php echo $date = date("Y-m-d", time()); ?></h6>
                    </div>
                    <div class="right">
                        <a href="#"><img src="../assets/img/noimage.png" alt="logo" class="logo-profile"></a>
                    </div>
                </div>-->
				
				<?php	include ('include/wallet-balance.php');	?>
					<div class="row mt-2 mb-2 border rounded py-1">
						<h4 class="text-center bg-primary text-white">Active Request</h4><br>
						<div class="table">
							<table class="table table-striped table-bordered bootstrap-datatable datatable responsive">
								<thead>
								<tr>
									<th><small>Request For</small></th>
									<th><small>Status</small></th>
									<th><small>Action</small></th> 
								</tr>
								</thead>
								<tbody> 
								<?php
								$query="select * from ams_support where empid='".@$user_id1."'  AND status !='Completed' ORDER BY id ASC";
								$result=mysqli_query($conn,$query);
								while($data=mysqli_fetch_assoc($result))
								{
								@$sn++;
								?>
								<tr>
									<td><small><?php echo $data['requestfor'] ?></small></td>
									<td><small><?php echo $data['status'] ?></small></td>
									<td>
									<?php
										if ($data ['assignto'] == '')
										{	echo '<a class="btn btn-danger btn-sm">Pending</a>'; }
										else
										{	echo '<a href="support-view-pending.php?id='.$data['id'].'" class="btn btn-primary btn-sm">View & Close</a></td>';	}
									?>
									
								</tr>
								<?php    }
									if(@$sn == 0) 
									{	echo "<br><div class='col-md-12 text-center bg-light'>No Pending Request!</div>";	}
								?>
								</tbody>
							</table>
						</div>
					</div>
					<div class="row mt-2 mb-2 border rounded py-1">
						<h4 class="text-center bg-success text-white">Completed Request</h4><br>
						<div class="table">
							<table class="table table-striped table-bordered bootstrap-datatable datatable responsive">
								<thead>
								<tr>
									<!--<th><small>SN.</small></th>-->
									<th><small>Request For</small></th>
									<th><small>Status</small></th>
									<th><small>Action</small></th> 
								</tr>
								</thead>
								<tbody> 
								<?php
								$query="select * from ams_support where empid='".@$user_id1."' AND status='Completed' ORDER BY id ASC";
								$result=mysqli_query($conn,$query);
								while($compdata=mysqli_fetch_assoc($result))
								{
								@$sn++;
								?>
								<tr>
									<!--<td><small></?php echo @$sn; ?></small></td>-->
									<td><small><?php echo $compdata['requestfor'] ?></small></td>
									<td><small><?php echo $compdata['status'] ?></small></td>
									<td><a href="support-view-completed.php?id=<?php echo $compdata['id'] ?>" class="btn btn-success btn-sm">View</a></td>
								</tr>
								<?php    }
									if(@$sn == 0) 
									{	echo "<br><div class='col-md-12 text-center bg-light'>No Request!</div>";	}
								?>
								</tbody>
							</table>
						</div>
					</div>
				<!--</?php	include ('include/wallet-section.php');	?> -->
            </div>
        </div>
		
		
        
		<!--</?php	include ('include/quik_links.php');	?>
		</?php	include ('include/extra_links.php');	?>-->
	
	<?php	include ('include/copyright.php');	?>
	</div>
	
	<?php	include ('footer.php');	?>