<?php
$this->load->view('footer');
$country = $this->db->query("SELECT id, name from wps_countries_list WHERE 1")->result_array();
$ipaddress = getVisIpAddr();
$country = $this->db->query("SELECT * from wps_cookies WHERE cookies_ip='$ipaddress'")->result_array();
if(empty($country)){
    ?>
    <div id="cookie-notice" class="callout callout-cookies callout-cookies--visible">
		<div class="container">
		    <div class="row">
		        <div class="col-lg-11 col-md-11 col-12">
		            	<p>
			Cookies help us provide, protect and improve our products and services. For more information about our use of cookies, please refer to our 
			<a href="<?php echo site_url();?>privacy-policy">Privacy policy</a>.
			</p>

			
		        </div>
		      <div class="col-lg-1 col-md-1 col-12">
                <form method="post" id="cookiesform">
                    <input type="hidden" name="ip" id="ip" value="<?=$ipaddress;?>">
		          <button class="close-button" id="cookies_btn">
				     Accept
			      </button>
                </form>
			  </div>
		    </div>
		</div>
	</div>
    <?
}
?>

<div class="modal fade" id="whatsapp" tabindex="-1" aria-modal="true" role="dialog">
    <div class="modal-dialog modal-dialog-centered modal-sm">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title">Message on WhatsApp</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
                <form id="whatsappEnq" method="post">
                    <div id="status_response"></div>                  
                    <div class="row">
                        <div class="col-lg-12">
                            <div class="form-group input-group">
                                <div class="select_box">
                                    <i class="fa fa-user"></i>                                 
                                      <input tabindex="1" class="form-control" type="text" placeholder="Your Name*" id="wname" name="wname" required>
                                </div>
                            </div>
                            <div class="form-group input-group">
                                <div class="select_box">
                                    <i class="fa fa-phone"></i>
                                    <input tabindex="2" class="form-control" autocomplete="off" required="" type="text" name="wmobile" id="wmobile" value="" placeholder="Mobile Number*" onkeyup="if (/\D/g.test(this.value))
                                  this.value = this.value.replace(/\D/g, '')" onkeypress="return isNumberKey(event)" minlength="10" maxlength="12">
                                </div>
                            </div>
                            <button tabindex="3" class="btnSub" type="submit" name="submit" id="whatsEnq" value="Submit" data-submit="...Sending">Submit</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<div id="scrollUp" class="orange-color"><i class="fa fa-angle-up"></i></div>
<script src="<?php echo theme_url(); ?>js/jquery.min.js" crossorigin="anonymous"></script>
<script src="<?php echo theme_url(); ?>js/bootstrap.min.js" crossorigin="anonymous"></script>
<script src="<?php echo theme_url(); ?>js/slick.min.js" crossorigin="anonymous"></script>
<!--<script src="<?php //echo theme_url(); ?>js/wow.min.js" crossorigin="anonymous"></script>-->
<script src="<?php echo theme_url(); ?>js/themes.js" crossorigin="anonymous"></script>
<script>
 		var video = $("#video");
		// Check if video is ready to play
		$(video).on('canplay', function () {
			$(video).mouseenter(function () {
				$(this).get(0).play();
			}).mouseleave(function () {
				$(this).get(0).pause();
			})
		});
	</script>
