<?php
$_title = "Ninja School Online";
include_once '../system/head.php';
if ($_login == null) {
	header("location:/login");
}

?>
<main class="flex-grow-1 flex-shrink-1">
	<?php

	function get_string_tinhtrangthe($tinhtrangthe)
	{
		switch ($tinhtrangthe) {
			case 0:
				$str = '<span class="btn btn-warning form-fontrol">Chờ xử lý</span>';
				break;
			case 1:
				$str = '<span class="btn btn-success form-fontrol">Nạp Thành Công</span>';
				break;
			case 2:
				$str = '<div class="btn" style="background-color:red;color:#fff; ">Thẻ Sai</div>';
				break;
			default:
				$str = '<span class="btn btn-danger form-fontrol">Lỗi Chưa Xác Định</span>';
				break;
		}
		return $str;
	}
	?>
	<!DOCTYPE html>
	<html lang="en">

	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>Lịch sử</title>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>Nạp lượng</title>
		<!--Gốc Trang-->
		<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
		<link rel="stylesheet"
			href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
		<!--Gốc Trang-->
		<!--Gốc Trang new menu-->
		<script src="https://cdn.lordicon.com/xdjxvujz.js"></script>
		<script src="https://code.iconify.design/2/2.2.1/iconify.min.js"></script>
		<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
		<!--Gốc Trang new menu - body-->
		<!-- Thư viện bootstrap5 -->
		<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet">
		<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
		<!-- Thư viện bootstrap5 -->
		<!---Icon --->
		<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" />
		<script src="https://code.iconify.design/iconify-icon/1.0.0/iconify-icon.min.js"></script>
		<!---Icon --->
		<!---Thông báo --->
		<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
		<!---Thông báo --->
		<!---Thông báo tự dộng tăt --->
		<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
		<!---Thông báo tự dộng tăt --->
		<!---Nút copy --->
		<script src="https://cdn.jsdelivr.net/clipboard.js/1.5.12/clipboard.min.js"></script>
		<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.0.17/dist/sweetalert2.min.js"></script>
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@11.0.17/dist/sweetalert2.min.css">
		<!---Nút copy --->
		<!--update body trang-->
		<link rel="stylesheet" href="../assets/css/nap-tien.css" />
		<!--update body trang-->
	</head>

	<body>
		<div style="margin-top: 100px;"></div>
		<div class="container pb-5">
			<?php
			if ($_login != null) {
				if ($_status == "wait") {
					echo '<div class="alert alert-primary">Để có thể đăng nhập vào game, bạn cần phải <a href="/active">kích hoạt tài khoản</a> (Phí: 10,000 Coin = 10,000 VND).</div>';
				} elseif ($_status == "block") {
					echo '<div class="alert alert-primary">Tài khoản đang bị khóa, để mở lại bạn cần phải <a href="/active">mở khóa tài khoản</a> (Phí: 20,000 Coin = 20,000 VND).</div>';
				}
			}
			?>
			<div class="user-card">

				<div class="py-3 text-center">
					<div class="table-responsive">
						<p class="maincontent-texxx">LỊCH SỬ GIAO DỊCH</p>
						<table width="100%" class="user-table">
							<tr>
								<th width="5%">ID</th>
								<th width="15%">LOẠI</th>
								<th width="25%">TRẠNG THÁI</th>
								<th width="25%">MỆNH GIÁ</th>
								<th width="25%">THỜI GIAN</th>
							</tr>
							</thead>
							<tbody>
								<?php
								$data = _query(_select("*", "naptien", "uid='$_username' ORDER BY id DESC"));
								while ($row = mysqli_fetch_array($data)) {
									?>

									<tr>
										<td>
											<?php echo htmlspecialchars($row['id']); ?>
										</td>
										<td>
											<?php echo htmlspecialchars($row['loaithe']); ?>
										</td>
										<td>
											<?php echo get_string_tinhtrangthe($row['tinhtrang']); ?>
										</td>
										<td>
											<?php echo number_format($row['sotien']); ?>đ
										</td>
										<td>
											<?php echo date("H:i - d/m/Y", $row['time']); ?>
										</td>
									</tr>

								<?php }
								?>
							</tbody>
						</table>
					</div>
				</div>
			</div>
		</div>
		<div style="margin-top: 50px;"></div>
		<?php
		include_once '../system/end.php';
		?>
</main>
</body>

</html>