<!doctype html>
<html lang="en">


<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>VisitorSquare</title>
    <link rel="shortcut icon" href="<?php echo e(asset('public/favicon.png')); ?>" type="image/x-icon">

    <!-- begin::global styles -->
    <link rel="stylesheet" href="<?php echo e(asset('public/admin/vendors/bundle.css')); ?>" type="text/css">
    <!-- end::global styles -->

    <!-- begin::custom styles -->
    <link rel="stylesheet" href="<?php echo e(asset('public/admin/css/app.min.css')); ?>" type="text/css">
    <!-- end::custom styles -->
    <meta name="csrf-token" content="<?php echo e(csrf_token()); ?>" />

</head>

<body class="bg-white h-100-vh p-t-0">

    <!-- begin::page loader-->
    <div class="page-loader">
        <div class="spinner-border"></div>
        <span>Loading</span>
    </div>
    <!-- end::page loader -->

    <div class="p-b-50 d-block d-lg-none"></div>

    <div class="container h-100-vh">
        <div class="row align-items-md-center h-100-vh">
            <div class="col-lg-6 d-none d-lg-block">
                <img class="img-fluid" src="<?php echo e(asset('public/login-left.svg')); ?>" alt="...">
            </div>
            <div class="col-lg-4 offset-lg-1 py-5" style="height:100vh">
                <!-- Nav tabs -->
                <ul class="nav nav-tabs">
                    <li class="nav-item">
                        <a class="nav-link active" data-toggle="tab" href="#admin">Login</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link visitor-tab" data-toggle="tab" href="#visitor">Visitor</a>
                    </li>
                
                </ul>

                <!-- Tab panes -->
                <div class="tab-content">
                    <div class="tab-pane container active py-4" id="admin">
                            <div class="m-b-20">
                                <img src="<?php echo e(asset('public/logo.png')); ?>" class="m-r-15" width="180" alt="">
                            </div>
                            <p>Sign in to continue.</p>
                            <?php if (isset($component)) { $__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74 = $component; } ?>
<?php $component = $__env->getContainer()->make(App\View\Components\FlashMessage::class, []); ?>
<?php $component->withName('flashMessage'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74)): ?>
<?php $component = $__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74; ?>
<?php unset($__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74); ?>
<?php endif; ?>

                            <form action="<?php echo e(route('login')); ?>" method="post" >
                                <?php echo csrf_field(); ?>
                                <div class="form-group mb-4">
                                    <input type="text" class="form-control form-control-lg" name="email"
                                        id="exampleInputEmail1" autofocus placeholder="Email/Mobile">
                                    <?php if($errors->has('email')): ?>
                                        <div class="text-danger">
                                            <?php echo e($errors->first('email')); ?>

                                        </div>
                                    <?php endif; ?>

                                </div>
                                <div class="form-group mb-4">
                                    <input type="password" name="password" class="form-control form-control-lg"
                                        id="exampleInputPassword1" placeholder="Password">
                                    <?php if($errors->has('password')): ?>
                                        <div class="text-danger">
                                            <?php echo e($errors->first('password')); ?>

                                        </div>
                                    <?php endif; ?>
                                </div>
                                
                                <div class="d-flex justify-content-between align-items-center mb-4">
                                    <div class="custom-control custom-checkbox">
                                        <input type="checkbox" name="i_agree" class="custom-control-input" id="customCheck">
                                        <label class="custom-control-label" for="customCheck">I Agree with <a href="javascript:;"
                                                data-toggle="modal" data-target="#policyModalLong"><u>Privacy
                                                    Policy</u></a></label>
                                    </div>
                                    <div class="clearfix"></div>
                                    <?php if($errors->has('i_agree')): ?>
                                        <div class="text-danger">
                                            <?php echo e($errors->first('i_agree')); ?>

                                        </div>
                                    <?php endif; ?>
                                </div>
                                <button class="btn btn-primary btn-lg btn-block btn-uppercase mb-4">Sign In</button>
                            </form>
                    </div>
                    <div class="tab-pane container fade py-4" id="visitor" >
                            <div class="m-b-20">
                                <img src="<?php echo e(asset('public/logo.png')); ?>" class="m-r-15" width="180" alt="">
                            </div>
                            
                            <?php if (isset($component)) { $__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74 = $component; } ?>
