<!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">
        <meta name="description" content="">
        <meta name="author" content="">
        <title>Srima Ticket Book Login </title>
        <!-- Bootstrap Core CSS -->
        <link href="bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
        <link href="https://fonts.googleapis.com/css2?family=Mukta:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
        <!-- Custom CSS -->
        <link href="dist/css/sb-admin-2.css" rel="stylesheet">
        <!-- Custom Fonts -->
        <link href="bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
            <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
            <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>
    <body>
		
		<div class="login-bg">
		<div class="login-text">
			<div class="login-text-area">
				<img src="images/logo.png" alt="">
			</div>
			<div class="login-text1">
				Sri Ma Group Of <br> Institution Presents
			</div>
			<div class="login-text2">
				Secondary  <br> Annual Day
			</div>
			<div class="login-text3">
				10 Feb 2023
			</div>
		</div>
		</div>
		
		<div class="login-form">
		<div class="login-inside">
        <h2>Srima Ticket Booking sign In</h2>
        <div class="form-area">
            <div class="col-md-7">
                <div class="panel">
                    <div class="panel-area">
                        <form method="post">
                            <fieldset>
                                <div class="form-group">
                                    <input class="form-control" placeholder="Mobile No." id="mobile_no" name="mobile_no" type="text" autofocus autocomplete="off">
                                </div>
                                <div class="form-group">
                                    <input class="form-control" placeholder="Enter OTP" id="mob_otp" name="mob_otp" type="password" value="" style="display:none">
                                </div>
                                <div class="success-msg"></div>
                                
                                <!-- Change this to a button or input when using this as a form -->
                                <button type="button" value="Send OTP" name="send_otp" id="send_otp" class="btn btn-lg btn-success btn-block">Send OTP</button>
                                <input type="button" value="Login" name="submit" id="login" class="btn btn-lg btn-success btn-block" style="display:none">
                                <div class="error-msg"></div>
                            </fieldset>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        </div>
        </div>
        <!-- jQuery -->
        <script src="bower_components/jquery/dist/jquery.min.js"></script>
        <!-- Bootstrap Core JavaScript -->
        <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
        <script type="text/javascript">
            $("#send_otp").click(function(){
                var mobile_no = $('#mobile_no').val();
                var send_otp = 1;
                var action = 'send_otp';
                $.ajax({
                    type: "POST",
                    url: "loginverify.php",
                    dataType:"json",
                    data: {mobile_no:mobile_no,send_otp:send_otp,action:action},
                    //cache: false,
                    success: function(data){
                        console.log(data);
                        if(data.is_success){
                            $('#mob_otp').show();
                            $('.success-msg').text(data.message);
                            $('.success-msg').show();
                            $('.error-msg').hide();
                            
                            $('#send_otp').hide();
                            $('#login').show();
                        }else{
                            $('.error-msg').text(data.message);
                            $('.error-msg').show();
                            $('.success-msg').hide();
                            $('#mob_otp').hide();
                            
                            $('#send_otp').show();
                            $('#login').hide();
                        }
                    }
                });
            });    
            $("#login").click(function(){
                var mobile_no = $('#mobile_no').val();
                var mob_otp = $('#mob_otp').val();
                var send_otp = 1;
                var login = 1;
                var action = 'verify_otp';
                $.ajax({
                    type: "POST",
                    url: "loginverify.php",
                    dataType:"json",
                    data: {mobile_no:mobile_no,mob_otp:mob_otp,send_otp:send_otp,action:action},
                    //cache: false,
                    success: function(data){
                        console.log(data);
                        if(data.is_success){
                            window.location = "https://dev.srimaone.in/srimaticket/dashboard.php";
                        }else{
                            $('.error-msg').text(data.message);
                            $('.error-msg').show();
                            $('.success-msg').hide();
                            $('#mob_otp').hide();
                            
                            $('#send_otp').show();
                            $('#login').hide();
                        }
                    }
                });
            });
           
        </script>
    </body>
</html>
