<?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 hr_dump where Functional_Reporting='$fetch1[Employee_Number]' AND Status='Active' ");
$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>List Open Project</title>
	
	<?php	include ('header.php');	?>
	
	<div id="appCapsule">
        <div class="section wallet-card-section pt-1">
            <div class="wallet-card">
				
				<?php	include ('include/wallet-balance.php');	?>
				<div class="mb-4 py-2">
				
					<div class="wallet-footer p-2">
						<div class="text-center">
							<a href="proj-admin.php" class="btn btn-primary btn-sm">Back to Admin Home</a>
						</div>
					</div>

					<div class="row stat-box py-2">
						<h5 class="text-center"> Open Projects List </h5>
						<div class="table">
							<table id="hrTable1" class="table table-striped table-bordered">
								<thead>
								<tr class="small">
									<th>SNo</th>
									<th>Developer Name</th>
									<th>Project Name</th>
									<th>City</th>
									<th>Closing Manager</th>
									<th>Phone</th>
									<th>Status</th>
									<th></th>
								</thead>
								<tbody>
								<?php
								$query="select * from proj_open WHERE created_by='$fetch1[empid]' ORDER BY SNo ASC";
								$result=mysqli_query($connpe,$query);
								while($data=mysqli_fetch_assoc($result))
								{
								@$sn++;
								?>
								<tr class="small">
									<td><?php echo $data['SNo'] ?></td>
									<td><?php echo $data['Developer'] ?></td>
									<td><?php echo $data['Project'] ?></td>
									<td><?php
										$oc=mysqli_query($connpe,"select * from  proj_cities where cityID_proj='$data[cityID_proj]' ");
										$fetchoc=mysqli_fetch_array($oc);
										echo $fetchoc['City_Name']
									?></td>
									<td><?php echo $data['Closing_Manager'] ?></td>
									<td><?php echo $data['Closing_Manager_Number'] ?></td>
									<td><?php 
										if ($data['Project_Status'] == 'Inactive')
										{	echo "<span class='btn btn-danger btn-sm'>Inactive</span>";	}
										else	{	echo $data['Project_Status'];	}
									?></td>
									
									<td>
									<?php	if ($data['created_by'] == $fetch1['empid'])
										{
											echo "<b><a class='btn btn-primary btn-sm' href='proj-edit.php?SNo=".$data['SNo']."'>Edit</a></b>";
										}
										/* else	{	echo "<a class='btn btn-warning'>NA</a>";	} */
									?>
									</td>
								</tr>
								<?php    }    ?> 
								</tbody>
							</table>		
						</div>
					</div>
				</div>
            </div>
        </div>
		
		<script type="text/javascript">
		function removeSpecialChars(element) {
			element.value = element.value.replace(/[^a-zA-Z0-9\s]/g, '');
		}
		</script>
		<!--</?php	include ('include/quik_links.php');	?>
		</?php	include ('include/extra_links.php');	?>-->
	
	<?php	include ('include/copyright.php');	?>
	</div>
	
	<?php	include ('footer.php');	?>