<!-- <script>
window.addEventListener('load', videoScroll);
window.addEventListener('scroll', videoScroll);
function videoScroll() {
  if ( document.querySelectorAll('video[autoplay]').length > 0) {
    var windowHeight = window.innerHeight,
        videoEl = document.querySelectorAll('video[autoplay]');
    for (var i = 0; i < videoEl.length; i++) {
      var thisVideoEl = videoEl[i],
          videoHeight = thisVideoEl.clientHeight,
          videoClientRect = thisVideoEl.getBoundingClientRect().top;
      if ( videoClientRect <= ( (windowHeight) - (videoHeight*.5) ) && videoClientRect >= ( 0 - ( videoHeight*.5 ) ) ) {
        thisVideoEl.play();
          $('#myplay').click(function(){   $('#myplay').get(0).play(); });
      } else {
        thisVideoEl.pause();
      }

    }
  }

}
</script>
<script>
$(window).bind("load", function() {
  setTimeout(function() {
    $('#video-wrap').prepend('<video id="myplay" autoplay playsinline loop controls><source src="<?php echo theme_url(); ?>images/home-video.mp4" type="video/mp4"></video>');
  }, 1000);
});
</script>
<script>
var myDiv = document.getElementById("myDiv");
   setTimeout(function () {
      myDiv.style.display = "block";
  console.log("Showing");
}, 6000);
</script>  -->
<link href="<?=theme_url();?>css/sweetalert.css" rel="stylesheet" />
<script src="<?=theme_url();?>js/sweetalert.min.js"></script>
<script>
    $(document).ready(function () {
        $('#newsletter_submit').click(function (e) {
            e.preventDefault();
            if ($("#newsletter_email").val() != '') {
                jQuery.ajax({
                    url: "<?php echo site_url(); ?>home/submit_newslater",
                    data: $('#newsletter_form1').serialize(),
                    type: "POST",
                    success: function (data) {
                        var data = data.trim();
                        if (data == 'success') {
                            $("#form-status1").html('<div class="alert alert-success">You are Now Subscribed with Newsletter!</div>');
                            $('#newsletter_form1').trigger('reset');
                        } else {
                            $("#form-status1").html(data);
                        }
                    },
                    error: function () {}
                });
            } else {
                $("#form-status1").html('<div class="alert alert-danger"><strong>Please Enter Valid Email ID! <button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true"><i class="fa fa-remove"></i></button></div>');
            }

        });


        $('#cookies_btn').click(function (e) {
            e.preventDefault();
            if ($("#ip").val() != '') {
                jQuery.ajax({
                    url: "<?php echo site_url(); ?>pages/cookies_checker",
                    data: $('#cookiesform').serialize(),
                    type: "POST",
                    success: function (data) {
                        var data = data.trim();
                        console.log(data);
                    },
                    error: function () {}
                });
            }
        });
   
        $('#enquiry_button').click(function (e) {
            //alert("hii");
            e.preventDefault();
            if ($("#pname").val() != '' && $('#pemail').val()!='' && $("#pmobile").val() != '' && $("#pquantity").val() != '' && $("#plocation").val() != '' && $("#pmessage").val() != '' ) {
                jQuery.ajax({
                    url: "<?php echo base_url(); ?>pages/product_enq",
                    data: $('#product_pop_form2').serialize(),
                    type: "POST",
                    success: function (data)
                    {
                        var data = data.trim();
                        if (data == 'success')
                        {                            
                            $("#mail-status").html('<div class="alert alert-success">Your Details has been Submitted, our team will contact you soon!</div>');
                            $('#mail-status').trigger('reset');
                            swal({
                                title: "Your details has been Submitted, our team will contact you soon!",
                                text: "",
                                type: "success",
                                cancelButtonColor: '#01a1e3',
                                confirmButtonColor: '#ff0000',
                                confirmButtonText: 'Ok',
                            },
                                    function (isConfirm) {
                                        if (isConfirm) {
                                            window.location.reload();
                                        }
                                    });
                        } else {
                            $("#mail-status").html(data);
                        }
                    },
                    error: function () {}
                });
            } else {
                $("#mail-status").html('<div class="alert alert-danger"><strong>Asterisk(*) Marked fields are Mandatory! <button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true"><i class="fa fa-remove"></i></button></div>');
            }
        });   


        $('#login_auth').click(function (e) {
            //alert("hii");
            e.preventDefault();
            if ($("#login_mobile").val() != '' && $('#login_password').val()!='' && $("#productId").val() != '' ) {
                jQuery.ajax({
                    url: "<?php echo base_url(); ?>users/login_validate",
                    data: $('#login-frm').serialize(),
                    type: "POST",
                    success: function (data)
                    {
                        var data = data.trim();
                        if (data == 'success')
                        {                            
                            $("#login-status").html('<div class="alert alert-success">Login Successfully</div>');
                            $('#login-status').trigger('reset');
                            swal({
                                title: "Login Successfully",
                                text: "",
                                type: "success",
                                cancelButtonColor: '#01a1e3',
                                confirmButtonColor: '#208e39',
                                confirmButtonText: 'Ok',
                            },
                                    function (isConfirm) {
                                        if (isConfirm) {
                                            $('#isPincodeValue').val('1');
                                                  $('#cart_form').submit();
                                        }
                                    });
                        } else {
                            $("#login-status").html('<div class="alert alert-danger">Invalid Credential! <button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true"><i class="fa fa-remove"></i></button></div>');
                        }
                    },
                    error: function () {}
                });
            } else {
                $("#login-status").html('<div class="alert alert-danger"><strong>Asterisk(*) Marked fields are Mandatory! <button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true"><i class="fa fa-remove"></i></button></div>');
            }
        });


    });


    function isAlphaNumeric(key) {
        var regex = new RegExp("^[A-Za-z0-9? ,_-]+$");
        var key = String.fromCharCode(event.charCode ? event.which : event.charCode);
        if (!regex.test(key)) {
            event.preventDefault();
            return false;
        }
    }
    function isAlpha(key) {
        var regex = new RegExp("^[a-zA-Z]+$");
        var key = String.fromCharCode(event.charCode ? event.which : event.charCode);
        if (!regex.test(key)) {
            event.preventDefault();
            return false;
        }
    }

    function isNumberKey(evt) {
        var charCode = (evt.which) ? evt.which : event.keyCode;
        if ((charCode < 48 || charCode > 57))
            return false;
        return true;
    }
