1function checkPrice($dates, $prices, $date, $cnt) { 2 $date = $date.trim(); 3 if($dates.length > 0) { 4 let $key = $dates.indexOf($date); 5 return $prices[$key] * $cnt; 6 } 7 8 return ''; 9} 10 11function checkPriceSingle($dates, $prices, $date, $cnt) { 12 $date = $date.trim(); 13 if($dates.length > 0) { 14 let $key = $dates.indexOf($date); 15 return $prices[$key]; 16 } 17 18 return ''; 19} 20 21 22jQuery(window).load(function () { 23 jQuery(".lds-spinner").css("display", "none"), jQuery("#spinblock").css("display", "block"), jQuery("#spinblock2").css("display", "block") 24}), 25jQuery(document).ready(function () { 26 jQuery(".matchH").matchHeight("height"); 27 var e = jQuery(".sectionName").map(function () { 28 return jQuery(this).data("name") 29 }).get().filter(function (e, t, a) { 30 return a.length > 0 && t == a.indexOf(e) 31 }); 32 jQuery(e).each(function (e, t) { 33 jQuery("." + t).wrapAll("<div class='row custom-row'></row>").parent().prepend('<div class="headline-category"><h4>' + t.replace(/_/g, " ") + "</h4></div>") 34 }), jQuery(window).width() >= 1100 ? jQuery("#owl-width").css("width", "800px") : jQuery(window).width() < 1099 && jQuery(window).width() > 700 && jQuery("#owl-width").css("width", "600px"), jQuery(".img-cst").find("a").attr("target", "_blank"), jQuery(".lists").find(".col-lg-4").css({ 35 "border-right": "1px", 36 "border-right-style": "solid" 37 }), jQuery(".process-step-circle-content").each(function (e) { 38 jQuery(this).text(jQuery(this).text().replace("0", " ")) 39 }), jQuery(".page-id-7696 .single-form:not(:first-child)").hide(), jQuery(".page-id-7708 .single-form:not(:first-child)").hide(), jQuery("#services").on("change", function () { 40 jQuery("." + jQuery(this).val()).show().siblings().hide() 41 }), jQuery(".video-thumb").addClass("col-sm-3") 42}), 43jQuery(document).ready(function () { 44 function e() { 45 event.currentTarget.classList.contains("active") ? event.currentTarget.classList.add("hideChild") : event.currentTarget.classList.remove("hideChild") 46 } 47 48 jQuery("#changeModal").modal({show: !1}), jQuery(".login-box label").each(function () { 49 el = jQuery(this), label_value = el.html(), el.hide(), el.next("input").val(label_value).addClass("not-filled-in") 50 }), jQuery(".login-box input").focus(function () { 51 el = jQuery(this), input_value = el.val(), label_value = el.prev("label").html(), input_value == label_value && el.val("").removeClass("not-filled-in") 52 }), 53 document.querySelectorAll(".toggleClick").forEach(function(t) { 54 t.addEventListener("click", e) 55 }), document.querySelector(".js-open-user-menu").addEventListener("click", function (e) { 56 var t = document.querySelector(".user-side-menu"); 57 t.classList.contains("open") ? (e.currentTarget.classList.remove("active"), t.classList.remove("open")) : (e.currentTarget.classList.add("active"), t.classList.add("open"), jQuery('#menu-alumni-menu li.menu-item-has-children').height(50), this.classList.add("move")), n(o) 58 }), document.querySelector(".js-open-user-menu").addEventListener("blur", function (e) { 59 document.querySelector(".user-side-menu").classList.contains("open") && e.currentTarget.classList.remove("open") 60 }), jQuery(".user-side-menu").focusout(function () { 61 }); 62 var t = !1; 63 64 function a() { 65 var e = { 66 action: "select_participant_data", 67 data: {user_id: jQuery("#user_id").val(), workshop_id: jQuery("#workshop_id").val()}, 68 type: "json" 69 }; 70 jQuery.ajax({ 71 type: "POST", url: my_ajax_object.ajax_url, data: e, success: function (e) { 72 var t = jQuery.parseJSON(e); 73 if (t.length > 0 && null !== t[0].participant_details && "null" != t[0].participant_details && void 0 !== t[0].participant_details) { 74 t = t[0].participant_details, document.body.contains(document.getElementById("csv-input-container")) && (document.getElementById("csv-input-container").style.display = "none", document.getElementById("csv-submit-container").style.display = "none"), jQuery("#ajax_csv #example_wrapper").remove(); 75 for (var a = jQuery.parseJSON(t), n = '<table id="example" class="table table-striped table-bordered table-sm" cellspacing="0" style="width:100%"><thead><tr>\n<th>First Name</th>\n<th>Last Name</th>\n<th>Position Title</th>\n<th>Email address</th>\n</tr></thead><tbody>', o = 0; o < a.length; o++) n += "<tr>", jQuery.each(a[o], function (e, t) { 76 var a = o + 1; 77 null != t && (n += '<td value="' + t + '"><input class="form-control" type="text" id="row-' + a + "-" + e.replace(" ", "-") + '" name="row-' + a + "-" + e.replace(" ", "-") + '" value="' + t + '"></td>') 78 }), n += "</tr>"; 79 n += "</tbody><tfoot><tr></tr></tfoot></table>", jQuery("#ajax_csv").append(n), jQuery("#example tr:empty").remove(), document.getElementById("change_csv").style.setProperty("display", "block", "important"), document.getElementById("delete_csv").style.setProperty("display", "block", "important"), document.getElementById("delete_csv").addEventListener("click", function () { 80 !function (e) { 81 let t = { 82 action: "delete_user_csv", 83 user_id: jQuery("#user_id").val(), 84 workshop_id: jQuery("#workshop_id").val(), 85 type: "json" 86 }; 87 jQuery.ajax({type: "POST", url: my_ajax_object.ajax_url, data: t}).done(function (e) { 88 jQuery("#changeModal").modal("show"), jQuery(".modal
88-title").text("SUCCESS"), jQuery(".modal-body").text("Deleted successfully!"), document.body.contains(document.getElementById("csv-input-container")) && (document.getElementById("csv-input-container").style.display = "block", document.getElementById("csv-submit-container").style.display = "block", document.getElementById("ajax_csv").style.display = "none", document.getElementById("change_csv").style.display = "none", document.getElementById("delete_csv").style.display = "none", document.getElementById("participant-list").value = "") 89 }) 90 }() 91 }) 92 } 93 var $example = jQuery("#example"); 94 if($example.length > 0) { 95 jQuery("#example").DataTable({serverside: !1, columnDefs: [{targets: [0, 1, 2]}]}) 96 } 97 } 98 }) 99 } 100 101 function n(e) { 102 var t = document.querySelector(".user-side-menu"), a = document.querySelector("#body-size"); 103 t.classList.contains("open") ? o.matches ? (a.style.width = "100%", a.style.marginLeft = "0px", a.classList.add("horizTranslate")) : (a.style.width = "calc(100% - 250px)", a.style.marginLeft = "250px", a.classList.add("horizTranslate")) : (a.style.width = "100%", a.style.marginLeft = "0px") 104 } 105 106 jQuery(".download").on("click", function () { 107 t = !0, jQuery(this).attr("disabled", !0) 108 }), jQuery(document).bind("gform_post_render", function () { 109 !0 === t && jQuery(".download-link").attr("data-id").split(",").forEach(function (e) { 110 !function (e, t) { 111 var a = document.createElement("a"); 112 a.download = t, a.href = e, a.click() 113 }(e, name) 114 }) 115 }), 116 jQuery("#download-pdf").submit(function (e) { 117 var t = jQuery("#validationDefault01").val(), a = jQuery("#validationDefault02").val(); 118 console.log("data", t, a), jQuery.ajax({ 119 type: "POST", 120 url: my_ajax_object.ajax_url, 121 data: {action: "send_custom_email", name: t, email: a}, 122 success: function (e) { 123 window.location = window.location.origin + "/wp-content/uploads/2020/10/7-Elements-Preparation-Sheet.pdf" 124 } 125 }), e.preventDefault() 126 }), 127 jQuery(document).bind("gform_confirmation_loaded", function (e, t) { 128 if (21 === t || 43 === t) { 129 var pdfUrl = window.location.origin + "/wp-content/uploads/2021/03/Negotiation_Insights_A_White_Paper_by_CMA_Consulting_Group_pptx.pdf"; 130 131 download_file(pdfUrl, 'Negotiation_Insights_A_White_Paper_by_CMA_Consulting_Group_pptx.pdf'); //call function 132 // var a = [], n = jQuery(".download-link")[0].dataset.id; 133 // if (a.push(n), "" != jQuery(".download-link-2")[0].dataset.id) { 134 // var o = jQuery(".download-link-2")[0].dataset.id; 135 // a.push(o) 136 // } 137 // jQuery.each(a, function (e) { 138 // window.open("about:blank", a[e]).location = a[e] 139 // }) 140 } else if(44 === t) { 141 var pdfUrl = window.location.origin + "/wp-content/uploads/2020/10/Mediation-and-Environment-CMA-Consulting-Group.pdf"; 142 download_file(pdfUrl, 'Mediation-and-Environment-CMA-Consulting-Group.pdf'); //call function 143 } else if(45 === t) { 144 var pdfUrl = window.location.origin + "/wp-content/uploads/2016/03/HR-Strategy-How-to-influence-and-engage-Joel-Gerschman-Rebecca-Stowe-Human-Capital-Magazine-March-2009.pdf"; 145 download_file(pdfUrl, 'HR-Strategy-How-to-influence-and-engage-Joel-Gerschman-Rebecca-Stowe-Human-Capital-Magazine-March-2009.pdf'); //call function 146 } else if(46 === t) { 147 var pdfUrl = window.location.origin + "/wp-content/uploads/2020/10/7-Elements-Preparation-Sheet.pdf"; 148 download_file(pdfUrl, '7-Elements-Preparation-Sheet.pdf'); //call function 149 } 150 }), 151 jQuery("#contact_details").submit(function (e) { 152 e.preventDefault(); 153 var t = {action: "get_contact_details", data: jQuery("#contact_details").seri
153alizeArray(), type: "json"}; 154 jQuery.ajax({ 155 type: "POST", url: my_ajax_object.ajax_url, data: t, success: function (e) { 156 console.log("Success :", e) 157 jQuery("#changeModal").modal("show"), jQuery(".modal-title").text("SUCCESS"), jQuery(".modal-body").text("Successfully saved!") 158 } 159 }), e.preventDefault() 160 }), jQuery("#site_details").submit(function (e) { 161 e.preventDefault(); 162 var t = {action: "get_site_details", data: jQuery("#site_details").serializeArray(), type: "json"}; 163 jQuery.ajax({ 164 type: "POST", url: my_ajax_object.ajax_url, data: t, success: function (e) { 165 jQuery("#changeModal").modal("show"), jQuery(".modal-title").text("SUCCESS"), jQuery(".modal-body").text("Successfully saved!") 166 } 167 }), e.preventDefault() 168 }), jQuery("#participant_details").submit(function (e) { 169 e.preventDefault(); 170 var t = jQuery("#participant-list").prop("files")[0], n = jQuery("#workshop_id").val(), o = new FormData; 171 o.append("file", t), o.append("workshop_id", n), o.append("action", "get_participant_details"), jQuery.ajax({ 172 url: my_ajax_object.ajax_url, 173 type: "POST", 174 contentType: !1, 175 processData: !1, 176 data: o, 177 success: function (e) { 178 jQuery("#changeModal").modal("show"), jQuery(".modal
178-title").text("SUCCESS"), jQuery(".modal-body").text("File uploaded successfully!"), a() 179 } 180 }), e.preventDefault() 181 }), jQuery(document).on("click", "#change_csv", function (e) { 182 e.preventDefault(); 183 var t = new Array; 184 jQuery("#example tbody tr").each(function (e, a) { 185 t[e] = { 186 "First Name": jQuery(a).find("td input:eq(0)").val(), 187 "Last Name": jQuery(a).find("td input:eq(1)").val(), 188 "Position Title": jQuery(a).find("td input:eq(2)").val(), 189 "Email Address": jQuery(a).find("td input:eq(3)").val() 190 } 191 }); 192 var a = { 193 user_id: jQuery("#user_id").val(), 194 workshop_id: jQuery("#workshop_id").val(), 195 UpdateData: t, 196 action: "get_participant_details_update" 197 }; 198 jQuery.ajax({ 199 url: my_ajax_object.ajax_url, type: "POST", data: a, success: function (e) { 200 jQuery("#changeModal").modal("show"), jQuery(".modal
200-title").text("SUCCESS"), jQuery(".modal-body").text("Updated successfully!") 201 } 202 }), e.preventDefault() 203 }), jQuery(document).ready(function () { 204 a() 205 }), jQuery("#radialYes").on("click", function () { 206 document.getElementById("radialYes").checked && (document.getElementById("preferredTimeContainer").style.display = "none") 207 }), jQuery("#radialNo").on("click", function () { 208 document.getElementById("radialNo").checked && (document.getElementById("preferredTimeContainer").style.display = "block") 209 }), 210 jQuery(".services-section .feature-box.feature-box-style-2 .feature-box-icon").eq(2).css("top", "-10px"), 211 jQuery(".services-section .feature-box.feature-box-style-2 .feature-box-icon").eq(6).css("top", "-5px"), 212 jQuery(".services-section .feature-box.feature-box-style-2 .feature-box-icon").eq(8).css("top", "-12px"), 213 document.querySelectorAll(".main-page-carousel .owl-nav button").forEach(function (e) { 214 e.addEventListener("click", function () { 215 var e = document.querySelector(".main-page-carousel .owl-item").getBoundingClientRect().width; 216 document.querySelectorAll(".main-page-carousel .owl-item").forEach(function (t) { 217 t.style.width = Math.round(e) + "px" 218 }) 219 }) 220 }); 221 222 var $select = jQuery(".book_now_form select"); 223 if($select.length > 0) { 224 $select.select2({minimumResultsForSearch: -1}); 225 226 jQuery(document).on("click", ".book_now_form .gform_page_footer input", function () { 227 setTimeout(function () { 228 jQuery(".book_now_form select").select2({minimumResultsForSearch: -1}) 229 }, 500) 230 }); 231 } 232 var o = window.matchMedia("(max-width: 992px)"); 233 n(), o.addListener(n), window.onload = function () { 234 navigator.userAgent.indexOf("Firefox") > 0 && document.querySelector("#choice_13_25_1").classList.add("firefox-check") 235 }; 236 jQuery("#menu-alumni-menu li.menu-item-has-children").click(function (event) { 237 if (jQuery(this).height() == 50) { 238 jQuery(this).height('auto'); 239 } else 240 jQuery(this).height(50); 241 }) 242 jQuery("#menu-alumni-menu li.menu-item-has-children ul.sub-menu li.menu-item-has-children").click(function (event) { 243 event.stopPropagation(); 244 if (jQuery(this).height() != 50) { 245 jQuery(this).height('auto'); 246 } else 247 jQuery(this).height(50); 248 }) 249 jQuery("#menu-client-menu li.menu-item-has-children").click(function (event) { 250 if (jQuery(this).height() == 50) { 251 jQuery(this).height('auto'); 252 } else 253 jQuery(this).height(50); 254 }) 255 var allTemplatesOnPage = document.querySelectorAll("div.customSingleTemplate"); 256 allTemplatesOnPage.forEach(function (item) { 257 if (item.firstElementChild.firstElementChild.innerText == "") { 258 item.firstElementChild.firstElementChild.remove(); 259 } 260 }) 261 262 function setHeight(className) { 263 var template = document.querySelectorAll(className); 264 var arr = []; 265 template.forEach(function (item) { 266 if (item.offsetHeight > 0) { 267 arr.push(item.offsetHeight); 268 } 269 }); 270 maxHeight = Math.max.apply(null, arr); 271 template.forEach(function (item) { 272 item.style.minHeight = maxHeight + 'px'; 273 }); 274 } 275 276 if (window.matchMedia("(min-width: 991px)").matches) { 277 setHeight('div.customSingleTemplate div.custom-row') 278 } else { 279 } 280 window.addEventListener('resize', function () { 281 if (window.matchMedia("(min-width: 991px)").matches) { 282 setHeight('div.customSingleTemplate div.custom-row') 283 } 284 }); 285 286 jQuery('.main_slider').slick({ 287 dots: true, 288 lazyLoad: 'ondemand', 289 slidesToShow: 1, 290 slidesToScroll: 1, 291 autoplay: true, 292 autoplaySpeed: 5000, 293 }); 294 295 jQuery('.slide-menu-button').off('click').click(function () { 296 jQuery(this).find('i').toggleClass('active'); 297 jQuery(this).parent().find('.slide-menu-bar').slideToggle(350); 298 }); 299 300 jQuery('body.home .custom-header-info .get-started a').on('click',function() { 301 ga('send', 'event', 'Button', 'Click', 'Book a consult', '1'); 302 }); 303 304 jQuery('#gform_1').submit(function() {
305 ga('send', 'event', 'Form', 'Stay Informed', 'Submit', '1'); 306 }); 307 308 jQuery('#gform_10').submit(function() { 309 ga('send', 'event', 'Form', 'Book a Consultation Today', 'Submit', '1'); 310 }); 311 312 jQuery('#gform_13').submit(function() { 313 ga('send', 'event', 'Form', 'Book your seat today!', 'Submit', '1'); 314 }); 315 316 jQuery('.page-id-4783 .custom-header-info .get-started a.white').on('click',function() { 317 ga('send', 'event', 'Button', 'Click', 'Contact CMA', '1'); 318 }); 319 320 jQuery('#gform_2').submit(function() { 321 ga('send', 'event', 'Form', 'Contact Us', 'Submit', '1'); 322 }); 323 324 var getLocation = function(href) { 325 var l = document.createElement("a"); 326 l.href = href; 327 return l; 328 }; 329 jQuery('.subscribe-btn').on('click', function () { 330 var url = new URL(jQuery(this).attr('href')); 331 var program = url.searchParams.get("program"); 332 if(typeof program != 'undefined') { 333 ga('send', 'event', 'Training Register Button', program, 'Click', '1'); 334 } 335 }); 336 337 jQuery('.custom-header-info .get-started a.white').on('click', function () { 338 var $name = jQuery(this).text(); 339 $name = $name.toLowerCase(); 340 if($name.trim() == 'quote') { 341 ga('send', 'event', 'Quote Button', document.title, 'Click', '1'); 342 } 343 }); 344 345 jQuery('#gform_8').on('click', function () { 346 ga('send', 'event', 'Form', 'Request Quote', 'Submit', '1'); 347 }); 348 349 var productType; 350 351 gform.addFilter( 'gform_product_total', function( price, formId ) { 352 $coupon = window['gf_coupons_response' + formId]; 353 354 if(typeof $coupon != 'undefined') { 355 if($coupon.feed.couponAmountType == "fixed_price") { 356 return price * 1.1; 357 } 358 } 359 360 var totalPrice = 0; 361 var eventObj = jQuery('#input_13_23').val(); 362 if(typeof eventObj != 'undefined') { 363 364 var event_arr = eventObj.split('|'); 365 366 var productDate; // Date 367 var productSeats = jQuery('#input_'+formId+'_22').val(); // Num of seats 368 369 jQuery('#gform_' + formId).find('select').each(function () { 370 var $this = jQuery(this); 371 var $li = $this.closest('li'); 372 if($li.css('display') != 'none') { 373 if($li.find('label').text() == 'Workshop Date') { 374 productDate = $this.val(); 375 } 376 } 377 }); 378 379 // Restore value from backup, when it is empty for a unknown reason 380 if (!productDate && window.BOOKING_PRODUCT_DATE) { productDate = window.BOOKING_PRODUCT_DATE } 381 382 if(productDate) { 383 384 // Backup selected value 385 if (window.BOOKING_PRODUCT_DATE != productDate) { window.BOOKING_PRODUCT_DATE = productDate } 386 387 var productAttr = productDate.split(' - '); 388 389 if(typeof workshops_date != 'undefined') { 390 if(typeof workshops_date[event_arr[0]] != 'undefined') { 391 if(typeof workshops_date[event_arr[0]]['all'] != 'undefined') { 392 if(productAttr[1] && typeof workshops_date[event_arr[0]]['all'][productAttr[1]] != 'undefined') { 393 let $element = workshops_date[event_arr[0]]['all'][productAttr[1]]['Date-select']; 394 var $dateEl = productAttr[0]; 395 $dateEl = $dateEl.trim(); 396 var $key = $element.indexOf($dateEl); 397 let is_total_price_set = false; 398 if(productSeats >= 4){ 399 productType = 'Group +4 Discount'; 400 if (workshops_date[event_arr[0]]['all'][productAttr[1]]['Group 4+ Discount'] !== undefined) { 401 totalPrice = workshops_date[event_arr[0]]['all'][productAttr[1]]['Group 4+ Discount'][$key] * productSeats; 402 is_total_price_set = true; 403 } else if (workshops_date[event_arr[0]]['all'][productAttr[1]]['Group 4+'] !== undefined) { 404 totalPrice = workshops_date[event_arr[0]]['all'][productAttr[1]]['Group 4+'][$key] * productSeats; 405 is_total_price_set = true; 406 } 407 } else { 408 if($key > -1) { 409 if(workshops_date[event_arr[0]]['all'][productAttr[1]]['Date'][$key] > 28) { 410 productType = 'Early Bird Price'; 411 if (workshops_date[event_arr[0]]['all'][productAttr[1]]['Early Bird'] !== undefined) { 412 totalPrice = workshops_date[event_arr[0]]['all'][productAttr[1]]['Early Bird'][$key] * productSeats; 413 is_total_price_set = true; 414 } else if (workshops_date[event_arr[0]]['all'][productAttr[1]]['Early Bird Discount'] !== undefined) { 415 totalPrice = workshops_date[event_arr[0]]['all'][productAttr[1]]['Early Bird Discount'][$key] * productSeats; 416 is_total_price_set = true; 417 } 418 } else { 419 productType = 'Standard Price'; 420 totalPrice = workshops_date[event_arr[0]]['all'][productAttr[1]]['Standard Price'][$key] * productSeats; 421 } 422 } 423 } 424 if (is_total_price_set === false) { 425 productType = 'Standard Price'; 426 totalPrice = workshops_date[event_arr[0]]['all'][productAttr[1]]['Standard Price'][$key] * productSeats; 427 } 428 } else { 429 if(typeof workshops_date[event_arr[0]]['all']['Sydney'] != 'undefined' && workshops_date[event_arr[0]]['all']['Sydney']) { 430 if(workshops_date[event_arr[0]]['all']['Sydney']['Date-select']) { 431 totalPrice = checkPrice(workshops_date[event_arr[0]]['all']['Sydney']['Date-select'], workshops_date[event_arr[0]]['all']['Sydney']['Standard Price'], productAttr[0],productSeats); 432 } 433 } else { 434 if(workshops_date[event_arr[0]]['all']['Melbourne']['Date-select']) { 435 totalPrice = checkPrice(workshops_date[event_arr[0]]['all']['Melbourne']['Date-select'], workshops_date[event_arr[0]]['all']['Melbourne']['Standard Price'], productAttr[0],productSeats);
436 jQuery('#input_13_106').val(checkPriceSingle(workshops_date[event_arr[0]]['all']['Melbourne']['Date-select'], workshops_date[event_arr[0]]['all']['Melbourne']['Standard Price'], productAttr[0],productSeats)); 437 } 438 } 439 productType = 'Standard Price'; 440 } 441 } 442 } 443 } 444 } 445 446 if(!totalPrice) { 447 totalPrice = 0.0; 448 } else { 449 var seatsCount = jQuery('#input_13_22').val(); 450 var originalTotal = totalPrice; 451 if (seatsCount > 1) { 452 originalTotal = originalTotal / seatsCount; 453 } 454 jQuery('#input_13_106').val(originalTotal); 455 console.log('set'); 456 457 var priceAdditionalBook = jQuery('#input_13_26').val(); 458 459 if(priceAdditionalBook !== '') { 460 priceAdditionalBook = priceAdditionalBook.split('|'); 461 priceAdditionalBook = parseInt(priceAdditionalBook[1]); 462 463 if(typeof $coupon != 'undefined' && priceAdditionalBook != 0) { 464 if($coupon.feed.couponAmountType == "percentage") { 465 let added = 2.78; 466 priceAdditionalBook = priceAdditionalBook + added; 467 } 468 } 469 470 } else { 471 priceAdditionalBook = 0; 472 } 473 474 totalPrice += parseFloat(priceAdditionalBook); 475 476 totalPrice = totalPrice * 1.1; // Add 10% 477 } 478 } 479 480 return totalPrice; 481 } ); 482 483 jQuery(document.body).on('change', '#input_13_20', function(){ 484 var price = jQuery(this).val(); 485 if (!isNaN(price) && price > 0){ 486 jQuery("#field_13_20 > div").show(); 487 }else{ 488 jQuery("#field_13_20 > div").hide(); 489 } 490 491 setTimeout(function(){ 492 jQuery('.ginput_total_13').prepend('<input type="hidden" value="'+productType+'" name="productType">'+productType + '<br/>').append(' <span style="font-size: 11px;">inc GST</span>'); 493 494 }, 5); 495 }); 496 497 jQuery(document.body).on('change', 'select', function() { 498 var $this = jQuery(this); 499 var $li = $this.closest('li'); 500 if($li.css('display') != 'none') { 501 if($li.find('label').text() == 'Workshop Date') { 502 productDate = $this.val(); 503 var $form = $this.closest('form'); 504 if($form.length > 0) { 505 $form.find('#input_13_22').trigger('change'); 506 } 507 } 508 } 509 }); 510}); 511
512function renderSummaryTable(data, titleText, block) { 513 514 let table = document.createElement("div"); 515 let tableWrapper = document.createElement("div"); 516 let title = document.createElement("p"); 517 518 let $show = false; 519 if(data.length > 0) { 520 data.forEach(function (item) { 521 if (item.value) { 522 $show = true; 523 } 524 }); 525 } 526 527 if($show) { 528 tableWrapper.classList.add("booking-summary-wrapper"); 529 table.classList.add("booking-summary"); 530 531 532 title.classList.add("booking-summary__title"); 533 title.innerText = titleText; 534 } 535 536 if(data.length > 0) { 537 data.forEach(function (item) { 538 if (item.value) { 539 var field = document.createElement("div"); 540 var title = document.createElement("span"); 541 var value = document.createElement("span"); 542 543 field.classList.add("booking-summary-field"); 544 title.classList.add("booking-summary-field__title"); 545 value.classList.add("booking-summary-field__value"); 546 547 title.innerText = item.label; 548 value.innerText = item.value; 549 if (item.totalPrice == true && block) { 550 var priceEl = block.querySelector("#field_13_20 > div > span"); 551 var priceValue = ""; 552 553 // priceValue = priceValue + priceEl.childNodes[0].textContent; // Text with price type 554 // 555 // priceValue = priceValue + " <span style='font-size: 12px;'>" + (typeof priceEl.children[priceEl.children.length - 1] != 'undefined' ? '(' + priceEl.children[priceEl.children.length - 1].innerText + ')' : '') + "</span>"; 556 // priceValue = priceValue + "<br>"; 557 priceValue = priceValue + item.value; 558 559 value.innerHTML = priceValue; 560 } 561 562 field.appendChild(title); 563 field.appendChild(value); 564 565 table.appendChild(field); 566 } 567 }); 568 } 569 570 if($show) { 571 tableWrapper.appendChild(table); 572 } 573 574 var formBody = block.querySelector(".gform_body > div:last-child"); 575 var buttons = block.querySelector(".gform_body > div:last-child > div:last-child"); 576 if (titleText) { 577 formBody.insertBefore(title, buttons); 578 } 579 formBody.insertBefore(tableWrapper, buttons); 580} 581 582jQuery(document).on('gform_post_render', function(event, form_id, current_page) { 583 var seatsCount = parseInt(jQuery('#input_13_22').val()); 584 585 for(i = 1; i <= seatsCount; i++){ 586 jQuery('.show_when_seats_' + i).show() 587 } 588 589 if(form_id == 13) { 590 renderFormCheckOne(); 591 } 592}); 593 594function renderFormCheckOne() { 595 let timerId = setInterval(function () { 596 let wrapper = jQuery(".form_cmaconsulting_off_wrapper"); 597 if(wrapper.length > 0 && wrapper.data('json1') != undefined && wrapper.data('json2') != undefined) { 598 var $title = wrapper.find('.booking-summary__title'); 599 if(!$title.length) { 600 clearInterval(timerId); 601 renderFormCheck(); 602 renderSummaryTable(wrapper.data('json1'), 'Workshop details', wrapper[0]); 603 var json2 = wrapper.data('json2'); 604 json2.forEach(function (data, index) { 605 renderSummaryTable(data, 'Participant #' + (index + 1), wrapper[0]); 606 }); 607 const fieldCaptcha = document.getElementById("field_13_109"); 608 const page = document.getElementById("gform_page_13_3"); 609 fieldCaptcha.style.padding = "15px"; 610 fieldCaptcha.remove(); 611 const lastChild = page.lastElementChild; 612 page.insertBefore(fieldCaptcha, lastChild); 613 const inputCaptcha = document.getElementById("input_13_109"); 614 inputCaptcha.style.placeSelf = 'center'; 615 } 616 } 617 618 },100); 619} 620 621function renderFormCheck() { 622 let timerIdTwo = setInterval(function () { 623 var $wraper = jQuery(".form_cmaconsulting_off_wrapper"); 624 var $title = $wraper.find('.booking-summary__title'); 625 if(!$title.length) { 626 clearInterval(timerIdTwo); 627 renderFormCheckOne(); 628 } 629 }); 630} 631 632jQuery(document).ready(function() { 633 gform.addFilter( 'gform_product_price', function( price, form_id, productFieldId ) { 634 $coupon = window['gf_coupons_response' + form_id]; 635 636 if(typeof $coupon != 'undefined') { 637 if($coupon.feed.couponAmountType == "fixed_price" && productFieldId == '23') { 638 if($coupon.product_type == 'one') { 639 price = parseFloat($coupon.feed.couponAmount); 640 } else { 641 price = parseFloat($coupon.feed.fixedPrice2); 642 } 643 } 644 } 645 646 return price; 647 }); 648 649 // jQuery(document.body).on('click','[target="gform_ajax_frame_~"] .button', function () { 650 jQuery(document.body).on('click','.gform_wrapper .button', function () {
651 let $this = jQuery(this); 652 $this.addClass('sendAjaxForm'); 653 $this.text('Loading ...'); 654 }); 655}); 656 657 658/* Helper function for downloading files*/ 659function download_file(fileURL, fileName) { 660 // for non-IE 661 if (!window.ActiveXObject) { 662 var save = document.createElement('a'); 663 save.href = fileURL; 664 save.target = '_blank'; 665 var filename = fileURL.substring(fileURL.lastIndexOf('/')+1); 666 save.download = fileName || filename; 667 if ( navigator.userAgent.toLowerCase().match(/(ipad|iphone|safari)/) && navigator.userAgent.search("Chrome") < 0) { 668 document.location = save.href; 669// window event not working here 670 }else{ 671 var evt = new MouseEvent('click', { 672 'view': window, 673 'bubbles': true, 674 'cancelable': false 675 }); 676 save.dispatchEvent(evt); 677 (window.URL || window.webkitURL).revokeObjectURL(save.href); 678 } 679 } 680 681 // for IE < 11 682 else if ( !! window.ActiveXObject && document.execCommand) { 683 var _window = window.open(fileURL, '_blank'); 684 _window.document.close(); 685 _window.document.execCommand('SaveAs', true, fileName || fileURL) 686 _window.close(); 687 } 688} 689 690function getUrlVars($var) { 691 var $url = new URL(window.location.href); 692 return $url.searchParams.get($var); 693} 694(function() { 695 if(getUrlVars('utm_source') && jQuery('.gf_coupon_code').length) { 696 697 jQuery.ajax({ 698 type: "POST", 699 url: my_ajax_object.ajax_url, 700 data: { 701 action: 'checkCoupon', 702 code: getUrlVars('utm_source') 703 }, 704 success: function(response) { 705 if(response.success) { 706 var utmCouponInterval = setInterval(function(){ 707 if(jQuery('.ginput_container_total input[name="input_20"]').length && jQuery('.ginput_container_total input[name="input_20"]').val() > 0) { 708 if(jQuery('select[name="input_22"]').val()) { 709 if(response.data.couponPricingType == 'Group 4+ Discount') { 710 if(parseInt(jQuery('select[name="input_22"]').val()) >= 4) { 711 jQuery('.gf_coupon_code').val(response.data.couponCode).change(); 712 jQuery('#gf_coupon_button').click(); 713 clearInterval(utmCouponInterval); 714 } 715 } else { 716 jQuery('.gf_coupon_code').val(response.data.couponCode).change(); 717 jQuery('#gf_coupon_button').click(); 718 clearInterval(utmCouponInterval); 719 } 720 } 721 } 722 }, 100); 723 } 724 } 725 }); 726 } 727})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.