<?php include "app_modal.php" ?>
 

<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.1.3/js/bootstrap.min.js"></script> 
<script src="https://cdnjs.cloudflare.com/ajax/libs/wow/1.0.2/wow.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.1.20/jquery.fancybox.min.js"></script>  
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.9.0/jquery.validate.min.js"></script>  

<script src="<?=site_url;?>/designer/js/themes.js"></script>

<script>
$(document).ready(function() {
        $("#contact_form").validate({
            rules: {
                name: "required",
                message: {
                    required: true,
                },
                location: {
                    required: true,
                },
                email: {
                    required: true,
                },
                mobile: {
                    required: true,
                    number: true,
                    minlength: 10,
                    maxlength: 10,
                }
            },
            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 10 digits long",
                    maxlength: "Your Mobile No. must be 10 digits long",
                }
            },
            submitHandler: function(form) {
                $.ajax({
                    url: '<?= site_url; ?>/contact.php',
                    type: 'POST',
                    data: $('#contact_form').serialize(),
                    dataType: 'json',
                    success: function(response) {
                        if (response.status == true) {
                            $('#pop_up').text(response.message_response).css('color',
                                'green');
                            $('#contact_form')[0].reset();
                            grecaptcha.reset();
                        } else {
                            $('#pop_up').text(response.message_response).css('color',
                                'red');
                        }
                    }
                });
            }
        });
    });
    $(document).ready(function() {
        $("#enq_pop_form1").validate({
            rules: {
                name: "required",
                message: {
                    required: true,
                },
                location: {
                    required: true,
                },
                email: {
                    required: true,
                },
                mobile: {
                    required: true,
                    number: true,
                    minlength: 10,
                    maxlength: 10,
                }
            },
            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 10 digits long",
                    maxlength: "Your Mobile No. must be 10 digits long",
                }
            },
            submitHandler: function(form) {
                $.ajax({
                    url: '<?= site_url; ?>/enquiry_popup.php',
                    type: 'POST',
                    data: $('#enq_pop_form1').serialize(),
                    dataType: 'json',
                    success: function(response) {
                        if (response.status == true) {
                            $('#enq_pop_up').text(response.message_response).css('color',
                                'green');
                            $('#enq_pop_form1')[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,
                },
                quantity: {
                    required: true,
                },
                email: {
                    required: true,
                },
                mobile: {
                    required: true,
                    number: true,
                    minlength: 10,
                    maxlength: 10,
                }
            },
            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",
                },
                quantity: {
                    required: "Please enter Your Minimum Order Quantity",
                },
                mobile: {
                    required: "Please enter your mobile no.",
                    number: "Mobile No. contains only numbers",
                    minlength: "Your Mobile No. must be 10 digits long",
                    maxlength: "Your Mobile No. must be 10 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');
                        }
                    }
                });
            }
        });
    });
    $(document).ready(function() {
        $("#callback_form").validate({
            rules: {
                name: "required",
                mobile: {
                    required: true,
                    number: true,
                    minlength: 10,
                    maxlength: 10,
                }
            },
            messages: {
                name: "Please enter your name",
                mobile: {
                    required: "Please enter your mobile no.",
                    number: "Mobile No. contains only numbers",
                    minlength: "Your Mobile No. must be 10 digits long",
                    maxlength: "Your Mobile No. must be 10 digits long",
                }
            },
            submitHandler: function(form) {
                
        $(':input[type="submit"]').prop('disabled', true);
                $.ajax({
                    url: '<?= site_url; ?>/ajax_enq_action.php',
                    type: 'POST',
                    data: $('#callback_form').serialize(),
                    dataType: 'json',
                    success: function(response) {
                        if (response.status == true) {
                            $('#cpop_up').text(response.message_response).css('color',
                                'green');
                            $('#callback_form')[0].reset();
                            $(':input[type="submit"]').prop('disabled', false);
                            grecaptcha.reset();
                        } else {
                            $('#cpop_up').text(response.message_response).css('color',
                                'red');
                                $(':input[type="submit"]').prop('disabled', false);
                        }
                    }
                });
            }
        });
    });
    $(document).ready(function() {
        $("#whatsapp_form").validate({
            rules: {
                name: "required",
                mobile: {
                    required: true,
                    number: true,
                    minlength: 10,
                    maxlength: 10,
                }
            },
            messages: {
                name: "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 digits",
                }
            },
        });
    });
    $('#whatsapp_form').submit(function(e) {
        e.preventDefault();
        $(':input[type="submit"]').prop('disabled', true);
        $.ajax({
            'url': '<?= site_url; ?>/whatsapp_enq.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);
                }
            }
        });
    });
    $(document).ready(function() {
        $("#callback_form").validate({
            rules: {
                name: "required",
                mobile: {
                    required: true,
                    number: true,
                    minlength: 10,
                    maxlength: 10,
                }
            },
            messages: {
                name: "Please enter your name",
                mobile: {
                    required: "Please enter your mobile no.",
                    number: "Mobile No. contains only numbers",
                    minlength: "Your Mobile No. must be 10 digits long",
                    maxlength: "Your Mobile No. must be 10 digits long",
                }
            },
            submitHandler: function(form) {
                $(':input[type="submit"]').prop('disabled', true);
                $.ajax({
                    url: '<?= site_url; ?>/ajax_enq_action.php',
                    type: 'POST',
                    data: $('#callback_form').serialize(),
                    dataType: 'json',
                    success: function(response) {
                        if (response.status == true) {
                            $('#cpop_up').text(response.message_response).css('color',
                                'green');
                            $('#callback_form')[0].reset();
                            $(':input[type="submit"]').prop('disabled', false);
                            grecaptcha.reset();
                        } else {
                            $('#cpop_up').text(response.message_response).css('color',
                                'red');
                                $(':input[type="submit"]').prop('disabled', false);
                        }
                    }
                });
            }
        });
    });

    
 
    $(document).ready(function() {
$("#career_form").validate({
    rules: {
            name: "required",
           email: {
                required: true,
            },
            location: {
                required: true,
            },
           
            qualifications: {
                
            },
            experience: {
                
            },
          
            salary: {
                
            },
            message: {
                
            },
            files: {
                required: true,
            },
           
            mobile: {
                required: true,
                number: true,
                minlength: 10,
                maxlength: 10,
            }
        },
        messages: {
            name: "Please enter your name",
         
            email: {
                required: "Please enter your email address"
            },
            location: {
                required: "Please enter your Location"
            },
           
            qualifications: {
                required: "Please enter your Qualifications"
            },
            experience: {
                required: "Please enter Your Experiance",
            },
         
            salary: {
                required: "Please enter Your Salary",
            },
            message: {
                required: "Please enter Your Message",
            },
            mobile: {
                required: "Please enter your mobile no.",
                number: "Mobile No. contains only numbers",
                minlength: "Your Mobile No. must be 10 digits long",
                maxlength: "Your Mobile No. must be 10 digits long",
            }
        },
    submitHandler: function(form) { 
        var formData = new FormData($("#career_form")[0]);
        console.log(formData);
        $.ajax({
            type: "POST",
            url: "<?=site_url;?>/ajax_career_form.php",
            data: formData,
            processData: false,
            contentType: false,
               
                dataType: 'json',
                success: function(response) {
                    if (response.status == true) {
                        $('#career_response').text(response.message_response).css('color',
                            'green');
                        $('#career_form')[0].reset();
                        grecaptcha.reset();
                    } else {
                        $('#career_response').text(response.message_response).css('color',
                            'red');
                    }
                }
            });
    }
});
});

    // code for form validation 
    function ValidateAlpha(evt) {
        var keyCode = (evt.which) ? evt.which : evt.keyCode
        if ((keyCode < 65 || keyCode > 90) && (keyCode < 97 || keyCode > 123) && keyCode != 32)
            return false;
        return true;
    }
    function isNumberKey(evt) {
        //var e = evt || window.event;
        var charCode = (evt.which) ? evt.which : evt.keyCode
        if (charCode != 46 && charCode > 31 &&
            (charCode < 48 || charCode > 57))
            return false;
        return true;
    }
    function validateOnlyTextField(element) {
        var str = element.value;
        if (str == ' ') {
            element.value = "";
        }
        if (!(/^[a-zA-Z\s]+$/.test(str))) {
            // console.log('String contain number characters');
            str = str.substr(0, str.length - 1);
            element.value = "";
        }
    }

 // Disable context menu and restrict certain key combinations
