<?php require_once('./includes/header.php'); ?>
<main class="innerpages">
   <div class="banner_wrapper" style="background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('./assets/images/inner-pages/Get-Free-Qoute.jpg?ver23g3fg');">
    <h1>Get Free Quote
</h1>
  </div>

     <section class="section section_five wow animate__slideInUp pt-5" data-wow-delay=".5s" id="bookSession">
        <div class="container">
            
             <!--<div class="heading_wrap">-->
             <!--           <h6>GET A QUOTE</h6>-->
             <!--       </div>-->
            <div class="form_wrapper">
            <form id="myForm" enctype="multipart/form-data">
            <?php function generateRandomString($length = 10) {
                    $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
                        $charactersLength = strlen($characters);
                        $randomString = '';
                        for ($i = 0; $i < $length; $i++) {
                            $randomString .= $characters[rand(0, $charactersLength - 1)];
                        }
                        return $randomString;
                    }  ?>
            <input type="hidden" name="custom_token" id="customToken" value="<?php echo generateRandomString(); ?>">
                    <div class="row gx-3">
                        <div class="col-sm-6 col-lg-4">
                            <input type="text" class="form-control" placeholder="First Name" id="fname" name="fname" required/>
                        </div>
                        <div class="col-sm-6 col-lg-4">
                            <input type="text" class="form-control" placeholder="Last Name" id="lname" name="lname" required/>
                        </div>
                        <div class="col-sm-6 col-lg-4">
                            <input type="email" class="form-control" placeholder="Email Address" id="email" name="email" required/>
                        </div>
                        <div class="col-sm-6 col-lg-4">
                            <input type="tel" class="form-control" placeholder="Mobile Number" id="phone" name="phone" required/>
                        </div>
                          <div class="col-sm-6 col-lg-4">
                            <input type="text" class="form-control" placeholder="Address" id="address" name="address" required/>
                        </div>
                    
                         
                            
                        <div class="col-sm-6 col-lg-4">
                            <select id="service" name="service" class="form-control" required>
                                <option value="chimney-flue-sweeping">Chimney & Flue Sweeping</option>
  <option value="wood-burner-flue-installation-repair">Wood Burner & Flue Installation/Repair</option>
  <option value="internal-brickwork-installation-repair">Internal Brickwork Installation/Repair</option>
  <option value="external-brickwork-installation-repair">External Brickwork Installation/Repair</option>
  <option value="plastering">Plastering</option>



                               
                            
                               
                                
                            </select>
                        </div>
                       <!--  <div class="col-sm-6 col-lg-4">
                            <div class="input_file_wrapper">
                                <input type="file" id="cvfile" name="cvfile" required/>
                                <span>Upload Your CV</span>
                            </div>
                        </div> -->
                        <div class="col-12">
                            <textarea id="message" name="message" class="form-control" placeholder="Message Description" required></textarea>
                        </div>
                     
                            <button type="submit" class="__btn_submit" id="btn-submit">Submit</button>
                            <ul id="error-messages"></ul>
                            <div id="successMsg" class="success_msg"></div>
                      
                    </div>
                    </form>
            </div>
          

        </div>
    </section>
</main>

<style>
button.btn-close {
    position: absolute;
    right: -10px;
    top: -11px;
    background-color: #fff;
    opacity: 1;
}

.modal-content {
    border-radius: 0;
    border: 5px solid #000;
}

</style>


<!-- Modal -->
<div class="modal fade" id="staticBackdrop" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered">
    <div class="modal-content">
      <div class="modal-body">
      <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      <strong>Thanks for being awesome!</strong><br/><br/>
We have received your message and would like to thank you for writing to us. If your inquiry is urgent, please use the telephone number to talk to one of our staff members. Otherwise, we will reply by email as soon as possible. Thanks, and warm regards.<br/><br/>

<strong><?php echo $site_name; ?></strong>
      </div>
    </div>
  </div>
</div>


<script>
$(document).ready(function(e){
    // Submit form data via Ajax
    $("#myForm").on('submit', function(e){
        e.preventDefault();
        $.ajax({
            type: 'POST',
            url: '<?php echo $base_url;?>/quote-form-process.php',
            data: new FormData(this),
            dataType: 'json',
            contentType: false,
            cache: false,
            processData:false,
            beforeSend: function(){
                $('#btn-submit').attr("disabled","disabled");
                $('#myForm').css("opacity",".5");
            },
            success: function(response){
                $('#successMsg').html('');
                if(response.status == 1){
                    $('#myForm')[0].reset();
                    $("#staticBackdrop").modal('show');
                }else{
                    $('#successMsg').html('<span class="alert alert-danger">'+response.message+'</span>');
                }
                $('#myForm').css("opacity","");
                $("#btn-submit").removeAttr("disabled");
            }
        });
    });
});
</script>


</main>


<?php require_once('./includes/footer.php'); ?>