<!doctype html>
<html lang="en" data-bs-theme="dark">

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="icon" href="../assets/images/favicon-32x32.png" type="image/png">
	<link href="../assets/plugins/simplebar/css/simplebar.css" rel="stylesheet">
	<link href="../assets/plugins/perfect-scrollbar/css/perfect-scrollbar.css" rel="stylesheet">
	<link href="../assets/plugins/metismenu/css/metisMenu.min.css" rel="stylesheet">
	<link href="../assets/css/pace.min.css" rel="stylesheet">
	<script src="../assets/js/pace.min.js"></script>
	<link href="../assets/css/bootstrap.min.css" rel="stylesheet">
	<link href="../assets/css/bootstrap-extended.css" rel="stylesheet">
	<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" rel="stylesheet">
	<link href="../assets/sass/app.css" rel="stylesheet">
	<!-- Theme Style CSS -->
	<link rel="stylesheet" href="../assets/sass/dark-theme.css">
	<link rel="stylesheet" href="../assets/sass/semi-dark.css">
	<link rel="stylesheet" href="../assets/sass/bordered-theme.css">
	<link href="../assets/css/icons.css" rel="stylesheet">
	<title>TOD - Admin Dashboard</title>
</head>

<body>
	<div class="wrapper">
		<div class="section-authentication-cover">
			<div class="row g-0">
				<div class="col-12 col-xl-7 col-xxl-8 auth-cover-left d-none d-xl-flex align-items-center justify-content-center">
					<div class="card shadow-none bg-transparent rounded-0">
						<div class="card-body">
							<img src="../assets/images/login-images/login-cover.svg" class="img-fluid" width="650" alt=""/>
						</div>
					</div>
				</div>
				<div class="col-12 col-xl-5 col-xxl-4 auth-cover-right align-items-center justify-content-center">
					<div class="card rounded-0 m-3 shadow-none bg-transparent">
						<div class="card-body p-sm-5">
							<div class="text-center mb-4">
								<img src="../assets/images/logo-icon.png" width="60" alt="">
								<h5>TechOdyssey Designs Dashboard</h5>
								<p>Please log in to your account</p>
							</div>
							<form id="loginForm" class="row g-3">
								<div class="col-12">
									<label for="inputEmailAddress" class="form-label">Username</label>
									<input type="input" class="form-control" name="username" id="inputEmailAddress" required>
								</div>
								<div class="col-12">
									<label for="inputChoosePassword" class="form-label">Password</label>
									<div class="input-group" id="show_hide_password">
										<input type="password" class="form-control" name="password" id="inputChoosePassword" required> 
										<a href="javascript:;" class="input-group-text bg-transparent"><i class="bx bx-hide"></i></a>
									</div>
								</div>
								<div class="col-12 d-grid">
									<button type="submit" class="btn btn-primary">Sign in</button>
								</div>
								<div class="col-12 text-danger text-center mt-2" id="loginMessage"></div>
							</form>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

	<script src="../assets/js/bootstrap.bundle.min.js"></script>
	<script src="../assets/js/jquery.min.js"></script>
	<script src="../assets/plugins/simplebar/js/simplebar.min.js"></script>
	<script src="../assets/plugins/metismenu/js/metisMenu.min.js"></script>
	<script src="../assets/plugins/perfect-scrollbar/js/perfect-scrollbar.js"></script>

	<script>
		$(document).ready(function () {
			$('#loginForm').on('submit', function (e) {
				e.preventDefault();
				const formData = $(this).serialize();
				
				$.ajax({
					url: '../src/login.php',
					type: 'POST',
					data: formData,
					success: function (response) {
						if (response.trim() === 'success') {
							window.location.href = 'index.php';
						} else {
							$('#loginMessage').text(response);
						}
					}
				});
			});
		});
	</script>

	<script src="../assets/js/app.js"></script>
</body>
</html>