<?php 

require __dir__ . '/init.php'; 

$tx = $_SESSION['transfer_log'] ?? call_user_func(function() {
	global $link;
	$SQL = "SELECT * FROM tbl_transaction WHERE id = '{$_GET['id']}'";
	return $link->query( $SQL )->fetch_assoc();
});

?>

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<meta content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no" name="viewport">
		<link rel="stylesheet" href="<?php echo help::url( TEMP_DIR . '/receipt/style.css' ); ?>" media="all" />
		<link rel="stylesheet" href="<?php echo help::url( TEMP_DIR . '/receipt/bootstrap-utilities.css' ); ?>" media="all" />
		<style>
			.save-btn {
				border: 1px solid #917bc7;
				background-image: linear-gradient(#8473c7, #8e7b97);
				padding: 14px;
				border-radius: 26px;
				font-size: 14px;
				font-weight: 700;
				color: #fff;
				font-family: 'SourceSansPro';
				text-transform: uppercase;
				cursor: pointer;
				box-shadow: 0 0 3px grey;
				display: block;
				text-align: center;
				user-select: none;
			}
			
			.save-btn:hover {
				background-image: linear-gradient(#aaa4bf, #aea0b5);
			}
			
			.save-btn:active {
				box-shadow: none;
			}
			.main-page {
				border: 1px solid #e7e6e6;
				padding: 30px;
				box-shadow: 2px 1px 5px lightgrey;
			}
			
			.save-btn.exit {
				background-image: none;
				background-color: #c36161;
				display: inline-block;
				width: 12rem;
			}
		</style>
	</head>
	<body class='p-4'>
	
	<div class='main-page mb-5'>
	
		<?php require TEMP_DIR . '/receipt/index.php'; ?>

		<div class='my-5 text-center'>
			<a class='save-btn mb-3' href='receipt-pdf.php?id=<?php echo $tx['tx_no']; ?>' target='receipt'>
				Save Receipt
			</a>
			<a class='save-btn exit' href='payment.php'>
				Close
			</a>
		</div>
	
	</div>
	
	</body>
</html>
