<style type="text/css">
    .modalCloseBtn {
        position: absolute;
        left: 91%;
    }

    .modatTitle {
        display: block;
        margin-left: auto;
        margin-right: auto;
        font-size: 16px;
        font-family: 'Open Sans', sans-serif !important;
        font-weight: 800;
        color: #7D1456;
    }

    input::-webkit-outer-spin-button,
    input::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    /* Firefox */
    input[type=number] {
        -moz-appearance: textfield;
    }

    .h5-title {
        font-size: 16px;
        font-family: 'Open Sans', sans-serif !important;
        font-weight: 800;
        color: #B02135;
    }

    .modal-header {
        border-top: 6px solid #910301;
    }

    #sinupformid .form-control {
        margin: auto !important;
    }

    .form-control {
        display: block;
        width: 100%;
        padding: .375rem .75rem;
        font-size: 1rem;
        font-weight: 400;
        line-height: 1.5;
        color: #212529;
        background-color: #fff;
        background-clip: padding-box;
        border: 1px solid #363a3d;
        //-webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        border-radius: .375rem;
        transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
        height: 6vh;
    }

    input[type="text"]::placeholder {
        //color: #008080 !important;

    }

    .nav-tabs .nav-item+.nav-item {
        margin-left: 0px;
    }
</style>

<div class="modal fade modal-outline show" id="signupModal" tabindex="-1" aria-labelledby="exampleModalLabel"
    aria-hidden="true">
    <div class="modal-dialog ">
        <div class="modal-content" style="background-image:url(<?php echo e(asset('assets/img/login-backgound.png')); ?>);">
            <div class="modal-header">
                <h5 class="modal-title text-center bottomborder modatTitle" style="margin-right: 5;">SIGN UP</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body p-0">
                <form action="#" method="post" id="sinupformid">
                    <?php echo csrf_field(); ?>
                    <div class="modal-body p-0">
                        <div class="container">
                            <img src="<?php echo e($header_data[0]['leftImage'] ? ApiBaseUrl()['url'] . '/' . @$header_data[0]['leftImage'] : asset('assets/img/logo-1.png')); ?>"
                                class="img-fluid my-3" height="120px" width="150px"
                                style="display: block; margin-left: auto; margin-right: auto;">

                            <div class="row" style="text-align:center;">
                                <div class="col-md-12">
                                    <div class="hs-toast-wrapper mb-3" id="signup-error-flashmsg"></div>
                                    <div class="hs-toast-wrapper mb-3" id="signup-success-flashmsg"></div>
                                    <!-- <span id="signup-error-flashmsg" class="text-center" style="color: red;"></span> -->
                                    <!-- <span id="signup-success-flashmsg" class="text-center" style="color: green;"></span> -->
                                </div>
                            </div>
                            <div class="row d-flex justify-content-center align-items-center">
                                <div class="col-xl-12">
                                    <div class="row g-0">
                                        <div class="col-xl-12">
                                            <div class="row">
                                                <div class="col-md-6 mb-4">
                                                    <div class="form-outline">
                                                        <label class="form-label" for="fname"
                                                            style="color:black !important">First name</label>
                                                        <input type="text" id="fname" name="fname"
                                                            class="form-control" required autocomplete="off"
                                                            placeholder="Enter first name" />
                                                    </div>
                                                </div>
                                                <div class="col-md-6 mb-4">
                                                    <div class="form-outline">
                                                        <label class="form-label" style="color:black!important"
                                                            for="lname">Last name</label>
                                                        <input type="text" id="lname" name="lname"
                                                            class="form-control" autocomplete="off"
                                                            placeholder="Enter last name" />
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="row">
                                                <div class="col-md-12 mb-4">
                                                    <div class="form-outline">
                                                        <label class="form-label" for="signupEmail"
                                                            style="color:black!important">Email</label>
                                                        <input type="email" id="signupEmail" name="email"
                                                            class="form-control" required autocomplete="off"
                                                            placeholder="Enter your email" />
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="row">
                                                <style>
                                                    input[type='tel']::value {
                                                        margin-right: 10px;
                                                    }
                                                </style>
                                                <div class="col-md-12 mb-4">
                                                    <div class="form-outline">
                                                        <label class="form-label" for="signupEmail"
                                                            style="color:black!important;">Phone
                                                            Number</label>
                                                        <input type="tel" placeholder="Ex. +1 123-456-7890"
                                                            minlength="10" maxlength="15" id="signupPhoneNumber"
                                                            name="phone" class="phone-with-country-code form-control"
                                                            onkeypress="return (event.charCode !=8 && event.charCode ==0 || (event.charCode >= 48 && event.charCode <= 57 || event.charCode==43 || event.charCode==13 ))"
                                                            oninput="nonEditCuntryCode1(this);" value="+1"
                                                            minlength="10" autocomplete="none" style="" required>
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="row">
                                                <div class="col-md-12 mb-4">
                                                    <div class="form-outline text-center">
                                                        <div class="col-md-12">
                                                            <button type="submit" class="btn btn-warning ms-2"
                                                                id="signupBtn">SIGN
                                                                UP</button>
                                                            <button type="button"
                                                                class="signupBtnClose btnClose btn btn-danger ms-2"
                                                                data-dismiss="modal" hidden>CLOSE</button>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>


                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="d-flex justify-content-center modal-footer">
                        <div class="row mx-auto d-block my-4">

                            <div class="col-md-12 my-4s">
                                <a href="javascript:void(0)" id="loginLink">Already
                                    registered? Sign In</a>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>


