<?php
//$this->load->view('footer');

$this->load->view('footer');

$country = $this->db->query("SELECT id, name from wps_countries_list WHERE 1")->result_array();
?>

<div class="modal fade" id="getquote" tabindex="-1">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <div class="modal-title">Send Enquiry</div>
            </div>
            <div class="modal-body">
                <div class="alert alert-warning EmessageBox" style="display: none;">
                    <span class="Emessage"></span>
                </div>
                <div class="alert alert-success SmessageBox" style="display: none;">
                    <span class="Smessage"></span>
                </div>
                <div class="row">
                    <div class="col-lg-7 col-md-7">
                        <div class="product_popup">
                            <div class="product_popup_image">
                                <img id="productQuoteImage" src="" alt="Outdoor Furniture Assembly">
                            </div>
                            <span id="serviename"></span>
                        </div>
                    </div>
                    <div class="col-lg-5 col-md-5">
                        <form name="contact-form" method="post" id="getQuoteForm">
                            <div id="pro-status"></div>
                            <input type="hidden" name="product_id" id="product_id">
                            <input type="hidden" name="post_url" id="post_url">
                            <input type="hidden" name="product_service" id="product_service">
                            <div class="form-group">
                                <input class="form-input" type="text" name="pro_name" id="pro_name" value="" pattern="[a-z A-Z]+" required>
                                <label class="form-label">Full Name*</label>
                            </div>

                            <div class="form-group">
                                <input class="form-input" type="email" name="pro_email" id="pro_email" value="" required>
                                <label class="form-label">Email ID*</label>
                            </div>

                            <div class="form-group">
                                <input class="form-input" type="tel" name="pro_mobile" id="pro_mobile" maxlength="10" minlength="10" value="" required>
                                <label class="form-label">Phone No*</label>
                            </div>

                            <div class="form-group">
                                <input class="form-input" type="text" name="pro_location" id="pro_location" onfocus="geolocate()" value="" autocomplete="off" required>
                                <label class="form-label">Location*</label>
                            </div>
                            <div class="form-group">
                                <textarea class="form-input" name="pro_message" id="pro_message" required></textarea>
                                <label class="form-label">Message*</label>
                            </div>

                            <div class="form-group">
                                <button class="contact_btn hover_btn" type="submit" id="pro_submit1" name="submit" value="Submit" data-submit="...Sending">Submit</button>
                            </div>
                        </form>

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(document).ready(function () {
        $('#pro_submit1').click(function (e) {

            e.preventDefault();
            if ($("#pro_name").val() != '') {
                jQuery.ajax({
                    url: "<?php echo base_url();?>pages/productmodal",
                    data: $('#getQuoteForm').serialize(),
                    type: "POST",
                    success: function (data) {
                        var data = data.trim();
                        if (data == 'success') {
                            $("#pro-status").html('<div class="alert alert-success"><strong>Thank you!! Your Request has been Submitted, our team will contact within 12 Hours.</strong></div>');
                            $('#product_pop_form').trigger('reset');

                        } else {
                            $("#pro-status").html(data);
                        }
                    },
                    error: function () {}
                });
            } else {
                $("#pro-status").html('<div class="alert alert-danger"><strong>Asterisk(*) Marked fields are Mandatory!</div>');
            }

        })
    })

</script>

<script>
    $('.getQuote').click(function () {
        var productID = $(this).attr('data-ProductID');
        //var companyID = $(this).attr('data-companyID');
        //var companyName = $(this).attr('data-companyName');
        var productName = $(this).attr('data-ProductName');
        var productImage = $(this).attr('data-ProductImage');
        var friendly_url = $(this).attr('data-friendly_url');
        $('#productQuoteImage').attr('src', productImage);
        //$('#productQuoteImage').css({"border": "3px solid #CCC"});
        // $('#serviename').html('');
        $('#serviename').html(productName);
        $('#product_service').val(productName);
        $('#product_id').val(productID);
        //$('#productCompID').val(companyID);
        $('#post_url').val(friendly_url);
    });
</script>

<script>
    $(document).ready(function () {
        //search Suggestions
        $('#search_keyword').keyup(function () {
            keyword = $(this).val();
            if (keyword.length != "") {
                $.post('<?php echo base_url('home/search_products'); ?>', {keyword: keyword}, function (data) {
                    $('#serach_listt').slideDown();
                    $('#serach_listt').html(data);
                });
            }
        });
        $('#search_keyword').blur(function () {
            $('#serach_listt').slideUp();
        });
    });
</script>
<script src="<?php echo theme_url(); ?>js/bootstrap.js"></script>
<script src="<?php echo theme_url(); ?>js/wow.min.js"></script>
<script src="<?php echo theme_url(); ?>js/owl.carousel.js"></script>
<script src="<?php echo theme_url(); ?>js/jquery-fancybox.min.js"></script>
<script src="<?php echo theme_url(); ?>js/themes.js"></script>

<script>

    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;

    }

</script>