<?php $component = $__env->getContainer()->make(App\View\Components\FlashMessage::class, []); ?>
<?php $component->withName('flashMessage'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74)): ?>
<?php $component = $__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74; ?>
<?php unset($__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74); ?>
<?php endif; ?>

                            <form  class="visitor-login-form">
                                <?php echo csrf_field(); ?>
                                <div class="form-group mb-4">
                                    <input type="text" class="form-control form-control-lg" name="email"
                                        id="email-mobile" autofocus placeholder="Email/Mobile">
                                    <?php if($errors->has('email')): ?>
                                        <div class="text-danger">
                                            <?php echo e($errors->first('email')); ?>

                                        </div>
                                    <?php endif; ?>

                                </div>
                                <button class="btn btn-info" type="submit">SEND OTP</button>                                
                               
                            </form>

                            <form  class="otp-form d-none">
                                <?php echo csrf_field(); ?>
                                <input type="hidden" name="email" id="email_input">
                                <input type="hidden" name="message_id" id="message_id">
                                <div class="form-group mb-4">
                                    <input type="number"  class="form-control form-control-lg" name="otp"
                                        id="otp-input" autofocus required>
                                    <?php if($errors->has('email')): ?>
                                        <div class="text-danger">
                                            <?php echo e($errors->first('email')); ?>

                                        </div>
                                    <?php endif; ?>

                                </div>
                                <div class="d-flex justify-content-between">
                                    <button type="button" class="btn btn-info time-running" disabled></button>
                                    <button class="btn btn-primary" type="submit">Verify OTP</button>  
                                </div>
                                
                                                              
                               
                            </form>

                            <form  class="visitor-password-reset-form d-none" method="post" action="<?php echo e(asset('visitor-reset-password')); ?>">
                                <?php echo csrf_field(); ?>
                                <input type="hidden" name="email" id="reset_email">

                                
                                <div class="form-group mb-4">
                                    <label for="password">Password</label>
                                    <input type="password"  class="form-control form-control-lg" name="password"
                                        id="reset_password" required>
                                    <?php if($errors->has('password')): ?>
                                        <div class="text-danger">
                                            <?php echo e($errors->first('password')); ?>

                                        </div>
                                    <?php endif; ?>

                                </div>
                                <div class="form-group mb-4">
                                    <label for="c_password">Confirm Password</label>
                                    <input type="password"  class="form-control form-control-lg" name="c_password"
                                        id="reset_confirm_password" required>
                                    <?php if($errors->has('c_password')): ?>
                                        <div class="text-danger">
                                            <?php echo e($errors->first('c_password')); ?>

                                        </div>
                                    <?php endif; ?>

                                </div>
                                <div class="d-flex justify-content-between">
                                    
                                    <button class="btn btn-primary" type="submit">RESET</button>  
                                </div>
                                
                                                              
                               
                            </form>
                    </div>
                   
                </div>
                
            </div>
        </div>
    </div>

    
    <div class="modal fade bd-example-modal-lg" id="policyModalLong" tabindex="-1" role="dialog"
        aria-labelledby="policyModalLongTitle" aria-hidden="true">
        <div class="modal-dialog modal-lg" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="policyModalLongTitle">Privacy Policy</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <p>Privacy Policy</p>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
                    </button>
                </div>
            </div>
        </div>
    </div>
    

    <!-- begin::global scripts -->
    <script src="<?php echo e(asset('public/admin/vendors/bundle.js')); ?>"></script>
    <!-- end::global scripts -->

    <!-- begin::custom scripts -->
    <script src="<?php echo e(asset('public/admin/js/borderless.min.js')); ?>"></script>
    <!-- end::custom scripts -->

   
    <!-- begin::select2 -->
    <link rel="stylesheet" href="<?php echo e(asset('public/admin/vendors/select2/css/select2.min.css')); ?>" type="text/css">
    <script src="<?php echo e(asset('public/admin/vendors/select2/js/select2.min.js')); ?>"></script>
    <!-- end::select2 -->
    <script>
       
        $(document).ready(function() {
            
           $(".visitor-login-form").submit(function(e){
                e.preventDefault();
                
                $.ajax({
                    type: "post",
                    headers: {
                        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                    },
                    data:new FormData(this),
                    contentType:false,
                    processData:false,
                    cache:false,
                    url: "<?php echo e(asset('visitor-otp')); ?>",
                    success: function(result) 
                    {  
                        var allData = result;
                        console.log(allData);
                        if(allData.message=="success")
                        {
                            $(".visitor-login-form").addClass("d-none");
                            $(".otp-form").removeClass("d-none");
                            var timer = 60;
                            $(".time-running").html("Time Left : "+60);

                            $("#email_input").val(allData.email);
                            $("#message_id").val(allData.message_id);
                            
                            setInterval(function () {
                                timer--;
                                if(timer<=0)
                                {
                                    $(".time-running").attr("mobile",allData.email);
                                    $(".time-running").html("Resend OTP");
                                   
                                }
                                else
                                {
                                    $(".time-running").html("Time Left : "+timer);
                                }
                            }, 1000);

                            $("#otp-input").on("input",function(e){
                                var otp = $(this).val();
                                var len = otp.length;
                                if(len>4)
                                {
                                    e.preventDefault();
                                    $(this).val(otp.slice(0, 4));
                                }
                            });

                            $(".otp-form").submit(function(e){
                                e.preventDefault();
                
                                $.ajax({
                                    type: "post",
                                    headers: {
                                        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                                    },
                                    data:new FormData(this),
                                    contentType:false,
                                    processData:false,
                                    cache:false,
                                    url: "<?php echo e(asset('visitor-otp-verify')); ?>",
                                    success: function(result) 
                                    { 
                                        if(result.message == "success")
                                        {
                                            $(".otp-form").addClass("d-none");
                                            $(".visitor-password-reset-form").removeClass("d-none");
                                            $("#reset_email").val(result.email);
                                        }
                                    },
                                    error:function(xhr,status,error)
                                    {
                                        console.log(error);
                                    }
                                });

                            });
                           
                        }
                    },
                    error:function(xhr,status,error)
                    {
                        console.log(error);
                    }
                });
           });
            /*function fetchHost()
            {
                
            }*/
        });

       
        
    </script>


</body>



</html>
<?php /**PATH /var/www/admin.visitorkrypt.com/resources/views/login.blade.php ENDPATH**/ ?>