$(document).ready(function() {
    $('#whatsEnq').click(function(e) {
        e.preventDefault();
        var wname = $('#wname').val();
        var wmobile = $('#wmobile').val();
        $.ajax({
            url: "<?php echo site_url(); ?>pages/whatsappenq",
            data: $('#whatsappEnq').serialize(),
            type: "POST",
            success: function(data) {
                if (data == 'success') {
                    $('#status_response').html(
                        '<div class="alert alert-success">Whatsapp Enquiry Submitted successfully</div>'
                        );
                    $('#whatsappEnq').trigger('reset');
                    window.open(
                        "https://api.whatsapp.com/send?phone=919717813544&text=Hii,I Contacted you through your Website (<?php echo $this->config->item('site_name_www'); ?>).Kindly Call me Thank you!&source=&data=&app_absent="
                        );
                } else {
                    $('#status_response').html(data);
                }
            }

        });

    });
});
    

</script>

<script>  
$(document).ready(function() {
    // otpmodal 
$('#otpmodal').click(function (e) {
            e.preventDefault();
    
    
            $('#login_modal').modal('hide');
            $('#otp_modal').modal('show');

});
    
    
        // reg_modal 
$('#regmodal').click(function (e) {
            e.preventDefault();
            $('#login_modal').modal('hide');
            $('#reg_modal').modal('show');

});
    
    $('#loginmodal').click(function (e) {
            e.preventDefault();
         var isEnable = $('#isPincodeValue').val();
        if(isEnable == '1')
           {
           $('#login_modal').modal('show');
           }       
});
    
});
</script>