<div class="modal fade" id="loginModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog ">
        <div class="modal-content" style="background-image:url(<?php echo e(asset('assets/img/login-backgound.png')); ?>);">
            <div class="modal-header">
                
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body p-0">
                <form action="#" method="post" id="phonemyForm" autocomplete="off">
                    <div class="modal-body p-0">
                        <img src="<?php echo e(ApiBaseUrl()['url'] . $header_data[0]['leftImage']); ?>" class="img-fluid mb-4"
                            height="100px" width="100px"
                            style="display: block;margin-left: auto;margin-right: auto;">
                        <style type="text/css">
                            .nav-fill .nav-item .nav-link,
                            .nav-justified .nav-item .nav-link {
                                width: 100%;
                                background: #cdcdcd9c !important;
                                color: #000000;
                            }

                            .nav-tabs .nav-item.show .nav-link,
                            .nav-tabs .nav-link.active {
                                color: #ffffff !important;
                                background: #008080 !important;
                                border-color: var(--bs-nav-tabs-link-active-border-color)
                            }
                        </style>
                        <div class="row">
                            <h5 class="text-center bottomborder modatTitle">SIGN IN</h5>
                            <div class="col-md-12 mt-4">
                                <div class="container mt-3 p-0">
                                    <div class="row g-0">
                                        <div class="col-xl-12">
                                            <div class="row" style="text-align:center;">
                                                <div class="col-md-12">
                                                    <div class="hs-toast-wrapper mb-3" id="login-error-flashmsg">
                                                    </div>
                                                    <div class="hs-toast-wrapper mb-3" id="login-success-flashmsg">
                                                    </div>
                                                    <span id="login-error-flashmsg" class="text-center"
                                                        style="color: red;"></span>
                                                    <span id="login-success-flashmsg" class="text-center"
                                                        style="color: green;"></span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row d-flex justify-content-center align-items-center">
                                        <div class="col-xl-12">
                                            <div class="row">
                                                <div class="col-xl-12">
                                                    <span class="email_section">
                                                        <div class="row">
                                                            <ul id="tabs" class="nav nav-tabs nav-fill"
                                                                style="border: 0px; box-shadow: 1px -4px 8px grey; margin: 0px; padding: 0px;">
                                                                <li class="nav-item d-none">
                                                                    <a href="#AdministratorTab" id="AdministratorTab"
                                                                        tab-name="Management" data-toggle="tab"
                                                                        class="nav-link rounded-0 border-0 m-0">Management</a>
                                                                </li>
                                                                <li class="nav-item">
                                                                    <a href="#devoteeTab" id="devoteeTab"
                                                                        tab-name="Devotee" data-toggle="tab"
                                                                        class="nav-link rounded-0 border-0 m-0 active">Devotee</a>
                                                                </li>
                                                            </ul>
                                                            <div class="col-md-12 p-0 mt-4">
                                                                <input type="email" id="loginEmail"
                                                                    placeholder="Enter your email Id." name="email"
                                                                    class="form-control"
                                                                    data-onclick="<?php echo e('send-email-otp'); ?>"
                                                                    style="margin: 0px;" oninput="loginBy('email');"
                                                                    autocomplete="none" />
                                                                <span class="otpsendmsg"
                                                                    style="color: green; font-size: 11px;margin-left: 12px;"></span>
                                                            </div>
                                                        </div>
                                                    </span>
                                                    <span class="mobile_section">
                                                        <div class="text-center mb-3 mt-3">--OR--</div>
                                                        <div class="row">
                                                            <div class="col-md-12 mx-0 px-0">
                                                                <input type="tel"
                                                                    placeholder="Ex. +1 (702) 123-4567"
                                                                    id="loginPhoneNumber" name="phone"
                                                                    class="phone-with-country-code form-control"
                                                                    data-onclick="<?php echo e('send-email-otp'); ?>"
                                                                    minlength="10" maxlength="15"
                                                                    onkeypress="return (event.charCode !=8 && event.charCode ==0 || (event.charCode >= 48 && event.charCode <= 57 || event.charCode==43  || event.charCode==13 ))"
                                                                    oninput="nonEditCuntryCode(this);loginBy('mobile')"
                                                                    value="+1" minlength="10"
                                                                    autocomplete="none">
                                                                <span class="otpsendmsg_number"
                                                                    style="color: green; font-size: 18px;margin-left: 12px;"></span>
                                                            </div>
                                                            <div class="col-md-12 my-4">
                                                                <center>
                                                                    <button id="emailotpntn" class="btn btn-success"
                                                                        onclick="sendEmailOtp('<?php echo e(route('send-email-otp')); ?>')">Login</button>
                                                                </center>
                                                            </div>
                                                        </div>
                                                    </span>
                                                    <div class="row vOtpBox mt-3" id="otptoggle"
                                                        style="display:none;">
                                                        <div class="col-md-8 mx-0 px-0">
                                                            <input type="number" name="emailotp" id="emailotp"
                                                                placeholder="Please enter OTP to continue."
                                                                class="form-control"
                                                                onkeypress="if(event.charCode==13 ){ verifyEmailOtp('<?php echo e(url('verifyEmailOtp')); ?>')  }"
                                                                required />
                                                            <div id="timerMessage" class="mt-4"
                                                                style="font-size: 13px;">You
                                                                can resend OTP after <span
                                                                    id="timeCounter2">2:00</span>
                                                                Seconds</div>
                                                            <a id="resendButton" style="color:red; padding: 10px;"
                                                                onclick="resendOtp()" href="javascript:void(0)"
                                                                disabled>Resend OTP</a>
                                                            <span id="timerCounter" style="font-size: 13px;"></span>
                                                        </div>
                                                        <div class="col-md-4 mb-4 mt-2">
                                                            <button id="emailotpverifybtn"
                                                                class="btn btn-success verifyBtn"
                                                                onclick="verifyEmailOtp('<?php echo e(route('verifyEmailOtp')); ?>')">VERIFY</button>
                                                        </div>
                                                        <div class="col-md-4 mb-4">
                                                        </div>
                                                    </div>
                                                    <div class="row mobile-section otpmobilebox vOtpBox"
                                                        id="mobiletoggle" style="display:none;">
                                                        <div class="col-md-8 mb-4 mx-0 px-0">
                                                            <input type="number" id="mobileotp" name="mobileotp"
                                                                placeholder="Please enter OTP to continue."
                                                                class="form-control" />
                                                            <!-- <span class="otpsendmsg_number_error" style="color: red; font-size: 18px;margin-left: 12px;"></span> -->
                                                            <div class="hs-toast-wrapper mb-3"
                                                                class="otpsendmsg_number_errorg"></div>

                                                        </div>
                                                        <div class="col-md-4 mb-4">
                                                            <button id="mobileotpverifybtn"
                                                                class="btn btn-success verifyBtn"
                                                                onclick="submitPhoneNumberAuthCode()"
                                                                onkeydown="if(event.keyCode === 13) document.getElementById('mobileotpverifybtn').click()">VERIFY</button>
                                                        </div>
                                                    </div>
                                                    <div class="row">
                                                        <div class="col-md-12" id="recaptcha-container"></div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="d-flex justify-content-center text-center modal-footer">
                        <div class="row">
                            <div class="col-md-12">
                                <button type="submit" class="btn btn-warning d-none" id="loginBtn">LOGIN</button>
                                <button type="button" class="loginBtnClose btnClose btn btn-danger ms-2"
                                    data-dismiss="modal" hidden>CLOSE</button>
                            </div>
                            <div class="col-md-12 my-4">
                                <a href="javascript:void(0)" id="signupLink" type='button'>New
                                    User? Sign
                                    Up</a>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<input type="hidden" name="serviceId" id="serviceId">
