
<?php $__env->startSection('title'); ?>
    <title><?php echo e(__('user.Login')); ?></title>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('user-content'); ?>

<!--===BREADCRUMB PART START====-->
  <section class="wsus__breadcrumb" style="background: url(<?php echo e(url($banner_image)); ?>);">
    <div class="wsus_bread_overlay">
        <div class="container">
            <div class="row">
                <div class="col-12 text-center">
                    <h4><?php echo e(__('user.Login')); ?></h4>
                    <nav style="--bs-breadcrumb-divider: '-';" aria-label="breadcrumb">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item"><a href="<?php echo e(route('home')); ?>"><?php echo e(__('user.Home')); ?></a></li>
                            <li class="breadcrumb-item active" aria-current="page"><?php echo e(__('user.Login')); ?></li>
                        </ol>
                    </nav>
                </div>
            </div>
        </div>
    </div>
</section>
<!--===BREADCRUMB PART END====-->


<!--=======LOGON PART START=========-->
<section class="wsus__logon mt_45 mb_45">
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-xl-5 col-md-6">
                <div class="wsus__login_form">
                    <h3><?php echo e(__('user.If You Have An Account? Login Here')); ?></h3>
                    <form id="loginFormSubmit">
                        <?php echo csrf_field(); ?>
                        <div class="form-group">
                            <div class="input-group input-group-lg">
                                <div class="input-group-prepend">
                                    <span class="input-group-text">
                                        <i class="fad fa-user-circle"></i>
                                    </span>
                                </div>
                                <input id="loginEmail" class="form-control form-control-lg" type="email" name="email" placeholder="<?php echo e(__('user.Email')); ?>" value="<?php echo e(env('PROJECT_MODE')==0 ? 'agent@gmail.com' : ''); ?>">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="input-group input-group-lg">
                                <div class="input-group-prepend">
                                    <span class="input-group-text">
                                        <i class="fas fa-key"></i>
                                    </span>
                                </div>
                                <input id="loginPassword" class="form-control form-control-lg" type="password" name="password" placeholder="<?php echo e(__('user.Password')); ?>" value="<?php echo e(env('PROJECT_MODE')==0 ? 1234 : ''); ?>">
                            </div>
                        </div>

                        <?php if($recaptcha_setting->status==1): ?>
                            <div class="form-group mt-2">
                                <div class="input-group input-group-lg">
                                    <div class="g-recaptcha" data-sitekey="<?php echo e($recaptcha_setting->site_key); ?>"></div>
                                </div>
                            </div>
                            <?php endif; ?>

                        <div class="wsus__check_area">
                            <div class="form-check">
                                <input name="remember" class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
                                <label class="form-check-label" for="flexCheckDefault">
                                    <?php echo e(__('user.Remember Me')); ?>

                                </label>
                            </div>
                            <a href="<?php echo e(route('forget.password')); ?>"><?php echo e(__('user.Forget Your Password ?')); ?></a>
                        </div>
                        <div class="wsus__reg_forget">
                            <button class="common_btn" type="submit" id="userLoginBtn"><?php echo e(__('user.Login')); ?></button>
                        </div>
                    </form>

                    <p class="wsus__or">or</p>

                    <?php if($socialLogin->is_gmail == 1 || $socialLogin->is_facebook == 1): ?>
                    <ul class="wsus__login_link">
                        <?php if($socialLogin->is_gmail == 1): ?>
                        <li><a class="google" href="<?php echo e(route('login-google')); ?>"><i class="fab fa-google"></i> google</a></li>
                        <?php endif; ?>
                        <?php if($socialLogin->is_facebook == 1): ?>
                        <li><a class="facebook" href="<?php echo e(route('login-facebook')); ?>"><i class="fab fa-facebook-f"></i> facebook</a></li>
                        <?php endif; ?>
                    </ul>
                    <?php endif; ?>

                </div>
            </div>
            <div class="col-xl-5 col-md-6 offset-xl-1 ml_to_mr">
                <div class="wsus__login_form ">
                    <h3><?php echo e(__('user.Dont Have An Account? Please Register')); ?></h3>
                    <form id="registerFormSubmit">
                        <?php echo csrf_field(); ?>
                        <div class="form-group">
                            <div class="input-group input-group-lg">
                                <div class="input-group-prepend">
                                    <span class="input-group-text">
                                        <i class="fad fa-user-circle"></i>
                                    </span>
                                </div>
                                <input class="form-control form-control-lg" type="text" name="name" id="regName" placeholder="<?php echo e(__('user.Name')); ?>">
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="input-group input-group-lg">
                                <div class="input-group-prepend">
                                    <span class="input-group-text">
                                        <i class="fas fa-envelope"></i>
                                    </span>
                                </div>
                                <input class="form-control form-control-lg" type="email" id="regEmail" name="email" placeholder="<?php echo e(__('user.Email')); ?>">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="input-group input-group-lg">
                                <div class="input-group-prepend">
                                    <span class="input-group-text">
                                        <i class="fas fa-key"></i>
                                    </span>
                                </div>
                                <input class="form-control form-control-lg" type="password" id="regPassword" name="password" placeholder="<?php echo e(__('user.Password')); ?>">
                            </div>
                        </div>

                        <?php if($recaptcha_setting->status==1): ?>
                        <div class="form-group mt-2">
                            <div class="input-group input-group-lg">
                                <div class="g-recaptcha" data-sitekey="<?php echo e($recaptcha_setting->site_key); ?>"></div>
                            </div>
                        </div>
                        <?php endif; ?>

                        <button id="registerBtn" class="common_btn" type="submit"><i id="reg-spinner" class="loading-icon fa fa-spin fa-spinner d-none"></i> <?php echo e(__('user.Register')); ?></button>
                    </form>
                </div>
            </div>
        </div>
    </div>