<script>
    $(document).ready(function() {
         // Send OTP 
    $('#otp_send').click(function(e) {
        e.preventDefault();
        var mobile = $("#mobile_num").val();
        if(mobile == ''){
            $('#otp-status').html('<div class="alert alert-danger"><strong> Mobile Number fields are Mandatory! <button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true"><i class="fa fa-remove"></i></button></div>');
        }
        else{ 
             $.ajax({
            url: "<?php echo site_url(); ?>users/sendotp",
            data: {mobile:mobile},
            type: "POST",
            success: function(data) {
                if (data == 'success') {
                    $('#style1').hide();
                    $('#style2').show();
                    $('#modaltitle').html('Verification Code');
                } else {
                    $('#otp-status').html('<div class="alert alert-danger"><strong> Invalid! Mobile Number <button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true"><i class="fa fa-remove"></i></button></div>');
                }
            }

        });
        }
    });
        
         // Otp verification 
        $('#otp_auth').click(function(e) {
        e.preventDefault();
        var otp = $("#otp").val();
        if(otp == ''){
            $('#otp-status2').html('<div class="alert alert-danger"><strong> Please Enter OTP ! <button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true"><i class="fa fa-remove"></i></button></div>');
        }
        else{ 
             $.ajax({
            url: "<?php echo site_url(); ?>users/otplogin_validate",
            data: {otp:otp},
            type: "POST",
            success: function(data) {
                if (data == 'success') {
                    
                    $('#otp_modal').modal('hide');
                            swal({
                                title: "Login Successfully",
                                text: "",
                                type: "success",
                                cancelButtonColor: '#01a1e3',
                                confirmButtonColor: '#208e39',
                                confirmButtonText: 'Ok',
                            },
                                    function (isConfirm) {
                                        if (isConfirm) {
                                             $('#isPincodeValue').val('1');
                                            $('#cart_form').submit();
                                        }
                                    });
                    
                } else {
                    $('#modaltitle').html('Verification Code');
                    $('#otp-status2').html('<div class="alert alert-danger"><strong> Wrong! OTP <button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true"><i class="fa fa-remove"></i></button></div>');
                }
            }

                });
            }
        });
        
        
         //registration 
        $('#register_send').click(function(e) {
        e.preventDefault();
        var username = $("#first_name").val(); 
        if( $("#first_name").val() == '' && $("#email_address").val() == '' && $("#mobile_number").val() == '' && $("#password").val() == '' && $("#c_password").val() == ''){
            $('#reg-status').html('<div class="alert alert-danger" role="alert"><strong> Asterisk(*) Marked fields are Mandatory! <button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true"><i class="fa fa-remove"></i></button></div>');
        }
        else{ 
             $.ajax({
            url: "<?php echo site_url(); ?>users/register_user",
             data: $('#register-frm').serialize(),
            type: "POST",
            success: function(data) {
                if (data == 'success') {
                    $('#section1').hide();
                    $('#section2').show();
                    $('#regtitle').html('Verification Code');
                } else {
                    $('#reg-status').html('<div class="alert alert-danger" role="alert"><strong> Asterisk(*) Marked fields are Mandatory! <button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true"><i class="fa fa-remove"></i></button></div>');
                }
            }
                });
            }
        });
        
        
                 // Otp registration authicate 
        $('#otp_auth_reg').click(function(e) {
        e.preventDefault();
        var otp = $("#otp_reg").val();
        if(otp == ''){
            $('#reg-status1').html('<div class="alert alert-danger" role="alert"><strong> Please Enter OTP ! <button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true"><i class="fa fa-remove"></i></button></div>');
        }
        else{ 
             $.ajax({
            url: "<?php echo site_url(); ?>users/otp_reg_validate",
            data: {otp:otp},
            type: "POST",
            success: function(data) {
                if (data == 'success') {
                    $('#reg_modal').modal('hide');
                    
                            swal({
                                title: "Register Successfully",
                                text: "",
                                type: "success",
                                cancelButtonColor: '#01a1e3',
                                confirmButtonColor: '#208e39',
                                confirmButtonText: 'Ok',
                            },
                                    function (isConfirm) {
                                        if (isConfirm) {
                                             $('#isPincodeValue').val('1');
                                            $('#cart_form').submit();
                                        }
                                    });
                    
                } else {
                    $('#reg-status1').html('<div class="alert alert-danger" role="alert"><strong> Wrong! OTP <button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true"><i class="fa fa-remove"></i></button></div>');
                }
            }

                });
            }
        });
        
        
                $('#resendotp').click(function(e) {
        e.preventDefault();
        var mobile = $('#mobile').val();
        if(mobile!="")
            {
            $.ajax({
            url: "<?=site_url();?>users/reg_resendotp",
            data: {mobile: mobile},
            type: "POST",
            success: function(data) {
                if (data == 'success') {
                    $('#status_response1').html('<div class="alert alert-success" role="alert"><strong> OTP Resend <button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true"><i class="fa fa-remove"></i></button></div>');
                }
            }

        });
            };
    });
        
        
        
    });     