<input type="hidden" name="fullPackage" id="fullPackage">
<input type="hidden" name="fromPage" id="fromPage">
<!-- country_code links -->

<script type="text/javascript" src="<?php echo e(asset('assets/js/time-picker.js')); ?>"></script>


<!-- country_code links -->
<script>
    $(document).ready(function() {
        $('#tabs a[data-toggle="tab"]').on('click', function() {
            $('#tabs a[data-toggle="tab"]').removeClass('active');
            $(this).addClass('active');
        });
    });
    var loader = new ldLoader({
        root: ".ldld.full"
    });
    if (window.performance && window.performance.navigation
        .type === window.performance.navigation
        .TYPE_BACK_FORWARD) {
        loader.on();
    }

    document.addEventListener("click", function(event) {
        if (event.target.matches(".navlink, .loader")) {
            loader.on();
        }
    });

    window.onload = function() {
        loader.off();
    };


    function startTimer() {
        resendButton.disabled = true;
        let timeLeft = 120;
        let minutes, seconds;
        timerMessage.style.display = "block";
        resendButton.style.display = "none";

        const countdown = setInterval(() => {
            minutes = Math.floor(timeLeft / 60);
            seconds = timeLeft % 60;
            timeCounter2.innerText =
                `${minutes}:${seconds.toString().padStart(2, "0")}`;
            timeLeft--;
            if (timeLeft === 0) {
                clearInterval(countdown);
                timerMessage.style.display = "none";
                resendButton.style.display = "block";
                resendButton.disabled = false;
            }
        }, 1000);
    }
