<?php
session_start();
include "connect.php";



		$clgamid = intval($_REQUEST['id']);
					
	$eve = "select * from res_clgdefapp_master where clgamid=$clgamid ";
	
	$re = mysqli_query($conn, $eve);
	 while($rtpay = mysqli_fetch_assoc($re))
										
	{
		$cdamid=$rtpay['cdamid'];
															$imid=$rtpay['imid'];
															$coursefees=$rtpay['applicationfess'];
								
								$stiqmid=$rtpay['stiqmid'];
								
								$coursemid=$rtpay['coursemid'];
								$capstatus=$rtpay['cdapstatus'];
								$cdastatus=$rtpay['cdastatus'];
								
								$capstatus=$capstatus;			
								$collegemid=$rtpay['collegemid'];
								$countrymid=$rtpay['countrymid'];
								
								$coremarks=$rtpay['cdfremarks'];
								
								$doapplication=date("d-m-Y", strtotime($rtpay['cdoapplication']));
								
								
								
								
								$eve13 = "select * from res_coursename_master where cnmid in(select cnmid from res_course_master where coursemid=$coursemid)";
								$re13 = mysqli_query($conn, $eve13);
								$coursename="";
								while($rt13 = mysqli_fetch_assoc($re13))
								{
									$coursename=$rt13['coursename'];
								}	
								
								$eve14 = "select * from res_college_master where collegemid=$collegemid";
								$re14 = mysqli_query($conn, $eve14);
								$cmname="";
								while($rt14 = mysqli_fetch_assoc($re14))
								{
									$cmname=$rt14['cmname'];
								}	
								
								$eve15 = "select * from res_country_master where countrymid=$countrymid";
								$re15 = mysqli_query($conn, $eve15);
								$countryname="";
								while($rt15 = mysqli_fetch_assoc($re15))
								{
									$countryname=$rt15['countryname'];
								}
								
								$capaddedon='';	
														$capaddedon=date("d-m-Y",strtotime($rtpay['cdaddedon']));
														$capaddedby=$rtpay['cdaddedby'];

														$ufullname='';
														$utype='';
														$evea1 = "select ufullname,utype from res_user_master where umid=$capaddedby";
														$rea1 = mysqli_query($conn, $evea1);
														if(mysqli_num_rows($rea1) > 0)
														{
														while($rta1 = mysqli_fetch_assoc($rea1))
														{
															$ufullname=$rta1['ufullname'];
															$utype=$rta1['utype'];
														}
														}
														
														if($cdastatus != 'Pending for Approval')
														{
															$app = $cdastatus;
														}else{
														
														$approve = "<a href='clfdefstatus.php?id=$cdamid&st=approve&imid=$imid'>Approve</a>";
														$reject = "<a href='clfdefstatus.php?id=$cdamid&st=reject&imid=$imid'><span style='color:red;'>Reject</span></a>";
		$app = $approve." ".$reject;
														}
	}
		
		

?>
<input type="hidden" name="clgamid" value="<?php echo $clgamid; ?>">
<div class="table-responsive">
														<!--begin::Table-->
														<table class="table align-middle table-row-dashed fs-6 gy-5 mb-0">
															<!--begin::Table head-->
															<thead>
																<tr class="text-start text-gray-400 fw-bold fs-7 text-uppercase gs-0">
																	
							<th>Country
                            </th>
							
							<th>College
                            </th>
							<th>Course
                            </th>
                            <th>Remark
                            </th>
                            <th>Course Fees
                            </th>
                            <th>Status
                            </th>
                            <th> Date
                            </th>
						<th> Approval
                            </th>
						
																	
																	
																</tr>
															</thead>
															<!--end::Table head-->
															<!--begin::Table body-->
															<tbody class="fw-semibold text-gray-600">
															
																<tr>
																	
																	
							
																	<td><?php echo $countryname; ?></td>
                            
							<td>
                              <?php echo $cmname;?>
                            </td> 
							<td>
                              <?php echo $coursename;?>
                            </td>
							<td>
                              <?php echo $coremarks;?>
                            </td>
                            <td>
                              <?php echo $coursefees;?>
                            </td>
                            <td>
                              <?php echo $capstatus;?>
                            </td>
                            <td>
                              <?php echo $doapplication;?>
                            </td>
                            <td>
                              <?php echo $app;?>
                            </td>
                           
																	
																</tr>
															
																</tbody>
															<!--end::Table head-->
														</table>
																			
											
																			
