<!DOCTYPE html>
<!--[if IE 9 ]><html class="ie ie9" lang="en" class="no-js"> <![endif]-->
<!--[if !(IE)]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<head>
	<title>Inventory Web Desk Login Panel</title>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="description" content="KingAdmin Dashboard">
	<meta name="author" content="The Develovers">
	<!-- CSS -->
	<link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css">
	<link href="assets/css/font-awesome.min.css" rel="stylesheet" type="text/css">
	<link href="assets/css/main.css" rel="stylesheet" type="text/css">
	<link href="assets/css/skins/transparent.css" rel="stylesheet" type="text/css">
	<!--[if lte IE 9]>
		<link href="assets/css/main-ie.css" rel="stylesheet" type="text/css" />
		<link href="assets/css/main-ie-part2.css" rel="stylesheet" type="text/css" />
	<![endif]-->
	<!-- Fav and touch icons -->
	<link rel="apple-touch-icon-precomposed" sizes="144x144" href="assets/ico/kingadmin-favicon144x144.png">
	<link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/ico/kingadmin-favicon114x114.png">
	<link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/ico/kingadmin-favicon72x72.png">
	<link rel="apple-touch-icon-precomposed" sizes="57x57" href="assets/ico/kingadmin-favicon57x57.png">
	<link rel="shortcut icon" href="assets/ico/favicon.png">
	<style>
	label.error {
	  color:#FB3A3A;
	  font-weight:bold;
	}
	</style>
</head>

<body>
	<div class="wrapper full-page-wrapper page-auth page-login text-center">
		<div class="inner-page">
			<div class="logo">
				<a href="index.html"><img src="assets/img/logo.png" alt="" /></a>
			</div>
			<div class="separator"><span>Forgot Password Panel </span></div>
			

	
			<div class="login-box center-block">
			<form class="form-horizontal" action="" method="post" id="login-form" novalidate>
                {!! csrf_field() !!}

	<div class="alert  alert-info " >
        <ul><li class="fa fa-cog  fa-1x fa-fw"></li>Enter Login ID to recover password..</ul>
    </div>						
	<div class="alert alert-success print-success-msg" style="display:none">
        <ul></ul>
    </div>
	
	<div class="alert alert-danger print-error-msg" style="display:none">
        <ul></ul>
    </div>					
					<div class="form-group">
						<label for="username" class="control-label sr-only">Username</label>
						<div class="col-sm-12">
							<div class="input-group">
								<span class="input-group-addon"><i class="fa fa-user"></i></span>
								<input type="text" placeholder="Enter Username" id="username" name="username" class="form-control">
							</div>
						</div>
					</div>
					<button class="btn btn-custom-primary btn-lg btn-block btn-auth"><i class="fa fa-arrow-circle-o-right spin "></i> Recover Password</button>                    
				</form>
				<div class="links">
					<p><a href="/">Do you remember Login credentials?</a></p>
				</div>
			</div>
		</div>
	</div>
	<footer class="footer">&copy; {{ date('Y') }} Inventory Web desk</footer>
	<!-- Javascript -->
	<script src="assets/js/jquery/jquery-2.1.0.min.js"></script>
	<script src="assets/js/bootstrap/bootstrap.js"></script>
	<script src="assets/js/plugins/modernizr/modernizr.js"></script>
	
	<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js"></script>
	<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js"></script>
	<script src="//ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js"></script>-->
	<script src="js/jquery.validate.min.js"></script>
	<script src="js/jquery.js"></script>
	
	 <!-- jQuery Form Validation code -->
  <script>
  
  // When the browser is ready...
  $(function() {
  
    // Setup form validation on the #login-form element
    $("#login-form").validate({
     
        // Specify the validation rules
        rules: {
            username: "required",
            password: "required"
        },
        
        // Specify the validation error messages
        messages: {
            username: "Username should not be empty..",
            password: "Password should not be empty.."
        },
        
        submitHandler: function(form) {
            //form.submit();

			$(".alert-info").find("ul").html('<li class="fa fa-cog fa-spin fa-1x fa-fw"></li> Login Verification under process...');			
			
			var _token = $("input[name='_token']").val();
	    	var username = $("input[name='username']").val();
	    	var password = $("input[name='password']").val();

	        $.ajax({
	            url: "/ilogin",
	            type:'POST',
	            data: {_token:_token, username:username, password:password},
	        /*   success: function(data){
					if(data.status == 1)
					{
						 (data.message);
					}
					else
					{
						$('#username').val('');
						$('#password').val('');
						printErrorMsg(data.message)
					}
	            }*/
				error: function( data ) {
				 $.each(data, function( index, value ) {
					 if(value.msg){
                //$("#response").html("<div class='alert alert-danger'>"+msg+"</div>");
			//$(".print-error-msg").find("ul").html('');
				$(".print-error-msg").css('display','block');
					 $(".print-error-msg").find("ul").append('<li class="fa fa-times-circle fa-1x fa-fw"></li>'+value.msg);}
			else if(value.home)
				 window.location.href = value.home;
				 });
            }
	        });
			
			function printErrorMsg (msg) {				
				$(".alert-info").css('display','none');
				$(".print-success-msg").css('display','none');
				$(".print-error-msg").find("ul").html('');
				$(".print-error-msg").css('display','block');
				$(".print-error-msg").find("ul").append('<li class="fa fa-times-circle fa-1x fa-fw"></li>'+msg);
			}
			
			function printSuccessMsg (msg) {
				$(".alert-info").css('display','none');
				$(".print-error-msg").css('display','none');
				$(".print-success-msg").find("ul").html('');
				$(".print-success-msg").css('display','block');
				$(".print-success-msg").find("ul").append('<li class="fa fa-check  fa-1x fa-fw"></li>'+msg);
				
           }
			
        }
    });

  });
  
  </script>

</body>

</html>