</script>
<script>
    function openLoginModal(page = '') {
        var fromPage = page;
        //alert(fromPage);
        $("#fromPage").val(page);
        $("form").get(0).reset();
        var emailotpntn = document.getElementById('emailotpntn');
        // alert(emailotpntn);
        emailotpntn.disabled = false;
        emailotpntn.innerText = 'LOGIN';
        //alert(emailotpntn.innerText);
        $('.signupBtnClose').click();
        $("#signupModal").modal("hide");
        $("#loginModal").modal("show");


        $(".vOtpBox").hide();
        $("#emailotpntn").show();
        $(".mobile_section").show();
        $(".email_section").show();
    }
    $(document).ready(function() {
        $(document).on('click', '#signupLink', function() {
            $('#loginModal').modal('hide');
            $('#signupModal').modal('show');
            console.log("Signup modal displayed");
        });
        $(document).on('click', '#loginLink', function() {
            $('#loginModal').modal('show');
            $('#signupModal').modal('hide');
            console.log("Signup modal displayed");
        });
    });
    // Sign up User
    $(document).on('submit', '#sinupformid', function(e) {
        e.preventDefault();
        //alert("shfgj");
        //loader.on();
        var btn = document.getElementById('signupBtn');
        var phone = $('#signupPhoneNumber').val();
        if (phone.length < 6) {
            //alert("max 6 digit");
            showToast({
                eleWrapper: '#signup-error-flashmsg',
                msg: 'Please enter a valid phone number.',
                theme: 'warning',
                closeButton: false,
                autoClose: true,
                afterShow: function() {
                    console.log(
                        'After show function'
                    );
                },
                afterClose: function() {
                    console.log(
                        'After close function'
                    );
                }
            });

            $('#signupPhoneNumber').focus();
            loader.off();
        }
        btn.disabled = true;
        btn.innerText = 'PLEASE WAIT...';
        var fname = $('#fname').val();
        var lname = $('#lname').val();
        var email = $('#signupEmail').val();
        var routeurl = "<?php echo e(url('signup')); ?>";
        var newphone = 0;
        var cuntryCode = $(
                "#signupModal .iti__selected-flag")
            .attr('title');
        cuntryCode = (cuntryCode.split(':')[1]).trim();
        var value = phone.replace(cuntryCode, '');
        newphone = value;
        //alert(routeurl);
        $.ajax({

            url: routeurl,
            method: "POST",
            data: {
                'fname': fname,
                'lname': lname,
                'email': email,
                'phone': newphone,
                'countryCode': cuntryCode
            },
            success: function(data) {
                //loader.off();
                console.log(data);
                var loginbtn = document
                    .getElementById(
                        'loginBtn');
                var emailotpntn = document
                    .getElementById(
                        'emailotpntn');
                const obj = JSON.parse(
                    data);
                // console.log(obj);
                if (obj.message == '') {
                    loginbtn.disabled =
                        false;
                    loginbtn.innerText =
                        'LOGIN';
                    emailotpntn.disabled =
                        false;
                    emailotpntn.innerText =
                        'LOGIN';
                    showToast({
                        eleWrapper: '#login-success-flashmsg',
                        msg: data,
                        theme: 'success',
                        closeButton: false,
                        autoClose: true,
                        afterShow: function() {
                            console
                                .log(
                                    'After show function'
                                );
                        },
                        afterClose: function() {
                            console
                                .log(
                                    'After close function'
                                );
                        }
                    });
                    if ((location.href
                            .match(
                                /([^\/]*)\/*$/
                            )[1])
                        .indexOf(
                            'Payonline') !=
                        -1) {
                        openBoxlog('login');
                    } else {
                        $('.signupBtnClose')
                            .click();
                        $("#signupModal")
                            .modal("hide");
                        $("#loginModal")
                            .modal("show");
                    }
                } else {
                    if (obj.message ==
                        'success') {
                        loginbtn.disabled =
                            false;
                        loginbtn.innerText =
                            'LOGIN';

                        emailotpntn
                            .disabled =
                            false;
                        emailotpntn
                            .innerText =
                            'LOGIN';
                        showToast({
                            eleWrapper: '#login-success-flashmsg',
                            msg: obj
                                .message,
                            theme: 'success',
                            closeButton: false,
                            autoClose: true,
                            afterShow: function() {
                                console
                                    .log(
                                        'After show function'
                                    );
                            },
                            afterClose: function() {
                                console
                                    .log(
                                        'After close function'
                                    );
                            }
                        });
                        if ((location.href
                                .match(
                                    /([^\/]*)\/*$/
                                )[1])
                            .indexOf(
                                'Payonline'
                            ) != -1) {
                            openBoxlog(
                                'login');
                        } else {
                            $('.signupBtnClose')
                                .click();
                            $("#signupModal")
                                .modal(
                                    "hide");
                            $("#loginModal")
                                .modal(
                                    "show");
                        }
                        btn.disabled =
                            false;
                        btn.innerText =
                            'SIGN UP';
                    } else {
                        loginbtn.disabled =
                            false;
                        loginbtn.innerText =
                            'LOGIN';
                        emailotpntn
                            .disabled =
                            false;
                        emailotpntn
                            .innerText =
                            'LOGIN';
                        showToast({
                            eleWrapper: '#signup-error-flashmsg',
                            msg: obj
                                .message,
                            theme: 'error',
                            closeButton: false,
                            autoClose: true,
                            afterShow: function() {
                                console
                                    .log(
                                        'After show function'
                                    );
                            },
                            afterClose: function() {
                                console
                                    .log(
                                        'After close function'
                                    );
                            }
                        });

                        btn.disabled =
                            false;
                        btn.innerText =
                            'SIGN UP';
                    }
                }
            }
        });

        return false;
    });
    // End Sign up User
    // mobile login user
    function LoginUser(url) {
        //alert(url);
        //   loader.on();
        var btn = document.getElementById('emailotpntn');
        btn.disabled = true;
        btn.innerText = 'PLEASE WAIT...';

        // event.preventDefault();
        var url = url;
        var email = $('#loginEmail').val();
        var phone = $('#loginPhoneNumber').val();

        var newphone = 0;
        var cuntryCode = $("#loginModal .iti__selected-flag").attr('title');
        cuntryCode = (cuntryCode.split(':')[1]).trim();
        var value = phone.replace(cuntryCode, '');
        newphone = value;
        const activeLoginTab = $('.nav-link.active');
        const LoginTabName = activeLoginTab.attr('tab-name');
        //alert(LoginTabName);
        $.ajax({
            url: url,
            type: "POST",
            dataType: "json",
            data: {
                'email': email,
                'phone': newphone,
                'LoginTabName': LoginTabName
            },
            success: function(data) {
                //loader.off();
                console.log(data);

                if (data.statusCode == 1) {
                    btn.disabled = true;
                    btn.innerText = 'SENT';

                    if (phone != "") {
                        submitPhoneNumberAuth();
                        $("#emailotpntn").hide();
                        $(".email_section").hide();
                        $("#loginPhoneNumber").attr('disabled', 'disabled');
                    } else {

                        $('#otptoggle').css("display", "none");

                        var btn2 = document.getElementById('emailotpverifybtn');
                        btn2.disabled = false;
                        btn.disabled = true;

                        // alert('Login Successful.');
                        $('.loginBtnClose').click();
                        $("#loginModal").modal("hide");
                        $("#paymentModal").modal("show");

                    }

                } else {
                    showToast({
                        eleWrapper: '#signup-error-flashmsg',
                        msg: 'This phone no. is not registerd please signup.',
                        theme: 'error',
                        closeButton: false,
                        autoClose: true,
                        afterShow: function() {
                            console.log('After show function');
                        },
                        afterClose: function() {
                            console.log('After close function');
                        }
                    });

                    if ((location.href.match(/([^\/]*)\/*$/)[1]).indexOf('Payonline') != -1) {
                        openBoxlog('signup');
                        btn.disabled = false;
                        btn.innerText = 'LOGIN';
                    } else {


                        if (LoginTabName == 'Management') {

                            btn.disabled = false;
                            btn.innerText = 'LOGIN';
                            showToast({
                                eleWrapper: '#login-error-flashmsg',
                                msg: 'This phone no. is not registerd please signup.',
                                theme: 'error',
                                closeButton: false,
                                autoClose: true,
                                afterShow: function() {
                                    console.log('After show function');
                                },
                                afterClose: function() {
                                    console.log('After close function');
                                }
                            });

                        } else {

                            $("#signupEmail").val(email);
                            $("#signupPhoneNumber").val(phone);
                            $("#loginModal").modal('hide');
                            $("#signupModal").modal('show');

                        }
                    }
                }
            }
        });

    }
    //  Send Email OTP
    function sendEmailOtp(url) {
        // alert(url);
        // loader.on();
        //test
        var email = $('#loginEmail').val();
        //console.log(email);
        var phoneval = $('#loginPhoneNumber').val();
        //console.log(phoneval);
        var phoneLength = $('#loginPhoneNumber').val().length;
        // console.log(phoneLength);
        // alert(email);
        if (email == "" && phoneLength < 12) {
            showToast({
                eleWrapper: '#login-error-flashmsg',
                msg: 'Please enter valid email or valid mobile number.',
                theme: 'warning',
                closeButton: false,
                autoClose: true,
                afterShow: function() {
                    console.log(
                        'After show function');
                },
                afterClose: function() {
                    console.log(
                        'After close function');
                }
            });
            //loader.off();

        } else {
            $("#login-error-flashmsg").html("");

            if (email == "") {
                // event.preventDefault();
                var routeUrl = "<?php echo e(url('signin')); ?>";
                // alert(routeUrl);
                LoginUser(routeUrl);
                //loader.off();
            } else {

                var mailformat =
                    /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;

                if (email.match(mailformat)) {
                    var btn = document.getElementById(
                        'emailotpntn');
                    btn.disabled = true;
                    btn.innerText = 'SENDING';

                    var Url = url;
                    //alert(Url);
                    var email = $('#loginEmail').val();
                    const activeLoginTab = $(
                        '.nav-link.active');
                    const LoginTabName = activeLoginTab.attr(
                        'tab-name');
                    // alert(LoginTabName);

                    $.ajax({
                        url: Url,
                        type: "POST",
                        dataType: "json",
                        data: {
                            'email': email,
                            'LoginTabName': LoginTabName
                        },
                        success: function(data) {
                            console.log(data);
                            // loader.off();
                            if (data[
                                    'statusCode'] ==
                                '1'
                            ) {

                                $("#emailotpntn")
                                    .hide();
                                $(".mobile_section")
                                    .hide();
                                btn.disabled = true;
                                btn.innerText =
                                    'SENT';
                                $('#otptoggle').css(
                                    'display',
                                    'inline-flex'
                                );
                                var btn2 = document
                                    .getElementById(
                                        'emailotpverifybtn'
                                    );
                                btn2.disabled =
                                    false;
                                btn.disabled = true;
                                $("#AdministratorTab")
                                    .addClass(
                                        'disabled');
                                $("#devoteeTab")
                                    .addClass(
                                        'disabled');
                                startTimer();
                                $("#emailotp")
                                    .focus();
                                showToast({
                                    eleWrapper: '#login-success-flashmsg',
                                    msg: 'OTP send on this email id!',
                                    theme: 'success',
                                    closeButton: false,
                                    autoClose: true,
                                    afterShow: function() {
                                        console
                                            .log(
                                                'After show function'
                                            );
                                    },
                                    afterClose: function() {
                                        console
                                            .log(
                                                'After close function'
                                            );
                                    }
                                });
                                $(".mobile-section")
                                    .hide();
                            } else if (data[
                                    'statusCode'] ==
                                '2') {
                                btn.disabled =
                                    false;
                                btn.innerText =
                                    'LOGIN';
                                showToast({
                                    eleWrapper: '#login-success-flashmsg',
                                    msg: 'Technical Error! Please Login With Phone Number or Contact Admin.',
                                    theme: 'error',
                                    closeButton: false,
                                    autoClose: true,
                                    afterShow: function() {
                                        console
                                            .log(
                                                'After show function'
                                            );
                                    },
                                    afterClose: function() {
                                        console
                                            .log(
                                                'After close function'
                                            );
                                    }
                                });
                            } else {
                                if (LoginTabName ==
                                    'Management') {

                                    btn.disabled =
                                        false;
                                    btn.innerText =
                                        'LOGIN';
                                    showToast({
                                        eleWrapper: '#login-error-flashmsg',
                                        msg: 'This email id is not registered please signup.',
                                        theme: 'error',
                                        closeButton: false,
                                        autoClose: true,
                                        afterShow: function() {
                                            console
                                                .log(
                                                    'After show function'
                                                );
                                        },
                                        afterClose: function() {
                                            console
                                                .log(
                                                    'After close function'
                                                );
                                        }
                                    });

                                } else {
                                    showToast({
                                        eleWrapper: '#signup-error-flashmsg',
                                        msg: 'This email id is not registered please signup.',
                                        theme: 'error',
                                        closeButton: false,
                                        autoClose: true,
                                        afterShow: function() {
                                            console
                                                .log(
                                                    'After show function'
                                                );
                                        },
                                        afterClose: function() {
                                            console
                                                .log(
                                                    'After close function'
                                                );
                                        }
                                    });
                                    $("#loginModal")
                                        .modal(
                                            'hide');
                                    $("#signupModal")
                                        .modal(
                                            'show');

                                    $("#signupEmail")
                                        .val(email);
                                }
                            }
                        }
                    });

                } else {
                    btn.disabled = false;
                    btn.innerText = 'LOGIN';

                    showToast({
                        eleWrapper: '#login-error-flashmsg',
                        msg: 'Please enter a valid email address.',
                        theme: 'warning',
                        closeButton: false,
                        autoClose: true,
                        afterShow: function() {
                            console.log(
                                'After show function'
                            );
                        },
                        afterClose: function() {
                            console.log(
                                'After close function'
                            );
                        }
                    });
                    //       loader.off();
                }

            }
            // loader.off();
        }
    }
    // Email verify
    function verifyEmailOtp(url) {
        //alert(url);
        //loader.on();
        var btn = document.getElementById('emailotpverifybtn');
        btn.disabled = true;
        btn.innerText = 'VERIFYING';
        var Url = url;
        //console.log(Url);
        // event.preventDefault();
        var otp = $('#emailotp').val();
        if (otp == "") {
            $("#login-success-flashmsg").html("");

            showToast({
                eleWrapper: '#login-error-flashmsg',
                msg: 'Please enter 6 digit OTP!',
                theme: 'warning',
                closeButton: false,
                autoClose: true,
                afterShow: function() {
                    console.log(
                        'After show function');
                },
                afterClose: function() {
                    console.log(
                        'After close function');
                }
            });
            btn.disabled = false;
            btn.innerText = 'VERIFY';
            // loader.off();

        } else {
            var email = $('#loginEmail').val();
            //console.log(email);
            $.ajax({
                url: Url,
                type: "POST",
                dataType: "json",
                data: {
                    'otp': otp,
                    'email': email
                },
                success: function(data) {
                    // loader.off();
                    console.log(data);
                    if (data['statusCode'] == 1) {
                        btn.disabled = true;
                        btn.innerText = 'VERIFIED';
                        if ($(
                                "#includeSankalpamModal"
                            )
                            .val() == 'YES') {
                            $("#loginModal").modal(
                                "hide");
                        }
                        var routeUrl =
                            "<?php echo e(route('signin')); ?>";
                        PhoneLogin(routeUrl);


                    } else {
                        $("#login-error-flashmsg")
                            .html("");
                        $("#login-success-flashmsg")
                            .html("");
                        showToast({
                            eleWrapper: '#login-error-flashmsg',
                            msg: data[
                                'message'
                            ],
                            theme: 'warning',
                            closeButton: false,
                            autoClose: true,
                            afterShow: function() {
                                console
                                    .log(
                                        'After show function'
                                    );
                            },
                            afterClose: function() {
                                console
                                    .log(
                                        'After close function'
                                    );
                            }
                        });
                        btn.disabled = false;
                        btn.innerText = 'VERIFY';
                    }


                }
            });
        }
    }
    // Country code
    function nonEditCuntryCode(el) {
        var cuntryCode = $("#loginModal .iti__selected-flag")
            .attr('title');
        //alert(cuntryCode);
        cuntryCode = (cuntryCode.split(':')[1]).trim();

        if (el.value.length > cuntryCode.length) {
            var value = el.value.replace(cuntryCode,
                '');; //replace all $ with empty string
            el.value = cuntryCode + value;
        } else {
            el.value = cuntryCode;
        }
    }

    function nonEditCuntryCode1(el) {
        var cuntryCode = $("#signupModal .iti__selected-flag")
            .attr('title');
        cuntryCode = (cuntryCode.split(':')[1]).trim();
        if (el.value.length > cuntryCode.length) {
            var value = el.value.replace(cuntryCode,
                '');; //replace all $ with empty string
            el.value = cuntryCode + value;
        } else {
            el.value = cuntryCode;
        }
    }
    // End Country code
    // Tab
    $('#tabs .nav-link2').on('click', function() {
        const activeTab = $('.nav-link2.active');
        if (activeTab.attr('tab-name') === 'Devotee') {
            $('#signupLink').hide();
        } else {
            $('#signupLink').show();
        }
    });

    function PhoneLogin(url) {
        //alert(url);
        // event.preventDefault();
        // loader.on();
        var url = url;
        // alert(url);
        var email = $('#loginEmail').val();
        //alert(email);
        var phone = $('#loginPhoneNumber').val();
        var newphone = 0;
        var cuntryCode = $("#loginModal .iti__selected-flag")
            .attr('title');
        cuntryCode = (cuntryCode.split(':')[1]).trim();
        var value = phone.replace(cuntryCode, '');
        newphone = value;
        const activeLoginTab = $('.nav-link.active');
        const LoginTabName = activeLoginTab.attr('tab-name');
        console.log(LoginTabName);

        // alert(url);
        $.ajax({
            url: url,
            type: "POST",
            dataType: "json",
            data: {
                'email': email,
                'phone': newphone,
                'sessionCreate': 1,
                'LoginTabName': LoginTabName
            },
            success: function(data) {
                // loader.off();
                console.log(data);
                if (data.statusCode == 1) {
                    alert('Login Successful.');
                    // $(".dotlgbtn").text('MY ACCOUNT');
                    if ($('#serviceId').val()) {
                        $('.loginBtnClose').click();
                        $("#loginModal").modal(
                            "hide");
                        $("#paymentModal").modal(
                            "show");
                    } else if ($(
                            '#donateToTempleBtnBeforeLogin'
                        ).val()) {
                        $('.loginBtnClose').click();
                        $("#loginModal").modal(
                            "hide");
                        $("#DonateToTemple").val(
                            'DONATIONS');
                        $("#DonateToTemplePaymentModal")
                            .modal("show");

                    } else {
                        if ($("#fromPage").val() ==
                            'newsletter') {
                            $('.loginBtnClose')
                                .click();
                            $("#loginModal").modal(
                                "hide");
                            subscribeNewsletter();

                        } else if ($("#fromPage")
                            .val() == 'REQUEST-FORM'
                        ) {
                            window.location.href =
                                "<?php echo e('services/serviceRequest'); ?>";
                        } else if ($("#fromPage")
                            .val() ==
                            'REQUEST-OUTSIDE') {
                            window.location.href =
                                "<?php echo e(url('services-request', 'outside-temple')); ?>";
                        } else if ($("#fromPage")
                            .val() == 'APARAKARYA'
                        ) {
                            window.location.href =
                                "<?php echo e(url('services-request', 'aparakarya')); ?>";
                        } else if ($("#fromPage")
                            .val() ==
                            'MAKE-PAYMENTS-FORM') {
                            window.location.href =
                                "<?php echo e('services/MakePayment'); ?>";
                        } else if ($("#fromPage")
                            .val() == 'events') {
                            window.location.href =
                                "<?php echo e('events/checkout'); ?>";
                        } else if ($("#fromPage")
                            .val() == 'services') {

                            var includeSankalpam =
                                $(
                                    "#includeSankalpamModal"
                                )
                                .val();

                            if (includeSankalpam ==
                                'YES') {
                                $("#loginModal")
                                    .modal("hide");
                                $("#susbc-form-btn")
                                    .click();
                            } else {

                                window.location
                                    .href =
                                    "<?php echo e(route('checkout', ['param1' => 'service'])); ?>";
                            }
                        } else if ($("#fromPage")
                            .val() ==
                            'paylaterServices') {

                            var includeSankalpam =
                                $(
                                    "#includeSankalpamModal"
                                )
                                .val();

                            if (includeSankalpam ==
                                'YES') {
                                $("#loginModal")
                                    .modal("hide");
                                $("#susbc-form-btn")
                                    .click();
                            } else {
                                window.location
                                    .href =
                                    "<?php echo e('paylater-services/checkout'); ?>";
                            }
                        } else if ($("#fromPage")
                            .val() == 'donations') {
                            window.location.href =
                                "<?php echo e(route('donations-checkout')); ?>";

                        } else if ($("#fromPage")
                            .val() ==
                            'recurring-sponsorships'
                        ) {
                            window.location.href =
                                "<?php echo e('recurring-sponsor/checkout'); ?>";

                        } else if ($("#fromPage")
                            .val() == 'sponsorships'
                        ) {
                            window.location.href =
                                "<?php echo e('checkout/sponsorship'); ?>";
                        } else if ($("#fromPage")
                            .val() == 'view-cart') {
                            window.location.href =
                                "<?php echo e('Services/ViewCart'); ?>";
                        } else if ($("#fromPage")
                            .val() == 'facilities'
                        ) {
                            window.location.href =
                                "<?php echo e('facilities/checkout'); ?>";
                        } else if ($("#fromPage")
                            .val() == 'pledge_form'
                        ) {
                            submitRecurringForm();
                        } else if ($("#fromPage")
                            .val() == 'garbhalaya_land') {
                            window.location.href =
                                "<?php echo e(url('garbhalayalandcheckout')); ?>";
                        } else if ($(
                                "#includeSankalpamModal"
                            ).val() == 'YES') {
                            $("#loginModal").modal(
                                "hide");
                        } else {

                            if (LoginTabName ==
                                'Management') {

                                window.location
                                    .href =
                                    "<?php echo e('managements/member-directory'); ?>";

                            } else {

                                window.location
                                    .href =
                                    "<?php echo e(route('admin.dashboard')); ?>";
                            }
                        }
                    }
                } else {
                    $("#loginModal").modal('hide');
                    $("#signupModal").modal('show');
                    showToast({
                        eleWrapper: '#signup-error-flashmsg',
                        msg: 'This phone no. is not registerd please signup.',
                        theme: 'error',
                        closeButton: false,
                        autoClose: true,
                        afterShow: function() {
                            console.log(
                                'After show function'
                            );
                        },
                        afterClose: function() {
                            console.log(
                                'After close function'
                            );
                        }
                    });

                }
            }
        });

    }

    function loginBy(type) {


        if (type == 'email') {
            var cuntryCode = $("#loginModal .iti__selected-flag").attr('title');
            cuntryCode = (cuntryCode.split(':')[1]).trim();
            $("#loginPhoneNumber").val(cuntryCode);
        } else {
            $("#loginEmail").val('');
        }
    }

    //
    function checkLoginStatus(serviceAmt = '', serviceName = '', service_Id = '', serviceCategoryTypes = '',
        serviceTypes = '', dayTypes = '', startDate = '', startTime = '') {

        loader.on();

        if (serviceAmt == 'OUTSIDE') {
            pageName = 'REQUEST-OUTSIDE';
        } else if (serviceAmt == 'APARAKARYA') {
            pageName = 'APARAKARYA';
        } else if (serviceAmt == 'REQUEST-FORM') {
            pageName = 'REQUEST-FORM';
        } else if (serviceAmt == 'PAY-LATER') {
            pageName = 'PAY-LATER';
        } else {
            pageName = '';

        }


        var amt = (serviceAmt / 1).toFixed(2);
        var serviceName = serviceName;
        var serviceId = service_Id;

        var serviceCategoryTypes = serviceCategoryTypes;
        var serviceTypes = serviceTypes;
        var dayTypes = dayTypes;
        var startDate = startDate;
        var startTime = startTime;



        if (serviceCategoryTypes == 'DONATIONS') {
            $("#dateTimeTable").css('display', 'none');
        }
        if ($("#DonateToTemple").val() == 'DONATIONS') {
            $("#DonateToTemple").val('')
        };

        if (serviceCategoryTypes == 'DONATIONS' && amt == 0.00) {
            $("#edittable").html(
                '<input style="text-align: right;" type="number" class="form-control currency" id="serviceAmt" min="1.00" value="1.00" required/>'
            );
        } else {

            $("#edittable").html('<h4 id="servicePrice">' + amt + '</h4><input type="hidden" name="" value="' + amt +
                '" id="serviceAmt">');
        }

        // event.preventDefault();
        $.ajax({
            url: "<?php echo e(url('check-login-status')); ?>",
            type: "POST",
            dataType: "json",
            success: function(data) {
                loader.off();
                if (data == 0) {
                    $("#signupModal").modal("hide");
                    $("#EventDetailsModal").modal("hide");
                    $('#servicePrice').text('$' + amt);
                    $('#serviceName').text(serviceName);

                    if (serviceCategoryTypes == 'EVENTS') {

                        $('#fullPackage').val('true');
                    }


                    $('#serviceId').val(serviceId);
                    if (amt != 0.00) {
                        $('#serviceAmt').val(amt);
                    }
                    openLoginModal(pageName);
                    $('#serviceCategoryTypes').val(serviceCategoryTypes);
                    $('#serviceTypes').val(serviceTypes);
                    $('#dayTypes').val(dayTypes);
                    $('#startDate').val(startDate);
                    $('#serviceStartDate').val(startDate);
                    $('#startTime').val(startTime);
                    $('#timepicker').val(startTime);

                } else {

                    if (pageName == 'REQUEST-FORM') {
                        window.location.href = "<?php echo e(url('services/serviceRequest')); ?>";
                    } else if (pageName == 'REQUEST-OUTSIDE') {
                        window.location.href = "<?php echo e(url('services-request', 'outside-temple')); ?>";
                    } else if (pageName == 'APARAKARYA') {
                        window.location.href = "<?php echo e(url('services-request', 'aparakarya')); ?>";
                    } else if (pageName == 'PAY-LATER') {
                        window.location.href = "<?php echo e(url('services/payLater')); ?>";
                    }

                    if (serviceCategoryTypes == 'EVENTS') {

                        $('#fullPackage').val('true');
                    }


                    $("#loginModal").modal("hide");
                    $('#servicePrice').text('$' + amt);
                    $('#serviceName').text(serviceName);
                    $('#serviceId').val(serviceId);
                    $('#serviceCategoryTypes').val(serviceCategoryTypes);
                    $('#serviceTypes').val(serviceTypes);
                    $('#dayTypes').val(dayTypes);
                    $('#startDate').val(startDate);
                    $("#serviceStartDate").val(startDate);
                    $('#startTime').val(startTime);
                    $("#timepicker").val(startTime);
                    if (amt != 0.00) {
                        $('#serviceAmt').val(amt);
                    }

                    $.ajax({
                        url: "<?php echo e(url('Home/getServiceDetailsById')); ?>",
                        type: "POST",
                        data: {
                            'serviceId': serviceId
                        },
                        success: function(serviceDetails) {
                            loader.off();
                            var details = JSON.parse(serviceDetails);

                            if (serviceCategoryTypes == 'EVENTS') {

                                $('#fullPackage').val('true');
                            }

                            if (serviceDetails != '') {
                                $("#servicesDetails").html();

                                if (details.startDate != '') {
                                    if ($("#serviceStartDate").val() != '') {
                                        $("#serviceStartDate").val('');
                                    }
                                    $("#serviceStartDate").val('');
                                    $("#serviceStartDate").val(details.startDate);
                                    $("#serviceStartDate").prop('readonly', true);
                                } else {
                                    if ($("#serviceStartDate").val() != '') {
                                        $("#serviceStartDate").val('');
                                    }
                                    $("#serviceStartDate").val('');
                                    $("#serviceStartDate").val(details.startDate);
                                    $("#serviceStartDate").prop('readonly', false);
                                }

                                if (details.startTime != '') {

                                    if ($("#timepicker").val() != '') {
                                        $("#timepicker").val('');
                                    }

                                    $("#timepicker").val(details.startTime);
                                    $("#timepicker").prop('readonly', true);
                                    $("#timepicker").prop('disabled', true);


                                } else {
                                    if ($("#timepicker").val() != '') {
                                        $("#timepicker").val('');
                                    }

                                    $("#timepicker").val(details.startTime);
                                    $("#timepicker").prop('readonly', false);
                                    $("#timepicker").prop('disabled', false);
                                }


                                $("#modaleventCloseBtn").click();
                                $("#paymentModal").modal("show");
                            }
                        }
                    });



                    if ($("#serviceCategoryTypes").val() == 'AWAY-TEMPLE') {
                        $("#addressField").html(
                            '<p>Please Select Your Service Location:</p> <input type="radio" id="home" name="ServiceAddress" value="home" checked required>  <label for="home">Home</label><br> <input type="radio" id="other" name="ServiceAddress" value="other">  <label for="other">Other Location</label><br><textarea class="form-control my-3" placeholder="Enter Your Full address" id="Address" name="Address" style="display:none" required></textarea>'
                        );


                        $('input:radio[name="ServiceAddress"]').change(function() {
                            if ($(this).val() == 'home') {
                                $("#Address").css('display', 'none');
                            } else {
                                $("#Address").css('display', 'inline-flex');
                            }
                        });

                    }
                }
            }
        });
    }

    $(document).ready(function() {
        $(".each-word").each(function() {
            var $this = $(this);
            var htmlContent = $this.html();
            var modifiedContent = htmlContent.replace(/(?:<[^>]*>)|(\b[a-z])([a-z]+)?\b/gim, function(
                match, p1, p2) {
                if (p1) {
                    return "<span class='first-letter'>" + p1 + "</span>" + (p2 || "");
                } else {
                    return match; // Preserve HTML tags
                }
            });
            $this.html(modifiedContent);
        });
    });

    // anyamount prize code 
    $(".amount-input").on({
        keyup: function() {
            var inputId = $(this).attr('id');
            var id = inputId.replace('anyAmtEvent', '');
            formatCurrency($(this), id);
        },
        blur: function() {
            var inputId = $(this).attr('id');
            var id = inputId.replace('anyAmtEvent', '');
            formatCurrency($(this), id, "blur");
        }
    });

    $(".amount-input-donations").on({
        keyup: function() {
            var inputId = $(this).attr('id');
            var id = inputId.replace('anyAmtDonation', '');
            formatCurrency($(this), id);
        },
        blur: function() {
            var inputId = $(this).attr('id');
            var id = inputId.replace('anyAmtDonation', '');
            formatCurrency($(this), id, "blur");
        }
    });

    function formatCurrency(input, id, blur) {
        var input_val = input.val();

        if (input_val === "") {
            return;
        }

        var original_len = input_val.length;
        var caret_pos = input.prop("selectionStart");

        if (input_val.indexOf(".") >= 0) {
            var decimal_pos = input_val.indexOf(".");
            var left_side = input_val.substring(0, decimal_pos);
            var right_side = input_val.substring(decimal_pos);

            left_side = left_side.replace(/\D/g, "");
            right_side = right_side.replace(/\D/g, "");

            if (blur === "blur") {
                right_side += "00";
            }

            right_side = right_side.substring(0, 2);

            input_val = left_side + "." + right_side;
        } else {
            input_val = input_val.replace(/\D/g, "");

            if (blur === "blur") {
                input_val += ".00";
            }
        }

        input.val(input_val);

        $("#checkbox_" + id).attr('data-price', input_val);

        var updated_len = input_val.length;
        caret_pos = updated_len - original_len + caret_pos;
        input[0].setSelectionRange(caret_pos, caret_pos);
    }
</script>
<script type="text/javascript" src="<?php echo e(asset('assets/js/country_code.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/js/country_code2.js')); ?>"></script>
<!-- Mobile OTP AUTH BY FIREBASE -->
<!-- Add the latest firebase dependecies from CDN -->
<script src="https://www.gstatic.com/firebasejs/6.3.3/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/6.3.3/firebase-auth.js"></script>


<script>
    var firebaseConfig = {
        apiKey: "AIzaSyAcxU5AvD6qtVG76xDCXaf2vzuPIX_DwMw",
        authDomain: "login-7aff9.firebaseapp.com",
        projectId: "login-7aff9",
        storageBucket: "login-7aff9.appspot.com",
        messagingSenderId: "981533541532",
        appId: "1:981533541532:web:9846cc5487bb8fead35959",
        measurementId: "G-57D5BT4B2F"
    };


    firebase.initializeApp(firebaseConfig);
    window.recaptchaVerifier = new firebase.auth
        .RecaptchaVerifier(
            "recaptcha-container", {
                size: "normal",
                callback: function(response) {
                    submitPhoneNumberAuth();
                }
            }
        );

    function submitPhoneNumberAuth() {
        $("#AdministratorTab").addClass('disabled');
        $("#devoteeTab").addClass('disabled');

        var phoneNumber = document.getElementById(
            "loginPhoneNumber").value;
        var appVerifier = window.recaptchaVerifier;
        firebase
            .auth()
            .signInWithPhoneNumber(phoneNumber, appVerifier)
            .then(function(confirmationResult) {
                window.confirmationResult =
                    confirmationResult;

                if (confirmationResult.verificationId) {
                    // $("#mobiletoggle").toggle();
                    $("#mobiletoggle").css('display',
                        'inline-flex');
                    $('#mobileotp').focus();
                    $("#AdministratorTab").addClass(
                        'disabled');
                    $("#devoteeTab").addClass('disabled');

                    showToast({
                        eleWrapper: '.otpsendmsg_number',
                        msg: 'OTP has been sent on this mobile number.',
                        theme: 'success',
                        closeButton: false,
                        autoClose: true,
                        afterShow: function() {
                            console.log(
                                'After show function'
                            );
                        },
                        afterClose: function() {
                            console.log(
                                'After close function'
                            );
                        }
                    });

                    // $(".otpsendmsg_number").html("OTP has been sent on this mobile number.");
                    // setTimeout(function(){$(".otpsendmsg_number").text('');},6000);
                    $("#recaptcha-container").remove();
                }


            })
            .catch(function(error) {
                console.log(error);
            });
    }

    function submitPhoneNumberAuthCode() {
        var btn = document.getElementById('mobileotpverifybtn');
        btn.disabled = true;
        btn.innerText = 'VERIFYING';


        var code = document.getElementById("mobileotp").value;
        if (code == "") {
            btn.disabled = false;
            btn.innerText = 'VERIFY';
            $(".otpsendmsg_number").html("");


            showToast({
                eleWrapper: '.otpsendmsg_number_error',
                msg: 'Please enter 6 digit OTP!',
                theme: 'warning',
                closeButton: false,
                autoClose: true,
                afterShow: function() {
                    console.log(
                        'After show function');
                },
                afterClose: function() {
                    console.log(
                        'After close function');
                }
            });


            // $(".otpsendmsg_number_error").html("Please enter 6 digit OTP!");
            // setTimeout(function(){$(".otpsendmsg_number_error").text('');},6000);

        } else {
            confirmationResult
                .confirm(code)
                .then(function(result) {
                    var user = result.user;
                    // console.log(user);

                    var routeUrl = "<?php echo e(route('signin')); ?>";
                    PhoneLogin(routeUrl);


                    // console.log("USER LOGGED IN");

                })
                .catch(function(error) {
                    alert('Invalid OTP/OTP Expired!!')
                    var btn = document.getElementById(
                        'mobileotpverifybtn');
                    btn.disabled = false;
                    btn.innerText = 'VERIFY';
                    // console.log(error);
                });

            firebase.auth().onAuthStateChanged(function(
                user) {});
        }
    }
</script>
<script type="text/javascript" src="<?php echo e(asset('assets/js/notify.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/js/notify.min.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/js/multidatepickers.js')); ?>"></script>
<script rel="text/javascript" src="<?php echo e(asset('assets/js/jquery-ui.min.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/js/time-picker.js')); ?>"></script>
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<?php /**PATH D:\project\vaap\carolinamurugantemple\resources\views/includes/modal.blade.php ENDPATH**/ ?>