</script>

<!--reset password-->
<script>
    $(document).ready(function() {
         $('#resetpass').click(function(e) {
        e.preventDefault();
            
             var mobile = $('#m_number').val();
             if( mobile != '' )
                 {
                    $.ajax({
                    url: "<?php echo site_url(); ?>members/reset_otp",
                    data:{mobile:mobile}, 
                    type: "POST",
                    success: function(data) {
                if (data == 'success') {
                    $('.sty1').hide();
                    $('.sty2').show();
                    $('#resetstatus').html('<div class="alert alert-success" role="alert"> Please Type the Verification Code sent to <?=$this->session->userdata('mobnumber');?></div>');
                } else {
                    $('#resetstatus').html('<div class="alert alert-danger" role="alert"><strong> Invalid! User <button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true"><i class="fa fa-remove"></i></button></div>');
                }
            }

        });  
                 }
         });
        
        $('#verifyotp').click(function(e) {
        e.preventDefault();
            
             var mobile = $('#mobile_number').val();
            var otp = $('#otp').val();
             if( mobile != '' )
                 {
                    $.ajax({
                    url: "<?php echo site_url(); ?>members/verifyotp",
                    data:{mobile:mobile,otp:otp}, 
                    type: "POST",
                    success: function(data) {
                if (data == 'success') {
                    $('.sty2').hide();
                    $('.sty3').show();
                    $('#resetstatus').empty();
                } else {
                    $('#resetstatus').html('<div class="alert alert-danger" role="alert"><strong> Invalid! OTP <button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true"><i class="fa fa-remove"></i></button></div>');
                }
            }

        });  
                 }
         });
        
                $('#new_pass').click(function(e) {
                    e.preventDefault();
            
             var password = $('#new_password').val();
            var action = $('#action').val();
             if( password != '' )
                 {
                    $.ajax({
                    url: "<?php echo site_url(); ?>members/resetpass",
                    data:{password:password,action:action}, 
                    type: "POST",
                    success: function(data) {
                if (data == 'success') {
                    $('#resetstatus').html('<div class="alert alert-success" role="alert"><strong> Password Change Successfully!</div>');
                    $('.sty3').hide();
                } else {
                    $('#resetstatus').html('<div class="alert alert-danger" role="alert"><strong> Asterisk(*) Marked fields are Mandatory! <button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true"><i class="fa fa-remove"></i></button></div>');
                }
            }

        });  
                 }
                    else{
                        $('#resetstatus').html('<div class="alert alert-danger" role="alert"><strong> Asterisk(*) Marked fields are Mandatory!<button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true"><i class="fa fa-remove"></i></button></div>');
                    }
         });
        
        
        
        
    $('#forget_pass').click(function(e) {
        e.preventDefault();
             var username = $('#username').val();
             if( username != '' )
                 {
                    $.ajax({
                    url: "<?php echo site_url(); ?>users/forgottenpassword",
                    data:{username:username}, 
                    type: "POST",
                    success: function(data) {
                if (data == 'success') {
                    $('#sty1').hide();
                    $('#sty2').show();
                    $('#forget_heading').html('Verification Code');
                    $('#forgetstatus').html('<div class="alert alert-success" role="alert"> Please Type the Verification Code sent to <?=$this->session->userdata('mobnumber');?></div>');
                } 
                else if(data == 'success1') {
                    $('#forgetstatus').html('<div class="alert alert-success" role="alert">Please check your email account to reset your password!</div>');  
                    setTimeout(function(){
            window.location.href = 'login';
         }, 5000);
                }
                        else if(data == 'error2'){
                    $('#forgetstatus').html('<div class="alert alert-danger " role="alert"><strong> Mail Not Sent !<button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true"><i class="fa fa-remove"></i></button></div>');
                }
                        else{
                            $('#forgetstatus').html('<div class="alert alert-danger " role="alert"><strong> Invalid User!<button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true"><i class="fa fa-remove"></i></button></div>'); 
                        }
            }

        });  
                 }
         });
        
        
     $('#otp_auth_verify').click(function(e) {
        e.preventDefault();
             var otp = $('#otp').val();
             if( otp != '' )
                 {
                    $.ajax({
                    url: "<?php echo site_url(); ?>users/forget_otp_auth",
                    data:{otp:otp}, 
                    type: "POST",
                    success: function(data) {
                if (data == 'success') {
                    $('#sty2').hide();
                    $('#sty3').show();
                     $('#forgetstatus').empty();
                } else {
                    $('#forget_heading').html('Verification Code');
                    $('#forgetstatus').html('<div class="alert alert-danger" role="alert"><strong> Invalid! OTP <button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true"><i class="fa fa-remove"></i></button></div>');
                }
            }

        });  
                 }
                else {
                    $('#forget_heading').html('Verification Code');
                    $('#forgetstatus').html('<div class="alert alert-danger" role="alert"><strong>OTP Required! <button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true"><i class="fa fa-remove"></i></button></div>');
                }
         });
        
             $('#newforget_pass').click(function(e) {
        e.preventDefault();
             var password = $('#forgetpassword').val();
             if( password != '' )
                 {
                    $.ajax({
                    url: "<?php echo site_url(); ?>users/set_forget_password",
                    data:{password:password}, 
                    type: "POST",
                    success: function(data) {
                if (data == 'success') {
                    
                       swal({
                                title: "Password Change Successfully!",
                                text: "",
                                type: "success",
                                cancelButtonColor: '#01a1e3',
                                confirmButtonColor: '#208e39',
                                confirmButtonText: 'Ok',
                            },
                               function (isConfirm) {
                                        if (isConfirm) {
                                          window.location.href = '<?=base_url() ?>login';
                                        }
                                    });
                } else {
                    $('#forgetstatus').html('<div class="alert alert-danger" role="alert"><strong> Invalid! Password Format <button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true"><i class="fa fa-remove"></i></button></div>');
                }
            }

        });  
                 }
                else {
                    $('#forgetstatus').html('<div class="alert alert-danger" role="alert"><strong>Password fields are Mandatory! <button type="button" class="close" data-bs-dismiss="alert" aria-hidden="true"><i class="fa fa-remove"></i></button></div>');
                }
         });
        
        
        
    });
</script>
<script>
$(document).ready(function(){
$("#login_modal, #otp_modal, #reg_modal").modal({
show:false,
backdrop:'static'
});
});
</script>
<script>
$(function(){
  
  $(".accordian .title").click(function(e){
    $($(e.target).find('.fa.fa-plus').toggleClass('open'));
  $(".accordian ul .ac-dropdown").slideUp();
    if ($(this).next().is(":hidden")){
    $(this).next().slideDown();
    }
  });
 
     $('.close-button').on('click', function(){
    $('.callout-cookies').addClass('hide');
});
 
  
  
});
</script>

