<?php $__env->startSection('sitecontent'); ?>
<section class="headerbg headerbg-inner">
    <div class="header header-padding">
        <?php echo $__env->make('partials.site.header-menu', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    </div>
    <div class="inner-heading"><?php echo e(__('lang.sign_in_title')); ?></div>
</section>
<section class="loginbg">
    <div class="container">
        <div class="row justify-content-center sign-in-form">
            <div class="col-lg-5">
                <div class="loginform dark-color-bg signinform">
                    <!-- <h6>
                        <?php echo __('lang.sign_in_description'); ?>
                    </h6> -->
                    <form>
                        <div class="row">
                            <div class="form-group col-md-12">
                                <?php if(Session::has('message')): ?>
                                <div class="alert alert-success" role="alert">
                                  <?php echo e(Session::get('message')); ?>

                                </div>
                                <?php endif; ?>
                                <?php if(Session::has('error')): ?>
                                <div class="alert alert-danger" role="alert">
                                  <?php echo e(Session::get('error')); ?>

                                </div>
                                <?php endif; ?>
                            </div>
                            <div class="form-group col-md-12">
                                <span><img src="<?php echo e(asset('site-assets/images/mobile0edit.svg')); ?>" /></span>
                                <input type="text" onkeypress="return (event.charCode !=8 && event.charCode ==0 || (event.charCode >= 48 && event.charCode <= 57))" class="form-control form-input-color" name="phone" id="phone" placeholder="9x xxxx xxxx" maxlength="10" />
                            </div>
                        </div>
                        <p style="font-size: 15px;margin-bottom: 0rem;"><?php echo e(__('lang.default_number_message')); ?></p>
                        <div class="form-group col-md-12">
                            <button type="button" class="submit-btn submit-btn-signin text-uppercase" id="login_button" onclick="user_login()"><?php echo e(__('lang.verify_button')); ?> <img src="<?php echo e(asset('site-assets/images/arrowright.png')); ?>" /></button>
                        </div>
                        <!-- <div class="createacc"><a href="javascript:;"><?php echo e(__('lang.create_your_account')); ?>&nbsp;</a></div> -->
                    </form>
                </div>
                
            </div>
        </div>
    </div>
</section>
<!-- Verify Modal -->
<div class="modal" id="verifymodal">
    <div class="modal-dialog modal-dialog-centered modal-size-small">
        <div class="modal-content">
            <!-- Modal body -->
            <div class="modal-body">
                <?php echo Form::model(null, ['method' => 'POST', 'url' => ['verify-otp']]); ?>

                    <?php echo csrf_field(); ?>
                    <input type="hidden" name="phone_number" id="enter_phone1">
                    <div class="verificationcode-popup">
                        <h1><?php echo e(__('lang.enter_verify_code')); ?></h1>
                        <h6><?php echo e(__('lang.verification_otp_send_message')); ?></h6>
                        <h3 id="enter_phone"></h3>
                        <div class="otpinput digit-group" data-group-name="digits">
                            <input type="password" id="otp_1" name="otp_1" data-next="otp_2" />
                            <input type="password" id="otp_2" name="otp_2" data-next="otp_3" data-previous="otp_1" />
                            <input type="password" id="otp_3" name="otp_3" data-next="otp_4" data-previous="otp_2" />
                            <input type="password" id="otp_4" name="otp_4" data-next="otp_5" data-previous="otp_3" />
                        </div>
                        <p style="font-size: 15px;"><?php echo e(__('lang.default_otp_message')); ?></p>
                        <button class="submit-btn submit-btn-verifyotp mt-0 text-uppercase" type="submit" id="submit_verify"><?php echo e(__('lang.verify_button')); ?> <i class="fa fa-long-arrow-right" aria-hidden="true"></i></button>
                        <div class="resendlink"><a href="javascript:;" onclick="user_login()"><?php echo e(__('lang.resend_again')); ?></a></div>
                    </div>
                <?php echo Form::close(); ?>

            </div>
        </div>
    </div>
</div>
<footer class="footer">
    <?php echo $__env->make('partials.site.footer', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
</footer>
<script type="text/javascript">
    $('.digit-group').find('input').each(function() {
        $(this).attr('maxlength', 1);
        $(this).on('keyup', function(e) {
            var parent = $($(this).parent());
            if(e.keyCode === 8 || e.keyCode === 37) {
                var prev = parent.find('input#' + $(this).data('previous'));            
                if(prev.length) {
                    $(prev).select();
                }
            } else if((e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 65 && e.keyCode <= 90) || (e.keyCode >= 96 && e.keyCode <= 105) || e.keyCode === 39) {
                var next = parent.find('input#' + $(this).data('next')); 
                if(next.length) {
                    $(next).select();
                } else {
                    $("#submit_verify").click();
                }
            }
        });
    });

    function user_login() {
        var data = {
            phone : $("#phone").val()
        }
        if (data.phone == '') {
        }else{
            $("#login_button").html("Please wait..");
            $("#login_button").attr('disabled',true);
            $.ajax({
                type: 'POST',
                url: base_url + "/api/user/login",
                headers: {},
                contentType: 'application/json',
                dataType: 'json',
                data: JSON.stringify(data),
                success: function (response) {
                    $("#enter_phone").html($("#phone").val());
                    $("#enter_phone1").val($("#phone").val());
                    $('#verifymodal').modal('show');
                }
            });
        }
    }
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.site-app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/waterfl/public_html/resources/views/signin.blade.php ENDPATH**/ ?>