<?php include_once("include/main.inc.php"); ?>
<script src="<?=site_url;?>/designer/js/bootstrap.js"></script>
<script src="<?=site_url;?>/designer/js/wow.min.js"></script>
<script src="<?=site_url;?>/designer/js/jquery-fancybox.min.js"></script>
<script src="<?=site_url;?>/designer/js/owl.carousel.js"></script>
<script src="<?=site_url;?>/designer/js/themes.js"></script>
<script src="<?=site_url;?>/designer/js/jquery.validate.min.js"></script>
<?php include 'app_modal.php';

?>
<script>
   $(document).ready(function() {
    $("#whatsapp_form").validate({
          rules:{
            username: "required",
            mobile: {
              required: true,
              number: true,
              minlength:10,
              maxlength:10,
            }
          },
          messages:{
            username: "Please Enter Your Name",
            mobile: {
              required: "Please Enter Your mobile Number",
              number: "Mobile Number Must be Number",
              minlength: "Mobile Number must have 10 digits",
              maxlength: "Mobile Number must have 10 difits",
            }
          },
        });
$("#enq_pop_form").validate({
    rules: {
            name: "required",
            message: {
                required: true,
           
            },
            location: {
                required: true,
               
            },
            email: {
                required: true,
              
            },
            mobile: {
                required: true,
                number: true,
                minlength: 7,
                maxlength : 12
            }
        },
        messages: {
            name: "Please enter your name",
            message: {
                required: "Please enter your message",
            
            },

            email: {
                required: "Please enter your email address",
            },
            location: {
                required: "Please Enter Your Location",
            
            },
            mobile: {
                required: "Please enter your mobile no.",
                number: "Mobile No. contains only numbers",
                minlength: "Your Mobile No. must be at least 7-12 digits long",
                maxlength: "Your Mobile No. must be at least 7-12 digits long",
            }
        },
    submitHandler: function(form) { 
        $.ajax({
                url: '<?=site_url;?>/enquiry_popup.php',
                type: 'POST',
                data: $('#enq_pop_form').serialize(),
                dataType: 'json',
                success: function(response) {
                    if (response.status == true) {
                        $('#enq_pop_up').text(response.message_response).css('color',
                            'green');
                        $('#enq_pop_form')[0].reset();
                        grecaptcha.reset();

                    } else {
                        $('#enq_pop_up').text(response.message_response).css('color',
                            'red');

                    }
                }
            });

    }
});
});

$(document).ready(function() {

$("#product_pop_form").validate({
    rules: {
            name: "required",
            message: {
                required: true,
           
            },
            location: {
                required: true,
               
            },
            email: {
                required: true,
              
            },
            mobile: {
                required: true,
                number: true,
                minlength: 7,
                maxlength : 12
            }
        },
        messages: {
            name: "Please enter your name",
            message: {
                required: "Please enter your message",
            
            },

            email: {
                required: "Please enter your email address",
            },
            location: {
                required: "Please Enter Your Location",
            
            },
            mobile: {
                required: "Please enter your mobile no.",
                number: "Mobile No. contains only numbers",
                minlength: "Your Mobile No. must be at least 7-12 digits long",
                maxlength: "Your Mobile No. must be at least 7-12 digits long",
            }
        },
    submitHandler: function(form) { 
        $.ajax({
                url: '<?=site_url;?>/enquirycat_popup.php',
                type: 'POST',
                data: $('#product_pop_form').serialize(),
                dataType: 'json',
                success: function(response) {
                    if (response.status == true) {
                        $('#cat_pop_up').text(response.message_response).css('color',
                            'green');
                        $('#product_pop_form')[0].reset();
                        grecaptcha.reset();

                    } else {
                        $('#cat_pop_up').text(response.message_response).css('color',
                            'red');

                    }
                }
            });

    }
});
            $('#contact_form').submit(function(e){
                e.preventDefault();
                $(':input[type="submit"]').prop('disabled', true);
                $.ajax({
                    'url':'<?=site_url;?>/ajax_save_contact.php',
                    'type':'POST',
                    'dataType': 'json',
                    'data':$(this).serialize(),
                    'success':function(result){
                        if(result.status  == false){
                            $('.success_message').text('');
                            $('.error_message').text(result.message_response)
                            $(':input[type="submit"]').prop('disabled', false);
                        }else{   
                            $('.error_message').text('');                             
                            $('.success_message').text(result.message_response);
                            $('#contact_form').trigger("reset");
                            $(':input[type="submit"]').prop('disabled', false);
                        }
                    }
                })
            });
        $('#whatsapp_form').submit(function(e) {
            e.preventDefault();
            $(':input[type="submit"]').prop('disabled', true);
            $.ajax({
                'url': '<?=site_url;?>/ajax_save_whatsapp.php',
                'type': 'POST',
                'dataType': 'json',
                'data': $(this).serialize(),
                'success': function(result) {
                    if (result.status == false) {
                        $('.wht_success_message').text('');
                        $('.wht_error_message').text(result.message_response)
                        $(':input[type="submit"]').prop('disabled', false);
                    } else {
                        $('.wht_error_message').text('');
                        $('.wht_success_message').text("You Have Successfully Submitted enquiry. We will contact you soon.");
                        $('#whatsapp_form').trigger("reset");
                        window.open(result.message_response, '_blank');
                        $(':input[type="submit"]').prop('disabled', false);
                    }
                }
            });
        });
});

</script>