<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Click Mobile ERP | OTP </title>

    <!-- Bootstrap -->
    <link href="{!! url('public/assets/vendors/bootstrap/dist/css/bootstrap.min.css') !!}" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="{!! url('public/assets/vendors/font-awesome/css/font-awesome.min.css') !!}" rel="stylesheet">
    <!-- NProgress -->
    <link href="{!! url('public/assets/vendors/nprogress/nprogress.css') !!}" rel="stylesheet">
    <!-- Animate.css -->
    <link href="{!! url('public/assets/vendors/animate.css/animate.min.css') !!}" rel="stylesheet">

    <!-- Custom Theme Style -->
    <link href="{!! url('public/assets/build/css/custom.min.css') !!}" rel="stylesheet">
  </head>

  <body class="login">
    <div>
      <a class="hiddenanchor" id="signup"></a>
      <a class="hiddenanchor" id="signin"></a>

      <div class="login_wrapper">
        <div class="animate form login_form">
          <section class="login_content">
            

            <form method="post" action="{!! url('login') !!}">
              <input type="hidden" name="otp_user_id" value="{{ $otp_user_id }}" >
              {{ csrf_field() }}
              <h1>OTP Form</h1>
              <p class="alert alert-info" id="otpInfoArea">Hello  {{ $auth_name }}, an OTP has been sent to your email address, use it to complete the login process</p>
              @include('commons.notifications')
              <div>
                <input type="text" name="otp" id="otpText" class="form-control" placeholder=" --- Enter OTP Here ---" required="" />
              </div>
              <!-- <div>
                <input type="password" name="password" class="form-control" placeholder="Password" required="" />
              </div> -->
              <div>
                <button type="submit" id="otpSubmitBtn" class="btn btn-success submit btn-block">Submit</button>
                <p class="text-center text-danger" id="timer"></p>
                <div class="text-center">                
                <a class="btn btn-link text-center" href="{{ url('resendotp') }}">Resend OTP</a>
                </div>
              </div>

              <div class="clearfix"></div>

              <div class="separator">
                <!-- <p class="change_link">New to site?
                  <a href="#signup" class="to_register"> Create Account </a>
                </p> -->

                <div class="clearfix"></div>
                <br />

                <div>
                  <h1><i class="fa fa-paw"></i> Click ERP </h1>
                  <p>©{{ date('Y') }} All Rights Reserved. Click Mobile</p>
                </div>
              </div>
            </form>
          </section>
        </div>

        
      </div>
    </div>
    <script src="{!! url('public/assets/vendors/jquery/dist/jquery.min.js') !!}"></script>
    <script src="{!! url('public/assets/vendors/bootstrap/dist/js/bootstrap.min.js') !!}"></script>
    <script src="{!! url('public/assets/vendors/moment/min/moment.min.js') !!}"></script>
 
    <script type="text/javascript">
      $(document).ready(function() {
            var timeLeft = 120; // 2 minutes in seconds
            
            function updateTimer() {
                var minutes = Math.floor(timeLeft / 60);
                var seconds = timeLeft % 60;
                seconds = seconds < 10 ? "0" + seconds : seconds; // Format seconds

                $("#timer").text(minutes + ":" + seconds);

                if (timeLeft > 0) {
                    timeLeft--;
                    setTimeout(updateTimer, 1000);
                } 
                else {
                  $("#timer").text("Time's up!");
                  $('#otpSubmitBtn').prop('disabled', true);
                  $('#otpText').prop('disabled', true);
                  $('#otpInfoArea').removeClass('alert alert-info');
                  $('#otpInfoArea').addClass('alert alert-warning');

                }
            }
            updateTimer(); // Start the countdown
        });

    </script>
  </body>
</html>
