	<!doctype html>
	<html lang="en" class="no-js">

	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
		<meta name="description" content="">
		<meta name="author" content="">
		<meta name="theme-color" content="#3e454c">

		<title>PDF Viewer</title>
        <script src="https://code.jquery.com/jquery-3.6.4.slim.min.js" integrity="sha256-a2yjHM4jnF9f54xUQakjZGaqYs/V1CYvWpoqZzC2/Bw=" crossorigin="anonymous"></script>
		<!-- Font awesome -->
		<!--<link rel="stylesheet" href="css/font-awesome.min.css">-->
		<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
		<!-- Sandstone Bootstrap CSS -->
		<link rel="stylesheet" href="css/bootstrap.min.css">
		<link rel="stylesheet" href="//cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css">
		<script src="//cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js" ></script>
		<!-- Admin Stye -->
		<link rel="stylesheet" href="css/style.css">
		<style>
			.errorWrap {
				padding: 10px;
				margin: 0 0 20px 0;
				background: #dd3d36;
				color: #fff;
				-webkit-box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);
				box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);
			}

			.succWrap {
				padding: 10px;
				margin: 0 0 20px 0;
				background: #5cb85c;
				color: #fff;
				-webkit-box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);
				box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);
			}
		</style>

	</head>

	<body>
		<?php include('includes/header.php'); ?>
		
		
		<div class="ts-main-content">
			<?php include('includes/leftbar.php'); ?>
			<div class="content-wrapper">
				<div class="container-fluid">

					<div class="row">
						<div class="col-md-12">

							<h2 class="page-title">PDF Viewer</h2>

							<!-- Zero Configuration Table -->
							<div class="panel panel-default">
								<div class="panel-heading"><a href="card_sub_edit.php?edit=<?php echo $_GET['fileid']?>">&nbsp; Edit File <i class="fa-solid fa-pen-to-square"></i></a></div>
								<div class="panel-body">
									<?php if ($error) { ?><div class="errorWrap" id="msgshow"><?php echo htmlentities($error); ?> </div><?php } else if ($msg) { ?><div class="succWrap" id="msgshow"><?php echo htmlentities($msg); ?> </div><?php } ?>
									    <?php
                                            // Check if the 'file' parameter is set in the query string
                                            if (isset($_GET['file'])) {
                                                $pdfFileName = $_GET['file'];
                                                $pdfFilePath = '../cardcopies/' . $pdfFileName;
                                            
                                                // Check if the PDF file exists
                                                if (file_exists($pdfFilePath)) {
                                                    echo '<div id="pdfContainer">';
                                                    echo '<embed src="' . $pdfFilePath . '" type="application/pdf" width="100%" height="600px" />';
                                                    echo '</div>';
                                                } else {
                                                    echo '<p>PDF file not found.</p>';
                                                }
                                            } else {
                                                echo '<p>No PDF file selected for viewing.</p>';
                                            }
                                            ?>
								</div>
							</div>
						</div>
					</div>

				</div>
			</div>
		</div>

		
			</body>

	</html>