document.onkeydown = function (e) {
    if (e.ctrlKey && (
        e.keyCode === 67 ||  // Ctrl + C
        e.keyCode === 86 ||  // Ctrl + V
        e.keyCode === 85 ||  // Ctrl + U
        e.keyCode === 117    // F6 (not typically used for view source)
    )) {
        e.preventDefault();
        return false;
    }
    return true;
};

// Disable Ctrl + U specifically using jQuery keypress
$(document).on("keypress", function (e) {
    if (e.ctrlKey && e.key.toLowerCase() === "u") {
        e.preventDefault();
        return false;
    }
    return true;
});

// Disable right-click context menu
document.addEventListener("contextmenu", function (e) {
    e.preventDefault();
}, false);

// Uncomment and customize this block when using intlTelInput plugin
/*
$(".telePhone").intlTelInput({
    preferredCountries: ["in", "us"],
    initialCountry: "in",
    separateDialCode: true,
});

$('.iti__country-list li').click(function() {
    const dialCode = $(this).data('dial-code');
    const countryName = $(".iti__country-name", this).text();

    $("#code").val(dialCode);
    $(".mobile").val($(this).data('country-code-code'));  // Make sure 'country-code-code' is correct
    $('#countryName').val(countryName);
    $(".code").val(dialCode);
    $('.countryName').val(countryName);
    $('.countryName1').val(countryName);
});
*/

// Allow only alphabetic characters and spaces in input
function allowOnlyAlphabets(input) {
    input.value = input.value.replace(/[^a-zA-Z\s]/g, '');
}

</script>