<?php session_start()?>
<!DOCTYPE html>
<html lang="en">
<head>
	<title>POS</title>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
<!--===============================================================================================-->	
	<link rel="icon" type="image/png" href="images/logo-tr.png"/>
<!--===============================================================================================-->
	<link rel="stylesheet" type="text/css" href="admin/vendor/bootstrap/css/bootstrap.min.css">
<!--===============================================================================================-->
	<link rel="stylesheet" type="text/css" href="admin/fonts/font-awesome-4.7.0/css/font-awesome.min.css">
<!--===============================================================================================-->
	<link rel="stylesheet" type="text/css" href="admin/fonts/Linearicons-Free-v1.0.0/icon-font.min.css">
<!--===============================================================================================-->
	<link rel="stylesheet" type="text/css" href="admin/vendor/animate/animate.css">
<!--===============================================================================================-->	
	<link rel="stylesheet" type="text/css" href="admin/vendor/css-hamburgers/hamburgers.min.css">
<!--===============================================================================================-->
	<link rel="stylesheet" type="text/css" href="admin/vendor/animsition/css/animsition.min.css">
<!--===============================================================================================-->
	<link rel="stylesheet" type="text/css" href="admin/css/util.css">
	<link rel="stylesheet" type="text/css" href="admin/css/main.css">

	<link rel="stylesheet" href="admin/assets/toastr/toastr.min.css">
  	<script src="admin/assets/toastr/jquery.min.js"></script>
  	<script src="admin/assets/toastr/toastr.min.js"></script>
<!--===============================================================================================-->
	<style>
		.text-blinkings{
			animation: blinkingText 1.8s infinite;
		}
		@keyframes blinkingText{
			0% 	{ color: red; }
			49%	{ color: red;}
			60%	{ color: red;}
			70%	{ color: transparent;}
			100%{ color: red;}
		}
		#toast-container > .toast {
    		width: 320px; /* Adjust the width as needed */
			font-size: 14px;
		}
		.switch-pin-login {
			margin-top: 20px;
			width: 100%;
			background-color: #4CAF50;
			color: white;
			padding: 15px;
			font-size: 18px;
			border: none;
			cursor: pointer;
		}
	</style>
</head>
<body>
	
	<div class="limiter">
		<div class="container-login100">
			<div class="wrap-login100">
				<div class="login100-form-title" style="background-image: url(images/spa-bg.jpg);">
					<span class="login100-form-title-1">
						<?php 
							include_once 'admin/model/common_model.php';
							$common_model = new common_model();

							$companyDetails = $common_model->getCompanyDetails();
                            $company_name = $companyDetails['company_name'];
							echo $company_name;
						?>
					</span>
				</div>
				<div style="margin-left:200px;margin-top:20px;position:absolute">
					<?php 
							$errors = array(
							1=>"Invalid Username or Password, Try again",
							2=>"Session Expired, Please Login Again",
							3=>"Your Account Has Been Suspended",
							4=>"Your Role Has Not Been Assigned",
							5=>"You Have Successfully Logged Out",
							6=>"Update Successful, Login To Activate your Account",
							7=>"Successfully Logged Out",
							8=>"Duplicate Session ID, Please Login Again"
							);
							
							$error_id = isset($_GET['err']) ? (int)$_GET['err'] : 0;
							if ($error_id == 1){
									echo '<p class="text-blinkings" style="font-size:16px">'.$errors[$error_id].'</p>';
								}elseif($error_id == 2){
									echo '<p class="text-blinkings" style="font-size:16px">'.$errors[$error_id].'</p>';
								}elseif($error_id == 3){
									echo '<p class="text-blinkings" style="font-size:16px">'.$errors[$error_id].'</p>';
								}elseif($error_id == 4){
									echo '<p class="text-blinkings" style="font-size:16px">'.$errors[$error_id].'</p>';
								}elseif($error_id == 5){
									echo '<p class="text-info" style="font-size:16px"><i class="fa fa-thumbs-up"></i> '.$errors[$error_id].'</p>';
								}elseif($error_id == 6){
									echo '<p class="text-info" style="font-size:16px"><i class="fa fa-thumbs-up"></i> '.$errors[$error_id].'</p>';
								}elseif($error_id == 7){
									echo '<p class="text-info" style="font-size:16px"><i class="fa fa-thumbs-up"></i> '.$errors[$error_id].'</p>';
								}elseif($error_id == 8){
									echo '<p class="text-blinkings" style="font-size:16px">'.$errors[$error_id].'</p>';
								}
							?> 
					</div>

				<form class="login100-form validate-form" action="aunthenticate.php" method="post">
					<div class="wrap-input100 validate-input m-b-26" data-validate="Username is required">
						<span class="label-input100">Email</span>
						<input class="input100" type="text" autocomplete="off" name="username" placeholder="Enter username" autofocus>
						<span class="focus-input100"></span>
					</div>

					<div class="wrap-input100 validate-input m-b-18" data-validate = "Password is required">
						<span class="label-input100">Password</span>
						<input class="input100" type="password" name="pass" autocomplete="off" placeholder="Enter password">
						<span class="focus-input100"></span>
					</div>

					

					<div class="container-login100-form-btn">
						<button class="login100-form-btn">
							Login
						</button>   
					</div>

					
				</form>
			</div>
		</div>
	</div>
	
<!--===============================================================================================-->
	<script src="admin/vendor/jquery/jquery-3.2.1.min.js"></script>
<!--===============================================================================================-->
	<script src="admin/vendor/animsition/js/animsition.min.js"></script>
<!--===============================================================================================-->
	<script src="admin/vendor/bootstrap/js/popper.js"></script>
	<script src="admin/vendor/bootstrap/js/bootstrap.min.js"></script>
<!--===============================================================================================-->
	<script src="admin/js/main.js"></script>
	<script type="text/javascript">
        $(document).ready(function() {
            <?php if (isset($_SESSION['notification'])) { ?>
                var type = "<?php echo $_SESSION['notification']['type']; ?>";
                var title = "<?php echo $_SESSION['notification']['title']; ?>";
                var message = "<?php echo $_SESSION['notification']['message']; ?>";
                
                toastr.options = {
                    "closeButton": true,
                    "progressBar": false,
                    "positionClass": "toast-top-right",
                    "timeOut": "5000",
                    "extendedTimeOut": "3000"
                };

                if (type === 'success') {
					        toastr.success(message, title || "Success");
				        } else if (type === 'error') {
					        toastr.error(message, title || "Error");
				        } else if(type === 'warning'){
					        toastr.warning(message, title || "Warning");
				        } else if(type === 'info') {
                  toastr.info(message, title || "Info");
                }


                // Clear the notification session
                <?php unset($_SESSION['notification']); ?>
            <?php } ?>
        });
    </script>

</body>
</html>