<?php
    session_start();
    if(isset($_SESSION['user_id']) && isset($_SESSION['user_name']) && $_SESSION['user_cate'] === "user"){
        $user_id = $_SESSION['user_id'] ;
        $username = $_SESSION['user_name'] ;
        // $ticket = $_SESSION['last_ticket'] ;
        // $company = $_SESSION['company'] ;
        $user_image = $_SESSION['user_image'] ;
    }else{
        header("Location:login.php") ;
    }
?>
<?php 
    if(isset($_GET['event']) || !empty($_GET['event'])){
        $event_id = $_GET['event'];
    }
    else{
        header("Location:dashboard.php") ;
    }
?>
<?php include "head.php" ; ?>
<style>
    .event-box img {
        height: 300px;
        width: 100%;
        min-height: 100%;
    }
    .event-title {
        font-weight: 500;
        color: #4b94e5;
        /*width: 40%;*/
    }
    .event-para {
        /*width: 60%;*/
        margin-left: 10px;
    }
</style>
<body>
	<!-- Main Wrapper -->

	<div class="main-wrapper">

		<!-- Header -->

		<?php include "header.php" ; ?>

		<!-- /Header -->
	<body>

		
			<!-- Breadcrumb -->
			<?php include "breadcrumbuser.php" ; ?>
			<!-- /Breadcrumb -->
			
			<!-- Page Content -->
			<div class="content">
				<div class="container-fluid">

					<div class="row">
						<div class="col-md-5 col-lg-4 col-xl-3 theiaStickySidebar">
							
							<!-- Profile Sidebar -->
							<?php include "sidebar.php" ; ?>
							<!-- /Profile Sidebar -->
							
						</div>
						
						<div class="col-md-7 col-lg-8 col-xl-9">

							<div class="row">
								<div class="col-md-12">
								    <?php
								        $e_sql = $config->query("SELECT * FROM event_post WHERE event_id = '$event_id' ") ;  
                                        $e_res = $e_sql->fetch_assoc();
								    ?>
									<h4 class="mb-4"><?= $e_res['e_title'] ?></h4>
									<div class="appointment-tab">
										
										<div class="tab-content">
										
											<!-- Upcoming Appointment Tab -->
											<div class="tab-pane show active" id="upcoming-appointments">
												<div class="card card-table mb-0">
													<div class="card-body">
														<div class="table-responsive">
															<table class="table table-hover table-center mb-0">
																<thead>
																	<tr>
																		<th>S.No</th>
																		<th>Name</th>	
																		<th>DOB </th>
																		<th>Gender</th>
																		<th>FIDE ID</th>
																		<th>City</th>
																		<th>Category</th>
																		<th>Contact</th>
																		<th>Email ID</th>					 
																		<th>AICF ID</th>
																		<th>TNSCA ID</th>
																		<th>CHESS.COM ID</th>
																		<th>LICHESS ID</th>
																		<th>Entry Fee</th>
																		<th>Payment Date</th>
																	</tr>
																</thead>
																<tbody>
																    <?php
																    
																        $sno = 1;
                     											        $sql = "SELECT * FROM apply_request WHERE user_id = '$user_id' AND event_id = '$event_id' " ;
                    											        $res = $config->query($sql);
                       											        while($row = $res->fetch_assoc()){
                       											            $ply_id = $row['player_id'];
                       											            $ply_sql = $config->query("SELECT * FROM players WHERE id = '$ply_id' ") ;
                       											            $ply = $ply_sql->fetch_assoc();
                  											        ?>
																	<tr>
																		<td><?= $sno; ?></td>
																		<td><?= $ply['name'] ?></td>
																		<td><?= date('d-m-Y',strtotime($ply['dob'])); ?></td>
																		<td><?= $ply['gender'] ?></td>
																		<td><?= $ply['fide_id'] ?></td>
																		<td><?= $ply['city'] ?></td>
																		<td><?= $row['entry_type'] ?></td>
																		<td><?= $ply['phone'] ?></td>
																		<td><?= $ply['email'] ?></td>
																		<td><?= $ply['aicf_id'] ?></td>
																		<td><?= $ply['tnsca_id'] ?></td>
																		<td><?= $ply['chess_id'] ?></td>
																		<td><?= $ply['lichess_id'] ?></td>
																		<td><?= ($row['entry'] == 'free') ? "Free" : $row['entry_fees'] ; ?></td>
																		<td><?= date('d-m-Y',strtotime($row['apply_on'])); ?></td>
																	</tr>
																	<?php $sno++; } ?>
																</tbody>
															</table>		
														</div>
													</div>
												</div>
											</div>
											<!-- /Upcoming Appointment Tab -->
									   
											
										</div>
									</div>
								</div>
							</div>

						</div>
					</div>

				</div>

			</div>		
			<!-- /Page Content -->
   	<!-- Footer -->

		<?php include "footer.php" ; ?>

		<!-- /Footer -->
	</div>

	<!-- /Main Wrapper -->

	<!-- jQuery -->

	<script src="assets/js/jquery.min.js"></script>

	<!-- Bootstrap Core JS -->

	<script src="assets/js/popper.min.js"></script>

	<script src="assets/js/bootstrap.min.js"></script>

	<!-- Sticky Sidebar JS -->
    <script src="assets/plugins/theia-sticky-sidebar/ResizeSensor.js"></script>
    <script src="assets/plugins/theia-sticky-sidebar/theia-sticky-sidebar.js"></script>
	
	<!-- Circle Progress JS -->
	<script src="assets/js/circle-progress.min.js"></script>
		
	<!-- Slick JS -->

	<script src="assets/js/slick.js"></script>

	<!-- Custom JS -->

	<script src="assets/js/script.js"></script>
		

</body>

<!-- doccure/  30 Nov 2019 04:11:53 GMT -->

</html>