</section>
<!--======= LOGON PART END========-->



<?php
    $search_url = request()->fullUrl();
?>


<script>
    (function($) {
    "use strict";
    $(document).ready(function () {
        $("#loginFormSubmit").on('submit',function(e) {
            e.preventDefault();
            $.ajax({
                url: "<?php echo e(route('login')); ?>",
                type:"post",
                data:$('#loginFormSubmit').serialize(),
                success:function(response){
                    if(response.success){
                        window.location.href = "<?php echo e(route('user.dashboard')); ?>";
                        toastr.success(response.success)

                    }
                    if(response.error){
                        toastr.error(response.error)

                        var query_url='<?php echo $search_url; ?>';
                        window.location.href = query_url;

                    }
                },
                error:function(response){
                    if(response.responseJSON.errors.email)toastr.error(response.responseJSON.errors.email[0])
                    if(response.responseJSON.errors.password){
                        toastr.error(response.responseJSON.errors.password[0])
                    }

                    if(!response.responseJSON.errors.email && !response.responseJSON.errors.password){

                        toastr.error("<?php echo e(__('user.Please Complete the recaptcha to submit the form')); ?>")
                    }


                }

            });


        })

        $("#registerFormSubmit").on('submit',function(e) {
            e.preventDefault();
            console.log('hiu');

                // project demo mode check
                var isDemo="<?php echo e(env('PROJECT_MODE')); ?>"
                var demoNotify="<?php echo e(env('NOTIFY_TEXT')); ?>"
                if(isDemo==0){
                    toastr.error(demoNotify);
                    return;
                }
                // end
            $("#reg-spinner").removeClass('d-none')
            $("#registerBtn").addClass('custom-opacity')
            $("#registerBtn").attr('disabled',true);
            $.ajax({
                url: "<?php echo e(route('register')); ?>",
                type:"post",
                data:$('#registerFormSubmit').serialize(),
                success:function(response){
                    if(response.success){
                        $("#registerFormSubmit").trigger("reset");
                        $("#reg-spinner").addClass('d-none')
                        $("#registerBtn").removeClass('custom-opacity')
                        $("#registerBtn").attr('disabled',false);
                        toastr.success(response.success)
                    }
                    if(response.error){
                        toastr.error(response.error)

                        var query_url='<?php echo $search_url; ?>';
                        window.location.href = query_url;
                    }
                },
                error:function(response){
                    if(response.responseJSON.errors.name){
                        $("#reg-spinner").addClass('d-none')
                        $("#registerBtn").removeClass('custom-opacity')
                        $("#registerBtn").attr('disabled',false);
                        $("#registerBtn").addClass('site-btn-effect')
                        toastr.error(response.responseJSON.errors.name[0])
                    }

                    if(response.responseJSON.errors.email){
                        $("#reg-spinner").addClass('d-none')
                        $("#registerBtn").removeClass('custom-opacity')
                        $("#registerBtn").attr('disabled',false);
                        $("#registerBtn").addClass('site-btn-effect')
                        toastr.error(response.responseJSON.errors.email[0])
                    }

                    if(response.responseJSON.errors.password){
                        $("#reg-spinner").addClass('d-none')
                        $("#registerBtn").removeClass('custom-opacity')
                        $("#registerBtn").attr('disabled',false);
                        $("#registerBtn").addClass('site-btn-effect')
                        toastr.error(response.responseJSON.errors.password[0])
                    }

                    if(!response.responseJSON.errors.name && !response.responseJSON.errors.email && !response.responseJSON.errors.password){
                        $("#reg-spinner").addClass('d-none')
                        $("#registerBtn").removeClass('custom-opacity')
                        $("#registerBtn").attr('disabled',false);
                        $("#registerBtn").addClass('site-btn-effect')
                        toastr.error("<?php echo e(__('user.Please Complete the recaptcha to submit the form')); ?>")
                    }


                }

            });


        })

    });

    })(jQuery);
</script>

<?php $__env->stopSection(); ?>



<?php echo $__env->make('layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/fwvrhhfw/topriserealtors.com/resources/views/auth/login.blade.php ENDPATH**/ ?>