<?php 
	require_once('Connections/conn_ama.php');
	
	if(!isset($_SESSION)){
        session_start();
    }
		$colname=-1;
		
		if(isset($_GET['cfh'])){
			$colname = $_GET['cfh'];
		}

    	//Retrieve ReportDetails Content
    	$query_rsReportDetails = "CALL cf_report_details('".$colname."')";
	    $rsReportDetails = mysqli_query($conn_ama, $query_rsReportDetails ) or die(mysqli_error($conn_ama));
	    $row_rsReportDetails = mysqli_fetch_assoc($rsReportDetails);
		$totalRows_rsReportDetails = mysqli_num_rows($rsReportDetails);/**/
		
		mysqli_next_result($conn_ama); 

		//Retrieve Report Details Images
		$query_rsReportImages = "CALL cf_report_details_imgs('".$colname."')";
		$rsReportImages = mysqli_query($conn_ama, $query_rsReportImages) or die(mysqli_error($conn_ama));
		$row_rsReportImages = mysqli_fetch_assoc($rsReportImages);
		$totalRows_rsReportImagess = mysqli_num_rows($rsReportImages);
 ?>
<div class="col-lg-12 cf-data-area">
	<div class="cf-data-area-wrap">
		<div class="row">
			<div class="col-12">
				<a href="manage-citizens-feedback.php" class="btn btn-info"><< Back</a>
			</div>
			
			<div class="col-lg-6 reporter-details">
				<div class="reporter-details-wrap">
					<h4>Reporter's Details</h4>
					<h5>Name: <span><?php echo $row_rsReportDetails['fname']." ".$row_rsReportDetails['lname']; ?></span> </h5>
					<h5>Contact No.: <span><?php echo $row_rsReportDetails['phone']; ?></span> </h5>
					<h5>Location: <span><?php echo $row_rsReportDetails['location']; ?></span> </h5>
					<h5>GP Code: <span><?php echo $row_rsReportDetails['gpscode']; ?></span> </h5>
					<h5>Email: <span> <a href="#" class="theemail" 
							data-email="<?php echo $row_rsReportDetails['email']; ?>" 
							data-cfh="<?php echo $colname; ?>" >
								<?php echo $row_rsReportDetails['email']; ?>
							</a>
						</span>
					</h5>
				</div>
				<div class="response-email-wrap">

				</div>
			</div>
			<div class="col-lg-6 report-details">
				<div class="report-details-wrap">
					<h4>Report</h4>
					<span class="report-date float-right"> <?php $actual_time = date('D, jS M Y   g:i a', strtotime($row_rsReportDetails['feedbackdate'])); echo $actual_time; ?></span>
					<h3><?php echo $row_rsReportDetails['category']; ?></h3>
					<h5>Report Location: <span><?php echo $row_rsReportDetails['reportlocation']; ?></span> </h5>
					<h5>Report Loacation GP Code: <span><?php echo $row_rsReportDetails['reportgpscode']; ?></span> </h5>
					
					<div class="report-content">
						<?php echo $row_rsReportDetails['report']; ?>
					</div>
					<div class="report-image">
						<div class="row">
							<!-- <div class="col-12">
								<h4>Report Images</h4>
							</div> -->
							<?php do{ ?>
								<div class="col-lg-4 report-image-box">
									<div class="report-image-box-wrap">
										<img src="../../citizens-feedback/<?php echo $row_rsReportImages['image']; ?>" class="img-fluid" alt="">
									</div>
								</div>
							<?php } while($row_rsReportImages = mysqli_fetch_assoc($rsReportImages)) ?>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div><!-- End .data-area-wrap-->	
</div>

<script>

   /*  $(document).ready( function() {
        $('#example').dataTable({
        	"pageLength": 10,
        	"order": []
        });
    }); */
</script>