contact_us.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <title>Client Brief</title>
  7. <link rel="shortcut icon" href="images/blueprint.ico" type="image/x-icon">
  8. <link href="css/bootstrap.css" rel="stylesheet">
  9. <link href="css/blueprint.css" rel="stylesheet">
  10. <link href="css/print.css" rel="stylesheet" media="print">
  11. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
  12. <!-- jQuery first, then Popper.js, then Bootstrap JS -->
  13. <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
  14. <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
  15. <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
  16. <script type="text/javascript" src="https://use.fontawesome.com/1e2844bb90.js"></script>
  17. <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js" integrity="sha256-T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=" crossorigin="anonymous"></script>
  18. </head>
  19. <body>
  20. <div class="container">
  21. <div id="contact_form">
  22. <form id="contact" name="contact" action="">
  23. <div class="mb-3">
  24. <label class="form-label" for="subject">Subject</label>
  25. <select name="subject" id="subject" class="form-control form-control-sm" aria-required="true" aria-invalid="false">
  26. <option selected value=""></option>
  27. <option value="New Residential">New Residential</option>
  28. <option value="Residential Extension">Residential Extension</option>
  29. <option value="New Commercial">New Commercial</option>
  30. <option value="Commercial Extension">Commercial Extension</option>
  31. <option value="Shed or Ancillary Dwelling">Shed or Ancillary Dwelling</option>
  32. <option value="Pool">Pool</option>
  33. <option value="Interior Design">Interior Design</option>
  34. <option value="Other">Other</option>
  35. </select>
  36. </div>
  37. <div class="mb-3">
  38. <label class="form-label" for="name">Your name</label>
  39. <input type="text" class="form-control form-control-sm" name="name" id="name" minlength="3" required >
  40. </div>
  41. <div class="mb-3">
  42. <label class="form-label" for="email">Your email address</label>
  43. <input type="email" class="form-control form-control-sm" name="email" id="email" required >
  44. </div>
  45. <div class="mb-3">
  46. <label class="form-label" for="email">Your mobile number</label>
  47. <input type="tel" class="form-control form-control-sm" name="mobile" id="mobile" required >
  48. </div>
  49. <div class="mb-3">
  50. <label class="form-label" for="name">Proposed Project Address</label>
  51. <input type="text" class="form-control form-control-sm map-autocomplete" name="property_address" id="property_address" onFocus="geolocate(this)">
  52. <div id="queryHelp" class="form-text">(This is so we can conduct some preliminary searches about your site such as zoning, easements and risks and hazards on your site such as landslip and bushfire.)</div>
  53. </div>
  54. <div class="mb-3">
  55. <label class="form-label" for="query">Description of your project or enquiry</label>
  56. <textarea cols="30" rows="8" class="form-control form-control-sm" name="query" id="query" placeholder="Your question"></textarea>
  57. <div id="queryHelp" class="form-text">(Please provide any other essential details about your project such as what you are looking to build, the size, how many bedrooms, bathrooms, style, rough budget etc)</div>
  58. </div>
  59. <div class="mb-3">
  60. <div id="postData"></div>
  61. </div>
  62. <input type="submit" name="submit" id="submit_btn" class="btn btn-sml btn-secondary" value="Submit">
  63. </form>
  64. </div>
  65. <script type="text/javascript">
  66. $(document).ready(function() {
  67. document.getElementById('mobile').addEventListener('keyup',function(evt){
  68. var phoneNumber = document.getElementById('mobile');
  69. var charCode = (evt.which) ? evt.which : evt.keyCode;
  70. phoneNumber.value = phoneFormat(phoneNumber.value);
  71. });
  72. });
  73. window.autocompletes = {};
  74. var placeSearch,
  75. clickedGeolocationField = null;
  76. var componentForm = {
  77. street_number: 'short_name',
  78. route: 'long_name',
  79. locality: 'long_name',
  80. administrative_area_level_1: 'short_name',
  81. postal_code: 'short_name'
  82. };
  83. String.prototype.toProperCase = function () {
  84. return this.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
  85. };
  86. // This creates a simple rectangle representing the Building Dimensions.
  87. function initAutocomplete() {
  88. let inputs = document.getElementsByClassName('map-autocomplete');
  89. for (let i = 0; i < inputs.length; i++) {
  90. var autocomplete = new google.maps.places.Autocomplete(
  91. inputs[i], {types: ['address'],componentRestrictions: {country: 'au'}}
  92. );
  93. autocomplete.name = inputs[i].name;
  94. autocomplete.setFields(['address_component']);
  95. autocomplete.addListener('place_changed', fillInAddress);
  96. autocompletes[inputs[i].id] = autocomplete;
  97. }
  98. }
  99. function fillInAddress() {
  100. let place = this.getPlace(),
  101. streetNumber = '',
  102. resultAddress = [];
  103. for (let component in componentForm) {
  104. for (let i = 0; i < place.address_components.length; i++) {
  105. let addressType = place.address_components[i].types[0];
  106. if (addressType == component) {
  107. let val = place.address_components[i][componentForm[addressType]];
  108. if (addressType == 'street_number') {
  109. streetNumber = val + ' ';
  110. } else {
  111. resultAddress.push(val);
  112. }
  113. }
  114. }
  115. }
  116. if (resultAddress.length > 0) {
  117. resultAddress = streetNumber + resultAddress.join(', ').toProperCase();
  118. $('[name="' + clickedGeolocationField + '"]').val(resultAddress);
  119. }
  120. }
  121. function geolocate(el) {
  122. clickedGeolocationField = el.name;
  123. if (navigator.geolocation) {
  124. navigator.geolocation.getCurrentPosition(function(position) {
  125. let geolocation = {
  126. lat: position.coords.latitude,
  127. lng: position.coords.longitude
  128. };
  129. let circle = new google.maps.Circle(
  130. {center: geolocation, radius: position.coords.accuracy});
  131. autocompletes[el.id].setBounds(circle.getBounds());
  132. });
  133. }
  134. }
  135. // A function to format text to look like a phone number
  136. function phoneFormat(input){
  137. // Strip all characters from the input except digits
  138. input = input.replace(/\D/g,'');
  139. // Trim the remaining input to ten characters, to preserve phone number format
  140. input = input.substring(0,20);
  141. // Based upon the length of the string, we add formatting as necessary
  142. var size = input.length;
  143. if(size == 0){
  144. input = input;
  145. }else if(size < 4){
  146. input = input + ' ';
  147. }else if(size < 7){
  148. input = input.substring(0,4)+' '+input.substring(4,6);
  149. }else if (input.startsWith("04") ) {
  150. input = input.substring(0,4)+' '+input.substring(4,7)+' '+input.substring(7,20);
  151. }else if (input.startsWith("+44") ) {
  152. input = input;
  153. }else{
  154. // for any number not starting in 04 e.g. all landlines
  155. input = input.substring(0,2)+' '+input.substring(2,6)+' '+input.substring(6,20);
  156. }
  157. return input;
  158. }
  159. $(document).ready(function(){
  160. $('#contact').submit(function(e){
  161. var dataString = $(this).serialize();
  162. //alert(dataString); return false;
  163. $.ajax({
  164. type: "POST",
  165. url: "form.php",
  166. data: dataString,
  167. success: function () {
  168. $("#postData").text('Your enquiry has been successfully sent, we will be in contact with you shortly.');
  169. $('#contact').trigger("reset");
  170. },
  171. error: function(){
  172. //alert("Form submission failed!");
  173. $("#postData").html(data);
  174. }
  175. });
  176. e.preventDefault();
  177. });
  178. });
  179. </script>
  180. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm" crossorigin="anonymous"></script>
  181. <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB-QceOYrDe9otynMmQ9iNF3yEZzbpsanM&libraries=places&callback=initAutocomplete" async defer></script>
  182. </div>
  183. </body>
  184. </html>