PageSourceSearch

https://www.winnetwork.ca/wp-content/plugins/wfwe-core/js/wfwe-core-public.min.js?ver=5.0.7.0

js winnetwork.ca collected 2026-10-05 18:03:02 UTC 907,845 bytes, 1 lines download raw bytes

1function wfwe_setCookie(t,e,a,o="none"){var r=new Date;r.setTime(r.getTime()+24*a*60*60*1e3);var n="expires="+r.toUTCString();let i="";switch(o){case"none":i="SameSite=None;Secure;";break;case"lax":i="SameSite=Lax;";break;case"strict":i="SameSite=Strict"}document.cookie=t+"="+e+";"+i+n+";path=/"}function wfwe_getCookie(t){for(var e=t+"=",a=decodeURIComponent(document.cookie).split(";"),o=0;o<a.length;o++){for(var r=a[o];" "==r.charAt(0);)r=r.substring(1);if(0==r.indexOf(e))return r.substring(e.length,r.length)}return""}function wdtElementNotification(t,e){if(t.hasClass("wdt-element-notification")){t.removeClass("wdt-element-notification");let e=t.clone(!0);t.before(e),t.remove(),t=e}let a=Date.now();return t.attr("data-tip",e),t.attr("data-tip-id",a),t.addClass("wdt-element-notification"),setTimeout(removeElementNotification,2250,t,a),t}function removeElementNotification(t,e){t.attr("data-tip-id")==e&&t.removeClass("wdt-element-notification")}function wdtInitGoogleMaps(){}function wdtNumberFormat(t,e=2){return t.toLocaleString("en-CA",{minimumFractionDigits:0,maximumFractionDigits:e})}function wdtMergeForms(t,e={}){const{method:a="POST",action:o=""}=e,r=document.createElement("form");r.method=a,r.action=o,r.style.display="none";for(const e of t){const t=new FormData(e);for(const[e,a]of t.entries()){const t=document.createElement("input");t.type="hidden",t.name=e,t.value=a,r.appendChild(t)}}return r}function wdtAddFormToURLHistory(t){let e=new FormData(t);const a=new URLSearchParams;for(const[t,o]of e.entries())a.append(t,o);const o=`${window.location.origin+window.location.pathname}?${a.toString()}`;window.history.replaceState({},"",o)}function wdtSaveFormCookie(t,e){let a=new FormData(e);const o=new URLSearchParams;for(const[t,e]of a.entries())o.append(t,e);wfwe_setCookie(t,o.toString(),365)}function wdtAnnounce(t,e=!1){jQuery("#wdt-screenreader-announcer-polite").length||jQuery("body").prepend('\n            <div id="wdt-screenreader-announcer-polite" class="screen-reader-text" aria-live="polite" aria-atomic="false"></div>\n            <div id="wdt-screenreader-announcer-assertive" class="screen-reader-text" aria-live="assertive" aria-atomic="false"></div>\n        ');const a=jQuery(e?"#wdt-screenreader-announcer-assertive":"#wdt-screenreader-announcer-polite");a.empty(),setTimeout((()=>{const e=jQuery("<p></p>").text(t);a.append(e),setTimeout((()=>e.remove()),5e3)}),50)}function wdtFocusElement(t){if(!t||!t.length)return;let e=t.find('a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])').filter(":visible").first();e.length?e.trigger("focus"):(t.is("[tabindex]")||t.attr("tabindex","-1"),t.trigger("focus"))}jQuery((function(t){"use strict";if(t(document).on("click",'button[data-action="wdt-remove-content-modal"]',(function(t){wdtRemoveContentModal()})),t('button[data-action="wdt-sidebar-menu-open"]').on("click",(function(e){t(this).next('[data-target="wdt-sidebar-menu"]').toggle(),t(this).toggleClass("active")})),t('*[data-action="wdt-no-propagate"]').on("click",(function(t){t.stopPropagation()})),t(".wdt-embeddable-container").find('a[target="_self"]').on("click",(function(e){t("body").append('<div class="wdt-loading-modal"><div class="wdt-spinner"></div></div>')})),t(".wdt-embeddable-container").find('form[target="_self"]').on("submit",(function(e){t("body").append('<div class="wdt-loading-modal"><div class="wdt-spinner"></div></div>')})),t("label>.wdt-input-character-counter").length>0){function e(e){let a=t(this).parent("label").first().find(".wdt-input-character-counter").first(),o=a.data("limit"),r=a.data("counter-target"),n=a.data("severity")||"truncate",i=t(this).val(),s=0;if("words"==r){if(s=i.split(/\s+\b/).length,s>o)if(this.setCustomValidity("Exceeded limit of "+o+" words for this input."),"truncate"==n){s=o;let a=0;for(let t=0;t<=o&&-1!=a;t++)a+=i.slice(a).search(/\s+\b/)+1;a>-1?t(this).val(i.slice(0,a)):console.log("Invalid wordIndex: "+a),e.preventDefault()}else"warn"==n&&(t(this).addClass("wdt-counter-warn"),t(a).addClass("wdt-counter-warn"));else this.setCustomValidity(""),t(this).removeClass("wdt-counter-warn"),t(a).removeClass("wdt-counter-warn")}else s=i.length,s>o?(a[0].setCustomValidity("Exceeded limit of "+o+" characters for this input."),"truncate"==n?(s=o,t(this).val(i.slice(0,o)),e.preventDefault()):"warn"==n&&(t(this).addClass("wdt-counter-warn"),t(a).addClass("wdt-counter-warn"))):(this.setCustomValidity(""),t(this).removeClass("wdt-counter-warn"),t(a).removeClass("wdt-counter-warn"));a.text(s+"/"+o)}t("label>.wdt-input-character-counter").each((function(a){t(this).data("current",0);let o=t(this).data("limit");t(this).text("0/"+o),t(this).parent("label").first().find("input,textarea").first().on("keydown",e).on("input",e)}))}if(t("#success-test").on("click",(function(){wdtDisplayNotification("This is a test notification","success",3e3)})),t("#error-test").on("click",(function(){wdtDisplayNotification("This is a test notification","error",3e3)})),t("#warning-test").on("click",(function(){wdtDisplayNotification("This is a test notification","warning",3e3)})),t("#info-test").on("click",(function(){wdtDisplayNotification("This is a test notification","info",3e3)})),t("fieldset.noc-library-selector").length>0){function a(e){if(e.hasClass("open"))return;t(e).find("ul").first().slideDown(150),t(e).addClass("open"),t(e).find("svg.wdt-caret-svg").first().addClass("rotated");let o=t(e).parentsUntil("fieldset.noc-library-selector","li.noc-library-selector-list-item").first();o.length>0&&a(o)}function o(e){if(!e.hasClass("open"))return;
1t(e).find("ul").first().slideUp(150),t(e).removeClass("open"),t(e).find("svg.wdt-caret-svg").first().removeClass("rotated"),t(e).find("li.noc-library-selector-list-item.open").each((function(e){o(t(this))}))}t(".noc-library-caret-container").on("click",(function(e){e.stopPropagation(),e.preventDefault();let r=t(this).parents("li").first();r.hasClass("open")?o(r):a(r)})),t(".noc-library-teer-category-select-list").on("mousedown",(function(t){t.preventDefault()})),t(".noc-library-teer-category-select-list").on("click",(function(e){t(this).prev(".noc-library-teer-category-select-controls").trigger("click")})),t(".noc-library-teer-category-select-controls").on("click",(function(e){let a=t(this).next(".noc-library-teer-category-select-list");"true"==a.attr("data-visible")?a.attr("data-visible",!1):a.attr("data-visible",!0)})),t(".noc-library-teer-category-select-controls").on("focusout",(function(e){t(this).next(".noc-library-teer-category-select-list").attr("data-visible",!1)})),t(".noc-library-teer-category-select-controls").on("keydown",(function(e){let a=e.which||e.keyCode,o=t(this).next(".noc-library-teer-category-select-list"),r="",n=null,i=[];switch(a){case 27:return o.attr("data-visible",!1),e.preventDefault(),e.stopPropagation(),!1;case 40:return r=t(this).attr("aria-activedescendant"),n=t("#"+r),i=[],i=n.length?n.nextAll(".noc-library-teer-category-select-item").first():o.find(".noc-library-teer-category-select-item").first(),i.length&&(t(this).attr("aria-activedescendant",i.attr("id")),n.attr("aria-selected",!1),i.attr("aria-selected",!0)),e.preventDefault(),e.stopPropagation(),!1;case 38:return r=t(this).attr("aria-activedescendant"),n=t("#"+r),i=[],n.length&&(i=n.prevAll(".noc-library-teer-category-select-item").first()),i.length&&(t(this).attr("aria-activedescendant",i.attr("id")),n.attr("aria-selected",!1),i.attr("aria-selected",!0)),e.preventDefault(),e.stopPropagation(),!1;case 13:if(r=t(this).attr("aria-activedescendant"),n=t("#"+r),n.length&&"true"==t(o).attr("data-visible")){let e=t(n).find(".noc-library-teer-category-checkbox"),a=t(e).prop("checked");return e.prop("checked",!a),e.trigger("change"),!1}t(this).trigger("click"),e.preventDefault(),e.stopPropagation()}})),t("button.noc-library-quick-selects").on("click",(function(e){e.stopPropagation(),e.preventDefault();let a=t(this).parents("fieldset.noc-library-selector").first(),r=t(this).attr("data-action");if("all-occupations"==r){let e=a.find('input[name="wdt_noc_library_selections[]"]');e.prop("checked",!0),e.first().trigger("change"),wdtElementNotification(t(this),"All occupations added to selection.")}if("all-trades"==r){let e=a.find('input[data-trade="true"]');e.prop("checked",!0),e.first().trigger("change"),wdtElementNotification(t(this),"All trade occupations added to selection.")}if("clear-all"==r){a.find('input[name="wdt_noc_library_selections[]"]').prop("checked",!1),wdtElementNotification(t(this),"All occupations removed from selection.");let e=a.find("li.noc-library-selector-list-item");e.each((function(e){o(t(this))})),e.first().find(".noc-library-checkbox").first().trigger("change")}})),t(document).on("change",".noc-library-teer-category-checkbox",(function(e){let a=t(this).prop("checked"),o=t(this).attr("data-teer-category"),r=t('.noc-library-checkbox[data-teer-category="'+o+'"]');r.prop("checked",a),r.first().trigger("change")})),t(".noc-library-checkbox").on("click",(function(e){let a=t(this).prop("checked"),o=t(this).parents("li").first().find("ul").first();t(o).find(".noc-library-checkbox").prop("checked",a)})),t(".noc-library-checkbox").on("change",(function(e){let a=t(this).parents("fieldset.noc-library-selector").first(),o=t(a).find(".noc-library-checkbox"),r=!1;o.each((function(e){let a=t(this).attr("data-code"),o=t(this).parents("li").first().find("ul").first().find(".noc-library-checkbox");if(o.length<1)return;let n=!0,i=0;o.each((function(e){t(this).prop("checked")?t(this).val()&&i++:n=!1}));let s=t('.noc-library-button-embedded-label[data-code="'+a+'"]');i>0?s.text(i+" selected"):s.text(""),n?(t(this).prop("indeterminate",!1),t(this).prop("checked")||(t(this).prop("checked",!0),r=!0)):i>0?t(this).prop("indeterminate",!0):(t(this).prop("indeterminate",!1),t(this).prop("checked")&&(t(this).prop("checked",!1),r=!0))})),r&&o.first().trigger("change")}))}t(document).on("wdt:hideSubmitSection",'*[data-has-nested-forms="true"]',(function(e){t(this).find('[data-submit-section="true"]').hide()})),t(document).on("wdt:showSubmitSection",'*[data-has-nested-forms="true"]',(function(e){t(this).find('[data-submit-section="true"]').show()}))})),jQuery((function(t){"use strict";"undefined"!=typeof Chart&&Chart.pluginService&&Chart.pluginService.register({beforeDraw:function(t){if(t.config.options.elements.center){var e=t.chart.ctx,a=t.config.options.elements.center,o=a.fontStyle||"proxima-nova",r=a.text,n=a.color||"#000",i=a.maxFontSize||75,s=(a.sidePadding||20)/100*(2*t.innerRadius);e.font="30px "+o;var d=e.measureText(r).width,l=2*t.innerRadius-s,c=l/d,p=Math.floor(30*c),u=2*t.innerRadius,f=Math.min(p,u,i),g=a.minFontSize,m=a.lineHeight||25,w=!1;void 0===g&&(g=20),g&&f<g&&(f=g,w=!0),e.textAlign="center",e.textBaseline="middle";var h=(t.chartArea.left+t.chartArea.right)/2,b=(t.chartArea.top+t.chartArea.bottom)/2;if(e.font=f+"px "+o,e.fillStyle=n,!w)return void e.fillText(r,h,b);for(var y=r.split(" "),v="",_=[],k=0;k<y.length;k++){var x=v+y[k]+" ";e.measureText(x).width>l&&k>0?(_.push(v),v=y[k]+" "):v=x}b-=_.length/2*m;for(k=0;k<_.length;k++)e.fillText(_[k],h,b),b+=m;e.fillText(v,h,b)}}})})),jQuery(document).ready((function(){"use strict";jQuery(".wdt-sidebar-menu a.wdt-internal-link").on("click",(function(t){if(jQuery(".wdt-sidebar-menu a").removeClass("active"),jQuery(this).addClass("active"),jQuery(window).width()>=768){var e=jQuery(this).attr("href");jQuery(".wdt-content-section").hide(),t.preventDefault(),t.stopPropagation(),jQuery(e).show()}}))})),jQuery((t=>{"use strict";function e(t){const e=t.next(".wdt-toolbar-dropdown-content"),a=t.attr("aria-label");
1e.slideUp("fast"),t.attr("aria-expanded","false"),t.attr("aria-label",a.replace("Collapse","Expand"))}function a(){t('.wdt-toolbar-dropdown-trigger[aria-expanded="true"]').each((function(){e(t(this))}))}function o(t){t.next(".wdt-toolbar-dropdown-content").is(":visible")?e(t):(a(),function(t){const e=t.next(".wdt-toolbar-dropdown-content"),a=t.attr("aria-label");e.slideDown("fast"),t.attr("aria-expanded","true"),t.attr("aria-label",a.replace("Expand","Collapse"))}(t))}function r(){t("#wdt-toolbar-button-portal-dashboard").attr("aria-expanded","false")}function n(){"true"!==t("#wdt-toolbar-button-portal-dashboard").attr("aria-expanded")?t("#wdt-toolbar-button-portal-dashboard").attr("aria-expanded","true"):"false"!==t("#wdt-toolbar-button-portal-dashboard").attr("aria-expanded")&&r()}t("#wdt-toolbar").length&&(t(document).on("click",(function(e){if("true"===t("#wdt-toolbar-button-portal-dashboard").attr("aria-expanded")){const a=t(e.target);if(a.closest("#wdt-toolbar-portal-menu").length||"wdt-toolbar-button-portal-dashboard"===a.attr("id")||a.closest("#wdt-toolbar-button-portal-dashboard").length)return;r()}})),t(document).on("keydown",(function(e){"Escape"===e.key&&"true"===t("#wdt-toolbar-button-portal-dashboard").attr("aria-expanded")&&r()})),t("#wdt-toolbar-portal-dashboard-container").on("click",(function(t){n()})),t(".wdt-toolbar-dropdown-trigger").on("click",(function(e){o(t(this))})),t(".wdt-toolbar-dropdown-content > button.wdt-dropdown-handle").on("click",(function(e){o(t(this).closest(".wdt-toolbar-dropdown-container").find(".wdt-toolbar-dropdown-trigger"))})),t(document).on("keydown",(function(t){"Escape"===t.key&&a()})))}));var WDT_TOOL_LABELS={wejobs:"Jobs Board",training:"Job & Training Events"};function wdt_dual_event_cap(t,e,a){trackResearchEvent(t+"|"+e+"|"+a),wdt_event_cap({t:t,ac:e,d:a})}function wdt_event_cap(t){if(!WDT.admin){var e=wfwe_getCookie("gender"),a=wfwe_getCookie("ageGroup");e||(e="U",wfwe_setCookie("gender","U",365)),a||(a="U",wfwe_setCookie("ageGroup","U",365)),"string"==typeof t.no&&(t.no=t.no.split(",").map((t=>t.trim())).filter((t=>""!==t))),"string"==typeof t.na&&(t.na=t.na.split(",").map((t=>t.trim())).filter((t=>""!==t))),t.nonce=WDT.central.analytics_nonce,t.g=e,t.a=a,jQuery.ajax({method:"POST",url:"/wp-json/wedatatools/v1/analytics/events/",data:t,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)}}).done((function(t){}))}}function wdt_career_calc_event_cap(t){if(!WDT.admin){var e=wfwe_getCookie("gender"),a=wfwe_getCookie("ageGroup");e||(e="U",wfwe_setCookie("gender","U",365)),a||(a="U",wfwe_setCookie("ageGroup","U",365)),t.nonce=WDT.central.analytics_nonce,t.g=e,t.a=a,t.t="Career Calculator",jQuery.ajax({method:"POST",url:"/wp-json/wedatatools/v1/analytics/career-calc/",data:t,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)}}).done((function(t){}))}}function trackResearchEvent(t){var e=wfwe_getCookie("gender"),a=wfwe_getCookie("ageGroup");e||(e="U",wfwe_setCookie("gender","U",365)),a||(a="U",wfwe_setCookie("ageGroup","U",365)),"function"==typeof gtag&&gtag("event","WEData Analytics",{event_category:"WEData Analytics",event_action:e+"|"+a,event_label:t})}jQuery(document).ready((function(t){"use strict";if(jQuery(".research-board-close").on("click",(function(t){jQuery("#wfwe-analytics-modal").hide()})),jQuery(".wfwe_job_postings").length||jQuery(".post-type-archive-wfwe_job_postings").length||jQuery(".post-type-archive-wdt_training_post").length||jQuery(".vis-job-relationships").length||jQuery(".wemap-census ").length||jQuery(".vis-wemap2 ").length||jQuery(".single-wfwe_job_postings").length||jQuery(".wfwe_employers").length||jQuery(".timeline-tool").length||jQuery("#map-sectors").length||jQuery("#wdt-ccc").length){var e=wfwe_getCookie("gender"),a=wfwe_getCookie("ageGroup");!navigator.cookieEnabled||e&&a||(e||wfwe_setCookie("gender","U",365),a||wfwe_setCookie("ageGroup","U",365),wfwe_show_analytics_modal&&jQuery("#wfwe-analytics-modal").show(),jQuery(".research-board-gender").on("click",(function(t){jQuery(".research-board-gender").removeClass("selected"),jQuery(this).addClass("selected"),wfwe_setCookie("gender",jQuery(this).data("gender"),365),jQuery(".research-board-age-group.selected").length&&jQuery("#wfwe-analytics-modal").hide()})),jQuery(".research-board-age-group").on("click",(function(t){jQuery(".research-board-age-group").removeClass("selected"),jQuery(this).addClass("selected"),wfwe_setCookie("ageGroup",jQuery(this).data("age-group"),365),jQuery(".research-board-gender.selected").length&&jQuery("#wfwe-analytics-modal").hide()})))}jQuery(".job-posting-link").on("wdt:captureClickEvent",(function(t){var e=jQuery(this).data("post-id"),a=jQuery(this).data("job-title"),o=jQuery(this).data("employer"),r=(jQuery(this).data("nocs"),jQuery(this).data("nocs-202
11")),n=jQuery(this).data("tool");(n||(n="Jobs Board"),"function"==typeof trackResearchEvent&&trackResearchEvent("wejobs|click-job-post|"+e),"function"==typeof wdt_event_cap)&&wdt_event_cap({t:n,ac:"Click Job Post",e:o,d:a,no2021:r,na:""})})),jQuery(".job-posting-link").on("click",(function(e){t(this).trigger("wdt:captureClickEvent")})),jQuery(".wdt-occupation-link").on("click",(function(e){e.preventDefault();var a=jQuery(this).data("noc");wdt_event_cap({t:jQuery(this).data("tool"),ac:"Click Occupation",e:"",d:"",no2021:a,na:""});let o=t(this).attr("target");o||(o=t("base").first().attr("target")),window.open(jQuery(this).attr("href"),o)})),t(".wdt-an-event").on("click",(function(e){var a=t(this).data("an-action"),o=t(this).data("tool"),r=t(this).data("an-label"),n=t(this).data("an-details"),i=t(this).data("employer"),s=(t(this).data("noc-codes"),t(this).data("noc-2021-codes"));if("function"==typeof trackResearchEvent){trackResearchEvent(o+"|"+a+"|"+r)}if("function"==typeof wdt_event_cap){let t=a.split("-"),e=[];for(let a of t)e.push(a.charAt(0).toUpperCase()+a.slice(1));let r=e.join(" "),d=WDT_TOOL_LABELS[o];d||(d=o),wdt_event_cap({t:d,ac:r,e:i,d:n,no2021:s,na:""})}})),t(".resume-toolbar-button.export").on("click",(function(e){let a=t("#_acf_post_id").val();a&&jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/analytics/resumes/view/",data:{resumeId:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){},error:function(t){console.log(t)},complete:function(){}})})),t("#wdt-employer-post-view-hook").each((function(e){let a=t(this).attr("data-post-id");var o=wfwe_getCookie("gender"),r=wfwe_getCookie("ageGroup");a&&jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/analytics/companies/view/",data:{companyId:a,age:r,gender:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){},error:function(t){console.log(t)},complete:function(){}})})),t("#wdt-occupation-post-view-hook").each((function(e){let a=t(this).attr("data-noc-code");var o=wfwe_getCookie("gender"),r=wfwe_getCookie("ageGroup");a&&jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/analytics/occupations/view/",data:{nocCode:a,age:r,gender:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){},error:function(t){console.log(t)},complete:function(){}})})),t("#wdt-sector-post-view-hook").each((function(e){let a=t(this).attr("data-post-id");var o=wfwe_getCookie("gender"),r=wfwe_getCookie("ageGroup");a&&jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/analytics/sectors/view/",data:{sectorId:a,age:r,gender:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){},error:function(t){console.log(t)},complete:function(){}})}))})),jQuery((function(t){jQuery((function(t){"use strict";t(".wdt-skill-tags-tabbed-display-tab").on("click",(function(e){e.preventDefault();let a=t(this).data("content");t(this).parents(".wdt-skill-tags-tabbed-display").first().find(".wdt-skill-tags-tabbed-display-tab").removeAttr("selected"),t(this).parents(".wdt-skill-tags-tabbed-display").first().find(".wdt-skill-tags-tabbed-display-content").removeAttr("selected"),t(this).attr("selected",""),t("#"+a).attr("selected","")})),t("button.wdt-skill-tags-tabbed-display-letter-list-letter").on("click",(function(e){e.preventDefault();let a=t(this).data("letter"),o=t(this).parents(".wdt-skill-tags-tabbed-display-content").first().find('.wdt-skill-tags-tabbed-display-letter-break-container[data-letter="'+a+'"]');t([document.documentElement,document.body]).animate({scrollTop:o.offset().top},500)}))}))})),jQuery((function(t){"use strict";t(".wdt-skilled-trade-noc-link").on("click",(function(t){t.stopPropagation()}))})),jQuery(document).ready((function(t){"use strict";var e=new WeakMap;t('#wdt-training-board input[type="checkbox"][name="medium[]"]').on("change",(function(e){t(this).is(":checked")&&wdt_dual_event_cap("Job & Training Events","filter-by-medium",t(this).val())})),t('#wdt-training-board input[type="checkbox"][name="duration[]"]').on("change",(function(e){t(this).is(":checked")&&wdt_dual_event_cap("Job & Training Events","filter-by-duration",t(this).val())})),t('#wdt-training-board input[type="checkbox"][name="cost[]"]').on("change",(function(e){t(this).is(":checked")&&wdt_dual_event_cap("Job & Training Events","filter-by-cost",t(this).val())})),t('#wdt-training-board input[type="checkbox"][name="credential[]"]').on("change",(function(e){t(this).is(":checked")&&wdt_dual_event_cap("Job & Training Events","filter-by-credential",t(this).val())})),jQuery("#wdt-training-board-search-field").on("change",(function(e){wdt_dual_event_cap("Job & Training Events","search",t(this).val())})),t(".wdt-training-board-advanced-search-fieldset-field").find('input[type="checkbox"]').on("change",(function(t){})),t(".wdt-training-board-advanced-search-fieldset-open").on("click",(function(e){t(this).next(".wdt-training-board-advanced-search-fieldset-fields").slideToggle()})),t("#wdt-training-board-open-mobile-menu").on("click",(function(e){t("#wdt-training-board").addClass("mobile-filter-view"),t(".wdt-training-board-mobile-section").removeClass("mobile-collapsed")})),t("#wdt-training-board-close-mobile-menu").on("click",(function(e){t("#wdt-training-board").removeClass("mobile-filter-view"),setTimeout((function(){t(".wdt-training-board-mobile-section").addClass("mobile-collapsed")}),500)})),t('[data-action="wdt-training-post-card"] a, [data-action="wdt-training-post-card"] button').on("click",(function(t){e.set(t.originalEvent,!0)})),t('[data-action="wdt-training-post-card"]').on("click",(function(a){e.get(a.originalEvent)||t(this).find('[data-target="wdt-training-opp-link"]')[0].click()}))})),jQuery(document).ready((function(t){"use strict";t('#wdt-print-page-btns [data-action="print"]').on("click",(function(t){window.print()})),t('#wdt-print-page-btns [data-action="cancel"]').on("click",(function(t){window.close()}))})),jQuery((function(t){"use strict";t("body").on("wdtrb:cover-letter-preview",(function(e){let a=e._previewLink;if(Math.max(document.documentElement.clientWidth||0,window.innerWidth||0)<1200)window.open(a,"_blank");else{let e='<svg width="25px" height="25px" version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><path d="m96.328 0.0039062c-0.13672 0.0039062-0.26953 0.015625-0.39844 0.035156l0.019531-0.0039063h-28.105-0.050781c-1.9727 0-3.5703 1.5977-3.5703 3.5703 0 1.9727 1.5977 3.5703 3.5703 3.5703h0.054687 19.934l-22.461 22.461c-0.64453 0.64844-1.0391 1.5352-1.0391 2.5195 0 1.9727 1.6016 3.5703 3.5703 3.5703 0.98047 0 1.8711-0.39844 2.5156-1.0391l22.461-22.461v19.934 0.050782c0 1.9727 1.5977 3.5703 3.5703 3.5703 1.9727 0 3.5703-1.5977 3.5703-3.5703v-0.054688 0.003906-28.117c0.019531-0.14062 0.03125-0.30469 0.03125-0.47266 0-1.9727-1.5977-3.5703-3.5703-3.5703-0.035157 0-0.070313 
10-0.10547 0.0039062h0.007812zm-92.781 64.227c-1.9492 0.03125-3.5195 1.6172-3.5195 3.5703v0.054688-0.003907 28.555 0.007812 0.007813c0 0.10156 0.0078124 0.20703 0.015625 0.30469l-0.0039063-0.015624c0.0039063 0.027343 0.0039063 0.042968 0.0039063 0.058593v-0.011719c0.0078124 0.10547 0.023437 0.19531 0.039062 0.28906l-0.0039062-0.023437c0.0078125 0.054687 0.015625 0.089843 0.023437 0.12109l-0.0039058-0.023437c0.074219 0.34766 0.19141 0.65625 0.33984 0.9375l-0.007812-0.019532c0.023437 0.046876 0.039062 0.070313 0.054687 0.097657l-0.007813-0.019531c0.054688 0.09375 0.097657 0.16797 0.14844 0.24219l-0.007812-0.011719c0.023437 0.039063 0.039062 0.058594 0.054687 0.082032l-0.007813-0.011719c0.19922 0.28516 0.42969 0.53125 0.6875 0.74219l0.007813 0.007813c0.007813 0.007812 0.019531 0.019531 0.03125 0.027343l0.003906 0.003907c0.58203 0.46094 1.3203 0.74219 2.1211 0.76172h0.003906 0.039063 0.042968 28.551 0.050781c1.9727 0 3.5703-1.5977 3.5703-3.5703s-1.5977-3.5703-3.5703-3.5703h-0.054687-19.93l22.457-22.461c0.66406-0.64844 1.0781-1.5547 1.0781-2.5547 0-1.9727-1.5977-3.5703-3.5703-3.5703-0.035156 0-0.070313 0-0.10547 0.003906h0.007813c-0.96094 0.027344-1.8281 0.43359-2.4531 1.0742l-22.461 22.465v-19.938-0.046875c0-1.9727-1.6016-3.5703-3.5703-3.5703h-0.054687 0.003906z" fill="#666"/></svg>',o='<svg width="25px" height="25px" version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><path d="m84.699 15.301c-1.8008-1.8008-4.6016-1.8008-6.3984 0l-28.301 28.301-28.301-28.301c-1.8008-1.8008-4.6016-1.8008-6.3984 0-1.8008 1.8008-1.8008 4.6016 0 6.3984l28.301 28.301-28.301 28.301c-1.8008 1.8008-1.8008 4.6016 0 6.3984 0.89844 0.89844 2 1.3008 3.1992 1.3008s2.3008-0.39844 3.1992-1.3008l28.301-28.301 28.301 28.301c0.89844 0.89844 2 1.3008 3.1992 1.3008s2.3008-0.39844 3.1992-1.3008c1.8008-1.8008 1.8008-4.6016 0-6.3984l-28.301-28.301 28.301-28.301c1.6992-1.8008 1.6992-4.5977 0-6.3984z" fill="#666"/></svg>';t("body").append('<div data-target="wdt-cover-letter-builder-modal" class="wdt-cover-letter-builder-modal-container wdt-cover-letter-builder-preview-modal"><button class="wdt-cover-letter-builder-modal-close" data-action="close-modal" data-target="close-modal-button">Close Modal</button><div data-modal-target="wdt-cover-letter-builder-modal-item" class="wdt-cover-letter-builder-modal-preview-container"><div class="wdt-cover-letter-builder-modal-preview-buttons" ><button title="Open preview in a new tab." data-action="open-cover-letter-preview-new-tab" class="wdt-cover-letter-builder-modal-preview-btn">'+e+'</button><button title="Close preview modal." data-action="close-modal" class="wdt-cover-letter-builder-modal-preview-btn">'+o+'</button></div><object data-modal-target="wdt-cover-letter-builder-modal-preview-object" class="wdt-cover-letter-preview-object" data="'+a+'" type="application/pdf"></object></div></div>'),t("body").addClass("wdt-modal-open")}})),t(document).on("click",'[data-target="wdt-cover-letter-builder-modal"] [data-action="cancel"]',(function(e){t(this).parents('[data-target="wdt-cover-letter-builder-modal"]').first().click()})),t(document).on("click",'[data-target="wdt-cover-letter-builder-modal"] [data-action="close-modal"]',(function(e){t(this).parents('[data-target="wdt-cover-letter-builder-modal"]').first().click()})),t(document).on("click",'[data-target="wdt-cover-letter-builder-modal"] [data-action="open-cover-letter-preview-new-tab"]',(function(e){e.preventDefault();let a=t(this).parents('[data-target="wdt-cover-letter-builder-modal"]').first(),o=t(a).find('[data-modal-target="wdt-cover-letter-builder-modal-preview-object"]');if(o.length){let e=t(o).attr("data");e&&window.open(e,"_blank")}})),t(document).on("click",'[data-target="wdt-cover-letter-builder-modal"]',(function(e){t("body").removeClass("wdt-modal-open"),t(this).remove()})),t(document).on("click",'[data-target="wdt-cover-letter-builder-modal"] [data-modal-target="wdt-cover-letter-builder-modal-item"]',(function(t){t.stopPropagation()}))})),jQuery((t=>{"use strict";t(".wdt-view-switcher").length&&(t(".wdt-view-switcher-toggle").on("click",(e=>{t(".wdt-view-switcher-inner").slideToggle(300),t(".wdt-view-switcher-toggle").toggleClass("closed")})),t(".wdt-view-switcher-form").on("submit",(e=>{e.preventDefault();let a=t("#wdt-view-switcher-view").val(),o=t("#wdt-view-switcher-search").val();a&&(a=a.replace("{{ query }}",o).replace(" ","+"),window.location.href=a)})))})),jQuery(document).ready((function(){"use strict";jQuery(".wfwe-sourcedata-link").on("click",(function(t){t.preventDefault(),jQuery(this).closest(".wfwe-sourcedata-header").next(".wfwe-sourcedata-content").slideToggle("fast")}))}));const portalRoot=document.getElementById("wdt-portal");function wdtAcceptCompanySuggestion(t,e,a,o,r){jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/companies/accept/",data:{nonce:o,object_slug:t,suggester_id:e,action:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully accepted suggestion.","success",3e3),r(!0)):(wdtDisplayNotification("Error accepting suggestion.","error",-1),r(!1))},error:function(t){console.log(t),wdtDisplayNotification("Error accepting suggestion.","error",-1),r(!1)}})}function wdtDeclineCompanySuggestion(t,e,a,o){jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/companies/decline/",data:{nonce:a,object_slug:t,suggester_id:e},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully declined 
1suggestion.","success",3e3),o(!0)):(wdtDisplayNotification("Error declining suggestion.","error",-1),o(!1))},error:function(t){console.log(t),wdtDisplayNotification("Error declining suggestion.","error",-1),o(!1)}})}function wdtAcceptOccupationSuggestion(t,e,a,o,r){jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/occupations/accept/",data:{nonce:o,object_slug:t,suggester_id:e,action:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully accepted suggestion.","success",3e3),r(!0)):(wdtDisplayNotification("Error accepting suggestion.","error",-1),r(!1))},error:function(t){console.log(t),wdtDisplayNotification("Error accepting suggestion.","error",-1),r(!1)}})}function wdtDeclineOccupationSuggestion(t,e,a,o){jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/occupations/decline/",data:{nonce:a,object_slug:t,suggester_id:e},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully declined suggestion.","success",3e3),o(!0)):(wdtDisplayNotification("Error declining suggestion.","error",-1),o(!1))},error:function(t){console.log(t),wdtDisplayNotification("Error declining suggestion.","error",-1),o(!1)}})}function wdtAcceptIndustrySuggestion(t,e,a,o,r){jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/industries/accept/",data:{nonce:o,object_slug:t,suggester_id:e,action:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully accepted suggestion.","success",3e3),r(!0)):(wdtDisplayNotification("Error accepting suggestion.","error",-1),r(!1))},error:function(t){console.log(t),wdtDisplayNotification("Error accepting suggestion.","error",-1),r(!1)}})}function wdtDeclineIndustrySuggestion(t,e,a,o){jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/industries/decline/",data:{nonce:a,object_slug:t,suggester_id:e},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully declined suggestion.","success",3e3),o(!0)):(wdtDisplayNotification("Error declining suggestion.","error",-1),o(!1))},error:function(t){console.log(t),wdtDisplayNotification("Error declining suggestion.","error",-1),o(!1)}})}function wdtAcceptSkillSuggestion(t,e,a,o,r){jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/skills/accept/",data:{nonce:o,object_slug:t,suggester_id:e,action:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully accepted skill suggestion.","success",3e3),r(!0)):(wdtDisplayNotification("Error accepting skill suggestion.","error",-1),r(!1))},error:function(t){console.log(t),wdtDisplayNotification("Error accepting skill suggestion.","error",-1),r(!1)}})}function wdtDeclineSkillSuggestion(t,e,a,o){jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/skills/decline/",data:{nonce:a,object_slug:t,suggester_id:e},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully declined skill suggestion.","success",3e3),o(!0)):(wdtDisplayNotification("Error declining skill suggestion.","error",-1),o(!1))},error:function(t){console.log(t),wdtDisplayNotification("Error declining skill suggestion.","error",-1),o(!1)}})}function wdtAddOccupationToDashboard(t,e,a){jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/occupations/dashboard/",data:{nonce:e,object_slug:t},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully added occupation post to dashboard.","success",3e3),a(!0)):(wdtDisplayNotification(t.message,"error",-1),a(!1))},error:function(t){console.log(t),wdtDisplayNotification("Error removing occupation post from dashboard.","error",-1),a(!1)}})}function wdtRemoveOccupationFromDashboard(t,e,a){jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/occupations/undashboard/",data:{nonce:e,object_slug:t},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully removed occupation post to dashboard.","success",3e3),a(!0)):(wdtDisplayNotification(t.message,"error",-1),a(!1))},error:function(t){console.log(t),wdtDisplayNotification("Error removing occupation post from dashboard.","error",-1),a(!1)}})}function wdtAddIndustryToDashboard(t,e,a){jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/industries/dashboard/",data:{nonce:e,object_slug:t},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully added industry post to dashboard.","success",3e3),a(!0)):(wdtDisplayNotification(t.message,"error",-1),a(!1))},error:function(t){console.log(t),wdtDisplayNotification("Error removing industry post from dashboard.","error",-1),a(!1)}})}function wdtRemoveIndustryFromDashboard(t,e,a){jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/industries/undashboard/",data:{nonce:e,object_slug:t},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully removed industry post to dashboard.","success",3e3),a(!0)):(wdtDisplayNotification(t.message,"error",-1),a(!1))},error:function(t){console.log(t),wdtDisplayNotification("Error removing industry post from dashboard.","error",-1),a(!1)}})}function wdtAddCompanyToDashboard(t,e,a){jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/companies/dashboard/",data:{nonce:e,object_slug:t},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully added company post to dashboard.","success",3e3),a(!0)):(wdtDisplayNotification(t.message,"error",-1),a(!1))},error:function(t){console.log(t),wdtDisplayNotification("Error removing company post from dashboard.","error",-1),a(!1)}})}function wdtRemoveCompanyFromDashboard(t,e,a){jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/companies/undashboard/",data:{nonce:e,object_slug:t},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully removed company post to dashboard.","success",3e3),a(!0)):(wdtDisplayNotification(t.message,"error",-1),a(!1))},error:function(t){console.log(t),wdtDisplayNotification("Error removing company post from dashboard.","error",-1),a(!1)}})}function wdtFollowOccupationPost(t,e,a){jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/occupations/follow/",data:{nonce:e,object_slug:t},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully followed occupation.","success",3e3),a(!0)):(wdtDisplayNotification("Error saving occupation.","error",-1),a(!1))},error:function(t){console.log(t),wdtDisplayNotification("Error saving occupation.","error",-1),a(!1)}})}function wdtUnfollowOccupationPost(t,e,a){jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/occupations/unfollow/",data:{nonce:e,object_slug:t},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully unsaved occupation post.","success",3e3),a(!0)):(wdtDisplayNotification("Error unsaving occupation post.","error",-1),a(!1))},error:function(t){console.log(t),wdtDisplayNotification("Error unsaving occupation post.","error",-1),a(!1)}})}function wdtFollowJobPost(t,e,a){jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/jobs/follow/",data:{nonce:e,object_slug:t},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully saved job.","success",3e3),wdtAnnounce("Successfully saved job"),a(!0)):(wdtDisplayNotification("Error saving job.","error",-1),wdtAnnounce("Error saving job"),a(!1))},error:function(t){console.log(t),wdtDisplayNotification("Error saving job.","error",-1),wdtAnnounce("Error saving job"),a(!1)}})}function wdtUnfollowJobPost(t,e,a){jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/jobs/unfollow/",data:{nonce:e,object_slug:t},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully unsaved job post.","success",3e3),a(!0)):(wdtDisplayNotification("Error unsaving job post.","error",-1),a(!1))},error:function(t){console.log(t),wdtDisplayNotification("Error unsaving job post.","error",-1),a(!1)}})}function wdtFollowIndustryPost(t,e,a){jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/industries/follow/",data:{nonce:e,object_slug:t},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully followed industry.","success",3e3),a(!0)):(wdtDisplayNotification("Error saving industry.","error",-1),a(!1))},error:function(t){console.log(t),wdtDisplayNotification("Error saving industry.","error",-1),a(!1)}})}function wdtUnfollowIndustryPost(t,e,a){jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/industries/unfollow/",data:{nonce:e,object_slug:t},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully unsaved industry post.","success",3e3),a(!0)):(wdtDisplayNotification("Error unsaving industry post.","error",-1),a(!1))},error:function(t){console.log(t),wdtDisplayNotification("Error unsaving industry post.","error",-1),a(!1)}})}function wdtFollowCompanyPost(t,e,a){jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/companies/follow/",data:{nonce:e,object_slug:t},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully followed company.","success",3e3),a(!0)):(wdtDisplayNotification("Error saving company.","error",-1),a(!1))},error:function(t){console.log(t),wdtDisplayNotification("Error saving company.","error",-1),a(!1)}})}function wdtUnfollowCompanyPost(t,e,a){jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/companies/unfollow/",data:{nonce:e,object_slug:t},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully unfollowed company.","success",3e3),a(!0)):(wdtDisplayNotification("Error unsaving company post.","error",-1),a(!1))},error:function(t){console.log(t),wdtDisplayNotification("Error unsaving company post.","error",-1),a(!1)}})}function wdtChangeJobPostStatus(t,e,a,o){jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/jobs/status/",data:{nonce:a,object_slug:t,status:e},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully saved job.","success",3e3),o(!0)):(wdtDisplayNotification("Error saving job.","error",-1),o(!1))},error:function(t){console.log(t),wdtDisplayNotification("Error saving job.","error",-1),o(!1)}})}function wdtNewsletterSignupSubmit(t,e){var a=jQuery;let o=a('form[data-form-id="'+e+'"]'),r=a(o).attr("data-submit-url"),n=a(o).data("widget-id");grecaptcha.reset(n);let i=a(o).serializeArray();i.push({name:"token",value:t}),jQuery.ajax({method:"POST",url:r,data:i,timeout:0,beforeSend:t=>{wdtSetNewsLetterFormLoading(o),t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:t=>
1{t.success?setTimeout((function(){wdtSetNewsletterFormComplete(o),_wdtRenderContentModal("Successfully subscribed.",t.content,"wdt-newsletter-modal")}),750):setTimeout((function(){wdtSetNewsletterFormDefault(o),wdtDisplayNotification("Could not subscribe. Issue: "+t.message,"error",-1)}),750)},error:t=>{t.responseJSON&&"rest_invalid_param"==t.responseJSON.code?setTimeout((function(){wdtSetNewsletterFormDefault(o),wdtDisplayNotification("Could not subscribe, invalid email.","error",-1)}),750):res.message?setTimeout((function(){wdtSetNewsletterFormDefault(o),wdtDisplayNotification("Could not subscribe. Issue: "+res.message,"error",-1)}),750):setTimeout((function(){wdtSetNewsletterFormDefault(o),wdtDisplayNotification("Could not subscribe, bad request.","error",-1)}),750)}})}function wdtSetNewsLetterFormLoading(t){var e=jQuery;e(t).addClass("loading"),e(t).removeClass("complete"),e(t).find(".wdt-jobs-newsletter-signup-email-input").prop("tabindex",-1),e(t).find(".wdt-jobs-newsletter-signup-submit").prop("disabled",!0),e(t).find(".wdt-jobs-newsletter-signup-submit").prop("tabindex",-1)}
1function wdtSetNewsletterFormComplete(t){var e=jQuery;e(t).addClass("complete"),e(t).removeClass("loading"),e(t).find(".wdt-jobs-newsletter-signup-email-input").prop("tabindex",-1),e(t).find(".wdt-jobs-newsletter-signup-submit").prop("disabled",!0),e(t).find(".wdt-jobs-newsletter-signup-submit").prop("tabindex",-1)}function wdtSetNewsletterFormDefault(t){var e=jQuery;e(t).removeClass("loading"),e(t).removeClass("complete"),e(t).find(".wdt-jobs-newsletter-signup-email-input").prop("tabindex",0),e(t).find(".wdt-jobs-newsletter-signup-submit").prop("disabled",!1),e(t).find(".wdt-jobs-newsletter-signup-submit").prop("tabindex",0)}function wdtIsValidPhoneNumber(t){let e=String(t||"").trim();if(!e)return!0;if(/[^\d\s().+-]/.test(e))return!1;let a=e.replace(/\D/g,"");return 10===a.length||11===a.length&&"1"===a.charAt(0)}function wdtValidatePhoneInput(t){return!t||(wdtIsValidPhoneNumber(t.value)?(t.setCustomValidity(""),!0):(t.setCustomValidity("Please enter a valid phone number (e.g. 416-555-1234)"),t.reportValidity(),!1))}function wdtFormatPhoneNumber(t,e){if(!t)return t;let a=String(t),o=String(e||"").trim(),r=a.match(/(?:ext\.?|x)\s*(\d+)\s*$/i);r&&(""===o&&(o=r[1]),a=a.slice(0,a.length-r[0].length));let n,i=a.replace(/\D/g,"");if(10===i.length)n="("+i.slice(0,3)+") "+i.slice(3,6)+"-"+i.slice(6);else{if(11!==i.length||"1"!==i.charAt(0))return""!==o?a.trim()+" x"+o:t;n="+1 ("+i.slice(1,4)+") "+i.slice(4,7)+"-"+i.slice(7)}return""!==o?n+" x"+o:n}function wdtReadTypeaheadSelection(t){var e=jQuery,a=e(t).find("select").val();return a?{value:a,label:e(t).find('select option[value="'+a+'"]').first().text()}:null}function wdtSyncEmployerNoteTaskFields(t,e,a){var o=jQuery,r=o(t).find('[data-target="task-form-inner"]').first();if(r.length&&o(e).length){var n=o(e).find('[name="relatedClientId"]').first(),i=parseInt(n.val()),s=r.find('[data-task-form-target="client-select"]'),d=r.find('[data-task-form-target="service-provider-select"]');void 0===r.data("wdtDefaultProvider")&&r.data("wdtDefaultProvider",wdtReadTypeaheadSelection(d));var l=r.data("wdtDefaultProvider");if(!i||i<=0){if(s.trigger("wdt:undisable"),d.trigger("wdt:undisable"),s.trigger("wdt-clearall"),(d.find("select").val()||"")!==(l?l.value:"")&&(d.trigger("wdt-clearall"),l)){var c=o.Event("wdt:select");c.value=l.value,c.label=l.label,d.trigger(c)}}else{var p=n.find("option[selected]").first().text()||n.closest(".wdt-ajax-select-container").find(".wdt-ajax-select-input-tag-text").first().text();o.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/employer-case-notes/client-service-provider",data:{employerId:a,clientId:i},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){if(t.success&&t.body&&t.body.slug){d.find("select").trigger("wdt:undisable"),d.trigger("wdt-clearall");var e=o.Event("wdt:select");e.value=t.body.slug,e.label=t.body.label,d.trigger(e),d.trigger("wdt:disable")}u()},error:function(){u()}})}}function u(){s.find("select").trigger("wdt:undisable"),s.trigger("wdt-clearall");var t=o.Event("wdt:select");t.value=i,t.label=p,s.trigger(t),s.trigger("wdt:disable")}}function resolveAllInvisRecaptchas(t){if(!(t instanceof Element))return Promise.reject(new Error("resolveAllInvisRecaptchas: rootEl must be a DOM Element."));const e=Array.from(t.querySelectorAll('[data-field-type="captcha"][data-invis]'));return 0===e.length?Promise.resolve():Promise.all(e.map(waitForInvisField)).then((()=>{}))}function waitForInvisField(t){return new Promise(((e,a)=>{if(!(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement))return void a(new Error("waitForInvisField: fieldEl must be an input/textarea element."));if(t.value)return void e(t.value);const o=t.getAttribute("data-widget-id"),r=Number(o);if(!Number.isFinite(r))return void a(new Error("Invisible reCAPTCHA is not initialized (missing/invalid data-widget-id)."));if(!window.grecaptcha||"function"!=typeof window.grecaptcha.execute)return void a(new Error("reCAPTCHA is not available (script blocked or not loaded)."));const n=o=>{const r=o?.detail?.token||t.value;r?e(r):a(new Error("reCAPTCHA resolved event fired but token is empty."))};t.addEventListener("wdt:reCaptchaResolved",n,{once:!0});try{"function"==typeof window.grecaptcha.ready?window.grecaptcha.ready((()=>window.grecaptcha.execute(r))):window.grecaptcha.execute(r)}catch(e){t.removeEventListener("wdt:reCaptchaResolved",n),a(e instanceof Error?e:new Error(String(e)))}}))}function wdtSerializeMaterialForm(t){let e=jQuery,a={};return e(t).find("[name]").each((function(t){let o=e(this).attr("type"),r=e(this).attr("data-field-type"),n=e(this).attr("name");a[n]||(a[n]=[]);let i=e(this).val();"checkbox"!==o&&"radio"!==o||e(this).is(":checked")||(i=null);let s=i,d=null;switch(r){case"checkbox":case"radio":let t=e(this)[0];t.labels&&t.labels.length&&(s=t.labels[0].textContent.trim());break;case"combobox":d=e(this).parents('[data-target="wdt-form-select-combobox-container"]').first(),s=e(d).find('[data-target="wdt-form-select-combobox-text"]').text().trim();break;case"typeahead-select":d=e(this).parents('[data-wdt-material-form-target="typeahead-select-container"]').first();let o=[];i&&!Array.isArray(i)?o=[i]:Array.isArray(i)&&i.length&&(o=i);for(let t of o){let o=e(d).find('select option[value="'+t+'"]').text().trim();a[n].push({label:o,value:t})}return!0}i&&("string"==typeof i||i instanceof String)&&a[n].push({label:s,value:i})})),a}function wdtRecaptchaInit(){jQuery('input[data-field-type="captcha"]').trigger("wdt:initialize")}portalRoot&&function(){const t=new WeakMap;function e(e){if(!e||t.has(e))return;const a=()=>{const t=e.getBoundingClientRect();e.style.height=Math.max(0,window.innerHeight-t.top)+"px"};a(),window.addEventListener("resize",a,{passive:!0}),window.addEventListener("orientationchange",a,{passive:!0}),document.fonts?.ready&&document.fonts.ready.then(a);const o=new ResizeObserver(a);o.observe(document.body),t.set(e,(()=>{window.removeEventListener("resize",a),window.removeEventListener("orientationchange",a),o.disconnect()}))}document.addEventListener("DOMContentLoaded",(function(){document.querySelectorAll("[fill-portal-viewport]").forEach(e)}));new MutationObserver((t=>{t.forEach((t=>
1{t.addedNodes.forEach((t=>{1===t.nodeType&&(t.hasAttribute?.("fill-portal-viewport")&&e(t),t.querySelectorAll?.("[fill-portal-viewport]").forEach(e))}))}))})).observe(portalRoot,{childList:!0,subtree:!0})}(),jQuery((function(t){"use strict";var e=new WeakMap;function a(t,e){for(var a=0;a<t.length;)t[a]===e?t.splice(a,1):++a;return t}t('[data-action="click-inner-job-link"] a, [data-action="click-inner-job-link"] button').on("click",(function(t){e.set(t.originalEvent,!0)})),t('[data-action="click-inner-job-link"]').on("click",(function(a){e.get(a.originalEvent)||t(this).find('[data-target="wdt-job-posting-link"]')[0].click()})),t(document).on("click",'[data-action="wdt-portal-dropdown-menu-toggle"]',(function(e){e.preventDefault(),e.stopPropagation();let a=t(this).parents('[data-target="wdt-portal-dropdown-menu-container"]').first().find('[data-target="wdt-portal-dropdown-menu"]');if(!t(this).attr("aria-controls")){let e="wdt-dropdown-menu-"+Math.random().toString(36).slice(2,9);a.attr("id",e),t(this).attr("aria-controls",e)}let o="true"==t(a).attr("data-visible");t('[data-target="wdt-portal-dropdown-menu"]').hide(),t('[data-target="wdt-portal-dropdown-menu"]').attr("data-visible","false"),o?(t(this).attr("aria-expanded","false"),t(a).attr("data-visible","false"),t(a).hide()):(t(this).attr("aria-expanded","true"),t(a).attr("data-visible","true"),t(a).show())})),t(document).on("click",(function(e){t('[data-target="wdt-portal-dropdown-menu"]').hide(),t('[data-target="wdt-portal-dropdown-menu"]').attr("data-visible","false"),t('[data-action="wdt-portal-dropdown-menu-toggle"]').attr("aria-expanded","false")})),t('[wdt-report-target="date-range"],[wdt-dashboard-target="date-range"]').on("change",(function(e){wfwe_setCookie("wdt_dashboard_date_range_val",t(this).val(),1)})),t('[wdt-report-url-update][wdt-report-target="date-range"]').on("change",(function(e){let a=t(this).val(),o=new URL(window.location);o.searchParams.set("wdt_dashboard_date_range",encodeURIComponent(a)),history.replaceState({},"",o.toString())})),t(document).on("click",'[data-target="wdt-portal-dashboard-table"] tbody tr',(function(e){t(this).find('[data-clickable-row-target="true"]').length&&"true"!==t(e.target).attr("data-clickable-row-target")&&(t(this).find('[data-clickable-row-target="true"]')[0].click(),e.preventDefault(),e.stopPropagation())})),t(document).on("click",'[data-collapsable-table="true"] tbody tr',(function(e){"td"!==e.target.tagName.toLowerCase()&&"tr"!=e.target.tagName.toLowerCase()||t(this).toggleClass("open")})),t(document).on("wdt:collapsableTableInit",'[data-collapsable-table="true"]',(function(e){if(t(this).find(".wdt-portal-table-collapsable-column").length){let e=t(this).find(".wdt-portal-table-collapsable-column").first().siblings("td:not( .wdt-portal-table-collapsable-column ):not( .wdt-portal-table-mobile-hide )").length;t(this).find(".wdt-portal-table-collapsable-column").css("grid-column","1/"+e)}})),t('[data-collapsable-table="true"]').each((function(e){t(this).trigger("wdt:collapsableTableInit")})),t(document).on("wdt:portalHiredForm","#wdt-portal",(function(e){let a=e._post_hash,o=e._reminder;t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/html/job-update/",data:{post_hash:a,reminder:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success&&_wdtRenderContentModal(t.title,t.html,"wdt-portal-modal")},error:function(t){console.log(t)}})})),t(document).on("submit",'form[data-portal-target="wdt-portal-new-job-hire-form"]',(function(e){e.preventDefault();let a=t(this).serializeArray();t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/profile/occupation/",data:a,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success&&wdtDisplayNotification("Successfully updated occupation details.","success",3e3)},error:function(t){wdtDisplayNotification("Could not update occupation details.","error",-1),console.log(t)}}),wdtForceRemoveContentModal()})),t(document).on("click",'form[data-portal-target="wdt-portal-new-job-hire-form"] [data-target="wdt-portal-new-job-hired-skip-btn"]',(function(t){wdtForceRemoveContentModal()})),t(document).on("change",'[data-widget="wdt-saved-jobs-widget"] input[name="saved-job-status"], #wdt-portal-following-job-posts input[name="saved-job-status"]',(function(e){let a=t(this).val(),o=t(this).attr("data-post-slug"),r=t(this).attr("data-nonce");wdtChangeJobPostStatus(o,a,r,(function(e){if("_wdt-user-hired-job-hash"===a){let e=t.Event("wdt:portalHiredForm");e._post_hash=o,e._reminder=!1,t("#wdt-portal").trigger(e)}}))})),t('*[data-action="wdt-job-portal-signup-link"]').on("click",(function(e){if(e.preventDefault(),WDT.portal_registration){let e=WDT.portal_registration.links?WDT.portal_registration.links:[];if(e.length>1){const a=t(this);let o=WDT.portal_registration.description,r="";for(let t of e)r+='<a class="wdt-signup-modal-button" href="'+t.link+'">'+t.description+"</a>";let n='<div class="wdt-signup-modal" aria-label="Sign Up"><h2 class="wdt-signup-modal-title">Tell us a little about you</h2><div class="wdt-signup-modal-btns">';n+=r,n+='</div><p class="wdt-signup-modal-body">'+o+"</p></div>",_wdtRenderContentModal("",n),window.wdtActiveContentModal&&(wdtActiveContentModal.afterDestroyCallback=function(){a[0].focus()})}else 1==e.length?window.location.href=e[0].link:window.location.href=WDT.portal_registration.default_registration}})),t(document).on("change",'input[data-action="toggle-task-complete"]',(function(e){let a=t(this).prop("checked"),o=t(this).attr("data-object-slug");t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/case-tasks/complete/",data:{complete:a,case_task_slug:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){if(t.success){let t="Successfully completed task.";a||(t="Successfully uncompleted task."),wdtDisplayNotification(t,"success",3e3)}else wdtDisplayNotification("Encountered an error updating task completion status.","error",3e3)},error:function(t){wdtDisplayNotification("Encountered an error updating task completion status.","error",3e3),console.log(t)}})})),t("#wdt-portal-company-lookup").on("wdt:ajaxresult",(function(e){let a=e.resultObj,o=t(this).parents(".wdt-ajax-select-container ").first(),r=t(o).find(".wdt-ajax-select-search-results-result:not(.invalid-result)").length,n=t('<li class="wdt-ajax-select-search-results-result" id="wdt-ajax-select-search-results-result-'+r+'" aria-selected="false" role="option" data-value="'+a.value+'"><span data-target="wdt-company-follow" id="company-follow-lookup-term-'+
1a.post_id+'" class="'+a.class+'" data-button-type="icon" data-object-slug="'+a.id+'" data-post-id="'+a.post_id+'" data-nonce="'+a.nonce+'" data-action="'+a.action+'" data-value="'+a.value+'"><p class="ajax-select-follow-text">'+a.text+"</p></span></li>");t(o).find(".wdt-ajax-select-search-results").append(n),e.preventDefault()})),t("#wdt-portal-company-lookup").on("wdt:beforeselect",(function(e){let a=e.selected,o=t(this).parents(".wdt-ajax-select-container ").first(),r=t(o).find('.wdt-ajax-select-search-results-result[data-value="'+a.value+'"]>span').first();t(r).trigger("wdt:handleFollow"),e.preventDefault()})),t(document).on("click",'button[data-target="wdt-company-follow"]',(function(e){e.stopPropagation(),t(this).trigger("wdt:handleFollow")})),t(document).on("wdt:followed",'[data-target="wdt-company-follow"]',(function(e){"icon"==t(this).data("button-type")?(t(this).removeClass("not-following"),t(this).addClass("following")):t(this).find('[data-target="button-label"]').length?t(this).find('[data-target="button-label"]').first().text("Unfollow Company"):t(this).text("Unfollow Company"),t(this).data("action","wdt_company_unfollow")})),t(document).on("wdt:unfollowed",'[data-target="wdt-company-follow"]',(function(e){"icon"==t(this).data("button-type")?(t(this).removeClass("following"),t(this).addClass("not-following")):t(this).find('[data-target="button-label"]').length?t(this).find('[data-target="button-label"]').first().text("Follow Company"):t(this).text("Follow Company"),t(this).data("action","wdt_company_follow")})),t(document).on("wdt:handleFollow",'[data-target="wdt-company-follow"]',(function(e){e.stopPropagation();var a=t(this).data("action"),o=t(this).data("nonce"),r=t(this).data("object-slug");t(this).data("post-name");let n=t('[data-target="wdt-company-follow"][data-object-slug="'+r+'"]'),i=this;"wdt_company_follow"==a?wdtFollowCompanyPost(r,o,(function(e){e&&(n.each((function(e){t(this).trigger("wdt:followed")})),t(i).trigger("wdt:originFollowed"))})):wdtUnfollowCompanyPost(r,o,(function(e){e&&(n.each((function(e){t(this).trigger("wdt:unfollowed")})),t(i).trigger("wdt:originUnfollowed"))}))})),t("#wdt-portal-follow-industry-lookup").on("wdt:ajaxresult",(function(e){let a=e.resultObj,o=t(this).parents(".wdt-ajax-select-container ").first(),r=t(o).find(".wdt-ajax-select-search-results-result:not(.invalid-result)").length,n=t('<li class="wdt-ajax-select-search-results-result" id="wdt-ajax-select-search-results-result-'+r+'" aria-selected="false" role="option" data-value="'+a.value+'"><span data-target="wdt-industry-follow" id="industry-follow-lookup-term-'+a.post_id+'" class="'+a.class+'" data-button-type="icon" data-object-slug="'+a.id+'" data-post-id="'+a.post_id+'" data-nonce="'+a.nonce+'" data-action="'+a.action+'" data-value="'+a.value+'"><p class="ajax-select-follow-text">'+a.text+"</p></span></li>");
1t(o).find(".wdt-ajax-select-search-results").append(n),e.preventDefault()})),t("#wdt-portal-follow-industry-lookup").on("wdt:beforeselect",(function(e){let a=e.selected,o=t(this).parents(".wdt-ajax-select-container ").first(),r=t(o).find('.wdt-ajax-select-search-results-result[data-value="'+a.value+'"]>span').first();t(r).trigger("wdt:handleFollow"),e.preventDefault()})),t(document).on("click",'button[data-target="wdt-industry-follow"]',(function(e){e.stopPropagation(),t(this).trigger("wdt:handleFollow")})),t(document).on("wdt:followed",'[data-target="wdt-industry-follow"]',(function(e){"icon"==t(this).data("button-type")?(t(this).removeClass("not-following"),t(this).addClass("following")):t(this).find('[data-target="button-label"]').length?t(this).find('[data-target="button-label"]').first().text("Unfollow Sector"):t(this).text("Unfollow Sector"),t(this).data("action","wdt_industry_unfollow")})),t(document).on("wdt:unfollowed",'button[data-target="wdt-industry-follow"]',(function(e){"icon"==t(this).data("button-type")?(t(this).removeClass("following"),t(this).addClass("not-following")):t(this).find('[data-target="button-label"]').length?t(this).find('[data-target="button-label"]').first().text("Follow Sector"):t(this).text("Follow Sector"),t(this).data("action","wdt_industry_follow")})),t(document).on("wdt:handleFollow",'[data-target="wdt-industry-follow"]',(function(e){e.stopPropagation();let a=this;var o=t(this).data("action"),r=t(this).data("nonce"),n=t(this).data("object-slug");t(this).data("post-name");let i=t('[data-target="wdt-industry-follow"][data-object-slug="'+n+'"]');"wdt_industry_follow"==o?wdtFollowIndustryPost(n,r,(function(e){e&&(i.each((function(e){t(this).trigger("wdt:followed")})),t(a).trigger("wdt:originFollowed"))})):wdtUnfollowIndustryPost(n,r,(function(e){e&&(i.each((function(e){t(this).trigger("wdt:unfollowed")})),t(a).trigger("wdt:originUnfollowed"))}))})),t("#wdt-portal-follow-occupation-lookup").on("wdt:ajaxresult",(function(e){let a=e.resultObj,o=t(this).parents(".wdt-ajax-select-container ").first(),r=t(o).find(".wdt-ajax-select-search-results-result:not(.invalid-result)").length,n=t('<li class="wdt-ajax-select-search-results-result" id="wdt-ajax-select-search-results-result-'+r+'" aria-selected="false" role="option" data-value="'+a.value+'"><span data-target="wdt-occupation-follow" id="occupation-follow-lookup-term-'+a.post_id+'" class="'+a.class+'" data-button-type="icon" data-object-slug="'+a.id+'" data-post-id="'+a.post_id+'" data-nonce="'+a.nonce+'" data-action="'+a.action+'" data-value="'+a.value+'"><p class="ajax-select-follow-text">'+a.text+"</p></span></li>");
1t(o).find(".wdt-ajax-select-search-results").append(n),e.preventDefault()})),t("#wdt-portal-follow-occupation-lookup").on("wdt:beforeselect",(function(e){let a=e.selected,o=t(this).parents(".wdt-ajax-select-container ").first(),r=t(o).find('.wdt-ajax-select-search-results-result[data-value="'+a.value+'"]>span').first();t(r).trigger("wdt:handleFollow"),e.preventDefault()})),t(document).on("click",'button[data-target="wdt-occupation-follow"]',(function(e){e.stopPropagation(),t(this).trigger("wdt:handleFollow")})),t(document).on("wdt:followed",'[data-target="wdt-occupation-follow"]',(function(e){console.log(this),"icon"==t(this).data("button-type")?(t(this).removeClass("not-following"),t(this).addClass("following")):t(this).text("Unfollow Occupation"),t(this).data("action","wdt_occupation_unfollow")})),t(document).on("wdt:unfollowed",'[data-target="wdt-occupation-follow"]',(function(e){"icon"==t(this).data("button-type")?(t(this).removeClass("following"),t(this).addClass("not-following")):t(this).text("Follow Occupation"),t(this).data("action","wdt_occupation_follow")})),t(document).on("wdt:handleFollow",'[data-target="wdt-occupation-follow"]',(function(e){e.stopPropagation();let a=this;var o=t(this).data("action"),r=t(this).data("nonce"),n=t(this).data("object-slug");t(this).data("post-name");let i=t('[data-target="wdt-occupation-follow"][data-object-slug="'+n+'"]');"wdt_occupation_follow"==o?wdtFollowOccupationPost(n,r,(function(e){e&&(i.each((function(e){t(this).trigger("wdt:followed")})),t(a).trigger("wdt:originFollowed"))})):wdtUnfollowOccupationPost(n,r,(function(e){e&&(i.each((function(e){t(this).trigger("wdt:unfollowed")})),t(a).trigger("wdt:originUnfollowed"))}))})),t(document).on("click",'[data-action="wdt-follow-job-post"]',(function(e){let a=this,o=t(this).attr("data-nonce"),r=t(this).attr("data-object-slug");t(a).prop("disabled",!0),wdtFollowJobPost(r,o,(function(e){t(a).prop("disabled",!1),e&&t(a).trigger("wdt:followed-job")}))})),t(document).on("click",'[data-action="wdt-unfollow-job-post"]',(function(e){let a=this,o=t(this).attr("data-nonce"),r=t(this).attr("data-object-slug");t(a).prop("disabled",!0),wdtUnfollowJobPost(r,o,(function(e){t(a).prop("disabled",!1),e&&t(a).trigger("wdt:unfollowed-job")}))})),t(document).on("change",'[name="wdt-show-occupation-on-dashboard"]',(function(e){let a=t(this).attr("data-nonce"),o=t(this).is(":checked"),r=t(this).val(),n=this;o?wdtAddOccupationToDashboard(r,a,(function(e){e||t(n).prop("checked",!o)})):wdtRemoveOccupationFromDashboard(r,a,(function(e){e||t(n).prop("checked",!o)}))})),t(document).on('[name="wdt-show-company-on-dashboard"]',"change",(function(e){let a=t(this).attr("data-nonce"),o=t(this).is(":checked"),r=t(this).val(),n=this;o?wdtAddCompanyToDashboard(r,a,(function(e){e||t(n).prop("checked",!o)})):wdtRemoveCompanyFromDashboard(r,a,(function(e){e||t(n).prop("checked",!o)}))})),t(document).on("change",'[name="wdt-show-industry-on-dashboard"]',(function(e){let a=t(this).attr("data-nonce"),o=t(this).is(":checked"),r=t(this).val(),n=this;o?wdtAddIndustryToDashboard(r,a,(function(e){e||t(n).prop("checked",!o)})):wdtRemoveIndustryFromDashboard(r,a,(function(e){e||t(n).prop("checked",!o)}))})),t(document).on("click",'.wdt-skill[data-action="wdt_skill_add"],.wdt-skill[data-action="wdt_skill_remove"]',(function(e){!function(e,o,r,n){if(!e||!o||!r)return e||console.log("no action"),o||console.log("no nonce"),void(r||console.log("no object slug"));if(t('.wdt-skill[data-object-slug="'+r+'"]').each((function(a){"wdt_skill_add"==e?(t(this).attr("data-action","wdt_skill_remove"),t(this).addClass("wdt-user-has-skill")):(t(this).attr("data-action","wdt_skill_add"),t(this).removeClass("wdt-user-has-skill"))})),"undefined"!=typeof radarChartArr)for(let t of radarChartArr){if("wdt_skill_add"==e){let e=t.post_skills;for(let a in e)if(e.hasOwnProperty(a)&&e[a].includes(r)){t.match_skills[a].push(r);break}}else{let e=t.match_skills;for(let t in e)e.hasOwnProperty(t)&&e[t].includes(r)&&a(e[t],r)}let o=[];for(let e in t.match_skills)o.push(t.match_skills[e].length);
1t.data.datasets.forEach((t=>{"Your Skills"==t.label&&(t.data=o)})),t.update()}"function"==typeof wdt_dual_event_cap&&wdt_dual_event_cap("portal","toggle-skill",r);let i=WDT.rest_url+"wedatatools/v1/portal/skills/follow/";"wdt_skill_remove"===e&&(i=WDT.rest_url+"wedatatools/v1/portal/skills/unfollow/");jQuery.ajax({type:"POST",url:i,data:{nonce:o,object_slug:r},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success&&("wdt_skill_add"==e?wdtDisplayNotification(n+" has been added to your profile.","success"):wdtDisplayNotification(n+" has been removed from your profile.","success"))},error:function(t){"wdt_skill_add"==e?wdtDisplayNotification("Error adding skill "+n,"error",7500):wdtDisplayNotification("Error removing skill "+n,"error",7500),console.log(t)}})}(t(this).attr("data-action"),t(this).attr("data-nonce"),t(this).attr("data-object-slug"),t(this).text())})),t(".wdt-skill-library-lookup").on("wdt:ajaxresult",(function(e){let a=e.resultObj,o=t(this).parents(".wdt-ajax-select-container ").first(),r=t(o).find(".wdt-ajax-select-search-results-result:not(.invalid-result)").length,n=t('<li class="wdt-ajax-select-search-results-result" id="wdt-ajax-select-search-results-result-'+r+'" aria-selected="false" role="option" data-value="'+a.value+'"><span id="skill-library-lookup-term-'+a.term_slug+'" class="'+a.class+'" data-button-type="icon" data-object-slug="'+a.term_slug+'" data-nonce="'+a.nonce+'" data-action="'+a.action+'" data-value="'+a.value+'"><p class="skill-text">'+a.text+"</p></span></li>");
1t(o).find(".wdt-ajax-select-search-results").append(n),e.preventDefault()})),t(".wdt-skill-library-lookup").on("wdt:beforeselect",(function(t){t.preventDefault()})),t("#wdt-portal[data-hired-reminder]").each((function(e){let a=t.Event("wdt:portalHiredForm");a._post_hash=t(this).attr("data-hired-reminder"),a._reminder=!0,t(this).trigger(a)}))})),jQuery((function(t){"use strict";t("body").on("wdtrb:resume-preview",(function(t){let e=t._previewLink;if(Math.max(document.documentElement.clientWidth||0,window.innerWidth||0)<1200)window.open(e,"_blank");else{let a='<svg width="25px" height="25px" version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><path d="m96.328 0.0039062c-0.13672 0.0039062-0.26953 0.015625-0.39844 0.035156l0.019531-0.0039063h-28.105-0.050781c-1.9727 0-3.5703 1.5977-3.5703 3.5703 0 1.9727 1.5977 3.5703 3.5703 3.5703h0.054687 19.934l-22.461 22.461c-0.64453 0.64844-1.0391 1.5352-1.0391 2.5195 0 1.9727 1.6016 3.5703 3.5703 3.5703 0.98047 0 1.8711-0.39844 2.5156-1.0391l22.461-22.461v19.934 0.050782c0 1.9727 1.5977 3.5703 3.5703 3.5703 1.9727 0 3.5703-1.5977 3.5703-3.5703v-0.054688 0.003906-28.117c0.019531-0.14062 0.03125-0.30469 0.03125-0.47266 0-1.9727-1.5977-3.5703-3.5703-3.5703-0.035157 0-0.070313 0-0.10547 0.0039062h0.007812zm-92.781 64.227c-1.9492 0.03125-3.5195 1.6172-3.5195 3.5703v0.054688-0.003907 28.555 0.007812 0.007813c0 0.10156 0.0078124 0.20703 0.015625 0.30469l-0.0039063-0.015624c0.0039063 0.027343 0.0039063 0.042968 0.0039063 0.058593v-0.011719c0.0078124 0.10547 0.023437 0.19531 0.039062 0.28906l-0.0039062-0.023437c0.0078125 0.054687 0.015625 0.089843 0.023437 0.12109l-0.0039058-0.023437c0.074219 0.34766 0.19141 0.65625 0.33984 0.9375l-0.007812-0.019532c0.023437 0.046876 0.039062 0.070313 0.054687 0.097657l-0.007813-0.019531c0.054688 0.09375 0.097657 0.16797 0.14844 0.24219l-0.007812-0.011719c0.023437 0.039063 0.039062 0.058594 0.054687 0.082032l-0.007813-0.011719c0.19922 0.28516 0.42969 0.53125 0.6875 0.74219l0.007813 0.007813c0.007813 0.007812 0.019531 0.019531 0.03125 0.027343l0.003906 0.003907c0.58203 0.46094 1.3203 0.74219 2.1211 0.76172h0.003906 0.039063 0.042968 28.551 0.050781c1.9727 0 3.5703-1.5977 3.5703-3.5703s-1.5977-3.5703-3.5703-3.5703h-0.054687-19.93l22.457-22.461c0.66406-0.64844 1.0781-1.5547 1.0781-2.5547 0-1.9727-1.5977-3.5703-3.5703-3.5703-0.035156 0-0.070313 0-0.10547 0.003906h0.007813c-0.96094 0.027344-1.8281 0.43359-2.4531 1.0742l-22.461 22.465v-19.938-0.046875c0-1.9727-1.6016-3.5703-3.5703-3.5703h-0.054687 0.003906z" fill="#666"/></svg>',o=document.createElement("div");o.classList.add("wdt-resume-builder-modal-preview-container"),o.innerHTML='<div class="wdt-resume-builder-modal-preview-buttons"><button title="Open preview in a new tab." data-action="open-resume-preview-new-tab" class="wdt-resume-builder-modal-preview-btn">'+a+'</button></div><object data-modal-target="wdt-resume-builder-modal-preview-object" class="wdt-resume-preview-object" data="'+e+'" type="application/pdf"></object>',wdtRenderContentModal({className:"wdt-resume-builder-2-modal wdt-resume-builder-preview-modal wdt-portal-modal",id:"wdt-resume-builder-modal-instance",closeable:!0}),wdtActiveContentModal.contentNode.appendChild(o),wdtActiveContentModal.focusFirstFocusableElement(),wdtActiveContentModal.setFocusAfterCloseElement(t._triggerElement)}})),t(document).on("click",'.wdt-resume-builder-2-modal [data-action="cancel"], .wdt-resume-builder-2-modal [data-action="close-modal"]',(function(t){wdtForceRemoveContentModal()})),t(document).on("click",'.wdt-resume-builder-2-modal [data-action="open-resume-preview-new-tab"]',(function(e){e.preventDefault();let a=t(this).closest(".wdt-resume-builder-2-modal"),o=t(a).find('[data-modal-target="wdt-resume-builder-modal-preview-object"]');if(o.length){let e=t(o).attr("data");e&&window.open(e,"_blank")}}))})),jQuery((function(t){"use strict";t("#wdt-industry-search").on("keyup",(function(e){var a=t(this).val().toLowerCase().trim();e.keyCode>=48&&e.keyCode<=57||e.keyCode>=65&&e.keyCode<=90||e.keyCode>=97&&e.keyCode,a.length>=3?t("#wdt-industry-search-results").find(".wdt-preview-panel").each((function(){var e=t(this).text().toLowerCase().trim(),o=t(this).children("a").data("alt-titles"),r=t(this),n=o?Array.from(o.split(",")):[e],i=!1,s={};n.push(e);
1try{n.forEach((function(t){if(i=t.trim().toLowerCase().indexOf(a)>=0)throw s}))}catch(t){if(t!==s)throw t}i?r.show():r.hide()})):t(".wdt-preview-panel").show()})),t(".wdt-button[data-action=wdt_industries_selected_industry]").on("click",(e=>{let a=t(e.target).prev().data("noc");a?wfwe_setCookie("wdt_industries_selected_industry",a,365):console.error("Error: Could not perform action. Could not find a NOC")}))})),jQuery(document).ready((function(t){"use strict";t(".wdt-industry-content").each((function(){var e=t(this).text();if(t.trim(e).length>300){var a=e.substring(0,300),o=e.substring(300,t.trim(e).length);t(this).empty().html(a),t(this).append('<button class="wdt-industry-read-more">read more...</button>'),t(this).append('<span class="wdt-industry-more-text">'+o+"</span>")}})),t(".wdt-industry-read-more").click((function(){t(this).siblings(".wdt-industry-more-text").contents().unwrap(),t(this).remove()})),jQuery("#wdt-apply-naics-tags-button").on("click",(function(e){let a=this;t(this).prop("disabled",!0);var o=jQuery("#wdt-apply-naics-tags-tool").data("nonce"),r=[],n=[];jQuery('[name="wdt-apply-naics-tags-company[]"]:checked').each((function(){n.push(jQuery(this).parents("li").first()),r.push(jQuery(this).val())}));var i=jQuery("#wdt-apply-naics-tags-tool").data("naics");t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/employers/employer-mgmt/tag/",data:{"wdt-employer-posting-naics":[i],"post-id[]":r,nonce:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){if(t.success){wdtDisplayNotification("Added tag to the selected companies.","success",3e3);for(let t of n)jQuery(t).slideUp()}else wdtDisplayNotification("Encountered error attempting to add the tag to the selected companies.","error",5e3)},error:function(t){console.log(t),wdtDisplayNotification("Encountered error attempting to add the tag to the selected companies.","error",5e3)},complete:function(){t(a).prop("disabled",!1)}})}))})),jQuery((function(t){if(t("#wdt-skill-demand-report").length>0){var e=!1;t("#wdt-skill-demand-report select").on("change",(function(t){if("function"==typeof wdt_event_cap){wdt_event_cap({t:"Skills Demand Report",ac:"Filter Report",e:"",d:"",na:""})}"function"==typeof trackResearchEvent&&trackResearchEvent("skilldemand|filter-report|")})),t("#wdt-skill-demand-report-form").on("submit",(function(a){if(a.preventDefault(),"function"==typeof wdt_event_cap){wdt_event_cap({t:"Skills Demand Report",ac:"Request Report",e:"",d:"",na:""})}"function"==typeof trackResearchEvent&&trackResearchEvent("skilldemand|request-report|");var o=t("#wdt-skill-demand-report-form").data("nonce"),r=document.getElementById("wdt-skill-demand-report-canvas").getContext("2d");t("#wdt-skill-demand-report-table > tbody").html(""),jQuery("#wdt-skill-demand-report-contents").find(".wdt-spinner-container").fadeIn("fast"),jQuery.ajax({type:"POST",url:WDT.admin_url+"admin-ajax.php",dataType:"json",data:{action:"wdt_get_skill_demand_report_results",nonce:o,start_date:jQuery("#wdt-skill-demand-report-start-date").val(),end_date:jQuery("#wdt-skill-demand-report-end-date").val(),region:jQuery("#wdt-skill-demand-report-region").val(),comparison:jQuery("#wdt-skill-demand-report-comparison").val(),occupations:jQuery("#wdt-skill-demand-report-occupations").val(),sectors:jQuery("#wdt-skill-demand-report-sectors").val()},success:function(a){var o="",n=[],i=[],s=[];if(Object.keys(a.results).forEach((e=>{n.push(e),i.push(a.results[e]),s.push(a.total);var r="";if("relative"==t("#wdt-skill-demand-report-comparison").val()){var d=Math.round(Number(a.results[e])/Number(a.total)*100);r=" of "+a.total+" ("+d+"%)"}o+="<tr><td>"+e+"</td><td>"+a.results[e]+r+"</td></tr>"})),t("#wdt-skill-demand-report-table > tbody").html(o),t("#wdt-skill-demand-report-table").show(),jQuery("#wdt-skill-demand-report-contents").find(".wdt-spinner-container").fadeOut("fast"),chartData={labels:n,datasets:[{label:"Matching Job Posts",backgroundColor:WDT.colors.primary,borderColor:WDT.colors.primary,borderWidth:3,data:i}]},"relative"==t("#wdt-skill-demand-report-comparison").val()){var d={label:"Total Job Posts",backgroundColor:"#cccccc",borderColor:"#cccccc",borderWidth:3,data:s};chartData.datasets.push(d)}
11==e?(skillDemandChart.data=chartData,skillDemandChart.update()):(e=!0,skillDemandChart=new Chart(r,{type:"horizontalBar",data:chartData,options:{maintainAspectRatio:!1,legend:{display:!1},scales:{xAxes:[{stacked:!1,ticks:{suggestedMin:0,beginAtZero:!0,fontSize:12}}],yAxes:[{stacked:!1,ticks:{precision:0,fontSize:12}}]},tooltips:{enabled:!0}}}))},error:function(t){console.log(t)}})}))}})),jQuery(document).ready((function(t){"use strict";if(jQuery("#wdt-job-board-advanced-search-toggle").on("click",(function(t){t.preventDefault(),t.stopPropagation(),jQuery("#wdt-job-board-advanced-search").slideToggle("fast")})),jQuery("#wejobs-filter-skill-type").on("change",(function(t){"function"==typeof wdt_dual_event_cap&&wdt_dual_event_cap("wejobs","filter-by-skill-type",jQuery(this).val())})),jQuery("#wejobs-filter-skill-level").on("change",(function(t){"function"==typeof wdt_dual_event_cap&&wdt_dual_event_cap("wejobs","filter-by-skill-level",jQuery(this).val())})),jQuery("#wejobs-filter-job-type").on("change",(function(t){"function"==typeof wdt_dual_event_cap&&wdt_dual_event_cap("wejobs","filter-by-job-type",jQuery(this).val())})),jQuery("#wejobs-filter-job-duration").on("change",(function(t){"function"==typeof wdt_dual_event_cap&&wdt_dual_event_cap("wejobs","filter-by-job-duration",jQuery(this).val())})),jQuery("#wejobs-filter-job-tag").on("change",(function(t){"function"==typeof wdt_dual_event_cap&&wdt_dual_event_cap("wejobs","filter-by-job-tag",jQuery(this).val())})),jQuery("#wejobs-filter-language").on("change",(function(t){"function"==typeof wdt_dual_event_cap&&wdt_dual_event_cap("wejobs","filter-by-language",jQuery(this).val())})),jQuery("#wejobs-filter-job-location").on("change",(function(t){"function"==typeof wdt_dual_event_cap&&wdt_dual_event_cap("wejobs","filter-by-job-location",jQuery(this).val())})),jQuery("#wejobs-filter-job-industry").on("change",(function(t){"function"==typeof wdt_dual_event_cap&&wdt_dual_event_cap("wejobs","filter-by-job-industry",jQuery(this).val())})),jQuery("#wdt-job-board-search-field").on("change",(function(t){"function"==typeof wdt_dual_event_cap&&wdt_dual_event_cap("wejobs","search",jQuery(this).val())})),t('#wdt-job-post [data-target="auto-redirect"]').length){let e=t('#wdt-job-post [data-target="auto-redirect"] a[data-target="job-link"]');"true"===new URL(window.location).searchParams.get("redirect")&&t(e).length&&t(e).get(0).click()}})),jQuery((function(t){"use strict";t(".wdt-jobs-newsletter-signup").on("submit",(function(e){e.preventDefault();let a=t(this).find("*[required]"),o=!0;if(a.each((function(e){o&&(o=t(this)[0].reportValidity())})),!o)return;let r=t(this).attr("data-form-id"),n=t(this).data("widget-id"),i=grecaptcha.getResponse(n);i?wdtNewsletterSignupSubmit(i,r):grecaptcha.execute(n)}))})),jQuery((function(t){"use strict";t(document).on("click",'button[data-action="wdt-cover-letter-list-item-view"]',(function(e){let a=t(this).attr("data-post-link"),o=t.Event("wdtrb:cover-letter-preview");o._previewLink=a,t("body").trigger(o)})),t(document).on("click",'button[data-action="wdt-cover-letter-list-item-duplicate"]',(function(e){let a=t(this).data("nonce"),o=t(this).data("post_id"),r=t(this),n=r.closest(".wdt-cover-letter-list-item");r.prop("disabled",!0),jQuery.ajax({method:"POST",url:"/wp-json/wedatatools/v1/cover-letter-builder/duplicate/",data:{nonce:a,post_id:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){if(t.success){wdtDisplayNotification("Successfully duplicated cover letter.","success",5e3);const e=n.clone();e.find(".wdt-cover-letter-list-item-title").text(t.new_post_title),e.find(".wdt-cover-letter-list-item-excerpt").text("Created by "+t.creator_name+" · "+t.created_date),e.find('[data-action="wdt-cover-letter-list-item-duplicate"]').data("post_id",t.new_post_id).attr("data-post_id",t.new_post_id).prop("disabled","false"),e.find('[data-action="wdt-cover-letter-list-item-delete"]').data("post_id",t.new_post_id).attr("data-post_id",t.new_post_id),e.find('[data-action="wdt-cover-letter-list-item-edit"]').attr("href",t.new_edit_link),e.find('[data-action="wdt-cover-letter-list-item-view"]').attr("data-post-link",t.new_post_link),n.after(e),wdtAnnounce("Cover letter duplicated: "+t.new_post_title)}else wdtDisplayNotification("Could not duplicate cover letter: "+t.response,"error",-1)},error:function(t){console.log(t),t.responseJSON.response?wdtDisplayNotification("Could not duplicate cover letter: "+t.responseJSON.response,"error",-1):wdtDisplayNotification("Could not duplicate cover letter: error making request.","error",-1)},complete:function(){r.prop("disabled",!1)}})})),t(document).on("click",'button[data-action="wdt-cover-letter-list-item-delete"]',(function(e){let a=t(this).data("nonce"),o=t(this).data("post_id"),r=t(this),n=r.closest(".wdt-cover-letter-list-item");confirm("Are you sure you want to delete this item? Deleted items cannot be recovered.")&&(r.prop("disabled",!0),jQuery.ajax({method:"POST",url:"/wp-json/wedatatools/v1/cover-letter-builder/delete/",data:{nonce:a,post_id:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.success){wdtDisplayNotification("Successfully deleted cover letter.","success",5e3);let e=n.next(".wdt-cover-letter-list-item").find("button").first();e.length||(e=n.prev(".wdt-cover-letter-list-item").find("button").first()),e.length||(e=t(".wdt-portal-client-cover-letters .wdt-button.wdt-primary").first()),n.remove(),e.length&&e.focus(),wdtAnnounce("Cover letter deleted.")}else wdtDisplayNotification("Could not delete cover letter: "+e.response,"error",-1),r.prop("disabled",!1)},error:function(t){console.log(t),t.responseJSON.response?wdtDisplayNotification("Could not delete cover letter: "+t.responseJSON.response,"error",-1):wdtDisplayNotification("Could not delete cover letter: error making request.","error",-1),r.prop("disabled",!1)}}))}))})),jQuery((function(t){"use strict";t('[data-target="wdt-portal-notification-card"] [data-action="wdt-portal-notification-card-mark-read"]').on("click",(function(e){let a=t(this).attr("data-object-id"),o=t(this).parents('[data-target="wdt-portal-notification-card"]').first();jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/notifications/read",data:{notification_id:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success?(t(o).find('[data-target="wdt-portal-notification-card-unread"]').removeClass("wdt-portal-notification-card-unread"),t(o).find('[data-target="wdt-portal-notification-card-unread"]').addClass("wdt-portal-notification-card-read")):wdtDisplayNotification("Unable to update read status for notification.","error",-1)},error:function(t){wdtDisplayNotification("Unable to update read status for notification.","error",-1),console.log(t)}})})),t('[data-target="wdt-portal-notification-card"] [data-action="wdt-portal-notification-card-remove"]').on("click",(function(e){let a=t(this).attr("data-object-id"),o=t(this).parents('[data-target="wdt-portal-notification-card"]').first();jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/notifications/remove",data:{notification_id:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success?t(o).slideUp("fast"):wdtDisplayNotification("Unable to remove notification.","error",-1)},error:function(t){wdtDisplayNotification("Unable to remove notification.","error",-1),console.log(t)}})})),t(document).on("wdt:afterOpenForm",'[data-target="wdt-portal-notification-card"] [data-action="create-case-task"]',(function(e){let a=t(this).attr("data-name"),o=t(this).attr("data-staff-id"),r=t(this).attr("data-staff-name"),n=t(this).attr("data-client-id"),i=t(this).attr("data-client-name"),s=t(this).attr("data-client-manageable");if(t('#wdt-task-modal [name="task-name"]').val(a),n>0&&"true"===s){let e=t.Event("wdt:select");e.label=i,e.value=n,t('#wdt-task-modal [name="task-client"]').trigger(e)}if(o>0){let e=t.Event("wdt:select");e.label=r,e.value=o,t('#wdt-task-modal [name="task-assigned"]').trigger(e)}}))})),jQuery((function(t){"use strict";t('button[data-action="wdt-resume-list-item-view"]').on("click",(function(e){let a=t(this).attr("data-post-link"),o=t.Event("wdtrb:resume-preview");o._previewLink=a,o._triggerElement=this,t("body").trigger(o)})),t('button[data-action="wdt-resume-list-item-duplicate"]').on("click",(function(e){let a=t(this).data("nonce"),o=t(this).data("post_id");t(this).prop("disabled",!0),jQuery.ajax({method:"POST",url:"/wp-json/wedatatools/v1/resume-builder/duplicate/",data:{nonce:a,post_id:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully duplicated resume.","success",5e3),location.reload()):wdtDisplayNotification("Could not duplicate resume: "+t.response,"error",-1)},error:function(t){console.log(t),t.responseJSON.response?wdtDisplayNotification("Could not duplicate resume: "+t.responseJSON.response,"error",-1):wdtDisplayNotification("Could not duplicate resume: error making request.","error",-1)},complete:function(){t(this).prop("disabled",!1)}})})),t('button[data-action="wdt-resume-list-item-delete"]').on("click",(function(e){let a=t(this).data("nonce"),o=t(this).data("post_id");confirm("Are you sure you want to delete this item? Deleted items cannot be recovered.")&&(t(this).prop("disabled",!0),jQuery.ajax({method:"POST",url:"/wp-json/wedatatools/v1/resume-builder/delete/",data:{nonce:a,post_id:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully deleted resume.","success",5e3),location.reload()):wdtDisplayNotification("Could not delete resume: "+t.response,"error",-1)},error:function(t){console.log(t),t.responseJSON.response?wdtDisplayNotification("Could not delete resume: "+t.responseJSON.response,"error",-1):wdtDisplayNotification("Could not delete resume: error making request.","error",-1)},complete:function(){t(this).prop("disabled",!1)}}))})),t('button[data-action="wdt-portal-delete-uploaded-resume"]').on("click",(function(e){let a=t(this).attr("data-file-id");confirm("Are you sure you want to delete this item? Deleted items cannot be recovered.")&&(t(this).prop("disabled",!0),jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/files/delete/",data:{fileID:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully deleted resume.","success",5e3),location.reload()):wdtDisplayNotification("Could not delete resume.","error",-1)},error:function(t){wdtDisplayNotification("Could not delete resume.","error",-1)},complete:function(){t(this).prop("disabled",!1)}}))}))})),jQuery((function(t){"use strict";t("#wdt-job-portal-sidebar").length&&(t('#wdt-job-portal-sidebar button[data-action="wdt-open-sidebar-dropdown-links"]').on("click",(function(e){let a=t(this).next('ul[data-target="wdt-sidebar-dropdown-links"]');
1"open"==t(a).attr("data-state")?(t(a).attr("data-state","closed"),t(a).slideUp(150),t(this).siblings(".wdt-sidebar-dropdown-icon").first().removeClass("menu-open"),t(this).attr("aria-expanded","false")):(t(a).attr("data-state","open"),t(a).slideDown(150),t(this).siblings(".wdt-sidebar-dropdown-icon").first().addClass("menu-open"),t(this).attr("aria-expanded","true"))})),t('button[data-action="wdt-portal-toggle-sidebar"]').on("click",(function(e){t(this).toggleClass("active"),t("#wdt-job-portal-sidebar").slideToggle("fast")})),t('#wdt-job-portal-sidebar button[data-action="wdt-open-sidebar-dropdown-links"]').each((function(e){t(this).next('ul[data-target="wdt-sidebar-dropdown-links"]').find(".wdt-sidebar-item.wdt-active").length&&t(this).trigger("click")})),t("#wdt-job-portal-sidebar nav").on("keydown",(function(e){let a=e.key;if("ArrowUp"!==a&&"ArrowDown"!==a&&"Up"!==a&&"Down"!==a)return;let o=t(this).find("a, button").filter((function(){let e=t(this);return!!e.is(":visible")&&(!e.is(":disabled")&&"true"!==e.attr("aria-disabled"))}));if(!o.length)return;e.preventDefault();let r=document.activeElement,n=o.toArray().indexOf(r);-1===n&&(n=0);let i=n;"ArrowUp"===a||"Up"===a?i=Math.max(n-1,0):"ArrowDown"!==a&&"Down"!==a||(i=Math.min(n+1,o.length-1)),t(o.get(i)).trigger("focus")})))})),jQuery((function(t){"use strict";t(document).on("click",'[data-target="wdt-skill-suggestion"] [data-action="wdt-accept-skill-suggestion"]',(function(e){t(this).parents('[data-target="wdt-portal-suggestion-tray"]');let a=t(this).parents('[data-target="wdt-skill-suggestion"]').first(),o=this,r=t(this).data("nonce"),n=t(this).attr("data-object-slug"),i=t(this).data("suggester-id"),s=t(this).data("suggested-action");t(this).prop("disabled",!0),wdtAcceptSkillSuggestion(n,i,s,r,(function(e){t(o).prop("disabled",!1),e&&t(a).trigger("wdt:hideSuggestion")}))})),t(document).on("click",'[data-target="wdt-skill-suggestion"] [data-action="wdt-decline-skill-suggestion"]',(function(e){t(this).parents('[data-target="wdt-portal-suggestion-tray"]');let a=t(this).parents('[data-target="wdt-skill-suggestion"]').first(),o=this,r=t(this).data("nonce"),n=t(this).attr("data-object-slug"),i=t(this).data("suggester-id");t(this).prop("disabled",!0),wdtDeclineSkillSuggestion(n,i,r,(function(e){t(o).prop("disabled",!1),e&&t(a).trigger("wdt:hideSuggestion")}))})),t(document).on("click",'[data-target="wdt-company-suggestion"] [data-action="wdt-accept-company-suggestion"]',(function(e){t(this).parents('[data-target="wdt-portal-suggestion-tray"]');let a=t(this).parents('[data-target="wdt-company-suggestion"]').first(),o=this,r=t(this).data("nonce"),n=t(this).attr("data-object-slug"),i=t(this).data("suggester-id"),s=t(this).data("suggested-action");t(this).prop("disabled",!0),wdtAcceptCompanySuggestion(n,i,s,r,(function(e){if(t(o).prop("disabled",!1),e){t('[data-target="wdt-company-follow"][data-object-slug="'+n+'"]').each((function(e){t(this).trigger("wdt:followed")})),t(o).trigger("wdt:originFollowed"),t(a).trigger("wdt:hideSuggestion")}}))})),t(document).on("click",'[data-target="wdt-company-suggestion"] [data-action="wdt-decline-company-suggestion"]',(function(e){t(this).parents('[data-target="wdt-portal-suggestion-tray"]');let a=t(this).parents('[data-target="wdt-company-suggestion"]').first(),o=this,r=t(this).data("nonce"),n=t(this).attr("data-object-slug"),i=t(this).data("suggester-id");t(this).prop("disabled",!0),wdtDeclineCompanySuggestion(n,i,r,(function(e){t(o).prop("disabled",!1),e&&t(a).trigger("wdt:hideSuggestion")}))})),t(document).on("click",'[data-target="wdt-industry-suggestion"] [data-action="wdt-accept-industry-suggestion"]',(function(e){t(this).parents('[data-target="wdt-portal-suggestion-tray"]');let a=t(this).parents('[data-target="wdt-industry-suggestion"]').first(),o=this,r=t(this).data("nonce"),n=t(this).attr("data-object-slug"),i=t(this).data("suggester-id"),s=t(this).data("suggested-action");t(this).prop("disabled",!0),wdtAcceptIndustrySuggestion(n,i,s,r,(function(e){if(t(o).prop("disabled",!1),e){t('[data-target="wdt-industry-follow"][data-object-slug="'+n+'"]').each((function(e){t(this).trigger("wdt:followed")})),t(o).trigger("wdt:originFollowed"),t(a).trigger("wdt:hideSuggestion")}}))})),t(document).on("click",'[data-target="wdt-industry-suggestion"] [data-action="wdt-decline-industry-suggestion"]',(function(e){t(this).parents('[data-target="wdt-portal-suggestion-tray"]');let a=t(this).parents('[data-target="wdt-industry-suggestion"]').first(),o=this,r=t(this).data("nonce"),n=t(this).attr("data-object-slug"),i=t(this).data("suggester-id");t(this).prop("disabled",!0),wdtDeclineIndustrySuggestion(n,i,r,(function(e){t(o).prop("disabled",!1),e&&t(a).trigger("wdt:hideSuggestion")}))})),t(document).on("click",'[data-target="wdt-occupation-suggestion"] [data-action="wdt-accept-occupation-suggestion"]',(function(e){t(this).parents('[data-target="wdt-portal-suggestion-tray"]');let a=t(this).parents('[data-target="wdt-occupation-suggestion"]').first(),o=this,r=t(this).data("nonce"),n=t(this).attr("data-object-slug"),i=t(this).data("suggester-id"),s=t(this).data("suggested-action");t(this).prop("disabled",!0),wdtAcceptOccupationSuggestion(n,i,s,r,(function(e){if(t(o).prop("disabled",!1),e){t('[data-target="wdt-occupation-follow"][data-object-slug='+n+"]").each((function(e){t(this).trigger("wdt:followed")})),t(o).trigger("wdt:originFollowed"),t(a).trigger("wdt:hideSuggestion")}}))})),t(document).on("click",'[data-target="wdt-occupation-suggestion"] [data-action="wdt-decline-occupation-suggestion"]',(function(e){t(this).parents('[data-target="wdt-portal-suggestion-tray"]');let a=t(this).parents('[data-target="wdt-occupation-suggestion"]').first(),o=this,r=t(this).data("nonce"),n=t(this).attr("data-object-slug"),i=t(this).data("suggester-id");t(this).prop("disabled",!0),wdtDeclineOccupationSuggestion(n,i,r,(function(e){t(o).prop("disabled",!1),e&&t(a).trigger("wdt:hideSuggestion")}))})),t(document).on("wdt:hideSuggestion",'[data-suggestion-tray-target="suggestion"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-suggestion-tray"]');t(this).attr("data-active","false"),t(this).slideUp(200),t(a).trigger("wdt:refreshSuggestionTray")})),t(document).on("wdt:refreshSuggestionTray",'[data-target="wdt-portal-suggestion-tray"]',(function(e){let a=t('[data-suggestion-tray-target="suggestion"]:not([data-active="false"]');console.log(a),a.length||t(this).find('[data-target="wdt-portal-suggestion-tray-no-suggestions"]').show()}))})),jQuery((function(t){"use strict";t("#wdt-case-notes-printable-page #wdt-portal-printable-case-notes-table").each((function(e){t(this).trigger("wdt:refresh"),t("#wdt-case-notes-printable-page #wdt-portal-printable-case-notes-table").on("wdt:ready",(function(e){t(this).trigger("wdt:refresh")}))}
1))})),jQuery(document).ready((function(t){"use strict";t(document).on("click",'[data-target="tagging-rule-container"] [data-action="wdt-portal-term-tagging-rule-form-heading-edit-btn"]',(function(e){let a=t(this).parents('[data-target="tagging-rule-container"]'),o=t(a).find('[data-target="tagging-rule-heading"]'),r=t(a).find('[data-target="tagging-rule-form"]');t('[data-action="create-autotag-rule"]').hide(),t('[data-target="tagging-rule-container"]').parent("li").hide(),t(a).parent("li").show(),t(o).hide(),t(r).show()})),t(document).on("click",'[data-target="tagging-rule-container"] [data-target="tagging-rule-form"] [data-action="cancel-rule"], [data-target="tagging-rule-container"] [data-target="tagging-rule-form"] [data-action="save-rule"]',(function(e){let a=t(this).parents('[data-target="tagging-rule-container"]'),o=t(a).find('[data-target="tagging-rule-heading"]'),r=t(a).find('[data-target="tagging-rule-form"]'),n=t(r).find('[name="pattern"]').val(),i=t(r).find('[data-target="wdt-form-select-combobox"]').attr("title");t(a).find('[data-target="task-form-title"]').text(n),t(a).find('[data-target="task-form-type"]').text(i),t('[data-action="create-autotag-rule"]').show(),t('[data-target="tagging-rule-container"]').parent("li").show(),t(o).show(),t(r).hide()})),t(document).on("click",'[data-target="tagging-rule-container"] [data-action="wdt-portal-term-tagging-rule-form-heading-remove-btn"]',(function(e){let a=t(this).parents('[data-target="tagging-rule-container"]');t(a).remove()}))})),jQuery((function(t){"use strict";t(document).on("click",'[data-target="wdt-task-list-item"] [data-action="wdt-task-list-item-expand-content"]',(function(e){let a=this;t(a).prop("disabled",!0);let o=t(a).attr("data-object-slug"),r=t(a).attr("data-nonce"),n=t(a).parents('[data-target="wdt-task-list-item"]').first();t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/case-tasks/description/",data:{object_slug:o,nonce:r},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&(t(n).find('[data-target="wdt-task-list-item-content"]').text(e.description),t(n).find('[data-target="wdt-task-list-item-content"]').slideDown("fast"),t(a).attr("data-action","wdt-task-list-item-collapse-content"),t(a).text("Less"))},error:function(t){console.log(t),wdtDisplayNotification("Error retrieving task description.","error",-1)},complete:function(){t(a).prop("disabled",!1)}})})),t(document).on("click",'[data-target="wdt-task-list-item"] [data-action="wdt-task-list-item-collapse-content"]',(function(e){let a=t(this).parents('[data-target="wdt-task-list-item"]').first();t(a).find('[data-target="wdt-task-list-item-content"]').slideUp("fast"),t(this).attr("data-action","wdt-task-list-item-expand-content"),t(this).text("More")}))})),jQuery((function(t){t(document).on("click",'[data-target="wdt-eap-cams-template"] [data-action="open-cams-template"]',(function(e){let a=t(this).parents('[data-target="wdt-eap-cams-template"]').first(),o=t(a).find('[data-target="wdt-cams-eap-template-content"]').first();t(a).hasClass("wdt-eap-cams-template-open")?(t(a).removeClass("wdt-eap-cams-template-open"),t(o).slideUp("fast")):(t(a).addClass("wdt-eap-cams-template-open"),t(o).slideDown("fast"))})),t(document).on("click",'[data-action="wdt-cams-erfs-toggle"]',(function(e){e.preventDefault();let a=t(this),o="true"===a.attr("aria-expanded"),r=a.attr("aria-controls"),n=t("#"+r);o?(a.attr("aria-expanded","false"),n.attr("hidden","")):(a.attr("aria-expanded","true"),n.removeAttr("hidden"))})),t(document).on("click",'[data-action="view-erfs-sub-goal"]',(function(e){e.preventDefault(),e.stopPropagation();let a=t(this).data("sub-goal-id"),o=t(this).closest('[data-target="wdt-eap-cams-template"]'),r=t(o).find('[data-target="sub-goal-row"][data-sub-goal-id="'+a+'"]').first();r.length&&r.trigger("click")}))})),jQuery((function(t){"use strict";t(document).on("click",'[data-target="sub-goal-row"]',(function(e){e.preventDefault();let a=t(this),o=t(a).next('[data-target="sub-goal-content-row"]'),r=t(o).find("td").html(),n=t(a).closest('[data-target="wdt-eap-cams-template"]'),i=t(n).find('[data-target="wdt-cams-eap-overview"]').first(),s=t(n).find('[data-target="wdt-cams-sub-goal-expanded-view"]').first(),d=t(s).find('[data-target="wdt-cams-sub-goal-expanded-content"]').first(),l=t
1(a).closest("section"),c=l.find('[data-target="wdt-cams-section-body-text"]').first(),p=l.find('[data-action="wdt-cams-back-to-overview"]').first();t(d).html(r),t(i).hide(),t(s).show(),c.hide(),p.show()})),t(document).on("click",'[data-action="wdt-cams-back-to-overview"]',(function(e){e.preventDefault();let a=t(this).closest("section"),o=a.find('[data-target="wdt-cams-sub-goal-expanded-view"]:visible').first(),r=o.closest('[data-target="wdt-eap-cams-template"]').find('[data-target="wdt-cams-eap-overview"]').first(),n=o.find('[data-target="wdt-cams-sub-goal-expanded-content"]').first(),i=a.find('[data-target="wdt-cams-section-body-text"]').first();t(n).html(""),o.hide(),r.show(),t(this).hide(),i.show()})),t(document).on("click",'[data-target="wdt-cams-plan-item-row"] [data-action="wdt-cams-plan-item-expand"]',(function(e){e.preventDefault(),e.stopPropagation();let a=t(this),o=a.closest('[data-target="wdt-cams-plan-item-row"]'),r=o.next('[data-target="wdt-cams-plan-item-content-row"]'),n="true"===o.attr("data-open");o.siblings('[data-target="wdt-cams-plan-item-row"][data-open="true"]').each((function(){let e=t(this);e.attr("data-open","false"),e.find('[data-action="wdt-cams-plan-item-expand"]').attr("aria-expanded","false"),e.next('[data-target="wdt-cams-plan-item-content-row"]').attr("data-visible","false")})),n?(o.attr("data-open","false"),a.attr("aria-expanded","false"),r.attr("data-visible","false")):(o.attr("data-open","true"),a.attr("aria-expanded","true"),r.attr("data-visible","true"))}))})),jQuery((function(t){t(document).on("click",'[data-target="wdt-cams-planned-item-accordion"] [data-action="wdt-cams-planned-item-accordion-expand"]',(function(e){t('[data-target="wdt-cams-planned-item-accordion"]').removeClass("open"),t('[data-target="wdt-cams-planned-item-accordion"] [data-target="wdt-cams-planned-item-accordion-content"]').slideUp("fast");let a=t(this).parents('[data-target="wdt-cams-planned-item-accordion"]').first(),o=t(a).find('[data-target="wdt-cams-planned-item-accordion-content"]');t(o).is(":visible")||(t(a).addClass("open"),t(a).find('[data-target="wdt-cams-planned-item-accordion-content"]').slideDown("fast"))}))})),jQuery(document).ready((function(t){"use strict";var e;t(document).on("click",'#wdt-cams-lookup-form-container button[data-action="request-client-transfer"]',(function(t){e&&e.destroy(),(e=new WDTContentModal("Request Client Transfer","This client is already assigned to another service provider. To complete a transfer, please contact "+WDT.site_title+" and provide them with the client details.","wdt-portal-modal-alt")).render()})),t(document).on("submit","#wdt-cams-lookup-form-container #wdt-cams-lookup-form",(function(e){let a=t(this).parents("#wdt-cams-lookup-form-container").first();e.preventDefault();let o=t(this).find('[name="search"]').val(),r=t(this).find('[name="nonce"]').val();t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/cams/client-lookup/",data:{clientReferenceNumber:o,nonce:r},beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce);let o=t(a).find('template[data-target="spinner"]').clone(!0).html();t(a).find('[data-target="cams-lookup-form-results"]').empty(),t(a).find('[data-target="cams-lookup-form-results"]').append(o)},success:function(e){if(t(a).find('[data-target="cams-lookup-form-results"]').empty(),e.success&&e.client_data){let o=t(t(a).find('template[data-target="result"]').clone(!0).html());if(t(o).find('[data-target="client-title"]').text(e.client_data.ref_number+" - "+e.client_data.first_name+" "+e.client_data.last_name),t(o).find('[data-target="select-client"]').attr("data-cams-ref",e.client_data.ref_number),t(o).find('[data-target="select-client"]').attr("data-first-name",e.client_data.first_name),t(o).find('[data-target="select-client"]').attr("data-last-name",e.client_data.last_name),e.portal_users.length>0){t(o).find('button[data-target="select-client"]').hide();let a=null;for(let t of e.portal_users)if(t.permissions.includes("manage")){a=t;break}if(a){let e=new URL(t(o).find('[data-target="client-link"]').attr("href"));e.searchParams.set("wdt-client",a.id),t(o).find('[data-target="client-link"]').attr("href",e.href),t(o).find('[data-target="client-link"]').show()}else t(o).find('button[data-action="request-client-transfer"]').show()}t(a).find('[data-target="cams-lookup-form-results"]').append(o)}else{let e=t(t(a).find('template[data-target="no-results"]').clone(!0).html());t(e).find('[data-target="wdt-cams-lookup-ref-number"]').text(o),t(a).find('[data-target="cams-lookup-form-results"]').append(e)}},error:function(e){t(a).find('[data-target="cams-lookup-form-results"]').empty(),console.log(e),wdtDisplayNotification("Error looking up CaMS client.","error",-1)},complete:function(){}})}))})),jQuery((function(t){"use strict";t('[data-target="wdt-case-notes-filter-table"] #wdt-portal-case-notes-table').on("wdt:afterRefresh",(function(e){let a=t(this).data("page"),o=t(this).data("max_page");1===a?(t('[data-target="wdt-case-notes-filter-table"] [data-target="wdt-case-notes-filter-table-pagination"] [data-pg-action="first"]').prop("disabled",!0),t('[data-target="wdt-case-notes-filter-table"] [data-target="wdt-case-notes-filter-table-pagination"] [data-pg-action="prev"]').prop("disabled",!0)):(t('[data-target="wdt-case-notes-filter-table"] [data-target="wdt-case-notes-filter-table-pagination"] [data-pg-action="first"]').prop("disabled",!1),t('[data-target="wdt-case-notes-filter-table"] [data-target="wdt-case-notes-filter-table-pagination"] [data-pg-action="prev"]').prop("disabled",!1)),a===o?(t('[data-target="wdt-case-notes-filter-table"] [data-target="wdt-case-notes-filter-table-pagination"] [data-pg-action="next"]').prop("disabled",!0),t('[data-target="wdt-case-notes-filter-table"] [data-target="wdt-case-notes-filter-table-pagination"] [data-pg-action="last"]').prop("disabled",!0)):(t('[data-target="wdt-case-notes-filter-table"] [data-target="wdt-case-notes-filter-table-pagination"] [data-pg-action="next"]').prop("disabled",!1),t('[data-target="wdt-case-notes-filter-table"] [data-target="wdt-case-notes-filter-table-pagination"] [data-pg-action="last"]').prop("disabled",!1))})),t('[data-target="wdt-case-notes-filter-table"] [data-action="wdt-case-notes-filter-table-refresh"]').on("change",(function(e){let a=t(this).parents('[data-target="wdt-case-notes-filter-table"]').first().find("#wdt-portal-case-notes-table"),o=t(this).val();t(a).data("perPage",o),t(a).data("page",1),t(a).trigger("wdt:refresh")})),t('[data-target="wdt-case-notes-filter-table"] [data-target="wdt-case-notes-filter-table-pagination"] [data-pg-action="first"]').on("click",(function(e){let a=t(this).parents('[data-target="wdt-case-notes-filter-table"]').first().find("#wdt-portal-case-notes-table");1!==t(a).data("page")&&(t(a).data("page",1),t(a).trigger("wdt:refresh"))})),t('[data-target="wdt-case-notes-filter-table"] [data-target="wdt-case-notes-filter-table-pagination"] [data-pg-action="prev"]').on("click",(function(e){let a=t(this).parents('[data-target="wdt-case-notes-filter-table"]').first().find("#wdt-portal-case-notes-table"),o=t(
1a).data("page"),r=o-1;r>0&&r!==o&&(t(a).data("page",r),t(a).trigger("wdt:refresh"))})),t('[data-target="wdt-case-notes-filter-table"] [data-target="wdt-case-notes-filter-table-pagination"] [data-pg-action="next"]').on("click",(function(e){let a=t(this).parents('[data-target="wdt-case-notes-filter-table"]').first().find("#wdt-portal-case-notes-table"),o=t(a).data("page"),r=o+1;r<=t(a).data("max_page")&&r!==o&&(t(a).data("page",r),t(a).trigger("wdt:refresh"))})),t('[data-target="wdt-case-notes-filter-table"] [data-target="wdt-case-notes-filter-table-pagination"] [data-pg-action="last"]').on("click",(function(e){let a=t(this).parents('[data-target="wdt-case-notes-filter-table"]').first().find("#wdt-portal-case-notes-table"),o=t(a).data("page"),r=t(a).data("max_page");o!==r&&(t(a).data("page",r),t(a).trigger("wdt:refresh"))})),t('[data-target="wdt-case-notes-filter-table"] #wdt-portal-client-case-notes-search').on("change",(function(e){t('[data-target="wdt-case-notes-filter-table"] #wdt-portal-case-notes-table').data("query",t(this).val()),t('[data-target="wdt-case-notes-filter-table"] #wdt-portal-case-notes-table').trigger("wdt:refresh")})),t('[data-target="wdt-case-notes-filter-table"] #wdt-portal-case-notes-table').each((function(e){t(this).trigger("wdt:refresh"),t('[data-target="wdt-case-notes-filter-table"] #wdt-portal-case-notes-table').on("wdt:ready",(function(e){t(this).trigger("wdt:refresh")}))})),t(document).on("click",'[data-target="wdt-case-notes-filter-table"] [data-action="wdt-portal-client-case-notes-open-filters"]',(function(e){let a=t("#wdt-portal-client-case-notes-filters-form-template #wdt-portal-client-case-notes-filters-form-container");a.detach();let o=t.Event("wdt:populatePanel");o._html=a[0],t('#wdt-portal [data-target="wdt-portal-tipout-panel-right"]').trigger(o),t('#wdt-portal [data-target="wdt-portal-tipout-panel-right"]').trigger("wdt:showPanel"),e.stopPropagation()})),t(document).on("wdt:beforeClearPanel",'#wdt-portal [data-target="wdt-portal-tipout-panel-right"]',(function(e){let a=t(this).find("#wdt-portal-client-case-notes-filters-form-container");t(a).length&&(t(a).detach(),t("#wdt-portal-client-case-notes-filters-form-template").append(t(a[0])))})),t(document).on("change",'#wdt-portal-client-case-notes-filters-form-container [data-target="wdt-portal-case-notes-filters-form"] [data-case-notes-form-field]',(function(e){t(this).parents('[data-target="wdt-portal-case-notes-filters-form"]').trigger("submit")})),t(document).on("submit",'#wdt-portal-client-case-notes-filters-form-container [data-target="wdt-portal-case-notes-filters-form"]',(function(e){e.preventDefault();let a=t('[data-target="wdt-case-notes-filter-table"] #wdt-portal-case-notes-table'),o=t(a).data("filters");o||(o={});let r=[];t(this).find("[name]").each((function(e){r.push(t(this).attr("name"))}));let n=wdtSerializeMaterialForm(t(this));for(let t of r)o[t]=null;for(let t in n){let e=n[t];if(e.length){let a=[];for(let t of e)a.push(t.value);1===a.length?o[t]=a[0]:a.length>1&&(o[t]=a)}}t(a).data("filters",o),t(a).trigger("wdt:refresh")})),t(document).on("wdt:refreshFilterButtons",'[data-target="wdt-case-notes-filter-table"] [data-target="wdt-portal-client-case-notes-filters"]',(function(e){let a="true"===t(this).attr("data-show-all");t(this).find('button[data-action="remove-case-note-filter"]').remove(),t(this).find('button[data-target="remove-all-case-note-filters"]').hide(),t(this).find('button[data-target="show-all-filters"]').hide();let o=wdtSerializeMaterialForm(t('#wdt-portal-client-case-notes-filters-form-container [data-target="wdt-portal-case-notes-filters-form"]')),r=0;for(let e in o)for(let n of o[e]){let o=n.label,i=document.createElement("button");i.innerText=o,i.setAttribute("data-value",n.value),i.setAttribute("data-name",e),i.classList.add("wdt-portal-client-case-notes-filters-btn"),i.classList.add("close-icon"),i.setAttribute("data-action","remove-case-note-filter"),(a||r<3)&&t(i).insertBefore('[data-target="wdt-portal-client-case-notes-filters"] button[data-target="show-all-filters"]'),r++}let n=t('[data-target="wdt-portal-client-case-notes-open-filters"] .wdt-icon-btn-label').text();n=n.split("(").shift().trim(),r>0?(t(this).show(),n=n+" ("+r+")",t(this).find('button[data-target="remove-all-case-note-filters"]').show(),!a&&r>3&&(t(this).find('button[data-target="show-all-filters"]').text(r-3+"+"),t(this).find('button[data-target="show-all-filters"]').show())):t(this).hide(),t('[data-target="wdt-portal-client-case-notes-open-filters"] .wdt-icon-btn-label').text(n)})),t(document).on("click",'[data-target="wdt-portal-client-case-notes-filters"] [data-action="show-all-filters"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-client-case-notes-filters"]').first();t(a).attr("data-show-all","true"),t('[data-target="wdt-case-notes-filter-table"] [data-target="wdt-portal-client-case-notes-filters"]').trigger("wdt:refreshFilterButtons")})),t(document).on("click",'[data-action="remove-all-case-note-filters"]',(function(e){t('[data-target="wdt-case-notes-filter-table"] #wdt-portal-case-notes-table').data("suppress-refresh",!0),t('#wdt-portal #wdt-portal-client-case-notes-filters-form-container [data-target="wdt-portal-case-notes-filters-form"] [name]').each((function(e){let a=t.Event("wdt:clearValue");t(this).trigger(a)})),t('[data-target="wdt-case-notes-filter-table"] #wdt-portal-case-notes-table').data("suppress-refresh",!1),t('#wdt-portal #wdt-portal-client-case-notes-filters-form-container [data-target="wdt-portal-case-notes-filters-form"]').trigger("submit")})),t(document).on("click",'[data-action="remove-case-note-filter"]',(function(e){let a=t(this).attr("data-name"),o=t(this).attr("data-value");t('#wdt-portal #wdt-portal-client-case-notes-filters-form-container [data-target="wdt-portal-case-notes-filters-form"] [name="'+a+'"]').each((function(e){let a=t.Event("wdt:clearValue");a._value=o,t(this).trigger(a)}))})),t(document).on("wdt:refresh",'[data-target="wdt-case-notes-filter-table"] #wdt-portal-case-notes-table',(function(e){t('[data-target="wdt-case-notes-filter-table"] [data-target="wdt-portal-client-case-notes-filters"]').trigger("wdt:refreshFilterButtons")}))})),jQuery(document).ready((function(t){"use strict";let e=null,a=!1;function o(){let a=t("#wdt-portal-training-programs-table-container"),o=t('[data-target="wdt-portal-training-programs-filter-table"]'),i=t("#wdt-portal-training-programs-table"),s=t("#wdt-portal-training-programs-table").attr("data-nonce"),d=new URL(window.location),l=d.searchParams.get("pg"),c=d.searchParams.get("pp")||25,f=d.searchParams.get("query"),{order:g,orderby:m}=function(){if(!t("#wdt-portal-training-programs-table").attr("data-sort"))return{orderby:"title",order:"ASC"};
1let e=t("#wdt-portal-training-programs-table").attr("data-sort").split("-");if(2!==e.length)return{orderby:"title",order:"ASC"};"coursename"===e[0]&&(e[0]="title");return{orderby:e[0],order:e[1]}}(),w={nonce:s,per_page:c,query:f,page:l,order:g,orderby:m,user_id:null!==u()&&0!==u()?u():p(),...function(){if(!t('[data-target="wdt-portal-training-programs-filters-form"]').length)return{};let e={},a=t('select[name="occupations[]"]').val().map((t=>t));if(e.nocs=a,t('input[name="client_occupation_filter"]:checked').length){let a=t('input[name="client_occupation_filter"]:checked').val().split(",");e.nocs&&Array.isArray(e.nocs)||(e.nocs=[]);for(let t of a)e.nocs.push(t)}let o=t('input[name="occupation_groups[]"]:checked').map((function(){return t(this).val()})).toArray();e.nocs=e.nocs.concat(o),e.user_status=[],n()&&e.user_status.push("saved");t("#wdt-portal-training-programs-table").hasClass("showing-recommended-programs")&&e.user_status.push("recommended");let r=t('input[name="status[]"]:checked').map((function(){return t(this).val()})).toArray();for(let t of r)e.user_status.push(t);e.user_status=[...new Set(e.user_status)];for(let t in e)0===e[t].length&&delete e[t];return e}()};for(let t in w)null===w[t]&&delete w[t];e&&e.abort(),e=t.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/training/programs",data:w,beforeSend:function(e){e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),i.find('tbody[data-target="portal-table-body"]').find("td").addClass("wdt-portal-table-body-element-loading"),o.find('[data-target="spinner"]').show(),t('[data-target="wdt-portal-training-programs-filter-table"] [data-target="no-matches-found"]').hide(),t('[data-target="wdt-portal-training-programs-filter-table"] [data-target="result-count-container"]').hide()}}).always((function(){o.find('[data-target="spinner"]').hide()})).error((function(t){"abort"!==t.statusText&&(wdtDisplayNotification("Unable to retrieve training programs. Please contact administrator.","error",-1),console.log(t))})).success((function(e){if(i.find('tbody[data-target="portal-table-body"]').html(""),e.hasOwnProperty("hits")&&Array.isArray(e.hits)){if(e.hits.length)for(let n of e.hits){if(!1===t('.wdt-portal-training-programs-filters-form-descending-fieldset .wdt-material-form-checkbox[name="status[]"]').is(":checked")&&"_wdt-user-ignored-program-id"===n.user_status)continue;let e=t(t(a).find('[data-target="template-table"]').get(0).content).find('[data-target="template-row"]').clone();r(e,n),o.find('tbody[data-target="portal-table-body"]').append(e)}else t('[data-target="wdt-portal-training-programs-filter-table"] [data-target="no-matches-found"]').show();let{total_results:n,current_page:s,max_pages:d}=e.pagination;if(i.data("max_page",e.pagination.max_pages),n?(t('[data-target="wdt-portal-training-programs-filter-table"] [data-target="result-count-container"]').show().find('[data-target="result-count"]').text(wdtNumberFormat(n)),wdtAnnounce(`Courses table updated. ${wdtNumberFormat(n)} results.`)):wdtAnnounce("Courses table updated. No results found."),d>1){let e=t('[data-target="wdt-portal-training-programs-pagination"]');1===s?(e.find('[data-pg-action="first"]').prop("disabled",!0),e.find('[data-pg-action="prev"]').prop("disabled",!0)):(e.find('[data-pg-action="first"]').prop("disabled",!1),e.find('[data-pg-action="prev"]').prop("disabled",!1)),s===d?(e.find('[data-pg-action="next"]').prop("disabled",!0),e.find('[data-pg-action="last"]').prop("disabled",!0)):(e.find('[data-pg-action="next"]').prop("disabled",!1),e.find('[data-pg-action="last"]').prop("disabled",!1))}else t('[data-target="wdt-portal-training-programs-pagination"]').hide()}}))}function r(e,a){e.attr("data-program-id",a.id);let o=t("template#wdt-training-programs-row-options-template").clone(!0).html();o=o.replaceAll("PROGRAM_ID",a.id);let r=a.user_following,i="_wdt-user-ignored-program-id"===a.user_status,s=a.delivery_channel.map((t=>t.toString().replaceAll(" ","-").toLowerCase())).join(" "),d="";Array.isArray(a.suggestions)&&a.suggestions.length>0&&(d=` <span>Recommended by ${a.suggestions.shift().suggester_name}</span>`);let l=`\n            <div>\n                <p class="program-title recommended">${a.title}${d}</p>\n                <div>\n                    <p class="program-delivery-channel ${s}">${a.delivery_channel.join(", ")}</p>\n                    <p class="program-cost">\n                        <svg width="13" height="20" viewBox="0 0 13 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n                            <g clip-path="url(#clip0_50_1329)">\n                                <path d="M6.25006 0C6.94146 0 7.50006 0.558594 7.50006 1.25V2.64453C7.56256 2.65234 7.62115 2.66016 7.68365 2.67188C7.69928 2.67578 7.71099 2.67578 7.72662 2.67969L9.60162 3.02344C10.2813 3.14844 10.7305 3.80078 10.6055 4.47656C10.4805 5.15234 9.82818 5.60547 9.1524 5.48047L7.29693 5.14062C6.07428 4.96094 4.99615 5.08203 4.23834 5.38281C3.48053 5.68359 3.17584 6.09766 3.10553 6.48047C3.0274 6.89844 3.08599 7.13281 3.1524 7.27734C3.22271 7.42969 3.36724 7.60156 3.6524 7.79297C4.28912 8.21094 5.26568 8.48438 6.53131 8.82031L6.64459 8.85156C7.76178 9.14844 9.12896 9.50781 10.1446 10.1719C10.
16993 10.5352 11.2227 11.0273 11.5469 11.7148C11.879 12.4141 11.9493 13.1953 11.7969 14.0273C11.5274 15.5117 10.504 16.5039 9.23443 17.0234C8.69928 17.2422 8.11724 17.3828 7.50006 17.4531V18.7578C7.50006 19.4492 6.94146 20.0078 6.25006 20.0078C5.55865 20.0078 5.00006 19.4492 5.00006 18.7578V17.3945C4.98443 17.3906 4.9649 17.3906 4.94928 17.3867H4.94146C3.98834 17.2383 2.42193 16.8281 1.36724 16.3594C0.738338 16.0781 0.453181 15.3398 0.734431 14.7109C1.01568 14.082 1.75396 13.7969 2.38287 14.0781C3.19928 14.4414 4.54303 14.8008 5.32037 14.9219C6.56646 15.1055 7.59381 15 8.28912 14.7148C8.94928 14.4453 9.25006 14.0547 9.33599 13.5859C9.41021 13.1719 9.35162 12.9336 9.28521 12.7891C9.21099 12.6328 9.06646 12.4609 8.7774 12.2695C8.13678 11.8516 7.15631 11.5781 5.88678 11.2422L5.7774 11.2148C4.66412 10.9102 3.29693 10.5469 2.28131 9.88281C1.72662 9.51953 1.20709 9.02344 0.882869 8.33594C0.554744 7.63672 0.488338 6.85547 0.644588 6.02344C0.925838 4.53125 2.04303 3.5625 3.31256 3.05859C3.83209 2.85156 4.4024 2.71094 5.00006 2.62891V1.25C5.00006 0.558594 5.55865 0 6.25006 0Z" fill="#00448B"/>\n                            </g>\n                            <defs>\n                                <clipPath id="clip0_50_1329">\n                                    <rect width="12.5" height="20" fill="white"/>\n                                </clipPath>\n                            </defs>\n                        </svg>\n\n                        ${a.program_cost}\n                    </p>\n                </div>\n                <p class="program-description">${a.description}</p>`;l+=`<div class="program-meta">\n                    <a href="${a.program_url}" target="_blank" aria-label="View ${a.title} Course Details (Opens in new tab)">Course Details</a>`,WDT.logged_in&&!u()&&(l+=`<button class="toggle-follow ${r?"following":"not-following"}" aria-label="${r?"Unfollow":"Follow"} this training program"><svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4.43591 21.789V4.80392C4.43591 4.18162 4.94096 3.67657 5.56326 3.67657H20.4359C21.0582 3.67657 21.5633 4.18162 21.5633 4.80392V21.7882L13.3106 15.2457L13 14.9994L12.6894 15.2457L4.43591 21.789Z" stroke="#515667"/></svg></button>\n                        <button class="toggle-ignored ${i?"ignored":"not-ignored"}" aria-label="${i?"Unignore":"Ignore"} this training program"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M385.1 419.1L92.9 126.9C64.8 162.3 48 207.2 48 256c0 114.9 93.1 208 208 208c48.8 0 93.7-16.8 129.1-44.9zm33.9-33.9C447.2 349.7 464 304.8 464 256c0-114.9-93.1-208-208-208c-48.8 0-93.7 16.8-129.1 44.9L419.1 385.1zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256z"/></svg></button>`),l+="</div>",WDT.logged_in&&(l+=o),l+="</div>",e.find('[data-column="coursename"]').append(l),"Coursera"===a.institutions[0].title&&"0"===a.program_cost?e.find('[data-column="cost"]').append("\n                <div>\n                    <p>Coursera+ Subscription required</p>\n                </div>\n            "):e.find('[data-column="cost"]').append(`\n                <div>\n                    <p>$${a.program_cost}</p>\n                </div>\n            `),WDT.logged_in&&e.find('[data-column="status"]').append(function(t,e=""){let a="no-status";switch(t){case"_wdt-user-interested-program-id":a="Interested";break;case"_wdt-user-enrolled-program-id":a="Enrolled";break;case"_wdt-user-completed-program-id":a="Completed";break;default:a="no-status"}return n()?`\n                <div>\n                    <div class="status-dropdown-trigger ${a.toString().toLowerCase()}" aria-expanded="false" aria-controls="status-dropdown-${e.toString().replaceAll(" ","-").toLowerCase()}">\n                        <p>${"no-status"===a?"No&nbsp;status":a}</p>\n                    </div>\n                    <div class="status-dropdown" id="status-dropdown-${e.toString().replaceAll(" ","-").toLowerCase()}">\n                        <ul>\n                            <li><button ${"Interested"===a?'class="selected"':""}>Interested</button></li>\n                            <li><button ${"Enrolled"===a?'class="selected"':""}>Enrolled</button></li>\n                            <li><button ${"Completed"===a?'class="selected"':""}>Completed</button></li>\n                        </ul>\n                    </div>\n                </div>\n            `:`\n                <div>\n                    <div class="status-data ${a.toString().toLowerCase()}">\n                        <p>${"no-status"===a?"":a}</p>\n                    </div>\n                </div>\n            `}(a.user_status,a.title));let c=[],p=0;for(let t of a.occupations){if(p>=3)break;t.name&&(c.push(t.name),p++)}e.find('[data-column="occupations"]').append(`\n            <div>\n                <p>${c.join(", ")}</p>\n            </div>\n        `),WDT.logged_in&&e.find('[data-column="options"]').append(o),r&&e.find("button#recommend-training-program").remove()}function n(){return t("#wdt-portal-training-programs-table").hasClass("showing-saved-programs")}
1function i(t){t.attr("aria-expanded","false")}function s(e,a){return new Promise(((o,r)=>{let n=WDT.rest_url+"wedatatools/v1/portal/training-programs/status",i=c(),s=null!==u()&&0!==u()?u():p();t.ajax({url:n,method:"post",dataType:"json",data:{nonce:i,user_id:s,program_id:a,status:e},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)}}).error((t=>{console.log("Error:"),console.log(t),wdtDisplayNotification("Could not update training program status","error",3e3),o(!1)})).success((t=>{if(t.hasOwnProperty("success")&&!0===t.success){o(!0);let t="";switch(e){case"_wdt-user-completed-program-id":t="Successfully completed course";break;case"_wdt-user-enrolled-program-id":t="Successfully enrolled course";break;case"_wdt-user-ignored-program-id":t="Course has been marked as not interested";break;case"_wdt-user-interested-program-id":t="Successfully saved course";break;default:t="Updated training program status"}wdtDisplayNotification(t,"success",3e3)}else wdtDisplayNotification("Could not update training program status","error",3e3),o(!1)}))}))}async function d(e){!0===await s("_wdt-user-interested-program-id",e)&&t(`[data-program-id=${e}] .toggle-follow`).length&&(wdtAnnounce("Saved course"),t(`[data-program-id=${e}] .toggle-follow`).removeClass("not-following").addClass("following"),t(`[data-program-id=${e}] .toggle-ignored.ignored`).length&&t(`[data-program-id=${e}] .toggle-ignored.ignored`).removeClass("ignored").addClass("not-ignored"),t(`[data-program-id=${e}] [data-column="status"] .status-dropdown-trigger`).removeClass("enrolled").removeClass("completed").addClass("interested"),t(`[data-program-id=${e}] [data-column="status"] .status-dropdown-trigger p`).text("Interested"),t(`[data-program-id=${e}] [data-column="status"] .status-dropdown button`).removeClass("selected").filter((function(){return"Interested"===t(this).text().trim()})).addClass("selected"))}function l(e){let a=WDT.rest_url+"wedatatools/v1/portal/training-programs/unfollow",o=c(),r=null!==u()&&0!==u()?u():p();t.ajax({url:a,method:"post",dataType:"json",data:{nonce:o,user_id:r,program_id:e},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)}}).error((t=>{console.log("Error:"),console.log(t),wdtDisplayNotification("Could not update training program status","error",3e3)})).success((a=>{a.hasOwnProperty("success")&&!0===a.success&&t(`[data-program-id=${e}] .toggle-follow`).length&&(t(`[data-program-id=${e}] .toggle-follow`).removeClass("following").addClass("not-following"),t(`[data-program-id=${e}] [data-column="status"] .status-dropdown-trigger`).removeClass("interested").removeClass("completed").removeClass("enrolled"),t(`[data-program-id=${e}] [data-column="status"] .status-dropdown-trigger p`).html("No&nbsp;status"),t(`[data-program-id=${e}] [data-column="status"] .status-dropdown button`).removeClass("selected"),t(`[data-program-id=${e}] .toggle-ignored.ignored`).length?(t(`[data-program-id=${e}] .toggle-ignored.ignored`).removeClass("ignored").addClass("not-ignored"),wdtAnnounce("Removed uninterested status"),wdtDisplayNotification("Successfully removed uninterested status","success",3e3)):(wdtAnnounce("Unsaved course"),wdtDisplayNotification("Successfully unsaved course","success",3e3)))}))}function c(){return t("#wdt-portal-training-programs-table").attr("data-follow-nonce")}function p(){return t("#wdt-portal-training-programs-table").attr("data-user-id")?parseInt(t("#wdt-portal-training-programs-table").attr("data-user-id")):null}function u(){return t("#wdt-portal-training-programs-table").attr("data-client-id")?parseInt(t("#wdt-portal-training-programs-table").attr("data-client-id")):null}t(document).on("click",'[data-column="status"] .status-dropdown button:not(.selected)',(function(){let e=t(this).text(),a=t(this).closest("[data-program-id]").attr("data-program-id");"Interested"===e?d(a):"Enrolled"===e?async function(e){!0===await s("_wdt-user-enrolled-program-id",e)&&t(`[data-program-id=${e}] [data-column="status"]`).length&&(wdtAnnounce("Marked course as enrolled"),t(`[data-program-id=${e}] .toggle-follow`).removeClass("not-following").addClass("following"),t(`[data-
1program-id=${e}] .toggle-ignored.ignored`).length&&t(`[data-program-id=${e}] .toggle-ignored.ignored`).removeClass("ignored").addClass("not-ignored"),t(`[data-program-id=${e}] [data-column="status"] .status-dropdown-trigger`).removeClass("interested").removeClass("completed").addClass("enrolled"),t(`[data-program-id=${e}] [data-column="status"] .status-dropdown-trigger p`).text("Enrolled"),t(`[data-program-id=${e}] [data-column="status"] .status-dropdown button`).removeClass("selected").filter((function(){return"Enrolled"===t(this).text().trim()})).addClass("selected"))}(a):"Completed"===e&&async function(e){!0===await s("_wdt-user-completed-program-id",e)&&t(`[data-program-id=${e}] [data-column="status"]`).length&&(wdtAnnounce("Marked course as completed"),t(`[data-program-id=${e}] .toggle-follow`).removeClass("not-following").addClass("following"),t(`[data-program-id=${e}] .toggle-ignored.ignored`).length&&t(`[data-program-id=${e}] .toggle-ignored.ignored`).removeClass("ignored").addClass("not-ignored"),t(`[data-program-id=${e}] [data-column="status"] .status-dropdown-trigger`).removeClass("interested").removeClass("enrolled").addClass("completed"),t(`[data-program-id=${e}] [data-column="status"] .status-dropdown-trigger p`).text("Completed"),t(`[data-program-id=${e}] [data-column="status"] .status-dropdown button`).removeClass("selected").filter((function(){return"Completed"===t(this).text().trim()})).addClass("selected"))}(a)})),t(document).on("click",'td[data-column="coursename"]',(function(e){let a=t(e.target);if(a.is(".program-meta, .program-meta *, .program-options, .program-options *")){let e=t(this).closest("[data-program-id]").attr("data-program-id");a.is(".program-meta .toggle-follow, .program-meta .toggle-follow *")?(a.closest(".program-meta .toggle-follow").length&&(a=a.closest(".program-meta .toggle-follow")),a.hasClass("not-following")?d(e):a.hasClass("following")&&l(e)):a.is(".program-meta .toggle-ignored, .program-meta .toggle-ignored *")&&(a.closest(".program-meta .toggle-ignored").length&&(a=a.closest(".program-meta .toggle-ignored")),a.hasClass("not-ignored")?async function(e){await s("_wdt-user-ignored-program-id",e)&&(wdtAnnounce("Marked course as not interested"),t(`[data-program-id=${e}] .toggle-ignored`).length&&(t(`[data-program-id=${e}] .toggle-ignored`).removeClass("not-ignored").addClass("ignored"),t(`[data-program-id=${e}] .toggle-follow.following`).length&&t(`[data-program-id=${e}] .toggle-follow.following`).removeClass("following").addClass("not-following"),t(`[data-program-id=${e}] [data-column="status"] .status-dropdown-trigger`).removeClass("interested").removeClass("completed").removeClass("enrolled"),t(`[data-program-id=${e}] [data-column="status"] .status-dropdown-trigger p`).html("No&nbsp;status"),t(`[data-program-id=${e}] [data-column="status"] .status-dropdown button`).removeClass("selected")),t('tr[data-program-id="'+e+'"]').length&&t('tr[data-program-id="'+e+'"]').hide())}(e):a.hasClass("ignored")&&l(e))}else t(this).toggleClass("open")})),t(document).on("click",(function(){t('.status-dropdown-trigger[aria-expanded="true"]').each((function(){i(t(this))}))})),t(document).on("click",'[data-target="wdt-portal-training-programs-filter-table"] button#share-training-program',(function(e){e.stopPropagation(),function(e){let a=t(`[data-program-id=${e}] .program-title`).text(),o=t(`[data-program-id=${e}] .program-meta > a`).attr("href"),r=t("#wdt-portal-training-programs-table").attr("data-site-title");const n=`mailto:?subject=${encodeURIComponent(`Training Program Suggestion: ${a}`)}&body=${encodeURIComponent(`I wanted to share this training program with you that I found on ${r}: ${o}`)}`;window.location.href=n}(t(this).closest("[data-program-id]").attr("data-program-id"))})),t(document).on("click",'[data-target="wdt-portal-training-programs-filter-table"] button#recommend-training-program',(function(e){e.stopPropagation(),function(e){let a=t("#wdt-portal-training-programs-table").attr("data-suggest-nonce"),o=u();t.ajax({url:WDT.rest_url+"wedatatools/v1/portal/suggest/training-program",method:"post",dataType:"json",data:{action:"follow",nonce:a,user_id:o,program_id:e},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)}}).error((t=>{console.log("Error:"),console.log(t)})).success((e=>{e.hasOwnProperty("success")&&!0===e.success?wdtDisplayNotification("Recommended training program to client","success",3e3):wdtDisplayNotification("Could not recommend training program to client","error",3e3),t('[data-target="wdt-portal-training-programs-filter-table"] #wdt-portal-training-programs-table').trigger("wdt:refresh")}))}(t(this).closest("[data-program-id]").attr("data-program-id"))})),t(document).on("click",'[data-target="wdt-portal-training-programs-filter-table"] button#mark-enrolled-training-program',(function(e){e.stopPropagation(),async function(e){await s("_wdt-user-enrolled-program-id",e)&&t('[data-target="wdt-portal-training-programs-filter-table"] #wdt-portal-training-programs-table').trigger("wdt:refresh")}(t(this).closest("[data-program-id]").attr("data-program-id"))})),t(document).on("click",'[data-target="wdt-portal-training-programs-filter-table"] button#mark-completed-training-program',(function(e){e.stopPropagation(),async function(e){await s("_wdt-user-completed-program-id",e)&&t('[data-target="wdt-portal-training-programs-filter-table"] #wdt-portal-training-programs-table').trigger("wdt:refresh")}(t(this).closest("[data-program-id]").attr("data-program-id"))})),t(document).on("click",".status-dropdown-trigger",(function(e){var a;
1e.stopPropagation(),"true"!==(a=t(this)).attr("aria-expanded")?(t('.status-dropdown-trigger[aria-expanded="true"]').each((function(){i(t(this))})),function(t){t.attr("aria-expanded","true")}(a)):i(a)})),t(document).on("click",'[data-target="wdt-portal-training-programs-filters-form"] [data-target="wdt-portal-training-programs-filters-form-section"] [data-target="wdt-portal-training-programs-filters-form-accordion-header"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-training-programs-filters-form"]'),o=t(this).parents('[data-target="wdt-portal-training-programs-filters-form-section"]').find('[data-target="wdt-portal-training-programs-filters-form-collapsable-content"]');"inactive"===o.attr("data-state")?o.trigger("wdt:expand"):o.trigger("wdt:collapse"),0===a.find('[data-target="wdt-portal-training-programs-filters-form-section"] [data-target="wdt-portal-training-programs-filters-form-collapsable-content"]:not([data-state="inactive"])').length?a.find('[data-target="wdt-portal-training-programs-filters-form-collapse-expand-button"]').trigger("wdt:setExpand"):a.find('[data-target="wdt-portal-training-programs-filters-form-collapse-expand-button"]').trigger("wdt:setCollapse")})),t(document).on("wdt:collapse",'[data-target="wdt-portal-training-programs-filters-form-section"] [data-target="wdt-portal-training-programs-filters-form-collapsable-content"]',(function(e){t(this).parents('[data-target="wdt-portal-training-programs-filters-form-section"]').find('[data-target="wdt-portal-training-programs-filters-form-accordion-header"]').attr("data-state","inactive").attr("aria-expanded","false"),t(this).attr("data-state","inactive"),t(this).slideUp("fast")})),t(document).on("wdt:expand",'[data-target="wdt-portal-training-programs-filters-form-section"] [data-target="wdt-portal-training-programs-filters-form-collapsable-content"]',(function(e){t(this).parents('[data-target="wdt-portal-training-programs-filters-form-section"]').find('[data-target="wdt-portal-training-programs-filters-form-accordion-header"]').attr("data-state","active").attr("aria-expanded","true"),t(this).attr("data-state","active"),t(this).slideDown("fast")})),t(document).on("wdt:setCollapse",'[data-target="wdt-portal-training-programs-filters-form-collapse-expand-button"]',(function(e){t(this).attr("data-action","wdt-portal-training-programs-filters-form-collapse-all"),t(this).text("Collapse All"),t(this).attr("aria-label","Collapse all filter groups"),wdtAnnounce("Expanded all filters")})),t(document).on("wdt:setExpand",'[data-target="wdt-portal-training-programs-filters-form-collapse-expand-button"]',(function(e){t(this).attr("data-action","wdt-portal-training-programs-filters-form-expand-all"),t(this).text("Expand All"),t(this).attr("aria-label","Expand all filter groups"),wdtAnnounce("Collapsed all filters")})),t(document).on("click",'[data-target="wdt-portal-training-programs-filters-form"] [data-action="wdt-portal-training-programs-filters-form-collapse-all"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-training-programs-filters-form"]');a.find('[data-target="wdt-portal-training-programs-filters-form-collapsable-content"]').each((function(e){t(this).trigger("wdt:collapse")})),a.find('[data-target="wdt-portal-training-programs-filters-form-collapse-expand-button"]').trigger("wdt:setExpand")})),t(document).on("click",'[data-target="wdt-portal-training-programs-filters-form"] [data-action="wdt-portal-training-programs-filters-form-expand-all"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-training-programs-filters-form"]');a.find('[data-target="wdt-portal-training-programs-filters-form-collapsable-content"]').each((function(e){t(this).trigger("wdt:expand")})),a.find('[data-target="wdt-portal-training-programs-filters-form-collapse-expand-button"]').trigger("wdt:setCollapse")})),t('[data-target="wdt-portal-training-programs-filter-table"] [name="wdt-portal-training-programs-search"]').on("change",(function(e){let a=new URL(window.location),o=t('[data-target="wdt-portal-training-programs-filter-table"] #wdt-portal-training-programs-table'),r=t(this).val();a.searchParams.delete("pg"),a.searchParams.set("query",r),history.replaceState({},"",a.toString()),t(o).trigger("wdt:refresh")})),t(document).on("click",'[data-target="wdt-portal-training-programs-filter-table"] #training-programs-search-button',(function(){let e=new URL(window.location),a=t('[data-target="wdt-portal-training-programs-filter-table"] #wdt-portal-training-programs-table'),o=t('[data-target="wdt-portal-training-programs-filter-table"] [name="wdt-portal-training-programs-search"]').val();e.searchParams.delete("pg"),e.searchParams.set("query",o),history.replaceState({},"",e.toString()),t(a).trigger("wdt:refresh")})),t(document).on("change",'[data-target="wdt-portal-training-programs-filter-table"] #wdt-portal-training-programs-per-page',(function(e){let a=new URL(window.location),o=t('[data-target="wdt-portal-training-programs-filter-table"] #wdt-portal-training-programs-table'),r=t(this).val();a.searchParams.set("pg",1),a.searchParams.set("pp",r),history.replaceState({},"",a.toString()),t(o).trigger("wdt:refresh")})),t('[data-target="wdt-portal-training-programs-pagination"] [data-pg-action="first"]').on("click",(function(e){let a=new URL(window.location),o=t('[data-target="wdt-portal-training-programs-filter-table"] #wdt-portal-training-programs-table'),r=parseInt(a.searchParams.get("pg"));r||(r=1),1!==parseInt(r)&&(a.searchParams.set("pg",1),history.replaceState({},"",a.toString()),t(o).trigger("wdt:refresh"))})),t('[data-target="wdt-portal-training-programs-pagination"] [data-pg-action="prev"]').on("click",(function(e){let a=new URL(window.location),o=t('[data-target="wdt-portal-training-programs-filter-table"] #wdt-portal-training-programs-table'),r=parseInt(a.searchParams.get("pg"));r||(r=1);let n=r-1;n>0&&n!==r&&(a.searchParams.set("pg",n),history.replaceState({},"",a.toString()),t(o).trigger("wdt:refresh"))})),t('[data-target="wdt-portal-training-programs-pagination"] [data-pg-action="next"]').on("click",(function(e){let a=new URL(window.location),o=t('[data-target="wdt-portal-training-programs-filter-table"] #wdt-portal-training-programs-table'),r=parseInt(a.searchParams.get("pg"));r||(r=1);let n=r+1;n<=t(o).data("max_page")&&n!==r&&(a.searchParams.set("pg",n),history.replaceState({},"",a.toString()),t(o).trigger("wdt:refresh"))})),t('[data-target="wdt-portal-training-programs-pagination"] [data-pg-action="last"]').on("click",(function(e){let a=new URL(window.location),o=t('[data-target="wdt-portal-training-programs-filter-table"] #wdt-portal-training-programs-table'),r=parseInt(a.searchParams.get("pg"));r||(r=1);let n=t(o).data("max_page");r!==n&&(a.searchParams.set("pg",n),history.replaceState({},"",a.toString()),t(o).trigger("wdt:refresh"))})),t(document).on("click",'[data-target="wdt-portal-training-programs-filter-table"] [data-action="wdt-portal-training-programs-open-filters"]',(function(e){let a=t("#wdt-portal-training-programs-filters-template #wdt-portal-training-programs-filter-form-container");a.detach();let o=t.Event("wdt:populatePanel");o._html=a[0],t('#wdt-portal [data-target="wdt-portal-tipout-panel-right"]').trigger(o),"false"===t(this).attr("aria-expanded")?(t(this).attr("aria-expanded","true"),t('#
1wdt-portal [data-target="wdt-portal-tipout-panel-right"]').trigger("wdt:showPanel")):(t(this).attr("aria-expanded","false"),t('#wdt-portal [data-target="wdt-portal-tipout-panel-right"]').trigger("wdt:hidePanel")),e.stopPropagation()})),t(document).on("wdt:hidePanel",'#wdt-portal [data-target="wdt-portal-tipout-panel-right"]',(function(){t('[data-target="wdt-portal-training-programs-filter-table"] [data-action="wdt-portal-training-programs-open-filters"]').attr("aria-expanded","false")})),t(document).on("wdt:refreshFilterButtons",'[data-target="wdt-portal-training-programs-filter-table"]',(function(e){let a=t(this).find('[data-target="wdt-portal-training-programs-filters"]'),o="true"===t(a).attr("data-show-all");t(this).find('[data-target="wdt-portal-training-programs-filters"] button[data-action="remove-training-program-filter"]').remove(),t(this).find('[data-target="wdt-portal-training-programs-filters"] button[data-target="remove-all-training-program-filters"]').hide(),t(this).find('[data-target="wdt-portal-training-programs-filters"] button[data-target="show-all-filters"]').hide();let r=wdtSerializeMaterialForm(t('#wdt-portal #wdt-portal-training-programs-filter-form-container [data-target="wdt-portal-training-programs-filters-form"]')),n=0;for(let e in r)for(let a of r[e]){let r=a.label;"client"===e&&(r="Client: "+r),"staff"===e&&(r="Staff: "+r),"date_range"===e&&(r="Date Range: "+r.replace("|"," - "));let i=document.createElement("button");i.innerText=r,i.setAttribute("data-value",a.value),i.setAttribute("data-name",e),i.classList.add("wdt-portal-training-programs-filters-btn"),i.classList.add("close-icon"),i.setAttribute("data-action","remove-training-program-filter"),i.setAttribute("aria-label",`Remove "${r}" filter from table`),(o||n<3)&&t(i).insertBefore('[data-target="wdt-portal-training-programs-filters"] button[data-target="show-all-filters"]'),n++}let i=t('[data-target="wdt-portal-training-programs-open-filters"] .wdt-icon-btn-label').text();i=i.split("(").shift().trim(),n>0?(t(a).show(),i=i+" ("+n+")",t(this).find('[data-target="wdt-portal-training-programs-filters"] button[data-target="remove-all-training-program-filters"]').show(),!o&&n>3&&(t(this).find('[data-target="wdt-portal-training-programs-filters"] button[data-target="show-all-filters"]').text(n-3+"+"),t(this).find('[data-target="wdt-portal-training-programs-filters"] button[data-target="show-all-filters"]').show())):t(a).hide(),t('[data-target="wdt-portal-training-programs-open-filters"] .wdt-icon-btn-label').text(i)})),t(document).on("click",'[data-target="wdt-portal-training-programs-filters"] [data-action="show-all-filters"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-training-programs-filters"]').first();t(a).attr("data-show-all","true"),t('[data-target="wdt-portal-training-programs-filter-table"]').trigger("wdt:refreshFilterButtons")})),t(document).on("click",'[data-action="remove-all-training-program-filters"]',(function(e){a=!0,t('#wdt-portal #wdt-portal-training-programs-filter-form-container [data-target="wdt-portal-training-programs-filters-form"] [name]').each((function(e){let a=t.Event("wdt:clearValue");t(this).trigger(a)})),a=!1,t('[data-target="wdt-portal-training-programs-filter-table"] #wdt-portal-training-programs-table').trigger("wdt:refresh")})),t(document).on("click",'[data-action="remove-training-program-filter"]',(function(e){let a=t(this),o=a.nextAll('[data-action="remove-training-program-filter"]').first(),r=a.prevAll('[data-action="remove-training-program-filter"]').first(),n=t("#wdt-portal-training-programs-search"),i=o.length?o[0]:r.length?r[0]:n[0],s=a.attr("data-name"),d=a.attr("data-value");t('#wdt-portal #wdt-portal-training-programs-filter-form-container [data-target="wdt-portal-training-programs-filters-form"] [name="'+s+'"]').each((function(e){let a=t.Event("wdt:clearValue");a._value=d,t(this).trigger(a)})),setTimeout((()=>i&&i.focus()),0)})),t('[data-target="wdt-portal-training-programs-filter-table"]').trigger("wdt:refreshFilterButtons"),t(document).on("wdt:updateFromTrainingProgramsForm","#wdt-portal-training-programs-filter-form-container",(function(e){let a=[];t(this).find('[data-target="wdt-portal-training-programs-filters-form"] [name]').each((function(e){a.push(t(this).attr("name"))}));let o=wdtSerializeMaterialForm(t(this).find('[data-target="wdt-portal-training-programs-filters-form"]')),r=new 
1URL(window.location);for(let t of a)r.searchParams.delete(t);for(let t in o){let e=o[t];if(e.length)for(let a of e)r.searchParams.append(t,a.value)}history.replaceState({},"",r.toString()),t('[data-target="wdt-portal-training-programs-filter-table"] #wdt-portal-training-programs-table').trigger("wdt:refresh")})),t(document).on("change","#wdt-portal-training-programs-filter-form-container :input[name]",(function(e){let a=t(this).parents("#wdt-portal-training-programs-filter-form-container");t(a).trigger("wdt:updateFromTrainingProgramsForm"),t('[data-target="wdt-portal-training-programs-filter-table"]').trigger("wdt:refreshFilterButtons")})),t(document).on("change",'#wdt-portal-training-programs-filter-form-container [name="occupations[]"]',(function(e){if(t(this).data("suppressed"))return;let a=t(this).parents("#wdt-portal-training-programs-filter-form-container"),o=t(a).find('[data-target="client-occupation-preferences"]').first();if(!t(o).length)return;t(o).data("suppressed",!0);let r=t(a).find('[data-target="client-occupations"]').first(),n=JSON.parse(t(r)[0].textContent),i=t(this).val();if(i&&i.length){let e=!0;for(let t of n)if(!i.includes(t.value)){e=!1;break}t(o).prop("checked",e)}else t(o).prop("checked",!1);t(o).data("suppressed",!1)})),t(document).on("change",'#wdt-portal-training-programs-filter-form-container [data-target="client-occupation-preferences"]',(function(e){if(t(this).data("suppressed"))return;let o=t(this).parents("#wdt-portal-training-programs-filter-form-container"),r=t(o).find('[name="occupations[]"]').first();if(t(r).data("suppressed",!0),t(this).is(":checked")){let e=t(o).find('[data-target="client-occupations"]').first(),n=JSON.parse(t(e)[0].textContent);if(a=!0,t(r).trigger("wdt-clearall"),Array.isArray(n))for(let e of n){let a=t.Event("wdt:select");a.label=e.text,a.value=e.value,t(r).trigger(a)}a=!1,t('[data-target="wdt-portal-training-programs-filter-table"] #wdt-portal-training-programs-table').trigger("wdt:refresh")}else t(r).trigger("wdt-clearall");t(r).data("suppressed",!1)})),t(document).on("wdt:beforeClearPanel",'#wdt-portal [data-target="wdt-portal-tipout-panel-right"]',(function(e){let a=t(this).find("#wdt-portal-training-programs-filter-form-container");t(a).length&&(t(a).detach(),t("#wdt-portal-training-programs-filters-template").append(t(a[0])))})),t('[data-target="wdt-portal-training-programs-filter-table"] #wdt-portal-training-programs-table').on("wdt:tableSort",(function(e){let a=e._columnSlug+"-"+e._sortDir;t(this).attr("data-sort",a),t(this).trigger("wdt:refresh")})),t(document).on("click",'[data-action="wdt-training-programs-tab"]',(function(e){e.preventDefault();let a=t(this).data("page-type"),o=t("#wdt-portal-training-programs-table"),r=new URL(window.location);t('[data-action="wdt-training-programs-tab"]').removeClass("active").removeAttr("aria-current"),t(this).addClass("active").attr("aria-current","page"),wdtAnnounce(`Now showing ${t(this).text().trim()}`),o.removeClass("showing-saved-programs showing-recommended-programs"),"saved-courses"===a?o.addClass("showing-saved-programs"):"recommended-courses"===a&&o.addClass("showing-recommended-programs"),t('[data-target="wdt-portal-training-programs-filter-btn-container"]').toggle(""===a),r.searchParams.delete("pg"),a?r.searchParams.set("wdt-page-type",a):r.searchParams.delete("wdt-page-type"),history.replaceState({},"",r.toString()),o.trigger("wdt:refresh")})),t(document).on("wdt:refresh",'[data-target="wdt-portal-training-programs-filter-table"] #wdt-portal-training-programs-table',(function(t){t.stopPropagation(),a||o()})),t('[data-target="wdt-portal-training-programs-filter-table"] #wdt-portal-training-programs-table').trigger("wdt:refresh")})),jQuery((function(t){"use strict";t("#wdt-portal-client-case-notes #wdt-portal-client-case-notes-search").on("change",(function(e){t("#wdt-portal-client-case-notes #wdt-portal-case-notes-table").data("query",t(this).val()),t("#wdt-portal-client-case-notes #wdt-portal-case-notes-table").trigger("wdt:refresh")})),t("#wdt-portal-client-case-notes #wdt-portal-case-notes-table").each((function(e){t(this).trigger("wdt:refresh"),t("#wdt-portal-client-case-notes #wdt-portal-case-notes-table").on("wdt:ready",(function(e){t(this).trigger("wdt:refresh")}))}
1)),t(document).on("click",'#wdt-portal-client-case-notes [data-action="wdt-portal-client-case-notes-open-filters"]',(function(e){let a=t("#wdt-portal-client-case-notes-filters-form-template #wdt-portal-client-case-notes-filters-form-container");a.detach();let o=t.Event("wdt:populatePanel");o._html=a[0],t('#wdt-portal [data-target="wdt-portal-tipout-panel-right"]').trigger(o),t('#wdt-portal [data-target="wdt-portal-tipout-panel-right"]').trigger("wdt:showPanel"),e.stopPropagation()})),t(document).on("wdt:beforeClearPanel",'#wdt-portal [data-target="wdt-portal-tipout-panel-right"]',(function(e){let a=t(this).find("#wdt-portal-client-case-notes-filters-form-container");t(a).length&&(t(a).detach(),t("#wdt-portal-client-case-notes-filters-form-template").append(t(a[0])))})),t(document).on("change",'#wdt-portal-client-case-notes-filters-form-container [data-target="wdt-portal-case-notes-filters-form"] [data-case-notes-form-field]',(function(e){t(this).parents('[data-target="wdt-portal-case-notes-filters-form"]').trigger("submit")})),t(document).on("submit",'#wdt-portal-client-case-notes-filters-form-container [data-target="wdt-portal-case-notes-filters-form"]',(function(e){e.preventDefault();let a=t("#wdt-portal-client-case-notes #wdt-portal-case-notes-table"),o=t(a).data("filters");o||(o={});let r=[];t(this).find("[name]").each((function(e){r.push(t(this).attr("name"))}));let n=wdtSerializeMaterialForm(t(this));for(let t of r)o[t]=null;for(let t in n){let e=n[t];if(e.length){let a=[];for(let t of e)a.push(t.value);1===a.length?o[t]=a[0]:a.length>1&&(o[t]=a)}}t(a).data("filters",o),t(a).trigger("wdt:refresh")})),t(document).on("wdt:refreshFilterButtons",'#wdt-portal-client-case-notes [data-target="wdt-portal-client-case-notes-filters"]',(function(e){let a="true"===t(this).attr("data-show-all");t(this).find('button[data-action="remove-case-note-filter"]').remove(),t(this).find('button[data-target="remove-all-case-note-filters"]').hide(),t(this).find('button[data-target="show-all-filters"]').hide();let o=wdtSerializeMaterialForm(t('#wdt-portal-client-case-notes-filters-form-container [data-target="wdt-portal-case-notes-filters-form"]')),r=0;for(let e in o)for(let n of o[e]){let o=n.label,i=document.createElement("button");i.innerText=o,i.setAttribute("data-value",n.value),i.setAttribute("data-name",e),i.classList.add("wdt-portal-client-case-notes-filters-btn"),i.classList.add("close-icon"),i.setAttribute("data-action","remove-case-note-filter"),(a||r<3)&&t(i).insertBefore('[data-target="wdt-portal-client-case-notes-filters"] button[data-target="show-all-filters"]'),r++}let n=t('[data-target="wdt-portal-client-case-notes-open-filters"] .wdt-icon-btn-label').text();n=n.split("(").shift().trim(),r>0?(t(this).show(),n=n+" ("+r+")",t(this).find('button[data-target="remove-all-case-note-filters"]').show(),!a&&r>3&&(t(this).find('button[data-target="show-all-filters"]').text(r-3+"+"),t(this).find('button[data-target="show-all-filters"]').show())):t(this).hide(),t('[data-target="wdt-portal-client-case-notes-open-filters"] .wdt-icon-btn-label').text(n)})),t(document).on("click",'[data-target="wdt-portal-client-case-notes-filters"] [data-action="show-all-filters"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-client-case-notes-filters"]').first();t(a).attr("data-show-all","true"),t('#wdt-portal-client-case-notes [data-target="wdt-portal-client-case-notes-filters"]').trigger("wdt:refreshFilterButtons")})),t(document).on("click",'[data-action="remove-all-case-note-filters"]',(function(e){t("#wdt-portal-client-case-notes #wdt-portal-case-notes-table").data("suppress-refresh",!0),t('#wdt-portal #wdt-portal-client-case-notes-filters-form-container [data-target="wdt-portal-case-notes-filters-form"] [name]').each((function(e){let a=t.Event("wdt:clearValue");t(this).trigger(a)})),t("#wdt-portal-client-case-notes #wdt-portal-case-notes-table").data("suppress-refresh",!1),t('#wdt-portal #wdt-portal-client-case-notes-filters-form-container [data-target="wdt-portal-case-notes-filters-form"]').trigger("submit")})),t(document).on("click",'[data-action="remove-case-note-filter"]',(function(e){let a=t(this).attr("data-name"),o=t(this).attr("data-value");t('#wdt-portal #wdt-portal-client-case-notes-filters-form-container [data-target="wdt-portal-case-notes-filters-form"] [name="'+a+'"]').each((function(e){let a=t.Event("wdt:clearValue");a._value=o,t(this).trigger(a)}))})),t(document).on("wdt:refresh","#wdt-portal-client-case-notes #wdt-portal-case-notes-table",(function(e){t('#wdt-portal-client-case-notes [data-target="wdt-portal-client-case-notes-filters"]').trigger("wdt:refreshFilterButtons")}))})),jQuery((function(t){"use strict";t("#wdt-portal-client-file-upload #wdt-portal-uploaded-files-table").each((function(e){let a=t(this).attr("data-owner-id"),o=t.Event("wdt:refresh");o._ownerID=a,t(this).trigger(o),t("#wdt-portal-client-file-upload #wdt-portal-uploaded-files-table").on("wdt:ready",(function(e){t(this).trigger(o)}))})),t(document).on("wdt:start","#wdt-portal-client-file-upload #wdt-portal-uploaded-files-table [data-file-action]",(function(e){e.stopPropagation();let a=t("#wdt-portal-client-file-upload #wdt-portal-uploaded-files-table");t(a).trigger("wdt:loadState")})),t(document).on("wdt:complete","#wdt-portal-client-file-upload #wdt-portal-uploaded-files-table [data-file-action]",(function(e){e.stopPropagation();let a=t("#wdt-portal-client-file-upload #wdt-portal-uploaded-files-table"),o=t(
1a).attr("data-owner-id"),r=t.Event("wdt:refresh");r._ownerID=o,t(a).trigger(r)}))})),jQuery((function(t){})),jQuery(document).ready((function(t){"use strict";t(document).on("click",'[data-target="wdt-portal-case-notes-filters-form"] [data-target="wdt-portal-case-notes-filters-form-section"] [data-target="wdt-portal-case-notes-filters-form-accordion-header"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-case-notes-filters-form"]'),o=t(this).parents('[data-target="wdt-portal-case-notes-filters-form-section"]'),r=t(o).find('[data-target="wdt-portal-case-notes-filters-form-collapsable-content"]');"inactive"===t(r).attr("data-state")?t(r).trigger("wdt:expand"):t(r).trigger("wdt:collapse"),0===t(a).find('[data-target="wdt-portal-case-notes-filters-form-section"] [data-target="wdt-portal-case-notes-filters-form-collapsable-content"]:not([data-state="inactive"])').length?t(a).find('[data-target="wdt-portal-case-notes-filters-form-collapse-expand-button"]').trigger("wdt:setExpand"):t(a).find('[data-target="wdt-portal-case-notes-filters-form-collapse-expand-button"]').trigger("wdt:setCollapse")})),t(document).on("wdt:collapse",'[data-target="wdt-portal-case-notes-filters-form"] [data-target="wdt-portal-case-notes-filters-form-section"] [data-target="wdt-portal-case-notes-filters-form-collapsable-content"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-case-notes-filters-form-section"]'),o=t(a).find('[data-target="wdt-portal-case-notes-filters-form-accordion-header"]');t(o).attr("data-state","inactive"),t(this).attr("data-state","inactive"),t(this).slideUp("fast")})),t(document).on("wdt:expand",'[data-target="wdt-portal-case-notes-filters-form"] [data-target="wdt-portal-case-notes-filters-form-section"] [data-target="wdt-portal-case-notes-filters-form-collapsable-content"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-case-notes-filters-form-section"]'),o=t(a).find('[data-target="wdt-portal-case-notes-filters-form-accordion-header"]');t(o).attr("data-state","active"),t(this).attr("data-state","active"),t(this).slideDown("fast")})),t(document).on("wdt:setCollapse",'[data-target="wdt-portal-case-notes-filters-form"] [data-target="wdt-portal-case-notes-filters-form-collapse-expand-button"]',(function(e){t(this).attr("data-action","wdt-portal-case-notes-filters-form-collapse-all"),t(this).text("Collapse All")})),t(document).on("wdt:setExpand",'[data-target="wdt-portal-case-notes-filters-form"] [data-target="wdt-portal-case-notes-filters-form-collapse-expand-button"]',(function(e){t(this).attr("data-action","wdt-portal-case-notes-filters-form-expand-all"),t(this).text("Expand All")})),t(document).on("click",'[data-target="wdt-portal-case-notes-filters-form"] [data-action="wdt-portal-case-notes-filters-form-collapse-all"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-case-notes-filters-form"]');t(a).find('[data-target="wdt-portal-case-notes-filters-form-collapsable-content"]').each((function(e){t(this).trigger("wdt:collapse")})),t(a).find('[data-target="wdt-portal-case-notes-filters-form-collapse-expand-button"]').trigger("wdt:setExpand")})),t(document).on("click",'[data-target="wdt-portal-case-notes-filters-form"] [data-action="wdt-portal-case-notes-filters-form-expand-all"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-case-notes-filters-form"]');t(a).find('[data-target="wdt-portal-case-notes-filters-form-collapsable-content"]').each((function(e){t(this).trigger("wdt:expand")})),t(a).find('[data-target="wdt-portal-case-notes-filters-form-collapse-expand-button"]').trigger("wdt:setCollapse")}))})),jQuery(document).ready((function(t){"use strict";t(document).on("wdt:beforeAjaxRequest","#wdt-portal-client-onboarding-form-caseworker-container",(function(t,e){e.data.self_option=!0})),t(document).on("change",'#wdt-portal-client-onboarding-form [name="referral_source"]',(function(e){"rs-direct-contact"===t(this).val()||"rs-walk-in"===t(this).val()?t("#wdt-portal-client-onboarding-form #wdt-portal-client-onboarding-form-marketing-sources").show():t("#wdt-portal-client-onboarding-form #wdt-portal-client-onboarding-form-marketing-sources").hide()})),t(document).on("change",'#wdt-portal-client-onboarding-form [name="email"]',(function(e){let a=t(this).val(),o=t(this).attr("data-nonce"),r=this;jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/email/exists/",data:{email:a,nonce:o},beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(r)[0].setCustomValidity("")},success:function(e){e.success&&t(r)[0].setCustomValidity("Email address is already in use.")},error:function(t){wdtDisplayNotification("Encountered issue verifying email address.","error",-1)},complete:function(){}})}))})),jQuery(document).ready((function(t){"use strict";t(document).on("change",'[data-target="wdt-portal-client-map-filters-form"] [name="last_active_limit"]',(function(e){""!==t(this).val()&&t('[data-target="wdt-portal-client-map-filters-form"] [name="last_active"]').prop("checked",!0)})),t(document).on("click",'[data-target="wdt-portal-client-map-filters-form"] [data-target="wdt-portal-client-map-filters-form-section"] [data-target="wdt-portal-client-map-filters-form-accordion-header"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-client-map-filters-form"]'),o=t(this).parents('[data-target="wdt-portal-client-map-filters-form-section"]'),r=t(o).find('[data-target="wdt-portal-client-map-filters-form-collapsable-content"]');"inactive"===t(r).attr("data-state")?t(r).trigger("wdt:expand"):t(r).trigger("wdt:collapse"),0===t(a).find('[data-target="wdt-portal-client-map-filters-form-section"] [data-target="wdt-portal-client-map-filters-form-collapsable-content"]:not([data-state="inactive"])').length?t(a).find('[data-target="wdt-portal-client-map-filters-form-collapse-expand-button"]').trigger("wdt:setExpand"):t(a).find('[data-target="wdt-portal-client-map-filters-form-collapse-expand-button"]').trigger("wdt:setCollapse")})),t(document).on("wdt:collapse",'[data-target="wdt-portal-client-map-filters-form"] [data-target="wdt-portal-client-map-filters-form-section"] [data-target="wdt-portal-client-map-filters-form-collapsable-content"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-client-map-filters-form-section"]'),o=t(a).find('[data-target="wdt-portal-client-map-filters-form-accordion-header"]');t(o).attr("data-state","inactive"),t(this).attr("data-state","inactive"),t(this).slideUp("fast")})),t(document).on("wdt:expand",'[data-target="wdt-portal-client-map-filters-form"] [data-target="wdt-portal-client-map-filters-form-section"] [data-target="wdt-portal-client-map-filters-form-collapsable-content"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-client-map-filters-form-section"]'),o=t(a).find('[data-target="wdt-portal-client-map-filters-form-accordion-header"]');t(o).attr("data-state","active"),t(this).attr("data-state","active"),t(this).slideDown("fast")})),t(document).on("wdt:setCollapse",'[data-target="wdt-portal-client-map-filters-form"] [data-target="wdt-portal-client-map-filters-form-collapse-expand-button"]',(function(e){t(this).attr("data-action","w
1dt-portal-client-map-filters-form-collapse-all"),t(this).text("Collapse All")})),t(document).on("wdt:setExpand",'[data-target="wdt-portal-client-map-filters-form"] [data-target="wdt-portal-client-map-filters-form-collapse-expand-button"]',(function(e){t(this).attr("data-action","wdt-portal-client-map-filters-form-expand-all"),t(this).text("Expand All")})),t(document).on("click",'[data-target="wdt-portal-client-map-filters-form"] [data-action="wdt-portal-client-map-filters-form-collapse-all"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-client-map-filters-form"]');t(a).find('[data-target="wdt-portal-client-map-filters-form-collapsable-content"]').each((function(e){t(this).trigger("wdt:collapse")})),t(a).find('[data-target="wdt-portal-client-map-filters-form-collapse-expand-button"]').trigger("wdt:setExpand")})),t(document).on("click",'[data-target="wdt-portal-client-map-filters-form"] [data-action="wdt-portal-client-map-filters-form-expand-all"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-client-map-filters-form"]');t(a).find('[data-target="wdt-portal-client-map-filters-form-collapsable-content"]').each((function(e){t(this).trigger("wdt:expand")})),t(a).find('[data-target="wdt-portal-client-map-filters-form-collapse-expand-button"]').trigger("wdt:setCollapse")}))})),jQuery(document).ready((function(t){"use strict";t(document).on("click",'form[data-target="wdt-portal-client-referral-form"] button[data-action="toggle-more"]',(function(e){"true"===t(this).attr("data-showing")?(t(this).attr("data-showing","false"),t('form[data-target="wdt-portal-client-referral-form"] #wdt-portal-client-referral-form-service-needs').hide(),t('form[data-target="wdt-portal-client-referral-form"] #wdt-portal-client-referral-form-access-to-transportation').hide()):(t(this).attr("data-showing","true"),t('form[data-target="wdt-portal-client-referral-form"] #wdt-portal-client-referral-form-service-needs').show(),t('form[data-target="wdt-portal-client-referral-form"] #wdt-portal-client-referral-form-access-to-transportation').show())})),t(document).on("change",'[data-target="wdt-portal-client-referral-form"] [name="referral_source"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-client-referral-form"]').first();"rs-direct-contact"===t(this).val()||"rs-walk-in"===t(this).val()?t(a).find("#wdt-portal-client-referral-form-marketing-sources").show():t(a).find("#wdt-portal-client-referral-form-marketing-sources").hide()})),t(document).on("change",'[data-target="wdt-portal-client-referral-form"] [name="service_provider"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-client-referral-form"]'),o=t(this).val(),r=t(a).find('[name="staff[]"]'),n=t(r).parents('[data-wdt-material-form-target="typeahead-select-container"]').first();if(o){if(t(r).trigger("wdt:undisable"),o===t(r).attr("data-service-provider"))return;t(r).attr("data-service-provider",o),t(r).trigger("wdt-clearall");let e=t(n).attr("data-action");e=e.split("?").shift(),e+="?serviceProviders="+o,t(n).attr("data-action",e)}else t(r).trigger("wdt-clearall"),t(r).trigger("wdt:disable"),t(r).prop("data-service-provider",!1)})),t(document).on("submit",'form[data-target="wdt-portal-client-referral-form"]',(function(e){e.preventDefault();let a=this,o=t(a).serializeArray();t(this).find('button[type="submit"]').prop("disabled",!0),jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/add-staff-to-clients/",data:o,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?wdtDisplayNotification("Successfully referred client.","success",5e3):wdtDisplayNotification("Could not refer clients: "+t.response,"error",-1)},error:function(t){t.responseJSON.response?wdtDisplayNotification("Could not refer clients: "+t.responseJSON.response,"error",-1):wdtDisplayNotification("Could not refer clients: error making request.","error",-1)},complete:function(){t(a).trigger("wdt:complete")}})}))})),jQuery(document).ready((function(t){"use strict";t(document).on("change",'[data-target="wdt-portal-people-filters-form"] [name="last_active_limit"]',(function(e){""!==t(this).val()&&t('[data-target="wdt-portal-people-filters-form"] [name="last_active"]').prop("checked",!0)})),t(document).on("click",'[data-target="wdt-portal-people-filters-form"] [data-target="wdt-portal-people-filters-form-section"] [data-target="wdt-portal-people-filters-form-accordion-header"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-people-filters-form"]'),o=t(this).parents('[data-target="wdt-portal-people-filters-form-section"]'),r=t(o).find('[data-target="wdt-portal-people-filters-form-collapsable-content"]');"inactive"===t(r).attr("data-state")?t(r).trigger("wdt:expand"):t(r).trigger("wdt:collapse"),0===t(a).find('[data-target="wdt-portal-people-filters-form-section"] [data-target="wdt-portal-people-filters-form-collapsable-content"]:not([data-state="inactive"])').length?t(a).find('[data-target="wdt-portal-people-filters-form-collapse-expand-button"]').trigger("wdt:setExpand"):t(a).find('[data-target="wdt-portal-people-filters-form-collapse-expand-button"]').trigger("wdt:setCollapse")})),t(document).on("wdt:collapse",'[data-target="wdt-portal-people-filters-form"] [data-target="wdt-portal-people-filters-form-section"] [data-target="wdt-portal-people-filters-form-collapsable-content"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-people-filters-form-section"]'),o=t(a).find('[data-target="wdt-portal-people-filters-form-accordion-header"]');t(o).attr("data-state","inactive"),t(this).attr("data-state","inactive"),t(this).slideUp("fast")})),t(document).on("wdt:expand",'[data-target="wdt-portal-people-filters-form"] [data-target="wdt-portal-people-filters-form-section"] [data-target="wdt-portal-people-filters-form-collapsable-content"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-people-filters-form-section"]'),o=t(a).find('[data-target="wdt-portal-people-filters-form-accordion-header"]');t(o).attr("data-state","active"),t(this).attr("data-state","active"),t(this).slideDown("fast")})),t(document).on("wdt:setCollapse",'[data-target="wdt-portal-people-filters-form"] [data-target="wdt-portal-people-filters-form-collapse-expand-button"]',(function(e){t(this).attr("data-action","w
1dt-portal-people-filters-form-collapse-all"),t(this).text("Collapse All")})),t(document).on("wdt:setExpand",'[data-target="wdt-portal-people-filters-form"] [data-target="wdt-portal-people-filters-form-collapse-expand-button"]',(function(e){t(this).attr("data-action","wdt-portal-people-filters-form-expand-all"),t(this).text("Expand All")})),t(document).on("click",'[data-target="wdt-portal-people-filters-form"] [data-action="wdt-portal-people-filters-form-collapse-all"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-people-filters-form"]');t(a).find('[data-target="wdt-portal-people-filters-form-collapsable-content"]').each((function(e){t(this).trigger("wdt:collapse")})),t(a).find('[data-target="wdt-portal-people-filters-form-collapse-expand-button"]').trigger("wdt:setExpand")})),t(document).on("click",'[data-target="wdt-portal-people-filters-form"] [data-action="wdt-portal-people-filters-form-expand-all"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-people-filters-form"]');t(a).find('[data-target="wdt-portal-people-filters-form-collapsable-content"]').each((function(e){t(this).trigger("wdt:expand")})),t(a).find('[data-target="wdt-portal-people-filters-form-collapse-expand-button"]').trigger("wdt:setCollapse")}))})),jQuery(document).ready((function(t){"use strict";t(document).on("change",'#wdt-portal-staff-onboarding-form [name="email"]',(function(e){let a=t(this).val(),o=t(this).attr("data-nonce"),r=this;jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/email/exists/",data:{email:a,nonce:o},beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(r)[0].setCustomValidity("")},success:function(e){e.success&&t(r)[0].setCustomValidity("Email address is already in use.")},error:function(t){wdtDisplayNotification("Encountered issue verifying email address.","error",-1)},complete:function(){}})}))})),jQuery(document).ready((function(t){"use strict";t(document).on("submit",'form[data-target="wdt-portal-task-postpone-form"]',(function(e){e.preventDefault();let a=this,o=t(this).find('[name="postpone_slug"]').val(),r=t(this).find('[name="postpone_date"]').val();t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/case-tasks/update/due-date/",data:{date:r,task_slug:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success?(wdtForceRemoveContentModal(),wdtDisplayNotification("Successfully updated task date.","success",3e3),t("#wdt-portal-tasks #wdt-portal-tasks-table").trigger("wdt:refresh")):wdtDisplayNotification("Could not update task date.","error",-1)},error:function(t){console.log(t)},complete:function(){t(a).trigger("wdt:afterSubmit")}})})),t(document).on("change",'[data-target="wdt-portal-task-postpone-form"] #wdt-portal-task-postpone-form-dropdown',(function(e){let a=t(this).parents('[data-target="wdt-portal-task-postpone-form"]'),o=t(a).find("#wdt-portal-task-postpone-form-custom-date"),r=t(o).parents('[data-target="wdt-material-form-date-input-label"]');"custom"===t(this).val()?t(r).show():t(r).hide(),t(a).find('[name="postpone_date"]').trigger("wdt:refresh")})),t(document).on("change",'[data-target="wdt-portal-task-postpone-form"] #wdt-portal-task-postpone-form-custom-date',(function(e){let a=t(this).parents('[data-target="wdt-portal-task-postpone-form"]');t(a).find('[name="postpone_date"]').trigger("wdt:refresh")})),t(document).on("wdt:refresh",'[data-target="wdt-portal-task-postpone-form"] [name="postpone_date"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-task-postpone-form"]'),o=t("#wdt-portal-task-postpone-form-dropdown").val(),r=t(a).find("#wdt-portal-task-postpone-form-custom-date").val(),n="custom"!==o?o:r;t(this).val(n)}))})),jQuery(document).ready((function(t){"use strict";t(document).on("submit",'[data-target="wdt-portal-tasks-filters-assign-staff-form"]',(function(e){e.preventDefault();let a=this,o=t(this).find('[name="task_slug"]').val(),r=t(this).find('[name="staff_id"]').val();t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/case-tasks/update/staff/",data:{task_slug:o,staff_id:r},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?wdtDisplayNotification("Successfully updated task assignee.","success",3e3):wdtDisplayNotification("Could not update task assignee.","error",-1)},error:function(t){console.log(t)},complete:function(){t(a).trigger("wdt:afterSubmit")}})}))})),jQuery((function(t){"use strict";t(document).on("click",'[data-target="wdt-portal-invitation-email-sent-client-created-modal-body"] [data-action="wdt-portal-invitation-email-sent-copy-invite"]',(function(e){let a=t(this).attr("data-content");navigator.clipboard.writeText(a),wdtElementNotification(t(this),"Copied invite to clipboard.")}))})),jQuery(document).ready((function(t){"use strict";t('[data-action="wdt-job-mgmt-list-item-duplicate"]').on("click",(function(e){e.preventDefault(),t(this).prop("disabled",!0);let a=t(this).attr("data-nonce"),o=t(this).attr("data-post-id");jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/job-board/job-mgmt/duplicate/",data:{"post-id":o,nonce:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success?(wdtDisplayNotification("Successfully duplicated post.","success",3e3),location.reload()):t(this).prop("disabled",!1)},error:function(e){console.log(e),t(this).prop("disabled",!1)},complete:function(){}})})),t('[data-action="wdt-job-mgmt-list-item-expire"]').on("click",(function(e){e.preventDefault(),t(this).prop("disabled",!0);let a=t(this).attr("data-nonce"),o=t(this).attr("data-post-id");jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/job-board/job-mgmt/expire/",data:{"post-id":o,nonce:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success?(wdtDisplayNotification("Successfully expired post.","success",3e3),location.reload()):t(this).prop("disabled",!1)},error:function(e){console.log(e),t(this).prop("disabled",!1)},complete:function(){}})}))})),jQuery((function(t){"use strict";t(document).on("wdt:followed-job",'[data-target="wdt-portal-widget-job-card"] button[data-target="wdt-follow-job-post-btn"]',(function(e){let a=this;
1t(a).attr("data-action","wdt-unfollow-job-post"),t(a).attr("title","Unsave Job Post"),t(a).removeClass("wdt-not-following-job-post"),t(a).addClass("wdt-following-job-post")})),t(document).on("wdt:unfollowed-job",'[data-target="wdt-portal-widget-job-card"] button[data-target="wdt-follow-job-post-btn"]',(function(e){let a=this;t(a).attr("data-action","wdt-follow-job-post"),t(a).attr("title","Save Job Post"),t(a).removeClass("wdt-following-job-post"),t(a).addClass("wdt-not-following-job-post")}))})),jQuery((function(t){"use strict";function e(t,e,a,o,r){"follow"==t?jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/suggest/company",data:{nonce:e,object_slug:a,user_id:r,action:"follow"},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){wdtDisplayNotification(o+" has been suggested to the client.","success")},error:function(t){wdtDisplayNotification("Error suggesting "+o,"error",7500),console.log(t)}}):"remove"==t&&jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/suggest/company",data:{nonce:e,object_slug:a,user_id:r,action:"remove"},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){wdtDisplayNotification("The suggestion to follow "+o+" has been removed.","success")},error:function(t){wdtDisplayNotification("Error suggesting "+o,"error",7500),console.log(t)}})}function a(t,e,a,o,r){"follow"==t?jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/suggest/industry",data:{nonce:e,object_slug:a,user_id:r,action:"follow"},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){wdtDisplayNotification(o+" has been suggested to the client.","success")},error:function(t){wdtDisplayNotification("Error suggesting "+o,"error",7500),console.log(t)}}):"remove"==t&&jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/suggest/industry",data:{nonce:e,object_slug:a,user_id:r,action:"remove"},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){wdtDisplayNotification("The suggestion to follow "+o+" has been removed.","success")},error:function(t){wdtDisplayNotification("Error suggesting "+o,"error",7500),console.log(t)}})}function o(t,e,a,o,r){"follow"==t?jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/suggest/occupation",data:{nonce:e,object_slug:a,user_id:r,action:"follow"},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){wdtDisplayNotification(o+" has been suggested to the client.","success")},error:function(t){wdtDisplayNotification("Error suggesting "+o,"error",7500),console.log(t)}}):"remove"==t&&jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/suggest/occupation",data:{nonce:e,object_slug:a,user_id:r,action:"remove"},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){wdtDisplayNotification("The suggestion to follow "+o+" has been removed.","success")},error:function(t){wdtDisplayNotification("Error suggesting "+o,"error",7500),console.log(t)}})}function r(t,e,a,o,r){"wdt_skill_add_suggestion"==t?jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/suggest/skill",data:{nonce:e,term_slug:a,user_id:r,action:"follow"},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){wdtDisplayNotification(o+" has been suggested to the client.","success")},error:function(t){wdtDisplayNotification("Error suggesting skill "+o,"error",7500),console.log(t)}}):"wdt_skill_remove_suggestion"===t&&jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/suggest/skill",data:{nonce:e,term_slug:a,user_id:r,action:"remove"},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){wdtDisplayNotification("A suggestion for "+o+" has been removed from the client.","success")},error:function(t){wdtDisplayNotification("Error removing skill suggestion "+o,"error",7500),console.log(t)}})}t('[data-overview-section="profile"][data-cams-issue="true"]').length&&wdtDisplayNotification("Unable to retrieve additional CaMS data for this client.","error",-1),t(document).on("wdt:ajaxresultfilter","#wdt-client-profile-company-suggest-container",(function(e){let a=e._option,o=t(this).data("_followed-map");if(!o){o={},t('#wdt-portal-client-following [data-target="following-companies"] [data-target="wdt-preview-panel"]').each((function(e){o[t(this).attr("data-post-id")]=!0})),t(this).data("_followed-map",o)}console.log(o),o[t(a).attr("data-value")]&&t(a).attr("disabled",!0)})),t(document).on("wdt:beforeselect","#wdt-client-profile-company-suggest-container",(function(a){let o=a.selected,r=t("#wdt-portal-client-following").attr("data-user-id");e("follow",t("#wdt-portal-client-following").attr("data-nonce"),o.value,o.text,r)})),t(document).on("wdt:removedselection","#wdt-client-profile-company-suggest-container",(function(a){let o=a._selection,r=t("#wdt-portal-client-following").attr("data-user-id");e("remove",t("#wdt-portal-client-following").attr("data-nonce"),o.value,o.text,r)})),t("#wdt-client-profile-industry-suggest-container").on("wdt:ajaxresultfilter",(function(e){let a=e._option,o=t(this).data("_followed-map");if(!o){o={},t('#wdt-portal-client-following [data-target="following-industries"] [data-target="wdt-preview-panel"]').each((function(e){o[t(this).attr("data-post-id")]=!0})),t(this).data("_followed-map",o)}o[t(a).attr("data-value")]&&t(a).attr("disabled",!0)})),t("#wdt-client-profile-industry-suggest-container").on("wdt:beforeselect",(function(e){let o=e.selected,r=t("#wdt-portal-client-following").attr("data-user-id");a("follow",t("#wdt-portal-client-following").attr("data-nonce"),o.value,o.text,r)})),t("#wdt-client-profile-industry-suggest-container").on("wdt:removedselection",(function(e){let o=e._selection,r=t("#wdt-portal-client-following").attr("data-user-id");a("remove",t("#wdt-portal-client-following").attr("data-nonce"),o.value,o.text,r)})),t("#wdt-client-profile-occupation-suggest-container").on("wdt:ajaxresultfilter",(function(e){let a=e._option,o=t(this).data("_followed-map");if(!o){o={},t('#wdt-portal-client-following [data-target="following-occupations"] [data-target="wdt-preview-panel"]').each((function(e){o[t(this).attr("data-post-id")]=!0})),t(this).data("_followed-map",o)}o[t(a).attr("data-value")]&&t(a).attr("disabled",!0)})),t("#wdt-client-profile-occupation-suggest-container").on("wdt:beforeselect",(function(e){let a=e.selected,r=t("#wdt-portal-client-following").attr("data-user-id");o("follow",t("#wdt-portal-client-following").attr("data-nonce"),a.value,a.text,r)})),t("#wdt-client-profile-occupation-suggest-container").on("wdt:removedselection",(function(e){let a=e._selection,r=t("#wdt-portal-client-following").attr("data-user-id");o("remove",t("#wdt-portal-client-following").attr("data-nonce"),a.value,a.text,r)})),t("#wdt-client-profile-skill-suggest-container").on("wdt:ajaxresultfilter",(function(e){let a=e._option,o=t(this).data("_followed-skills-map");if(!o){o={},t('#wdt-portal-client-skills [data-target="followed-skill"]').each((function(e){o[t(this).attr("data-skill-slug")]=!0})),t(this).data("_followed-skills-map",o)}o[t(a).attr("data-value")]&&t(a).attr("disabled",!0)})),t("#wdt-client-profile-skill-suggest-container").on("wdt:beforeselect",(function(e){let a=e.selected,o=t("#wdt-portal-client-skills").attr("data-user-id");r("wdt_skill_add_suggestion",t("#wdt-portal-client-skills").attr("data-nonce"),a.value,a.text,o)})),t("#wdt-client-profile-skill-suggest-container").on("wdt:removedselection",(function(e){let a=e._selection,o=t("#wdt-portal-client-skills").attr("data-user-id");r("wdt_skill_remove_suggestion",t("#wdt-portal-client-skills").attr("data-nonce"),a.value,a.text,o)})),t('#wdt-portal-client-page button[data-action="wdt-nav-tabs-item"]').on("wdt:navigateTab",(function(e){let a=t(this).attr("data-tab-target");
1t('.wdt-portal-client [data-action="section"]').attr("data-status","inactive"),t('.wdt-portal-client [data-action="section"][data-section="'+a+'"]').attr("data-status","active");let o=new URL(window.location);o.searchParams.set("wdt-client-tab",a),history.replaceState({},"",o.toString());let r=t(this).parents("#wdt-portal-client-page").first(),n=t(r).attr("data-analytics-nonce"),i=t(r).attr("data-client-id");if("true"===t(this).attr("data-new-activity")){t(this).removeAttr("data-new-activity");let e=t(this).data("tracked-events");jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/user/events/seen/",data:{events:e},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){},error:function(t){console.log(t)}})}jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/analytics/portal/client/view",data:{nonce:n,clientId:i,clientPage:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){},error:function(t){console.log(t)}})})),t('#wdt-portal-client-page button[data-action="wdt-nav-tabs-item"][data-status="active"]').trigger("click"),t(document).on("click",'#wdt-portal-client-page [data-action="overview-staff-edit"]',(function(e){let a=t(this).attr("data-toggle-state");a||(a="closed"),"closed"===a?(t('[data-target="wdt-portal-client-overview-assign-container"]').show(),t(this).attr("data-toggle-state","open"),t(this).find(".wdt-icon-btn-label").text("Cancel"),t(this).find("svg").hide()):(t('[data-target="wdt-portal-client-overview-assign-container"]').hide(),t(this).attr("data-toggle-state","closed"),t(this).find(".wdt-icon-btn-label").text("Edit"),t(this).find("svg").show())})),t(document).on("change","#wdt-portal-client-page #wdt-portal-client-manager-select",(function(e){t(this).val().length?t("#wdt-portal-client-page #wdt-portal-client-save").prop("disabled",!1):t("#wdt-portal-client-page #wdt-portal-client-save").prop("disabled",!0)})),t("#wdt-portal-client-page").each((function(e){let a=this,o={following:["follow-company","unfollow-company","follow-sector","unfollow-sector","follow-occupation","unfollow-occupation"],skills:["follow-skill","unfollow-skill"],resumes:["create-resume"],"job-leads":["follow-job","unfollow-job"]},r={},n=[];for(let t in o){let e=o[t];for(let a of e)r[a]=t,n.push(a)}let i=t(this).attr("data-nonce"),s=t(this).attr("data-client-id");jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/clients/activity/new/",data:{nonce:i,user_id:s,events:n},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.success){let o=e.events;for(let e of o)if(r[e.ac]){let o=t(a).find('[data-action="wdt-portal-client-nav"][data-target="'+r[e.ac]+'"]');if(t(o).length){t(o).attr("data-new-activity","true");let a=t(o).data("tracked-events");a||(a=[]),a.push(e.id),t(o).data("tracked-events",a)}}}},error:function(t){console.log(t)}})})),t('#wdt-portal-client-page [data-action="create-case-note"]').on("click",(function(e){let a=t(this).attr("data-client-id");t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/html/case-notes/form/",data:{client_id:[a]},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&(_wdtRenderContentModal("Add Note",e.html,"wdt-portal-modal-alt","wdt-case-note-modal",!0),t("#wdt-case-note-modal #wdt-portal-client-case-note-form").trigger("wdt:initializeForm"))},error:function(t){console.log(t)}})})),t(document).on("click",'#wdt-portal-client-page [data-action="wdt-portal-client-case-notes-edit-btn"]',(function(e){let a=t(this).attr("data-object-slug");t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/html/case-notes/form/",data:{case_slug:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&(_wdtRenderContentModal("Edit Note",e.html,"wdt-portal-modal-alt","wdt-case-note-modal",!0),t("#wdt-case-note-modal #wdt-portal-client-case-note-form").trigger("wdt:initializeForm"))},error:function(t){console.log(t)}})})),t(document).on("click",'#wdt-portal-client-page [data-action="wdt-portal-client-case-notes-remove-btn"]',(function(e){let a=t(this).attr("data-object-slug"),o=t(this).attr("data-object-name"),r=t(this).parents("tr").first();_wdtRenderConfirmModal("Delete Case Note","Are you sure you want to delete <strong>"+o+"</strong>?",(function(){t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/case-notes/delete/",data:{case_note_slug:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&(wdtDisplayNotification("Successfully deleted case note.","success",3e3),t(r).remove())},error:function(t){console.log(t)}})}),(function(){}),"Delete","wdt-portal-modal-alt")})),t(document).on("wdt:submittedCaseNote","#wdt-case-note-modal #wdt-portal-client-case-note-form",(function(e){t('#wdt-portal-client-page [data-target="portal-case-notes-table"]').trigger("wdt:refresh"),e._isBulk&&t(".wdt-portal-my-clients-table-checkbox").prop("checked",!1).trigger("change")})),t(document).on("click",'#wdt-portal-client-case-note-form [data-action="save-note"]',(function(e){e.preventDefault();let a=[],o=t(this).parents("#wdt-portal-client-case-note-form").first(),r=o.attr("data-client-ids");if(r)a=r.split(",").map((t=>t.trim())).filter((t=>t.length>0));
1else{let e=t("#wdt-portal-client-page").attr("data-client-id");e&&(a=[e])}let n=!!r&&a.length>1,i=t(o).find('[name="activities[]"]'),s=t(o).find('[name="date"]'),d=t(o).find('[name="timestamp"]'),l=t(o).find('[name="details"]'),c=t(o).find('[name="slug"]'),p=[i,s,l];for(let e of p){if(!t(e)[0].reportValidity())return}let u=t(o).find('[data-nested-case-tasks="true"]');t(u).trigger("wdt:collectCaseTasks");let f=t(u).data("wdt:caseTasks");if(null===f)return;f=f||[];let g=t(this);t(g).prop("disabled",!0);let m=t(g).html();t(g).html('<div class="wdt-spinner wdt-spinner-small"></div>');let w=t(i).val(),h=t(s).val(),b=t(d).val(),y=t(l).val(),v=t(c).val(),_=t(o).find('select[name="employer_id"]').val(),k=t(o).find('select[name="employer_contact_id"]').val(),x=WDT.rest_url+"wedatatools/v1/portal/case-notes/create/",j={activities:w,date:h,timestamp:b,details:y,employer_id:null!==_&&""!==_?_:0,employer_contact_id:null!==k&&""!==k?k:0};j.client_id=a,f.length&&(j.tasks=f),v&&(x=WDT.rest_url+"wedatatools/v1/portal/case-notes/update/",j.case_note_slug=v),t.ajax({type:"POST",url:x,data:j,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.success){let e="Successfully added note.";v&&(e="Successfully updated note.");let a=t.Event("wdt:submittedCaseNote");a._isBulk=n,t(o).trigger(a),wdtDisplayNotification(e,"success",3e3),wdtForceRemoveContentModal()}},error:function(t){wdtDisplayNotification("Unable to create case note.","error",-1),console.log(t)},complete:function(){t(g).prop("disabled",!1),t(g).html(m)}})})),t(document).on("click",'#wdt-portal-client-case-note-form [data-action="close-note"]',(function(e){let a=t(this).closest("#wdt-case-note-modal, #wdt-people-page-case-note-modal");t(a).trigger("wdt:customDestroyContentModal")})),t(document).on("wdt:customDestroyContentModal","#wdt-case-note-modal,#wdt-people-page-case-note-modal",(function(t){_wdtRenderConfirmModal("Discard Changes","Are you sure you want to discard these changes?",(function(){wdtForceRemoveContentModal()}),(function(){wdtFocusActiveContentModal()}),"Discard Changes","wdt-portal-modal-alt")})),t(document).on("wdt:complete",'#wdt-client-page-refer-modal form[data-target="wdt-portal-client-referral-form"]',(function(t){wdtForceRemoveContentModal(),setTimeout((function(){location.reload()}),2e3)})),t(document).on("wdt:complete",'#wdt-client-page-assign-modal form[data-target="wdt-portal-my-clients-assign-staff-form"]',(function(t){wdtForceRemoveContentModal(),setTimeout((function(){location.reload()}),2e3)})),t(document).on("click",'[data-action="wdt-client-open-resend-invite-modal"]',(function(e){let a=t(t("#wdt-portal-client-invitation-email-sent-modal").html()),o=t(this).attr("data-nonce"),r=t(this).attr("data-client-id"),n=t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/invite/resend/",data:{nonce:o,client_id:r},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){t(a).find('[data-target="client-email"]').text(e.email),t(a).find('[data-action="wdt-portal-invitation-email-sent-copy-invite"]').attr("data-content",e.copyable_content),t(a).find('[data-target="client-link"]').attr("href",e.user_link);let o=e.email_suppressed?"Invite generated":"Invite email has been sent";_wdtRenderContentModal(o,t(a).prop("outerHTML"),"wdt-portal-modal","wdt-portal-onboard-client-modal")},error:function(t){console.log(t)},complete:function(){}});t("#wdt-client-page-assign-modal").on("wdt:destroy",(function(t){n.abort()}))})),t(document).on("click",'[data-action="wdt-client-open-resend-password-reset-modal"]',(function(e){let a=t(this).attr("data-nonce"),o=t(this).attr("data-email"),r=t(this).attr("data-client-id");jQuery.ajax({method:"POST",url:"/wp-json/wedatatools/v1/portal/profile/password-reset/",data:{nonce:a,user_id:r},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){if(t.success){let t="";t+='<p class="wdt-portal-modal-body-text wdt-portal-modal-password-block-1"> We just sent a password reset link to <strong>'+o+"</strong></p>",t+='<p class="wdt-portal-modal-small-text wdt-portal-modal-password-block-2">(They may need to look in their spam folder.)</p>',_wdtRenderContentModal("Sent Password Reset",t,"wdt-portal-modal"),setTimeout((function(){location.reload()}),5e3)}else wdtDisplayNotification("Could not send password reset: "+t.response,"error",-1)},error:function(t){console.log(t),t.responseJSON.response?wdtDisplayNotification("Could not send password reset: "+t.responseJSON.response,"error",-1):wdtDisplayNotification("Could not send password reset: error making request.","error",-1)}})})),t(document).on("click",'[data-action="wdt-client-open-assign-staff-modal"]',(function(e){let a=t(this).attr("data-client-id"),o=t(this).attr("data-service-provider"),r="true"===t(this).attr("data-has-staff"),n="true"===t(this).attr("data-is-referral"),i="true"===t(this).attr("data-is-new-client"),s=t(this).attr("data-tasks-nonce"),d=[a];if(r){let e=t(t("#wdt-portal-client-filters-existing-assignments").html());_wdtRenderContentModal("Manage Staff Assignments",t(e).prop("outerHTML"),"wdt-portal-modal-alt","wdt-my-clients-existing-assignments-modal");let a=t.Event("wdt:initializeAssignStaffExisting");a._clients=d,a._serviceProvider=o,a._clientsWithStaffCount=1,a._clientsWithStaffIds=d,a._tasksNonce=s,a._hasReferrals=n,a._hasNewClients=i,a._hasOldClients=!n&&!i,t("#wdt-my-clients-existing-assignments-modal").find('[data-target="wdt-assign-staff-existing"]').trigger(a)}else{let e=t(t("#wdt-portal-client-filters-assign-staff").html());_wdtRenderContentModal("Assign Staff",e.html(),"wdt-portal-modal-alt","wdt-client-page-assign-modal");let a=t.Event("wdt:initializeAssignStaff");a._clients=d,a._serviceProvider=o,t("#wdt-client-page-assign-modal").find("#wdt-portal-my-clients-assign-staff-form").trigger(a)}})),t(document).on("click",'[data-action="wdt-client-open-refer-client-modal"]',(function(e){let a=t(t("#wdt-portal-client-refer-client").html()),o=t(this).attr("data-client-id");t(a).find('[name="nonce"]').before('<input type="hidden" name="clients[]" value="'+o+'">'),_wdtRenderContentModal("Refer to Service Provider",a.html(),"wdt-portal-modal-alt","wdt-client-page-refer-modal")})),t(document).on("click",'[data-action="wdt-client-open-unlink-client-modal"]',(function(e){let a=t("#wdt-portal-client-remove-cams-link").clone(!0);_wdtRenderContentModal("Remove CaMS Link",a.html(),"wdt-portal-modal","wdt-client-cams-unlink-modal",!1,!1)})),t(document).on("click",'[data-action="wdt-client-open-link-client-modal"]',(function(e){let a=t("#wdt-portal-client-create-cams-link").clone(!0);_wdtRenderContentModal("CaMS Lookup",a.html(),"wdt-portal-modal","wdt-client-cams-link-modal")})),t(document).on("click",'#wdt-client-cams-link-modal [data-action="wdt-cams-lookup-select-client"]',(function(e){let a=t(this).attr("data-cams-ref"),o=t(this).attr("data-first-name"),r=t(this).attr("data-last-name"),n=a+" - "+o+" "+r,i=t("#wdt-portal-client-page").attr("data-client-name")+" "+t("#wdt-portal-client-page").attr("data-portal-name")+" Account",s=t(t("#wdt-portal-client-confirm-cams-link").clone(!0).html());t(s).find('[data-target="confirm-cams-link-compare-a"]').text(i),t(s).find('[data-target="confirm-cams-link-compare-b"]').text(n),t(s).find('[data-action="wdt-portal-create-cams-link"]').attr("data-cams-ref",a),o+" "+r!==t("#wdt-portal-client-page").attr("data-client-name")&&t(s).find(".wdt-portal-client-confirm-cams-link-compare").addClass("compare-warning"),_wdtRenderContentModal("Are you sure you want to link CaMS client data?",s.prop("outerHTML"),"wdt-portal-modal","wdt-client-cams-confirm-modal",!1,!1)})),t(document).on("click",'[data-action="wdt-client-open-remove-user-modal"]',(function(e){let a=t("#wdt-portal-client-filters-remove-user").clone(!0).html(),o=t(this).attr("data-client-count"),r=t(this).attr("data-task-count");if(o>0||r>
10){let e=t(this).attr("data-caseworker-name"),n=[];o>0&&n.push("<strong>"+o+" active client(s)</strong>"),r>0&&n.push("<strong>"+r+" active task(s)</strong>"),a="<p><strong>"+e+"</strong> has "+n.join(" and ")+". To proceed with removing this Staff Portal account, all clients and tasks must be reassigned to another staff member. Any irrelevant tasks can be deleted."}_wdtRenderContentModal("Remove User",a,"wdt-portal-modal-alt")})),t(document).on("click",'[data-action="wdt-client-open-archive-leads-modal"]',(function(e){let a=t("#wdt-portal-client-filters-archive-leads").clone(!0);_wdtRenderContentModal("Archive User",a.html(),"wdt-portal-modal-alt")})),t(document).on("click",'[data-action="wdt-client-open-unarchive-leads-modal"]',(function(e){let a=t("#wdt-portal-client-filters-unarchive-leads").clone(!0);_wdtRenderContentModal("Unarchive User",a.html(),"wdt-portal-modal-alt")})),t(document).on("click",'[data-action="wdt-client-open-safety-flags-modal"]',(function(e){let a=t("#wdt-portal-client-safety-flags-template").clone(!0);_wdtRenderContentModal("Add Safety Flag",a.html(),"wdt-portal-modal-alt")})),t(document).on("click",'#wdt-client-cams-confirm-modal button[data-action="wdt-portal-create-cams-link"]',(function(e){let a=t(this).attr("data-nonce"),o=t(this).attr("data-client-id"),r=t(this).attr("data-cams-ref");r?(t(this).prop("disabled",!0),jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/add-cams-ref-to-clients/",data:{nonce:a,client_id:o,ref_number:r},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?wdtDisplayNotification("CaMS link has been successfully added.","success",5e3):wdtDisplayNotification("Could not add reference number: "+t.response,"error",-1)},error:function(t){t.responseJSON.response?wdtDisplayNotification("Could not add reference number: "+t.responseJSON.response,"error",-1):wdtDisplayNotification("Could not add reference number: error making request.","error",-1)},complete:function(){wdtForceRemoveContentModal(),setTimeout((function(){location.reload()}),2e3)}})):wdtDisplayNotification("No reference number added.","error",-1)})),t(document).on("click",'#wdt-client-cams-unlink-modal button[data-action="wdt-portal-client-remove-cams-link"]',(function(e){let a=t(this).attr("data-nonce"),o=t(this).attr("data-client-id");t(this).prop("disabled",!0),jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/remove-cams-ref-from-clients/",data:{nonce:a,clients:[o]},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?wdtDisplayNotification("CaMS link has been successfully removed.","success",5e3):wdtDisplayNotification("Could not remove reference number: "+t.response,"error",-1)},error:function(t){t.responseJSON.response?wdtDisplayNotification("Could not remove reference number: "+t.responseJSON.response,"error",-1):wdtDisplayNotification("Could not remove reference number: error making request.","error",-1)},complete:function(){wdtForceRemoveContentModal(),setTimeout((function(){location.reload()}),2e3)}})})),t(document).on("click",'#wdt-content-modal [data-target="wdt-portal-client-filters-remove-user-container"] button[data-action="wdt-portal-user-remove"]',(function(e){t(this).prop("disabled",!0);let a=t(this).attr("data-nonce"),o=t(this).attr("data-client-id");jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/user/remove/",data:{nonce:a,user_id:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?wdtDisplayNotification("Successfully removed user.","success",5e3):wdtDisplayNotification("Could not remove: "+t.response,"error",-1)},error:function(t){t.responseJSON.response?wdtDisplayNotification("Could not remove: "+t.responseJSON.response,"error",-1):wdtDisplayNotification("Could not remove: error making request.","error",-1)},complete:function(){wdtForceRemoveContentModal(),setTimeout((function(){let t=new URL(window.location);t.searchParams.set("wdt-page","my-clients"),location.href=t.href}),1e3)}})})),t(document).on("click",'#wdt-content-modal [data-target="wdt-portal-client-filters-archive-leads-container"] button[data-action="wdt-portal-client-archive"]',(function(e){t(this).prop("disabled",!0);let a=t(this).attr("data-nonce"),o=t(this).attr("data-client-id");jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/clients/archive/",data:{nonce:a,clients:[o]},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?wdtDisplayNotification("Successfully archived client(s).","success",5e3):wdtDisplayNotification("Could not archive: "+t.response,"error",-1)},error:function(t){t.responseJSON.response?wdtDisplayNotification("Could not archive: "+t.responseJSON.response,"error",-1):wdtDisplayNotification("Could not archive: error making request.","error",-1)},complete:function(){wdtForceRemoveContentModal(),setTimeout((function(){location.reload()}),1e3)}})})),t(document).on("click",'#wdt-content-modal [data-target="wdt-portal-client-filters-unarchive-leads-container"] button[data-action="wdt-portal-client-unarchive"], [data-target="wdt-portal-client-archived-ribbon"] button[data-action="wdt-portal-client-unarchive"]',(function(e){let a=this;t(a).prop("disabled",!0);let o=t(a).attr("data-nonce"),r=t(a).attr("data-client-id");jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/clients/unarchive/",data:{nonce:o,clients:[r]},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?wdtDisplayNotification("Successfully unarchived client(s).","success",5e3):wdtDisplayNotification("Could not unarchive: "+t.response,"error",-1)},error:function(t){t.responseJSON.response?wdtDisplayNotification("Could not unarchive: "+t.responseJSON.response,"error",-1):wdtDisplayNotification("Could not unarchive: error making request.","error",-1)},complete:function(){wdtForceRemoveContentModal(),setTimeout((function(){location.reload()}),1e3)}})})),t('#wdt-portal-client-case-notes [data-target="case-notes-table"]').length&&(t(
1document).on("click",'#wdt-portal-client-case-notes [data-target="case-notes-table"] td [data-action="show-full-case-note"]',(function(e){let a=t(this).parents("td").first();t(a).find('[data-target="wdt-portal-client-case-notes-content"]').removeClass("wdt-portal-client-case-notes-content"),t(this).attr("data-action","hide-full-case-note"),t(this).text("Less")})),t(document).on("click",'#wdt-portal-client-case-notes [data-target="case-notes-table"] td [data-action="hide-full-case-note"]',(function(e){let a=t(this).parents("td").first();t(a).find('[data-target="wdt-portal-client-case-notes-content"]').addClass("wdt-portal-client-case-notes-content"),t(this).attr("data-action","show-full-case-note"),t(this).text("More")})),t(document).on("wdt:seeMoreRefresh",'#wdt-portal-client-case-notes [data-target="case-notes-table"]',(function(e){t(this).find('[data-target="wdt-portal-client-case-notes-content"].wdt-portal-client-case-notes-content').each((function(e){if(t(this)[0].offsetHeight<t(this)[0].scrollHeight){let e=t(this).parents("td"),a=t(e).find('[data-target="show-hide-btn"]');t(a).length||t(this).parents("td").first().append('<button class="wdt-text-link" style="display: inline;" data-target="show-hide-btn" data-action="show-full-case-note">More</button>')}else{let e=t(this).parents("td"),a=t(e).find('[data-target="show-hide-btn"][data-action="show-full-case-note"]');t(a).remove()}}))})),t(window).on("resize",(function(e){t('#wdt-portal-client-case-notes [data-target="case-notes-table"]').trigger("wdt:seeMoreRefresh")})),t('#wdt-portal-client-case-notes [data-target="case-notes-table"]').trigger("wdt:seeMoreRefresh")),t(document).on("click",'#wdt-portal-client-job-leads [data-target="skill-breakdown-back"]',(function(e){e.preventDefault(),t('#wdt-portal-client-job-leads [data-target="wdt-portal-skill-breakdown"]').remove(),t('#wdt-portal-client-job-leads [data-target="client-job-leads-table"]').show()})),t(document).on("click",'#wdt-portal-client-job-leads [data-target="client-job-leads-table"] [data-action="show-skill-breakdown"]',(function(e){let a=t(this).attr("data-post-hash"),o=t(this).attr("data-client-id");jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/html/user/skill-breakdown/",data:{post_hash:a,user_id:o,interactive:!1},beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t('#wdt-portal-client-job-leads [data-target="client-job-leads-table"]').hide(),t("#wdt-portal-client-job-leads").append('<div class="wdt-spinner wdt-spinner-small" data-target="spinner"></div>')},success:function(e){e.success?t("#wdt-portal-client-job-leads").append(e.html):(wdtDisplayNotification("Error retrieving skill breakdown.","error",-1),t('#wdt-portal-client-job-leads [data-target="client-job-leads-table"]').show())},error:function(e){wdtDisplayNotification("Error retrieving skill breakdown.","error",-1),t('#wdt-portal-client-job-leads [data-target="client-job-leads-table"]').show()},complete:function(){t('#wdt-portal-client-job-leads [data-target="spinner"]').remove()}})})),t(document).on("change",'#wdt-portal-client-job-leads [data-target="client-job-leads-table"] [name="saved-job-status"]',(function(e){let a=t(this).val(),o=t(this).attr("data-post-slug"),r=t(this).attr("data-nonce"),n=t(this).attr("data-client-id");t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/jobs/status/",data:{nonce:r,object_slug:o,user_id:n,status:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?wdtDisplayNotification("Successfully updated job post status.","success",3e3):wdtDisplayNotification("Error updating job post status.","error",-1)},error:function(t){console.log(t),wdtDisplayNotification("Error updating job post status.","error",-1)}})})),t(document).on("wdt:refresh","#wdt-portal-client-permissions #wdt-portal-client-permissions-form",(function(e){e.preventDefault(),e.stopPropagation();let a=t(this).find('[data-target="permission-form-section"]');t(a).each((function(e){let a=t(this).find('input[name="permissions[]"]'),o=t(this).find('[name="expand-all"]'),r=!1,n=!0;a.each((function(e){t(this).is(":checked")?r=!0:n=!1})),t(o).prop("checked",!1),t(o).prop("indeterminate",!1),n?(t(o).prop("checked",!0),t(o).prop("indeterminate",!1)):r&&(t(o).prop("checked",!1),t(o).prop("indeterminate",!0))}))})),t(document).on("change",'#wdt-portal-client-permissions input[name="permissions[]"]',(function(e){let a=t(this).parents("#wdt-portal-client-permissions-form").first();if(t(this).is(":checked")){let e=t(this).attr("data-links");if(e){let o=e.split("|");for(let e of o){t(a).find('input[name="permissions[]"][value="'+e+'"]').is(":checked")||(t(a).find('input[name="permissions[]"][value="'+e+'"]').prop("checked",!0),t('#wdt-portal-client-permissions [data-target="perm-link-warning"]').show())}}}else{let e=t(this).val(),o=t(a).find('input[name="permissions[]"][data-links*="'+e+'"]');if(t(o.length)){t(o).is(":checked")&&(t(o).prop("checked",!1),t('#wdt-portal-client-permissions [data-target="perm-link-warning"]').show())}}t(a).trigger("wdt:refresh")})),t('#wdt-portal-client-permissions input[name="expand-all"]').length&&t('#wdt-portal-client-permissions input[name="expand-all"]').trigger("wdt:refresh"),t(document).on("click",'#wdt-portal-client-permissions input[name="expand-all"]',(function(e){let a=t(this).is(":checked"),o=t(this).parents('[data-target="permission-form-section"]').first(),r=t(o).find('input[name="permissions[]"]');a?r.each((function(e){t(this).prop("checked",!0)})):r.each((function(e){t(this).prop("checked",!1)}))})),t(document).on("submit","#wdt-portal-client-permissions #wdt-portal-client-permissions-form",(function(e){e.preventDefault(),e.stopPropagation();let a=t(this).serializeArray();t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/user/permissions/",data:a,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully updated permissions.","success",3e3),setTimeout((function(){location.reload()}),2e3)):wdtDisplayNotification("Error updating permissions.","error",-1)},error:function(t){console.log(t),wdtDisplayNotification("Error updating permissions.","error",-1)}})})),t('[data-section="overview"] [data-target="client-overview-section"] [data-target="edit"]').on("click",(function(e){let a=t(this).parents('[data-section="overview"]').first(),o=t(this).parents('[data-target="client-overview-section"]').first(),r=t(o).find('[data-target="group"]');t(o).find('[data-target="cams-notice"]').show(),t(o).find('[data-target="buttons"]').show(),r.each((function(e){let a=t(this).find('[data-target="content"]'),o=t(this).find('[data-target="field"]');o.length&&(t(a).hide(),t(o).show())})),t(a).find('[data-target="edit"]').hide()})),t('[data-section="overview"] [data-target="client-overview-section"] [data-target="buttons"] [data-target="cancel"]').on("click",(function(e){let a=t(this).parents('[data-section="overview"]').first(),o=t(this).parents('[data-target="client-overview-section"]').first(),r=t(o).find('[data-target="group"]');t(o).find('[data-target="cams-notice"]').hide(),t(o).find('[data-target="buttons"]').hide(),r.each((function(e){let a=t(this).find('[data-target="content"]'),o=t(this).find('[data-target="field"]');t(a).show(),o.length&&t(o).hide()})),t(a).find('[data-target="edit"]').show()})),t(document).on("submit",'[data-section="overview"] [data-target="update-client-form"], #w
1dt-portal-safety-flags-assign-form',(function(e){e.preventDefault(),e.stopPropagation();let a=t(this).find('button[data-target="save"]'),o=t(this).serializeArray(),r=t(this).find('[data-target="cancel"]');t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/clients/update/",data:o,beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(a).prop("disabled",!0),t(r).prop("disabled",!0)},success:function(e){e.success?(wdtRemoveContentModal(),e.email_success?(_wdtRenderContentModal("Client has been updated","A confirmation email has been sent to the client to notify them of an email change. Please direct the client to confirm this new email.","wdt-portal-modal","wdt-portal-updated-client-modal",!1),t("#wdt-portal-updated-client-modal").on("wdt:destroy",(function(t){location.reload()}))):(wdtDisplayNotification("Successfully updated client.","success"),setTimeout((function(){location.reload()}),2e3))):(t(a).prop("disabled",!1),t(r).prop("disabled",!1),wdtDisplayNotification("Error encountered when updating client.","error",-1))},error:function(e){console.log(e),t(a).prop("disabled",!1),t(r).prop("disabled",!1),wdtDisplayNotification("Error encountered when updating client.","error",-1)}})})),t(document).on("click",'#wdt-portal-client-sub-ribbon [data-action="update-cams-cache"]',(function(e){let a=this,o=t(this).attr("data-cams-reference"),r=t(this).attr("data-nonce");t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/cams/cache/refresh/",data:{clientReferenceNumber:o,nonce:r},beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(a).attr("disabled",!0),t(a).text("Refreshing...")},success:function(e){wdtDisplayNotification("Successfully updated CaMS data. Please refresh the page.","success"),t(a).text("Refreshed")},error:function(e){wdtDisplayNotification("Error updating CaMS data.","error",-1),t(a).attr("disabled",!1),t(a).text("Refresh")},complete:function(){}})})),function(){let t=new URLSearchParams(window.location.search),e=document.getElementById("wdt-portal-client-resolve-transfer-request-form-template");t.has("review-transfer-request")&&e&&e.innerHTML.trim()&&_wdtRenderContentModal("Transfer Request",e.innerHTML,"wdt-portal-modal-alt")}()})),jQuery(document).ready((function(t){"use strict";function e(e){e.siblings().each((function(){t(this).find("button, input, select:not(.wdt-ajax-select-source), textarea").attr("tabindex","-1"),t(this).attr("hidden",!0)})),e.attr("hidden",!1),e.find("button, input, select:not(.wdt-ajax-select-source), textarea").attr("tabindex","0")}e(t('#wdt-portal-employer-register-form > [data-section="1"]')),t('#wdt-portal-employer-register-form [name="wdt_user_email_address"]').on("change",(function(e){let a=t(this).parents('[data-target="wdt-portal-employer-register-form-wizard-section"]').first(),o=t(a).find('[data-action="navigate-section"]'),r=t(this).val(),n=t(this).attr("data-nonce"),i=this;jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/email/exists/",data:{email:r,nonce:n},beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(o).prop("disabled",!0),t(i)[0].setCustomValidity("")},success:function(e){e.success&&t(i)[0].setCustomValidity("Email address is already in use.")},error:function(t){wdtDisplayNotification("Encountered issue verifying email address.","error",-1)},complete:function(){t(o).prop("disabled",!1)}})})),t('#wdt-portal-employer-register-form [name="wdt_user_password"]').on("change",(function(e){let a=t('#wdt-portal-employer-register-form [name="wdt_user_password2"]');t(this).trigger("wdt:checkPWValidity"),t(a).trigger("wdt:checkPWValidity")})),t('#wdt-portal-employer-register-form [name="wdt_user_password2"]').on("change",(function(e){let a=t('#wdt-portal-employer-register-form [name="wdt_user_password"]');t(this).trigger("wdt:checkPWValidity"),t(a).trigger("wdt:checkPWValidity")})),t('#wdt-portal-employer-register-form [name="wdt_user_password"]').on("wdt:checkPWValidity",(function(e){let a=t('#wdt-portal-employer-register-form [name="wdt_user_password2"]');t(this)[0].setCustomValidity("");let o=t(this).val();o.includes("/")||o.includes("\\")?t(this)[0].setCustomValidity("Password cannot contain slashes."):o.length<8?t(this)[0].setCustomValidity("Password must be a minimum of 8 characters."):o.match("^(?=.*?[A-Za-z])(?=.*\\d)")?o===t(a).val()||t(this)[0].setCustomValidity("Passwords do not match."):t(this)[0].setCustomValidity("Password must contain at least 1 letter and 1 number.")})),t('#wdt-portal-employer-register-form [name="wdt_user_password2"]').on("wdt:checkPWValidity",(function(e){let a=t('#wdt-portal-employer-register-form [name="wdt_user_password"]');t(this)[0].setCustomValidity(""),t(this).val()!==t(a).val()&&t(a)[0].setCustomValidity("Passwords do not match.")})),t('#wdt-portal-employer-register-form [data-action="navigate-section"]').on("click",(function(a){let o=t(this).attr("data-section-num"),r=o,n=t(this).parents("#wdt-portal-employer-register-page").first(),i=t(n).find('[data-target="wdt-portal-employer-register-form-wizard-section"][data-active="true"]'),s=t(i).find("*[required]"),d=t(this).attr("data-direction");if("next"==d){r=parseInt(o)+1;let e=!0;if(s.each((function(a){e&&(t(this).is(":hidden")||t(this).prop("disabled")||(e=t(this)[0].reportValidity()))})),!e)return}else"back"==d&&(r=parseInt(o)-1);t(n).find('[data-target="wdt-milestone-progress-container"] [data-target="wdt-milestone-progress-item"][data-number="'+r+'"]').trigger("wdt:activate"),t(n).find('[data-target="wdt-portal-employer-register-form-wizard-section"]').removeClass("active-section"),t(n).find('[data-target="wdt-portal-employer-register-form-wizard-section"]').attr("data-active","false");let l=t(n).find('[data-target="wdt-portal-employer-register-form-wizard-section"][data-section="'+r+'"]');l.addClass("active-section").attr("data-active","true"),e(l),l.find(".wdt-form-section")[0].focus()})),t("#wdt-portal-employer-register-form").on("submit",(function(e){let a=t(this).parents("#wdt-portal-employer-register-page").first(),o=t("#wdt-employer-register-form-recaptcha").data("captcha-id");var r=grecaptcha.getResponse(o);if(!r){let t="Please complete the RECAPTCHA";return e.preventDefault(),void alert(t)}jQuery("#wdt-employer-register-form-recaptcha").val(r),t(a).find('[data-target="wdt-milestone-progress-container"] [data-target="wdt-milestone-progress-item"]').first().trigger("wdt:complete"),t(a).find('[data-target="wdt-portal-employer-register-form-wizard-section"]').removeClass("active-section"),t(a).find('[data-target="wdt-portal-employer-register-form-wizard-section"]').attr("data-active","false"),t(a).find('[data-target="wdt-portal-employer-register-form-wizard-section"][data-section="999"]').addClass("active-section"),t(a).find('[data-target="wdt-portal-employer-register-form-wizard-section"][data-section="999"]').attr("data-active","true")})),t(document).on("change",'#wdt-portal-employer-register-form [name="wdt_user_company_details_industry"]',(function(e){let a=t(this).find("option[selected]"),o=t("#wdt-employer-register-form-industries");t(o).trigger("wdt-clearall"),t(a).each((function(e){let a=t.Event("wdt:select");a.label=t(this).text(),a.value=t(this).attr("value"),t(o).trigger(a)}))})),t('#wdt-portal-employer-register-form select[name="wdt_user_company"]').on("change",(function(e){let a=t(this).parents("#wdt-portal-employer-register-form").first(),o=t(this).val();o?jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/employers/tags/",data:{employer_slug:o},beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t("#wdt-portal-employer-register-form-company-proceed").prop("disabled",!0)},success:function(e){if(e.success)if(e.employer_found){if(t("#wdt-employer-register-form-company-detail
1s-fieldset").hide(),e.tag_data.nocs){let o=t("#wdt-employer-register-form-occupations");t(o).trigger("wdt-clearall"),e.tag_data.nocs.length?t(a).find('[data-target="wdt-portal-employer-register-form-occupations-prompt"]').show():t(a).find('[data-target="wdt-portal-employer-register-form-occupations-prompt"]').hide();for(let a of e.tag_data.nocs){let e=t.Event("wdt:select");e.label=a.slug.replace("noc","")+" - "+a.name,e.value=a.slug.replace("noc",""),t(o).trigger(e)}}if(e.tag_data.naics){let o=t("#wdt-employer-register-form-industries");t(o).trigger("wdt-clearall"),e.tag_data.naics.length?t(a).find('[data-target="wdt-portal-employer-register-form-sectors-prompt"]').show():t(a).find('[data-target="wdt-portal-employer-register-form-sectors-prompt"]').hide();for(let a of e.tag_data.naics){let e=t.Event("wdt:select");e.label=a.slug.replace("naics","")+" - "+a.name,e.value=a.slug.replace("naics",""),t(o).trigger(e)}}}else wdtAnnounce("Company not found, please fill out your company details below."),t("#wdt-employer-register-form-company-details-fieldset").show()},error:function(t){wdtDisplayNotification("Encountered issue retrieving Company data.","error",-1)},complete:function(){t("#wdt-portal-employer-register-form-company-proceed").prop("disabled",!1)}}):t("#wdt-employer-register-form-company-details-fieldset").hide()}))})),jQuery(document).ready((function(t){"use strict";t(document).on("wdt:unfollowed",'#wdt-portal-following-companies-container [data-target="following-companies"] [data-target="wdt-preview-panel"] [data-target="wdt-company-follow"]',(function(e){let a=t(this).parents('[data-target="wdt-preview-panel"]').first();t(a).slideUp("fast",(function(){t(a).remove()}))})),t(document).on("wdt:followed",'#wdt-portal-following-companies-container [data-target="suggested-companies"] [data-target="wdt-preview-panel"] [data-target="wdt-company-follow"]',(function(e){let a=t(this).parents('[data-target="wdt-preview-panel"]').first();t(a).slideUp("fast",(function(){t(a).remove()}))})),t(document).on("wdt:originFollowed",'#wdt-portal-following-companies-container [data-target="wdt-company-follow"], #wdt-portal-following-companies-container [data-target="wdt-suggestion-accept"]',(function(e){let a=t(this).attr("data-object-slug");t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/html/preview-panel/company/",data:{object_slug:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.success){let o=e.html,r=t.parseHTML(o);t(r).hide(),t('#wdt-portal-following-companies-container [data-target="following-companies"]').prepend(r),t(r).slideDown("fast"),t('#wdt-portal-following-companies-container [data-target="wdt-portal-suggestion-tray"] [data-suggestion-tray-target="suggestion"][data-object-slug="'+a+'"]').each((function(e){t(this).trigger("wdt:hideSuggestion")})),t('#wdt-portal-following-companies-container [data-target="no-follow-warning"]').slideUp("fast")}},error:function(t){console.log(t)}})}))})),jQuery(document).ready((function(t){"use strict";t(document).on("wdt:unfollowed",'#wdt-portal-following-industries-container [data-target="following-industries"] [data-target="wdt-preview-panel"] [data-target="wdt-industry-follow"]',(function(e){let a=t(this).parents('[data-target="wdt-preview-panel"]').first();t(a).slideUp("fast",(function(){t(a).remove()}))})),t(document).on("wdt:originFollowed",'#wdt-portal-following-industries-container [data-target="wdt-industry-follow"], #wdt-portal-following-industries-container [data-target="wdt-suggestion-accept"]',(function(e){let a=t(this).attr("data-object-slug");t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/html/preview-panel/industry/",data:{object_slug:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.success){let o=e.html,r=t.parseHTML(o);t(r).hide(),t('#wdt-portal-following-industries-container [data-target="following-industries"]').prepend(r),t(r).slideDown("fast"),t('#wdt-portal-following-industries-container [data-target="wdt-portal-suggestion-tray"] [data-suggestion-tray-target="suggestion"][data-object-slug="'+a+'"]').each((function(e){t(this).trigger("wdt:hideSuggestion")})),t('#wdt-portal-following-industries-container [data-target="no-follow-warning"]').slide
1Up("fast")}},error:function(t){console.log(t)}})}))})),jQuery(document).ready((function(t){"use strict";t(document).on("wdt:tableSort","#wdt-portal-following-job-posts #wdt-portal-following-job-posts-table",(function(e){let a=e._columnSlug,o=e._sortDir,r=t(this).find("tbody tr"),n=[],i=!0;r.each((function(e){n.push(this),t(this).detach();let o=t(this).find('td[data-target="'+a+'"').attr("data-sort-val");isNaN(o)&&(i=!1)}));let s=null;if("asc"===o)s=i?(e,o)=>{let r=t(e).find('td[data-target="'+a+'"').attr("data-sort-val"),n=t(o).find('td[data-target="'+a+'"').attr("data-sort-val");return parseFloat(r)-parseFloat(n)}:(e,o)=>{let r=t(e).find('td[data-target="'+a+'"').attr("data-sort-val"),n=t(o).find('td[data-target="'+a+'"').attr("data-sort-val");return r.localeCompare(n)};else s=i?(e,o)=>{let r=t(e).find('td[data-target="'+a+'"').attr("data-sort-val"),n=t(o).find('td[data-target="'+a+'"').attr("data-sort-val");return parseFloat(n)-parseFloat(r)}:(e,o)=>{let r=t(e).find('td[data-target="'+a+'"').attr("data-sort-val");return t(o).find('td[data-target="'+a+'"').attr("data-sort-val").localeCompare(r)};n.sort(s);for(let e of n)t(this).find("tbody").append(e)})),t(document).on("click",'[data-action="wdt-portal-following-job-posts-remove-btn"]',(function(e){let a=t(this).parents('[data-target="saved-job-row"]').first(),o=null,r=a.nextAll('[data-target="saved-job-row"]:visible').first();if(r.length)o=r;else{let e=a.prevAll('[data-target="saved-job-row"]:visible').first();if(e.length)o=e;else{let e=a.closest("table");o=e.length?e:t("#wdt-portal-following-job-posts-table").first()}}wdtUnfollowJobPost(t(this).attr("data-object-slug"),t(this).attr("data-nonce"),(function(e){e&&(t(a).remove(),wdtFocusElement(o),"function"==typeof wdtAnnounce&&wdtAnnounce("Successfully Unsaved Job"))}))})),t(document).on("wdt:followed-job",'#wdt-portal-my-jobs-feed [data-target="job-post-list-item"] [data-target="wdt-follow-job-post-btn"]',(function(e){let a=t(this).parents('[data-target="job-post-list-item"]').first(),o=null,r=a.prevAll('[data-target="job-post-list-item"]:visible').first();if(r.length)o=r;else{let t=a.nextAll('[data-target="job-post-list-item"]:visible').first();o=t.length?t:a.closest(".wdt-job-post-list")}t(a).slideUp(200,(function(){wdtFocusElement(o)}))}))})),jQuery(document).ready((function(t){"use strict";t(document).on("wdt:unfollowed",'#wdt-portal-following-occupations-container [data-target="following-occupations"] [data-target="wdt-preview-panel"] [data-target="wdt-occupation-follow"]',(function(e){let a=t(this).parents('[data-target="wdt-preview-panel"]').first();t(a).slideUp("fast",(function(){t(a).remove()}))})),t(document).on("wdt:originFollowed",'#wdt-portal-following-occupations-container [data-target="wdt-occupation-follow"], #wdt-portal-following-occupations-container [data-target="wdt-suggestion-accept"]',(function(e){let a=t(this).attr("data-object-slug");t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/html/preview-panel/occupation-2021/",data:{object_slug:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.success){let o=e.html,r=t.parseHTML(o);t(r).hide(),t('#wdt-portal-following-occupations-container [data-target="following-occupations"]').prepend(r),t(r).slideDown("fast"),t('#wdt-portal-following-occupations-container [data-target="wdt-portal-suggestion-tray"] [data-suggestion-tray-target="suggestion"][data-object-slug="'+a+'"]').each((function(e){t(this).trigger("wdt:hideSuggestion")})),t('#wdt-portal-following-occupations-container [data-target="no-follow-warning"]').slideUp("fast")}},error:function(t){console.log(t)}})}))})),jQuery(document).ready((function(t){"use strict";jQuery("#wdt-password-lost-form").on("submit",(function(t){var e,a=!0;jQuery('[name="wdt_user_email_address"]').val().length<1&&(a=!1,e="Please enter your email address.");var o=grecaptcha.getResponse(recaptchaWidget);o?jQuery("#wdt-password-lost-recaptcha-input").val(o):(e="Please complete the RECAPTCHA",a=!1),0==a&&(t.preventDefault(),alert(e))}))})),jQuery(document).ready((function(t){"use strict";
1t("#wdt-portal-onboard-client").length&&(t(document).on("wdt:showCaMSLookup","#wdt-portal-onboard-client",(function(e){let a=e._clientNumber,o=t(this).attr("data-service-provider"),r=t(t(this).find('template[data-target="cams-lookup"]').first().clone(!0).html());if(r.length)t(this).find('[data-target="onboard-client-content-area"]').first().empty(),t(this).find('[data-target="onboard-client-content-area"]').first().append(r),t(r).find('[data-target="wdt-material-form-date-input"]').trigger("wdtrf:register"),a&&t(r).find('[name="client_reference_number"]').val(a);else{let e=t(t(this).find('template[data-target="portal-profile-no-cams"]').first().clone(!0).html());t(e).find('[name="service_provider"]').val(o),t(this).find('[data-target="onboard-client-content-area"]').first().empty(),t(this).find('[data-target="onboard-client-content-area"]').first().append(e),t(e).find('[data-target="wdt-material-form-date-input"]').trigger("wdtrf:register")}})),t(document).on("wdt:showNoCaMSForm","#wdt-portal-onboard-client",(function(e){let a=t(this).attr("data-service-provider"),o=t(t(this).find('template[data-target="portal-profile-no-cams"]').first().clone(!0).html());t(o).find('[name="service_provider"]').val(a),t(this).find('[data-target="onboard-client-content-area"]').first().empty(),t(this).find('[data-target="onboard-client-content-area"]').first().append(o),t(o).find('[data-target="wdt-material-form-date-input"]').trigger("wdtrf:register")})),t(document).on("wdt:showLanding","#wdt-portal-onboard-client",(function(e){let a=t(t(this).find('template[data-target="portal-profile-pathway-selection"]').first().clone(!0).html());t(this).find('[data-target="onboard-client-content-area"]').first().empty(),t(this).find('[data-target="onboard-client-content-area"]').first().append(a)})),t(document).on("click",'#wdt-portal-onboard-client [data-action="request-client-transfer"]',(function(t){_wdtRenderContentModal("Request Client Transfer","This client is already assigned to another service provider. To complete a transfer, please contact "+WDT.site_title+" and provide them with the client details.","wdt-portal-modal-alt")})),t(document).on("submit",'#wdt-portal-onboard-client [data-target="wdt-portal-onboard-cams-lookup-form-container"] #wdt-portal-cams-lookup-form',(function(e){if(e.preventDefault(),t(this).data("disabled"))return;let a=t(this).parents('[data-target="wdt-portal-onboard-cams-lookup-form-container"]'),o=t(this).serializeArray();t(this).data("disabled",!0);let r=this,n=t(a).find('[data-target="wdt-portal-onboard-cams-lookup-form-results"]');t(n).html("");let i=t(t(a).find('template[data-target="spinner"]').clone(!0).html());jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/cams/client-lookup/",data:o,beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(n).append(i)},success:function(e){if(e.success)if(e.client_data){let o=e.client_data,r=t(t(a).find('template[data-target="table"]').clone(!0).html()),i=t(t(r).find('[data-target="template-table"]').get(0).content).find('[data-target="template-row"]').clone(),s="";if(o.first_name&&o.last_name){if(s="<span>"+(o.first_name+" "+o.last_name)+"</span>",o.email&&(s+='<div class="wdt-portal-table-subtext email-subtext"><span>'+o.email+"</span></div>"),o.phone&&(s+='<div class="wdt-portal-table-subtext phone-subtext"><span>'+o.phone+"</span></div>"),i.find('td[data-column="button"] button[data-action="use-cams-client"]').attr("data-first-name",o.first_name?o.first_name:"—"),i.find('td[data-column="button"] button[data-action="use-cams-client"]').attr("data-last-name",o.last_name?o.last_name:"—"),i.find('td[data-column="button"] button[data-action="use-cams-client"]').attr("data-stream",o.stream?o.stream:"—"),i.find('td[data-column="button"] button[data-action="use-cams-client"]').attr("data-marital-status",o.marital_status?o.marital_status:"—"),i.find('td[data-column="button"] button[data-action="use-cams-client"]').attr("data-immigration-status",o.immigration_status?o.immigration_status:"—"),i.find('td[data-column="button"] button[data-action="use-cams-client"]').attr("data-preferred-language",o.preferred_language?o.preferred_language:"—"),i.find('td[data-column="button"] button[data-action="use-cams-client"]').attr("data-population-groups",o.identities&&o.identities.length?o.identities.join(", "):"—"),i.find('td[data-column="button"] button[data-action="use-cams-client"]').attr("data-email",o.email?o.email:"—"),i.find('td[data-column="button"] button[data-action="use-cams-client"]').attr("data-phone",o.phone?o.phone:"—"),i.find('td[data-column="button"] button[data-action="use-cams-client"]').attr("data-address",o.address?o.address:"—"),e.portal_users.length>0){t(i).find('button[data-action="use-cams-client"]').hide();let a=null;for(let t of e.portal_users)if(t.permissions.includes("manage")){a=t;break}if(a){let e=new URL(t(i).find('[data-target="client-link"]').attr("href"));e.searchParams.set("wdt-client",a.id),t(i).find('[data-target="client-link"]').attr("href",e.href),t(i).find('[data-target="client-link"]').show()}else t(i).find('button[data-action="request-client-transfer"]').show()}}i.find('td[data-column="name"]').html(s),o.ref_number&&(i.find('td[data-column="cams"]').text(o.ref_number),i.find('td[data-column="button"] button').attr("data-cams-ref",o.ref_number)),o.date_of_birth&&i.find('td[data-column="birth"]').text(o.date_of_birth),o.city&&i.find('td[data-column="city"]').text(o.city),t(r).find('tbody[data-target="portal-table-body"]').append(i),t(n).append(r);let d=a.find('[data-action="wdt-portal-existing-client-lookup-form-skip"]');d.prop("disabled",!1),d.closest(".wdt-portal-existing-client-lookup-form-continue-container").removeAttr("hidden")}else{let e=t(t(a).find('template[data-target="failure"]').clone(!0).html());t(n).append(e)}else wdtDisplayNotification("Unable to retrieve CaMS data.","error",-1)},error:function(t){"abort"!==t.statusText&&(wdtDisplayNotification("Unable to retrieve clients. Please contact administrator.","error",-1),console.log(t))},complete:function(){t(r).data("disabled",!1),t(i).remove()}})}
1)),t(document).on("submit",'#wdt-portal-onboard-client [data-target="wdt-portal-onboard-common-assessment-lookup-form-container"] #wdt-portal-common-assessment-lookup-form',(function(e){if(e.preventDefault(),t(this).data("disabled"))return;let a=t(this),o=a.parents('[data-target="wdt-portal-onboard-common-assessment-lookup-form-container"]'),r=a.serializeArray();a.data("disabled",!0);let n=o.find('[data-target="wdt-portal-onboard-common-assessment-lookup-form-results"]').html(""),i=t(o.find('template[data-target="spinner"]').clone(!0).html());jQuery.ajax({method:"get",url:WDT.rest_url+"wedatatools/v1/portal/cams/common-assessment-lookup/",data:r,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),n.append(i)}}).always((function(){a.data("disabled",!1),i.remove()})).error((function(t){"abort"!==t.statusText&&(wdtDisplayNotification("Unable to retrieve clients. Please contact administrator.","error",-1),console.log(t))})).success((function(e){if(!e.hasOwnProperty("success")||!0!==e.success)return void wdtDisplayNotification("Unable to retrieve Common Assessment data.","error",-1);if(!e.hasOwnProperty("common_assessment")){let e=t(t(o).find('template[data-target="failure"]').clone(!0).html());return void n.append(e)}let a=e.common_assessment.caDetails.caClientInfo,r=e.common_assessment.caDetails.caMetaData,i=e.common_assessment.caDetails.caQuestionResponsesList,s=r.caNumber,d="",l="";for(let t of i)if("CA97_1"===t.questionCode){let e=t.answerEN,a=e.split(" ");a.length&&(l=a[0],d=e);break}let c=t(t(o).find('template[data-target="table"]').clone(!0).html()),p=t(t(c).find('[data-target="template-table"]').get(0).content).find('[data-target="template-row"]').clone(),u="";if(a.firstName&&a.lastName){u="<span>"+(a.firstName+" "+a.lastName)+"</span>",a.email&&(u+='<div class="wdt-portal-table-subtext email-subtext"><span>'+a.email+"</span></div>"),a.phoneNum&&(u+='<div class="wdt-portal-table-subtext phone-subtext"><span>'+a.phoneNum+"</span></div>"),e.client_number?(console.log(e.client_number),p.find('td[data-column="button"] button[data-target="use-common-assessment-client"]').text("Search CaMS Profile"),p.find('td[data-column="button"] button[data-target="use-common-assessment-client"]').attr("data-cams-ref",e.client_number),p.find('td[data-column="button"] button[data-target="use-common-assessment-client"]').attr("data-action","search-cams-ref")):(p.find('td[data-column="button"] button[data-target="use-common-assessment-client"]').attr("data-first-name",a.firstName?a.firstName:"—"),p.find('td[data-column="button"] button[data-target="use-common-assessment-client"]').attr("data-last-name",a.lastName?a.lastName:"—"),p.find('td[data-column="button"] button[data-target="use-common-assessment-client"]').attr("data-stream",r.stream?r.stream:"—"),p.find('td[data-column="button"] button[data-target="use-common-assessment-client"]').attr("data-marital-status",a.maritalStatus?a.maritalStatus:"—"),p.find('td[data-column="button"] button[data-target="use-common-assessment-client"]').attr("data-immigration-status",a.immigratedToCanada?a.immigratedToCanada:"—"),p.find('td[data-column="button"] button[data-target="use-common-assessment-client"]').attr("data-preferred-language",a.preferredLanguage?a.preferredLanguage:"—"),p.find('td[data-column="button"] button[data-target="use-common-assessment-client"]').attr("data-preferred-name",a.preferredFirstName?a.preferredFirstName:""),p.find('td[data-column="button"] button[data-target="use-common-assessment-client"]').attr("data-population-groups",a.identities&&a.identities.length?a.identities.join(", "):"—"),p.find('td[data-column="button"] button[data-target="use-common-assessment-client"]').attr("data-email",a.email?a.email:"—"),p.find('td[data-column="button"] button[data-target="use-common-assessment-client"]').attr("data-phone",a.phoneNum?a.phoneNum:"—"),p.find('td[data-column="button"] button[data-target="use-common-assessment-client"]').attr("data-address",a.streetNum?`${a.streetNum} ${a.streetName}, ${a.city}, ${a.province}, ${a.postalCode}`:"—"),p.find('td[data-column="button"] button[data-target="use-common-assessment-client"]').attr("data-birth-date","—"),p.find('td[data-column="button"] button[data-target="use-common-assessment-client"]').attr("data-target-occupation",d),p.find('td[data-column="button"] button[data-target="use-common-assessment-client"]').attr("data-target-occupation-code",l))}if(p.find('td[data-column="name"]').html(u),s&&(p.find('td[data-column="ca"]').text(s),p.find('td[data-column="button"] button').attr("data-ca-number",s)),a.dateOfBirth&&a.dateOfBirth.date){const t=new Date(a.dateOfBirth.date);let e=`${t.getFullYear()}
1-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`;p.find('td[data-column="birth"]').text(e),p.find('td[data-column="button"] button[data-action="use-common-assessment-client"]').attr("data-birth-date",e)}if(a.city&&p.find('td[data-column="city"]').text(a.city),e.portal_users.length>0){t(p).find('button[data-target="use-common-assessment-client"]').hide();let a=null;for(let t of e.portal_users)if(t.permissions.includes("manage")){a=t;break}if(a){let e=new URL(t(p).find('[data-target="client-link"]').attr("href"));e.searchParams.set("wdt-client",a.id),t(p).find('[data-target="client-link"]').attr("href",e.href),t(p).find('[data-target="client-link"]').show()}else t(p).find('button[data-action="request-client-transfer"]').show()}c.find('tbody[data-target="portal-table-body"]').append(p),n.append(c);let f=o.find('[data-action="wdt-portal-existing-client-lookup-form-skip"]');f.prop("disabled",!1),f.closest(".wdt-portal-existing-client-lookup-form-continue-container").removeAttr("hidden")}))})),t(document).on("click",'#wdt-portal-onboard-client [data-target="wdt-portal-onboard-cams-table"] [data-action="use-cams-client"]',(function(e){let a=t(this).parents("#wdt-portal-onboard-client").first(),o=t(this).attr("data-cams-ref"),r=t(this).attr("data-first-name"),n=t(this).attr("data-last-name"),i=t(t(a).find('template[data-target="wdt-portal-client-confirm-cams-import"]').clone(!0).html());t(i).find('[data-target="confirm-cams-import-client"]').text(r+" "+n+" - "+o),t(i).find('[data-action="wdt-portal-import-cams-data"]').attr("data-cams-ref",o),t(i).find('[data-action="wdt-portal-import-cams-data"]').attr("data-first-name",r),t(i).find('[data-action="wdt-portal-import-cams-data"]').attr("data-last-name",n),t(i).find('[data-action="wdt-portal-import-cams-data"]').attr("data-stream",t(this).attr("data-stream")),t(i).find('[data-action="wdt-portal-import-cams-data"]').attr("data-marital-status",t(this).attr("data-marital-status")),t(i).find('[data-action="wdt-portal-import-cams-data"]').attr("data-immigration-status",t(this).attr("data-immigration-status")),t(i).find('[data-action="wdt-portal-import-cams-data"]').attr("data-preferred-language",t(this).attr("data-preferred-language")),t(i).find('[data-action="wdt-portal-import-cams-data"]').attr("data-population-groups",t(this).attr("data-population-groups")),t(i).find('[data-action="wdt-portal-import-cams-data"]').attr("data-email",t(this).attr("data-email")),t(i).find('[data-action="wdt-portal-import-cams-data"]').attr("data-phone",t(this).attr("data-phone")),t(i).find('[data-action="wdt-portal-import-cams-data"]').attr("data-address",t(this).attr("data-address")),_wdtRenderContentModal("Are you sure you want to import CaMS data?",t(i).prop("outerHTML"),"wdt-portal-modal","wdt-portal-client-confirm-cams-import")})),t(document).on("click",'#wdt-portal-client-confirm-cams-import [data-action="wdt-portal-import-cams-data"]',(function(e){wdtForceRemoveContentModal();let a=t("#wdt-portal-onboard-client").first(),o=t(a).attr("data-service-provider"),r=t(this).attr("data-cams-ref"),n=t(this).attr("data-first-name"),i=t(this).attr("data-last-name"),s=t(this).attr("data-email"),d=t(t(a).find('template[data-target="portal-profile-cams"]').first().clone(!0).html());t(d).find('[name="service_provider"]').val(o),t(d).find('[name="cams_reference"]').val(r),t(d).find('[name="first_name"]').val(n),t(d).find('[name="last_name"]').val(i),t(d).find('[name="email"]').val(s),t(d).find('[data-target="onboard-form-cams-client-name"]').text(n+" "+i+" - "+r),t(d).find('[data-target="cams-data-list"] [data-target="cams-reference"]').text(t(this).attr("data-cams-ref")),t(d).find('[data-target="cams-data-list"] [data-target="cams-client-stream"]').text(t(this).attr("data-stream")),t(d).find('[data-target="cams-data-list"] [data-target="cams-marital-status"]').text(t(this).attr("data-marital-status")),t(d).find('[data-target="cams-data-list"] [data-target="cams-immigration-status"]').text(t(this).attr("data-immigration-status")),t(d).find('[data-target="cams-data-list"] [data-target="cams-preferred-language"]').text(t(this).attr("data-preferred-language")),t(d).find('[data-target="cams-data-list"] [data-target="cams-identities"]').text(t(this).attr("data-population-groups")),t(d).find('[data-target="cams-data-list"] [data-target="cams-primary-email"]').text(t(this).attr("data-email")),t(d
1).find('[data-target="cams-data-list"] [data-target="cams-primary-phone"]').text(t(this).attr("data-phone")),t(d).find('[data-target="cams-data-list"] [data-target="cams-primary-address"]').text(t(this).attr("data-address")),t(a).find('[data-target="onboard-client-content-area"]').first().empty(),t(a).find('[data-target="onboard-client-content-area"]').first().append(d),t(d).find('[data-target="wdt-material-form-date-input"]').trigger("wdtrf:register")})),t(document).on("click",'#wdt-portal-onboard-client [data-action="wdt-portal-invite-skip-to-no-cams"]',(function(e){let a=t(this).parents("#wdt-portal-onboard-client").first();t(a).trigger("wdt:showNoCaMSForm")})),t(document).on("click",'#wdt-portal-onboard-client [data-action="search-cams-ref"]',(function(e){let a=t(this).attr("data-cams-ref"),o=t(this).parents("#wdt-portal-onboard-client").first(),r=t.Event("wdt:showCaMSLookup");r._clientNumber=a,t(o).trigger(r)})),t(document).on("click",'#wdt-portal-onboard-client [data-action="use-common-assessment-client"]',(function(e){let a=t(this).parents("#wdt-portal-onboard-client").first(),o={ca_number:t(this).attr("data-ca-number"),first_name:t(this).attr("data-first-name"),last_name:t(this).attr("data-last-name"),marital_status:t(this).attr("data-marital-status"),immigration_status:t(this).attr("data-immigration-status"),preferred_language:t(this).attr("data-preferred-language"),population_groups:t(this).attr("data-population-groups"),email:t(this).attr("data-email"),phone:t(this).attr("data-phone"),address:t(this).attr("data-address"),birth_date:t(this).attr("data-birth-date"),target_occupation_code:t(this).attr("data-target-occupation-code"),target_occupation:t(this).attr("data-target-occupation"),preferred_name:t(this).attr("data-preferred-name")},r=t(t(a).find('template[data-target="portal-profile-common-assessment"]').first().clone(!0).html()),n=function(e){if("object"!=typeof e)return console.error("Could not get Common Assessment Data",e),null;let a='<div class="common-assessment-details-container">';return a+="<p>Client Profile</p>",a+='<div class="common-assessment-details-client-profile">',e.ca_number&&"—"!==e.ca_number&&(a+=`<p>CA Number</p><p>${e.ca_number}</p>`),e.birth_date&&"—"!==e.birth_date&&(a+=`<p>Birth Date</p><p>${e.birth_date}</p>`),e.marital_status&&"—"!==e.marital_status&&(a+=`<p>Marital Status</p><p>${e.marital_status}</p>`),e.immigration_status&&"—"!==e.immigration_status&&(a+=`<p>Immigration Status</p><p>${e.immigration_status}</p>`),e.preferred_language&&"—"!==e.preferred_language&&(a+=`<p>Preferred Language</p><p>${e.preferred_language}</p>`),a+="</div>",a+="<p>Contact</p>",a+='<div class="common-assessment-details-contact">',e.email&&"—"!==e.email&&(a+=`<p>Primary Email Address</p><p>${e.email}</p>`),e.phone&&"—"!==e.phone&&(a+=`<p>Primary Phone Number</p><p>${e.phone}</p>`),e.address&&"—"!==e.address&&(a+=`<p>Primary Mailing Address</p><p>${e.address}</p>`),a+="</div>",a+="</div>",t(a)}(o);if(null!==n){if(r.find("#wdt-portal-client-onboarding-form-common-assessment-data").append(n),t(a).find('[data-target="onboard-client-content-area"]').first().empty(),t(a).find('[data-target="onboard-client-content-area"]').first().append(r),o.first_name&&(t(`<p class="common-assessment-form-name">${o.first_name} ${o.last_name} - ${o.ca_number}</p>`).insertAfter(".wdt-portal-onboard-client-form-container > .wdt-portal-onboard-client-form-heading-container"),t(r).find('[name="first_name"]').first().val(o.first_name),t(r).find('[name="last_name"]').first().val(o.last_name)),o.email&&(t(r).find("#wdt-portal-client-onboarding-form-email").val(o.email),t(r).find("#wdt-portal-client-onboarding-form-email").trigger("change")),o.ca_number&&t(r).find("#wdt-portal-client-onboarding-form-ca-number-hidden").val(o.ca_number),o.phone&&t(r).find('[name="phone"]').first().val(o.phone),o.preferred_language&&t(r).find('[name="preferred_language"]').first().val(o.preferred_language),o.preferred_name&&t(r).find('[name="preferred_name"]').first().val(o.preferred_name),o.birth_date&&t(r).find('[name="date_of_birth"]').first().val(o.birth_date),o.address&&t(r).find('[name="street_address"]').first().val(o.address),5===o.target_occupation_code.length){let e=t.Event("wdt:select");e.label=o.target_occupation,e.value=o.target_occupation_code,t(r).find('[name="target_occupations[]"]').trigger(e)}t(r).find('[data-target="wdt-material-form-date-input"]').trigger("wdtrf:register")}}
1)),t(document).on("change",'#wdt-portal-onboard-client #wdt-portal-client-onboarding-form [name="service_provider"]',(function(e){let a=t(this).parents("#wdt-portal-client-onboarding-form").first(),o=t(this).val(),r=t(a).find('[name="caseworker"]'),n=t(r).parents('[data-wdt-material-form-target="typeahead-select-container"]').first();if(o){if(o===t(r).attr("data-service-provider"))return;t(r).attr("data-service-provider",o),t(r).trigger("wdt-clearall"),t(r).trigger("wdt:undisable");let e=t(n).attr("data-action");e=e.split("?").shift(),e+="?serviceProviders="+o,t(n).attr("data-action",e)}else t(r).trigger("wdt-clearall"),t(r).trigger("wdt:disable"),t(r).prop("data-service-provider",!1)})),t(document).on("click",'#wdt-portal-onboard-client [data-action="wdt-portal-onboard-client-cancel"]',(function(e){let a=t(this).parents("#wdt-portal-onboard-client").first();t(a).trigger("wdt:showLanding")})),t(document).on("submit",'#wdt-portal-onboard-client [data-target="wdt-portal-onboard-client-lookup-form-container"] #wdt-portal-existing-client-lookup-form',(function(e){if(e.preventDefault(),t(this).data("disabled"))return;let a=t(this).parents('[data-target="wdt-portal-onboard-client-lookup-form-container"]');t(a).find('[data-action="wdt-portal-existing-client-lookup-form-skip"]').prop("disabled",!0);let o=t(this).serializeArray();t(this).data("disabled",!0);let r=this,n=t(a).find('[data-target="wdt-portal-onboard-client-lookup-form-results"]');t(n).html("");let i=t(t(a).find('template[data-target="spinner"]').clone(!0).html());jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/clients/",data:o,beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(n).append(i)},success:function(e){if(e.success){let o=e.body.clients;if(0===o.length){let e=t(t(a).find('template[data-target="success"]').clone(!0).html());t(n).append(e);let o=a.find('[data-action="wdt-portal-existing-client-lookup-form-skip"]');o.prop("disabled",!1),o.closest(".wdt-portal-existing-client-lookup-form-continue-container").removeAttr("hidden")}else{let e=t(t(a).find('template[data-target="table"]').clone(!0).html());for(let a of o){let o=t(t(e).find('[data-target="template-table"]').get(0).content).find('[data-target="template-row"]').clone(),r="";if(a.full_name&&a.id){let t=a.full_name;r=a.editable&&a.client_link?'<a class="wdt-portal-table-link" href="'+a.client_link+'">'+t+"</a>":"<span>"+t+"</span>",a.archived&&(r+='<span class="wdt-archived-badge">Archived</span>'),a.status&&(r+='<div class="wdt-portal-table-subtext user-subtext"><span>'+a.status+"</span></div>"),a.email&&(r+='<div class="wdt-portal-table-subtext email-subtext"><span>'+a.email+"</span></div>"),a.phone&&(r+='<div class="wdt-portal-table-subtext phone-subtext"><span>'+a.phone+"</span></div>")}if(o.find('td[data-column="name"]').html(r),a.cams_ref&&o.find('td[data-column="cams"]').text(a.cams_ref),a.service_providers&&a.service_providers.length>0){let t=[];for(let e of a.service_providers)t.push(e.label);o.find('td[data-column="service-provider"]').text(t.join(", "))}a.cams_profile&&a.cams_profile.birth_date?o.find('td[data-column="birth"]').text(a.cams_profile.birth_date):a.date_of_birth?o.find('td[data-column="birth"]').text(a.date_of_birth):a.birth_year&&a.birth_year>0&&o.find('td[data-column="birth"]').text(a.birth_year),a.cams_profile&&a.cams_profile.city&&o.find('td[data-column="city"]').text(a.cams_profile.city),a.editable&&a.client_link&&o.find('td[data-column="link"] a[data-target="profile-link"]').attr("href",a.client_link),a.editable||(o.find('td[data-column="link"] a[data-target="profile-link"]').remove(),o.find('td[data-column="link"] button[data-action="request-client-transfer"]').show()),t(e).find('tbody[data-target="portal-table-body"]').append(o)}t(n).append(e);let r=a.find('[data-action="wdt-portal-existing-client-lookup-form-skip"]');r.prop("disabled",!1),r.closest(".wdt-portal-existing-client-lookup-form-continue-container").removeAttr("hidden")}}},error:function(t){"abort"!==t.statusText&&(wdtDisplayNotification("Unable to retrieve clients. Please contact administrator.","error",-1),console.log(t))},complete:function(){t(r).data("disabled",!1),t(i).remove()}})}
1)),t(document).on("click",'#wdt-portal-onboard-client [data-target="wdt-portal-onboard-client-lookup-form-container"] [data-action="wdt-portal-existing-client-lookup-form-skip"]',(function(e){let a=t(this).parents("#wdt-portal-onboard-client").first(),o=t(t(a).find('template[data-target="portal-profile-pathway-selection"]').first().clone(!0).html());o.length&&(t(a).find('[data-target="onboard-client-content-area"]').first().empty(),t(a).find('[data-target="onboard-client-content-area"]').first().append(o))})),t(document).on("click","#wdt-portal-onboard-path-cams",(function(){let e=t(this).parents("#wdt-portal-onboard-client").first();t(e).trigger("wdt:showCaMSLookup")})),t(document).on("click","#wdt-portal-onboard-path-ca",(function(){let e=t(this).parents("#wdt-portal-onboard-client").first(),a=t(e).attr("data-service-provider"),o=t(t(e).find('template[data-target="common-assessment-lookup"]').first().clone(!0).html());if(o.length)t(e).find('[data-target="onboard-client-content-area"]').first().empty(),t(e).find('[data-target="onboard-client-content-area"]').first().append(o),t(o).find('[data-target="wdt-material-form-date-input"]').trigger("wdtrf:register");else{let o=t(t(e).find('template[data-target="portal-profile-no-cams"]').first().clone(!0).html());t(o).find('[name="service_provider"]').val(a),t(e).find('[data-target="onboard-client-content-area"]').first().empty(),t(e).find('[data-target="onboard-client-content-area"]').first().append(o),t(o).find('[data-target="wdt-material-form-date-input"]').trigger("wdtrf:register")}})),t(document).on("submit","#wdt-portal-onboard-client #wdt-portal-client-onboarding-form",(function(e){if(e.stopPropagation(),e.preventDefault(),t(this).prop("disabled"))return;let a=this;t(a).prop("disabled",!0),t('#wdt-portal-onboard-client [data-action="wdt-portal-onboard-client-submit"]').prop("disabled",!0);let o=t(a).serializeArray();t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/clients/create/",data:o,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.success){let a=t(t('#wdt-portal-onboard-client template[data-target="client-created-modal"]').first().html());t(a).find('[data-target="client-email"]').text(e.email),t(a).find('[data-action="wdt-portal-invitation-email-sent-copy-invite"]').attr("data-content",e.copyable_content),t(a).find('[data-target="client-link"]').attr("href",e.user_link),_wdtRenderContentModal("Client has been added",t(a).prop("outerHTML"),"wdt-portal-modal","wdt-portal-onboard-client-modal",!1,!1),t("").on("wdt:destroy",(function(t){window.location.replace(e.user_link)}))}else t(a).prop("disabled",!1),t('#wdt-portal-onboard-client [data-action="wdt-portal-onboard-client-submit"]').prop("disabled",!1),wdtDisplayNotification("Unable to create client.","error",-1)},error:function(e){t(a).prop("disabled",!1);let o="Error encountered when creating client.";e.responseJSON.code&&"WDT-UE"===e.responseJSON.code&&(o="Error encountered when creating client: A user already exists with this email."),t('#wdt-portal-onboard-client [data-action="wdt-portal-onboard-client-submit"]').prop("disabled",!1),wdtDisplayNotification(o,"error",-1)}})})))})),jQuery(document).ready((function(t){"use strict";t(document).on("submit","#wdt-portal-onboard-staff #wdt-portal-staff-onboarding-form",(function(e){if(e.stopPropagation(),e.preventDefault(),t(this).prop("disabled"))return;t(this).prop("disabled",!0),t('#wdt-portal-onboard-staff [data-action="submit-onboard-staff"]').prop("disabled",!0);let a=t(this).serializeArray();t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/staff/create/",data:a,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.success){let a=t(t('#wdt-portal-onboard-staff template[data-target="staff-created-modal"]').first().html());t(a).find('[data-target="client-email"]').text(e.email),t(a).find('[data-action="wdt-portal-invitation-email-sent-copy-invite"]').attr("data-content",e.copyable_content),t(a).find('[data-target="client-link"]').attr("href",e.user_link),_wdtRenderContentModal("Staff has been added",t(a).prop("outerHTML"),"wdt-portal-modal","wdt-portal-onboard-staff-modal",!1,!1),t("").on("wdt:destroy",(function(t){window.location.replace(e.user_link)}))}else t(this).prop("disabled",!1),t('#wdt-portal-onboard-staff [data-action="submit-onboard-staff"]').prop("disabled",!1),wdtDisplayNotification("Unable to create staff account.","error",-1)},error:function(e){console.log(e),t(this).prop("disabled",!1),t('#wdt-portal-onboard-staff [data-action="submit-onboard-staff"]').prop("disabled",!1),wdtDisplayNotification("Error encountered when creating staff account.","error",-1)}})}))})),jQuery(document).ready((function(t){"use strict";t('#wdt-portal-create-password #wdt-password-create-form [name="password"]').on("change",(function(e){let a=t('#wdt-portal-create-password #wdt-password-create-form [name="password_confirm"]');t(this).trigger("wdt:checkPWValidity"),t(a).trigger("wdt:checkPWValidity")})),t('#wdt-portal-create-password #wdt-password-create-form [name="password_confirm"]').on("change",(function(e){let a=t('#wdt-portal-create-password #wdt-password-create-form [name="password"]');t(this).trigger("wdt:checkPWValidity"),t(a).trigger("wdt:checkPWValidity")})),t('#wdt-portal-create-password #wdt-password-create-form [name="password"]').on("wdt:checkPWValidity",(function(e){let a=t('#wdt-portal-create-password #wdt-password-create-form [name="password_confirm"]');t(this)[0].setCustomValidity("");let o=t(this).val();o.includes("/")||o.includes("\\")?t(this)[0].setCustomValidity("Password cannot contain slashes."):o.length<8?t(this)[0].setCustomValidity("Password must be a minimum of 8 characters."):o.match("^(?=.*?[A-Za-z])(?=.*\\d)")?o===t(a).val()||t(this)[0].setCustomValidity("Passwords do not match."):t(this)[0].setCustomValidity("Password must contain at least 1 letter and 1 number.")})),t(document).on("submit","#wdt-portal-create-password #wdt-password-create-form",(function(e){if(e.stopPropagation(),e.preventDefault(),t(this).prop("disabled"))return;t(this).prop("disabled",!0);let a=t(this).serializeArray();t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/password/create/",data:a,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success?(wdtDisplayNotification("Password created. Directing to login","success",3e3),setTimeout((function(){let e=t("#
1wdt-portal-create-password").attr("data-login-link");window.location.replace(e)}),2e3)):(t(this).prop("disabled",!1),wdtDisplayNotification("Unable to create password.","error",-1))},error:function(e){console.log(e),t(this).prop("disabled",!1),wdtDisplayNotification("Error encountered creating password.","error",-1)}})}))})),jQuery(document).ready((function(t){"use strict";var e=null,a=!1;if(t("#wdt-portal-my-clients-table").length||t('#wdt-portal-my-clients  [data-table-target="wdt-portal-my-clients-table"]').length){function r(){let t=window.location.href,e=new URLSearchParams(t);e.delete("wdt-page"),wfwe_setCookie("wdt_people_filters",e.toString(),365)}function n(){let e=t('[data-target="wdt-portal-dropdown-action-menu-toggle"]'),a=t(".wdt-my-clients-bulk-case-notes-btn"),o=t('#wdt-portal-my-clients-table [name="people-select"]'),r=t(o).map((function(){if(this.checked)return t(this).val()})).get();r.length?e.prop("disabled",!1):e.prop("disabled",!0),r.length>1?a.show():a.hide(),o.length>0&&r.length===o.length?t('#wdt-portal-my-clients [data-table-target="wdt-portal-my-clients-table"] [name="people-select-all"]').prop("checked",!0):t('#wdt-portal-my-clients [data-table-target="wdt-portal-my-clients-table"] [name="people-select-all"]').prop("checked",!1)}function i(o=1){if(a)return;let r=t("#wdt-portal-my-clients-table").first(),i=t(r).parents('[data-target="portal-table-container"]').first(),s=t('input[name="wdt-portal-my-clients-search"]').val(),d=t('select[name="wdt-portal-my-clients-per-page"]').val(),l=t(r).attr("data-sort"),c=new URL(window.location),p=c.searchParams.getAll("types[]"),u=c.searchParams.getAll("genders[]"),f=c.searchParams.getAll("identifies[]"),g=c.searchParams.getAll("transfer_status[]"),m=c.searchParams.getAll("access_to_transportation[]"),w=c.searchParams.get("employment_status"),h=c.searchParams.get("education_level"),b=c.searchParams.get("last_active"),y=c.searchParams.get("last_active_limit"),v=c.searchParams.get("no_saved_jobs"),_=c.searchParams.get("no_resumes"),k=c.searchParams.get("no_cams_link"),x=c.searchParams.get("overdue_tasks"),j=c.searchParams.get("incomplete_profile"),C=c.searchParams.get("only_archived"),D=c.searchParams.get("age_min"),T=c.searchParams.get("age_max"),N=c.searchParams.getAll("following_occupations[]"),S=c.searchParams.getAll("following_skills[]"),E=c.searchParams.getAll("caseworkers[]"),P=c.searchParams.getAll("service_providers[]"),R=c.searchParams.getAll("client_stream[]"),W=c.searchParams.get("eap_status"),Q=c.searchParams.get("postal_code"),O=c.searchParams.getAll("cities[]"),A=c.searchParams.get("is_transient"),F=c.searchParams.get("match_mode"),M=c.searchParams.get("my-clients-only"),L=c.searchParams.getAll("referral_source[]"),q=c.searchParams.getAll("client_ids[]");if(t("#wdt-portal-my-clients").find('[data-target="wdt-portal-my-clients-footer"]').find('[data-target="wdt-portal-my-clients-footer-total"]').html(""),r.length)r.each((function(a){let r=this;t(i).find('tbody[data-target="portal-table-body"]').find("td").addClass("wdt-portal-table-body-element-loading"),t(i).find('td input[type="checkbox"]').remove();let c={nonce:t(this).attr("data-nonce"),number:d,query:s,page:o,sort:l,types:p,genders:u,identifies:f,access_to_transportation:m,employment_status:w,education_level:h,last_active:b,last_active_limit:y,no_saved_jobs:v,no_resumes:_,incomplete_profile:j,only_archived:C,age_min:D,age_max:T,following_occupations:N,following_skills:S,overdue_tasks:x,caseworkers:E,no_cams_link:k,service_providers:P,client_stream:R,eap_status:W,postal_code:Q,cities:O,is_transient:A,match_mode:F,transfer_status:g,my_clients_only:M,referral_source:L,client_ids:q.length?q:null,include_cams_profile:!0};for(let t in c)null===c[t]&&delete c[t];e&&e.abort(),e=jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/clients/",data:c,beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(i).find('[data-target="spinner"]').show(),t('#wdt-portal-my-clients [data-target="no-matches-found"]').hide(),t('#wdt-portal-my-clients [data-target="result-count-container"]').hide(),n()},success:function(e){if(t(i).find('tbody[data-target="portal-table-body"]').html(""),e.success){if(t(r).siblings('[data-target="wdt-portal-my-clients-footer"]').find('[data-target="wdt-portal-my-clients-footer-total"]').html("<strong>"+e.body.page+"</strong> of "+e.body.max_page),e.body.clients.length)for(let a of e.body.clients){let e=t(t(i).find('[data-target="template-table"]').get(0).content).find('[data-target="template-row"]').clone();e.find('td[data-column="checkbox"]').find('input[name="people-select"]').val(a.id),a.has_assignment&&e.find('td[data-column="checkbox"]').find('input[name="people-select"]').attr("data-has-staff","true"),a.is_referral&&e.find('td[data-column="checkbox"]').find('input[name="people-select"]').attr("data-is-referral","true"),a.is_new_client&&e.find('td[data-column="checkbox"]').find('input[name="people-select"]').attr("data-is-new-client","true"),a.actionable||e.find('td[data-column="checkbox"] *').remove();let o="";if(a.full_name&&a.id){let t=a.full_name;o='<a class="wdt-portal-table-link" href="?wdt-page=client&wdt-client='+a.id+'">'+t+"</a>";let e=[];
1if(a.archived&&e.push('<span class="wdt-archived-badge" data-metadata="archived">Archived</span>'),a.status&&e.push('<div class="wdt-portal-table-subtext status-subtext" data-metadata="user-type" data-status="'+a.status+'">'+a.status+"</div>"),""!==a.transfer_request_status&&e.push('<div class="wdt-portal-table-subtext status-subtext" data-metadata="transfer-request-status" data-status="transfer-status">'+a.transfer_request_status+"</div>"),e.length&&(o+='<div class="wdt-portal-table-subtext-group">'+e.join("")+"</div>"),a.cams_ref||a.eap_number){if(o+='<div class="wdt-portal-client-ids data-metadata-group="client-ids">',a.cams_ref&&(o+='<div class="wdt-portal-client-id-line" data-metadata="cams-id"><span class="wdt-portal-client-id-label">CaMS ID</span><span class="wdt-portal-client-id-value">'+a.cams_ref+"</span></div>"),a.eap_number){o+='<div class="wdt-portal-client-id-line" data-metadata="eap-number"><span class="wdt-portal-client-id-label">EAP</span><a class="wdt-portal-client-eap-link" href="'+("?wdt-page=client&wdt-client="+a.id+"&wdt-client-tab=cams")+'">'+a.eap_number+"</a></div>"}o+="</div>"}if(a.cams_profile?.email||a.email){let t=a.cams_profile?.email||a.email;o+='<div class="wdt-portal-table-subtext email-subtext" data-metadata="user-email"><a class="wdt-portal-table-subtext-link" href="mailto:'+t+'">'+t+"</a></div>"}if((a.cams_profile?.phone||a.phone)&&(o+='<div class="wdt-portal-table-subtext phone-subtext" data-metadata="user-phone"><span>'+(a.cams_profile?.phone||a.phone)+"</span></div>"),a.service_providers){let t=[];for(let e of a.service_providers)t.push(e.label);o+='<div class="wdt-portal-table-subtext business-subtext" data-metadata="assigned-service-provider"><span>'+t.join(", ")+"</span></div>"}a.staff&&(o+='<div class="wdt-portal-table-subtext user-subtext" data-metadata="assigned-staff"><span>'+a.staff+"</span></div>")}if(e.find('td[data-column="client"]').html(o),a.id){if(e.find("[data-user-id]").attr("data-user-id",a.id),a.skill_match_jobs_count&&a.skill_match_jobs_count>0){let t=e.find('[data-target="skill-match-job-count"]').attr("href"),o=new URL(t);o.searchParams.set("user_skill_match",a.id),e.find('[data-target="skill-match-job-count"]').attr("href",o.href)}else{let t=e.find('[data-target="skill-match-job-count"]'),a=t.html();t.after('<div class="wdt-table-nowrap-content" data-target="skill-match-job-count"]></div>'),t.remove(),e.find('[data-target="skill-match-job-count"]').html(a)}if(a.occupation_match_jobs_count&&a.occupation_match_jobs_count>0){let t=e.find('[data-target="occupation-match-job-count"]').attr("href"),o=new URL(t);o.searchParams.set("user_occupation_match",a.id),e.find('[data-target="occupation-match-job-count"]').attr("href",o.href)}else{let t=e.find('[data-target="occupation-match-job-count"]'),a=t.html();t.after('<div class="wdt-table-nowrap-content" data-target="occupation-match-job-count"]></div>'),t.remove(),e.find('[data-target="occupation-match-job-count"]').html(a)}}e.find('td[data-column="email"]').text(a.cams_profile?.email||a.email),e.find('input[name="people-select"]').val(a.id).attr("data-email",a.cams_profile?.email||a.email),e.find('td[data-column="status"]').text(a.status);let r="<span>"+a.last_login+"</span>";if(a.last_action&&(r+='<div class="wdt-portal-table-subtext"><span>'+a.last_action+"</span></div>"),e.find('td[data-column="last-activity"]').html(r),e.find('td[data-column="last-case-note-date"]').text(a.last_case_note_date||"—"),e.find('td[data-column="referral-date"]').text(a.referral_date),e.find('td[data-column="staff"]').text(a.staff),e.find('td[data-column="resumes"]').text(a.resumes),e.find('td[data-column="skills"]').text(a.skills),e.find('td[data-column="occupations"]').text(a.occupations),e.find('td[data-column="sectors"]').text(a.sectors),e.find('td[data-column="companies"]').text(a.companies),e.find('[data-target="skill-match-job-count"] [data-target="job-count"]').text(a.skill_match_jobs_count),e.find('[data-target="occupation-match-job-count"] [data-target="job-count"]').text(a.occupation_match_jobs_count),e.find('td[data-column="employment-start-date"]').text(a.employment_start_date),a.service_providers){let t=[];for(let e of a.service_providers)t.push(e.slug);e.find('td[data-column="checkbox"]').find('input[name="people-select"]').attr("data-service-providers",t.join("|"))}if(a.target_occupations&&a.target_occupations.length){let t=e.find('[data-column="target-occupation"]').attr("data-job-board-url");if(t){let o=new URL(t);
1o.searchParams.set("user_occupation_match",a.id);let r=[];for(let t of a.target_occupations){let e=t.code+" - "+t.title;r.push('<a class="wdt-text-link nowrap-element" target="_blank" title="'+e+'" href="'+o.href+'">'+e+"</a>")}e.find('[data-column="target-occupation"]').html(r.join("<br>"))}}t(i).find('tbody[data-target="portal-table-body"]').append(e)}else t('#wdt-portal-my-clients [data-target="no-matches-found"]').show();let a=e.body.total;a&&(t('#wdt-portal-my-clients [data-target="result-count-container"]').show(),t('#wdt-portal-my-clients [data-target="result-count-container"] [data-target="result-count"]').text(wdtNumberFormat(a)));let o=e.body.page,n=e.body.max_page;t(r).data("page",e.body.page),t(r).data("max_page",e.body.max_page),1===o?(t('[data-target="wdt-portal-my-clients-pagination"] [data-pg-action="first"]').prop("disabled",!0),t('[data-target="wdt-portal-my-clients-pagination"] [data-pg-action="prev"]').prop("disabled",!0)):(t('[data-target="wdt-portal-my-clients-pagination"] [data-pg-action="first"]').prop("disabled",!1),t('[data-target="wdt-portal-my-clients-pagination"] [data-pg-action="prev"]').prop("disabled",!1)),o===n?(t('[data-target="wdt-portal-my-clients-pagination"] [data-pg-action="next"]').prop("disabled",!0),t('[data-target="wdt-portal-my-clients-pagination"] [data-pg-action="last"]').prop("disabled",!0)):(t('[data-target="wdt-portal-my-clients-pagination"] [data-pg-action="next"]').prop("disabled",!1),t('[data-target="wdt-portal-my-clients-pagination"] [data-pg-action="last"]').prop("disabled",!1)),t('[data-target="wdt-portal-my-clients-table"]').trigger("wdt:changeCustomColumns")}},error:function(t){"abort"!==t.statusText&&(wdtDisplayNotification("Unable to retrieve clients. Please contact administrator.","error",-1),console.log(t))},complete:function(){t(i).find('[data-target="spinner"]').hide()}})}));else{let e=t.Event("wdt:update");e.wdt={},e.wdt.perPage=d,e.wdt.query=s,e.wdt.page=o,t('#wdt-portal-my-clients [data-table-target="wdt-portal-my-clients-table"]').trigger(e)}}i(),t('#wdt-portal-my-clients [data-table-target="wdt-portal-my-clients-table"]').on("wdt:loaded",(function(t){i()})),t("#wdt-portal-my-clients-manager-select").trigger("wdt:disable",!0),t("#wdt-portal-my-clients #wdt-portal-my-clients-table").on("wdt:tableSort",(function(e){let a=e._columnSlug+"-"+e._sortDir;t(this).attr("data-sort",a),i(1)})),t('[data-target="wdt-portal-my-clients-pagination"] [data-pg-action="first"]').on("click",(function(e){let a=t(this).parents('[data-target="wdt-portal-my-clients-footer"]').first().prevAll('[data-target="portal-table-container"]').first().find('table[data-target="wdt-portal-my-clients-table"]').first();1!==t(a).data("page")&&i(1)})),t('[data-target="wdt-portal-my-clients-pagination"] [data-pg-action="prev"]').on("click",(function(e){let a=t(this).parents('[data-target="wdt-portal-my-clients-footer"]').first().prevAll('[data-target="portal-table-container"]').first().find('table[data-target="wdt-portal-my-clients-table"]').first(),o=t(a).data("page"),r=o-1;r>0&&r!==o&&i(r)})),t('[data-target="wdt-portal-my-clients-pagination"] [data-pg-action="next"]').on("click",(function(e){let a=t(this).parents('[data-target="wdt-portal-my-clients-footer"]').first().prevAll('[data-target="portal-table-container"]').first().find('table[data-target="wdt-portal-my-clients-table"]').first(),o=t(a).data("page"),r=o+1;r<=t(a).data("max_page")&&r!==o&&i(r)})),t('[data-target="wdt-portal-my-clients-pagination"] [data-pg-action="last"]').on("click",(function(e){let a=t(this).parents('[data-target="wdt-portal-my-clients-footer"]').first().prevAll('[data-target="portal-table-container"]').first().find('table[data-target="wdt-portal-my-clients-table"]').first(),o=t(a).data("page"),r=t(a).data("max_page");o!==r&&i(r)})),t(document).on("click",'#wdt-content-modal [data-target="wdt-portal-my-clients-filters-archive-leads-container"] button[data-action="wdt-portal-my-clients-archive"]',(function(e){t(this).prop("disabled",!0);let a=t('#wdt-portal-my-clients-table [name="people-select"]'),o=t(a).map((function(){if(this.checked)return t(this).val()})).get(),r=t(this).attr("data-nonce");jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/clients/archive/",data:{nonce:r,clients:o},beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t("#wdt-portal-my-clients-spinner").show()},success:function(t){t.success?wdtDisplayNotification("Successfully archived client(s).","success",5e3):wdtDisplayNotification("Could not archive: "+t.response,"error",-1)},error:function(t){t.responseJSON.response?wdtDisplayNotification("Could not archive: "+t.responseJSON.response,"error",-1):wdtDisplayNotification("Could not archive: error making request.","error",-1)},complete:function(){t("#wdt-portal-my-clients-spinner").hide(),i(),wdtForceRemoveContentModal()}})})),t(document).on("click",'#wdt-content-modal [data-target="wdt-portal-my-clients-filters-unarchive-leads-container"] button[data-action="wdt-portal-my-clients-unarchive"]',(function(e){t(this).prop("disabled",!0);let a=t('#wdt-portal-my-clients-table [name="people-select"]'),o=t(a).map((function(){if(this.checked)return t(this).val()})).get(),r=t(this).attr("data-nonce");jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/clients/unarchive/",data:{nonce:r,clients:o},beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t("#wdt-portal-my-clients-spinner").show()},success:function(t){t.success?wdtDisplayNotification("Successfully unarchived client(s).","success",5e3):wdtDisplayNotification("Could not unarchive: "+t.response,"error",-1)},error:function(t){t.responseJSON.response?wdtDisplayNotification("Could not unarchive: "+t.responseJSON.response,"error",-1):wdtDisplayNotification("Could not unarchive: error making request.","error",-1)},complete:function(){t("#wdt-portal-my-clients-spinner").hide(),i(),wdtForceRemoveContentModal()}})})),t(document).on("change",'#wdt-portal-my-clients-table [name="people-select"]',(function(t){n()})),t(document).on("change",'#wdt-portal-my-clients [data-table-target="wdt-portal-my-clients-table"] [name="people-select-all"]',(function(e){t(this).prop("checked")?t('#wdt-portal-my-clients [data-table-target="wdt-portal-my-clients-table"] [name="people-select"]').each((function(e){t(this).prop("checked",!0)})):t('#wdt-portal-my-clients [data-table-target="wdt-portal-my-clients-table"] [name="people-select"]').each((function(e){t(this).prop("checked",!1)})),t('#wdt-portal-my-clients [data-table-target="wdt-portal-my-clients-table"] [name="people-select"]').first().trigger("change")})),t('#wdt-portal-my-clients [name="my-clients-only"]').on("change",(function(e){let a=t(this).is(":checked"),o=window.location.href,n=new URL(o);a?n.searchParams.set("my-clients-only","true"):n.searchParams.delete("my-clients-only"),history.replaceState({},"",n.toString()),r()})),t('*[data-action="wdt-portal-my-clients-refresh"]').on("change",(function(t){i()})),t('#wdt-portal-my-clients [data-table-target="wdt-portal-my-clients-table"]').on("wdt:response",(function(e){t("#wdt-portal-my-clients").find('[data-target="wdt-portal-my-clients-footer"]').find('[data-target="wdt-portal-my-clients-footer-total"]').html("<strong>"+e.wdt.body.page+"</strong> of "+e.wdt.body.max_page)})),t(document).on("click",'#wdt-portal-my-clients [data-action="client-preview"]',(function(e){t('#wdt-portal [data-target="wdt-portal-tipout-panel-right"]').trigger("wdt:showLoadingState"),t('#
1wdt-portal [data-target="wdt-portal-tipout-panel-right"]').trigger("wdt:showPanel");let a=t(this).attr("data-user-id");jQuery.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/html/client/overview/panel/",data:{user_id:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.success&&e.html){let a=t.Event("wdt:populatePanel");a._html=e.html,t('#wdt-portal [data-target="wdt-portal-tipout-panel-right"]').trigger(a)}},error:function(t){console.log(t)},complete:function(){t('#wdt-portal [data-target="wdt-portal-tipout-panel-right"]').trigger("wdt:hideLoadingState")}}),e.stopPropagation()})),t(document).on("click",'#wdt-portal-my-clients [data-action="wdt-portal-my-clients-open-filters"]',(function(e){if(t('[data-target="wdt-portal-tipout-panel-right"][data-state="active"] #wdt-portal-my-clients-filter-form-container').length)t('#wdt-portal [data-target="wdt-portal-tipout-panel-right"]').trigger("wdt:closePanel");else{let e=t("#wdt-portal-my-clients-filters-template #wdt-portal-my-clients-filter-form-container");e.detach();let a=t.Event("wdt:populatePanel");a._html=e[0],t('#wdt-portal [data-target="wdt-portal-tipout-panel-right"]').trigger(a),t('#wdt-portal [data-target="wdt-portal-tipout-panel-right"]').trigger("wdt:showPanel")}e.stopPropagation()})),t(document).on("wdt:updateFromPeopleForm","#wdt-portal-my-clients-filter-form-container",(function(e){let a=`${window.location.origin}${window.location.pathname}?wdt-page=my-clients`,o=wdtSerializeMaterialForm(t(this).find('[data-target="wdt-portal-people-filters-form"]')),n=new URL(a);for(let t in o){let e=o[t];if(e.length)for(let a of e)n.searchParams.append(t,a.value)}t('#wdt-portal-my-clients [name="my-clients-only"]').is(":checked")&&n.searchParams.set("my-clients-only","true"),history.replaceState({},"",n.toString()),r(),i()})),t(document).on("change","#wdt-portal-my-clients-filter-form-container [data-people-form-field]",(function(e){let a=t(this).parents("#wdt-portal-my-clients-filter-form-container");t(a).trigger("wdt:updateFromPeopleForm"),t("#wdt-portal-my-clients").trigger("wdt:refreshFilterButtons")})),t(document).on("wdt:beforeClearPanel",'#wdt-portal [data-target="wdt-portal-tipout-panel-right"]',(function(e){let a=t(this).find("#wdt-portal-my-clients-filter-form-container");t(a).length&&(t(a).detach(),t("#wdt-portal-my-clients-filters-template").append(t(a[0])))})),t(document).on("wdt:refreshFilterButtons","#wdt-portal-my-clients",(function(e){let a=t(this).find('[data-target="wdt-portal-my-clients-filters"]'),o="true"===t(a).attr("data-show-all");t(this).find('[data-target="wdt-portal-my-clients-filters"] button[data-action="remove-client-filter"]').remove(),t(this).find('[data-target="wdt-portal-my-clients-filters"] button[data-target="remove-all-client-filters"]').hide(),t(this).find('[data-target="wdt-portal-my-clients-filters"] button[data-target="show-all-filters"]').hide();let r=wdtSerializeMaterialForm(t('#wdt-portal #wdt-portal-my-clients-filter-form-container [data-target="wdt-portal-people-filters-form"]')),n=0;for(let e in r)for(let a of r[e]){if("match_mode"===e)continue;let i=a.label;if("age_min"===e&&(i="Minimum age: "+i),"age_max"===e&&(i="Maximum age: "+i),"last_active_limit"===e){if(!r.last_active.length)continue;i="Active limit: "+i+" days"}let s=document.createElement("button");s.innerText=i,s.setAttribute("data-value",a.value),s.setAttribute("data-name",e),s.classList.add("wdt-portal-my-clients-filters-btn"),s.classList.add("close-icon"),s.setAttribute("data-action","remove-client-filter"),(o||n<3)&&t(s).insertBefore('[data-target="wdt-portal-my-clients-filters"] button[data-target="show-all-filters"]'),n++}let i=t('[data-target="wdt-portal-my-clients-open-filters"] .wdt-icon-btn-label').text();i=i.split("(").shift().trim(),n>0?(t(a).show(),i=i+" ("+n+")",t(this).find('[data-target="wdt-portal-my-clients-filters"] button[data-target="remove-all-client-filters"]').show(),!o&&n>3&&(t(this).find('[data-target="wdt-portal-my-clients-filters"] button[data-target="show-all-filters"]').text(n-3+"+"),t(this).find('[data-target="wdt-portal-my-clients-filters"] button[data-target="show-all-filters"]').show())):t(a).hide(),t('[data-target="wdt-portal-my-clients-open-filters"] .wdt-icon-btn-label').text(i)})),t(document).on("click",'[data-target="wdt-portal-my-clients-filters"] [data-action="show-all-filters"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-my-clients-filters"]').first();t(a).attr("data-show-all","true"),t("#wdt-portal-my-clients").trigger("wdt:refreshFilterButtons")})),t(document).on("click",'[data-target="wdt-portal-my-clients-filters"] [data-action="remove-all-client-filters"]',(function(e){a=!0,t('#wdt-portal #wdt-portal-my-clients-filter-form-container [data-target="wdt-portal-people-filters-form"] [name]').each((function(e){let a=t.Event("wdt:clearValue");t(this).trigger(a)})),a=!1;let o=new URL(window.location);o.search="?wdt-page=my-clients",history.replaceState({},"",o.toString()),i()})),t(document).on("click",'[data-action="remove-client-filter"]',(function(e){let a=t(this).attr("data-name"),o=t(this).attr("data-value");t('#wdt-portal #wdt-portal-my-clients-filter-form-container [data-target="wdt-portal-people-filters-form"] [name="'+a+'"]').each((function(e){let a=t.Event("wdt:clearValue");a._value=o,t(this).trigger(a)}))})),t("#wdt-portal-my-clients").trigger("wdt:refreshFilterButtons"),t(document).on("wdt:complete",'#wdt-my-clients-assign-modal form[data-target="wdt-portal-my-clients-assign-staff-form"]',(function(t){i(),wdtForceRemoveContentModal()})),t(document).on("wdt:existingStaffAssignmentsComplete",(function(t){i()})),t(document).on("wdt:submittedCaseNote","#wdt-people-page-case-note-modal #wdt-portal-client-case-note-form",(function(t){i()})),t(document).on("click",'[data-action="wdt-my-clients-open-assign-staff-modal"]',(function(e){let a=this,o=t(t("#wdt-portal-my-clients-filters-assign-staff").html()),r=t('#wdt-portal-my-clients-table [name="people-select"]'),n=[],i=[],s=0,d=[],l=!1,c=!1,p=!1;if(t(r).each((function(e){if(this.checked){n.push(t(this).val());let e=t(this).attr("data-service-providers").split("|");i.push(e),"true"===t(this).attr("data-has-staff")&&(s++,d.push(t(this).val())),"true"===t(this).attr("data-is-referral")?l=!0:"true"===t(this).attr("data-is-new-client")?c=!0:p=!0}})).get(),i=i.shift().filter((function(t){return i.every((function(e){return-1!==e.indexOf(t)}))}
1)),1!==i.length)return void wdtDisplayNotification("Unable to assign staff to clients without a common service provider.","error",-1);if(s>0){let e=t(t("#wdt-portal-my-clients-filters-existing-assignments").html());_wdtRenderContentModal("Manage Staff Assignments",t(e).prop("outerHTML"),"wdt-portal-modal-alt","wdt-my-clients-existing-assignments-modal");let o=t.Event("wdt:initializeAssignStaffExisting");return o._clients=n,o._serviceProvider=i[0],o._clientsWithStaffCount=s,o._clientsWithStaffIds=d,o._tasksNonce=t(a).data("tasks-nonce"),o._hasReferrals=l,o._hasNewClients=c,o._hasOldClients=p,void t("#wdt-my-clients-existing-assignments-modal").find('[data-target="wdt-assign-staff-existing"]').trigger(o)}_wdtRenderContentModal("Assign Staff",o.html(),"wdt-portal-modal-alt","wdt-my-clients-assign-modal");let u=t.Event("wdt:initializeAssignStaff");u._clients=n,u._serviceProvider=i[0],t("#wdt-my-clients-assign-modal").find("#wdt-portal-my-clients-assign-staff-form").trigger(u)})),t(document).on("click",'[data-action="wdt-my-clients-open-archive-leads-modal"]',(function(e){let a=t(t("#wdt-portal-my-clients-filters-archive-leads").html()),o=t('#wdt-portal-my-clients-table [name="people-select"]'),r=t(o).map((function(){if(this.checked)return t(this).val()})).get().length;t(a).find('[data-target="archive-number"]').text(r),_wdtRenderContentModal("Archive People",t(a).prop("outerHTML"),"wdt-portal-modal-alt")})),t(document).on("click",'[data-action="wdt-my-clients-open-unarchive-leads-modal"]',(function(e){let a=t(t("#wdt-portal-my-clients-filters-unarchive-leads").html()),o=t('#wdt-portal-my-clients-table [name="people-select"]'),r=t(o).map((function(){if(this.checked)return t(this).val()})).get().length;t(a).find('[data-target="archive-number"]').text(r),_wdtRenderContentModal("Unarchive People",t(a).prop("outerHTML"),"wdt-portal-modal-alt")})),t(document).on("click",'[data-action="wdt-my-clients-email-selected-people"]',(function(e){e.preventDefault();let a=t('#wdt-portal-my-clients-table [name="people-select"]:checked').map((function(){return t(this).data("email")})).get().filter((t=>!!t));if(0===a.length)return void wdtDisplayNotification("No email addresses found for selected clients.","error",-1);let o=`mailto:?bcc=${encodeURIComponent(a.join(","))}`;window.location.href=o}))}if(t(document).on("wdt:changeCustomColumns",'[data-target="wdt-portal-my-clients-table"]',(function(e){let a=t('[data-target="wdt-people-custom-columns-form"] [data-rf-target="wdt-material-form-checkbox-label"][draggable="true"] input[type="checkbox"]:checked').map(((t,e)=>e.name)).get();for(let e of a)t(this).find('th[data-column="'+e+'"],td[data-column="'+e+'"]').show();let o=t('[data-target="wdt-people-custom-columns-form"] [data-rf-target="wdt-material-form-checkbox-label"][draggable="true"] input[type="checkbox"]:not(:checked)').map(((t,e)=>e.name)).get();for(let e of o)t(this).find('th[data-column="'+e+'"],td[data-column="'+e+'"]').hide();let r=t('[data-target="wdt-people-custom-columns-form"] [data-rf-target="wdt-material-form-checkbox-label"][draggable="false"] input[type="checkbox"]:checked').map(((t,e)=>e.name)).get();for(let e of r)t(this).find('[data-metadata="'+e+'"]').show();let n=t('[data-target="wdt-people-custom-columns-form"] [data-rf-target="wdt-material-form-checkbox-label"][draggable="false"] input[type="checkbox"]:not(:checked)').map(((t,e)=>e.name)).get();for(let e of n)t(this).find('[data-metadata="'+e+'"]').hide();let i=t('[data-target="wdt-people-custom-columns-form"] [data-rf-target="wdt-material-form-checkbox-label"][draggable="true"] input[type="checkbox"]').map(((t,e)=>e.name)).get(),s=t(this).find('thead tr[data-target="heading-row"] th[data-column="client"]'),d=t(this).find("tbody tr");for(let e of i){let a=t(this).find('thead tr[data-target="heading-row"] th[data-column="'+e+'"]');a.length&&(t(this).find(a).insertAfter(s),s=a)}t(d).each((function(e){let a=t(this).find('td[data-column="client"]');for(let e of i){let o=t(this).find('td[data-column="'+e+'"]');o.length&&(t(this).find(o).insertAfter(a),a=o)}})),wfwe_setCookie("wdt_people_column_order",i.join("|"),365),wfwe_setCookie("wdt_selected_people",t('[data-target="wdt-people-custom-columns-form"] input[type="checkbox"]:checked').map(((t,e)=>e.name)).get().join("|"),365);const l=t('[data-target="wdt-people-custom-columns-form"]').data("c
1olumns-version");l&&wfwe_setCookie("wdt_people_columns_version",l,365)})),t(document).on("wdt:formReordered",'#wdt-portal-my-clients [data-target="wdt-people-custom-columns-form"]',(function(e){t('[data-target="wdt-portal-my-clients-table"]').trigger("wdt:changeCustomColumns")})),t(document).on("change",'#wdt-portal-my-clients [data-target="wdt-people-custom-columns-form"] input',(function(e){t('[data-target="wdt-portal-my-clients-table"]').trigger("wdt:changeCustomColumns")})),t('#wdt-portal-my-clients [data-target="wdt-portal-my-clients-table"]').trigger("wdt:changeCustomColumns"),t(document).on("click",'[data-action="wdt-my-clients-bulk-case-notes"]',(function(e){let a=t('#wdt-portal-my-clients-table [name="people-select"]:checked').map((function(){return t(this).val()})).get();t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/html/case-notes/form/",data:{client_id:a},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&(_wdtRenderContentModal("Add Note",e.html,"wdt-portal-modal-alt","wdt-people-page-case-note-modal",!0),t("#wdt-people-page-case-note-modal #wdt-portal-client-case-note-form").trigger("wdt:initializeForm"))},error:function(t){console.log(t)}})})),t("#wdt-portal-my-clients-search").length){var o=!1;t("#wdt-portal-my-clients-search").autocomplete({minLength:1,classes:{"ui-autocomplete":"wdt-autocomplete-menu"},appendTo:"#wdt-portal-my-clients-autocomplete-target",search:function(){if(o)return!1},source:function(e,a){let o=new URLSearchParams(window.location.search).getAll("types[]");t.ajax({url:WDT.rest_url+"wedatatools/v1/portal/typeahead/users?useName=true",data:{useName:!0,query:e.term,"types[]":o,size:10,nonce:t("#wdt-portal-my-clients-search").attr("data-nonce")},dataType:"json",beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){const o=t.map(e.results||[],(function(t){return{label:t.text||t.id||"",value:t.text||t.id||"",userId:t.user_id,data:t}}));a(o)},error:function(){a([])}})},select:function(t,e){e&&e.item&&e.item.userId&&(window.location.href="?wdt-page=client&wdt-client="+e.item.userId)}}),t("#wdt-portal-my-clients-search").on("keydown",(function(e){"Enter"===e.key&&(o=!0,t(this).autocomplete("close"))})),t("#wdt-portal-my-clients-search").on("input",(function(){o=!1}))}})),jQuery(document).ready((function(t){"use strict";var e=null,a=!1;t(document).on("wdt:refresh",'#wdt-portal-tasks [data-target="unassigned-tasks"]',(function(e){let a=this,o=t(a).attr("data-nonce");t(this).hide(),jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/case-tasks/",data:{show_staffless:"true",nonce:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&e.body.total>0&&(t(a).find('[data-target="unassigned-tasks-count"]').text(e.body.total),t(a).show())},error:function(t){console.log(t)}})})),t(document).on("wdt:afterSave",'[data-target="task-form-inner"]',(function(e){t("#wdt-portal-tasks #wdt-portal-tasks-table").length&&t("#wdt-portal-tasks #wdt-portal-tasks-table").trigger("wdt:refresh")})),t('#wdt-portal-tasks [name="wdt-portal-tasks-search"]').on("change",(function(e){let a=new URL(window.location),o=t("#wdt-portal-tasks #wdt-portal-tasks-table"),r=t(this).val();a.searchParams.delete("pg"),a.searchParams.set("query",r),history.replaceState({},"",a.toString()),t(o).trigger("wdt:refresh")})),t(document).on("change","#wdt-portal-tasks #wdt-portal-tasks-per-page",(function(e){let a=new URL(window.location),o=t("#wdt-portal-tasks #wdt-portal-tasks-table"),r=t(this).val();a.searchParams.set("pg",1),a.searchParams.set("pp",r),history.replaceState({},"",a.toString()),t(o).trigger("wdt:refresh")})),t('[data-target="wdt-portal-tasks-pagination"] [data-pg-action="first"]').on("click",(function(e){let a=new URL(window.location),o=t("#wdt-portal-tasks #wdt-portal-tasks-table"),r=parseInt(a.searchParams.get("pg"));r||(r=1),1!==parseInt(r)&&(a.searchParams.set("pg",1),history.replaceState({},"",a.toString()),t(o).trigger("wdt:refresh"))})),t('[data-target="wdt-portal-tasks-pagination"] [data-pg-action="prev"]').on("click",(function(e){let a=new URL(window.location),o=t("#wdt-portal-tasks #wdt-portal-tasks-table"),r=parseInt(a.searchParams.get("pg"));r||(r=1);let n=r-1;n>0&&n!==r&&(a.searchParams.set("pg",n),history.replaceState({},"",a.toString()),t(o).trigger("wdt:refresh"))})),t('[data-target="wdt-portal-tasks-pagination"] [data-pg-action="next"]').on("click",(function(e){let a=new URL(window.location),o=t("#wdt-portal-tasks #wdt-portal-tasks-table"),r=parseInt(a.searchParams.get("pg"));r||(r=1);let n=r+1;n<=t(o).data("max_page")&&n!==r&&(a.searchParams.set("pg",n),history.replaceState({},"",a.toString()),t(o).trigger("wdt:refresh"))})),t('[data-target="wdt-portal-tasks-pagination"] [data-pg-action="last"]').on("click",(function(e){let a=new URL(window.location),o=t("#wdt-portal-tasks #wdt-portal-tasks-table"),r=parseInt(a.searchParams.get("pg"));r||(r=1);let n=t(o).data("max_page");r!==n&&(a.searchParams.set("pg",n),history.replaceState({},"",a.toString()),t(o).trigger("wdt:refresh"))})),t(document).on("click",'#wdt-portal-tasks [data-action="wdt-portal-tasks-open-filters"]',(function(e){if(t('[data-target="wdt-portal-tipout-panel-right"][data-state="active"] #wdt-portal-tasks-filter-form-container').length)t('#wdt-portal [data-target="wdt-portal-tipout-panel-right"]').trigger("wdt:closePanel");
1else{let e=t("#wdt-portal-tasks-filters-template #wdt-portal-tasks-filter-form-container");e.detach();let a=t.Event("wdt:populatePanel");a._html=e[0],t('#wdt-portal [data-target="wdt-portal-tipout-panel-right"]').trigger(a),t('#wdt-portal [data-target="wdt-portal-tipout-panel-right"]').trigger("wdt:showPanel")}e.stopPropagation()})),t(document).on("wdt:refreshFilterButtons","#wdt-portal-tasks",(function(e){let a=t(this).find('[data-target="wdt-portal-tasks-filters"]'),o="true"===t(a).attr("data-show-all");t(this).find('[data-target="wdt-portal-tasks-filters"] button[data-action="remove-client-filter"]').remove(),t(this).find('[data-target="wdt-portal-tasks-filters"] button[data-target="remove-all-task-filters"]').hide(),t(this).find('[data-target="wdt-portal-tasks-filters"] button[data-target="show-all-filters"]').hide();let r=wdtSerializeMaterialForm(t('#wdt-portal #wdt-portal-tasks-filter-form-container [data-target="wdt-portal-task-filters-form"]')),n=0;for(let e in r)for(let a of r[e]){let r=a.label;"client[]"===e&&(r="Client: "+r),"employer_id[]"===e&&(r="Employer: "+r),"staff"===e&&(r="Staff: "+r),"date_range"===e&&(r="Date Range: "+r.replace("|"," - "));let i=document.createElement("button");i.innerText=r,i.setAttribute("data-value",a.value),i.setAttribute("data-name",e),i.classList.add("wdt-portal-tasks-filters-btn"),i.classList.add("close-icon"),i.setAttribute("data-action","remove-client-filter"),(o||n<3)&&t(i).insertBefore('[data-target="wdt-portal-tasks-filters"] button[data-target="show-all-filters"]'),n++}let i=t('[data-target="wdt-portal-tasks-open-filters"] .wdt-icon-btn-label').text();i=i.split("(").shift().trim(),n>0?(t(a).show(),i=i+" ("+n+")",t(this).find('[data-target="wdt-portal-tasks-filters"] button[data-target="remove-all-task-filters"]').show(),!o&&n>3&&(t(this).find('[data-target="wdt-portal-tasks-filters"] button[data-target="show-all-filters"]').text(n-3+"+"),t(this).find('[data-target="wdt-portal-tasks-filters"] button[data-target="show-all-filters"]').show())):t(a).hide(),t('[data-target="wdt-portal-tasks-open-filters"] .wdt-icon-btn-label').text(i)})),t(document).on("click",'[data-target="wdt-portal-tasks-filters"] [data-action="show-all-filters"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-tasks-filters"]').first();t(a).attr("data-show-all","true"),t("#wdt-portal-tasks").trigger("wdt:refreshFilterButtons")})),t(document).on("click",'[data-target="wdt-portal-tasks-filters"] [data-action="remove-all-task-filters"]',(function(e){a=!0,t('#wdt-portal #wdt-portal-tasks-filter-form-container [data-target="wdt-portal-task-filters-form"] [name]').each((function(e){let a=t.Event("wdt:clearValue");t(this).trigger(a)})),a=!1,t("#wdt-portal-tasks #wdt-portal-tasks-table").trigger("wdt:refresh")})),t(document).on("click",'[data-action="remove-client-filter"]',(function(e){let a=t(this).attr("data-name"),o=t(this).attr("data-value");t('#wdt-portal #wdt-portal-tasks-filter-form-container [data-target="wdt-portal-task-filters-form"] [name="'+a+'"]').each((function(e){let a=t.Event("wdt:clearValue");a._value=o,t(this).trigger(a)}))})),t("#wdt-portal-tasks").trigger("wdt:refreshFilterButtons"),t(document).on("wdt:updateFromTasksForm","#wdt-portal-tasks-filter-form-container",(function(e){let a=[];t(this).find('[data-target="wdt-portal-task-filters-form"] [name]').each((function(e){a.push(t(this).attr("name"))}));let o=wdtSerializeMaterialForm(t(this).find('[data-target="wdt-portal-task-filters-form"]')),r=new URL(window.location);for(let t of a)r.searchParams.delete(t);for(let t in o){let e=o[t];if(e.length)for(let a of e)r.searchParams.append(t,a.value)}history.replaceState({},"",r.toString()),function(){let t=new URL(window.location.href),e=new URLSearchParams(t.search);e.delete("wdt-page"),wfwe_setCookie("wdt_tasks_filters",e.toString(),365)}(),t("#wdt-portal-tasks #wdt-portal-tasks-table").trigger("wdt:refresh")})),t(document).on("change","#wdt-portal-tasks-filter-form-container [data-tasks-form-field]",(function(e){let a=t(this).parents("#wdt-portal-tasks-filter-form-container");t(a).trigger("wdt:updateFromTasksForm"),t("#wdt-portal-tasks").trigger("wdt:refreshFilterButtons")})),t(document).on("wdt:beforeClearPanel",'#wdt-portal [data-target="wdt-portal-tipout-panel-right"]',(function(e){let a=t(this).find("#wdt-portal-tasks-filter-form-container");t(a).length&&(t(a).detach(),t("#wdt-portal-tasks-filters-template").append(t(a[0])))})),t("#wdt-portal-tasks #wdt-portal-tasks-table").on("wdt:tableSort",(function(e){let a=e._columnSlug+"-"+e._sortDir;t(this).attr("data-sort",a),t(this).trigger("wdt:refresh")})),t(document).on("wdt:refresh","#wdt-portal-tasks #wdt-portal-tasks-table",(function(o){if
1(o.stopPropagation(),a)return;let r=t(this).parents("#wdt-portal-tasks-table-container"),n=t(this).parents("#wdt-portal-tasks"),i=this,s=t(this).attr("data-nonce"),d=new URL(window.location),l=d.searchParams.get("pg"),c=d.searchParams.get("pp"),p=d.searchParams.get("query"),u="",f="",g=d.searchParams.get("staff"),m=d.searchParams.getAll("client[]"),w=d.searchParams.getAll("employer_id[]"),h=d.searchParams.get("include_completed"),b=d.searchParams.get("show_clientless"),y=d.searchParams.get("show_staffless"),v=d.searchParams.getAll("service_providers[]"),_=t(this).attr("data-sort"),k=d.searchParams.get("date_range");if(k){let t=k.split("|");u=t.shift(),f=t.pop()}let x={nonce:s,number:c,query:p,page:l,sort:_,staff:g,client:m.length?m:null,employer_id:w.length?w:null,include_completed:h,show_clientless:b,show_staffless:y,service_providers:v},j=o._excludeSlugs;Array.isArray(j)&&(x.exclude_slugs=j),u&&(x.start_date=u,x.end_date=f);for(let t in x)null===x[t]&&delete x[t];e&&e.abort(),e=jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/case-tasks/",data:x,beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(i).find('tbody[data-target="portal-table-body"]').find("td").addClass("wdt-portal-table-body-element-loading"),t(n).find('[data-target="spinner"]').show(),t('#wdt-portal-tasks [data-target="no-matches-found"]').hide(),t('#wdt-portal-tasks [data-target="result-count-container"]').hide()},success:function(e){if(t(i).find('tbody[data-target="portal-table-body"]').html(""),e.success){if(e.body.tasks.length)for(let a of e.body.tasks){let e=t(t(r).find('[data-target="template-table"]').get(0).content).find('[data-target="template-row"]').clone();if(a.completed&&t(e).find('[data-column="checkbox"] input[type="checkbox"]').prop("checked",!0),a.due_date&&(a.overdue&&t(e).find('[data-column="due"] [data-target="due-content"]').css("color","#DB002C"),t(e).find('[data-column="due"] [data-target="due-content"]').text(a.due_date)),a.next_dates.length){let o='<p style="margin-bottom: 5px; margin-top: 0;"><strong>Recurring Task - Upcoming Due Dates</strong></p>';for(let t of a.next_dates)o+='<p style="margin-bottom: 5px;">'+t+"</p>";t(e).find('[data-column="due"] [data-target="due-date-tooltip"] [data-target="wdt-tooltip-text"]').html(o)}else t(e).find('[data-column="due"] [data-target="due-date-tooltip"]').remove();if(a.staff&&a.staff.length){let o=[],r=[];for(let t of a.staff)o.push(t.name),r.push(t.id);t(e).find('[data-column="staff"]').text(o.join(", ")),t(e).find("[data-staff-ids]").each((function(e){t(this).attr("data-staff-ids",r.join("|"))})),t(e).find("[data-staff-names]").each((function(e){t(this).attr("data-staff-names",o.join("|"))})),t(e).find('[data-action="wdt-portal-task-reassign-btn"] .wdt-icon-btn-label').text("Reassign Task")}let o="";if(a.client){o+=(a.client.permission?'<a class="wdt-portal-table-link" href="?wdt-page=client&wdt-client='+a.client.id+'" target="_blank">'+a.client.name+"</a>":"<span>"+a.client.name+"</span>")+(a.client.archived?'<span class="wdt-archived-badge">Archived</span>':"")}if(a.employer_profile){let t='<a class="wdt-portal-table-link" href="'+("?wdt-page=employer-profile&wdt-employer="+a.employer_profile.id)+'" target="_blank">'+a.employer_profile.name+"</a>";o+=o?'<div class="wdt-portal-table-subtext">'+t+"</div>":t}o?t(e).find('[data-column="client"]').html(o):t(e).find('[data-column="client"]').text("N/A"),a.name&&(t(e).find('[data-column="name"]').text(a.name),t(e).find("[data-object-name]").each((function(e){t(this).attr("data-object-name",a.name)}))),a.excerpt&&t(e).find('[data-column="task"]').text(a.excerpt),a.slug&&t(e).find("[data-object-slug]").each((function(e){t(this).attr("data-object-slug",a.slug)})),a.service_provider&&t(e).find("[data-service-provider]").each((function(e){t(this).attr("data-service-provider",a.service_provider)})),t(n).find('tbody[data-target="portal-table-body"]').append(e)}else t('#wdt-portal-tasks [data-target="no-matches-found"]').show();let a=e.body.total;a&&(t('#wdt-portal-tasks [data-target="result-count-container"]').show(),t('#wdt-portal-tasks [data-target="result-count-container"] [data-target="result-count"]').text(wdtNumberFormat(a)));let o=e.body.page,s=e.body.max_page;t(i).data("max_page",e.body.max_page),1===o?(t('[data-target="wdt-portal-tasks-pagination"] [data-pg-action="first"]').prop("disabled",!0),t('[data-target="wdt-portal-tasks-pagination"] [data-pg-action="prev"]').prop("disabled",!0)):(t('[data-target="wdt-portal-tasks-pagination"] [data-pg-action="first"]').prop("disabled",!1),t('[data-target="wdt-portal-tasks-pagination"] [data-pg-action="prev"]').prop("disabled",!1)),o===s?(t('[data-target="wdt-portal-tasks-pagination"] [data-pg-action="next"]').prop("disabled",!0),t('[data-target="wdt-portal-tasks-pagination"] [data-pg-action="last"]').prop("disabled",!0)):(t('[data-target="wdt-portal-tasks-pagination"] [data-pg-action="next"]').prop("disabled",!1),t('[data-target="wdt-portal-tasks-pagination"] [data-pg-action="last"]').prop("disabled",!1))}},error:function(t){"abort"!==t.statusText&&(wdtDisplayNotification("Unable to retrieve tasks. Please contact administrator.","error",-1),console.log(t))},complete:function(){t('#wdt-portal-tasks [data-target="unassigned-tasks"]').trigger("wdt:refresh"),t(n).find('[data-target="spinner"]').hide()}})})),t("#wdt-portal-tasks #wdt-portal-tasks-table").trigger("wdt:refresh"),t('#wdt-portal-tasks [data-target="unassigned-tasks"]').trigger("wdt:refresh")})),jQuery(document).ready((function(t){"use strict";var e=null;t(document).on("click",'#wdt-portal-taxonomy-archive [data-target="wdt-portal-taxonomy-archive-table"] [data-action="delete-term"]',(function(t){})),t(document).on("change","#wdt-portal-taxonomy-archive #wdt-portal-taxonomy-archive-tax-select",(function(e){let a=new URL(window.location),o=t("#wdt-portal-taxonomy-archive #wdt-portal-taxonomy-archive-table"),r=t(this).val();a.searchParams.set("pg",1),a.searchParams.set("taxonomy",r),history.replaceState({},"",a.toString()),t(o).trigger("wdt:refresh")})),t(document).on("change","#wdt-portal-taxonomy-archive #wdt-portal-taxonomy-archive-per-page",(function(e){let a=new URL(window.location),o=t("#wdt-portal-taxonomy-archive #wdt-portal-taxonomy-archive-table"),r=t(this).val();a.searchParams.set("pg",1),a.searchParams.set("pp",r),history.replaceState({},"",a.toString()),t(o).trigger("wdt:refresh")})),t('[data-target="wdt-portal-taxonomy-archive-pagination"] [data-pg-action="first"]').on("click",(function(e){let a=new URL(window.location),o=t("#wdt-portal-taxonomy-archive #wdt-portal-taxonomy-archive-table"),r=parseInt(a.searchParams.get("pg"));r||(r=1),1!==parseInt(r)&&(a.searchParams.set("pg",1),history.replaceState({},"",a.toString()),t(o).trigger("wdt:refresh"))})),t('[data-target="wdt-portal-taxonomy-archive-pagination"] [data-pg-action="prev"]').on("click",(function(e){let a=new URL(window.location),o=t("#wdt-portal-taxonomy-archive #wdt-portal-taxonomy-archive-table"),r=parseInt(a.searchParams.get("pg"));r||(r=1);let n=r-1;n>0&&n!==r&&(a.searchParams.set("pg",n),history.replaceState({},"",a.toString()),t(o).trigger("wdt:refresh"))})),t('[data-target="wdt-portal-taxonomy-archive-pagination"] [data-pg-action="next"]').on("click",(function(e){let a=new URL(window.location),o=t("#wdt-portal-taxonomy-archive #wdt-portal-taxonomy-archive-table"),r=parseInt(a.searchParams.get("pg"));r||(r=1);let n=r+1;n<=t(o).data("max_page")&&n!==r&&(a.searchParams.set("pg",n),history.replaceState({},"",a.toString()),t(o).trigger("wdt:refresh"))})),t('[data-target="wdt-portal-taxonomy-archive-pagination"] [data-pg-action="last"]').on("click",(function(e){let a=new URL(window.location),o=t("#wdt-portal-taxonomy-archive #wdt-portal-taxonomy-archive-table"),r=parseInt(a.searchParams.get("pg"));r||(r=1);let n=t(o).data("max_page");r!==n&&(a.searchParams.set("pg",n),history.replaceState({},"",a.toString()),t(o).trigger("wdt:refresh"))})),t('#wdt-portal-taxonomy-archive [name="wdt-portal-taxonomy-archive-search"]').on("change",(function(e){let a=new URL(window.location),o=t("#wdt-portal-taxonomy-archive #wdt-portal-taxonomy-archive-table"),r=t(this).val();a.searchParams.delete("pg"),a.searchParams.set("query",r),history.replaceState({},"",a.toString()),t(o).trigger("wdt:refresh")})),t("#wdt-portal-taxonomy-archive #wdt-portal-taxonomy-archive-table").on("wdt:tableSort",(function(e){let a=e._columnSlug+"-"+e._sortDir;t(this).attr("data-sort",a);let o=new URL(window.location);o.searchParams.delete("pg"),history.replaceState({},"",o.toString()),t(this).trigger("wdt:refresh")})),t(document).on("wdt:refresh","#wdt-portal-taxonomy-archive #wdt-portal-taxonomy-archive-table",(function(a){a.stopPropagation();let o=t(this).parents("#wdt-portal-taxonomy-archive-table-container"),r=t(this).parents("#wdt-portal-taxonomy-archive"),n=this;t(n).find('[name="job-select-all"]').prop("checked",!1);let i=t(this).attr("data-nonce"),s=new URL(window.location),d=(s.searchParams.get("status"),t(this).attr("data-sort")),l=s.searchParams.get("pg"),c={nonce:i,number:s.searchParams.get("pp"),query:s.searchParams.get("query"),page:l,sort:d,taxonomy:s.searchParams.get("taxonomy")};for(let t in c)null===c[t]&&delete c[t];e&&e.abort(),e=jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/terms/",data:c,beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(n).find('tbody[data-target="portal-table-body"]').find("td").addClass("wdt-portal-table-body-element-loading"),t(r).find('[data-target="spinner"]').show(),t('#wdt-portal-taxonomy-archive [data-target="no-matches-found"]').hide(),t('#wdt-portal-taxonomy-archive [data-target="result-count-container"]').hide()},success:function(e){if(t(n).find('tbody[data-target="portal-table-body"]').html(""),e.success){if(t(n).siblings('[data-target="wdt-portal-taxonomy-archive-footer"]').find('[data-target="wdt-portal-taxonomy-archive-footer-total"]').html("<strong>"+e.body.page+"</strong> of "+e.body.max_page),e.body.creatable){t('[data-target="create-taxonomy-term"]').show();let a=t('[data-target="create-taxonomy-term"]').attr("href"),o=new URL(a);o.searchParams.set("wdt-taxonomy",e.body.taxonomy),a=o.href,t('[data-target="create-taxonomy-term"]').attr("href",a)}else t('[data-target="create-taxonomy-term"]').hide();if(e.body.terms.length)for(let a of e.body.terms){let e=t(t(o).find('[data-target="template-table"]').get(0).content).find('[data-target="template-row"]').clone();a.title&&t(e).find('[data-column="title"]').text(a.title),t(e).find('[data-column="title"]').append('<div class="wdt-portal-taxonomy-archive-table-post-btns" data-target="wdt-portal-taxonomy-archive-table-post-btns"></div>');let n=[];a.actions.includes("edit")&&a.edit_link&&n.push('<a href="'+a.edit_link+'" target="_blank" class="wdt-text-link">Edit</a>'),a.actions.includes("delete")&&n.push('<button class="wdt-text-link" data-action="delete-term" data-post-slug data-post-title data-nonce="'+a.mgmt_nonce+'">Delete</button>'),t(e).find('[data-column="title"] [data-target="wdt-portal-taxonomy-archive-table-post-btns"]').append(n.join(" | ")),a.slug&&(t(e).find('[data-column="slug"]').text(a.slug),t(e).find("[data-term-slug]").attr("data-term-slug",a.slug)),t(r).find('tbody[data-target="portal-table-body"]').append(e)}else t('#wdt-portal-taxonomy-archive [data-target="no-matches-found"]').show();let a=e.body.total;a&&(t('#wdt-portal-taxonomy-archive [data-target="result-count-container"]').show(),t('#wdt-portal-taxonomy-archive [data-target="result-count-container"] [data-target="result-count"]').text(wdtNumberFormat(a)));let i=e.body.page,s=e.body.max_page;t(n).data("max_page",e.body.max_page),1===i?(t('[data-target="wdt-portal-taxonomy-archive-pagination"] [data-pg-action="first"]').prop("disabled",!0),t('[data-target="wdt-portal-taxonomy-archive-pagination"] [data-pg-action="prev"]').prop("disabled",!0)):(t('[data-target="wdt-portal-taxonomy-archive-pagination"] [data-pg-action="first"]').prop("disabled",!1),t('[data-target="wdt-portal-taxonomy-archive-pagination"] [data-pg-action="prev"]').prop("disabled",!1)),i===s?(t('[data-target="wdt-portal-taxonomy-archive-pagination"] [data-pg-action="next"]').prop("disabled",!0),t('[data-target="wdt-portal-taxonomy-archive-pagination"] [data-pg-action="last"]').prop("disabled",!0)):(t('[data-target="wdt-portal-taxonomy-archive-pagination"] [data-pg-action="next"]').prop("disabled",!1),t('[data-target="wdt-portal-taxonomy-archive-pagination"] [data-pg-action="last"]').prop("disabled",!1))}},error:function(t){"abort"!==t.statusText&&(wdtDisplayNotification("Unable to retrieve taxonomies. Please contact administrator.","error",-1),console.log(t))},complete:function(){t(r).find('[data-target="spinner"]').hide()}})})),t("#wdt-portal-taxonomy-archive #wdt-portal-taxonomy-archive-table").trigger("wdt:refresh")})),jQuery(document).ready((function(t){"use strict";t('#wdt-portal-taxonomy-edit-form [name="parent-term"]').on("wdt:ajaxresultfilter",(function(e){let a=e._option;t(this).attr("data-term-slug")==t(a).attr("data-value")&&t(a).attr("disabled",!0)})),t(document).on("click",'#wdt-portal-taxonomy-edit-form [data-target="new-autotag-container"] [data-action="create-autotag-rule"]',(function(e){let a=t(this).parents('[data-target="new-autotag-container"]').first(),o=t(a).next('[data-target="autotag-accordion-list"]'),r=t("<li>"+t(a).find("#wdt-portal-taxonomy-edit-form-autotag-template").clone(!0).html()+"</li>");
1t(o).append(r),t(r).find('[data-action="wdt-portal-term-tagging-rule-form-heading-edit-btn"]').click()})),t("#wdt-portal-taxonomy-edit-form").on("submit",(function(e){e.preventDefault();let a=t(this).attr("data-action"),o=[],r=t(this).find('[data-target="autotag-accordion-list"] li [data-target="tagging-rule-form"]');r.each((function(e){let a=t(this).find('[name="pattern"]').val(),r=t(this).find('[name="match-type"]').val(),n=t(this).find('[name="naics-codes[]"]').val();o.push({pattern:a,type:r,naics:n})}));let n=t(r).parents().first();t(r).detach();let i=t(this).serializeArray();t(n).append(r);let s={autotag_rules:o};for(let t of i){let e=!1,a=t.name;"[]"===a.substring(-2)&&(e=!0,a=a.replace("[]",""));let o=t.value;s[a]?(Array.isArray(s[a])||(s[a]=[s[a]]),s[a].push(o)):s[a]=e?[o]:o}if(console.log(s),"publish"==a){let e=t.Event("wdt:submitPublish");e._data=s,t(this).trigger(e)}else if("update"==a){let e=t.Event("wdt:submitUpdate");e._data=s,t(this).trigger(e)}else wdtDisplayNotification("Form configured improperly","error",-1)})),t("#wdt-portal-taxonomy-edit-form").on("wdt:submitPublish",(function(e){let a=e._data;t(this).find("#wdt-portal-taxonomy-edit-form-submit-button").prop("disabled",!0),t(this).find("#wdt-portal-taxonomy-edit-form-submit-button").text("Publishing...",!0);let o=this;jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/taxonomy/term-mgmt/create/",data:a,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.success){wdtDisplayNotification("Successfully created term.","success",3e3);let t=new URL(window.location);t.searchParams.set("wdt-term",e.term_id),window.open(t.toString(),"_self")}else t(o).find("#wdt-portal-taxonomy-edit-form-submit-button").prop("disabled",!1),t(o).find("#wdt-portal-taxonomy-edit-form-submit-button").text("Publish",!0),wdtDisplayNotification("Could not save term, unspecified error.","error",-1)},error:function(e){e.responseJSON&&e.responseJSON.message?wdtDisplayNotification("Could not save term: "+e.responseJSON.message,"error",-1):wdtDisplayNotification("Could not save term, unspecified error.","error",-1),t(o).find("#wdt-portal-taxonomy-edit-form-submit-button").prop("disabled",!1),t(o).find("#wdt-portal-taxonomy-edit-form-submit-button").text("Publish",!0)},complete:function(){}})})),t("#wdt-portal-taxonomy-edit-form").on("wdt:submitUpdate",(function(e){let a=e._data;t(this).find("#wdt-portal-taxonomy-edit-form-submit-button").prop("disabled",!0),t(this).find("#wdt-portal-taxonomy-edit-form-submit-button").text("Updating...",!0);let o=this;jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/taxonomy/term-mgmt/update/",data:a,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success?(wdtDisplayNotification("Successfully updated term.","success",3e3),location.reload()):(t(o).find("#wdt-portal-taxonomy-edit-form-submit-button").prop("disabled",!1),t(o).find("#wdt-portal-taxonomy-edit-form-submit-button").text("Update",!0),wdtDisplayNotification("Could not update term, unspecified error.","error",-1))},error:function(e){e.responseJSON&&e.responseJSON.message?wdtDisplayNotification("Could not update term: "+e.responseJSON.message,"error",-1):wdtDisplayNotification("Could not update term, unspecified error.","error",-1),t(o).find("#wdt-portal-taxonomy-edit-form-submit-button").prop("disabled",!1),t(o).find("#wdt-portal-taxonomy-edit-form-submit-button").text("Update",!0)},complete:function(){}})})),t('#wdt-portal-taxonomy-edit-form button[data-action="delete"]').on("click",(function(e){let a=t(this).attr("data-nonce"),o=t(this).attr("data-term-id"),r=t(this).attr("data-taxonomy");jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/taxonomy/term-mgmt/delete/",data:{nonce:a,slug:o,taxonomy:r},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.success){wdtDisplayNotification("Successfully deleted term.","success",3e3);let t=new URL(window.location);t.searchParams.set("wdt-page","taxonomy-archive"),window.location.href=t.toString()}else t(this).prop("disabled",!1)},error:function(e){console.log(e),t(this).prop("disabled",!1)},complete:function(){}})}))})),jQuery(document).ready((function(t){})),jQuery((function(t){"use strict";var e;t(document).on("wdt:loadState",'[data-target="portal-case-notes-table"]',(function(e){let a=t(this).parents('[data-target="portal-table-container"]').first();t(this).find('tbody[data-target="portal-table-body"]').find("td").addClass("wdt-portal-table-body-element-loading"),t(a).find('[data-target="spinner"]').show()})),t(document).on("wdt:tableSort",'[data-target="portal-case-notes-table"]',(function(e){let a=e._columnSlug+"-"+e._sortDir;t(this).attr("data-sort",a),t(this).data("sort",a),t(this).trigger("wdt:refresh")})),t(document).on("wdt:refresh",'[data-target="portal-case-notes-table"]',(function(a){if
1(a.stopPropagation(),t(this).data("suppress-refresh"))return;let o=t(this).parents('[data-target="portal-table-container"]').first(),r=this,n=t(this).data("filters"),i=t(this).data("page");i||(i=1);let s=t(this).data("perPage");s||(s=25);let d={nonce:t(this).data("nonce"),client:t(this).data("client-id")?t(this).data("client-id"):-1,sort:t(this).data("sort"),query:t(this).data("query"),page:i,number:s};if(n)for(let t in n)d[t]=n[t];for(let t in d)null===d[t]&&delete d[t];e&&e.abort(),e=jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/case-notes/",data:d,beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(r).closest('[data-target="wdt-case-notes-filter-table"]').find('[data-target="no-matches-found"]').hide(),t(r).trigger("wdt:loadState")},success:function(e){if(t(r).find('tbody[data-target="portal-table-body"]').html(""),e.success){if(e.body.notes.length)for(let a of e.body.notes){let e=t(t(o).find('[data-target="template-table"]').get(0).content).find('[data-target="template-row"]').clone();if(a.date){let o=a.date.split(" ");o.length>1&&"00:00:00"===o[1]&&o.pop(),t(e).find('[data-column="date"]').html(o.join("<br>"))}a.author&&a.author.name&&t(e).find('[data-column="author"]').text(a.author.name);let r=t(e).find('[data-column="related-to"]');if(null!==a.related_employer&&void 0!==a.related_employer){let e=t("<a>").addClass("wdt-portal-case-notes-related-link").attr("href",a.related_employer.url).attr("target","_blank").text(a.related_employer.name),o=t("<div>").addClass("wdt-portal-case-notes-related-employer").append(e);if(t(r).append(o),null!==a.related_contact&&void 0!==a.related_contact){let e=t("<div>").addClass("wdt-portal-case-notes-related-contact").text(a.related_contact.name);t(r).append(e)}}else t(r).text("—");if(a.activity_types){let o=[];for(let t of a.activity_types)o.push(t.name);t(e).find('[data-column="activity-type"]').text(o.join(", "))}a.content&&t(e).find('[data-column="details"]').html(a.content),a.slug&&t(e).find("[data-object-slug]").attr("data-object-slug",a.slug),a.name&&t(e).find("[data-object-name]").attr("data-object-name",a.name),a.client&&t(e).find("[data-client-id]").attr("data-client-id",a.client.id),a.permissions?(a.permissions.includes("edit")||t(e).find('[data-action="wdt-portal-client-case-notes-edit-btn"]').remove(),a.permissions.includes("delete")||t(e).find('[data-action="wdt-portal-client-case-notes-remove-btn"]').remove(),t(e).find('[data-column="dropdown"] [data-target="wdt-portal-dropdown-menu-container"] [data-target="wdt-portal-dropdown-menu"] > button').length||t(e).find('[data-target="wdt-portal-dropdown-menu-container"]').remove()):t(e).find('[data-target="wdt-portal-dropdown-menu-container"]').remove(),t(o).find('tbody[data-target="portal-table-body"]').append(e)}else t(r).closest('[data-target="wdt-case-notes-filter-table"]').find('[data-target="no-matches-found"]').show();t(r).data("page",e.body.page),t(r).data("max_page",e.body.max_page),t(r).trigger("wdt:afterRefresh")}},error:function(t){"abort"!==t.statusText&&(wdtDisplayNotification("Unable to retrieve case notes. Please contact administrator.","error",-1),console.log(t))},complete:function(){t(o).find('[data-target="spinner"]').hide()}})})),t('[data-target="portal-case-notes-table"]').trigger("wdt:ready")})),jQuery((function(t){"use strict";t('[data-table-target="portal-clients-table"]').on("wdt:response",(function(e){let a=t(this).parents('[data-target="portal-table-container"]').first(),o=e.wdt.body;if(o.clients.length)for(let e of o.clients){let o=t(t(a).find('[data-target="template-table"]').get(0).content).find('[data-target="template-row"]').clone(),r=o.find('td[data-column="client"]'),n="";if(r.length&&e.full_name&&e.id){let t=e.full_name;e.cams_ref&&(t+=" - "+e.cams_ref),n='<a class="wdt-portal-table-link" href="?wdt-page=client&wdt-client='+e.id+'">'+t+"</a>"+(e.archived?'<span class="wdt-archived-badge">Archived</span>':"")}n&&t(r).html(n);let i=o.find('td[data-column="last-activity"]'),s="";e.last_login&&(s+="<span>"+e.last_login+"</span>",e.last_action&&(s+='<div class="wdt-portal-table-subtext"><span>'+e.last_action+"</span></div>")),i.length&&s&&i.html(s);let d=o.find('td[data-column="resumes"]');d.length&&e.resumes&&d.text(wdtNumberFormat(e.resumes));let l=o.find('td[data-column="skills"]');l.length&&e.skills&&l.text(wdtNumberFormat(e.skills));let c=o.find('td[data-column="occupations"]');c.length&&e.occupations&&c.text(wdtNumberFormat(e.occupations));let p=o.find('td[data-column="sectors"]');p.length&&e.sectors&&p.text(wdtNumberFormat(e.sectors));let u=o.find('td[data-column="companies"]');u.length&&e.companies&&u.text(wdtNumberFormat(e.companies));let f=o.find('td[data-column="logins"]');f.length&&e.events&&e.events.login&&f.text(wdtNumberFormat(e.events.login)),t(a).find('[data-target="portal-table-body"]').append(o)}else t(a).find('[data-target="portal-table-body"]').append('<tr><td colspan="999">No results found.</td></tr>')})),t('[data-table-target="portal-clients-table"]').on("wdt:update",(function(e){let a=e.wdt&&e.wdt.perPage?e.wdt.perPage:25,o=e.wdt&&e.wdt.query?e.wdt.query:"",r=e.wdt&&e.wdt.page?e.wdt.page:1,n=t(this).attr("data-nonce"),i=t(this).parents('[data-target="portal-table-container"]').first(),s=this;jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/clients/",data:{nonce:n,number:a,query:o,page:r},beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(i).find('[data-target="portal-table-body"]').html(""),t(i).find('[data-target="spinner"]').show()},success:function(e){if(e.success){let a=t.Event("wdt:response");a.wdt={},a.wdt.body=e.body,t(s).trigger(a);let o=e.body.page,r=e.body.max_page;t(s).data("page",e.body.page),t(s).data("max_page",e.body.max_page),1===o?(t(s).parents('[data-target="portal-table-container"]').first().nextAll('[data-target="wdt-portal-my-clients-footer"]').first().find('[data-target="wdt-portal-my-clients-pagination"] [data-pg-action="first"]').prop("disabled",!0),t(s).parents('[data-target="portal-table-container"]').first().nextAll('[data-target="wdt-portal-my-clients-footer"]').first().find('[data-target="wdt-portal-my-clients-pagination"] [data-pg-action="prev"]').prop("disabled",!0)):(t(s).parents('[data-target="portal-table-container"]').first().nextAll('[data-target="wdt-portal-my-clients-footer"]').first().find('[data-target="wdt-portal-my-clients-pagination"] [data-pg-action="first"]').prop("disabled",!1),t(s).parents('[data-target="portal-table-container"]').first().nextAll('[data-target="wdt-portal-my-clients-footer"]').first().find('[data-target="wdt-portal-my-clients-pagination"] [data-pg-action="prev"]').prop("disabled",!1)),o===r?(t(s).parents('[data-target="portal-table-container"]').first().nextAll('[data-target="wdt-portal-my-clients-footer"]').first().find('[data-target="wdt-portal-my-clients-pagination"] [data-pg-action="next"]').prop("disabled",!0),t(s).parents('[data-target="portal-table-container"]').first().nextAll('[data-target="wdt-portal-my-clients-footer"]').first().find('[data-target="wdt-portal-my-clients-pagination"] [data-pg-action="last"]').prop("disabled",!0)):(t(s).parents('[data-target="portal-table-container"]').first().nextAll('[data-target="wdt-portal-my-clients-footer"]').first().find('[data-target="wdt-portal-my-clients-pagination"] [data-pg-action="next"]').prop("disabled",!1),t(s).parents('[data-target="portal-table-container"]').first().nextAll('[data-target="wdt-portal-my-clients-footer"]').first().find('[data-target="wdt-portal-my-clients-pagination"] [data-pg-action="last"]').prop("disabled",!1))}},error:function(t){wdtDisplayNotification("Unable to retrieve clients. Please contact administrator.","error",-1),console.log(t)},complete:function(){t(i).find('[data-target="spinner"]').hide()}})})),t('[data-table-target="portal-clients-table"]').on("wdt:loaded",(function(e){t(this).attr("data-loaded","true")})),t('[data-table-target="portal-clients-table"]').trigger("wdt:loaded")})),jQuery((function(t){"use strict";t('[data-target="wdt-activity-table"]').on("wdt:update",(function(e){let a=t(this).parents('[data-target="wdt-portal-activity-widget"]').first(),o=t(a).find('[data-action="wdt-change-activity-tab"][data-active="true"]').attr("data-target"),r=t('[wdt-dashboard-target="date-range"]').first().val().split("|"),n="-1"==r[0]?"":r[0],i="-1"==r[1]?"":r[1],s=this,d=t(s).attr("data-nonce"),l=a.find('[data-target="spinner"]'),c=setTimeout((function(){t(l).css("display","block"),t(s).css("opacity","0.5")}),200);jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/report/user-events/",data:{nonce:d,date_from:n,date_to:i},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&function(e,a){t(e).html(""),a.sort((function(t,e){return t.count-e.count})),a.reverse(),a=a.slice(0,6);for(let o of a)t(e).append("<tr><td>"+o.label+"</td><td>"+o.count+"</td></tr>")}(s,function(t,e){let a=[];
1for(let o in t)null!=t[o][e]&&a.push({count:t[o][e],label:o});return a}(e.result,o))},error:function(t){console.log(t)},complete:function(){clearTimeout(c),t(l).css("display","none"),t(s).css("opacity","1")}})})),t('[data-target="wdt-portal-activity-widget"] [data-target="wdt-activity-table"]').length&&t('[data-target="wdt-portal-activity-widget"] [data-target="wdt-activity-table"]').each((function(e){t(this).trigger("wdt:update")})),t('[data-target="wdt-portal-activity-widget"] [data-action="wdt-change-activity-tab"]').on("click",(function(e){let a=t(this).parents('[data-target="wdt-portal-activity-widget"]').first();t(a).find('[data-action="wdt-change-activity-tab"]').attr("data-active","false"),t(this).attr("data-active","true");let o=t(a).find('[data-target="wdt-activity-table"]');t(o).trigger("wdt:update")}))})),jQuery((function(t){})),jQuery((function(t){"use strict";function e(e){let a=t(e).parents('[data-target="wdt-portal-clients-widget"]').first(),o=t.Event("wdt:update");o.wdt={},o.wdt.page=1,o.wdt.perPage=t(a).find('[data-target="wdt-portal-clients-widget-perpage"]').val(),o.wdt.query=t(a).find('[data-target="wdt-portal-clients-widget-query"]').val(),t(e).trigger(o)}t('[data-target="wdt-portal-clients-widget"] [data-table-target="portal-clients-table"][data-loaded="true"]').each((function(t){e(this)})),t('[data-target="wdt-portal-clients-widget"] [data-table-target="portal-clients-table"]').on("wdt:loaded",(function(t){e(this)})),t('[data-target="wdt-portal-clients-widget"] [data-table-target="portal-clients-table"]').on("wdt:response",(function(e){t(this).parents('[data-target="wdt-portal-clients-widget"]').first().find('[data-target="wdt-portal-clients-widget-footer"]').find('[data-target="wdt-portal-clients-widget-footer-total"]').html("<strong>"+e.wdt.body.page+"</strong> of "+e.wdt.body.max_page)})),t('[data-target="wdt-portal-clients-widget"] [data-action="wdt-portal-clients-widget-refresh"]').on("change",(function(a){e(t(this).parents('[data-target="wdt-portal-clients-widget"]').first().find('[data-table-target="portal-clients-table"]'))}))})),jQuery((function(t){"use strict";t('[data-widget="wdt-counsellor-news"]').on("wdt:trigger",(function(e){let a=this,o=t(this).find('[data-target="spinner"]');t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/counsellor-news-feed/",data:{},beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(a).find('[data-target="wdt-portal-counsellor-news-widget-empty-notice"]').hide(),t(o).show()},success:function(e){if(e.success){let o=t(a).find('[data-target="news-list"]');if(e.posts&&e.posts.length>0)for(let r of e.posts){let e=r.feed,n=t(t(a).find('[data-target="wdt-portal-counsellor-news-widget-item-template"][data-feed="'+e+'"]').clone(!0).html());t(o).append(n),t(n).find('[data-target="wdt-counsellor-news-item-title"]').text(r.title),t(n).find('[data-target="wdt-counsellor-news-item-title"]').attr("href",r.link),t(n).find('[data-target="wdt-counsellor-news-item-content"]').html(r.content),t(n).find('[data-target="wdt-counsellor-news-item-content"] a').each((function(e){let a=t(this).attr("href");a.includes(r.root_url)||t(this).attr("href",r.root_url+a),t(this).attr("target","_blank")})),t(n).find('[data-target="wdt-counsellor-news-item-date"]').text(r.date)}else t(a).find('[data-target="wdt-portal-counsellor-news-widget-empty-notice"]').show()}else t(a).find('[data-target="wdt-portal-counsellor-news-widget-empty-notice"]').show()},error:function(e){t(a).find('[data-target="wdt-portal-counsellor-news-widget-empty-notice"]').show(),console.log(e)},complete:function(){t(o).hide()}})})),t('[data-widget="wdt-counsellor-news"]').trigger("wdt:trigger")})),jQuery((function(t){"use strict";t(document).on("wdt:trigger",'[data-widget="wdt-job-activity-widget"]',(function(e){let a=t('[wdt-dashboard-target="date-range"]').first().val().split("|"),o="-1"==a[0]?"":a[0],r="-1"==a[1]?"":a[1];t(this).trigger("wdt:showchart"),t(this).find('[data-target="wdt-job-activity-chart-strip"]').each((function(e){let a=t.Event("wdt:update");a.wdt={},a.wdt.dateFrom=o,a.wdt.dateTo=r,t(this).trigger(a)}))})),t(document).on("click",'[data-action="wdt-change-job-activity-tab"]',(function(e){t('[data-action="wdt-change-job-activity-tab"]').attr("data-active","false").attr("aria-selected","false"),t(this).attr("data-active","true").attr("aria-selected","true"),wdtAnnounce(`Now showing ${t(this).attr("data-target")} job posting activity`);let a=t(this).parents('[data-target="wdt-portal-job-activity-widget-container"]').first();t(a).trigger("wdt:showchart")})),t(document).on("wdt:showchart",'[data-target="wdt-portal-job-activity-widget-container"]',(function(e){t(this).find('[data-target="charts"]').hide();let a=t(this).find('[data-action="wdt-change-job-activity-tab"][data-active="true"]').first().attr("data-target");t(this).find('[data-target="charts"][data-charts="'+a+'"]').css("display","flex")})),t('[data-widget="wdt-job-activity-widget"] [data-target="wdt-job-activity-chart-strip"][data-loaded="true"]').length&&t('[data-widget="wdt-job-activity-widget"]').trigger("wdt:trigger"),t('[data-widget="wdt-job-activity-widget"] [data-target="wdt-job-activity-chart-strip"]').on("wdt:loaded",(function(e){t(this).parents('[data-widget="wdt-job-activity-widget"]').first().trigger("wdt:trigger")})),t('[data-widget="wdt-job-activity-widget"]').each((function(e){0==t(this).find('[data-target="wdt-job-activity-chart-strip"]').length&&t(this).trigger("wdt:trigger")}))})),jQuery((function(t){"use strict";t('[data-widget="wdt-logins-widget"]').on("wdt:trigger",(function(e){let a=t('[wdt-dashboard-target="date-range"]').first().val().split("|"),o="-1"==a[0]?"":a[0],r="-1"==a[1]?"":a[1],n=t.Event("wdt:update");n.wdt={},n.wdt.mode=t(this).find('[data-action="wdt-change-logins-tab"][data-active="true"]').first().attr("data-target"),n.wdt.dateFrom=o,n.wdt.dateTo=r,t(this).find('[data-target="wdt-logins-simple-chart"]').trigger(n)})),t('[data-target="widget-container"] [data-target="wdt-logins-simple-chart"][data-loaded="true"]').length&&t('[data-target="widget-container"] [data-target="wdt-logins-simple-chart"][data-loaded="true"]').each((function(e){let a=t(this).parents('[data-widget="wdt-logins-widget"]').first();t(a).trigger("wdt:trigger")})),t('[data-target="widget-container"] [data-target="wdt-logins-simple-chart"]').on("wdt:loaded",(function(e){let a=t(this).parents('[data-widget="wdt-logins-widget"]').first();t(a).trigger("wdt:trigger")})),t('[data-action="wdt-change-logins-tab"]').on("click",(function(e){t('[data-action="wdt-change-logins-tab"]').attr("data-active","false"),t(this).attr("data-active","true");let a=t(this).parents('[data-widget="wdt-logins-widget"]').first();t(a).trigger("wdt:trigger")}))})),jQuery((function(t){"use strict";t(document).on("wdt:trigger",'[data-widget="wdt-my-companies-widget"]',(function(e){let a=this,o=[];t(this).find('[data-my-companies-widget-target="company-row"]').each((function(e){o.push(t(this).attr("data-company-id"))})),o&&(t(a).find('[data-my-companies-widget-target="my-companies-table"]').css("visibility","hidden"),t(a).find('[data-my-companies-widget-target="my-companies-table"]').css("opacity","0"),t(a).find('[data-target="spinner"]').css("display","block"),jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/metrics/employer-companies-breakdown/",data:{companies:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.success)for(let o of e.report){let e=o.id,r=t(a).find('[data-my-companies-widget-target="company-row"][data-company-id="'+e+'"]');r.length&&(t(r).find('[data-my-companies-widget-target="views"]').text(o.job_views),t(r).find('[data-my-companies-widget-target="active-posts"]').text(o.active_job_posts),t(r).find('[data-my-companies-widget-target="expired-posts"]').text(o.expired_job_posts),t(r).find('[data-my-companies-widget-target="followers"]').text(o.following_users))}},error:function(t){console.log(t)},complete:function(){t(a).find('[data-my-companies-widget-target="my-companies-table"]').css("visibility","visible"),t(a).find('[data-my-companies-widget-target="my-companies-table"]').css("opacity","1"),t(a).find('[data-target="spinner"]').css("display","none")}}))})),t('[data-widget="wdt-my-companies-widget"]').length&&t('[data-widget="wdt-my-companies-widget"]').trigger("wdt:trigger")})),jQuery((function(t){"use strict";function e(e){t(e).find('[data-target="chart"]').hide();let a=t(e).find('[data-action="wdt-change-accounts-tab"][data-active="true"]').first().attr("data-target");t(e).find('[data-target="chart"][data-chart="'+a+'"]').css("display","flex")}t('[data-widget="wdt-accounts-widget"]').on("wdt:trigger",(function(e){let a=t('[wdt-dashboard-target="date-range"]').first().val().split("|"),o="-1"==a[0]?"":a[0],r="-1"==a[1]?"":a[1],n=t.Event("wdt:update");n.wdt={},n.wdt.dateFrom=o,n.wdt.dateTo=r,t(this).find('[data-target="wdt-account-growth-breakdown"]').trigger(n)})),t('[data-target="wdt-portal-accounts-widget-container"]').each((function(t){e(this)})),t('[data-action="wdt-change-accounts-tab"]').on("click",(function(a){t('[data-action="wdt-change-accounts-tab"]').attr("data-active","false"),t(this).attr("data-active","true"),e(t(this).parents('[data-target="wdt-portal-accounts-widget-container"]').first())}
1)),t('[data-target="wdt-portal-accounts-widget-container"] [data-target="wdt-accounts-snapshot-chart"][data-loaded="true"]').length&&t('[data-target="wdt-portal-accounts-widget-container"] [data-target="wdt-accounts-snapshot-chart"][data-loaded="true"]').each((function(e){t(this).trigger("wdt:update")})),t('[data-target="wdt-portal-accounts-widget-container"] [data-target="wdt-accounts-snapshot-chart"]').on("wdt:loaded",(function(e){t(this).trigger("wdt:update")})),t('[data-target="wdt-portal-accounts-widget-container"] [data-target="wdt-account-growth-breakdown"][data-loaded="true"]').length&&t('[data-target="wdt-portal-accounts-widget-container"] [data-target="wdt-account-growth-breakdown"][data-loaded="true"]').each((function(e){let a=t(this).parents('[data-target="wdt-portal-accounts-widget-container"]').first();t(a).trigger("wdt:trigger")})),t('[data-target="wdt-portal-accounts-widget-container"] [data-target="wdt-account-growth-breakdown"]').on("wdt:loaded",(function(e){let a=t(this).parents('[data-target="wdt-portal-accounts-widget-container"]').first();t(a).trigger("wdt:trigger")}))})),jQuery((function(t){"use strict";t('[data-widget="wdt-top-viewed-widget"]').on("wdt:trigger",(function(e){let a=t('[wdt-dashboard-target="date-range"]').first().val().split("|"),o="-1"==a[0]?"":a[0],r="-1"==a[1]?"":a[1],n=t.Event("wdt:update");n.wdt={},n.wdt.mode=t(this).find('[data-action="wdt-change-top-viewed-tab"][data-active="true"]').first().attr("data-target"),n.wdt.dateFrom=o,n.wdt.dateTo=r,t(this).find('[data-target="wdt-top-viewed-chart"]').trigger(n)})),t('[data-target="widget-container"] [data-target="wdt-top-viewed-chart"][data-loaded="true"]').length&&t('[data-target="widget-container"] [data-target="wdt-top-viewed-chart"][data-loaded="true"]').each((function(e){t(this).parents('[data-target="widget-container"]').first().trigger("wdt:trigger")})),t('[data-target="widget-container"] [data-target="wdt-top-viewed-chart"]').on("wdt:loaded",(function(e){t(this).parents('[data-target="widget-container"]').first().trigger("wdt:trigger")})),t('[data-action="wdt-change-top-viewed-tab"]').on("click",(function(e){t('[data-action="wdt-change-top-viewed-tab"]').attr("data-active","false"),t(this).attr("data-active","true"),t(this).parents('[data-target="widget-container"]').first().trigger("wdt:trigger")}))})),jQuery((function(t){"use strict";t(document).on("wdt:trigger",'[data-widget="wdt-wage-insights-widget"]',(function(e){let a=t('[wdt-dashboard-target="date-range"]').first().val().split("|"),o="-1"==a[0]?"":a[0],r="-1"==a[1]?"":a[1];t(this).trigger("wdt:showchart");let n=t(this).find('[data-action="wdt-change-wage-insights-tab"][data-active="true"]').first().attr("data-target");t(this).find('[data-target="chart"][data-chart="'+n+'"] [data-target="wdt-wage-insights-chart"]').each((function(e){let a=t.Event("wdt:update");a.wdt={},a.wdt.dateFrom=o,a.wdt.dateTo=r,t(this).trigger(a)}))})),t(document).on("click",'[data-action="wdt-change-wage-insights-tab"]',(function(e){t('[data-action="wdt-change-wage-insights-tab"]').attr("data-active","false").attr("aria-selected","false"),t(this).attr("data-active","true").attr("aria-selected","true"),wdtAnnounce(`Now showing ${t(this).attr("data-target")} wage insights`);let a=t(this).parents('[data-target="wdt-portal-wage-insights-widget-container"]').first();t(a).trigger("wdt:trigger")})),t(document).on("wdt:showchart",'[data-target="wdt-portal-wage-insights-widget-container"]',(function(e){t(this).find('[data-target="chart"]').hide();let a=t(this).find('[data-action="wdt-change-wage-insights-tab"][data-active="true"]').first().attr("data-target");t(this).find('[data-target="chart"][data-chart="'+a+'"]').css("display","flex")})),t('[data-widget="wdt-wage-insights-widget"] [data-target="wdt-wage-insights-chart"][data-loaded="true"]').length&&t('[data-widget="wdt-wage-insights-widget"]').trigger("wdt:trigger"),t('[data-widget="wdt-wage-insights-widget"] [data-target="wdt-wage-insights-chart"]').on("wdt:loaded",(function(e){t(this).parents('[data-widget="wdt-wage-insights-widget"]').first().trigger("wdt:trigger")})),t('[data-widget="wdt-wage-insights-widget"]').each((function(e){0==t(this).find('[data-target="wdt-wage-insights-chart"]').length&&t(this).trigger("wdt:trigger")}))})),jQuery((function(t){"use strict";function e(){t('[data-target="wdt-widget-container"]').each((function(t){a(this)}))}function a(e){let a=t(e).find('[data-position="widget-container"]');a.removeClass("wdt-widget-container-hidden"),a.addClass("wdt-transient-widget-sizing");let o=0,r=0;do{a=t(e).find('[data-position="widget-container"]').not(".wdt-widget-container-hidden"),o=t(e).width(),r=t(e).get(0).scrollWidth,o<r&&a.last().addClass("wdt-widget-container-hidden")}while(o<r&&a.length>2);let n=t(e).find('[data-position="widget-container"]'),i=t(e).find('[data-position="widget-container"]').not(".wdt-widget-container-hidden");t(n).find('[data-target="navigate-left"]').css("visibility","hidden"),t(n).find('[data-target="navigate-right"]').css("visibility","hidden"),t(n).length>t(i).length&&(t(i).first().find('[data-target="navigate-left"]').css("visibility","visible"),t(i).last(
1).find('[data-target="navigate-right"]').css("visibility","visible")),a.removeClass("wdt-transient-widget-sizing"),t(e).removeClass("wdt-portal-widget-container-loading")}e(),t(window).on("resize",(function(t){e()})),t('[data-widget="wdt-widget-container-widget"] [data-widget="wdt-metric-widget"] [data-action="navigate-left"]').on("click",(function(e){let o=t(this).parents('[data-widget="wdt-widget-container-widget"]');this.blur(),o.find('[data-position="widget-container"]').last().detach().insertBefore(o.find('[data-position="widget-container"]').first()),setTimeout((function(){let t=o.find('.wdt-portal-metric-widget:nth-child(1) [data-action="navigate-left"]')[0];t&&t.focus()}),0),setTimeout((function(){wdtAnnounce("Navigated left",!0)}),50),a(o)})),t('[data-widget="wdt-widget-container-widget"] [data-position="widget-container"] [data-action="navigate-right"]').on("click",(function(e){let o=t(this).parents('[data-widget="wdt-widget-container-widget"]');this.blur(),o.find('[data-position="widget-container"]').first().detach().insertAfter(o.find('[data-position="widget-container"]').last()),setTimeout((function(){let t=o.find('.wdt-portal-metric-widget:nth-child(2) [data-action="navigate-right"]')[0];t&&t.focus()}),0),setTimeout((function(){wdtAnnounce("Navigated right",!0)}),50),a(o)}))})),jQuery((function(t){var e;t('[data-widget="wdt-portal-tasks"]').on("wdt:refresh",(function(a,o){let r=this,n=t(r).find('[data-target="spinner"]'),i=t(r).find('[data-target="late-tasks-list"]'),s=t(r).find('[data-target="current-tasks-list"]'),d=t(r).find('[data-target="wdt-portal-tasks-widget-empty-notice"]');e&&e.abort(),e=t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/case-tasks/",data:o,beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(n).show(),t(d).hide(),t(i).html("").hide(),t(i).prev().hide(),t(s).html("").hide(),t(s).prev().hide()},success:function(e){if(e.success&&e.body.tasks.length)for(let a of e.body.tasks){let e=t(t(r).find("#wdt-portal-task-list-item-template").clone(!0).html());if(a.completed&&t(e).find('[data-action="toggle-task-complete"]input[type="checkbox"]').prop("checked",!0),a.due_date&&(a.overdue&&t(e).find('[data-target="wdt-task-list-item-due-date"]').addClass("overdue"),t(e).find('[data-target="wdt-task-list-item-due-date"]').text(a.due_date)),a.staff&&a.staff.length){if(1===a.staff.length){let o=a.staff[0];t(e).find('[data-target="wdt-task-avatar"]').attr("title",o.name),t(e).find('[data-target="wdt-task-avatar"]').text(o.initials),t(e).find('[data-target="wdt-task-avatar"]').css("background-color",o.colour),t(e).find("[data-staff-ids]").each((function(e){t(this).attr("data-staff-ids",o.id)})),t(e).find("[data-staff-names]").each((function(e){t(this).attr("data-staff-names",o.name)}))}if(a.staff.length>1){let o=[],r=[];for(let t of a.staff)o.push(t.id),r.push(t.name);t(e).find('[data-target="wdt-task-avatar"]').attr("title",r.join(", ")),t(e).find('[data-target="wdt-task-avatar"]').text(a.staff.length),t(e).find("[data-staff-ids]").each((function(e){t(this).attr("data-staff-ids",o.join("|"))})),t(e).find("[data-staff-names]").each((function(e){t(this).attr("data-staff-names",r.join("|"))}))}t(e).find('[data-action="wdt-portal-task-reassign-btn"]').text("Reassign Task")}if(a.client){let o=t(e).find('[data-target="wdt-task-list-item-client"]');t(o).text(a.client.name),a.client.permission?t(o).attr("href","?wdt-page=client&wdt-client="+a.client.id):(t(o).attr("href","#"),t(o).attr("disabled",!0))}else{let o=t(e).find('[data-target="wdt-task-list-item-client"]'),r=Array.isArray(a.staff)&&a.staff.length>0?a.staff[0]:null;t(o).text(r.name),t(o).attr("href","?wdt-page=client&wdt-client="+r.id)}a.name&&(t(e).find('[data-target="wdt-task-list-item-title"]').text(a.name),t(e).find("[data-object-name]").each((function(e){t(this).attr("data-object-name",a.name)}))),a.slug&&t(e).find("[data-object-slug]").each((function(e){t(this).attr("data-object-slug",a.slug)})),a.excerpt||t(e).find('[data-target="wdt-task-list-item-more-btn"]').hide(),a.permissions&&a.permissions.includes("complete")||t(e).find('[data-action="toggle-task-complete"]').parents("label").first().remove(),a.permissions&&a.permissions.includes("update")||t(e).find('[data-target="wdt-portal-dropdown-menu-container"]').remove(),a.service_provider&&t(e).find("[data-service-provider]").each((function(e){t(this).attr("data-service-provider",a.service_provider)})),a.overdue?t(i).append(e):t(s).append(e)}},error:function(t){console.log(t)},complete:function(){t(i).children().length&&(t(i).show(),t(i).prev().show()),t(s).children().length&&(t(s).show(),t(s).prev().show()),0===t(i).children().length&&0===t(s).children().length&&t(d).show(),t(n).hide()}})})),t('[data-widget="wdt-portal-tasks"]').on("wdt:trigger",(function(e){let a={nonce:t(this).attr("data-nonce"),number:10,page:1,staff:t(this).attr("data-staff-id")};t(this).trigger("wdt:refresh",a)})),t('[data-widget="wdt-portal-tasks"]').trigger("wdt:trigger"),t(document).on("click",'[data-widget="wdt-portal-tasks"] [data-action="show-completed"]',(function(e){let a=t(this).parents('[data-widget="wdt-portal-tasks"]').first(),o={nonce:t(a).attr("data-nonce"),number:25,page:1,staff:t(a).attr("data-staff-id"),include_completed:!0};t(this).attr("data-action","hide-completed"),t(this).text("Hide Completed >"),t(a).trigger("wdt:refresh",o)})),t(document).on("click",'[data-widget="wdt-portal-tasks"] [data-action="hide-completed"]',(function(e){let a=t(this).parents('[data-widget="wdt-portal-tasks"]').first(),o={nonce:t(a).attr("data-nonce"),number:10,page:1,staff:t(a).attr("data-staff-id")};t(this).attr("data-action","show-completed"),t(this).text("Show Completed >"),t(a).trigger("wdt:refresh",o)}))})),jQuery((function(t){"use strict";t('[data-widget="wdt-resumes-widget"]').on("wdt:trigger",(function(e){let a=t('[wdt-dashboard-target="date-range"]').first().val().split("|"),o="-1"==a[0]?"":a[0],r="-1"==a[1]?"":a[1],n=t.Event("wdt:update");n.wdt={},n.wdt.mode=t(this).find('[data-action="wdt-change-resumes-tab"][data-active="true"]').first().attr("data-target"),n.wdt.dateFrom=o,n.wdt.dateTo=r,t(this).find('[data-target="wdt-resumes-simple-chart"]').trigger(n)})),t('[data-target="widget-container"] [data-target="wdt-resumes-simple-chart"][data-loaded="true"]').length&&t('[data-target="widget-container"] [data-target="wdt-resumes-simple-chart"][data-loaded="true"]').each((function(e){t(this).parents('[data-target="widget-container"]').first().trigger("wdt:trigger")})),t('[data-target="widget-container"] [data-target="wdt-resumes-simple-chart"]').on("wdt:loaded",(function(e){t(this).parents('[data-target="widget-container"]').first().trigger("wdt:trigger")})),t('[data-action="wdt-change-resumes-tab"]').on("click",(function(e){t('[data-action="wdt-change-resumes-tab"]').attr("data-active","false"),t(this).attr("data-active","true");let a=t(this).parents('[data-target="widget-container"]').first();t(a).trigger("wdt:trigger")}))})),jQuery((function(t){"use strict";t(document).on("wdt:showForm",'*[data-has-nested-forms="true"] [data-target="task-form-container"]',(function(e){let a=t(this).parents('*[data-has-nested-forms="true"]').first();t(a).trigger("wdt:hideSubmitSection")})),t(document).on("wdt:showHeading",'*[data-has-nested-forms="true"] [data-target="task-form-container"]',(function(e){let a=t(this).parents('*[data-has-nested-forms="true"]').first();t(a).trigger("wdt:showSubmitSection")})),t(document).on("wdt:customDestroyContentModal","#wdt-task-modal",(function(t){_wdtRenderConfirmModal("Discard Changes","Are you sure you want to discard these changes?",(function(){wdtForceRemoveContentModal()}),(function(){wdtFocusActiveContentModal()}),"Discard Changes","wdt-portal-modal-alt")})),t(document).on("click",'#wdt-task-modal [data-target="wdt-task-form-modal-form-container"] [data-action="close-task"]',(function(e){let a=t(this).parents("#wdt-task-modal").first();t(a).trigger("wdt:customDestroyContentModal")})),t(document).on("wdt:buildRequestPayload",'[data-target="task-form-inner"]',(function(e){let a=this;t(a).data("wdt:requestPayload",null);let o=t(a).find('[name="task-client"]'),r=t(a).find('[name="task-name"]'),n=t(a).find('[name="task-date"]'),i=t(a).find('[name="task-detail
1s"]'),s=t(a).find('[name="task-slug"]'),d=t(a).find('[name="task-assigned"]'),l=t(a).find('[name="task-recurring-period"]'),c=t(a).find('[name="task-recurring-end-date"]'),p=t(a).find('[name="task-service-provider"]'),u=t(a).find('[name="task-complete"]'),f=t(a).find('[name="task-employer"]'),g=[o,r,n,i,d,l,c,u];for(let e of g){if(!t(e).length)continue;if(!t(e)[0].reportValidity())return}let m=t(r).val(),w=t(n).val(),h=t(i).val(),b=t(d).val(),y=t(o).val(),v=t(s).val(),_=t(l).val(),k=t(c).val(),x=t(p).val(),j=t(u).val(),C=t(f).val(),D={date:w,details:h,client_id:y,name:m,staff_id:b,recurring_period:_,service_provider:x,complete:j};v&&(D.task_slug=v),C&&(D.employer_id=C),"yes"===t(a).find('[name="task-recurring-end"]:checked').val()&&(D.recurring_period_end=k),t(a).data("wdt:requestPayload",D)})),t(document).on("wdt:submit",'[data-target="task-form-inner"]',(function(e){let a=this;t(a).trigger("wdt:buildRequestPayload");let o=t(a).data("wdt:requestPayload");if(!o)return;let r=WDT.rest_url+"wedatatools/v1/portal/case-tasks/create/",n=null;o.task_slug&&(r=WDT.rest_url+"wedatatools/v1/portal/case-tasks/update/",n=o.task_slug);let i=t.ajax({type:"POST",url:r,data:o,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.success){let e=t.Event("wdt:afterSave");e._slug=n,t(a).trigger(e)}else wdtDisplayNotification("Unable to create task.","error",-1)},error:function(t){wdtDisplayNotification("Unable to create task.","error",-1),console.log(t)}});t(this).data("submission",i)})),t(document).on("wdt:afterSave",'[data-target="task-form-inner"]',(function(e){let a=e._slug;t("#wdt-task-modal").length&&(wdtForceRemoveContentModal(),a?wdtDisplayNotification("Successfully updated task.","success",3e3):wdtDisplayNotification("Successfully added task.","success",3e3))})),t(document).on("click",'[data-target="wdt-task-form-modal-form-container"] [data-action="save-task"]',(function(e){let a=t(this).parents('[data-target="wdt-task-form-modal-form-container"]').first().find('[data-target="task-form-inner"]').first();t(a).trigger("wdt:submit")})),t(document).on("click",'[data-action="wdt-portal-task-reassign-btn"][data-object-slug][data-staff-ids][data-staff-names]',(function(e){let a=t(this).attr("data-object-slug"),o=t(this).attr("data-staff-ids").split("|"),r=t(this).attr("data-staff-names").split("|"),n=t(this).attr("data-service-provider");if(o.length!==r.length)return;let i=t("#wdt-portal-tasks-reassign-staff").clone(!0);_wdtRenderContentModal("Reassign Task",i.html(),"wdt-portal-modal-alt"),t('#wdt-content-modal [name="task_slug"]').attr("value",a);for(let e=0;e<o.length;e++){if(!o[e])continue;let a=t.Event("wdt:select");a.label=r[e],a.value=o[e],t('#wdt-content-modal [name="staff_id"]').trigger(a)}let s=new WDTTypeahead(t('#wdt-content-modal [name="staff_id"]')[0]),d=s.getAction(),l=new URL(d);l.searchParams.set("serviceProviders",n),s.setAction(l)})),t(document).on("click",'[data-action="wdt-portal-task-postpone-btn"][data-object-slug]',(function(e){let a=t(this).attr("data-object-slug");t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/html/tasks/form/postpone",data:{task_slug:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&(_wdtRenderContentModal("Postpone Due Date",e.html,"wdt-portal-modal-alt"),t('#wdt-content-modal [data-date-picker="wdt-material-form"]').each((function(e){t(this).trigger("wdtrf:register")})),t('#wdt-content-modal [data-rf-action="wdt-material-form-input"]').each((function(e){t(this).trigger("wdtrf:refresh")})))},error:function(t){console.log(t)}})})),t(document).on("click",'[data-action="wdt-portal-task-edit-btn"][data-object-slug]',(function(e){let a=t(this).attr("data-object-slug");t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/html/tasks/form/",data:{taskSlug:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&(_wdtRenderContentModal("Edit Task",e.html,"wdt-portal-modal-alt","wdt-task-modal",!0),t('#wdt-task-modal [data-date-picker="wdt-material-form"]').each((function(e){t(this).trigger("wdtrf:register")})),t('#wdt-task-modal [data-rf-action="wdt-material-form-input"]').each((function(e){t(this).trigger("wdtrf:refresh")})),t('#wdt-task-modal [data-target="task-form-container"]').trigger("wdt:showForm"))},error:function(t){console.log(t)}})})),t(document).on("click",'[data-action="wdt-portal-task-remove-btn"][data-object-name][data-object-slug]',(function(e){let a=this,o=t(this).attr("data-object-name"),r=t(this).attr("data-object-slug");_wdtRenderConfirmModal("Delete Task","Are you sure you want to delete <strong>"+o+"</strong>?",(function(){t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/case-tasks/delete/",data:{case_task_slug:r},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?wdtDisplayNotification("Successfully deleted task.","success",3e3):wdtDisplayNotification("Encountered an error deleting task.","error",3e3)},error:function(t){wdtDisplayNotification("Encountered an error deleting task.","error",3e3),console.log(t)},complete:function(){t(a).trigger("wdt:afterDelete")}})}),(function(){}
1),"Delete Task","wdt-portal-modal-alt")})),t(document).on("click",'#wdt-portal [data-action="create-case-task"]',(function(e){let a=this,o=t(this).attr("data-client-id"),r={};o&&(r.clientID=o),t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/html/tasks/form/",data:r,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&(wdtRenderContentModal({title:"Add Task",content:e.html,className:"wdt-portal-modal-alt",id:"wdt-task-modal",customDestroy:!0}),t('#wdt-task-modal [data-date-picker="wdt-material-form"]').each((function(e){t(this).trigger("wdtrf:register")})),t('#wdt-task-modal [data-rf-action="wdt-material-form-input"]').each((function(e){t(this).trigger("wdtrf:refresh")})),t(a).trigger("wdt:afterOpenForm"),t('#wdt-task-modal [data-target="task-form-container"]').trigger("wdt:showForm"))},error:function(t){console.log(t)}})})),t(document).on("click",'[data-action="wdt-tasks-content-modal-close"]',(function(t){wdtRemoveContentModal()})),t(document).on("wdt:afterSubmit",'[data-target="wdt-portal-tasks-filters-assign-staff-form"]',(function(e){wdtForceRemoveContentModal(),t("#wdt-portal-tasks #wdt-portal-tasks-table").trigger("wdt:refresh")})),t(document).on("wdt:afterSubmit",'#wdt-task-modal form[data-target="wdt-portal-task-postpone-form"]',(function(e){wdtForceRemoveContentModal(),t("#wdt-portal-tasks #wdt-portal-tasks-table").trigger("wdt:refresh")})),t(document).on("wdt:afterDelete",'#wdt-portal-tasks [data-action="wdt-portal-task-remove-btn"][data-object-name][data-object-slug]',(function(e){let a=t.Event("wdt:refresh");a._excludeSlugs=[t(this).attr("data-object-slug")],t("#wdt-portal-tasks #wdt-portal-tasks-table").trigger(a)}))})),window.wdtInitJobBoardMaps=function(){var t=jQuery(".wdt-employer-job-board-locations-map[data-lat]");if(t.length){var e=t.first().closest(".wdt-employer-profile-tab-panel");e.length&&"none"===e.css("display")?window.wdtJobBoardMapsPending=!0:(window.wdtJobBoardMapsPending=!1,t.each((function(){var t=this;if(!jQuery(t).data("map-ready")){jQuery(t).data("map-ready",!0);var e=jQuery(t).data("has-pin"),a={lat:parseFloat(jQuery(t).data("lat")),lng:parseFloat(jQuery(t).data("lng"))},o=new google.maps.Map(t,{center:a,zoom:e?15:12,disableDefaultUI:!0,gestureHandling:"none",clickableIcons:!1});jQuery(t).data("map-instance",o),e&&google.maps.event.addListenerOnce(o,"idle",(function(){new google.maps.Marker({position:a,map:o})}))}})))}},jQuery((function(t){"use strict";let e=1===t(".wdt-employer-profile").data("restrict-edits");var a;e&&(t(".wdt-portal-client-overview-section-edit").hide(),t('[data-action="employer-locations-add"]').hide(),t('[data-action="employer-contacts-add"]').hide(),t('[data-action="employer-notes-add"]').hide()),t(document).on("wdt:navigateTab",'.wdt-employer-profile button[data-action="wdt-nav-tabs-item"]',(function(){var e=t(this).data("tab-target");t(".wdt-employer-profile-tab-panel").css("display","none"),t('.wdt-employer-profile-tab-panel[data-target="'+e+'"]').css("display","block");var a=new URL(window.location.href);a.searchParams.set("wdt-employer-tab",e),history.replaceState({},"",a.toString()),"job-board-admin"===e&&window.wdtJobBoardMapsPending&&window.google&&window.google.maps&&setTimeout((function(){wdtInitJobBoardMaps()}),50),"service-plan-cases"===e&&initializeArchiveTable(t(".wdt-employer-service-plan-cases [data-archive-table]").get(0)),"locations"===e&&initializeArchiveTable(t(".wdt-employer-locations [data-archive-table]").get(0)),"contacts"===e&&initializeArchiveTable(t(".wdt-employer-contacts [data-archive-table]").get(0)),"notes"===e&&initializeArchiveTable(t(".wdt-employer-notes [data-archive-table]").get(0))})),t(window).on("resize.jobBoardMaps",(function(){clearTimeout(a),a=setTimeout((function(){window.google&&window.google.maps&&t(".wdt-employer-job-board-locations-map[data-lat]").each((function(){var e=t(this).data("map-instance");e&&(google.maps.event.trigger(e,"resize"),e.setCenter(e.getCenter()))}))}),200)}));var o=[];function r(){return t(".wdt-employer-locations")}function n(t){if(!t)return"";var e=t.split("T")[0].split("-");return 3!==e.length?t:e[2]+"-"+e[1]+"-"+e[0]}function i(){var t=new Date,e=String(t.getDate()).padStart(2,"0"),a=String(t.getMonth()+1).padStart(2,"0");return t.getFullYear()+"-"+a+"-"+e}function s(e,a,o,r){t(e).data("max_page",r),t(a+' [data-target="wdt-pagination"] [data-pg-action="first"]').prop("disabled",1===o),t(a+' [data-target="wdt-pagination"] [data-pg-action="prev"]').prop("disabled",1===o),t(a+' [data-target="wdt-pagination"] [data-pg-action="next"]').prop("disabled",o===r),t(a+' [data-target="wdt-pagination"] [data-pg-action="last"]').prop("disabled",o===r)}var d=t('[data-target="employer-locations-actions-icon"]').html()||"";function l(e){var a=e.find('[name="type"]'),o=a.closest('[data-target="wdt-form-select-combobox-container"]'),r=o.find(".wdt-employer-locations-primary-warning"),n=e.find('[name="id"]').val(),i=parseInt(e.attr("data-existing-primary-id"))||0,s=e.attr("data-existing-primary-name")||"";if("primary"===(a.val()||"").toLowerCase()&&i&&String(i)!==String(n)){if
1(!r.length){var d="<strong>"+t("<div>").text(s).html()+"</strong>";o.append('<div class="wdt-employer-primary-warning wdt-employer-locations-primary-warning">This will replace the current Primary location ('+d+").</div>")}}else r.remove()}function c(e){var a=r().data("employer-id"),o=e?"Edit Location":"Add Location";t.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/employer-locations/form",data:{employerId:a,id:e||0},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){_wdtRenderContentModal(o,e,"wdt-portal-modal-alt","employer-locations-modal",!0);var a=t('#employer-locations-modal [data-target="employer-locations-form"]');a.trigger("wdt:initializeForm"),l(a)},error:function(){wdtDisplayNotification("Could not load location form.","error",-1)}})}function p(e,a){var o=e.find('[name="id"]').val(),r=!!o,n=e.find('[name="address"]').val(),i=e.find('[name="unitSuite"]').val(),s=e.find('[name="addressLine2"]').val(),d=e.find('[name="name"]').val(),l={employerId:e.find('[name="employerId"]').val(),name:d,type:e.find('[name="type"]').val(),address:n,unitSuite:i,addressLine2:s,city:e.find('[name="city"]').val(),province:e.find('[name="province"]').val(),postalCode:e.find('[name="postalCode"]').val(),comments:e.find('[name="comments"]').val(),startDate:e.find('[name="startDate"]').val(),endDate:e.find('[name="endDate"]').val()};r&&(l.id=o);var c=e.find('[name="postalCode"]')[0];if(l.postalCode&&!/^[A-Za-z]\d[A-Za-z] \d[A-Za-z]\d$/.test(l.postalCode))return c.setCustomValidity("Enter a valid postal code (e.g., N9A 7K6)"),void c.reportValidity();c.setCustomValidity("");var p=parseInt(e.attr("data-existing-primary-id"))||0;if("primary"===(l.type||"").toLowerCase()&&p&&String(p)!==String(o)){var f=t("<div>").text(e.attr("data-existing-primary-name")||"").html();_wdtRenderConfirmModal("Change Primary Location?","<strong>"+d+"</strong> will be saved as the Primary location. <strong>"+f+"</strong> will remain saved, but its type will change from Primary to Alternate.",(function(){u(e,l,a)}),(function(){C?C.focus():wdtFocusActiveContentModal()}),"Save as Primary","wdt-portal-modal-alt")}else u(e,l,a)}function u(e,a,o){var r=e.find('[data-target="employer-locations-save"]'),n=!!a.id,i=n?WDT.rest_url+"wedatatools/v1/portal/employer-locations/update":WDT.rest_url+"wedatatools/v1/portal/employer-locations/create";r.prop("disabled",!0),t.ajax({method:"POST",url:i,data:a,beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(i){if(r.prop("disabled",!1),i.success)if(t("#wdt-employer-locations-archive-table").trigger("wdt:refresh"),t(".wdt-employer-job-board-locations").length&&J(),wdtDisplayNotification(n?"Location updated.":"Location added.","success",3e3),o)"primary"===(a.type||"").toLowerCase()&&(e.attr("data-existing-primary-id",i.location?i.location.id:""),e.attr("data-existing-primary-name",a.name)),e[0].reset(),e.find('[name="id"]').val(""),e.closest(".wdt-content-modal-container").find(".wdt-content-modal-title").text("Add Location");else if(C){var s=i.location?i.location.id:null;C.destroy();var d=t('#employer-contacts-modal [data-target="employer-contacts-form"]');if(d.length){var l=D().data("employer-id");d.find('[name="locationId"][data-field-type="combobox"]').closest('[data-target="wdt-form-select-combobox-container"]').trigger("wdt:clearOptions"),function(e,a,o){let r=e.find('[name="locationId"][data-field-type="combobox"]').closest('[data-target="wdt-form-select-combobox-container"]');if(!r.length)return;t.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/employer-locations",data:{employerId:a,includeArchived:0},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.success&&e.locations){t.each(e.locations,(function(t,e){r.trigger("wdt:addOption",[e.id,e.name])}));let a=null;if(o?a=o:1===e.locations.length&&(a=e.locations[0].id),a){let e=t.Event("wdt:select");e.value=a,r.trigger(e)}}}})}(d,l,s)}}else wdtForceRemoveContentModal();else wdtDisplayNotification(i.message||"Could not save location.","error",-1)},error:function(t){r.prop("disabled",!1);var e=t&&t.responseJSON&&t.responseJSON.message||"Could not save location.";wdtDisplayNotification(e,"error",-1)}})}t(document).on("input",'[data-target="employer-locations-form"] [name="postalCode"]',(function(){var t=this.value.replace(/[^A-Za-z0-9]/g,"").toUpperCase().slice(0,6);this.value=t.length>3?t.slice(0,3)+" "+t.slice(3):t,this.setCustomValidity("")})),t(document).on("click",'[data-action="employer-locations-add"]',(function(){c(0)})),t(document).on("click",'[data-action="employer-locations-cancel"]',(function(){let e=t(this).closest("#employer-locations-modal");t(e).trigger("wdt:customDestroyContentModal")})),t(document).on("wdt:customDestroyContentModal","#employer-locations-modal",(function(t){_wdtRenderConfirmModal("Discard Changes","Are you sure you want to discard these changes?",(function(){C?C.destroy():wdtForceRemoveContentModal()}),(function(){C?C.focus():wdtFocusActiveContentModal()}),"Discard Changes","wdt-portal-modal-alt")})),t(document).on("click",'[data-action="employer-locations-actions-toggle"]',(function(e){e.stopPropagation();var a=t(this).siblings(".wdt-employer-locations-actions-menu"),o=a.is(":visible");if(t(".wdt-employer-locations-actions-menu").hide(),!o){var r=this.getBoundingClientRect();a.css({top:r.bottom+"px",right:window.innerWidth-r.right+"px",left:"auto",zIndex:1e3}).show()}})),t(document).on("click",(function(){t(".wdt-employer-locations-actions-menu").hide()})),t(window).on("scroll.employer-locations resize.employer-locations",(function(){t(".wdt-employer-locations-actions-menu").hide()})),t(document).on("click",'[data-action="employer-locations-edit"]',(function(){var e=t(this).closest("tr").data("location-id");t(".wdt-employer-locations-actions-menu").hide(),c(e)})),t(document).on("click",'[data-action="employer-locations-archive"]',(function(){var e=t(this).closest("tr"),a=e.data("location-id"),o=r().data("employer-id"),n=e.hasClass("wdt-employer-locations-row-archived");if(t(".wdt-employer-locations-actions-menu").hide(),n||"primary"!==(e.data("location-type")||"").toLowerCase()){var s={employerId:o,id:a};
1n||(s.endDate=i()),_wdtRenderConfirmModal(n?"Unarchive Location":"Archive Location",n?"Are you sure you want to unarchive this location?":"Are you sure you want to archive this location?",(function(){t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/employer-locations/archive",data:s,beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success?(t("#wdt-employer-locations-archive-table").trigger("wdt:refresh"),t(".wdt-employer-job-board-locations").length&&J()):wdtDisplayNotification("Could not update location status.","error",-1)},error:function(){wdtDisplayNotification("Could not update location status.","error",-1)}})}),void 0,n?"Unarchive":"Archive","wdt-portal-modal-alt")}else wdtDisplayNotification("Primary locations cannot be archived.","error",-1)})),t(document).on("submit",'[data-target="employer-locations-form"]',(function(e){e.preventDefault(),p(t(this),!1)})),t(document).on("click",'[data-action="employer-locations-save-add-another"]',(function(){p(t(this).closest('[data-target="employer-locations-form"]'),!0)})),t(document).on("change",'#employer-locations-modal [name="type"]',(function(){l(t(this).closest('[data-target="employer-locations-form"]'))}));var f=[],g=null,m=t('[data-target="employer-contacts-actions-icon"]').html()||"",w=t('[data-target="employer-contacts-bookmark-solid-icon"]').html()||"",h=t('[data-target="employer-contacts-bookmark-outline-icon"]').html()||"",b=t('[data-target="employer-contacts-mail-icon"]').html()||"",y=t('[data-target="employer-contacts-phone-icon"]').html()||"",v=t('[data-target="employer-profile-bookmark-solid-icon"]').html()||"",_=t('[data-target="employer-profile-bookmark-outline-icon"]').html()||"",k=t('[data-target="employer-profile-mail-icon"]').html()||"",x=t('[data-target="employer-profile-phone-icon"]').html()||"",j=[],C=null;function D(){return t(".wdt-employer-contacts")}function T(e){var a=D().data("employer-id"),o=e?"Edit Contact":"Add Contact",r={employerId:a};e&&(r.id=e),t.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/employer-contacts/form",data:r,beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){_wdtRenderContentModal(o,e,"wdt-portal-modal-alt","employer-contacts-modal",!0);var a=t('#employer-contacts-modal [data-target="employer-contacts-form"]');a.trigger("wdt:initializeForm"),E(a)},error:function(){wdtDisplayNotification("Could not load contact form.","error",-1)}})}function N(t){var e="all_service_providers"===(t.find('[name="visibility"]:checked').val()||"my_service_provider");return{isNetwork:e,existingId:parseInt(t.attr(e?"data-existing-network-primary-id":"data-existing-sp-primary-id"))||0,existingName:t.attr(e?"data-existing-network-primary-name":"data-existing-sp-primary-name")||"",label:e?"Primary (Network)":"Primary"}}function S(t,e){var a=t.find('[name="id"]').val();return"primary"===t.find('[name="type"]').val()&&e.existingId&&String(e.existingId)!==String(a)}function E(e){var a=e.find('[name="type"]'),o=a.closest('[data-target="wdt-form-select-combobox-container"]'),r=o.find(".wdt-employer-contacts-primary-warning"),n=N(e);if(n.isNetwork&&"1"!==e.attr("data-can-set-network-primary")&&"primary"===a.val())return r.remove(),void o.append('<div class="wdt-employer-primary-warning wdt-employer-contacts-primary-warning">Only network-wide employer managers can set the primary contact for all service providers.</div>');if(S(e,n)){if(!r.length){var i="<strong>"+t("<div>").text(n.existingName).html()+"</strong>";o.append('<div class="wdt-employer-primary-warning wdt-employer-contacts-primary-warning">This will replace the current '+n.label+" contact ("+i+").</div>")}}else r.remove()}function P(e,a){var o=!0;if(e.find("*[required]").each((function(){o&&(t(this).is(":hidden")||t(this).prop("disabled")||(o=this.reportValidity()))})),o&&wdtValidatePhoneInput(e.find('[name="phone"]')[0])){var r=e.find(".wdt-employer-contacts-contact-method-warning");if(e.find('[name="phone"]').val().trim()||e.find('[name="email"]').val().trim()){r.remove();var n=e.find('[name="id"]').val(),i=!!n,s=e.find('[name="firstName"]').val().trim(),d=e.find('[name="lastName"]').val().trim(),l=d?s+" "+d:s,c=e.find('[name="phone"]').val().trim(),p=e.find('[name="phoneExt"]').val().trim(),u={name:l,role:e.find('[name="role"]').val(),type:e.find('[name="type"]').val(),email:e.find('[name="email"]').val(),phone:c,phoneExt:p,startDate:e.find('[name="startDate"]').val(),endDate:e.find('[name="endDate"]').val(),locationId:parseInt(e.find('[name="locationId"]').val())||0,visibility:e.find('[name="visibility"]:checked').val()||"my_service_provider"};u.employerId=D().data("employer-id"),i&&(u.id=n);var f=N(e);if(S(e,f)){var g=t("<div>").text(l).html(),m=t("<div>").text(f.existingName).html(),w=f.isNetwork?" Every service provider without its own primary contact will fall back to it.":"";_wdtRenderConfirmModal("Change "+f.label+" Contact?","<strong>"+g+"</strong> will be saved as the "+f.label+" contact."+w+" <strong>"+m+"</strong> will remain saved, but its type will change from "+f.label+" to Alternate.",(function(){R(e,u,a)}),(function(){wdtFocusActiveContentModal()}),"Save as "+f.label,"wdt-portal-modal-alt")}else R(e,u,a)}else r.length||e.find('[name="phone"]').closest("label").before('<div class="wdt-inline-notice-banner wdt-banner-warning wdt-employer-contacts-contact-method-warning wdt-form-section-grid-item-span-4">Please add at least one contact method.</div>')}}function R(e,a,o){var r=e.find('[data-target="employer-contacts-save"]'),n=!!a.id,i=n?WDT.rest_url+"wedatatools/v1/portal/employer-contacts/update":WDT.rest_url+"wedatatools/v1/portal/employer-contacts/create";r.prop("disabled",!0),t.ajax({method:"POST",url:i,data:a,beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(i){if(r.prop("disabled",!1),i.success)if(t("#wdt-employer-contacts-archive-table").trigger("wdt:refresh"),wdtDisplayNotification(n?"Contact updated.":"Contact added.","success",3e3),o){if("primary"===a.type){var s="all_service_providers"===a.visibility?"network":"sp";e.attr("data-existing-"+s+"-primary-id",i.id||"0"),e.attr("data-existing-"+s+"-primary-name",a.name)}e[0].reset(),e.find('[name="id"]').val(""),e.closest(".wdt-content-modal-container").find(".wdt-content-modal-title").text("Add Contact")}else wdtForceRemoveContentModal();else wdtDisplayNotification("Could not save contact.","error",-1)},error:function(){r.prop("disabled",!1),wdtDisplayNotification("Could not save contact.","error",-1)}})}function W(e){var a=t(".wdt-employer-profile-header").find('[data-target="employer-preferred-contact"]');if(e){var o='<div class="wdt-employer-preferred-contact">';o+='<span class="wdt-employer-preferred-contact-title">';var r="Preferred Contact:";e.isFallback&&(r=e.isNetworkPrimary?"Primary (Network) Contact:":"Primary Contact:"),o+='<span class="wdt-employer-preferred-contact-label">'+r+"</span>",o+='<span class="wdt-employer-preferred-contact-name">'+t("<div>").text(e.name||"").html()+"</span>",o+="</span>",e.email&&(o+='<span class="wdt-employer-preferred-contact-info">',o+='<span class="wdt-employer-preferred-contact-icon" aria-hidden="true">'+k+"</span>",o+='<a href="mailto:'+t("<div>").text(e.email).html()+'" class="wdt-employer-preferred-contact-email">'+t("<div>").text(e.email).html()+"</a>",o+="</span>"),e.phone&&(o+='<span class="wdt-employer-preferred-contact-info">',o+='<span class="wdt-employer-preferred-contact-icon" aria-hidden="true">'+x+"</span>",o+="<span>"+t("<div>").text(wdtFormatPhoneNumber(e.phone,e.phoneExt)).html()+"</span>",o+="</span>"),o+="</div>",a.html(o)}else a.empty()}t(document).on("click",'[data-action="employer-contacts-bookmark"]',(function(e){e.stopPropagation();
1var a=parseInt(t(this).data("contact-id")),o=g===a?0:a,r=D().data("employer-id");g=o||null;var n={employerId:r};o&&(n.contactId=o),t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/employer-contacts/set-preferred",data:n,beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&(g=e.preferredContact&&!e.preferredContact.isFallback?e.preferredContact.id:null,W(e.preferredContact||null)),t("#wdt-employer-contacts-archive-table").trigger("wdt:refresh")},error:function(){t("#wdt-employer-contacts-archive-table").trigger("wdt:refresh"),wdtDisplayNotification("Could not update preferred contact.","error",-1)}})})),t(document).on("click",'[data-action="employer-contacts-add"]',(function(){T(0)})),t(document).on("click",'[data-action="employer-contacts-cancel"]',(function(){let e=t(this).closest("#employer-contacts-modal");t(e).trigger("wdt:customDestroyContentModal")})),t(document).on("wdt:customDestroyContentModal","#employer-contacts-modal",(function(t){_wdtRenderConfirmModal("Discard Changes","Are you sure you want to discard these changes?",(function(){wdtForceRemoveContentModal()}),(function(){wdtFocusActiveContentModal()}),"Discard Changes","wdt-portal-modal-alt")})),t(document).on("click",'[data-action="employer-contacts-add-location"]',(function(){var e=D().data("employer-id");t.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/employer-locations/form",data:{employerId:e,id:0,embedded:1},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){(C=new WDTContentModal("Add Location",e,"wdt-portal-modal-alt","employer-locations-modal",!0)).afterDestroyCallback=function(){C=null},C.render();var a=t('#employer-locations-modal [data-target="employer-locations-form"]');a.trigger("wdt:initializeForm"),l(a)},error:function(){wdtDisplayNotification("Could not load location form.","error",-1)}})})),t(document).on("change",'#employer-contacts-modal [name="type"], #employer-contacts-modal [name="visibility"]',(function(){E(t(this).closest('[data-target="employer-contacts-form"]'))})),t(document).on("click",'[data-action="employer-contacts-actions-toggle"]',(function(e){e.stopPropagation();var a=t(this).siblings(".wdt-employer-contacts-actions-menu"),o=a.is(":visible");if(t(".wdt-employer-contacts-actions-menu").hide(),!o){var r=this.getBoundingClientRect();a.css({top:r.bottom+"px",right:window.innerWidth-r.right+"px",left:"auto",zIndex:1e3}).show()}})),t(document).on("click",(function(){t(".wdt-employer-contacts-actions-menu").hide()})),t(window).on("scroll.employer-contacts resize.employer-contacts",(function(){t(".wdt-employer-contacts-actions-menu").hide()})),t(document).on("click",'[data-action="employer-contacts-edit"]',(function(){var e=t(this).closest("tr").data("contact-id");t(".wdt-employer-contacts-actions-menu").hide(),T(e)})),t(document).on("click",'[data-action="employer-contacts-archive"]',(function(){var e=t(this).closest("tr"),a=e.data("contact-id"),o=e.hasClass("wdt-employer-contacts-row-archived");t(".wdt-employer-contacts-actions-menu").hide(),_wdtRenderConfirmModal(o?"Unarchive Contact":"Archive Contact",o?"Are you sure you want to unarchive this contact?":"Are you sure you want to archive this contact?",(function(){t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/employer-contacts/archive",data:{employerId:D().data("employer-id"),id:a},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success?(t("#wdt-employer-contacts-archive-table").trigger("wdt:refresh"),wdtDisplayNotification(o?"Contact unarchived.":"Contact archived.","success",3e3)):wdtDisplayNotification("Could not update contact status.","error",-1)},error:function(){wdtDisplayNotification("Could not update contact status.","error",-1)}})}),void 0,o?"Unarchive":"Archive","wdt-portal-modal-alt")})),t(document).on("submit",'[data-target="employer-contacts-form"]',(function(e){e.preventDefault(),P(t(this),!1)})),t(document).on("click",'[data-action="employer-contacts-save-add-another"]',(function(){P(t(this).closest('[data-target="employer-contacts-form"]'),!0)})),t(document).on("input",'[data-target="employer-contacts-form"] [name="phone"]',(function(){this.setCustomValidity("")})),t(document).on("input",'[data-target="employer-contacts-form"] [name="phone"], [data-target="employer-contacts-form"] [name="email"]',(function(){t(this).closest('[data-target="employer-contacts-form"]').find(".wdt-employer-contacts-contact-method-warning").remove()})),t(document).on("click",'[data-action="employer-profile-follow"]',(function(e){e.preventDefault();var a=t(this),o=a.attr("data-employer-slug");if(o&&!a.prop("disabled")){var r="true"===a.attr("data-following"),n=r?"unfollow":"follow";a.prop("disabled",!0),t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/companies/"+n,data:{object_slug:o,employer_id:a.attr("data-employer-id")||0,nonce:a.attr("data-follow-nonce")||""},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){if(t&&t.success){var e=!r;a.attr("data-following",e?"true":"false"),a.attr("aria-label",e?"Unfollow employer":"Follow employer"),a.html(e?v:_),wdtDisplayNotification(e?"Employer added to My Employers.":"Employer removed from My Employers.","success",3e3)}else wdtDisplayNotification("Could not update followed employers.","error",-1)},error:function(){wdtDisplayNotification("Could not update followed employers.","error",-1)},complete:function(){a.prop("disabled",!1)}})}}));var Q=[],O=!1;t(".wdt-employer-notes").data("employer-id");(t(".wdt-employer-notes").length&&function(){if(f.length)return;var e=A().data("employer-id");t.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/employer-contacts",data:{employerId:e},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success&&t.body&&t.body.contacts&&(f=t.body.contacts)}})}(),t(document).on("wdt:populateTable","#wdt-employer-notes-archive-table",(function(a){a.stopPropagation();
1var o=this,r=t(this).attr("data-sort"),i=t(o).data("currentPage")||1,d=t('.wdt-employer-notes [data-archive-table] [name="perPage"]').val()||null,l=t('.wdt-employer-notes [data-archive-table] [name="search"]').val()||null,c={employerId:A().data("employer-id"),page:i};if(d&&(c.perPage=d),r&&(c.sort=r),l&&(c.search=l),O){var p=wdtSerializeMaterialForm(wdtGetArchiveTableFilterForm(t(".wdt-employer-notes [data-archive-table]").first()).find("[data-filter-form]").first()),u=p.authorId&&p.authorId[0]?p.authorId[0].value:"";u&&(c.authorId=u);var g=(p["clientId[]"]||[]).map((function(t){return t.value})).filter(Boolean);g.length&&(c["clientId[]"]=g);var m=(p["contactId[]"]||[]).map((function(t){return t.value})).filter(Boolean);m.length&&(c["contactId[]"]=m);var w=(p["activityTypeId[]"]||[]).map((function(t){return t.value})).filter(Boolean);w.length&&(c["activityTypeId[]"]=w)}else{var h=new URL(window.location),b=h.searchParams.get("authorId");b&&(c.authorId=b);var y=h.searchParams.getAll("clientId[]");y.length&&(c["clientId[]"]=y);var v=h.searchParams.getAll("contactId[]");v.length&&(c["contactId[]"]=v);var _=h.searchParams.getAll("activityTypeId[]");_.length&&(c["activityTypeId[]"]=_)}var k=!!(l||c.authorId||c["clientId[]"]||c["contactId[]"]||c["activityTypeId[]"]);t.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/employer-case-notes",data:c,traditional:!1,beforeSend:function(e){e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(o).trigger("wdt:loadState")},success:function(a){if(a.success){var r=a.body||{};Q=r.notes||[],function(e){var a=t(".wdt-employer-notes [data-archive-table]").first(),o=wdtGetArchiveTableFilterForm(a).find("[data-filter-form]").first();if(!o.length)return;var r=e&&e.availableAuthors?e.availableAuthors:[],n=e&&e.availableClients?e.availableClients:[],i=e&&e.availableContacts?e.availableContacts:[];function s(e,a,r,n){var i=o.find('[name="'+e+'"]');if(i.length){var s=i.closest('[data-typeahead-target="wdt-ajax-select-container"]').find(".wdt-ajax-local-options");s.length&&(s.empty(),t.each(a,(function(e,a){s.append(t("<li>").attr("aria-selected","false").attr("role","option").addClass("wdt-ajax-select-search-results-result").attr("data-depth","0").attr("data-value",r(a)).text(n(a)))})))}}s("authorId",r,(function(t){return t.id}),(function(t){return t.name})),s("clientId[]",n,(function(t){return t.id}),(function(t){return t.name})),s("contactId[]",i,(function(t){return t.id}),(function(t){return t.name})),a.trigger("wdt:refreshFilterButtons")}(r),O||(O=!0);var i=r.total||0,d=r.perPage||25,l=Math.max(1,Math.ceil(i/d)),c=t.Event("wdt:updatePageDisplay");c.page=r.page||1,c.maxPage=l,t(o).trigger(c),s(o,".wdt-employer-notes",r.page||1,l),t(o).find("tbody").empty(),function(a,o){if(!o||0===o.length)return void a.html('<tr><td colspan="6" class="wdt-employer-notes-empty" data-testid="employer-notes-no-results">No notes found.</td></tr>');var r="";t.each(o,(function(a,o){var i=o.permissions&&-1!==o.permissions.indexOf("update"),s=o.permissions&&-1!==o.permissions.indexOf("delete"),d=t("<div>").text(o.author?o.author.name:"").html()||'<span class="wdt-employer-profile-empty-value">—</span>',l=[];if(o.related_client_name||o.related_client_id&&o.related_client_id>0){var c=o.related_client_name||"Client #"+o.related_client_id,p=t("<div>").text(c).html();l.push(o.related_client_id&&o.related_client_id>0?'<a href="?wdt-page=client&wdt-client='+o.related_client_id+'" target="_blank" class="wdt-employer-notes-related-link">'+p+"</a>":'<span class="wdt-employer-notes-related-client">'+p+"</span>")}if(o.employer_contact_id&&o.employer_contact_id>0){var u=f.find((function(t){return t.id===o.employer_contact_id})),g=u&&u.name?u.name:o.employer_contact_name;g&&l.push('<span class="wdt-employer-notes-related-contact">'+t("<div>").text(g).html()+"</span>")}var m=l.length?l.join("<br>"):'<span class="wdt-employer-profile-empty-value">—</span>',w='<span class="wdt-employer-profile-empty-value">—</span>';o.activity_types&&o.activity_types.length&&(w=t.map(o.activity_types,(function(e){return t("<div>").text(e.name).html()})).join(", ")),r+='<tr class="wdt-employer-notes-row" data-testid="employer-notes-row" data-note-id="'+o.id+'">',r+='<td class="wdt-employer-notes-td-date" data-testid="employer-notes-row-date">'+function(t){if(!t)return'<span class="wdt-employer-profile-empty-value">—</span>';var e=t.split(" "),a=n(e[0]||""),o=e[1]||"";return a+(o?"<br>"+o:"")}(o.note_date)+"</td>",r+='<td data-testid="employer-notes-row-author">'+d+"</td>",r+='<td class="wdt-employer-notes-td-related">'+m+"</td>",r+='<td data-testid="employer-notes-row-activity">'+w+"</td>
1",r+='<td class="wdt-employer-notes-td-details" data-testid="employer-notes-row-details">'+t("<div>").text(o.note_content||"").html()+"</td>",r+='<td class="wdt-employer-notes-td-actions">',(i||s)&&(r+='<div class="wdt-portal-dropdown-menu-container" data-target="wdt-portal-dropdown-menu-container">',r+='<button class="wdt-portal-dropdown-expand-menu-ellipsis-btn" data-action="wdt-portal-dropdown-menu-toggle" data-testid="employer-notes-row-actions-btn" title="Toggle Menu"></button>',r+='<div class="wdt-portal-dropdown-menu" data-target="wdt-portal-dropdown-menu">',i&&!e&&(r+='<button class="wdt-portal-dropdown-menu-btn dropdown-btn-icon edit-icon" data-action="employer-notes-edit" data-testid="employer-notes-row-edit-btn">Edit</button>'),s&&(r+='<button class="wdt-portal-dropdown-menu-btn dropdown-btn-icon trash-icon" data-action="employer-notes-delete" data-testid="employer-notes-row-delete-btn">Delete</button>'),r+="</div></div>"),r+="</td>",r+="</tr>"})),a.html(r)}(t(o).find("tbody"),Q),t(".wdt-employer-notes").toggleClass("wdt-employer-notes-is-empty",!1===r.hasNotes),i>0?(t('.wdt-employer-notes [data-target="result-count-container"]').show(),t('.wdt-employer-notes [data-target="result-count"]').text(i)):!1!==r.hasNotes&&k&&t('.wdt-employer-notes [data-target="no-matches-found"]').show()}},error:function(t,e){},complete:function(){t(o).trigger("wdt:unloadState")}})})),t(".wdt-employer-notes").length)&&("none"!==t(".wdt-employer-notes").closest(".wdt-employer-profile-tab-panel").css("display")&&initializeArchiveTable(t(".wdt-employer-notes [data-archive-table]").get(0)));(t(document).on("wdt:populateTable","#wdt-employer-locations-archive-table",(function(a){a.stopPropagation();var l=this,c=t(this).attr("data-sort"),p=t(l).data("currentPage")||1,u=t('.wdt-employer-locations [data-archive-table] [name="perPage"]').val()||null,f=t('.wdt-employer-locations [data-archive-table] [name="search"]').val()||null,g=r(),m=g.data("employer-id"),w=t(".wdt-employer-locations [data-archive-table-toggle] input").is(":checked"),h={employerId:m,paginated:1,page:p};u&&(h.perPage=u),c&&(h.sort=c),f&&(h.search=f),w&&(h.includeArchived=1),t.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/employer-locations",data:h,beforeSend:function(e){e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(l).trigger("wdt:loadState")},success:function(a){if(a.success){var r=a.body||{};o=r.items||[];var c=r.total||0,p=r.perPage||25,u=Math.max(1,Math.ceil(c/p)),m=t.Event("wdt:updatePageDisplay");m.page=r.page||1,m.maxPage=u,t(l).trigger(m),s(l,".wdt-employer-locations",r.page||1,u),t(l).find("tbody").empty(),function(a,o){if(o&&0!==o.length){var r="";t.each(o,(function(a,o){var s,l=o.isArchived,c=l?" wdt-employer-locations-row-archived":"",p=n(o.startDate)||'<span class="wdt-employer-profile-empty-value">—</span>',u=o.endDate?o.endDate.split("T")[0]:"",f=u&&u<i();s=l?'<span class="wdt-employer-locations-chip wdt-employer-locations-chip-archived">Archived</span>':f?'<span class="wdt-employer-locations-chip wdt-employer-locations-chip-inactive">Inactive</span>':'<span class="wdt-employer-locations-chip wdt-employer-locations-chip-active">Active</span>';var g=l?n(o.endDate)||'<span class="wdt-employer-profile-empty-value">—</span>':f?n(o.endDate):"Present",m=[o.address,o.unitSuite,o.addressLine2].filter(Boolean).join(", "),w=m?m+(o.city?"<br>"+o.city+(o.province?", "+o.province:"")+(o.postalCode?" "+o.postalCode:""):""):'<span class="wdt-employer-profile-empty-value">—</span>',h=(!l&&(o.type||"").toLowerCase(),l?"Unarchive":"Archive");r+='<tr class="wdt-employer-locations-row'+c+'" data-testid="employer-locations-row" data-location-id="'+o.id+'" data-location-type="'+t("<div>").text(o.type||"").html()+'" data-location-status="'+(l?"archived":"active")+'">',r+='<td class="wdt-employer-locations-td-name" data-testid="employer-locations-row-name"><strong>'+t("<div>").text(o.name).html()+"</strong></td>",r+="<td>"+(o.type?t("<div>").text(o.type).html():'<span class="wdt-employer-profile-empty-value">—</span>')+"</td>",r+='<td class="wdt-employer-locations-td-address">'+w+"</td>",r+="<td>"+(o.city?t("<div>
1").text(o.city).html():'<span class="wdt-employer-profile-empty-value">—</span>')+"</td>",r+="<td>"+(o.comments?t("<div>").text(o.comments).html():'<span class="wdt-employer-profile-empty-value">—</span>')+"</td>",r+="<td>"+s+"</td>",r+='<td class="wdt-employer-locations-td-period">'+p+"<br>"+g+"</td>",r+='<td class="wdt-employer-locations-td-actions">',r+='<div class="wdt-employer-locations-actions-container">',r+='<button class="wdt-employer-locations-actions-btn" data-action="employer-locations-actions-toggle" data-testid="employer-locations-row-actions-btn" title="Actions">'+d+"</button>",r+='<div class="wdt-employer-locations-actions-menu" style="display:none;">',e||(r+='<button data-action="employer-locations-edit" data-testid="employer-locations-row-edit-btn">Edit</button>'),r+='<button data-action="employer-locations-archive" data-testid="employer-locations-row-archive-btn">'+h+"</button>",r+="</div></div>",r+="</td>",r+="</tr>"})),a.html(r)}else a.html('<tr><td colspan="8" class="wdt-employer-locations-empty" data-testid="employer-locations-no-results">No locations found.</td></tr>')}(t(l).find("tbody"),o),g.toggleClass("wdt-employer-locations-is-empty",!1===r.hasLocations),0===c&&!1!==r.hasLocations&&(f||t('.wdt-employer-locations [data-target="wdt-archive-table-filters"]').is(":visible"))&&t('.wdt-employer-locations [data-target="no-matches-found"]').show(),c>0&&(t('.wdt-employer-locations [data-target="result-count-container"]').show(),t('.wdt-employer-locations [data-target="result-count"]').text(c))}},error:function(t,e){},complete:function(){t(l).trigger("wdt:unloadState")}})})),t(".wdt-employer-locations").length)&&("none"!==t(".wdt-employer-locations").closest(".wdt-employer-profile-tab-panel").css("display")&&initializeArchiveTable(t(".wdt-employer-locations [data-archive-table]").get(0)));(t(document).on("wdt:populateTable","#wdt-employer-contacts-archive-table",(function(a){a.stopPropagation();var o=this,r=t(this).attr("data-sort"),d=t(o).data("currentPage")||1,l=t('.wdt-employer-contacts [data-archive-table] [name="search"]').val()||null,c=D(),p=c.data("employer-id"),u=t(".wdt-employer-contacts [data-archive-table-toggle] input").is(":checked"),f={employerId:p,paginated:1,page:d,perPage:500};r&&(f.sort=r),l&&(f.search=l),u&&(f.includeArchived=1),t.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/employer-contacts",data:f,beforeSend:function(e){e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(o).trigger("wdt:loadState")},success:function(a){if(a.success){var r=a.body||{};j=r.items||[];var d=r.total||0,p=r.perPage||25,u=Math.max(1,Math.ceil(d/p)),f=t.Event("wdt:updatePageDisplay");f.page=r.page||1,f.maxPage=u,t(o).trigger(f),s(o,".wdt-employer-contacts",r.page||1,u),void 0!==r.preferredContact&&(g=r.preferredContact&&!r.preferredContact.isFallback?r.preferredContact.id:null,W(r.preferredContact||null)),t(o).find("tbody").empty(),function(a,o){if(o&&0!==o.length){var r=o.some((function(t){return t.id===g&&"archived"!==t.status})),s="";t.each(o,(function(a,o){var d,l="archived"===o.status,c=l?" wdt-employer-contacts-row-archived":"",p=!l&&o.id===g,u=r?"This will replace your current preferred contact":"Set as your preferred contact",f='<span class="wdt-employer-contacts-bookmark '+(p?"wdt-employer-contacts-bookmark-primary":"wdt-employer-contacts-bookmark-alternate")+'">'+(p?w:h)+"</span>";d=l?'<span class="wdt-employer-contacts-bookmark-disabled">'+f+"</span>":'<span class="wdt-tooltip-container" data-action="wdt-tooltip-hover" tabindex="0"><button type="button" class="wdt-employer-contacts-bookmark-btn" data-action="employer-contacts-bookmark" data-testid="employer-contacts-row-bookmark-btn" data-contact-id="'+o.id+'">'+f+'</button><div role="tooltip" data-target="wdt-tooltip-text" class="wdt-tooltip-text">'+u+'</div><template data-target="tooltip-dummy-template"><div class="wdt-tooltip-dummy"><div class="wdt-tooltip-dummy-text" data-target="wdt-tooltip-dummy-text"></div><div class="wdt-tooltip-dummy-arrow"></div><div class="wdt-tooltip-dummy-arrow-underlay"></div></div></template></span>';var v=o.type?o.type.charAt(0).toUpperCase()+o.type.slice(1):"",_=o.type?'<span class="wdt-employer-contacts-type-name">'+t("<div>").text(v).html()+"</span>":'<span class="wdt-employer-profile-empty-value">—</span>';o.visibility_label&&(_+='<span class="wdt-employer-contacts-type-scope">'+t("<div>").text(o.visibility_label).html()+"</span>");var k='<div class="wdt-employer-contacts-name-cell">'+d+"<div><strong>"+t("<div>").text(o.name||"").html()+"</strong>";o.role&&(k+='<br><span class="wdt-employer-contacts-role">'+t("<div>").text(o.role).html()+"</span>"),k+="</div></div>";var x="";o.email&&(x='<div class="wdt-employer-contacts-info-row">'+b+'<a href="mailto:'+t("<div>").text(o.email).html()+'">'+t("<div>").text(o.email).html()+"</a></div>");var j="";o.phone&&(j='<div class="wdt-employer-contacts-info-row">'+y+t("<div>").text(wdtFormatPhoneNumber(o.phone,o.phone_ext)).html()+"</div>");var C,D=n(o.start_date)||'<span class="wdt-employer-profile-empty-value">—</span>',T=o.end_date?o.end_date.split("T")[0]:"",N=T&&T<i(),S=N?n(o.end_date):"Present";C=l?'<span class="wdt-employer-contacts-chip wdt-employer-contacts-chip-archived">Archived</span>':N?'<span class="wdt-employer-contacts-chip wdt-employer-contacts-chip-inactive">Inactive</span>':'<span class="wdt-employer-contacts-chip wdt-employer-contacts-chip-active">Active</span>',s+='<tr class="wdt-employer-contacts-row'+c+'" data-testid="employer-contacts-row" data-contact-id="'+o.id+'" data-contact-status="'+(l?"archived":"active")+'">',s+='<td class="wdt-employer-contacts-td-name" data-testid="employer-contacts-row-name">'+k+"</td>",s+='<td data-testid="employer-contacts-row-type">'+_+"</td>",s+="<td>"+x+j+"</td>";var E='<span class="wdt-employer-profile-empty-value">—</span>';if(o.location_name){E="<strong>"+t("<div>").text(o.location_name).html()+"</strong>",o.location_address&&(E+="<br>"+t("<div>").text(o.location_address).html());var P=[];o.location_city&&P.push(t("<div>").text(o.location_city).html());
1var R=[o.location_province,o.location_postal_code].filter(Boolean).join(" ");R&&P.push(t("<div>").text(R).html()),P.length&&(E+="<br>"+P.join(", "))}s+='<td class="wdt-employer-contacts-td-location">'+E+"</td>",s+="<td>"+C+"</td>",s+='<td class="wdt-employer-contacts-td-period">'+D+"<br>"+S+"</td>",s+='<td class="wdt-employer-contacts-td-actions">',s+='<div class="wdt-employer-contacts-actions-container">',s+='<button class="wdt-employer-contacts-actions-btn" data-action="employer-contacts-actions-toggle" data-testid="employer-contacts-row-actions-btn" title="Actions">'+m+"</button>",s+='<div class="wdt-employer-contacts-actions-menu" style="display:none;">',e||(s+='<button data-action="employer-contacts-edit" data-testid="employer-contacts-row-edit-btn">Edit</button>'),s+='<button data-action="employer-contacts-archive" data-testid="employer-contacts-row-archive-btn">'+(l?"Unarchive":"Archive")+"</button>",s+="</div></div>",s+="</td>",s+="</tr>"})),a.html(s)}else a.html('<tr><td colspan="7" class="wdt-employer-contacts-empty" data-testid="employer-contacts-no-results">No contacts found.</td></tr>')}(t(o).find("tbody"),j),c.toggleClass("wdt-employer-contacts-is-empty",!1===r.hasContacts),0===d&&!1!==r.hasContacts&&(l||t('.wdt-employer-contacts [data-target="wdt-archive-table-filters"]').is(":visible"))&&t('.wdt-employer-contacts [data-target="no-matches-found"]').show()}},error:function(t,e){},complete:function(){t(o).trigger("wdt:unloadState")}})})),t(".wdt-employer-contacts").length)&&("none"!==t(".wdt-employer-contacts").closest(".wdt-employer-profile-tab-panel").css("display")&&initializeArchiveTable(t(".wdt-employer-contacts [data-archive-table]").get(0)));function A(){return t(".wdt-employer-notes")}function F(e){var a=A().data("employer-id"),o=e?"Edit Note":"Add Note",r={employerId:a};e&&e.id&&(r.id=e.id),t.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/employer-case-notes/form",data:r,beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){wdtRenderContentModal({title:o,content:e,className:"wdt-portal-modal-alt",id:"employer-notes-modal"}),t('#employer-notes-modal [data-target="employer-notes-form"]').trigger("wdt:initializeForm")},error:function(){wdtDisplayNotification("Could not load note form.","error",-1)}})}t(document).on("click",'[data-action="employer-notes-add"]',(function(){F(null)})),t(document).on("click",'[data-action="employer-notes-cancel"]',(function(){let e=t(this).closest("#employer-notes-modal");e.length?t(e).trigger("wdt:customDestroyContentModal"):wdtForceRemoveContentModal()})),t(document).on("wdt:customDestroyContentModal","#employer-notes-modal",(function(t){_wdtRenderConfirmModal("Discard Changes","Are you sure you want to discard these changes?",(function(){wdtForceRemoveContentModal()}),(function(){wdtFocusActiveContentModal()}),"Discard Changes","wdt-portal-modal-alt")})),t(document).on("wdt:showForm",'#employer-notes-modal [data-target="task-form-container"]',(function(){wdtSyncEmployerNoteTaskFields(t(this),t(this).closest('[data-target="employer-notes-form"]'),A().data("employer-id"))})),t(document).on("change",'#employer-notes-modal [name="relatedClientId"]',(function(){var e=t(this).closest('[data-target="employer-notes-form"]'),a=A().data("employer-id");e.find('[data-target="task-forms"] [data-target="task-form-container"]').each((function(){wdtSyncEmployerNoteTaskFields(t(this),e,a)}))})),t(document).on("click",'[data-action="employer-notes-edit"]',(function(){var e=t(this).closest("tr").data("note-id"),a=null;t.each(Q,(function(t,o){if(o.id===e)return a=o,!1})),a&&F(a)})),t(document).on("click",'[data-action="employer-notes-delete"]',(function(){var e=t(this).closest("tr").data("note-id");_wdtRenderConfirmModal("Delete Case Note","Are you sure you want to delete?",(function(){t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/employer-case-notes/delete",data:{employerId:A().data("employer-id"),id:e},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success?(t("#wdt-employer-notes-archive-table").trigger("wdt:refresh"),wdtDisplayNotification("Note deleted.","success",3e3)):wdtDisplayNotification("Could not delete note.","error",-1)},error:function(){wdtDisplayNotification("Could not delete note.","error",-1)}})}),void 0,"Delete","wdt-portal-modal-alt")})),t(document).on("submit",'[data-target="employer-notes-form"]',(function(e){e.preventDefault(),function(e){var a=e.find('[data-target="employer-notes-save"]'),o=e.find('[name="id"]').val(),r=!!o,n=e.find('[name="noteDate"]').val(),i=e.find('[name="noteTime"]').val(),s=n+(i?" "+i:""),d={noteContent:e.find('[name="noteContent"]').val(),noteDate:s},l=parseInt(e.find('[name="employerContactId"]').val());l&&(d.employerContactId=l);var c=e.find('[name="activityTypeId"]').val();c&&(d.activityTypeSlug=c);var p=parseInt(e.find('[name="relatedClientId"]').val());
1p&&(d.relatedClientId=p);d.employerId=e.find('[name="employerId"]').val(),r&&(d.id=o);e.trigger("wdt:collectCaseTasks");var u=e.data("wdt:caseTasks");if(null===u)return;u.length&&(d.tasks=u);var f=r?WDT.rest_url+"wedatatools/v1/portal/employer-case-notes/update":WDT.rest_url+"wedatatools/v1/portal/employer-case-notes/create";a.prop("disabled",!0),t.ajax({method:"POST",url:f,data:d,beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){a.prop("disabled",!1),e.success?(t("#wdt-employer-notes-archive-table").trigger("wdt:refresh"),wdtDisplayNotification(r?"Note updated.":"Note added.","success",3e3),wdtForceRemoveContentModal()):wdtDisplayNotification("Could not save note.","error",-1)},error:function(){a.prop("disabled",!1),wdtDisplayNotification("Could not save note.","error",-1)}})}(t(this))}));var M='[data-target="employer-overview-section"] [data-target="edit"], [data-target="employer-update-name-trigger"]';t(document).on("click",'[data-target="employer-overview-section"] [data-target="edit"]',(function(){var e=t(this).closest('[data-target="employer-overview-section"]'),a=e.find('[data-target="group"]');t(M).not(e.find('[data-target="edit"]')).hide(),e.find('[data-target="employer-overview-edit-notice"]').show(),e.find('[data-target="buttons"]').show(),e.find('[data-target="edit"]').hide(),a.each((function(){var e=t(this).find('[data-target="content"]'),a=t(this).find('[data-target="field"]');a.length&&(e.hide(),a.show())}))})),t(document).on("click",'[data-target="employer-overview-section"] [data-target="cancel"]',(function(){var e=t(this).closest('[data-target="employer-overview-section"]'),a=e.find('[data-target="group"]');e.find('[data-target="employer-overview-edit-notice"]').hide(),e.find('[data-target="buttons"]').hide(),t(M).show(),a.each((function(){var e=t(this).find('[data-target="content"]'),a=t(this).find('[data-target="field"]');e.show(),a.length&&a.hide()}))}));var L='[data-target="employer-overview-form"] [name="primaryPhone"], [data-target="employer-overview-form"] [name="alternatePhone"], [data-target="employer-overview-form"] [name="faxNumber"]';t(document).on("input",L,(function(){this.setCustomValidity("")})),t(document).on("change",L,(function(){this.value=wdtFormatPhoneNumber(this.value)})),t(document).on("submit",'[data-target="employer-overview-form"]',(function(e){e.preventDefault();for(var a=t(this),o=a.find('[data-target="save"]'),r=a.find('[data-target="cancel"]'),n=["primaryPhone","alternatePhone","faxNumber"],i=0;i<n.length;i++)if(!wdtValidatePhoneInput(a.find('[name="'+n[i]+'"]')[0]))return;var s=a.serializeArray();o.prop("disabled",!0),r.prop("disabled",!0),t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/employer-profiles/update",data:t.param(s),beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Successfully updated employer profile.","success",3e3),setTimeout((function(){location.reload()}),1500)):(o.prop("disabled",!1),r.prop("disabled",!1),wdtDisplayNotification(t.message||"Could not update employer profile.","error",-1))},error:function(t){o.prop("disabled",!1),r.prop("disabled",!1);var e=t&&t.responseJSON&&t.responseJSON.message||"Could not update employer profile.";wdtDisplayNotification(e,"error",-1)}})}));var q="",H=null;function I(){return t('[data-target="employer-update-name"]')}function U(e,a){var o=I().find('[data-target="update-name-notice"]');o.empty(),e?(o.append(t('<div class="wdt-inline-notice-banner"></div>').addClass("wdt-banner-"+a).text(e)),o.show()):o.hide()}function z(t){var e=I().find('[data-target="update-name-results"]');e.empty(),t?(e.append(t),e.show()):e.hide()}function X(e){var a=I(),o=a.find('[data-target="update-name-submit"]');o.prop("disabled",!0),H=t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/employer-profiles/update-name",data:{employerId:a.data("employer-id"),tradingName:e},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){if(t.success)return wdtForceRemoveContentModal(),wdtDisplayNotification("Successfully updated the employer name.","success",3e3),void setTimeout((function(){location.reload()}),1500);o.prop("disabled",!1),U(t.message||"Could not update the employer name.","error")},error:function(t){o.prop("disabled",!1),U(t&&t.responseJSON&&t.responseJSON.message||"Could not update the employer name.","error")},complete:function(){H=null}})}t(document).on("wdt:afterModalOpen",'[data-target="employer-update-name-trigger"]',(function(){q="",I().find('[data-target="update-name-input"]').trigger("focus").trigger("select")})),t(document).on("click",'[data-action="employer-update-name-cancel"]',(function(){wdtForceRemoveContentModal()})),t(document).on("input",'[data-target="update-name-input"]',(function(){""!==q&&q!==(t(this).val()||"").trim()&&(q="",I().find('[data-target="update-name-submit"]').text("Update"),z(null),U("",""))})),t(document).on("submit",'[data-target="employer-update-name"]',(function(e){if(e.preventDefault(),!H){var a=t(this),o=a.find('[data-target="update-name-input"]'),r=(o.val()||"").trim(),n=String(a.data("current-name")||"").trim();if(""===r)return U("Enter the new name for this employer.","error"),void o.trigger("focus");r!==n?q!==r?function(e){var a=I(),o=a.find('[data-target="update-name-submit"]'),r=t('template[data-target="employer-update-name-spinner"]'),n=t('template[data-target="employer-update-name-table"]');U("",""),z(r.length?t(r[0].content.cloneNode(!0)):null),o.prop("disabled",!0);var i=t.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/employers",data:{query:e,format:"add-employer-existing-table",excludeEmployerId:a.data("employer-id"),nonce:a.data("nonce")},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(a){var r=a&&a.body&&a.body.employers||[];if(!r.length)return z(null),void X(e);if(!n.length)return z(null),o.prop("disabled",!1),void U("Could not display employers with similar names, so the name was not changed.","error");var i=t(n[0].content.cloneNode(!0));i.find("tbody").html(r.join("")),z(i),q=e,o.text("Update Anyway"),o.prop("disabled",!1),U("These employers have similar names. Check that none of them is already the company you are renaming before continuing.","warning")},error:function(){z(null),o.prop("disabled",!1),U("Could not check for existing employers, so the name was not changed. Please try again.","error")},complete:function(){H===i&&(H=null)}});H=i}
1(r):X(r):U("That is already this employer's name.","error")}})),t(document).on("click",'[data-target="employer-job-board-settings-section"] [data-action="job-board-admin-edit"]',(function(){var e=t(this).closest('[data-target="employer-job-board-settings-section"]'),a=e.find('[data-target="group"]');e.find('[data-target="buttons"]').show(),e.find('[data-target="edit"]').hide(),a.each((function(){var e=t(this).find('[data-target="content"]'),a=t(this).find('[data-target="field"]');a.length&&(e.hide(),a.show())}))})),t(document).on("click",'[data-action="job-board-admin-cancel"]',(function(){var e=t(this).closest('[data-target="employer-job-board-settings-section"]'),a=e.find('[data-target="group"]');e.find('[data-target="buttons"]').hide(),e.find('[data-target="edit"]').show(),a.each((function(){var e=t(this).find('[data-target="content"]'),a=t(this).find('[data-target="field"]');e.show(),a.length&&a.hide()}))}));var B=t('[data-target="employer-job-board-settings-form"] [name="wdt-employer-posting-strategy"]').val()||"active";t(document).on("change",'[data-target="employer-job-board-settings-form"] [name="wdt-employer-posting-strategy"]',(function(){var e=this;"blocked"===t(this).val()?_wdtRenderConfirmModal("Block All Job Posts from This Employer","This will permanently remove all existing job posts from this employer — including active and expired posts — and stop any new posts from being imported. Reporting data associated with these posts will also be affected. <strong>This action cannot be undone</strong>.",(function(){B="blocked"}),(function(){var a=t.Event("wdt:select");a.value=B,t(e).trigger(a)}),"Block & Remove All Posts","wdt-portal-modal-alt"):B=t(this).val()})),t(document).on("wdt:ajaxresultfilter",'[data-target="employer-job-board-settings-form"] [name="wdt-employer-posting-master"]',(function(e){var a=e._option;t(this).attr("data-employer-id")==t(a).attr("data-value")&&t(a).attr("disabled",!0)})),t(document).on("change",'[data-target="employer-job-board-settings-form"] [name="wdt-employer-posting-master"]',(function(){t(this).closest('[data-target="employer-job-board-settings-form"]').data("alias-prompt",!!t(this).val())})),t(document).on("submit",'[data-target="employer-job-board-settings-form"]',(function(e){e.preventDefault();var a=t(this),o=a.find('[data-target="save"]'),r=a.find('[data-target="cancel"]'),n=parseInt(a.attr("data-alias-count"),10)||0;function i(){o.prop("disabled",!0),r.prop("disabled",!0);for(var e=a.serializeArray(),n=!1,i=0;i<e.length;i++)if("wdt-employer-posting-master"===e[i].name){n=!0;break}n||e.push({name:"wdt-employer-posting-master",value:""});var s=t.param(e);t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/employers/employer-mgmt/update",data:s,beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Employer profile updated successfully.","success",3e3),setTimeout((function(){location.reload()}),1500)):(o.prop("disabled",!1),r.prop("disabled",!1),wdtDisplayNotification("Could not update job posting settings.","error",-1))},error:function(){o.prop("disabled",!1),r.prop("disabled",!1),wdtDisplayNotification("Could not update job posting settings.","error",-1)}})}a.data("alias-prompt")&&n>0?_wdtRenderConfirmModal("Reassign Aliases","There are currently "+n+" post(s) assigned as an alias to this post. If you assign this post as an alias to another post, this post's aliases will also be reassigned. Proceed?",i,void 0,"Proceed","wdt-portal-modal-alt"):i()})),t(".wdt-employer-job-board-locations").length&&J(),t(document).on("click",'[data-action="employer-cams-sync"]',(function(){var e=t("#employer-cams-sync-template").clone(!0);t('[data-target="wdt-portal-dropdown-menu"]').hide(),_wdtRenderContentModal("CaMS Lookup",e.html(),"wdt-portal-modal","employer-cams-sync-modal")})),t(document).on("input",'#wdt-employer-cams-lookup-container [name="cams-reference-number"]',(function(){t(this).closest(".wdt-material-form-search-label").toggleClass("wdt-form-input-progress",""!==t(this).val().trim())})),t(document).on("keydown",'#wdt-employer-cams-lookup-container [name="cams-reference-number"]',(function(e){"Enter"===e.key&&(e.preventDefault(),t(this).closest("#wdt-employer-cams-lookup-container").find('[data-action="employer-cams-sync-search"]').trigger("click"))})),t(document).on("click",'[data-action="employer-cams-sync-search"]',(function(){let e=t(this).closest("#wdt-employer-cams-lookup-container"),a=e.find('[name="cams-reference-number"]').val().trim(),o=e.find('[name="employer-cams-lookup-nonce"]').val();a?t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/cams/employer-lookup/",data:{employerReferenceNumber:a,nonce:o},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce);let a=e.find('template[data-target="spinner"]').clone(!0).html();e.find('[data-target="employer-cams-lookup-results"]').empty().append(a)}
1,success:function(o){if(e.find('[data-target="employer-cams-lookup-results"]').empty(),o.success&&o.employer_data){let a=o.employer_data.name||"",r=t(e.find('template[data-target="result"]').clone(!0).html());r.find('[data-target="employer-title"]').text(o.employer_data.ref_number+(a?" - "+a:"")),r.find('[data-target="select-employer"]').attr("data-cams-reference",o.employer_data.ref_number),r.find('[data-target="select-employer"]').attr("data-cams-name",a),e.find('[data-target="employer-cams-lookup-results"]').append(r)}else{let o=t(e.find('template[data-target="no-results"]').clone(!0).html());o.find('[data-target="employer-cams-lookup-ref"]').text(a),e.find('[data-target="employer-cams-lookup-results"]').append(o)}},error:function(){e.find('[data-target="employer-cams-lookup-results"]').empty(),wdtDisplayNotification("Error looking up employer reference.","error",-1)}}):wdtDisplayNotification("Please enter a CaMS reference number.","error",-1)})),t(document).on("click",'[data-action="employer-cams-lookup-select"]',(function(){let e=t(this).attr("data-cams-reference"),a=t(this).attr("data-cams-name")||"",o=t(".wdt-employer-profile-header"),r=o.attr("data-trading-name")||o.attr("data-employer-name")||"",n=t(t("#employer-cams-sync-confirm-template").clone(!0).html());n.find('[data-target="employer-cams-confirm-name"]').text(r||e),n.find('[data-target="employer-cams-confirm-ref"]').text(e+(a?" - "+a:"")),n.find('[data-action="employer-cams-sync-proceed"]').attr("data-cams-reference",e),_wdtRenderContentModal("Are you sure you want to link CaMS cases?",n.prop("outerHTML"),"wdt-portal-modal","employer-cams-sync-confirm-modal")})),t(document).on("click",'[data-action="employer-cams-sync-proceed"]',(function(){var e=t(this),a=e.data("employer-id"),o=e.data("nonce"),r=e.attr("data-cams-reference");r?(e.prop("disabled",!0),t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/cams/employer-link",data:{employerId:a,camsReferenceNumber:r,nonce:o},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("CaMS Service Plan Cases have been linked.","success",3e3),wdtForceRemoveContentModal(),setTimeout((function(){location.reload()}),2e3)):(wdtDisplayNotification(t.message||"Could not link CaMS cases.","error",-1),wdtForceRemoveContentModal())},error:function(t){var e=t&&t.responseJSON&&t.responseJSON.message||"Could not link CaMS cases.";wdtDisplayNotification(e,"error",-1),wdtForceRemoveContentModal()},complete:function(){e.prop("disabled",!1)}})):wdtDisplayNotification("Please enter a CaMS reference number.","error",-1)})),t(document).on("click",'[data-action="employer-cams-stop-sync"]',(function(){var e=t("#employer-cams-stop-sync-template").clone(!0);t('[data-target="wdt-portal-dropdown-menu"]').hide(),_wdtRenderContentModal("Stop Linking CaMS Cases",e.html(),"wdt-portal-modal-alt","employer-cams-stop-sync-modal")})),t(document).on("click",'[data-action="employer-cams-stop-sync-confirm"]',(function(){var e=t(this),a=e.data("employer-id"),o=e.data("nonce");e.prop("disabled",!0),t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/cams/employer-unlink",data:{employerId:a,nonce:o},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?wdtDisplayNotification("CaMS cases unlinked.","success",3e3):wdtDisplayNotification(t.message||"Could not stop linking CaMS cases.","error",-1)},error:function(){wdtDisplayNotification("Could not stop linking CaMS cases.","error",-1)},complete:function(){wdtForceRemoveContentModal(),setTimeout((function(){location.reload()}),2e3)}})})),t(document).on("click",'[data-action="employer-open-archive-modal"]',(function(){let e=t("#employer-archive-template").clone(!0);t('[data-target="wdt-portal-dropdown-menu"]').hide(),_wdtRenderContentModal("Archive Employer",e.html(),"wdt-portal-modal-alt","employer-archive-modal")})),t(document).on("click",'[data-action="employer-open-unarchive-modal"]',(function(){let e=t("#employer-unarchive-template").clone(!0);t('[data-target="wdt-portal-dropdown-menu"]').hide(),_wdtRenderContentModal("Unarchive Employer",e.html(),"wdt-portal-modal-alt","employer-unarchive-modal")})),t(document).on("click",'[data-action="employer-archive-confirm"]',(function(){let e=t(this),a=t(".wdt-employer-profile-header").data("employer-id");e.prop("disabled",!0),t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/employer-profiles/archive",data:{employerId:a},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Employer archived successfully.","success",3e3),wdtForceRemoveContentModal(),setTimeout((function(){location.reload()}),2e3)):(wdtDisplayNotification(t.message||"Could not archive employer.","error",-1),e.prop("disabled",!1))},error:function(){wdtDisplayNotification("Could not archive employer.","error",-1),e.prop("disabled",!1)}})})),t(document).on("click",'[data-action="employer-unarchive-confirm"]',(function(){let e=t(this),a=t(".wdt-employer-profile-header").data("employer-id");e.prop("disabled",!0),t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/employer-profiles/unarchive",data:{employerId:a},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(wdtDisplayNotification("Employer unarchived successfully.","success",3e3),wdtForceRemoveContentModal(),setTimeout((function(){location.reload()}),2e3)):(wdtDisplayNotification(t.message||"Could not unarchive employer.","error",-1),e.prop("disabled",!1))},error:function(){wdtDisplayNotification("Could not unarchive employer.","error",-1),e.prop("disabled",!1)}})})),t(document).on("click",'[data-action="employer-open-safety-flags-modal"]',(function(){let e=t("#employer-safety-flags-template").clone(!0),a=1===t(".wdt-employer-profile-header").data("has-safety-flags")?"Edit Safety Flag":"Add Safety Flag";t('[data-target="wdt-portal-dropdown-menu"]').hide(),_wdtRenderContentModal(a,e.html(),"wdt-portal-modal-alt","employer-safety-flags-modal")})),t(document).on("submit","#wdt-employer-safety-flags-form",(function(e){e.preventDefault();let a=t(this),o=a.find('[name="employerId"]').val(),r=a.find('[name="safety_flags[]"]:checked').map((function(){return t(this).val()})).get(),n=a.find('[name="custom_safety_flag"]').val()||"",i=a.find('[type="submit"]');i.prop("disabled",!0),t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/employer-profiles/safety-flags",data:{employerId:o,safetyFlags:r,customSafetyFlag:n},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){i.prop("disabled",!1),t.success?(wdtDisplayNotification("Safety flags saved.","success",3e3),wdtForceRemoveContentModal(),setTimeout((function(){location.reload()}),1500)):wdtDisplayNotification("Could not save safety flags.","error",-1)},error:function(){i.prop("disabled",!1),wdtDisplayNotification("Could not save safety flags.","error",-1)}})}));var G=!1;(t(document).on("click",'[data-action="service-plan-cases-refresh"]',(function(){var e=t(this),a=e.data("cams-nonce"),o=e.data("employer-id");a&&o?t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/employer-service-plan-cases/refresh",data:{employerId:o,nonce:a},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),e.prop("disabled",!0).text("Refreshing...")},success:function(t){wdtDisplayNotification("Successfully updated CaMS data. Please refresh the page.","success"),e.text("Refreshed")},error:function(){wdtDisplayNotification("Error updating CaMS data.","error",-1),e.prop("disabled",!1).text("Refresh")}}):(G=!1,t("#wdt-employer-service-plan-cases-archive-table").trigger("wdt:refresh"))})),t(document).on("wdt:populateTable","#wdt-employer-service-plan-cases-archive-table",(function(e){e.stopPropagation();var a=this,o=t(this).attr("data-sort"),r=t(a).data("currentPage")||1,n=t('.wdt-employer-service-plan-cases [data-archive-table] [name="perPage"]').val()||null,i=t('.wdt-employer-service-plan-cases [data-archive-table] [name="search"]').val()||null,d=t(".wdt-employer-service-plan-cases"),l=d.data("employer-id"),c=t('[data-target="service-plan-cases-filter-form"]'),p={employerId:l,page:r};if(n&&(p.perPage=n),o&&(p.sort=o),i&&(p.search=i),G&&c.length){var u=wdtSerializeMaterialForm(c);u.owner&&u.owner[0]&&u.owner[0].value&&(p.owner=u.owner[0].value);var f=(u["serviceDeliverySite[]"]||[]).map((function(t){return t.value}
1)).filter(Boolean);f.length&&(p["serviceDeliverySite[]"]=f);var g=(u["clientReference[]"]||[]).map((function(t){return t.value})).filter(Boolean);g.length&&(p["clientReference[]"]=g);var m=(u["status[]"]||[]).map((function(t){return t.value})).filter(Boolean);m.length&&(p["status[]"]=m)}else{var w=new URL(window.location),h=w.searchParams.get("owner");h&&(p.owner=h);var b=w.searchParams.getAll("serviceDeliverySite[]");b.length&&(p["serviceDeliverySite[]"]=b);var y=w.searchParams.getAll("clientReference[]");if(y.length&&(p["clientReference[]"]=y),c.length){var v=(wdtSerializeMaterialForm(c)["status[]"]||[]).map((function(t){return t.value})).filter(Boolean);v.length&&(p["status[]"]=v)}}t.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/employer-service-plan-cases",data:p,traditional:!1,beforeSend:function(e){e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(a).trigger("wdt:loadState")},success:function(e){if(e.success){!1!==e.hasCamsSync?(d.find('[data-target="service-plan-cases-last-sync"]').text("Last CaMS data sync: "+(e.lastCamsSync||"—")),d.find('[data-target="service-plan-cases-last-change"]').text("Last detected change: "+(e.lastDetectedChange||"—")),d.find(".wdt-employer-service-plan-cases-meta").show()):d.find(".wdt-employer-service-plan-cases-meta").hide(),function(e){var a=t('[data-target="service-plan-cases-filter-form"]');if(a.length){var o=e&&e.availableOwners?e.availableOwners:[],r=e&&e.availableSites?e.availableSites:[],n=e&&e.availableClients?e.availableClients:[];!function(e,o,r,n){var i=a.find('[name="'+e+'"][data-field-type="combobox"]');if(i.length){var s=i.closest('[data-target="wdt-form-select-combobox-container"]').find('[data-target="wdt-form-select-listbox"]');s.find('[data-action="wdt-form-select-listbox-item"]:not(:first)').remove(),t.each(o,(function(e,a){s.append(t("<div>").attr("role","option").attr("data-action","wdt-form-select-listbox-item").attr("data-target","wdt-form-select-listbox-item").attr("data-label",n(a)).attr("title",n(a)).attr("value",r(a)).attr("data-selected","false").attr("aria-selected","false").addClass("wdt-form-select-option").text(n(a)))}))}}("owner",o,(function(t){return t}),(function(t){return t}));var i=a.find('[name="serviceDeliverySite[]"]');if(i.length){var s=i.closest('[data-typeahead-target="wdt-ajax-select-container"]').find(".wdt-ajax-local-options");s.length&&(s.empty(),t.each(r,(function(e,a){s.append(t("<li>").attr("aria-selected","false").attr("role","option").addClass("wdt-ajax-select-search-results-result").attr("data-depth","0").attr("data-value",a).text(a))})))}var d=a.find('[name="clientReference[]"]');if(d.length){var l=d.closest('[data-typeahead-target="wdt-ajax-select-container"]').find(".wdt-ajax-local-options");l.length&&(l.empty(),t.each(n,(function(e,a){l.append(t("<li>").attr("aria-selected","false").attr("role","option").addClass("wdt-ajax-select-search-results-result").attr("data-depth","0").attr("data-value",a.ref).text(a.name))})))}}}(e),G||(G=!0,function(){var e=t('[data-target="service-plan-cases-filter-form"]');if(e.length){var a=new URL(window.location);0;var o=a.searchParams.get("owner");if(o){var r=t.Event("wdt:select");r.label=o,r.value=o,e.find('[name="owner"]').trigger(r)}a.searchParams.getAll("serviceDeliverySite[]").forEach((function(a){var o=t.Event("wdt:select");o.label=a,o.value=a,e.find('[name="serviceDeliverySite[]"]').trigger(o)})),a.searchParams.getAll("clientReference[]").forEach((function(a){var o=e.find('[name="clientReference[]"]'),r=o.closest('[data-typeahead-target="wdt-ajax-select-container"]').find('.wdt-ajax-local-options li[data-value="'+a+'"]'),n=r.length?r.text():a,i=t.Event("wdt:select");i.label=n,i.value=a,o.trigger(i)})),t("#wdt-employer-service-plan-cases-archive-table").trigger("wdt:refreshFilterButtons")}}());var o=e.total||0,r=e.perPage||25,n=Math.max(1,Math.ceil(o/r)),l=t.Event("wdt:updatePageDisplay");l.page=e.page||1,l.maxPage=n,t(a).trigger(l),s(a,".wdt-employer-service-plan-cases",e.page||1,n);var c=e.cases||[];if(t(a).find("tbody").empty(),c.length>0&&function(e,a){if(a&&0!==a.length){var o="";t.each(a,(function(e,a){var r=a.clientName||a.clientReference?t("<div>
1").text(a.clientName||a.clientReference).html():'<span class="wdt-employer-profile-empty-value">—</span>',n=a.clientUserId?'<a href="?wdt-page=client&wdt-client='+a.clientUserId+'" class="wdt-employer-service-plan-cases-td-client-name" target="_blank">'+r+"</a>":'<span class="wdt-employer-service-plan-cases-td-client-name">'+r+"</span>",i=t("<div>").text(a.eapReference||"").html(),s=n+((i?'<span class="wdt-employer-service-plan-cases-td-client-ref">'+i+"</span>":"")||""),d=a.startDate?a.startDate.split("T")[0]:'<span class="wdt-employer-profile-empty-value">—</span>',l=a.erfsTotal>0?"$"+parseFloat(a.erfsTotal).toLocaleString("en-CA",{minimumFractionDigits:2,maximumFractionDigits:2}):'<span class="wdt-employer-profile-empty-value">—</span>',c=a.isActive?"wdt-employer-service-plan-cases-chip-active":"wdt-employer-service-plan-cases-chip-closed",p=a.isActive?"Active":"Closed";o+="<tr>",o+="<td>"+s+"</td>",o+="<td>"+(a.serviceDeliverySite?t("<div>").text(a.serviceDeliverySite).html():'<span class="wdt-employer-profile-empty-value">—</span>')+"</td>",o+="<td>"+d+"</td>",o+="<td>"+(a.ownerName?t("<div>").text(a.ownerName).html():'<span class="wdt-employer-profile-empty-value">—</span>')+"</td>",o+='<td class="wdt-employer-service-plan-cases-td-erfs">'+l+"</td>",o+="<td>"+(a.outcome?t("<div>").text(a.outcome).html():'<span class="wdt-employer-profile-empty-value">—</span>')+"</td>",o+='<td><span class="wdt-employer-service-plan-cases-chip '+c+'">'+p+"</span></td>",o+="</tr>"})),e.html(o)}else e.empty()}(t(a).find("tbody"),c),o>0){var p=1===o?"service plan case":"service plan cases";t('.wdt-employer-service-plan-cases [data-target="result-count-container"]').html('<strong data-target="result-count">'+o+"</strong> "+p).show()}else(i||t('.wdt-employer-service-plan-cases [data-target="wdt-archive-table-filters"]').is(":visible"))&&t('.wdt-employer-service-plan-cases [data-target="no-matches-found"]').show()}else t(a).find("tbody").empty()},error:function(e,o){"abort"!==o&&t(a).find("tbody").empty()},complete:function(){t(a).trigger("wdt:unloadState")}})})),t(".wdt-employer-service-plan-cases").length)&&("none"!==t(".wdt-employer-service-plan-cases").closest(".wdt-employer-profile-tab-panel").css("display")&&initializeArchiveTable(t(".wdt-employer-service-plan-cases [data-archive-table]").get(0)));function J(){var e=t(".wdt-employer-job-board-locations"),a=e.data("employer-id"),o=e.find('[data-target="job-board-locations-spinner-wrap"]'),r=e.find('[data-target="job-board-locations-list"]'),n=e.find('[data-target="job-board-locations-empty"]'),i=e.siblings(".wdt-employer-job-board-locations-footer");function s(e,a,o){var r=!(isNaN(a)||isNaN(o)||0===a&&0===o),n=r?a.toFixed(3)+", "+o.toFixed(3):"";e.data("lat",r?a:"").data("lng",r?o:""),e.find(".wdt-employer-job-board-locations-row-coords span").last().html(r?t("<div>").text(n).html():'<span class="wdt-employer-profile-empty-value">—</span>');var i=e.find(".wdt-employer-job-board-locations-map");if(i.removeData("map-ready").empty(),r){if(i.attr("data-lat",a).attr("data-lng",o).attr("data-has-pin","1"),window.google&&window.google.maps){var s={lat:a,lng:o},d=new google.maps.Map(i[0],{center:s,zoom:15,disableDefaultUI:!0,gestureHandling:"none",clickableIcons:!1});i.data("map-instance",d),google.maps.event.addListenerOnce(d,"idle",(function(){new google.maps.Marker({position:s,map:d})}))}}else i.removeAttr("data-lat").removeAttr("data-lng").removeAttr("data-has-pin"),i.html('<span class="wdt-job-location-no-coords">No coordinates set</span>')}o.show(),t(document).on("click.jl-menu",(function(a){t(a.target).closest(".job-location-action, .job-location-menu").length||e.find(".job-location-menu").remove()})),e.on("click",".job-location-action",(function(a){a.stopPropagation();var o=t(this).closest(".wdt-employer-job-board-locations-row-actions");e.find(".job-location-menu").not(o.find(".job-location-menu")).remove();var r=o.find(".job-location-menu");r.length?r.remove():o.append('<div class="job-location-menu"><button type="button" class="job-location-menu-item" data-action="edit-coordinates" data-testid="employer-job-location-edit-coords-btn">Edit coordinates</button><button type="button" class="job-location-menu-item" data-action="auto-locate" data-testid="employer-job-location-auto-locate-btn">Auto-locate</button></div>')})),e.on("click",'[data-action="edit-coordinates"]',(function(){var e=t(this).closest(".wdt-job-location-item");e.find(".job-location-menu").remove();var o=e.data("loc-id");t.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/employer-locations/coordinates-form",data:{employerId:a,id:o},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(r){wdtRenderContentModal({title:"Edit Map Coordinates",content:r,className:"wdt-portal-modal-alt",id:"employer-map-coordinates-modal"});var n=t('#employer-map-coordinates-modal [data-target="employer-coordinates-form"]');n.trigger("wdt:initializeForm");var i=n.find('[data-target="employer-coordinates-save"]');n.on("click",'[data-action="employer-coordinates-cancel"]',(function(){wdtForceRemoveContentModal()})),n.on("submit",(function(r){r.preventDefault();var d=n.find('[name="lat"]').val(),l=n.find('[name="lng"]').val();i.prop("disabled",!0),t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/employer-locations/update-coordinates",data:{employerId:a,id:o,lat:d,lng:l},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){i.prop("disabled",!1),t.success?(s(e,parseFloat(t.lat),parseFloat(t.lng)),wdtForceRemoveContentModal(),wdtDisplayNotification("Coordinates updated.","success",3e3)):wdtDisplayNotification(t.message||"Failed to update coordinates.","error",-1)},error:function(){i.prop("disabled",!1),wdtDisplayNotification("Failed to update coordinates. Please try again.","error",-1)}})}))},error:function(){wdtDisplayNotification("Could not load coordinates form.","error",-1)}})})),e.on("click",'[data-action="auto-locate"]',(function(){var e=t(this).closest(".wdt-job-location-item");e.find(".job-location-menu").remove();var o=e.data("loc-id");t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/employer-locations/auto-locate",data:{employerId:a,id:o},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(s(e,parseFloat(t.lat),parseFloat(t.lng)),wdtDisplayNotification("Coordinates updated.","success",3e3)):wdtDisplayNotification(t.message||"Could not auto-locate the location.","error",-1)},error:function(){wdtDisplayNotification("Could not auto-locate the location.","error",-1)}})})),t.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/employer-locations",data:{employerId:a,includeArchived:0},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(o.hide(),e.success&&e.locations&&e.locations.length){var a="";t.each(e.locations,(function(e,o){var r=o.address||"",n=[o.province,o.postalCode].filter(
1Boolean).join(" "),i=[];o.city&&i.push(o.city),n&&i.push(n);var s=i.join(", "),d=parseFloat(o.lat),l=parseFloat(o.lng),c=!(isNaN(d)||isNaN(l)||0===d&&0===l),p=c?d.toFixed(3)+", "+l.toFixed(3):"";a+='<div class="wdt-job-location-item" data-testid="employer-job-location-item" data-loc-id="'+o.id+'" data-lat="'+(o.lat||"")+'" data-lng="'+(o.lng||"")+'" data-address="'+t("<div>").text(o.address||"").html()+'" data-city="'+t("<div>").text(o.city||"").html()+'" data-province="'+t("<div>").text(o.province||"").html()+'" data-postal="'+t("<div>").text(o.postalCode||"").html()+'">',a+='<div class="wdt-employer-job-board-locations-row">',a+='<div class="wdt-employer-job-board-locations-row-info">',a+='<strong class="wdt-employer-job-board-locations-row-name">'+t("<div>").text(o.name).html()+"</strong>",(r||s)&&(a+='<span class="wdt-employer-job-board-locations-row-address">',r&&(a+=t("<div>").text(r).html()),r&&s&&(a+="<br>"),s&&(a+=t("<div>").text(s).html()),a+="</span>"),a+="</div>",a+='<div class="wdt-employer-job-board-locations-row-coords">',a+="<strong>Coordinates</strong>",a+="<span>"+(c?t("<div>").text(p).html():'<span class="wdt-employer-profile-empty-value">—</span>')+"</span>",a+="</div>",a+='<div class="wdt-employer-job-board-locations-map-wrap">',a+=c?'<div class="wdt-employer-job-board-locations-map" data-lat="'+d+'" data-lng="'+l+'" data-has-pin="1"></div>':'<div class="wdt-employer-job-board-locations-map"><span class="wdt-job-location-no-coords">No coordinates set</span></div>',a+='<div class="wdt-employer-job-board-locations-row-actions">',a+='<button type="button" class="job-location-action" data-testid="employer-job-location-actions-btn" title="Edit coordinates" aria-label="Edit coordinates">',a+="<span></span>",a+="<span></span>",a+="<span></span>",a+="</button>",a+="</div>",a+="</div>",a+="</div>",a+="</div>"})),r.html(a).show(),window.google&&window.google.maps&&wdtInitJobBoardMaps()}else n.show(),i.find('[data-target="job-board-view-locations-link"]').hide(),i.find('[data-target="job-board-goto-locations-link"]').show()},error:function(){o.hide(),n.show(),i.find('[data-target="job-board-view-locations-link"]').hide(),i.find('[data-target="job-board-goto-locations-link"]').show()}})}})),jQuery(document).ready((function(t){function e(){t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/help/notificationBar/shoo",data:{},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){},error:function(t){}})}t('button[data-action="wdt-help-section-video-play"]').on("click",(function(e){let a=t(this).attr("data-video-url"),o=t(this).attr("data-title"),r=t(this).attr("data-thumbnail-url"),n=new WDTVideo(o,a,r),i=t(this).attr("data-module"),s=wdtCreateEmptyVideoFrame();(async function(t){let e=WDT.rest_url+"wedatatools/v1/help/videos/module?module="+t,a=await fetch(e);try{let t=await a.json();return t.success&&t.data?t.data:{}}catch(t){return{}}})(i).then((function(t){let e=[];for(let a of t)e.push(new WDTVideo(a.title,a.url,a.thumbnailURL));s.playVideo(n,e)}))})),t('button[data-action="wdt-help-section-open-article"]').on("click",(function(e){let a=t(this).attr("data-title"),o=t(this).next(".wdt-help-section-articles-article");if(o.length){o.clone().removeClass("nodisplay"),_wdtRenderContentModal(a,o.html())}})),t(document).on("wdt:noticeBarClosed","#wdt-help-resource-notification-bar",(function(t){e()})),t(document).on("click",'#wdt-help-resource-notification-bar [data-action="wdt-help-section-video-play"]',(function(t){e()}))})),jQuery(document).ready((function(t){const e={markers:null,userLocationMarker:null,directionsDisplay:null,pointLayers:null,pathLayers:null},a="wdt-job-map-jobs",o="wdt-job-map-directions",r={jobPoints:"wdt-job-map-job-points",jobClusters:"wdt-job-map-job-clusters",jobClusterCount:"wdt-job-map-job-cluster-count",directions:"wdt-job-map-directions-line"},n="wdt-job-map-marker-default",i="wdt-job-map-cluster-marker";var s,d,l=[];function c(t,a,o){jQuery(".wemap2-sidebar-toggle-markers").find(".wemap2-sidebar-spinner").show();var r=new URLSearchParams(window.location.search),n=r.get("job-nocs")?r.get("job-nocs"):"",i=r.get("job-naics")?r.get("job-naics"):"",s=[],d=[];n&&(s=n.split(",")),i&&(d=i.split(","));let l={logged_in:wemap.is_admin};a&&(l.search=a),s.length&&(l.nocs=s),d.length&&(l.naics=d),jQuery.ajax({url:"/wp-json/wedatatools/v1/get-jobs-geojson",method:"get",data:l,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(a){var r=a.data;e.markers=r.features.map((function(t,e){t.properties._wdtIndex=e;var a='<div class="map-infowindow" id="wdt-job-map-job-infowindow" data-job-id="'+t.properties.post_id+'" data-job-title="'+t.properties.job_title+'" data-employer-name="'+t.properties.employer+'">';a+="<h5>"+t.properties.job_title+"</h5>",a+='<div class="infowindow-section"><div class="infowindow-section-icon"><i class="fa fa-fw fa-briefcase" aria-hidden="true"></i></div><div class="infowindow-section-content">',wemap.display_job_map_companies&&!t.properties.hide_employer?a+='<a href="'+j(t.properties.employer_id)+'" target="_blank">'+t.properties.employer+"</a>
1":t.properties.hide_employer||(a+="<span>"+t.properties.employer+"</span>"),wemap.is_admin&&wemap.display_job_map_companies&&!t.properties.hide_employer&&(a+=' ⋅ <a class="" href="'+C(t.properties.employer_id,"employer")+'" target="_blank" rel="nofollow" >Edit</a>'),a+="</div></div>",null!=t.properties.salary&&"N/A"!=t.properties.salary&&(a+='<div class="infowindow-section"><div class="infowindow-section-icon"><i class="fa fa-fw fa-usd" aria-hidden="true"></i></div><div class="infowindow-section-content">'+_(t.properties.salary,"$")+"</div></div>"),null!=t.properties.education&&"N/A"!=t.properties.education&&(a+='<div class="infowindow-section"><div class="infowindow-section-icon"><i class="fa fa-fw fa-graduation-cap" aria-hidden="true"></i></div><div class="infowindow-section-content">'+t.properties.education+"</div></div>"),"N/A"!=t.properties.excerpt&&(a+='<div class="infowindow-section"><div class="infowindow-section-content">'+t.properties.excerpt);let o="Job Post Suggestion: "+t.properties.job_title,r="I wanted to share this job posting with you that I found on "+wemap.site_title+": ";if(t.properties.url)r+=t.properties.url;else if(t.properties.email){let e=new URL(wemap.job_url);e.searchParams.set("wdt-job",t.properties.post_id),r+=e.href}o=o.split(" ").map((t=>encodeURIComponent(t))).join(" "),r=r.split(" ").map((t=>encodeURIComponent(t))).join(" ");let n=t.properties.url;if(!n&&t.properties.email&&(n="mailto:"+t.properties.email+"?subject=Applying for: "+t.properties.job_title+"(ID: "+t.properties.post_id+")"),n&&(""!=t.properties.excerpt&&(a+=" &nbsp; "),a+='<br><a class="job-posting" data-post-id="'+t.properties.post_id+'" href="'+n+'" target="_blank" rel="nofollow">Go to Job Post</a>',a+=' ⋅ <a class="job-posting" href="mailto:?subject='+o+"&body="+r+'">Share</a>',wemap.is_admin&&(a+=' ⋅ <a class="job-posting" href="'+C(t.properties.post_id,"job")+'" target="_blank" rel="nofollow">Edit</a>')),wemap.logged_in&&wemap.hasOwnProperty("follow_nonce")&&t.properties.hasOwnProperty("user_saved")&&t.properties.hasOwnProperty("job_slug")){let e="Save Job Post",o="wdt-follow-job-post";"1"===t.properties.user_saved&&(e="Unsave Job Post",o="wdt-unfollow-job-post"),a+=`\n\t\t\t\t\t\t\t<div data-target="btns" class="wdt-job-map-job-infowindow-btns">\n                            <button\n\t\t\t\t\t\t\t\tclass="save-job-button"\n                                type="button"\n                                data-nonce="${wemap.follow_nonce}"\n                                data-target="wdt-follow-job-post-btn"\n                                data-action="${o}"\n                                data-object-slug="${t.properties.job_slug}"\n                            >\n                                ${e}\n                            </button>\n\t\t\t\t\t\t\t</div>`}else a+=`\n\t\t\t\t\t\t\t<div data-target="btns" class="wdt-job-map-job-infowindow-btns">\n                            <a\n                                class="save-job-button"\n                                href="${WDT.portal_url}?wdt-page=register"\n                            >\n                                Save Job Post\n                            </a>\n\t\t\t\t\t\t\t</div>`;return a+="</div></div>",a+='<div class="infowindow-section"><div class="infowindow-section-content">',a+='<span style="color: #666;">Directions:</span> <a class="get-directions" data-mode="walking" data-lat="'+t.geometry.coordinates[1]+'" data-long="'+t.geometry.coordinates[0]+'" href="#">Walk</a> ⋅ <a class="get-directions" data-mode="transit" data-lat="'+t.geometry.coordinates[1]+'" data-long="'+t.geometry.coordinates[0]+'" href="#">Public Transit</a> ⋅ <a class="get-directions" data-mode="driving" data-lat="'+t.geometry.coordinates[1]+'" data-long="'+t.geometry.coordinates[0]+'" href="#">Drive</a></div>',{feature:t,popupHTML:a+="</div></div>"}})),jQuery("#wemap-reset").unbind("click"),jQuery("#wemap-reset").on("click",(function(e){e.preventDefault(),jQuery("#wemap-filter-job-tag").val("all"),T("job-tag"),jQuery("#wemap-filter-benefits").val("all"),T("benefits"),jQuery("#wemap-filter-education").val("all"),T("education"),jQuery("#wemap-filter-sectors").val("all"),T("sector"),jQuery("#wemap-filter-teer").val("all"),T("teer"),jQuery("#wemap-filter-type").val("all"),T("type"),jQuery("#wemap-filter-duration").val("all"),T("duration"),jQuery("#wemap-filter-language").val("all"),T("language"),jQuery("#wemap-filter-experience").val("all"),T("experience");let a=jQuery("#wemap-search").val();jQuery("#wemap-search").val(""),T("search"),""!=a&&c(t,"",o),p(t,o)})),jQuery("#wemap-filter-type").unbind("change"),jQuery("#wemap-filter-type").on("change",(function(e){(D("type",jQuery(this).val()),p(t,o),"function"==typeof trackResearchEvent&&trackResearchEvent("wemap-jobs|filter-by-job-type|"+jQuery(this).val()),"function"==typeof wdt_event_cap)&&wdt_event_cap({t:"Jobs Map",ac:"Filter by Job Type",e:"",d:jQuery("#wemap-filter-type option:selected").attr("data-label"),na:""})})),jQuery("#wemap-filter-duration").unbind("change"),jQuery("#wemap-filter-duration").on("change",(function(e){(D("duration",jQuery(this).val()),p(t,o),"function"==typeof trackResearchEvent&&trackResearchEvent("wemap-jobs|filter-by-job-duration|"+jQuery(this).val()),"function"==typeof wdt_event_cap)&&wdt_event_cap({t:"Jobs Map",ac:"Filter by Job Duration",e:"",d:jQuery("#wemap-filter-duration option:selected").attr("data-label"),na:""})})),jQuery("#wemap-filter-teer").unbind("change"),jQuery("#wemap-filter-teer").on("change",(function(e){(D("teer",jQuery(this).val()),p(t,o),"function"==typeof trackResearchEvent&&trackResearchEvent("wemap-jobs|filter-by-teer-level|"+jQuery(this).val()),"function"==typeof wdt_event_cap)&&wdt_event_cap({t:"Jobs Map",ac:"Filter by Job Teer",e:"",d:jQuery("#wemap-filter-teer option:selected").attr("data-label"),na:""})})),jQuery("#wemap-filter-sectors").unbind("change"),jQuery("#wemap-filter-sectors").on("change",(function(e){(D("sector",jQuery(this).val()),p(t,o),"function"==typeof trackResearchEvent&&trackResearchEvent("wemap-jobs|filter-by-skill-type|"+jQuery(this).val()),"function"==typeof wdt_event_cap)&&wdt_event_cap({t:"Jobs Map",ac:"Filter by Skill Type",e:"",d:jQuery("#wemap-filter-sectors option:selected").attr("data-label"),na:""})})),jQuery("#wemap-filter-language").unbind("change"),jQuery("#wemap-filter-language").on("change",(function(e){(D("language",jQuery(this).val()),p(t,o),"function"==typeof trackResearchEvent&&trackResearchEvent("wemap-jobs|filter-by-language|"+jQuery(this).val()),"function"==typeof wdt_event_cap)&&wdt_event_cap({t:"Jobs Map",ac:"Filter by Language",e:"",d:jQuery("#wemap-filter-language option:selected").attr("data-label"),na:""})})),jQuery("#wemap-filter-experience").unbind("change"),jQuery("#wemap-filter-experience").on("change",(function(e){(D("experience",jQuery(this).val()),p(t,o),"function"==typeof trackResearchEvent&&trackResearchEvent("wemap-jobs|filter-by-experience|"+jQuery(this).val()),"function"==typeof wdt_event_cap)&&wdt_event_cap({t:"Jobs Map",ac:"Filter by Experience",e:"",d:jQuery("#wemap-filter-experience option:selected").attr("data-label"),na:""})})),jQuery("#wemap-filter-job-tag").unbind("change"),jQuery("#wemap-filter-job-tag").on("change",(function(e){(D("job-tag",jQuery(this).val()),p(t,o),"function"==typeof trackResearchEvent&&trackResearchEvent("wemap-jobs|filter-by-job-tag|"+jQuery(this).val()),"function"==typeof wdt_event_cap)&&wdt_event_cap({t:"Jobs Map",ac:"Filter by Job Tag",e:"",d:jQuery("#wemap-filter-job-tag option:selected").attr("data-label"),na:""})})),jQuery("#wemap-filter-education").unbind("change"),jQuery("#wemap-filter-education").on("change",(function(e){(D("education",jQuery(this).val()),p(t,o),"function"==typeof trackResearchEvent&&trackResearchEvent("wemap-jobs|filter-by-job-tag|"+jQuery(this).val()),"function"==typeof wdt_event_cap)&&wdt_event_cap({t:"Jobs Map",ac:"Filter by Job Tag",e:"",d:jQuery("#wemap-filter-education option:selected").attr("data-label"),na:""})})),jQuery("#wemap-filter-benefits").unbind("change"),jQuery("#wemap-filter-benefits").on("change",(function(e){(D("job-tag",jQuery(this).val()),p(t,o),"function"==typeof trackResearchEvent&&trackResearchEvent("wemap-jobs|filter-by-job-tag|"+jQuery(this).val()),"function"==typeof wdt_event_cap)&&wdt_event_cap({t:"Jobs Map",ac:"Filter by Job Tag",e:"",d:jQuery("#wemap-filter-benefits option:selected").attr("data-label"),na:""})})),jQuery("#wemap-search").unbind("change"),jQuery("#wemap-search").on("change",(function(e){D("search",jQuery(this).val()),c(t,jQuery(this).val(),o);var a=jQuery(this).val();("function"==typeof trackResearchEvent&&trackResearchEvent("wemap-jobs|search|"+a),"function"==typeof wdt_event_cap)&&wdt_event_cap({t:"Jobs Map",ac:"Keyword Search",e:"",d:a,na:""})})),jQuery(".wemap2-sidebar-toggle-markers").find(".wemap2-sidebar-spinner").hide(),p(t,o)},error:function(t){console.log(t)}})}function p(t,a){if(a.remove(),e.markers){var o=[];
1e.markers.forEach((function(t){var e=!0,a=jQuery("#wemap-filter-teer").val();if("all"!=a)if(Array.isArray(t.feature.properties.nocs_2021))for(let o of t.feature.properties.nocs_2021){if(o.charAt(1)===a){e=!0;break}e=!1}else e=!1;var r=jQuery("#wemap-filter-type").val();"all"!=r&&t.feature.properties.type!=r&&(e=!1);var n=jQuery("#wemap-filter-duration").val();"all"!=n&&t.feature.properties.duration!=n&&(e=!1);var i=jQuery("#wemap-filter-experience").val();WDT.admin&&"all"!=i&&!isNaN(i)&&(!t.feature.properties.experience||isNaN(t.feature.properties.experience)?e=!1:(i=parseInt(i),targetExperience=parseInt(t.feature.properties.experience),((i<=0||i>=20)&&t.feature.properties.experience!=i||i>targetExperience)&&(e=!1)));var s=jQuery("#wemap-filter-language").val();"all"!=s&&(Array.isArray(t.feature.properties.languages)&&t.feature.properties.languages.includes(s)||(e=!1));var d=jQuery("#wemap-filter-education").val();WDT.admin&&"all"!=d&&(Array.isArray(t.feature.properties.job_tags)&&t.feature.properties.job_tags.includes(d)||(e=!1));var l=jQuery("#wemap-filter-benefits").val();WDT.admin&&"all"!=l&&(Array.isArray(t.feature.properties.job_tags)&&t.feature.properties.job_tags.includes(l)||(e=!1));var c=jQuery("#wemap-filter-job-tag").val();"all"!=c&&(Array.isArray(t.feature.properties.job_tags)&&t.feature.properties.job_tags.includes(c)||(e=!1));var p=jQuery("#wemap-filter-sectors").val();if("all"!=p){let a=!1;if(Array.isArray(t.feature.properties.nocs_2021))for(let e of t.feature.properties.nocs_2021)e[0]==p&&(a=!0);a||(e=!1)}e&&o.push(t.feature)})),u(o)}}function u(t){if(d){var e=d.getSource(a);e&&e.setData({type:"FeatureCollection",features:t})}}function f(t){d&&[r.jobClusters,r.jobPoints].forEach((function(e){d.getLayer(e)&&d.setLayoutProperty(e,"visibility",t?"visible":"none")}))}function g(t){if(!e.markers)return null;var a=t.properties._wdtIndex;return void 0===a?null:e.markers[a]}function m(t){t&&(t.visible=!0,t.layerIds.forEach((function(t){d.getLayer(t)&&d.setLayoutProperty(t,"visibility","visible")})))}function w(t){t&&(t.visible=!1,t.layerIds.forEach((function(t){d.getLayer(t)&&d.setLayoutProperty(t,"visibility","none")})))}function h(t){var e=[];return t&&Array.isArray(t.features)?e=t.features:t&&"Feature"==t.type&&(e=[t]),e.forEach((function(t,e){t.properties||(t.properties={}),t.properties._wdtIndex=e})),e}function b(t,e,a,o){if(d.hasImage(t))o();else{var r=new Image;r.onload=function(){d.hasImage(t)||d.addImage(t,r,{pixelRatio:r.naturalWidth/a}),o()},r.onerror=function(){console.log("Job map: unable to load marker image "+e),o()},r.src=e}}function y(t){l.push(t),d.on("mouseenter",t,(function(){d.getCanvas().style.cursor="pointer"})),d.on("mouseleave",t,(function(){d.getCanvas().style.cursor=""}))}function v(t){if(t){var e=function(t){var e=d.cameraForBounds(t,{padding:40});if(!e)return null;var a=function(t,e){var a=d.getContainer(),o=a.offsetWidth,r=a.offsetHeight;if(!o||!r)return null;var n=512*Math.pow(2,e),i=o/2/n,s=r/2/n,l=mapboxgl.MercatorCoordinate.fromLngLat(t),c=new mapboxgl.MercatorCoordinate(l.x-i,Math.min(l.y+s,1)).toLngLat(),p=new mapboxgl.MercatorCoordinate(l.x+i,Math.max(l.y-s,0)).toLngLat();return[[c.lng,c.lat],[p.lng,p.lat]]}(e.center,e.zoom);if(!a)return null;return[[Math.min(t[0][0],a[0][0]),Math.min(t[0][1],a[0][1])],[Math.max(t[1][0],a[1][0]),Math.max(t[1][1],a[1][1])]]}(t);e&&d.setMaxBounds(e)}}function _(t,e){return e+Number(t).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g,"$1,")}function k(t){jQuery("#wemap2-overlay").fadeIn("fast"),navigator.geolocation.getCurrentPosition((function(e){jQuery("#wemap2-overlay").fadeOut("fast"),t(e)}),(function(){jQuery("#wemap2-overlay").fadeOut("fast"),!0?alert("Geolocation failed."):alert("Geolocation is unsupported on your browser or device."),t(null)}))}function x(t,a,n,i,s){var d=function(t){switch(t){case"WALKING":return"walking";case"BICYCLING":case"CYCLING":return"cycling";case"DRIVING":return"driving";default:return null}}(a);if(d){var l=i.split(","),c=parseFloat(l[0]),p=parseFloat(l[1]);k((function(a){if(a){e.userLocationMarker.setLngLat([a.coords.longitude,a.coords.latitude]).addTo(t),e.directionsDisplay.origin=a.coords.latitude+","+a.coords.longitude,e.directionsDisplay.destination=i;var n="https://api.mapbox.com/directions/v5/mapbox/"+d+"/"+a.coords.longitude+","+a.coords.latitude+";"+p+","+c+"?geometries=geojson&overview=full&access_token="+mapboxgl.accessToken;jQuery.getJSON(n).done((function(e){if(e.routes&&e.routes.length){var a,n,i=e.routes[0],s=t.getSource(o);if(s)s.setData({type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:i.geometry}]}),t.getLayer(r.directions)&&t.moveLayer(r.directions),t.fitBounds((a=i.geometry,n=new mapboxgl.LngLatBounds,a.coordinates.forEac
1h((function(t){n.extend(t)})),n),{padding:60})}else window.alert("Directions are unavailable from your location.")})).fail((function(t){window.alert("Direction service failed: "+t.status)}))}}))}else window.open("https://www.google.com/maps/dir/?api=1&destination="+encodeURIComponent(i)+"&travelmode=transit","_blank")}function j(t){return wemap.employer_url+"?wdt-employer="+t}function C(t,e){if(!wemap.is_admin||!wemap.admin_url)return!1;let a="wdt-job",o="job-edit";return"employer"===e&&(a="wdt-employer",o="employer-profile"),wemap.admin_url+"?wdt-page="+o+"&"+a+"="+t}function D(t,e){let a=new URL(window.location);a.searchParams.set(t,e),a=N(a),history.replaceState({},"",a.toString())}function T(t){let e=new URL(window.location);e.searchParams.delete(t),e=N(e),history.replaceState({},"",e.toString())}function N(t){let e=[];t.searchParams.forEach((function(t,a,o){"all"!=t&&"toggle-job-markers"!=t||e.push(a)}));for(let a of e)t.searchParams.delete(a);return t}function S(t){var e=document.createElement("textarea");return e.innerHTML=t,e.value}jQuery("#wemap2").length&&function(){if("undefined"==typeof mapboxgl)return void console.log("Job map: mapbox-gl is unavailable.");if(!wemap.mapbox_key)return void console.log("Job map: no Mapbox access token configured.");mapboxgl.accessToken=wemap.mapbox_key;var k=function(){if(!mapConfig.bounds)return null;var t=parseFloat(mapConfig.bounds.long1),e=parseFloat(mapConfig.bounds.lat1),a=parseFloat(mapConfig.bounds.long2),o=parseFloat(mapConfig.bounds.lat2);if(isNaN(t)||isNaN(e)||isNaN(a)||isNaN(o))return null;return[[Math.min(t,a),Math.min(e,o)],[Math.max(t,a),Math.max(e,o)]]}(),D=[mapConfig.center_long,mapConfig.center_lat],T=mapConfig.min_zoom,E=mapConfig.max_zoom,P=mapConfig.zoom;(d=new mapboxgl.Map({container:"wemap2-map",style:"mapbox://styles/mapbox/standard",config:{basemap:{colorMotorways:"#c5ccd3",colorTrunks:"#c5ccd3",colorRoads:"#c5ccd3",showPedestrianRoads:!1,showPointOfInterestLabels:!1,backgroundPointOfInterestLabels:"none",fuelingStationModePointOfInterestLabels:"none",colorPointOfInterestLabels:"#a4acb7",showRoadLabels:!0,showTransitLabels:!1,showAdminBoundaries:!1,colorAdminBoundaries:"#ff4268",font:"Montserrat",show3dObjects:!1,show3dBuildings:!1,show3dTrees:!1,show3dLandmarks:!1,showLandmarkIconLabels:!1,showIndoorLabels:!1,colorBuildings:"#ffffff",colorCommercial:"#ffffff",colorEducation:"#ffffff",colorMedical:"#ffffff",colorIndustrial:"#ffffff",colorGreenspace:"#ffffff",colorWater:"#e0f0ff",colorLand:"#ffffff"}},center:D,zoom:P,minZoom:T,maxZoom:E,bearing:0,pitch:0})).addControl(new mapboxgl.NavigationControl({showCompass:!1}),"top-right"),"undefined"!=typeof ResizeObserver&&new ResizeObserver((function(){d.resize()})).observe(d.getContainer());0==jQuery("#wpadminbar").length&&k&&(v(k),d.on("resize",(function(){v(k)})));function R(){d.addSource(a,{type:"geojson",data:{type:"FeatureCollection",features:[]},cluster:!0,clusterMaxZoom:19,clusterRadius:60}),d.addSource(o,{type:"geojson",data:{type:"FeatureCollection",features:[]}}),d.addLayer({id:r.directions,type:"line",slot:"top",source:o,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#00448b","line-width":7,"line-opacity":.5}}),d.addLayer({id:r.jobClusters,type:"symbol",source:a,filter:["has","point_count"],layout:{"icon-image":i,"icon-anchor":"center","icon-allow-overlap":!0,"icon-ignore-placement":!0,"text-field":["get","point_count_abbreviated"],"text-size":14,"text-allow-overlap":!0,"text-ignore-placement":!0},paint:{"text-color":"#ffffff"}}),d.addLayer({id:r.jobPoints,type:"symbol",source:a,filter:["!",["has","point_count"]],layout:{"icon-image":n,"icon-anchor":"center","icon-allow-overlap":!0,"icon-ignore-placement":!0}}),y(r.jobClusters),y(r.jobPoints),d.on("click",r.jobPoints,(function(t){Q(t.features[0])})),d.on("click",r.jobClusters,(function(t){O(t.features[0])}))}function W(){setTimeout((function(){jQuery("#wemap2").trigger("wdt-jobs-map-loaded",d)}),1),d.on("click",(function(t){(function(t){var e=l.filter((function(t){return d.getLayer(t)}));if(!e.length)return!1;return d.queryRenderedFeatures(t,{layers:e}).length>0})(t.point)||(s.remove(),jQuery("#wemap2-sidebar").removeClass("visible"),jQuery("#wemap2-sidebar-left").removeClass("visible"))})),jQuery("#toggle-job-markers").prop("checked")?c(d,jQuery("#wemap-search").val(),s):(f(!1),jQuery(".wemap2-sidebar-filter-container").slideUp("fast")),jQuery("#toggle-job-markers").on("change",(function(){if(jQuery(this).prop("checked")){if(jQuery(".wemap2-sidebar-filter-container").slideDown("fast"),"function"==typeof wdt_event_cap)wdt_event_cap({t:"Jobs Map",ac:"Show Map Layer",e:"",d:"Job Postings",na:""});e.markers?(f(!0),p(d,s)):(f(!0),c(d,jQuery("#wemap-search").val(),s))}else jQuery(".wemap2-sidebar-filter-container").slideUp("fast"),f(!1),u([])})),jQuery(".wemap2-sidebar-layer").on("click",(function(t){var e=jQuery(t.target);e.parent().hasClass("wemap2-sidebar-checkbox")&&A(e)})),jQuery(".wemap2-sidebar-download").on("click",(function(t){let a=jQuery(this).data("layer");if(e.pointLayers.hasOwnProperty(a)){let t=function(t){let e=[];e.push(["TITLE","ADDRESS","WEBSITE","EMAIL","PHONE","EXCERPT"]),t.forEach((function(t){var a=t.properties.title?t.properties.title:"",o=(t.properties.address||"").split(",").splice(0,4).join(" "),r=t.properties.website?t.properties.website:"",n=t.properties.email?t.properties.email:"",i=t.properties.phone?t.properties.phone:"",s=t.properties.excerpt?t.properties.excerpt:"";let d=['"'+S(a)+'"','"'+S(o)+'"','"'+S(r)+'"','"'+S(n)+'"','"'+S(i)+'"','"'+S(s)+'"'];e.push(d)}));let a="data:text/csv;charset=utf-8,"+String.fromCharCode(65279)+encodeURIComponent(e.map((t=>t.join(","))).join("\n"));return a}(e.pointLayers[a].features);var o=document.createElement("a");o.setAttribute("href",t),o.setAttribute("download",a+".csv"),document.body.appendChild(o),o.click(),document.body.removeChild(o)}})),jQuery(".wemap2-sidebar-checkbox>input").each((function(t){let e=jQuery(this);e.prop("checked")&&A(e)})),jQuery("#wdt-job-map-sidebar-toggle").unbind("click"),jQuery("#wdt-job-map-sidebar-toggle").on("click",(function(t){t.preventDefault(),t.stopPropagation(),jQuery("#wemap2-sidebar-left").toggleClass("visible")}));let t=(a="regionBoundary",void 0!==mapConfig[a]?mapConfig[a]:void 0!==masterMapConfig[a]?masterMapConfig[a]:void 0);var a;void 0!==t&&L(t),jQuery("body").width()>900&&jQuery("#wemap2-sidebar-left").addClass("visible"),jQuery("#wemap2-sidebar").find(".sidebar-close").on("click",(function(t){jQuery("#wemap2-sidebar").removeClass("visible")})),jQuery("#weexplore-switch").on("change",(function(t){"jobs"==jQuery(this).val()&&(location.href=wfwe_path_weexplore),"list"==jQuery(this).val()&&(location.href=wfwe_path_jobs),"map"==jQuery(this).val()&&(location.href=wfwe_path_map),"census"==jQuery(this).val()&&(location.href=wfwe_path_census)}))}function Q(a){var o=g(a);if(o){var r=o.feature;if(jQuery("#wemap2-sidebar").removeClass("visible"),s.setLngLat(r.geometry.coordinates).setHTML(o.popupHTML).addTo(d),t("#wdt-job-map-job-infowindow").trigger("wdt:openJobMapJobInfoWindow"),"function"==typeof trackResearchEvent&&trackResearchEvent("wemap-jobs|click-job-marker|"+r.properties.post_id),"function"==typeof wdt_event_cap){var n=r.properties.job_title;wdt_event_cap({t:"Jobs Map",ac:"Click Job Marker",e:r.properties.employer,d:n,no2021:o.feature.properties.nocs_2021,na:""})}jQuery(".get-directions").unbind("click"),jQuery(".get-directions").on("click",(function(t){t.preventDefault();var a=jQuery(this).data("lat"),n=jQuery(this).data("long"),i=jQuery(this).data("mode").toUpperCase(),s=a+","+n;if("function"==typeof wdt_event_cap){var l=i,c=r.properties.employer;r.properties.nocs;wdt_event_cap({t:"Jobs Map",ac:"Get Directions",e:c,d:l,no2021:o.feature.properties.nocs_2021,na:""})}x(d,i,e.userLocationMarker,s,e.directionsDisplay)})),jQuery(".job-posting").unbind("click"),jQuery(".job-posting").on("click",(function(t){t.preventDefault(),"function"==typeof gtag&&gtag("event","Job Posting Click",{event_category:"WEmap2",event_action:"Job Posting Click",event_label:o.feature.properties.job_title});var e="wemap-jobs",a="click-job-post",r=jQuery(this).data("post-id");if("function"==typeof trackResearchEvent&&trackResearchEvent(e+"|"+a+"|"+r),"function"==typeof wdt_event_cap){var n=o.feature.properties.job_title;wdt_event_cap({t:"Jobs Map",ac:"Click Job Post",e:o.feature.properties.employer,d:n,no2021:o.feature.properties.nocs_2021,na:""})}window.open(jQuery(this).attr("href"),"_blank")}))}}function O(t){var o=d.getSource(a);if(o){var r=t.properties.cluster_id;d.getZoom()<18?o.getClusterExpansionZoom(r,(function(e,a){e||d.easeTo({center:t.geometry.coordinates,zoom:a})})):o.getClusterLeaves(r,1/0,0,(function(t,a){if(!t){var o=a.map(g).filter((function(t){return t})),r="";for(var n in o){var i=o[n];r+='<div class="job-listing">',r+="<h3>"+i.feature.properties.job_title+"</h3>",r+='<p class="data"><i class="fa fa-fw fa-briefcase" aria-hidden="true"></i> ',wemap.display_job_map_companies&&!i.feature.properties.hide_employer?(r+='<a href="'+j(i.feature.properties.employer_id)+'" target="_blank">',r+=i.feature.properties.employer,r+="</a>"):i.feature.properties.hide_employer||(r+="<span>"+i.feature.properties.employer+"</span>"),wemap.is_admin&&wemap.display_job_map_companies&&!i.feature.properties.hide_employer&&(r+=' ⋅ <a class="" href="'+C(i.feature.properties.employer_id,"employer")+'" target="_blank" rel="nofollow" >Edit</a>'),r+="</p>";var l=i.feature.properties.salary;null!=l&&"N/A"!=l&&(r+='<p class="data"><i class="fa fa-fw fa-usd" aria-hidden="true"></i> '+_(l,"$")+"</p>");var c=i.feature.properties.education;null!=c&&"N/A"!=c&&(r+='<p class="data"><i class="fa fa-fw fa-graduation-cap" aria-hidden="true"></i> '+c+"</p>");let t="Job Post Suggestion: "+i.feature.properties.job_title,e="I wanted to share this job posting with you that I found on "+wemap.site_title+": ";if(i.feature.properties.url)e+=i.feature.properties.url;else if(i.feature.properties.email){let t=new URL(wemap.job_url);t.searchParams.set("wdt-job",i.feature.properties.post_id),e+=t.href}t=t.split(" ").map((t=>encodeURIComponent(t))).join(" "),e=e.split(" ").map((t=>encodeURIComponent(t))).join(" ");let a=i.feature.properties.url;
1!a&&i.feature.properties.email&&(a="mailto:"+i.feature.properties.email+"?subject=Applying for: "+i.feature.properties.job_title+"(ID: "+i.feature.properties.post_id+")"),r+="<p>"+i.feature.properties.excerpt+"</p>",r+="<p>",r+='<a class="job-posting job-posting-link" href="'+a+'" target="_blank" rel="nofollow" data-post-id="'+i.feature.properties.post_id+'" data-nocs="'+i.feature.properties.nocs+'" data-nocs-2021="'+i.feature.properties.nocs_2021+'" data-employer="'+i.feature.properties.employer+'" data-post-title="'+i.feature.properties.job_title+'">Go to Job Post</a>',r+=' ⋅ <a class="job-posting" href="mailto:?subject='+t+"&body="+e+'">Share</a>',wemap.is_admin&&(r+=' ⋅ <a class="job-posting" href="'+C(i.feature.properties.post_id,"job")+'" target="_blank" rel="nofollow" >Edit</a>'),r+="</p>",r+='<p><span style="color: #666;">Directions:</span> ',r+='<a class="get-directions" data-mode="walking" data-lat="'+i.feature.geometry.coordinates[1]+'" data-long="'+i.feature.geometry.coordinates[0]+'" href="">Walk</a>',r+=" ⋅ ",r+='<a class="get-directions" data-mode="transit" data-lat="'+i.feature.geometry.coordinates[1]+'" data-long="'+i.feature.geometry.coordinates[0]+'" href="">Bus</a>',r+=" ⋅ ",r+='<a class="get-directions" data-mode="driving" data-lat="'+i.feature.geometry.coordinates[1]+'" data-long="'+i.feature.geometry.coordinates[0]+'" href="">Drive</a>',r+="</p>",r+="</div>",r+="<hr>"}jQuery("#sidebar-content").html(r),jQuery("#wemap2-sidebar").addClass("visible"),jQuery(window).width()<800&&jQuery("#wemap2-sidebar-left").removeClass("visible"),jQuery(".job-posting").unbind("click"),jQuery(".job-posting").on("click",(function(t){if("function"==typeof gtag){t.preventDefault();var e="wemap-jobs",a="click-job-post",o=jQuery(this).data("post-id");"function"==typeof trackResearchEvent&&trackResearchEvent(e+"|"+a+"|"+o)}if("function"==typeof wdt_event_cap){var r=jQuery(this).data("post-title");wdt_event_cap({t:"Jobs Map",ac:"Click Job Post",e:jQuery(this).data("employer"),d:r,no2021:jQuery(this).data("nocs-2021"),na:""})}window.open(jQuery(this).attr("href"),"_blank")})),jQuery(".get-directions").unbind("click"),jQuery(".get-directions").on("click",(function(t){t.preventDefault();var a=jQuery(this).data("lat"),o=jQuery(this).data("long"),r=jQuery(this).data("mode").toUpperCase(),n=a+","+o;if(x(d,r,e.userLocationMarker,n,e.directionsDisplay),"function"==typeof wdt_event_cap){var i=r;wdt_event_cap({t:"Jobs Map",ac:"Get Directions",e:jQuery(this).closest(".job-listing").find(".job-posting-link").data("employer"),d:i,no2021:jQuery(this).closest(".job-listing").find(".job-posting-link").data("nocs-2021"),na:""})}})),s.remove()}}))}}function A(t){var a=t.attr("id"),o=t.data("type");let r=new URL(window.location),n=[];if(jQuery(".wemap2-sidebar-checkbox>input").each((function(t){jQuery(this).prop("checked")&&n.push(jQuery(this).attr("id"))})),n.length<1?r.searchParams.set("layer","none"):r.searchParams.set("layer",n.join("|")),r=N(r),history.replaceState({},"",r.toString()),"path"==o)if(Object.keys(e.pathLayers).indexOf(a)<0)t.parent().siblings(".wemap2-sidebar-spinner").show(),M(a,t),"function"==typeof trackResearchEvent&&trackResearchEvent("wemap-jobs|show-layer|"+t.closest(".wemap2-sidebar-layer").data("label")),"function"==typeof wdt_event_cap&&wdt_event_cap({t:"Jobs Map",ac:"Show Map Layer",e:"",d:t.closest(".wemap2-sidebar-layer").data("label"),na:""});else if(t[0].checked){if("function"==typeof trackResearchEvent&&trackResearchEvent("wemap-jobs|show-layer|"+t.closest(".wemap2-sidebar-layer").data("label")),"function"==typeof wdt_event_cap)wdt_event_cap({t:"Jobs Map",ac:"Show Map Layer",e:"",d:t.closest(".wemap2-sidebar-layer").data("label"),na:""});m(e.pathLayers[a])}else w(e.pathLayers[a]);else if("point"==o){let o=jQuery(t).parents(".wemap2-sidebar-layer-container").first().find(".wemap2-sidebar-download").first();if(Object.keys(e.pointLayers).indexOf(a)<0){if(t.parent().siblings(".wemap2-sidebar-spinner").show(),F(a,t),"function"==typeof trackResearchEvent&&trackResearchEvent("wemap-jobs|show-layer|"+t.closest(".wemap2-sidebar-layer").data("label")),"function"==typeof wdt_event_cap)wdt_event_cap({t:"Jobs Map",ac:"Show Map Layer",e:"",d:t.closest(".wemap2-sidebar-layer").data("label"),na:""});o.prop("disabled",!1)}else if(t.is(":checked")){if("function"==typeof trackResearchEvent&&trackResearchEvent("wemap-jobs|show-layer|"+jQuery(this).closest(".wemap2-sidebar-layer").data("label")),"function"==typeof wdt_event_cap)wdt_event_cap({t:"Jobs Map",ac:"Show Map Layer",e:"",d:t.closest(".wemap2-sidebar-layer").data("label"),na:""});m(e.pointLayers[a]),o.prop("disabled",!1)}else w(e.pointLayers[a]),o.prop("disabled",!0)}}function F(t,a){var o="wdt-job-map-point-"+t,r=o+"-symbols",n=o+"-icon",i={sourceId:o,layerIds:[r],features:[],visible:!0};e.pointLayers[t]=i,jQuery.getJSON(WDT.rest_url+"wedatatools/v1/get-layer-geojson?mapTag="+mapConfig.layers[t].slug).done((function(l){i.features=h(l),b(n,wemap.plugin_url+mapConfig.layers[t].marker2x,28,(function(){d.addSource(o,{type:"geojson",data:{type:"FeatureCollection",features:i.features}}),d.addLayer({id:r,type:"symbol",source:o,layout:{"icon-image":n,"icon-anchor":"center","icon-allow-overlap":!0,"icon-ignore-placement":!0,visibility:i.visible?"visible":"none"}}),y(r),d.on("click",r,(function(a){var o=i.features[a.features[0].properties._wdtIndex];if(o){var r=o.geometry.coordinates,n=o.properties.title,l=(o.properties.address||"").split(",").splice(0,4),c=o.properties.website,p=o.properties.email,u=o.properties.phone,f=o.properties.excerpt,g='<div class="map-infowindow '+mapConfig.layers[t].slug+'">';if(g+='<h5 class="'+mapConfig.layers[t].slug+'">'+n+"</h5>",g+='<div class="infowindow-section"><div class="infowindow-section-content">',g+=l,g+="</div></div>",""!=f&&(g+='<div class="infowindow-section"><div class="infowindow-section-content">',g+=f,g+="</div></div>"),g+='<div class="infowindow-section"><div class="infowindow-section-content">
1',"N/A"!=c&&""!=c&&(g+='<a data-title="'+n+'" class="wemap-jobs-website-link" href="'+c+'" target="_blank">Website</a> ⋅ '),"N/A"!=p&&""!=p&&(g+='<a href="mailto:'+p+'">Email</a>  ⋅ '),"N/A"!=u&&""!=u&&(g+=u+""),g+="</div></div>",g+='<div class="infowindow-section"><div class="infowindow-section-content">',g+='<span style="color: #666;">Directions:</span> <a class="get-directions" data-mode="walking" data-lat="'+r[1]+'" data-long="'+r[0]+'" href="#">Walk</a> ⋅ <a class="get-directions" data-mode="transit" data-lat="'+r[1]+'" data-long="'+r[0]+'" href="#">Public Transit</a> ⋅ <a class="get-directions" data-mode="driving" data-lat="'+r[1]+'" data-long="'+r[0]+'" href="#">Drive</a></div>',g+="</div></div>",g+="</div>",s.setLngLat(r).setHTML(g).addTo(d),"function"==typeof trackResearchEvent&&trackResearchEvent("wemap-jobs|click-marker|"+o.properties.title),"function"==typeof wdt_event_cap)wdt_event_cap({t:"Jobs Map",ac:"Click Map Marker",e:"",d:o.properties.title,na:""});jQuery(".get-directions").unbind("click"),jQuery(".get-directions").on("click",(function(t){t.preventDefault();var a=jQuery(this).data("lat"),r=jQuery(this).data("long"),n=jQuery(this).data("mode").toUpperCase(),i=a+","+r;if(x(d,n,e.userLocationMarker,i,e.directionsDisplay),"function"==typeof trackResearchEvent&&trackResearchEvent("wemap-jobs|get-directions|"+jQuery(this).data("title")),"function"==typeof wdt_event_cap){var s=n;wdt_event_cap({t:"Jobs Map",ac:"Get Directions",e:o.properties.employer,d:s,no2021:o.properties.nocs_2021,na:""})}})),jQuery(".wemap-jobs-website-link").on("click",(function(t){("function"==typeof trackResearchEvent&&trackResearchEvent("wemap-jobs|click-website-link|"+jQuery(this).data("title")),"function"==typeof wdt_event_cap)&&wdt_event_cap({t:"Jobs Map",ac:"Click Website Link",e:"",d:jQuery(this).data("title"),na:""})}))}})),a.parent().siblings(".wemap2-sidebar-spinner").hide()}))})).fail((function(o){console.log(o),delete e.pointLayers[t],a.parent().siblings(".wemap2-sidebar-spinner").hide()}))}function M(t,a){var o="wdt-job-map-path-"+t,r=o+"-lines",n={sourceId:o,layerIds:[r],features:[],visible:!0};e.pathLayers[t]=n,jQuery.getJSON(mapConfig.pathLayers[t].path).done((function(e){var i=-1,l=["#E29241","#E2AE41","#E27041","#E2DF41","#A1E241","#5BE241","#41E2BB","#41B2E2","#417EE2","#9641E2","#E241D7","#E2418C","#006C63","#6A0066","#003369"];n.features=h(e),n.features.forEach((function(t){i==l.length-1?i=0:i++,t.properties._wdtStrokeColor=l[i]})),d.addSource(o,{type:"geojson",data:{type:"FeatureCollection",features:n.features}}),d.addLayer({id:r,type:"line",slot:"middle",source:o,layout:{"line-cap":"round","line-join":"round",visibility:n.visible?"visible":"none"},paint:{"line-color":["get","_wdtStrokeColor"],"line-width":4,"line-opacity":.75}}),y(r),d.on("click",r,(function(e){var a=n.features[e.features[0].properties._wdtIndex];if(a){var o=a.properties.NAME,r='<div class="map-infowindow">';if(r+='<h5 class="">'+mapConfig.pathLayers[t].label_singular+": "+o+"</h5>",r+="</div>",s.setLngLat(e.lngLat).setHTML(r).addTo(d),"function"==typeof trackResearchEvent&&trackResearchEvent("wemap-jobs|click-path|"+a.properties.title),"function"==typeof wdt_event_cap)wdt_event_cap({t:"Jobs Map",ac:"Click Polyline",e:"",d:o,na:""})}})),a.parent().siblings(".wemap2-sidebar-spinner").hide()})).fail((function(o){console.log(o),delete e.pathLayers[t],a.parent().siblings(".wemap2-sidebar-spinner").hide()}))}function L(t){var a="wdt-job-map-region-boundary",o=a+"-fill",r=a+"-line",n={sourceId:a,layerIds:[o,r],features:[],visible:!0};e.pathLayers["region-boundary"]=n,jQuery.getJSON(t.geojson).done((function(e){var i=t.stroke_color?t.stroke_color:"#1b63d1",s=t.stroke_opacity?t.stroke_opacity:".5",l=t.stroke_weight?t.stroke_weight:"3",c=t.fill_color?t.fill_color:"#ba0000",p=t.fill_opacity?t.fill_opacity:".25",u=void 0===t.visible||t.visible;n.visible=u,n.features=h(e),d.addSource(a,{type:"geojson",data:{type:"FeatureCollection",features:n.features}}),d.addLayer({id:o,type:"fill",slot:"middle",source:a,layout:{visibility:u?"visible":"none"},paint:{"fill-color":c,"fill-opacity":parseFloat(p)}}
1),d.addLayer({id:r,type:"line",slot:"middle",source:a,layout:{"line-cap":"round","line-join":"round",visibility:u?"visible":"none"},paint:{"line-color":i,"line-width":parseFloat(l),"line-opacity":parseFloat(s)}})})).fail((function(t){console.log(t),delete e.pathLayers["region-boundary"]}))}s=new mapboxgl.Popup({maxWidth:"280px",closeOnClick:!1}),e.userLocationMarker=function(){var t=document.createElement("img");t.src=wemap.map_url+"/img/wemap2-marker-walking2x.png",t.width=34,t.height=48,t.style.cursor="pointer",t.alt="";var e=new mapboxgl.Marker({element:t,anchor:"center"}),a='<div class="map-infowindow">';return a+='<a href="#" id="remove-directions">Remove Directions</a>',a+="</div>",t.addEventListener("click",(function(t){t.stopPropagation(),s.setLngLat(e.getLngLat()).setHTML(a).addTo(d),jQuery("#remove-directions").on("click",(function(t){t.preventDefault(),function(){if(!d)return;var t=d.getSource(o);t&&t.setData({type:"FeatureCollection",features:[]})}(),s.remove(),e.remove()}))})),e}(),e.directionsDisplay={origin:null,destination:null},e.pathLayers={},e.pointLayers={},d.on("load",(function(){d.setTerrain(null);var t=2,e=function(){--t>0||(R(),W())};b(n,wemap.map_url+"/img/wemap2-marker-default2x.png",34,e),b(i,wemap.map_url+"/img/wemap2-cluster-marker1.png",54,e)}))}(),t(document).on("wdt:followed-job",'#wemap2-map [data-action="wdt-follow-job-post"]',(function(){t(this).attr("data-action","wdt-unfollow-job-post").text("Unsave Job Post")})),t(document).on("wdt:unfollowed-job",'#wemap2-map [data-action="wdt-unfollow-job-post"]',(function(){t(this).attr("data-action","wdt-follow-job-post").text("Save Job Post")}))})),jQuery(document).ready((function(t){"use strict";var e=null;if(t("#job-indexer-visibility-dashboard").on("wdt:refresh",(function(a){var o=jQuery(this).data("nonce"),r=a._offset;e&&e.abort(),e=jQuery.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"indexer_visibility_query",nonce:o,offset:r},success:e=>{!function(e,a){t(".job-indexer-visibility-chart").each((function(o){var r=this.getContext("2d"),n=t(this).data("indexer");let i=t(this).data("chart");i&&i.destroy();let s=function(t,e,a,o){let r=[],n=new Date;for(let t=o-1;t>=0;t--){let e=new Date(n);e.setDate(e.getDate()-t);let a=e.getFullYear(),o=String(e.getDate()).padStart(2,"0"),i=String(e.getMonth()+1).padStart(2,"0");r.push({label:a+"-"+i+"-"+o,active:[],expired:[],discarded:[]})}for(let t=0;t<e.length;t++)for(let o=0;o<r.length;o++)if(e[t].indexer.toLowerCase().includes(a.toLowerCase())&&e[t].timestamp.split(" ")[0]==r[o].label){switch(e[t].level){case"addition":r[o].active.push(e[t]);break;case"discard":r[o].discarded.push(e[t]);break;case"expire":r[o].expired.push(e[t])}break}let i={"active-bg":"rgba(54, 162, 235, 0.6)","active-brd":"rgba(54, 162, 235, 1)","expired-bg":"rgba(255, 99, 132, 0.6)","expired-brd":"rgba(255, 99, 132, 1)","discarded-bg":"rgba(255, 206, 86, 0.6)","discarded-brd":"rgba(255, 206, 86, 1)"},s=[],d={label:"New",data:[],backgroundColor:[],borderColor:[],borderWidth:1},l={label:"Expired",data:[],backgroundColor:[],borderColor:[],borderWidth:1},c={label:"Duplicates",data:[],backgroundColor:[],borderColor:[],borderWidth:1};for(let t=0;t<r.length;t++)s.push(r[t].label),d.data.push(r[t].active.length),d.backgroundColor.push(i["active-bg"]),d.borderColor.push(i["active-brd"]),l.data.push(r[t].expired.length),l.backgroundColor.push(i["expired-bg"]),l.borderColor.push(i["expired-brd"]),c.data.push(r[t].discarded.length),c.backgroundColor.push(i["discarded-bg"]),c.borderColor.push(i["discarded-brd"]);var p=new Chart(t,{type:"bar",data:{labels:s,datasets:[d,l,c]},options:{scales:{yAxes:[{ticks:{beginAtZero:!0}}]},title:{display:!0,text:a.charAt(0).toUpperCase()+a.slice(1)+" Weekly Indexing"}}});return p}(r,e,n,a);t(this).data("chart",s)}))}(e.results,r)},error:(t,e,a)=>{console.log(a)}})})),t("#job-indexer-visibility-dashboard").length>0){let e=t.Event("wdt:refresh");e._offset=7,t("#job-indexer-visibility-dashboard").trigger(e)}t('#job-indexer-visibility-dashboard-wrap [name="offset"]').on("change",(function(e){let a=t(this).val(),o=t.Event("wdt:refresh");o._offset=a,t("#job-indexer-visibility-dashboard").trigger(o)}))})),jQuery((function(t){"use strict";if(t("#wdt-portal-my-profile #wdt-portal-uploaded-files-table").each((function(){let e=t(this).attr("data-owner-id"),a=t.Event("wdt:refresh");a._ownerID=e,t(this).trigger(a),t(this).on("wdt:ready",(function(){t(this).trigger(a)}))})),t(document).on("wdt:start","#wdt-portal-my-profile #wdt-portal-uploaded-files-table [data-file-action]",(function(e){e.stopPropagation();let a=t("#wdt-portal-my-profile #wdt-portal-uploaded-files-table");t(a).trigger("wdt:loadState")})),t(document).on("wdt:complete","#wdt-portal-my-profile #wdt-portal-uploaded-files-table [data-file-action]",(function(e){e.stopPropagation();let a=t("#wdt-portal-my-profile #wdt-portal-uploaded-files-table"),o=t(
1a).attr("data-owner-id"),r=t.Event("wdt:refresh");r._ownerID=o,t(a).trigger(r)})),t('button[data-action="wdt-portal-profile-edit-email"]').on("click",(function(){e("email")})),t('button[data-action="wdt-portal-profile-edit-password"]').on("click",(function(){e("password")})),t('button[data-action="wdt-portal-profile-edit-user-company"]').on("click",(function(){e("company")})),t(document).on("click",'button[data-action="wdt-portal-my-profile-email-cancel"], button[data-action="wdt-portal-my-profile-password-cancel"], button[data-action="wdt-portal-my-profile-company-cancel"]',(function(){e("main")})),t('#wdt-portal-my-profile button[data-action="wdt-nav-tabs-item"]').on("wdt:navigateTab",(function(){e(t(this).attr("data-tab-target"))})),t("#wdt-my-profile-password-form input").on("input",(function(){t(this)[0].setCustomValidity("")})),t('button[data-action="wdt-portal-my-profile-password-reset"]').on("click",(function(e){let a=t(this).parents("form#wdt-my-profile-password-form").first(),o=t(a).find('input[name="wdt-portal-profile-password-nonce"]').val(),r=t(a).find('input[name="wdt-portal-profile-password-user-id"]').val();jQuery.ajax({method:"POST",url:"/wp-json/wedatatools/v1/portal/profile/password-reset/",data:{nonce:o,user_id:r},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.success){let e="";e+='<p class="wdt-portal-modal-body-text wdt-portal-modal-password-block-1">We just sent a password reset link to <strong>'+t(a).find('input[name="wdt-portal-profile-password-email"]').val()+"</strong></p>",e+='<p class="wdt-portal-modal-small-text wdt-portal-modal-password-block-2">(You may need to look in your spam folder.)</p>',e+='<p class="wdt-portal-modal-body-text wdt-portal-modal-password-block-3">Still not showing up? Request a new email below.</p>',e+='<button class="wdt-portal-modal-btn" data-action="wdt-request-new-password-reset-email">Resend Email</button>',_wdtRenderContentModal("Check Your Inbox",e,"wdt-portal-modal"),setTimeout((function(){location.reload()}),5e3)}else wdtDisplayNotification("Could not send password reset: "+e.response,"error",-1)},error:function(t){let e=t.responseJSON&&t.responseJSON.response?t.responseJSON.response:"error making request.";wdtDisplayNotification("Could not send password reset: "+e,"error",-1)}})})),t('button[data-action="wdt-portal-my-profile-password-save"]').on("click",(function(e){let a=t(this).parents("form#wdt-my-profile-password-form").first(),o=t(a).find('input[name="wdt_user_current_password"]'),r=t(a).find('input[name="wdt_user_new_password"]'),n=t(a).find('input[name="wdt_user_new_password_confirm"]'),i=t(a).find('input[name="wdt-portal-profile-password-nonce"]').val(),s=t(a).find('input[name="wdt-portal-profile-password-login"]').val();if(o.val()===r.val())return r[0].setCustomValidity("New password is identical to old password."),r[0].reportValidity(),void e.preventDefault();if(r[0].setCustomValidity(""),r.val()!==n.val())return n[0].setCustomValidity("Passwords do not match."),n[0].reportValidity(),void e.preventDefault();n[0].setCustomValidity("");let d=!0;a.find("input").each((function(){d&&(t(this)[0].reportValidity()||(e.preventDefault(),d=!1))})),d&&jQuery.ajax({method:"POST",url:"/wp-json/wedatatools/v1/portal/profile/password/",data:{nonce:i,password:r.val(),old_password:o.val()},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){if(t.success){let t="";t+='<p class="wdt-portal-modal-body-text">Your new password has successfully been set.</p>',t+='<p class="wdt-portal-modal-body-text">For security purposes, you will need to log in again before continuing.</p>',t+='<p class="wdt-portal-modal-body-text">If you are not redirected in 5 seconds, click <a target="_self" href="'+s+'">here</a>.</p>',_wdtRenderContentModal("Successfully Updated Password",t,"wdt-portal-modal"),setTimeout((function(){location.reload()}),5e3)}else wdtDisplayNotification("Could not update password: "+t.response,"error",-1)},error:function(t){let e=t.responseJSON&&t.responseJSON.response?t.responseJSON.response:"error making request.";wdtDisplayNotification("Could not update password: "+e,"error",-1)}})})),t(document).on("click",'button[data-action="wdt-portal-my-profile-email-save"]',(function(e){let a=t(this).parents("form#wdt-my-profile-email-form").first(),o=t(a).find('input[name="wdt_user_new_email"]'),r=t(a).find('input[name="wdt-portal-profile-email-nonce"]').val();a.find("input").each((function(){t(this)[0].reportValidity()||e.preventDefault()})),jQuery.ajax({method:"POST",url:"/wp-json/wedatatools/v1/portal/profile/email/",data:{nonce:r,email:o.val()},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){if(t.success){let e="";e+='<p class="wdt-portal-modal-body-text wdt-portal-modal-email-block-1">We just sent a confirmation email for the requested change to <strong>'+t.new_email+"</strong>.</p>",e+='<p class="wdt-portal-modal-small-text wdt-portal-modal-email-block-2">(You may need to look in your spam folder)</p>',e+='<p class="wdt-portal-modal-body-text wdt-portal-modal-email-block-3">Still not showing up? Request a new email below.</p>',e+='<button class="wdt-portal-modal-btn" data-action="wdt-request-new-email-confirmation-email" style="margin-left: auto; margin-right: auto; display: block;">Resend Email</button>',_wdtRenderContentModal("Check Your Inbox",e,"wdt-portal-modal")}else wdtDisplayNotification("Could not update email: "+t.response,"error",-1)},error:function(t){let e=t.responseJSON&&t.responseJSON.response?t.responseJSON.response:"error making request.";wdtDisplayNotification("Could not update email: "+e,"error",-1)}})})),t(document).on("click",'button[data-action="wdt-portal-my-profile-company-save"]',(function(a){let o=t(this).parents("form#wdt-my-profile-company-form").first();o.find("input").each((function(){t(this)[0].reportValidity()||a.preventDefault()}));let r=t(o).serializeArray();jQuery.ajax({method:"POST",url:"/wp-json/wedatatools/v1/portal/profile/company/",data:r,beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(o).find('button[data-action="wdt-portal-my-profile-company-save"]').prop("disabled",!0)}
1,success:function(a){if(a.success){let o=a.company_name;wdtDisplayNotification("Updated Company to "+o,"success",5e3),t('#wdt-my-profile-form-company-name-container [data-wdt-material-form-target="edit-input"]').attr("value",o),t('#wdt-my-profile-form-company-name-container [data-wdt-material-form-target="edit-input"]').trigger("wdtrf:refresh"),e("main")}else wdtDisplayNotification("Could not update company: "+a.response,"error",-1)},error:function(t){let e=t.responseJSON&&t.responseJSON.response?t.responseJSON.response:"error making request.";wdtDisplayNotification("Could not update company: "+e,"error",-1)},complete:function(){t(o).find('button[data-action="wdt-portal-my-profile-company-save"]').prop("disabled",!1)}})})),t('#wdt-my-profile-company-form-company[name="wdt_user_company"]').on("change",(function(){let e=t(this).val();e?jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/employers/exists/",data:{employer_slug:e},beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t("#wdt-my-profile-company-form-save").prop("disabled",!0)},success:function(e){e.success&&!e.employer_found&&t("#wdt-my-profile-company-form-company-details-fieldset").show()},complete:function(){t("#wdt-my-profile-company-form-save").prop("disabled",!1)}}):t("#wdt-my-profile-company-form-company-details-fieldset").hide()})),t('#wdt-my-profile-form #wdt-my-profile-form-service-provider-section [name="wdt_service_provider_slug"]').on("change",(function(){let e=t(this).parents("#wdt-my-profile-form-service-provider-section").first(),a=t(this).val();t(e).find('[data-target="service-provider-terms"]').addClass("wdt-display-none"),t(e).find('[data-target="service-provider-terms"][data-service-provider="'+a+'"]').removeClass("wdt-display-none")})),t("#wdt-my-profile-form").length){let e=new URLSearchParams(window.location.search).get("highlighted-items"),o=decodeURI(e);try{let t=JSON.parse(o);for(let e in t)a(e)}catch(t){}t('#wdt-my-profile-form #wdt-my-profile-form-service-provider-section [name="wdt_service_provider_slug"]').trigger("change")}function e(e){t('[data-type="my-profile-view"]').attr("data-status","inactive"),t('[data-type="my-profile-view"][data-target="'+e+'"]').attr("data-status","active")}function a(e){let a=t("#"+e);a.length&&a.addClass("wdt-my-profile-highlighted-item")}})),jQuery(document).ready((function(t){"use strict";t(document).on("wdt:openJobMapJobInfoWindow","#wdt-job-map-job-infowindow",(function(e){let a=t(this).attr("data-job-id"),o=t(this).attr("data-job-title"),r=t(this).attr("data-employer-name"),n=t(t("#wemap2 #wdt-report-job-posting-button-template").clone(!0).html());t(n).attr("data-job-id",a),t(n).attr("data-job-title",o),t(n).attr("data-employer-name",r),t(this).find('[data-target="btns"]').append(n)})),t(document).on("wdt:afterModalOpen","#wdt-job-map-report-job-posting-btn",(function(e){let a=t(this).attr("data-job-id"),o=t(this).attr("data-job-title"),r=t(this).attr("data-employer-name");t("#wdt-content-modal").find('[data-target="job-title"]').text(o),t("#wdt-content-modal").find('[data-target="employer-name"]').text(r),t("#wdt-content-modal").find('[name="jobPostingId"]').val(a)}))})),jQuery(document).ready((function(t){"use strict";t('[data-target="wdt-compact-form-container"] [data-action="toggle-form"]').on("click",(function(e){let a=t(this).parents('[data-target="wdt-compact-form-container"]').first();a.hasClass("wdt-open")?a.removeClass("wdt-open"):a.addClass("wdt-open")})),t(document).on("click",'[data-target="wdt-compact-form-container"]',(function(t){t.stopPropagation()})),t(document).on("click",(function(e){t('[data-target="wdt-compact-form-container"]').removeClass("wdt-open")}))}
1)),jQuery(document).ready((function(t){"use strict";t(document).on("wdt:uninitializeForm","form[wdt-initializable-form],div[wdt-initializable-form]",(function(e){t(this).find('[data-date-picker="wdt-material-form"]').trigger("wdtrf:unregister")})),t(document).on("wdt:initializeForm","form[wdt-initializable-form],div[wdt-initializable-form]",(function(e){t(this).find('[data-target="wdt-form-select-combobox-container"]').trigger("wdt:initialize"),t(this).find('[data-typeahead-target="wdt-ajax-select-container"]').trigger("wdt:initialize"),t(this).find('[data-target="wdt-material-date-range"]').trigger("wdt:initialize"),t(this).find('[data-date-picker="wdt-material-form"]').trigger("wdtrf:register"),t(this).find('[data-rf-action="wdt-material-form-input"]').trigger("wdtrf:refresh"),t(this).find('[data-field-type="captcha"]').trigger("wdt:initialize")})),t(document).on("wdt:afterModalOpen","button",(function(e){t("#wdt-content-modal form[wdt-initializable-form],div[wdt-initializable-form]").trigger("wdt:initializeForm")})),t(document).on("wdt:clearValue","[name]",(function(e){t(this).attr("name");let a=t(this).attr("type"),o=t(this).attr("data-field-type"),r=e._value;switch(o){case"date-range":let e=t(this).parents('[data-target="wdt-material-date-range"]').first();return t(this).val(""),void t(e).find('[data-range-target="dropdown"]').trigger("wdt:select");case"combobox":return void(r!==t(this).val()&&void 0!==r||t(this).trigger("wdt:select"));case"typeahead-select":if(r){let e=t.Event("wdt:removeselection");e._value=r,t(this).trigger(e)}else{let e=t.Event("wdt-clearall");t(this).trigger(e)}return}"checkbox"===a?r!==t(this).attr("value")&&void 0!==r||(t(this).prop("checked",!1),t(this).trigger("change")):r!==t(this).val()&&void 0!==r||(t(this).val(""),t(this).trigger("change"))}))})),jQuery(document).ready((function(t){"use strict";function e(e){let a=t(e).parents('[data-wdt-material-form-target="typeahead-select-container"]').first();a.length?t(a).trigger("wdtrf:refresh"):t(e).trigger("wdtrf:refresh")}t(document).on("input",'*[data-rf-action="wdt-material-form-input"]',(function(t){e(this)})),t(document).on("change",'*[data-rf-action="wdt-material-form-input"]',(function(t){e(this)})),t(document).on("wdtrf:refresh",'input[data-rf-target="wdt-material-form-checkbox"]',(function(e){let a=t(this).parents('[data-rf-target="wdt-material-form-checkbox-label"]').first();t(this).prop("disabled")?a.attr("data-disabled","true"):a.attr("data-disabled","false"),t(this).val()?a.addClass("wdt-form-input-progress"):a.removeClass("wdt-form-input-progress")})),t(document).on("wdtrf:refresh",'input[data-rf-target="wdt-material-form-text-input"]',(function(e){let a=t(this).parents('[data-rf-target="wdt-material-form-text-input-label"]').first();t(this).prop("disabled")?a.attr("data-disabled","true"):a.attr("data-disabled","false"),t(this).val()?a.addClass("wdt-form-input-progress"):a.removeClass("wdt-form-input-progress")})),t(document).on("wdtrf:refresh",'textarea[data-rf-target="wdt-material-form-textarea-input"]',(function(e){let a=t(this).parents('[data-rf-target="wdt-material-form-textarea-input-label"]').first();t(this).prop("disabled")?a.attr("data-disabled","true"):a.attr("data-disabled","false"),t(this).val()?a.addClass("wdt-form-input-progress"):a.removeClass("wdt-form-input-progress")})),t(document).on("wdtrf:refresh",'[data-wdt-material-form-target="typeahead-select-container"]',(function(e){let a=t(this).find(".wdt-ajax-select-label");if(!a||!a.length)return;let o=t(this).find('select[data-target="wdt-material-form-typeahead"]').val(),r=t(this).find('[data-target="wdt-ajax-select-input"]').val();o&&o.length||r&&r.length?t(this).addClass("wdt-form-input-progress"):t(this).removeClass("wdt-form-input-progress")})),t('input[data-rf-target="wdt-material-form-checkbox"]').trigger("wdtrf:refresh"),t('input[data-rf-target="wdt-material-form-text-input"]').trigger("wdtrf:refresh"),t('textarea[data-rf-target="wdt-material-form-textarea-input"]').trigger("wdtrf:refresh"),t('[data-wdt-material-form-target="typeahead-select-container"]').trigger("wdtrf:refresh")})),jQuery((function(t){"use strict";var e=!1;t(document).on("click",'[data-action="find-candidates-search"]',(function(e){let a=t(this).parents('[data-target="wdt-job-post-find-candidates"]').first(),o=t(this).attr("data-page"),r=t(a).find('[name="noc_select_nocs[]"]').val(),n=t(a).find('[name="job_skill_select_skills[]"]').val(),i=new URL(o);for(let t of r)i.searchParams.append("following_occupations[]",t);for(let t of n)i.searchParams.append("following_skills[]",t);window.open(i.href,"_blank")})),t(document).on("click",'[data-action="find-candidates"]',(function(e){let a=t(this).parents('[data-target="job-post-list-item"]').first(),o=t(a).find('[data-target="wdt-job-post-find-candidates"]');t(o).hasClass("active")?(t(o).trigger("wdt:hide"),t(a).find('[data-target="wdt-job-post-quick-edit"]').trigger("wdt:hide")):t(o).trigger("wdt:show")})),t(document).on("click",'[data-action="close-find-candidates"]',(function(e){let a=t(this).parents('[data-target="job-post-list-item"]').first(),o=t(a).find('[data-target="wdt-job-post-find-candidates"]');t(o).trigger("wdt:hide")})),t(document).on("wdt:show",'[data-target="job-post-list-item"] [data-target="wdt-job-post-find-candidates"]',(function(e){e.stopPropagation(),t('[data-target="wdt-job-post-quick-edit"]').each((function(e){t(this).trigger("wdt:hide")})),t('[data-target="wdt-job-post-find-candidates"]').each((function(e){t(this).trigger("wdt:hide")})),t(this).addClass("active"),t(this).slideDown("fast")})),t(document).on("wdt:hide",'[data-target="job-post-list-item"] [data-target="wdt-job-post-find-candidates"]',(function(e){e.stopPropagation(),t(this).removeClass("active"),t(this).slideUp("fast")})),t(document).on("click","button.wdt-job-post-quick-edit-button",(e=>{t(this).parents('[data-target="job-post-list-item"]').first();let a=t(e.currentTarget).attr("data-post-id");t('[data-target="wdt-job-post-quick-edit"][data-post-id="'+a+'"]').each((function(e){t(this).hasClass("active")?t(this).trigger("wdt:hide"):t(this).trigger("wdt:show")}))})),t(document).on("wdt:hide",'[data-target="job-post-list-item"] [data-target="wdt-job-post-quick-edit"]',(function(e){e.stopPropagation(),t(this).removeClass("active"),t(this).slideUp("fast")})),t(document).on("wdt:show",'[data-target="job-post-list-item"] [data-target="wdt-job-post-quick-edit"]',(function(e){e.stopPropagation();let a=t(this).parents('[data-target="job-post-list-item"]').first(),o=t(a).find("button.wdt-job-post-quick-edit-button").first(),r=t(a).find('[data-target="wdt-job-post-quick-edit"]');t('[data-target="wdt-job-post-quick-edit"]').each((function(e){t(this).trigger("wdt:hide")})),t('[data-target="wdt-job-post-find-candidates"]').each((function(e){t(this).trigger("wdt:hide")})),t(this).addClass("active"),t(this).slideDown("fast");t(o).attr("data-post-id");let n=t(o).attr("data-employer-id"),i=this;t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/naics/suggestions",data:{employer_id:n},beforeSend:e=>{t(i).find('[data-target="wdt-job-post-quick-edit-naics-suggestions-container"] [data-target="wdt-job-post-quick-edit-naics-suggestions"]').html(""),t(i).find('[data-target="wdt-job-post-quick-edit-naics-suggestions-spinner"]').show(),e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.success&&e.suggestions){let a=t(i).find('[data-target="wdt-job-post-quick-edit-naics-suggestions-container"] [data-target="wdt-job-post-quick-edit-naics-suggestions-templates"] [data-target="wdt-job-post-quick-edit-naics-suggestion"]');for(let o of e.suggestions){let e=a.clone(!0);t(e).find('[data-target="wdt-job-post-quick-edit-naics-suggestion-text"]').text(o.title),t(e).attr("data-value",o.term_id),t(e).attr("title",o.title),t(i).find('[data-target="wdt-job-post-quick-edit-naics-suggestions-container"] [data-target="wdt-job-post-quick-edit-naics-suggestions"]').append(e)}t(i).find('[data-target="wdt-job-post-quick-edit-naics-suggestions-container"] [data-target="wdt-job-post-quick-edit-naics-suggestions"]').append('<span data-target="wdt-none-to-display">No suggestions to display.</span>'),t(i).find('[data-target="wdt-job-post-quick-edit-naics-suggestions-container"] [data-target="wdt-job-post-quick-edit-naics-suggestions"] [data-target="wdt-none-to-display"]').hide(),t(r).trigger("wdt:filterNAICSSuggestions")}else t(i).find('[data-target="wdt-job-post-quick-edit-naics-suggestions-container"] [data-target="wdt-job-post-quick-edit-naics-suggestions"]').append("<span>No NAICS Suggestions Found.</span>")},error:function(t){console.log(t),wdtDisplayNotification("Error retrieving NAICS suggestions.","error",-1)},complete:function(){t(i).find('[data-target="wdt-job-post-quick-edit-naics-suggestions-spinner"]').hide()}})})),t(document).on("wdt:afterselect",'[data-target="wdt-job-post-quick-edit"] [data-quickedit-target="noc2021-select"]',(function(e){let a=t(this).parents('[data-target="wdt-job-post-quick-edit"]'),o=e.selected;t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/nocs/2016-match/",data:{noc:o.value},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e&&e.success&&e.found_match){let o=e.term,r=o.slug+" - "+o.name,n=o.term_id,i=t.Event("wdt:select");i.label=r,i.value=n;let s=t(a).find('[data-quickedit-target="noc-select"]'),d=t(s).parents('[data-wdt-material-form-target="typeahead-select-container"]').first();wdtElementNotification(t(d).find(".wdt-ajax-select-combobox-container"),"Added 2016 NOC tag."),t(a).find(s).trigger(i)}},error:function(t){console.log(t)},complete:function(){}})})),t(document).on("change",'[data-target="wdt-job-post-quick-edit"] [data-quickedit-target="naics-select"]',(function(e){let a=t(this).parents('[data-target="wdt-job-post-quick-edit"]');t(a).trigger("wdt:filterNAICSSuggestions")})),t(document).on("wdt:filterNAICSSuggestions",'[data-target="wdt-job-post-quick-edit"]',(function(e){let a=t(this).find('[data-quickedit-target="naics-select"]'),o=t(this).find('[data-target="wdt-job-post-quick-edit-naics-suggestions"] [data-target="wdt-job-post-quick-edit-naics-suggestion"]'),r=a.val(),n=!0;o.each((function(e){let a=t(this).attr("data-value");a==r||Array.isArray(r)&&r.includes(a)?t(this).hide():(n=!1,t(this).show())})),n?t(this).find('[data-target="wdt-job-post-quick-edit-naics-suggestions"] [data-target="wdt-none-to-display"]').show():t(this).find('[data-target="wdt-job-post-quick-edit-naics-suggestions"] [data-target="wdt-none-to-display"]').hide()})),t(document).on("click",'[data-target="wdt-job-post-quick-edit-naics-suggestion"]',(function(e){let a=t(this).attr("title"),o=t(this).attr("data-value"),r=t(this).parents('[data-target="wdt-job-post-quick-edit"]').first(),n=t(r).find('[data-quickedit-target="naics-select"]'),i=t.Event("wdt:select");i.label=a,i.value=o,t(n).trigger(i)})),t(".wdt-job-post-interest").on("click",(e=>{let a=t(e.currentTarget).data("post-hash"),o=t(e.currentTarget).data("action"),r=t(e.currentTarget).data("nonce"),n=t(e.currentTarget).parents('[data-target="job-post-list-item"]').first();console.log(n);let i=null,s=n.prevAll('[data-target="job-post-list-item"]:visible').first();if(s.length)i=s;else{let t=n.nextAll('[data-target="job-post-list-item"]:visible').first();i=t.length?t:n.closest(".wdt-job-post-list")}
1jQuery.ajax({type:"POST",url:WDT.admin_url+"admin-ajax.php",data:{action:o,nonce:r,hash:a},success:function(t){switch(n.slideUp(200,(function(){wdtFocusElement(i)})),o){case"wdt_job_post_ignore":wdtAnnounce("Successfully ignored post");break;case"wdt_job_post_unignore":wdtAnnounce("Successfully unignored post")}},error:function(t){wdtAnnounce("Something went wrong"),console.log(t)}})})),t('[data-action="wdt_quick_edit_add_title_checkbox"]').on("change",(function(e){let a=t(this).parents('[data-target="wdt-job-post-quick-edit"]').first().find('input[data-target="wdt_quick_edit_add_title_checkbox"]'),o=[];a.each((function(e){t(this).prop("checked")&&o.push(t(this).val())})),o.includes("add-title")?a.each((function(e){"add-title-no-naics"==t(this).val()&&t(this).prop("disabled",!0)})):a.prop("disabled",!1)})),t(document).on("submit",'form[data-target="wdt-job-post-quick-edit"]',(function(e){e.preventDefault();let a=this,o=t(a).serializeArray();console.log(o);let r=[],n=[];for(let t of o)"wdt-job-posting-nocs-2021[]"===t.name&&""!==t.value&&r.push(t.value),"wdt-job-posting-naics[]"===t.name&&""!==t.value&&n.push(t.value);let i=t.param(o);if(t(a).find('[name="wdt-quick-edit-new-rule"]').is(":checked")&&r.length){let e=t(a).attr("data-post-title"),o=new URL(t(a).attr("data-rule-link"));o.searchParams.set("wdt-job-title",e),o.searchParams.set("wdt-noc",r[0]),n.length&&o.searchParams.set("wdt-naics",n.join("|")),window.open(o.href,"_blank")}let s="";t(a).find('input[data-target="wdt_quick_edit_add_title_checkbox"]').each((function(e){t(this).prop("checked")&&!t(this).prop("disabled")&&(s=t(this).val())}));let d=t(a).find("button.wdt-job-post-quick-edit-save");t(d).prop("disabled",!0),t(d).text("Saving..."),t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/job-board/job-mgmt/tag/",data:i,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){t(d).prop("disabled",!1),t(d).text("Save"),wdtDisplayNotification("Successfully saved job.","success",3e3),t(a).slideUp(200)},error:function(e){console.log(e),t(d).prop("disabled",!1)}})})),t('.wdt-job-posting-list-item button[data-action="expire"]').on("click",(function(a){let o=this,r=t(this).parents(".wdt-job-posting-list-item").first(),n=t(this).attr("data-nonce"),i=t(this).attr("data-post-id");if(!e){let t=confirm("Are you sure you wish to expire this post?");if(e=t,!t)return}t(this).prop("disabled",!0),t(this).html('<div class="wdt-spinner wdt-spinner-xsmall" style="border-width: 3px; border-top-width: 3px; width: 13px; height: 13px; display: inline-block;"></div>'),jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/job-board/job-mgmt/expire/",data:{nonce:n,"post-id":i},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success?(wdtDisplayNotification("Successfully expired post.","success",3e3),t(r).slideUp(200)):(wdtDisplayNotification("Failed to expire post.","error",-1),t(o).prop("disabled",!1),t(o).html("Delete"))},error:function(e){console.log(e),wdtDisplayNotification("Failed to expire post.","error",-1),t(o).prop("disabled",!1),t(o).html("Delete")},complete:function(){}})})),t('.wdt-job-posting-list-item button[data-action="trash"]').on("click",(function(a){let o=this,r=t(this).parents(".wdt-job-posting-list-item").first(),n=t(this).attr("data-nonce"),i=t(this).attr("data-post-id");if(!e){let t=confirm("Are you sure you wish to permanently delete this post?");if(e=t,!t)return}t(this).prop("disabled",!0),t(this).html('<div class="wdt-spinner wdt-spinner-xsmall" style="border-width: 3px; border-top-width: 3px; width: 13px; height: 13px; display: inline-block;"></div>'),jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/job-board/job-mgmt/delete/",data:{nonce:n,"post-id":i},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success?(wdtDisplayNotification("Successfully deleted post.","success",3e3),t(r).slideUp(200)):(wdtDisplayNotification("Failed to delete post.","error",-1),t(o).prop("disabled",!1),t(o).html("Delete"))},error:function(e){console.log(e),wdtDisplayNotification("Failed to delete post.","error",-1),t(o).prop("disabled",!1),t(o).html("Delete")}
1,complete:function(){}})})),t(document).on("wdt:followed-job",'[data-target="job-post-list-item"] [data-target="wdt-follow-job-post-btn"]',(function(t){jQuery(this).text("Unsave Job Post"),jQuery(this).attr("data-action","wdt-unfollow-job-post")})),t(document).on("wdt:unfollowed-job",'[data-target="job-post-list-item"] [data-target="wdt-unfollow-job-post-btn"]',(function(t){jQuery(this).text("Save Job Post"),jQuery(this).attr("data-action","wdt-follow-job-post")}))})),jQuery(document).ready((function(t){if(jQuery(".wdt-job-posting-history").length&&null!==Chart){var e=[];Chart.defaults.global.defaultFontFamily="proxima-nova",t(".wdt-job-posting-history").each((function(a){let o={},r=t(this).attr("data-company");r&&(o.company=r);let n=t(this).attr("data-nocs");n&&(o.noc_slugs=n.split("|"));let i=t(this).attr("data-nocs-2021");i&&(o.noc_2021_slugs=i.split("|"));let s=this,d=t(this).find(".wdt-job-posting-history-canvas")[0];jQuery.ajax({url:WDT.rest_url+"wedatatools/v1/job-posting-history/month/",method:"GET",data:o,success:function(o){if(!o.success||!o.body||!o.body.month_buckets)return;var r=o.body.month_buckets,n=d.getContext("2d"),i={hiringActivityChart:null,chartData:null,activePosts:[],expiredPosts:[],labels:[],months:null},l=[],c=["J","F","M","A","M","J","J","A","S","O","N","D"],p=["01","02","03","04","05","06","07","08","09","10","11","12"],u=new Date,f=u.getFullYear(),g=u.getMonth();for(a=0;a<60;a++)g<0&&(f-=1,g=11),i.labels.push(c[g]),l.push(f+"-"+p[g]),i.activePosts.push(0),i.expiredPosts.push(0),g-=1;i.labels=i.labels.reverse(),l=l.reverse();let m=-1;for(let t=0;t<l.length;t++){let e=r[l[t]];if(e){parseInt(e.active)+parseInt(e.expired)>0&&-1==m&&(m=t),i.activePosts[t]=e.active,i.expiredPosts[t]=e.expired}}l.length-m>12?months=24:l.length-m>6?months=12:months=6,t(s).find('.wdt-job-posting-history-chart-span[data-months="'+months+'"]').addClass("selected"),jQuery(s).find(".wdt-spinner").css("opacity","0"),i.chartData={labels:i.labels.slice(0-months),datasets:[{label:"Expired Job Postings",backgroundColor:"#999999",borderColor:"#999999",borderWidth:3,data:i.expiredPosts.slice(0-months)},{label:"Active Job Postings",backgroundColor:WDT.colors.primary,borderColor:WDT.colors.primary,borderWidth:3,data:i.activePosts.slice(0-months)}]};i.hiringActivityChart=new Chart(n,{type:"bar",data:i.chartData,options:{maintainAspectRatio:!1,legend:{display:!1},scales:{xAxes:[{stacked:!0,ticks:{fontSize:12}}],yAxes:[{stacked:!0,ticks:{precision:0,fontSize:12}}]},tooltips:{enabled:!1},plugins:{datalabels:{display:!1}}}});let w=e.length;t(s).data("chart-index",w),e.push(i)}})})),jQuery(".wdt-job-posting-history .wdt-job-posting-history-chart-span").on("click",(function(a){jQuery(this).siblings().removeClass("selected"),jQuery(this).addClass("selected");var o=jQuery(this).data("months");let r=t(this).parents(".wdt-job-posting-history").first().data("chart-index");console.log(r);let n=e[r],i=n.chartData,s=n.hiringActivityChart,d=n.activePosts,l=n.expiredPosts,c=n.labels;i.datasets.forEach((function(t){var e=t.label;"Active Job Postings"==e?t.data=d.slice(0-o):"Expired Job Postings"==e&&(t.data=l.slice(0-o))})),i.labels=c.slice(0-o),s.update()}))}})),jQuery((function(t){"use strict";t(".wdt-basic-milestone-progress").length&&(t(document).on("wdt:activate",'[data-target="wdt-milestone-progress-container"] [data-target="wdt-milestone-progress-item"]',(function(e){let a=t(this).prev('[data-target="wdt-milestone-progress-item"]').first();if(a.length)t(a).trigger("wdt:complete");else{let e=t(this).parents('[data-target="wdt-milestone-progress-container"]').first();t(e).find('[data-target="wdt-milestone-progress-item"]').removeClass("wdt-basic-milestone-progress-item-active"),t(e).find('[data-target="wdt-milestone-progress-item"]').removeClass("wdt-basic-milestone-progress-item-complete")}var o;(o=t(this)).addClass("wdt-basic-milestone-progress-item-active").attr("aria-current","step"),o.siblings().each((function(){t(this).removeAttr("aria-current")})),wdtAnnounce(o.attr("aria-label"))})),t(document).on("wdt:complete",'[data-target="wdt-milestone-progress-container"] [data-target="wdt-milestone-progress-item"]',(function(e){let a=t(this).parents('[data-target="wdt-milestone-progress-container"]').first();t(a).find('[data-target="wdt-milestone-progress-item"]').removeClass("wdt-basic-milestone-progress-item-active").removeClass("wdt-basic-milestone-progress-item-complete"),t(this).addClass("wdt-basic-milestone-progress-item-complete"),t(this).prevAll('[data-target="wdt-milestone-progress-item"]').addClass("wdt-basic-milestone-progress-item-complete")}
1)))})),jQuery((function(t){"use strict";t('[data-target="wdt-nav-tabs"] [data-action="wdt-nav-tabs-item"]').on("click",(function(e){t(this).attr("data-tab-target");t(this).parents('[data-target="wdt-nav-tabs"]').first().find('[data-target="wdt-nav-tabs-item"]').attr("data-status","inactive"),t(this).attr("data-status","active"),t(this).trigger("wdt:navigateTab")})),t(document).on("wdt:navigateTab","[data-tab-href]",(function(e){window.location.href=t(this).attr("data-tab-href")}))})),jQuery(document).ready((function(t){"use strict";t('[data-action="wdt-notice-banner-close"]').on("click",(function(e){e.stopPropagation(),e.preventDefault();let a=t(this).parents(".wdt-notice-banner").first();t(a).slideUp(),t(this).attr("aria-pressed",!0);let o=t(a).attr("id");"wdt-job-board-resumes-notice"==o&&wfwe_setCookie("noticeClosed","T",365);let r=wfwe_getCookie("wdtNoticeCooldowns");try{r=JSON.parse(r)}catch(e){r={}}var n=new Date;n.setDate(n.getDate()+1),r[o]=n.getTime(),wfwe_setCookie("wdtNoticeCooldowns",JSON.stringify(r)),wdtAnnounce("Notice closed"),t("#wdt-toolbar")[0].focus(),t(a).trigger("wdt:noticeBarClosed")})),t('#wdt-portal-notification-survey-update [data-action="wdt-notice-banner-close"]').on("click",(function(t){jQuery.ajax({method:"POST",url:"/wp-json/wedatatools/v1/notifications/seen/",data:{event:"survey"},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){},error:function(t){}})})),t('#wdt-portal-notification-email-update [data-action="wdt-notice-banner-close"]').on("click",(function(t){jQuery.ajax({method:"POST",url:"/wp-json/wedatatools/v1/notifications/seen/",data:{event:"email"},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){},error:function(t){}})}))})),jQuery((function(t){"use strict";t(document).on("keydown",'[data-target="portal-table-container"] th[data-sortable="true"]',(function(e){const a=e.key;["Enter"," "].indexOf(a)>=0&&t(this).click()})),t(document).on("click",'[data-target="portal-table-container"] th[data-sortable="true"]',(function(e){let a=t(this).parents("table").first(),o=t(this).attr("data-sort-direction");if("desc"===o)o="asc";else o="desc";let r=t(this).attr("data-column");t(a).find("th[data-sortable]").each((function(){t(this).removeAttr("data-sort-direction").attr("aria-sort","none")}));let n="asc"===o?"ascending":"descending";t(this).attr("data-sort-direction",o).attr("aria-sort",n);let i=t.Event("wdt:tableSort");i._columnSlug=r,i._sortDir=o,t(a).trigger(i),wdtAnnounce(`Sorting table by column ${t(this).find(".wdt-portal-table-head-element-content").text().trim()} ${"desc"===o?"descending":"ascending"}`,!0)}))})),jQuery(document).ready((function(t){"use strict";t(document).on("click",'[data-target="wdt-company-preview-panel-naics-suggestion"]',(function(e){let a=t(this).attr("title"),o=t(this).attr("data-value"),r=t(this).parents(".wdt-preview-panel").first(),n=t(r).find('select[name="naics_suggestion_panel_naics[]"]'),i=t.Event("wdt:select");i.label=a,i.value=o,t(n).trigger(i)})),t('button[data-action="wdt-preview-panel-assign-company-naics"]').on("click",(function(e){let a=t(this).data("nonce"),o=t(this).data("post-id"),r=t(this).parents(".wdt-preview-panel").first().find('select[name="naics_suggestion_panel_naics[]"]').val(),n=this;t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/employers/employer-mgmt/tag/",data:{nonce:a,"post-id":o,"wdt-employer-posting-naics":r},beforeSend:e=>{t(n).text("Assigning..."),t(n).prop("disabled",!0),e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?wdtDisplayNotification("Successfully applied NAICS tags.","success",5e3):wdtDisplayNotification("Could not apply naics tags: "+t.response,"error",-1)},error:function(t){console.log(t),t.responseJSON.response?wdtDisplayNotification("Could not apply naics tags: "+t.responseJSON.response,"error",-1):wdtDisplayNotification("Could not apply naics tags: error making request.","error",-1)},complete:function(){t(n).text("Assigned!"),t(n).prop("disabled",!1)}})})),t('button[data-action="wdt-preview-panel-mark-uncategorized-naics"]').on("click",(function(e){let a=t(this).data("nonce"),o=t(this).data("post-id"),r=[t(this).data("uncategorized-naics")],n=this;t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/employers/employer-mgmt/tag/",data:{nonce:a,"post-id":o,"wdt-employer-posting-naics":r},beforeSend:e=>{t(n).text("Marking..."),t(n).prop("disabled",!0),e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?wdtDisplayNotification("Successfully marked company as uncategorized","success",5e3):wdtDisplayNotification("Could not mark company as uncategorized: "+t.response,"error",-1)},error:function(t){console.log(t),t.responseJSON.response?wdtDisplayNotification("Could not mark company as uncategorized: "+t.responseJSON.response,"error",-1):wdtDisplayNotification("Could not mark company as uncategorized: error making request.","error",-1)},complete:function(){t(n).text("Marked!"),t(n).prop("disabled",!1)}})}))})),jQuery((function(t){"use strict";t(document).on("click",'[data-action="wdt-toggle-preview-panel"]',(e=>{let a=t(e.target).closest(".wdt-preview-panel-header");a.length&&("true"===a.attr("aria-expanded")?a.attr("aria-expanded","fal
1se"):a.attr("aria-expanded","true")),t(e.target).toggleClass("active"),t(e.target).closest(".wdt-preview-panel-header").next(".wdt-preview-panel-content").slideToggle("fast")})),t(document).on("keyup",".wdt-preview-panel-header",(function(e){switch(e.which||e.keyCode){case 13:case 32:e.preventDefault(),t(this).trigger("click")}}))})),jQuery((function(t){"use strict";t(document).on("click",".wdt-skill-tags-compare-chart-tab",(function(e){e.preventDefault();let a=t(this).data("content");t(this).parents(".wdt-skill-tags-compare-chart").first().find(".wdt-skill-tags-compare-chart-tab").removeAttr("selected"),t(this).parents(".wdt-skill-tags-compare-chart").first().find(".wdt-skill-tags-compare-chart-content").removeAttr("selected"),t(this).attr("selected",""),t("#"+a).attr("selected","")}))})),jQuery(document).ready((function(t){"use strict";t(document).on("wdt:addOption",'[data-target="wdt-alphabet-select-container"]',(function(e){let a=e._option;if(a){let e=t(this).attr("data-name"),o=a.text.substring(0,1).toLowerCase(),r=t('[data-target="options"] [data-letter="'+o+'"]');r.length||(r=t('[data-target="options"] [data-letter="misc"]')),r.append('<label class="wdt-alphabet-select-option-label">'+a.text+'<input class="wdt-alphabet-select-letter-checkbox" data-target="checkbox" type="checkbox" name="'+e+'" value="'+a.value+'"></input><span class="wdt-alphabet-select-icon"></span></label>')}}))})),jQuery(document).ready((function(t){"use strict";t(document).on("wdt:initialize",'*[data-date-picker="wdt-material-form"]',(function(e){t(this).trigger("wdtrf:refresh")})),t(document).on("change",'*[data-date-picker="wdt-material-form"]',(function(e){t(this).trigger("wdtrf:refresh")})),t(document).on("click",".wdt-form-date-input-cal-icon",(function(e){let a=t(this).siblings('*[data-date-picker="wdt-material-form"]').first();0!==a.length&&!0!==a.prop("disabled")&&(a.trigger("wdtrf:register"),void 0!==a.data("datepicker")&&a.datepicker("show"))})),t(document).on("wdtrf:refresh",'*[data-date-picker="wdt-material-form"]',(function(e){let a=t(this).parents('[data-target="wdt-material-form-date-input-label"]').first();t(this).prop("disabled")?a.attr("data-disabled","true"):a.attr("data-disabled","false"),t(this).val()?a.addClass("wdt-form-input-progress"):a.removeClass("wdt-form-input-progress")})),t(document).on("wdt:disable",'*[data-date-picker="wdt-material-form"]',(function(e){t(this).prop("disabled",!0),t(this).trigger("wdtrf:refresh")})),t(document).on("wdt:enable",'*[data-date-picker="wdt-material-form"]',(function(e){t(this).prop("disabled",!1),t(this).trigger("wdtrf:refresh")})),t(document).on("wdtrf:unregister",'*[data-date-picker="wdt-material-form"]',(function(e){t(this).data("registered",!1),t(this).removeAttr("id"),t(this).data("datepicker")&&t(this).datepicker("destroy")})),t(document).on("wdtrf:register",'*[data-date-picker="wdt-material-form"]',(function(e){if(t(this).data("registered"))return;t(this).data("registered",!0);let a=t(this).attr("data-datepicker-classes");a&&(a=a.split(" "));let o={dateFormat:t(this).attr("data-date-format"),yearRange:"c-80:c+20",beforeShow:function(){if(a&&Array.isArray(a))for(let e of a)t("#ui-datepicker-div").addClass(e)},onClose:function(){let e=t(this).val();if(""!==e)try{t.datepicker.parseDate(t(this).attr("data-date-format"),e)}catch(e){t.datepicker._clearDate(this),t(this).trigger("change")}},onSelect:function(e){t(this).val(e),t(this).trigger("change")}};t(this).attr("data-min-date")&&(o.minDate=new Date(t(this).attr("data-min-date"))),t(this).attr("data-max-date")&&(o.maxDate=new Date(t(this).attr("data-max-date"))),t(this).attr("data-default-date")&&(o.defaultDate=new Date(t(this).attr("data-default-date"))),"true"===t(this).attr("data-change-year")&&(o.changeYear=!0),"true"===t(this).attr("data-change-month")&&(o.changeMonth=!0),t(this).datepicker(o).keyup((function(e){8!=e.keyCode&&46!=e.keyCode||(t.datepicker._clearDate(this),t(this).trigger("change"))})),t(this).trigger("wdt:initialize")})),t('*[data-date-picker="wdt-material-form"]').length&&t('*[data-date-picker="wdt-material-form"]').each((function(e){t(this).trigger("wdtrf:register")}))})),jQuery(document).ready((function(t){function e(t,e){t.attr("data-disabled",e?"true":"false"),t.find('[data-range-target="src-input"]').prop("disabled",e),t.find(".wdt-date-range-dropdown").trigger(e?"wdt:disable":"wdt:enable"),t.find('[data-range-target="start"], [data-range-target="end"]').prop("disabled",e).trigger("wdtrf:refresh")}t(document).on("change",'[data-target="wdt-material-date-range"] [data-range-target="dropdown"]',(function(e){t(this).parents('[data-target="wdt-material-date-range"]').first().trigger("wdt:refresh")})),t(document).on("change",'[data-target="wdt-material-date-range"] [data-range-target="start"]',(function(e){t(this).parents('[data-target="wdt-material-date-range"]').first().trigger("wdt:refresh")})),t(document).on("change",'[data-target="wdt-material-date-range"] [data-range-target="end"]',(function(e){t(this).parents('[data-target="wdt-material-date-range"]').first().trigger("wdt:refresh")})),t(document).on("wdt:refresh",'[data-target="wdt-material-date-range"]',(function(e){let a=t(this).find('[data-range-target="src-input"]'),o=t(this).find('[data-range-target="dropdown"]'),r=o.val();if("clear"===r)t('[data-target="wdt-material-form-date-input-label"]').hide(),a.val(""),a.attr("data-save-val",""),a.trigger("change");else if("custom"===r){t(this).find(".wdt-date-range-inputs").show().find('[data-target="wdt-material-form-date-input-label"]').show();let e=t(this).find('[data-range-target="start"]'),o=t(this).find('[data-range-target="end"]'),r=(e.val()?e.val():"-1")+"|"+(o.val()?o.val():"-1");a.val(r),a.attr("data-save-val",r),a.trigger("change")}else{t(this).find(".wdt-date-range-inputs").hide();let e=t(o).parents('[data-target="wdt-form-select-combobox-container"]').first(),n=t(e).find('[data-target="wdt-form-select-listbox-item"][value="'+r+'"]').first();a.val(r),a.attr("data-save-val",n.attr("data-save-val")),a.trigger("change")}})),t(document).on("wdt:select",'[data-target="wdt-material-date-range"] [data-target="wdt-form-select-combobox-container"]',(function(t){"custom"===t.value&&wdtAnnounce("Now showing start and end date inputs")})),t(document).on("wdt:initialize",'[data-target="wdt-material-date-range"]',(function(a){let o=t(this).find('[data-range-target="src-input"]');e(t(this),o.prop("disabled")),t(this).trigger("wdt:refresh"),t(this).find('[data-date-picker="wdt-material-form"]').trigger("wdtrf:register")})),t(document).on("wdt:disable",'[data-target="wdt-material-date-range"]',(function(a){e(t(this),!0)})),t(document).on("wdt:enable",'[data-target="wdt-material-date-range"]',(function(a){e(t(this),!1)})),t('[data-target="wdt-material-date-range"]').length&&t('[data-target="wdt-material-date-range"]').each((function(e){t(this).trigger("wdt:initialize")}))})),jQuery(document).ready((function(t){"use strict";t(document).on("wdt:initialize",'*[data-wdt-material-form-target="edit-input"]',(function(e){t(this).trigger("wdtrf:refresh")})),t(document).on("change",'*[data-wdt-material-form-target="edit-input"]',(function(e){t(this).trigger("wdtrf:refresh")})),t(document).on("wdtrf:refresh",'*[data-wdt-material-form-target="edit-input"]',(function(e){let a=t(this).parents('*[data-wdt-material-form-target="edit-input-container"]').first(),o=t(this).val();o?t(a).find('[data-wdt-material-form-target="edit-input-text"]').text(o):t(a).find('[data-wdt-material-form-target="edit-input-text"]').text("")}))})),jQuery(document).ready((function(t){"use strict";const e='[data-rf-target="wdt-material-form-file-input"]';function a(e){const a=t(e).find('input[type="file"]').get(0),o=t(e).find('[data-target="file-upload-filename"]'),r=o.attr("data-empty-text")||"";a&&a.files.length>0?(o.text(a.files[0].name),e.classList.add("has-file")):(o.text(r),e.classList.remove("has-file"))}t(document).on("change",e+' input[type="file"]',(function(){const o=t(this).parents(e).first().get(0);o&&a(o)})),t(document).on("click",e+' [data-target="file-upload-clear"]',(function(o){o.preventDefault(),o.stopPropagation();const r=t(this).parents(e).first().get(0);if(!r)return;const n=t(r).find('input[type="file"]').get(0);n&&(n.value=""),a(r)}))}
1)),jQuery(document).ready((function(t){"use strict";t(document).on("wdt:initialize",'input[data-field-type="captcha"]',(function(){const e=this;if(t(e).data("initialized"))return;if(!window.grecaptcha||"function"!=typeof grecaptcha.render)return void console.error("reCAPTCHA not loaded: grecaptcha.render unavailable");const a=t(e).siblings('[data-target="wdt-recaptcha-element"]').first(),o=a.attr("id"),r=a.attr("data-site-key");if(!o||!r)return void console.error("Missing reCAPTCHA widget element id or site key");const n=grecaptcha.render(o,{sitekey:r,theme:"light",callback:function(a){t(e).val(a||""),t(e).get(0).dispatchEvent(new CustomEvent("wdt:reCaptchaResolved",{bubbles:!0,detail:{token:a}}))}});t(e).attr("data-widget-id",n),t(e).data("initialized",!0)})),t(document).on("wdt:resolveInvisRecaptcha",'[data-field-type="captcha"][data-invis]',(function(){const e=t(this).attr("data-widget-id"),a=Number(e);Number.isFinite(a)?window.grecaptcha&&"function"==typeof grecaptcha.execute?"function"==typeof grecaptcha.ready?grecaptcha.ready((()=>grecaptcha.execute(a))):grecaptcha.execute(a):console.error("reCAPTCHA not loaded: grecaptcha.execute unavailable"):console.error("Invalid/missing data-widget-id for invis recaptcha field",this)}))})),jQuery(document).ready((function(t){"use strict";var e=0;t(document).on("wdt:initialize",'[data-target="wdt-form-select-combobox-container"]',(function(a){let o="wdt-select-combobox-derived-"+e++,r=o+"-combobox",n=o+"-listbox",i=o+"-label";t(this).find('[data-target="wdt-form-select-label"]').first().length&&(t(this).find('[data-target="wdt-form-select-label"]').attr("id",i),t(this).find('[data-target="wdt-form-select-combobox"]').attr("aria-labelledby",i),t(this).find('[data-target="wdt-form-select-listbox"]').attr("aria-labelledby",i)),t(this).find('[data-target="wdt-form-select-combobox"]').attr("id",r),t(this).find('[data-target="wdt-form-select-combobox"]').attr("aria-controls",n),t(this).find('[data-target="wdt-form-select-listbox"]').attr("id",n),t(this).find('[data-target="wdt-form-select-input"]').prop("disabled")?(t(this).attr("data-disabled","true"),t(this).find('[data-action="wdt-form-select-combobox"]').attr("tabindex","-1")):t(this).attr("data-disabled","false"),t(this).trigger("wdt:selectRefresh")})),t(document).on("wdt:disable",'[data-target="wdt-form-select-combobox-container"]',(function(e){e.stopPropagation(),t(this).attr("data-disabled","true"),t(this).find('[data-target="wdt-form-select-input"]').prop("disabled",!0),t(this).find('[data-action="wdt-form-select-combobox"]').attr("tabindex","-1")})),t(document).on("wdt:enable",'[data-target="wdt-form-select-combobox-container"]',(function(e){e.stopPropagation(),t(this).attr("data-disabled","false"),t(this).find('[data-target="wdt-form-select-input"]').prop("disabled",!1),t(this).find('[data-action="wdt-form-select-combobox"]').attr("tabindex","0")})),t(document).on("wdt:selectRefresh",'[data-target="wdt-form-select-combobox-container"]',(function(e){let a=t(this).find('[data-target="wdt-form-select-listbox-item"]'),o=!1;a.each((function(e){"true"==t(this).attr("data-selected")&&(o=!0)})),o?t(this).addClass("wdt-form-input-progress"):t(this).removeClass("wdt-form-input-progress")})),t(document).on("wdt:clearOptions",'[data-target="wdt-form-select-combobox-container"]',(function(e){t(this).find('[data-target="wdt-form-select-listbox"]').empty();let a=t.Event("wdt:select");a.value=null,t(this).trigger(a)})),t(document).on("wdt:removeOption",'[data-target="wdt-form-select-combobox-container"]',(function(e,a){if(t(this).find('[data-target="wdt-form-select-listbox"] [data-target="wdt-form-select-listbox-item"][value="'+a+'"]').remove(),a===t(this).find('[data-target="wdt-form-select-input"]').val()){let e=t.Event("wdt:select");e.value=null,t(this).trigger(e)}})),t(document).on("wdt:addOption",'[data-target="wdt-form-select-combobox-container"]',(function(e,a,o,r){let n=t(this).find('[data-target="wdt-form-select-listbox"]');t("<div>").addClass("wdt-form-select-option").attr("role","option").attr("data-action","wdt-form-select-listbox-item").attr("data-target","wdt-form-select-listbox-item").attr("data-label",o).attr("title",o).attr("value",a).attr("data-selected","false").attr("aria-selected","false").text(o).appendTo(n)})),t(document).on("wdt:select",'[data-target="wdt-form-select-combobox-container"]',(function(e){let a=e.value,o=t(this).find('[data-action="wdt-form-select-listbox-item"][value="'+a+'"]');if(o.length)t(this).find('[data-target="wdt-form-select-combobox-text"]').text(t(o).text()),t(this).find('[data-target="wdt-form-select-combobox"]').attr("title",t(o).text()),t(this).find('[data-target="wdt-form-select-input"]').attr("value",a).val(a),t(this).find('[data-target="wdt-form-select-input"]').trigger("change");else{let e=t(this).find('[data-target="wdt-form-select-combobox"]').attr("data-prompt");t(this).find('[data-target="wdt-form-select-combobox-text"]').text(e),t(this).find('[data-target="wdt-form-select-combobox"]').attr("title",e),t(this).find('[data-target="wdt-form-select-input"]').attr("value","").val(""),t(this).find('[data-target="wdt-form-select-input"]').trigger("change")}t(this).find('[data-action="wdt-form-select-listbox-item"]').attr("data-selected","false").attr("aria-selected","false"),t(o).attr("data-selected","true").attr("aria-selected","true"),t(this).find('[data-target="wdt-form-select-combobox"]').blur(),t(this).trigger("wdt:selectRefresh")})),t(document).on("mousedown",'[data-target="wdt-form-select-combobox-container"] [data-target="wdt-form-select-listbox"]',(function(t){t.preventDefault(),t.stopPropagation()})),t(document).on("mousedown",'[data-action="wdt-form-select-listbox-item"]',(function(e){let a=t(this).parents('[data-target="wdt-form-select-combobox-container"]').first(),o=t(this).attr("value"),r=t.Event("wdt:select");r.value=o,t(a).trigger(r)})),t(document).on("click",'[data-target="wdt-form-select-combobox-container"] label',(function(e){let a=t(this).parents('[data-target="wdt-form-select-combobox-container"]').first();t(a).find('[data-action="wdt-form-select-combobox"]').first().focus(),t(a).find('[data-action="wdt-form-select-combobox"]').first().click()})),t(document).on("click",'[data-action="wdt-form-select-combobox"]',(function(e){let a=t(this).parents('[data-target="wdt-form-select-combobox-container"]').first();"true"!==a.attr("data-disabled")&&("true"==a.attr("data-open")?t(this).trigger("wdt:close"):t(this).trigger("wdt:open"))})),t(document).on("wdt:open",'[data-action="wdt-form-select-combobox"]',(function(e){let a=t(this).siblings('[data-target="wdt-form-select-listbox"]');a.css("display","block");let o=t(this).parents('[data-target="wdt-form-select-combobox-container"]').first();o.attr("data-open","true"),o.find('[role="combobox"]').attr("aria-expanded","true");
1let r=t(o)[0].getBoundingClientRect();window.innerHeight-r.bottom<250?t(a).addClass("wdt-display-above"):t(a).removeClass("wdt-display-above"),t('[data-target="wdt-form-select-listbox-item"]').attr("id",""),t(a).find('[data-target="wdt-form-select-listbox-item"]').each((function(e){t(this).attr("id","wdt-material-form-listbox-item-"+e)})),t(o).trigger("wdt:selectRefresh")})),t(document).on("wdt:close",'[data-action="wdt-form-select-combobox"]',(function(e){t(this).siblings('[data-target="wdt-form-select-listbox"]').css("display","none");let a=t(this).parents('[data-target="wdt-form-select-combobox-container"]').first();a.attr("data-open","false"),a.find('[role="combobox"]').attr("aria-expanded","false"),t('[data-target="wdt-form-select-listbox-item"]').attr("id",""),t(a).trigger("wdt:selectRefresh")})),t(document).on("focusout",'[data-action="wdt-form-select-combobox"]',(function(e){t(this).trigger("wdt:close")})),t(document).on("wdt:makeActive",'[data-target="wdt-form-select-listbox-item"]:not([disabled])',(function(e){let a=t(this).parents('[data-target="wdt-form-select-combobox-container"]').first(),o=t(a).find('[data-target="wdt-form-select-combobox"]'),r=t(a).find('[data-target="wdt-form-select-listbox"]');t(o).attr("aria-activedescendant",t(this).attr("id")),t('[data-target="wdt-form-select-listbox-item"]').removeClass("focussed"),t(this).addClass("focussed");let n=t(this)[0].offsetTop,i=t(r)[0].scrollTop;n-i>200||n-i<0?t(r)[0].scrollTop=n:(n+t(this)[0].offsetHeight-i>200||n-i<0)&&(t(r)[0].scrollTop=n+t(this)[0].offsetHeight-200+1)})),t(document).on("wdt:randomSelect",'[data-target="wdt-form-select-combobox-container"]',(function(e){let a=t(this).find('[data-target="wdt-form-select-listbox-item"][value]'),o=a.length;if(o>0){let e=Math.floor(Math.random()*o),r=t.Event("wdt:select");r.value=t(a.get(e)).attr("value"),t(this).trigger(r)}})),t(document).on("keydown",'[data-action="wdt-form-select-combobox"]',(function(e){let a,o,r,n=e.which||e.keyCode,i=t(this).siblings('[data-target="wdt-form-select-listbox"]'),s=t(this).parents('[data-target="wdt-form-select-combobox-container"]').first();if("true"===s.attr("data-disabled"))return;let d=this,l=t(this).data("inputBuffer");switch(l||(l=""),32==n&&l&&(e.preventDefault(),e.stopPropagation(),n=-1),n){case 27:return t(this).siblings('[data-target="wdt-form-select-listbox"]').css("display","none"),s.attr("data-open","false"),t(s).trigger("wdt:selectRefresh"),!1;case 40:return t(this).trigger("wdt:open"),a=t(this).attr("aria-activedescendant"),o=t("#"+a),r=[],r=o.length?o.nextAll('[data-target="wdt-form-select-listbox-item"]:not([disabled])').first():i.find('[data-target="wdt-form-select-listbox-item"]:not([disabled])').first(),r.length&&t(r).trigger("wdt:makeActive"),e.preventDefault(),e.stopPropagation(),!1;case 38:return a=t(this).attr("aria-activedescendant"),o=t("#"+a),r=[],o.length&&(r=o.prevAll('[data-target="wdt-form-select-listbox-item"]:not([disabled])').first()),r.length?t(r).trigger("wdt:makeActive"):(t(this).trigger("wdt:close"),t(this).attr("aria-activedescendant","")),e.preventDefault(),e.stopPropagation(),!1;case 32:case 13:return t(this).siblings('[data-target="wdt-form-select-listbox"]').is(":visible")?(a=t(this).attr("aria-activedescendant"),o=t("#"+a),o.length&&(o.trigger("mousedown"),t(this).focus())):t(this).trigger("wdt:open"),e.preventDefault(),e.stopPropagation(),!1;case 9:t(this).siblings('[data-target="wdt-form-select-listbox"]').is(":visible")&&(a=t(this).attr("aria-activedescendant"),o=t("#"+a),o.length&&o.trigger("mousedown"));break;default:let n=e.key;if(1==n.length){t(this).trigger("wdt:open");let e=!1;n==l?(e=!0,l=n):l+=n,t(this).data("inputBuffer",l);let a=t(this).data("clearBufferJobID");a&&clearTimeout(a),a=setTimeout((function(e){t(e).data("inputBuffer","")}),750,d),t(this).data("clearBufferJobID",a);let o=null,r=!1;t(i).find('[data-target="wdt-form-select-listbox-item"]:not([disabled])').each((function(a){let n=t(this).attr("title").toLowerCase(),i=l.toLowerCase();if(0==n.indexOf(i)){if(!e)return o=this,!1;"true"==t(this).attr("aria-selected")?r=!0:!r&&o||(r=!1,o=this)}})),o&&t(o).trigger("wdt:makeActive")}}})),t('[data-target="wdt-form-select-combobox-container"]').length&&t('[data-target="wdt-form-select-combobox-container"]').each((function(e){t(this).trigger("wdt:selectRefresh"),t(this).trigger("wdt:initialize")}))})),jQuery(document).ready((function(t){"use strict";t(document).on("click",'*[data-rf-target="wdt-material-form-text-input-label"] [data-action="show-password"]',(function(e){let a=t(this).parents('*[data-rf-target="wdt-material-form-text-input-label"]').first(),o=t(a).find('[data-rf-target="wdt-material-form-text-input"]');"password"===t(o).attr("type")?(t(this).attr("aria-label","Hide password"),wdtAnnounce("Showing password"),t(o).attr("type","text"),t(a).find('[data-target="pw-off"]').hide(),t(a).find('[data-target="pw-on"]').show()):(t(this).attr("aria-label","Show password"),wdtAnnounce("Hiding password"),t(o).attr("type","password"),t(a).find('[data-target="pw-off"]').show(),t(a).find('[data-target="pw-on"]').hide())}))}));class WDTTypeahead{constructor(t){this.element=t}getAction(){let t=this.element.closest('[data-typeahead-target="wdt-ajax-select-container"]');return t?t.getAttribute("data-action"):""}setAction(t){let e=this.element.closest('[data-typeahead-target="wdt-ajax-select-container"]');e&&e.setAttribute("data-action",t)}}var wdtAjaxSelectCurAjaxRequest,wdtAjaxSelectCurTimeout;function wdtAjaxSelectInputClick(t){if(wdtIsAjaxSelectDisabled(t.target))return;let e,a=jQuery,o=a(t.target);if(o.hasClass("wdt-ajax-select-input-container"))e=a(o);else{if(o.hasClass("wdt-ajax-select-input-tag-remove"))return;e=o.parents(".wdt-ajax-select-input-container").first()}e.length&&(setTimeout((function(){a(e).find(".wdt-ajax-select-input").get(0).focus()}),1),a(e).find(".wdt-ajax-select-input").trigger("input"))}function wdtAjaxSelectClearAllEvent(t){if(wdtIsAjaxSelectDisabled(t.target))return;
1let e=jQuery,a=e(t.target),o=e(a).parents(".wdt-ajax-select-container").first();t.preventDefault(),t.stopPropagation(),wdtAjaxSelectClearAll(o)}function wdtAjaxSelectKeyUp(t){let e=t.which||t.keyCode;if([27,40,38,13,8].includes(e))return t.preventDefault(),t.stopPropagation(),!1}function wdtAjaxSelectInputKeydown(t){if(wdtIsAjaxSelectDisabled(t.target))return;let e,a,o,r,n,i,s=jQuery,d=t.which||t.keyCode,l=s(t.target),c=s(l).parents(".wdt-ajax-select-container").first(),p=c.find(".wdt-ajax-select-search-results"),u=c.find(".wdt-ajax-select-input"),f=c.attr("data-usedynamicoptions");switch(d){case 27:return s(c).find(".wdt-ajax-select-search-results").empty(),u.val(""),u.attr("aria-busy","false"),u.attr("aria-expanded","false"),t.preventDefault(),t.stopPropagation(),!1;case 40:if(e=s(l).attr("aria-activedescendant"),a=s("#"+e),o=[],o=a.length?a.nextAll(".wdt-ajax-select-search-results-result:not([disabled])").first():c.find(".wdt-ajax-select-search-results-result:not([disabled])").first(),o.length){s(l).attr("aria-activedescendant",o.attr("id")),a.removeClass("wdt-active-descendant"),o.addClass("wdt-active-descendant");let t=o[0].offsetTop,e=p[0].scrollTop;(t+o[0].offsetHeight-e>200||t-e<0)&&(p[0].scrollTop=t+o[0].offsetHeight-200+1)}else a.length||u.trigger("input");return t.preventDefault(),t.stopPropagation(),!1;case 38:if(e=s(l).attr("aria-activedescendant"),a=s("#"+e),o=[],a.length&&(o=a.prevAll(".wdt-ajax-select-search-results-result:not([disabled])").first()),o.length){s(l).attr("aria-activedescendant",o.attr("id")),a.removeClass("wdt-active-descendant"),o.addClass("wdt-active-descendant");let t=o[0].offsetTop,e=p[0].scrollTop;(t-e>200||t-e<0)&&(p[0].scrollTop=t)}else s(c).find(".wdt-ajax-select-search-results").empty(),u.attr("aria-busy","false"),u.attr("aria-expanded","false");return t.preventDefault(),t.stopPropagation(),!1;case 32:case 13:if(e=s(l).attr("aria-activedescendant"),a=s("#"+e),a.length)return a.trigger("click"),t.preventDefault(),t.stopPropagation(),!1;if(f&&u.val()&&32!==d)return s(c).trigger("wdt:flushinput"),t.stopPropagation(),t.preventDefault(),!1;break;case 8:let g=s(l).val(),m=s(c).find(".wdt-ajax-select-input-tag").last();if(0==g.length&&m.length){let e=m.find(".wdt-ajax-select-input-tag-text").text(),a=s.Event("wdt:removeselection");return a._value=m.attr("data-value"),s(c).trigger(a),s(l).val(e),t.preventDefault(),t.stopPropagation(),u.trigger("input"),!1}break;case 34:if(e=s(l).attr("aria-activedescendant"),a=s("#"+e),r=c.find(".wdt-ajax-select-search-results-result:not([disabled])"),i=0,i=a.length?r.index(a):-1,n=Math.min(i+10,r.length-1),o=r.eq(n),o.length){s(l).attr("aria-activedescendant",o.attr("id")),a.length&&a.removeClass("wdt-active-descendant"),o.addClass("wdt-active-descendant");let t=o[0].offsetTop;p[0].scrollTop=t}t.preventDefault(),t.stopPropagation();break;case 33:if(e=s(l).attr("aria-activedescendant"),a=s("#"+e),r=c.find(".wdt-ajax-select-search-results-result:not([disabled])"),i=0,i=a.length?r.index(a):-1,n=Math.max(i-10,0),o=r.eq(n),o.length){s(l).attr("aria-activedescendant",o.attr("id")),a.length&&a.removeClass("wdt-active-descendant"),o.addClass("wdt-active-descendant");let t=o[0].offsetTop;p[0].scrollTop=t}t.preventDefault(),t.stopPropagation();break;case 36:if(e=s(l).attr("aria-activedescendant"),a=s("#"+e),r=c.find(".wdt-ajax-select-search-results-result:not([disabled])"),n=0,o=r.eq(n),o.length){s(l).attr("aria-activedescendant",o.attr("id")),a.length&&a.removeClass("wdt-active-descendant"),o.addClass("wdt-active-descendant");let t=o[0].offsetTop;p[0].scrollTop=t}t.preventDefault(),t.stopPropagation();break;case 35:if(e=s(l).attr("aria-activedescendant"),a=s("#"+e),r=c.find(".wdt-ajax-select-search-results-result:not([disabled])"),n=r.length-1,o=r.eq(n),o.length){s(l).attr("aria-activedescendant",o.attr("id")),a.length&&a.removeClass("wdt-active-descendant"),o.addClass("wdt-active-descendant");let t=o[0].offsetTop;p[0].scrollTop=t}t.preventDefault(),t.stopPropagation();break;case 9:c.find(".wdt-ajax-select-search-results").empty(),u.attr("aria-busy","false"),u.attr("aria-expanded","fal
1se"),u.attr("aria-activedescendant","")}}function wdtAjaxSelectClearAll(t){if(wdtIsAjaxSelectDisabled(t))return;let e=jQuery,a=t.find("select.wdt-ajax-select-source");e(a).find("option").prop("selected",!1).removeAttr("selected"),e(a).prop("multiple")?e(a).val([]):e(a).val(""),wdtRefreshAjaxSelectOptions(t),e(a).trigger("change")}function wdtRefreshAjaxSelectOptions(t){let e=jQuery,a=t.find("select.wdt-ajax-select-source"),o=t.find(".wdt-ajax-select-input-container"),r=t.find(".wdt-ajax-select-search-results"),n=[],i=[],s=a.find("option");s.length&&s.each((function(t){let a=e(this).attr("value"),s=e(this).text(),d=e(this).attr("selected"),l=r.find('.wdt-ajax-select-search-results-result[data-value="'+a+'"]'),c=o.find('.wdt-ajax-select-input-tag[data-value="'+a+'"]');if(d){if(l.length&&l.attr("aria-selected","true"),!c.length){let t=e('<div role="option" aria-selected="true" class="wdt-ajax-select-input-tag" data-value="'+a+'"><span title="'+s+'" class="wdt-ajax-select-input-tag-text">'+s+'</span><button class="wdt-ajax-select-input-tag-remove" aria-label="Remove '+e("<span>").text(s).html()+'">×</button></div>');e(t).insertBefore(o.find(".wdt-ajax-select-input"))}i.push(a),n.push(s)}else l.length&&l.attr("aria-selected","false"),c.length&&(c.remove(),o.find("input.wdt-ajax-select-input")[0].focus(),wdtAnnounce(`Removed ${s}`,!0))})),e(a).data("value-labels",n),a.val(i)}function wdtRenderAjaxSelectResultItem(t,e){let a=jQuery,o=e.find("select.wdt-ajax-select-source"),r=e.find(".wdt-ajax-select-input").val(),n=a.Event("wdt:ajaxresult"),i=t;if(i.value=t.id,n.resultObj=i,a(o).trigger(n),!n.isDefaultPrevented()){let n=a(e).find(".wdt-ajax-select-search-results-result:not(.invalid-result)").length,i=t.label||t.text;if(r){r=r.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");let t=i.match(new RegExp(r,"gi"));if(t&&t.length)for(let e of t){let t=e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+"(?![^<]*>)";i=i.replace(new RegExp(t,"g"),'<span class="wdt-ajax-select-matched-text">'+e+"</span>")}}let s=a('<li id="wdt-ajax-select-search-results-result-'+n+'" tabindex="-1" aria-selected="false" role="option" class="wdt-ajax-select-search-results-result" data-depth="'+t.depth+'" data-value="'+t.id+'" data-text="'+a("<span>").text(t.text).html()+'"'+(t.disabled?" disabled":"")+">"+i+"</li>");a(e).find(".wdt-ajax-select-search-results").append(s);let d=a.Event("wdt:ajaxresultfilter");d._option=s,a(o).trigger(d)}}function wdtAjaxSelectBuildConfig(t,e,a,o){let r={query:t.query};t.page&&(r.page=t.page),t.use_slugs&&(r.use_slugs=t.use_slugs),t.all_option&&(r.all_option=t.all_option),parseInt(t.user_id)>0&&(r.user_id=t.user_id),parseInt(t.suggester_id)>0&&(r.suggester_id=t.suggester_id),t.include_children&&(r.include_children=!0),t.nonce&&(r.nonce=t.nonce);let n={url:t.action,method:"get",data:r,success:function(t){t.req=r,jQuery(e).trigger("wdt:ajaxResults",t),a(t)},complete:o};return WDT&&WDT.rest_nonce&&(n.beforeSend=function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)}),n}function wdtIsAjaxSelectDisabled(t){let e;return e=jQuery(t).hasClass(".wdt-ajax-select-container")?t:jQuery(t).parents(".wdt-ajax-select-container").first(),"true"==jQuery(e).attr("data-disabled")}function wdtToggleAjaxSelectLoading(t,e){if(e){jQuery(t).attr("data-loading",!0);let e=jQuery(t).find("input.wdt-ajax-select-input");wdtAnnounce("Loading results",!0),e.attr("aria-busy","true"),e.attr("aria-expanded","false")}else{jQuery(t).attr("data-loading",!1),jQuery(t).find("input.wdt-ajax-select-input").attr("aria-busy","false")}}function wdtToggleAjaxSelectResults(t,e){e?jQuery(t).addClass("wdt-ajax-select-expanded"):jQuery(t).removeClass("wdt-ajax-select-expanded")}function initializeArchiveTable(t){jQuery(t).data("attemptedInitialization",!0),jQuery(t).data("ready")&&jQuery(t).trigger("wdt:initializeArchiveTable")}function wdtUpdateArchiveTableScrollShadow(t){if(t){var e=jQuery(t).siblings(".wdt-archive-table-scroll-shadow").get(0);if(e)if(t.getAttribute("data-shadow-suppressed"))jQuery(e).removeClass("wdt-has-scroll-shadow");else{var a=t.scrollWidth>t.clientWidth+1,o=t.scrollLeft+t.clientWidth>=t.scrollWidth-1;jQuery(e).toggleClass("wdt-has-scroll-shadow",a&&!o)}}}function wdtFitArchiveTableCustomColumnsDropdown(t){if(t){var e=jQuery(t),a=e.find(".wdt-archive-table-scroll-container").first().get(0),o=e.find(".wdt-archive-table-scroll-inner").first().get(0);if(a&&o){var r=e.find(".wdt-archive-table-custom-columns-form-container").first(),n=r.length>0&&r.hasClass("wdt-open");if(o.style.transform="",n){var i=Math.ceil(o.getBoundingClientRect().width-a.getBoundingClientRect().width);i>0&&(o.style.transform="translateX(-"+i+"px)")}e.trigger("wdt:archiveTableColumnsMenu",[n])}}}jQuery(document).ready((function(t){var e=0;function a(e,a,o,r,n,i){wdtAjaxSelectCurAjaxRequest&&wdtAjaxSelectCurAjaxRequest.abort(),wdtToggleAjaxSelectLoading(r,!0),n||t(r).find(".wdt-ajax-select-search-results").empty();let s=t('<li class="wdt-ajax-select-search-results-result invalid-result" disabled>Searching...</li>');t(r).find(".wdt-ajax-select-search-results").append(s);let d=wdtAjaxSelectBuildConfig({query:a,page:o,use_slugs:"true"==t(r).attr("data-useslugs"),all_option:"true"==t(r).attr("data-alloption"),user_id:t(r).attr("data-userid"),suggester_id:t(r).attr("data-suggesterid"),include_children:"true"==t(r).attr("data-includechildren"),nonce:t(r).attr("data-nonce"),callback:i,loading:s,action:e},r,i,(function(){t(r).find("input.wdt-ajax-select-input").attr("aria-busy","false"),wdtToggleAjaxSelectLoading(r,!1),wdtAnnounce("Loaded, press down arrow to see results",!0),s.remove()}));t(r).trigger("wdt:beforeAjaxRequest",d),wdtAjaxSelectCurAjaxRequest=jQuery.ajax(d),t(r).data("ajaxConfig",null)}t(document).on("wdt:initialize",'[data-typeahead-target="wdt-ajax-select-container"]',(function(a){let o=t(this).find('[data-target="wdt-ajax-select-input"]'),r=t(o).attr("id");(!r||t("#"+r).length>1)&&(r="wdt-ajax-select-input-derived-"+e);let n=t(this).find('[data-target="results-listbox"]'),i=t(n).attr("id");(!i||t("#"+i).length>1)&&(i="wdt-ajax-select-results-derived-"+e),n.length&&t(n).attr("id",i),o.length&&(t(o).attr("id",r),t(o).attr("aria-controls",i));let s=t(this).find('[data-target="wdt-ajax-select-label"]');s.length&&t(s).attr("for",r),e++})),t(document).on("wdt:disable",".wdt-ajax-select-container",(function(e){t(this).attr("data-disabled",!0),t(this).find(".wdt-ajax-select-input").prop("disabled",!0),t(this).find("select.wdt-ajax-select-source").prop("disabled",!0)})),t(document).on("wdt:undisable",".wdt-ajax-select-container",(function(e){t(this).attr("data-disabled",!1),t(this).find(".wdt-ajax-select-input").prop("disabled",!1),t(this).find("select.wdt-ajax-select-source").prop("disabled",!1)})),t(document).on("wdt:refresh",".wdt-ajax-select-container",(function(e){wdtRefreshAjaxSelectOptions(t(this))})),t(document).on("wdt:flushinput",".wdt-ajax-select-container",(function(e){let a=t(this).attr("data-usedynamicoptions"),o=t(this).find(".wdt-ajax-select-input");if(a&&o.val()){let e=o.val(),a=o.val(),r=t.Event("wdt:select");r.value=e,r.label=a,t(this).trigger(r)}t(this).trigger("wdt:clearinput")})),t(document).on("wdt:clearinput",".wdt-ajax-select-container",(function(e){t(this).find(".wdt-ajax-select-input").val(""),t(this).find(".wdt-ajax-select-search-results").empty()})),t(document).on("wdt:select",".wdt-ajax-select-container",(function(e){let a=e.value,o=e.label,r=t(this).find("select.wdt-ajax-select-source"),n=t.Event("wdt:beforeselect"),i={value:a,text:o};if(n.selected=i,r.trigger(n),n.isDefaultPrevented())return;let s=t(r).attr("multiple"),d=r.find('option[value="'+a+'"]');if(!s){t(r).find("option[selected]").attr("selected",!1),t(this).trigger("wdt:clearinput"),t(this).find(".wdt-ajax-select-input").blur()}if(d.length)d.attr("selected",!0);else{let e=t('<option value="'+a+'" selected>'+o+"</option>");r.append(e)}t(this).attr("data-clearonselect")&&t(this).trigger("wdt:clearinput"),wdtRefreshAjaxSelectOptions(t(this)),t(r).trigger("change");let l=t.Event("wdt:afterselect");l.selected=i,t(r).trigger(l),r.closest('[data-typeahead-target="wdt-ajax-select-container"]').find("input.wdt-ajax-select-input")[0].focus()})),t(document).on("wdt:removeselection",".wdt-ajax-select-container",(function(e){let a=e._value,o=t(this).find("select.wdt-ajax-select-source"),r=o.find('option[value="'+a+'"]');if(r.length){r.attr("selected",!1),wdtRefreshAjaxSelectOptions(t(this)),t(o).trigger("change");let e=t.Event("wdt:removedselection");e._selection={value:t(r).attr("value"),text:t(r).text()},t(this).trigger(e)}})),t(document).on("input",".wdt-ajax-select-container .wdt-ajax-select-input",(function(e){if(wdtIsAjaxSelectDisabled(this))return;t(".wdt-ajax-select-search-results").empty();let o=t(this).parents(".wdt-ajax-select-container").first(),r=t(o)[
10].getBoundingClientRect();window.innerHeight-r.bottom<250?t(o).find(".wdt-ajax-select-search-results").addClass("wdt-display-above"):t(o).find(".wdt-ajax-select-search-results").removeClass("wdt-display-above");let n=t(this).val();if("true"==o.attr("data-uselocaloptions")){return t(o).find(".wdt-ajax-local-options>*").each((function(e){if(t(this).text().toLowerCase().includes(n.toLowerCase().trim())||""==n){let a=t(this).clone();a.attr("id","wdt-ajax-select-search-results-local-result-"+e),a.attr("tabindex","-1"),t(o).find(".wdt-ajax-select-search-results").append(a)}})),void wdtRefreshAjaxSelectOptions(o)}t(o).attr("data-page",!1),t(o).attr("data-pagination",!1),t(this).attr("aria-activedescendant",""),clearTimeout(wdtAjaxSelectCurTimeout),wdtAjaxSelectCurAjaxRequest&&wdtAjaxSelectCurAjaxRequest.abort();let i=o.attr("data-action");i&&(wdtAjaxSelectCurTimeout=setTimeout(a,500,i,n,1,o,!1,(function(e){let a=e.results;if(a.length<1){wdtAnnounce("No results found using this filter");let e=t('<li class="wdt-ajax-select-search-results-result invalid-result" disabled>No results found.</li>');t(o).find(".wdt-ajax-select-search-results").append(e)}else{t(o).find(".wdt-ajax-select-input").attr("aria-expanded","true");for(let t of a)wdtRenderAjaxSelectResultItem(t,o)}e.pagination&&e.pagination.more?(t(o).attr("data-page",2),t(o).attr("data-pagination",!0)):t(o).attr("data-pagination",!1),wdtRefreshAjaxSelectOptions(o)})))})),t(document).on("click","label",(function(e){if(wdtIsAjaxSelectDisabled(this))return;let a=t(this).find(".wdt-ajax-select-container"),o=t(this).attr("for");if(o){let e=t("#"+o);e.hasClass("wdt-ajax-select-source")&&(a=e.parents(".wdt-ajax-select-container").first())}return a.length?(e.preventDefault(),e.stopPropagation(),t(a).find(".wdt-ajax-select-input").get(0).focus(),void t(a).find(".wdt-ajax-select-input").trigger("input")):void 0})),t(document).on("focusout",".wdt-ajax-select-container",(function(e){t(this)[0].contains(document.activeElement)||(t(this).attr("data-page",!1),t(this).attr("data-pagination",!1),t(this).find(".wdt-ajax-select-search-results").empty(),t(this).find(".wdt-ajax-select-input").attr("aria-activedescendant",""),t(this).trigger("wdt:flushinput"),wdtToggleAjaxSelectResults(this,!1))})),t(document).on("focusin",".wdt-ajax-select-container",(function(t){wdtToggleAjaxSelectResults(this,!0)})),document.addEventListener("scroll",(function(e){let o=e.target;t(o).hasClass("wdt-ajax-select-search-results")&&t(o).scrollTop()+t(o).innerHeight()>=t(o)[0].scrollHeight-20&&function(e){let o=t(e).parents(".wdt-ajax-select-container").first(),r=t(o).find("input.wdt-ajax-select-input"),n=t(o).find(".wdt-ajax-select-search-results");if(t(n).is(":empty"))return;if("true"==t(o).attr("data-loading"))return;let i=t(o).attr("data-pagination"),s=t(o).attr("data-page");if("true"==i&&s){a(t(o).attr("data-action"),t(r).val(),s,o,!0,(function(e){let a=e.results;if(a.length<1){wdtAnnounce("No more results found");let e=t('<li class="wdt-ajax-select-search-results-result invalid-result" disabled>No results found.</li>');t(o).find(".wdt-ajax-select-search-results").append(e)}else for(let t of a)wdtRenderAjaxSelectResultItem(t,o);e.pagination&&e.pagination.more?(t(o).attr("data-page",parseInt(s)+1),t(o).attr("data-pagination",!0)):t(o).attr("data-pagination",!1),wdtRefreshAjaxSelectOptions(o)}))}}(o)}),!0),t(document).on("mousedown",".wdt-ajax-select-search-results-result, .wdt-ajax-select-search-results",(function(t){t.preventDefault(),t.stopPropagation()})),t(document).on("click",".wdt-ajax-select-search-results-result",(function(e){if(wdtIsAjaxSelectDisabled(this))return;if(e.preventDefault(),e.stopPropagation(),"true"===t(this).attr("aria-selected")||t(this).attr("selected")||t(this).attr("disabled"))return;let a=t(this).parents(".wdt-ajax-select-container").first();a.find(".wdt-ajax-select-input").attr("aria-expanded","false"),a.find(".wdt-ajax-select-input")[0].focus();let o=t(this).attr("data-value"),r=t(this).attr("data-text")||t(this).text(),n=t.Event("wdt:select");n.value=o,n.label=r,t(a).trigger(n)})),t(document).on("wdt-clearall",".wdt-ajax-select-container",(function(e){wdtAjaxSelectClearAll(t(this))})),t(document).on("click",".wdt-ajax-select-input-tag-remove",(function(e){if(wdtIsAjaxSelectDisabled(this))return;e.preventDefault(),e.stopPropagation();let a=t(this).parents(".wdt-ajax-select-container").first(),o=t(this).parents(".wdt-ajax-select-input-tag").first().attr("data-value"),r=t.Event("wdt:removeselection");r._value=o,t(a).trigger(r)})),t(document).on("keydown",".wdt-ajax-select-search-results-result",(function(e){let a=e.which||e.keyCode,o=t(this).parents(".wdt-ajax-select-container").first(),r=o.find(".wdt-ajax-select-input"),n=o.find(".wdt-ajax-select-search-results-result:not([disabled])");if(9===a){if(e.shiftKey){let t=n.eq(n.index(this)-1);t.length&&n.index(this)>0?t[0].focus():r[0].focus()}else{let t=n.index(this)+1,e=n.eq(t);e.length?e[0].focus():r[0].focus()}e.preventDefault(),e.stopPropagation()}else if(13===a||32===a)t(this).trigger("click"),e.preventDefault(),e.stopPropagation();else if(27===a)o.find(".wdt-ajax-select-search-results").empty(),r.attr("aria-busy","false"),r.attr("aria-expanded","fal
1se"),r[0].focus(),e.preventDefault(),e.stopPropagation();else if(40===a){let t=n.eq(n.index(this)+1);t.length&&t[0].focus(),e.preventDefault()}else if(38===a){let t=n.index(this)-1;t>=0?n.eq(t)[0].focus():r[0].focus(),e.preventDefault()}})),t('[data-typeahead-target="wdt-ajax-select-container"]').trigger("wdt:initialize")})),jQuery(document).ready((function(t){"use strict";var e;function a(){let a=t("#wdt-main-tooltip-dummy");if(!a.length||!e)return;let o="",r=t("body").attr("style");r&&(o=r["overflow-x"],o||(o="")),t("body").css("overflow-x","hidden");var n=e.getBoundingClientRect();let i=t(a).find('[data-target="wdt-tooltip-dummy-text"]');a.css("width",""),i.css("max-width",""),a.css("position","fixed"),a.css("top",n.top+"px"),a.css("left",n.left+"px");const s=n.top-20-16;if(a[0].offsetHeight>s){const t=Math.min(window.innerWidth-32,600);let e=400;for(;a[0].offsetHeight>s&&e<=t;)i.css("max-width",e+"px"),e+=50}let d=a[0].offsetWidth,l=a[0].offsetLeft,c=window.innerWidth-l-d,p=d/2;c<0&&l+c>0?p=Math.max(p,Math.abs(c-16)):l<p&&(p=l<0?0:l+16),i.css("transform","translateX( -"+p+"px )"),t("body").css("overflow-x",o),a.css("width","0")}function o(o,r,n,i=null){t("#wdt-main-tooltip-dummy").remove(),i?(t(i).attr("id","wdt-main-tooltip-dummy"),t("body").append(i)):i=function(){let e=t(document.createElement("div"));e.addClass("wdt-tooltip-dummy"),e.attr("id","wdt-main-tooltip-dummy");let a=t(document.createElement("div"));a.addClass("wdt-tooltip-dummy-text"),a.attr("data-target","wdt-tooltip-dummy-text");let o=t(document.createElement("div"));return o.addClass("wdt-tooltip-dummy-arrow"),e.append(a),e.append(o),t("body").append(e),t("#wdt-main-tooltip-dummy")}(),t(i).find('[data-target="wdt-tooltip-dummy-text"]').html(n),r?t(i).css("display","block"):t(i).css("display","none"),e=o,a()}t(document).on("mouseover",'[data-action="wdt-tooltip-hover"]:not([data-hover-disabled])',(function(e){t(this).trigger("wdt:showTooltip")})),t(document).on("focusin",'[data-action="wdt-tooltip-hover"]:not([data-hover-disabled])',(function(e){t(this).trigger("wdt:showTooltip")})),t(document).on("mouseleave",'[data-action="wdt-tooltip-hover"]:not([data-hover-disabled])',(function(t){o(null,!1,"")})),t(document).on("focusout",'[data-action="wdt-tooltip-hover"]',(function(t){o(null,!1,"")})),t(document).on("keypress",'[data-action="wdt-tooltip-hover"][data-hover-disabled]',(function(e){"Enter"===e.key&&t(this).trigger("click")})),t(document).on("click",'[data-action="wdt-tooltip-hover"][data-hover-disabled]',(function(a){e!==this?t(this).trigger("wdt:showTooltip"):o(null,!1,"")})),t(document).on("click",'[data-action="wdt-tooltip-hover"]',(function(t){t.stopPropagation(),t.preventDefault()})),t(document).on("wdt:showTooltip",'[data-action="wdt-tooltip-hover"]',(function(e){let a=t(this).find('[data-target="wdt-tooltip-text"]').html(),r=null,n=t(this).find('[data-target="tooltip-dummy-template"]');t(n).length&&(r=t(t(n).clone(!0).html())),o(this,!0,a,r)})),t(window).on("resize",(function(t){a()}))})),jQuery((function(t){"use strict";t('[data-target="wdt-widget-customize-menu-container"] [data-action="expand-customize-menu"]').on("click",(function(e){let a=t(this).parents('[data-target="wdt-widget-customize-menu-container"]').first(),o=t(a).find('[data-target="wdt-widget-customize-menu-dropdown"]');"true"==o.attr("data-visible")?(t(o).attr("data-visible","false"),t(this).attr("aria-label","Expand widget customize menu"),t(this).attr("aria-expanded","false")):(t(o).attr("data-visible","true"),t(this).attr("aria-label","Collapse widget customize menu"),t(this).attr("aria-expanded","true"))})),t('[data-target="wdt-widget-customize-menu-dropdown"] [data-action="wdt-customize-dashboard"]').on("click",(function(e){let a=t(this).parents('[data-target="wdt-widget-customize-menu-dropdown"]').first();t(a).attr("data-visible","false")})),t('[data-target="wdt-widget-customize-menu-dropdown"] [data-action="wdt-remove-widget"]').on("click",(function(e){let a=t('[data-target="wdt-portal-employer-dashboard"]').first(),o=t(this).parents("[data-widget]").first();console.log(a);let r=t(o).attr("data-widget"),n=t.Event("wdt:removeWidget");n._widget=r,console.log(n),t(a).trigger(n)}))})),jQuery(document).ready((function(t){"use strict";var e;function a(e){let a=t(e).attr("data-persist-filter-cookie");if(void 0===a)return;let o=new URL(window.location);o.searchParams.delete("wdt-page"),wfwe_setCookie(a,o.searchParams.toString(),365)}t(document).on("dragstart",'[data-archive-table] [data-target="wdt-archive-table-custom-columns-form"] [draggable="true"]',(function(a){e=this,a.originalEvent.dataTransfer.dropEffect="move",t(this).addClass("wdt-archive-table-custom-columns-dragging-ghost"),setTimeout((function(e){t(e).removeClass("wdt-archive-table-custom-columns-dragging-ghost"),t(e).addClass("wdt-archive-table-custom-columns-dragging-origin")}),1,this)})),t(document).on("dragend",'[data-archive-table] [data-target="wdt-archive-table-custom-columns-form"] [draggable="true"]',(function(a){e=null;let o=t(this).parents('[data-target="wdt-archive-table-custom-columns-form"]').first();t(o).find('[draggable="true"]').removeClass("wdt-archive-table-custom-columns-dragover"),t(this).removeClass("wdt-archive-table-custom-columns-dragging-ghost"),t(this).removeClass("wdt-archive-table-custom-columns-dragging-origin")})),t(document).on("dragover",'[data-archive-table] [data-target="wdt-archive-table-custom-columns-form"] [draggable="true"]',(function(e){let a=t(this).parents('[data-target="wdt-archive-table-custom-columns-form"]').first();t(a).find('[draggable="true"]').removeClass("wdt-archive-table-custom-columns-dragover"),t(this).addClass("wdt-archive-table-custom-columns-dragover")})),t(document).on("drop",'[data-archive-table] [data-target="wdt-archive-table-custom-columns-form"] [draggable="true"]',(function(a){let o=t(e);if(!o.length||e===this)return;t(o).insertBefore(this);let r=t(this).parents("[data-archive-table]").first();t(r).find("table").trigger("wdt:changeCustomColumns")})),t(document).on("click",'[data-archive-table] [data-target="wdt-archive-table-custom-columns-form"] [data-action="wdt-archive-table-reset-columns"]',(function(e){let a=t(this).parents('[data-target="wdt-archive-table-custom-columns-form"]').first(),o=t(a).find('[data-rf-target="wdt-material-form-checkbox"]');t(o).each((function(){t(this).prop("checked","true"===t(this).attr("data-default"))})),t(o).first().trigger("change")})),t(document).on("wdt:assessButtonState",'[data-target="wdt-archive-table-custom-columns-form"] [data-action="wdt-archive-table-reset-columns"]',(function(e){let a=t(this).parents('[data-target="wdt-archive-table-custom-columns-form"]').first(),o=t(a).find('[data-rf-target="wdt-material-form-checkbox"]'),r=!0;t(o).each((function(){if("true"===t(this).attr("data-default")!==t(this).prop("checked"))return r=!1,!1})),t(this).prop("disabled",r)})),t(document).on("change",'[data-archive-table] [data-target="wdt-archive-table-custom-columns-form"] [data-rf-target="wdt-material-form-checkbox"]',(function(e){let a=t(this).parents('[data-target="wdt-archive-table-custom-columns-form"]').first();t(a).find('[data-action="wdt-archive-table-reset-columns"]').trigger("wdt:assessButtonState")})),t(document).on("change",'[data-archive-table] [data-target="wdt-archive-table-custom-columns-form"] input',(function(e){let a=t(this).parents("[data-archive-table]").first();t(a).find("table").trigger("wdt:changeCustomColumns")})),t(document).on("wdt:changeCustomColumns","[data-archive-table] table",(function(e){e.stopPropagation();let a=this,o=t(this).parents("[data-archive-table]").first(),r=t(o).find('[data-target="wdt-archive-table-custom-columns-form"]');if(!t(r).length)return;let n=t(r).attr("data-cookie-name"),i=new Set(t(r).find('[data-rf-target="wdt-material-form-checkbox-label"] input[type="checkbox"]').map(((t,e)=>e.name)).get());t(r).find('[data-rf-target="wdt-material-form-checkbox-label"] input[type="checkbox"]').each((function(){let e=this.name,o=t(this).prop("checked"),r=t(a).find('th[data-column="'+e+'"],td[data-column="'+e+'"]');r.length?r.toggle(o):t(a).find('[data-column-data="'+e+'"]').toggle(o)})),t(a).find('.wdt-tablebuilder-embed-group[data-embed-group="links"]').each((function(){let e=t(this).children("[data-column-data]");e.removeClass("wdt-archive-cell-link-first"),e.filter((function(){return"none"!==this.style.display})).first().addClass("wdt-archive-cell-link-first")}));let s=t(r).find('[data-rf-target="wdt-material-form-checkbox-label"][draggable="true"] input[type="checkbox"]').map(((t,e)=>e.name)).get();if(s.length){let e=null;if(t(a).find("thead tr th").each((function(){i.has(t(this).attr("data-column"))||(e=this)})),e)for(let o of s){let r=t(a).find('thead tr th[data-column="'+o+'"]');r.length&&(t(r).insertAfter(e),e=r[0])}t(a).find("tbody tr").each((function(){let e=null;if(t(this).find("td").each((function(){i.has(t(this).attr("data-column"))||(e=this)})),e)for(let a of s){let o=t(this).find('td[data-column="'+a+'"]');o.length&&(t(o).insertAfter(e),e=o[0])}}))}if(n){wfwe_setCookie("wdt_"+n+"_column_order",s.join("|"),365),wfwe_setCookie("wdt_selected_"+n,t(r).find('input[type="checkbox"]:checked').map(((t,e)=>e.name)).get().join("|"),365)}})),t(document).on("click",'[data-archive-table] .wdt-archive-table-custom-columns-form-container [data-action="toggle-form"]',(function(){let e=t(this).closest("[data-archive-table]").get(0);requestAnimationFrame((function(){wdtFitArchiveTableCustomColumnsDropdown(e)}))})),t(document).on("click",(function(){requestAnimationFrame((function(){t("[data-archive-table]").each((function(){wdtFitArchiveTableCustomColumnsDropdown(this)}))}))})),t(document).on("wdt:archiveTableColumnsMenu","[data-archive-table]",(function(e,a){let o=t(this).find(".wdt-archive-table-scroll-container").first().get(0);o&&(a?o.setAttribute("data-shadow-suppressed","_true"):o.removeAttribute("data-shadow-suppressed"),wdtUpdateArchiveTableScrollShadow(o))})),t(document).on("wdt:loadState","[data-archive-table] table",(function(e){let a=t(this).parents("[data-archive-table]");t(this).find("tbody").find("td").addClass("wdt-portal-table-body-element-loading"),t(a).find('[data-target="spinner"]').show(),t(a).find('[data-target="no-matches-found"]').hide(),t(a).find('[data-target="result-count-container"]').hide()})),t(document).on("wdt:unloadState","[data-archive-table] table",(function(e){let a=t(this).parents("[data-archive-table]");t(a).find('[data-target="spinner"]').hide()})),t(document).on("wdt:updatePageDisplay","[data-archive-table] table",(function(e){let a=t(this).parents("[data-archive-table]");t(a).find('[data-target="wdt-archive-table-footer"]').find('[data-target="wdt-archive-table-footer-total"]').html("<strong>"+e.page+"</strong> of "+e.maxPage)})),t(document).on("wdt:sort","[data-archive-table] table",(function(e){e.preventDefault();let a=t(e.th).attr("data-column")+"-"+e.order;t(this).attr("data-sort",a),t(this).data("currentPage",1),t(this).trigger("wdt:refresh")})),t(document).on("click",'[data-action="remove-archive-table-toggle"]',(function(e){let a=t(this).attr("data-name"),o=t(this).parents("[data-archive-table]").first();t(o).find('[data-archive-table-toggle] input[name="'+a+'"]').prop("checked",!1).trigger("change")})),t(document).on("change","[data-archive-table] [data-archive-table-toggle] input",(function(e){let o=t(this).parents("[data-archive-table]").first(),r=t(o).find("table").first();if(void 0===t(o).attr("data-disable-url-updates")){let e=new URL(window.location);t(this).prop("checked")?e.searchParams.set(t(this).attr("name"),"true"):e.searchParams.delete(t(this).attr("name")),history.replaceState({},"",e.toString()),a(o)}t(r).data("currentPage",1),t(r).trigger("wdt:refresh"),t(o).trigger("wdt:refreshFilterButtons")})),t(document).on("change",'[data-archive-table] [name="search"]',(function(e){let a=t(this).parents("[data-archive-table]").first(),o=t(a).find("table");t(o).data("currentPage",1),t(o).trigger("wdt:refresh")})),t(document).on("click",'[data-archive-table] [data-target="wdt-pagination"] [data-pg-action="first"]',(function(e){let a=t(this).parents("[data-archive-table]").first(),o=t(a).find("table");1!==(parseInt(t(o).data("currentPage"))||1)&&(t(o).data("currentPage",1),t(o).trigger("wdt:refresh"))})),t(document).on("click",'[data-archive-table] [data-target="wdt-pagination"] [data-pg-action="prev"]',(function(e){let a=t(this).parents("[data-archive-table]").first(),o=t(a).find("table"),r=parseInt(t(o).data("currentPage"))||1,n=r-1;n>0&&n!==r&&(t(o).data("currentPage",n),t(o).trigger("wdt:refresh"))})),t(document).on("click",'[data-archive-table] [data-target="wdt-pagination"] [data-pg-action="next"]',(function(e){let a=t(this).parents("[data-archive-table]").first(),o=t(a).find("table"),r=parseInt(t(o).data("currentPage"))||1,n=r+1;n<=t(o).data("max_page")&&n!==r&&(t(o).data("currentPage",n),t(o).trigger("wdt:refresh"))})),t(document).on("click",'[data-archive-table] [data-target="wdt-pagination"] [data-pg-action="last"]',(function(e){let a=t(this).parents("[data-archive-table]").first(),o=t(a).find("table"),r=parseInt(t(o).data("currentPage"))||1,n=t(o).data("max_page");r!==n&&(t(o).data("currentPage",n),t(o).trigger("wdt:refresh"))})),t(document).on("change",'[data-archive-table] [name="perPage"]',(function(e){let a=t(this).parents("[data-archive-table]").first(),o=t(a).find("table");t(o).data("currentPage",1),t(o).trigger("wdt:refresh")})),t(document).on("wdt:updateFromArchiveTableForm",'[data-target="filter-form-container"]',(function(e){let o=wdtGetArchiveTableForFilterForm(this),r=t(o).find("table").first();if(void 0===t(o).attr("data-disable-url-updates")){let e=[];t(this).find("[data-filter-form] [name]").each((function(a){e.push(t(this).attr("name"))}));let r=wdtSerializeMaterialForm(t(this).find("[data-filter-form]")),n=new URL(window.location);for(let t of e)n.searchParams.delete(t);for(let t in r){let e=r[t];if(e.length)for(let a of e)n.searchParams.append(t,a.value)}history.replaceState({},"",n.toString()),a(o)}t(r).data("currentPage",1),t(r).trigger("wdt:refresh")})),t(document).on("click",'[data-target="wdt-archive-table-filters"] [data-action="show-all-filters"]',(function(e){let a=t(this).parents('[data-target="wdt-archive-table-filters"]').first();t(a).attr("data-show-all","true");let o=t(this).parents("[data-archive-table]").first();t(o).trigger("wdt:refreshFilterButtons")})),t(document).on("click",'[data-action="remove-all-archive-table-filters"]',(function(e){let a=t(this).parents("[data-archive-table]").first(),o=t(a).find("table");t(o).data("suppressRefresh",!0);let r=wdtGetArchiveTableFilterForm(a);t(r).find("[data-filter-form] [name]").each((function(e){let a=t.Event("wdt:clearValue");t(this).trigger(a)})),t(o).data("suppressRefresh",!1),t(o).data("currentPage",1),t(o).trigger("wdt:refresh")})),t(document).on("click",'[data-action="remove-archive-table-filter"]',(function(e){let a=t(this).attr("data-name"),o=t(this).attr("data-value"),r=wdtGetArchiveTableFilterForm(t(this).parents("[data-archive-table]").first());t(r).find('[data-filter-form] [name="'+a+'"]').each((function(e){let a=t.Event("wdt:clearValue");a._value=o,t(this).trigger(a)}))})),t(document).on("wdt:refreshFilterButtons","[data-archive-table]",(function(e){let a=t(this).find('[data-target="wdt-archive-table-filters"]'),o="true"===t(a).attr("data-show-all");t(this).find('[data-target="wdt-archive-table-filters"] button[data-action="remove-archive-table-filter"]').remove(),t(this).find('[data-target="wdt-archive-table-filters"] button[data-action="remove-archive-table-toggle"]').remove(),t(this).find('[data-target="wdt-archive-table-filters"] button[data-target="remove-all-archive-table-filters"]').hide(),t(this).find('[data-target="wdt-archive-table-filters"] button[data-target="show-all-filters"]').hide();let r=wdtGetArchiveTableFilterForm(this).find("[data-filter-form]"),n=wdtSerializeMaterialForm(r),i=0,s=t(this).find("[data-archive-table-toggle] input");if(t(s).length&&t(s).prop("checked")){let e=t(this).find('[data-archive-table-toggle] [data-target="toggle-label"]').text().trim(),a=document.createElement("button");a.innerText=e,a.setAttribute("data-name",t(s).attr("name")),a.classList.add("wdt-archive-table-filters-btn"),a.classList.add("close-icon"),a.setAttribute("data-action
1","remove-archive-table-toggle"),t(a).insertBefore(t(this).find('[data-target="wdt-archive-table-filters"] button[data-target="show-all-filters"]')),i++}for(let e in n)if(t(r).find('[name="'+e+'"][data-archive-table-refresh-field]').length)for(let a of n[e]){let r=a.label;if("age_min"===e&&(r="Minimum age: "+r),"age_max"===e&&(r="Maximum age: "+r),"last_active_limit"===e){if(!n.last_active.length)continue;r="Active limit: "+r+" days"}let s=document.createElement("button");s.innerText=r,s.setAttribute("data-value",a.value),s.setAttribute("data-name",e),s.classList.add("wdt-archive-table-filters-btn"),s.classList.add("close-icon"),s.setAttribute("data-action","remove-archive-table-filter"),(o||i<3)&&t(s).insertBefore(t(this).find('[data-target="wdt-archive-table-filters"] button[data-target="show-all-filters"]')),i++}let d=t(this).find('[data-target="wdt-archive-table-open-filters"] .wdt-icon-btn-label').text();d=d.split("(").shift().trim(),i>0?(t(a).show(),d=d+" ("+i+")",i>1&&t(this).find('[data-target="wdt-archive-table-filters"] button[data-target="remove-all-archive-table-filters"]').show(),!o&&i>3&&(t(this).find('[data-target="wdt-archive-table-filters"] button[data-target="show-all-filters"]').text(i-3+"+"),t(this).find('[data-target="wdt-archive-table-filters"] button[data-target="show-all-filters"]').show())):t(a).hide(),t(this).find('[data-target="wdt-archive-table-open-filters"] .wdt-icon-btn-label').text(d)})),t(document).on("change",'[data-target="filter-form-container"] [name="matchMode"]',(function(e){let a=t(this).parents('[data-target="filter-form-container"]').first();t(a).trigger("wdt:updateFromArchiveTableForm")})),t(document).on("change",'[data-target="filter-form-container"] [data-archive-table-refresh-field]',(function(e){let a=t(this).parents('[data-target="filter-form-container"]').first();t(a).trigger("wdt:updateFromArchiveTableForm");let o=wdtGetArchiveTableForFilterForm(a);t(o).trigger("wdt:refreshFilterButtons")})),t(document).on("click",'[data-archive-table] [data-action="wdt-archive-table-open-filters"]',(function(e){let a=t(this).parents("[data-archive-table]").first(),o=t(a).find('[data-target="filter-form-template"] [data-target="filter-form-container"]');o.detach(),t(a).data("filterForm",o),t(o).data("archiveTable",a);let r=t.Event("wdt:populatePanel");r._html=o[0],t('#wdt-portal [data-target="wdt-portal-tipout-panel-right"]').trigger(r),t('#wdt-portal [data-target="wdt-portal-tipout-panel-right"]').trigger("wdt:showPanel"),e.stopPropagation()})),t(document).on("wdt:beforeClearPanel",'#wdt-portal [data-target="wdt-portal-tipout-panel-right"]',(function(e){let a=t(this).find('[data-target="filter-form-container"]');if(t(a).length){let e=t(a).data("archiveTable");t(a).detach(),e&&e.length?t(e).find('[data-target="filter-form-template"]').append(t(a[0])):t('[data-target="filter-form-template"]').append(t(a[0]))}})),t(document).on("click",'[data-archive-table] [data-action="add-filter"]',(function(e){let a=t(this).parents("[data-archive-table]").first(),o=t(this).attr("data-name"),r=t(this).attr("data-value"),n=t(this).text(),i=wdtGetArchiveTableFilterForm(a),s=t(i).find('[data-target="wdt-archive-table-filters-form-dynamic-filters"] input[type="checkbox"][name="'+o+'"][value="'+r+'"]');if(s.length)s.prop("checked",!0);else{let e=t(t(i).find('[data-target="template-checkbox"]').clone(!0).html());console.log(e),t(i).find('[data-target="wdt-archive-table-filters-form-dynamic-filters"]').append(e),t(e).find("input").attr("name",o),t(e).find("input").val(r),t(e).find('[data-target="wdt-form-checkbox-input-label-text"]').text(n),t(e).find("input").prop("checked",!0)}t(i).trigger("wdt:updateFromArchiveTableForm"),t(a).trigger("wdt:refreshFilterButtons")})),t(document).on("wdt:initializeArchiveTable","[data-archive-table]",(function(e){if(e.stopPropagation(),!t(this).data("initialized")){t(this).data("initialized",!0),t(this).trigger("wdt:refreshFilterButtons"),t(this).find("table").first().trigger("wdt:changeCustomColumns"),t(this).find("table").first().trigger("wdt:refresh");var a=t(this).find(".wdt-archive-table-scroll-container").first().get(0),o=t(this).find(".wdt-archive-table-scroll-inner").first().get(0);a&&(t(a).on("scroll",(function(){wdtUpdateArchiveTableScrollShadow(this)})),wdtArchiveTableScrollShadowObserver&&(wdtArchiveTableScrollShadowObserver.observe(a),o&&wdtArchiveTableScrollShadowObserver.observe(o)))}})),t(document).on("wdt:refresh","[data-archive-table] table",(function(e){e.stopPropagation(),t(this).data("suppressRefresh")||t(this).trigger("wdt:populateTable")})),t('[data-target="wdt-archive-table-custom-columns-form"] [data-action="wdt-archive-table-reset-columns"]').trigger("wdt:assessButtonState"),t("[data-archive-table]").data("ready",!0),t("[data-archive-table]").each((function(e){t(this).data("attemptedInitialization")&&initializeArchiveTable(this)}))})),jQuery(window).on("resize.archiveTableScrollShadow",(function(){jQuery(".wdt-archive-table-scroll-container").each((function(){wdtUpdateArchiveTableScrollShadow(this)})),jQuery("[data-archive-table]").each((function(){wdtFitArchiveTableCustomColumnsDropdown(this)}))}));var wdtArchiveTableScrollShadowObserver=window.ResizeObserver?new ResizeObserver((function(t){t.forEach((function(t){wdtUpdateArchiveTableScrollShadow(jQuery(t.target).closest(".wdt-archive-table-scroll-container").get(0))}))})):null;function wdtGetArchiveTableFilterForm(t){let e=jQuery(t).data("filterForm");return e&&e.length?e:jQuery(t).find('[data-target="filter-form-template"] [data-target="filter-form-container"]')}function wdtGetArchiveTableForFilterForm(t){let e=jQuery(t).data("archiveTable");return e&&e.length?e:jQuery(t).parents("[data-archive-table]").first()}jQuery(document).ready((function(t){"use strict";t(document).on("click",'form section [data-target="wdt-form-accordion-header"]',(function(e){let a=t(this).parents("form"),o=t(this).parents("section"),r=t(o).find('[data-target="wdt-form-accordion-collapsable-content"]');"inactive"===t(r).attr("data-state")?t(r).trigger("wdt:expand"):t(r).trigger("wdt:collapse"),0===t(a).find('section [data-target="wdt-form-accordion-collapsable-content"]:not([data-state="inactive"])').length?t(a).find('[data-target="wdt-form-collapse-expand-button"]').trigger("wdt:setExpand"):t(a).find('[data-target="wdt-form-collapse-expand-button"]').trigger("wdt:setCollapse")})),t(document).on("wdt:collapse",'form section [data-target="wdt-form-accordion-collapsable-content"]',(function(e){let a=t(this).parents("section"),o=t(a).find('[data-target="wdt-form-accordion-header"]');t(o).attr("data-state","inactive"),t(this).attr("data-state","inactive"),t(this).slideUp("fast")})),t(document).on("wdt:expand",'form section [data-target="wdt-form-accordion-collapsable-content"]',(function(e){let a=t(this).parents("section"),o=t(a).find('[data-target="wdt-form-accordion-header"]');t(o).attr("data-state","active"),t(this).attr("data-state","active"),t(this).slideDown("fast")})),t(document).on("wdt:setCollapse",'form [data-target="wdt-form-collapse-expand-button"]',(function(e){t(this).attr("data-action","w
1dt-accordion-form-collapse-all"),t(this).text("Collapse All")})),t(document).on("wdt:setExpand",'form [data-target="wdt-form-collapse-expand-button"]',(function(e){t(this).attr("data-action","wdt-accordion-form-expand-all"),t(this).text("Expand All")})),t(document).on("click",'form [data-action="wdt-accordion-form-collapse-all"]',(function(e){let a=t(this).parents("form");t(a).find('[data-target="wdt-form-accordion-collapsable-content"]').each((function(e){t(this).trigger("wdt:collapse")})),t(a).find('[data-target="wdt-form-collapse-expand-button"]').trigger("wdt:setExpand")})),t(document).on("click",'form [data-action="wdt-accordion-form-expand-all"]',(function(e){let a=t(this).parents("form");t(a).find('[data-target="wdt-form-accordion-collapsable-content"]').each((function(e){t(this).trigger("wdt:expand")})),t(a).find('[data-target="wdt-form-collapse-expand-button"]').trigger("wdt:setCollapse")}))})),jQuery(document).ready((function(t){"use strict";t(document).on("submit","#wdt-portal-accept-eula #wdt-accept-eula-form",(function(e){if(e.stopPropagation(),e.preventDefault(),t(this).prop("disabled"))return;let a=t(this).find('button[type="submit"]');t(this).prop("disabled",!0),t(a).prop("disabled",!0);let o=t(this).serializeArray();t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/eula/accept/",data:o,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success?(wdtDisplayNotification("Successfully accepted terms & conditions.","success",3e3),setTimeout((function(){window.location.reload()}),2e3)):(t(this).prop("disabled",!1),t(a).prop("disabled",!1),wdtDisplayNotification("Unable to accept terms & conditions.","error",-1))},error:function(e){console.log(e),t(this).prop("disabled",!1),t(a).prop("disabled",!1),wdtDisplayNotification("Error accepting terms & conditions.","error",-1)}})}))})),jQuery((function(t){"use strict";t('[wdt-dashboard-target="date-range"]').on("change",(function(e){t('[data-widget="wdt-logins-widget"').trigger("wdt:trigger"),t('[data-widget="wdt-accounts-widget"]').trigger("wdt:trigger"),t('[data-widget="wdt-resumes-widget"]').trigger("wdt:trigger"),t('[data-widget="wdt-top-viewed-widget"]').trigger("wdt:trigger"),t('[data-target="wdt-activity-table"]').trigger("wdt:update"),t('[data-widget="wdt-job-activity-widget"]').trigger("wdt:trigger"),t('[data-widget="wdt-wage-insights-widget"]').trigger("wdt:trigger"),wdtAnnounce("Updated dashboard widgets with new date range")})),t('[data-dashboard-target="company-skills-metric-widget"]').length&&t('[data-dashboard-target="company-skills-metric-widget"]').each((function(e){let a=this;t(a).find('[data-target="outer-container"]').css("visibility","hidden"),t(a).find('[data-target="outer-container"]').css("opacity","0"),t(a).find('[data-target="spinner"]').css("display","block"),jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/metrics/company-skills/",data:{},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&t(a).find('[data-target="metric-widget-value"]').text(wdtNumberFormat(e.count))},error:function(t){console.log(t)},complete:function(){t(a).find('[data-target="outer-container"]').css("visibility","visible"),t(a).find('[data-target="outer-container"]').css("opacity","1"),t(a).find('[data-target="spinner"]').css("display","none")}})})),t('[data-dashboard-target="clients-no-resume-widget"]').length&&t('[data-dashboard-target="clients-no-resume-widget"]').each((function(e){let a=this,o=t(a).attr("data-nonce");t(a).find('[data-target="outer-container"]').css("visibility","hidden"),t(a).find('[data-target="outer-container"]').css("opacity","0"),t(a).find('[data-target="spinner"]').css("display","block"),jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/clients/",data:{no_resumes:"true",types:["client"],nonce:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&t(a).find('[data-target="metric-widget-value"]').text(wdtNumberFormat(e.body.total))},error:function(t){console.log(t)},complete:function(){t(a).find('[data-target="outer-container"]').css("visibility","visible"),t(a).find('[data-target="outer-container"]').css("opacity","1"),t(a).find('[data-target="spinner"]').css("display","none")}})})),t('[data-dashboard-target="clients-no-recent-logins-widget"]').length&&t('[data-dashboard-target="clients-no-recent-logins-widget"]').each((function(e){let a=this,o=t(a).attr("data-nonce");t(a).find('[data-target="outer-container"]').css("visibility","hidden"),t(a).find('[data-target="outer-container"]').css("opacity","0"),t(a).find('[data-target="spinner"]').css("display","block"),jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/clients/",data:{last_active:"true",types:["client"],last_active_limit:7,nonce:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&t(a).find('[data-target="metric-widget-value"]').text(wdtNumberFormat(e.body.total))},error:function(t){console.log(t)},complete:function(){t(a).find('[data-target="outer-container"]').css("visibility","visible"),t(a).find('[data-target="outer-container"]').css("opacity","1"),t(a).find('[data-target="spinner"]').css("display","none")}})})),t('[data-dashboard-target="clients-no-saved-jobs-widget"]').length&&t('[data-dashboard-target="clients-no-saved-jobs-widget"]').each((function(e){let a=this,o=t(a).attr("data-nonce");t(a).find('[data-target="outer-container"]').css("visibility","hidden"),t(a).find('[data-target="outer-container"]').css("opacity","0"),t(a).find('[data-target="spinner"]').css("display","block"),jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/clients/",data:{no_saved_jobs:"true",types:["client"],nonce:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&t(a).find('[data-target="metric-widget-value"]').text(wdtNumberFormat(e.body.total))},error:function(t){console.log(t)},complete:function(){t(a).find('[data-target="outer-container"]').css("visibility","visible"),t(a).find('[data-target="outer-container"]').css("opacity","1"),t(a).find('[data-target="spinner"]').css("display","none")}})})),t('[data-dashboard-target="client-overdue-tasks-widget"]').length&&t('[data-dashboard-target="client-overdue-tasks-widget"]').each((function(e){let a=this,o=t(a).attr("data-nonce");t(a).find('[data-target="outer-container"]').css("visibility","hidden"),t(a).find('[data-target="outer-container"]').css("opacity","0"),t(a).find('[data-target="spinner"]').css("display","block"),jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/clients/",data:{overdue_tasks:"true",types:["client"],nonce:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&t(a).find('[data-target="metric-widget-value"]').text(wdtNumberFormat(e.body.total))},error:function(t){console.log(t)},complete:function(){t(a).find('[data-target="outer-container"]').css("visibility","visible"),t(a).find('[data-target="outer-container"]').css("opacity","1"),t(a).find('[data-target="spinner"]').css("display","none")}})})),t('[data-dashboard-target="unassigned-tasks-widget"]').length&&t('[data-dashboard-target="unassigned-tasks-widget"]').each((function(e){let a=this,o=t(a).attr("data-nonce");t(a).find('[data-target="outer-container"]').css("visibility","hidden"),t(a).find('[data-target="outer-container"]').css("opacity","0"),t(a).find('[data-target="spinner"]').css("display","block"),jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/case-tasks/",data:{show_staffless:"true",nonce:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&t(a).find('[data-target="metric-widget-value"]').text(e.body.total)},error:function(t){console.log(t)},complete:function(){t(a).find('[data-target="outer-container"]').css("visibility","visible"),t(a).find('[data-target="outer-container"]').css("opacity","1"),t(a).find('[data-target="spinner"]').css("display","none")}})})),t('[data-dashboard-target="my-feed-metric-widget"]').length&&t('[data-dashboard-target="my-feed-metric-widget"]').each((function(e){let a=this;t(a).find('[data-target="outer-container"]').css("visibility","hidden"),t(a).find('[data-target="outer-container"]').css("opacity","0"),t(a).find('[data-target="spinner"]').css("display","block"),jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/metrics/job-feed/",data:{},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&t(a).find('[data-target="metric-widget-value"]').text(wdtNumberFormat(e.count))},error:function(t){console.log(t)},complete:function(){t(a).find('[data-target="outer-container"]').css("visibility","visible"),t(a).find('[data-target="outer-container"]').css("opacity","1"),t(a).find('[data-target="spinner"]').css("display","none")}})})),t('[data-dashboard-target="company-jobs-metric-widget"]').length&&t('[data-dashboard-target="company-jobs-metric-widget"]').each((function(e){let a=this,o=t(this).attr("data-company");o&&(t(a).find('[data-target="outer-container"]').css("visibility","hidden"),t(a).find('[data-target="outer-container"]').css("opacity","0"),t(a).find('[data-target="spinner"]').css("display","block"),jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/metrics/company-job-count/",data:{company:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&t(a).find('[data-target="metric-widget-value"]').text(wdtNumberFormat(e.count))},error:function(t){console.log(t)},complete:function(){t(a).find('[data-target="outer-container"]').css("visibility","visible"),t(a).find('[data-target="outer-container"]').css("opacity","1"),t(a).find('[data-target="spinner"]').css("display","none")}}))})),t('[data-dashboard-target="company-job-views-metric-widget"]').length&&t('[data-dashboard-target="company-job-views-metric-widget"]').each((function(e){let a=this,o=t(this).attr("data-company");o&&(t(a).find('[data-target="outer-container"]').css("visibility","hidden"),t(a).find('[data-target="outer-container"]').css("opacity","0"),t(a).find('[data-target="spinner"]').css("display","block"),jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/metrics/company-job-views/",data:{company:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&t(a).find('[data-target="metric-widget-value"]').text(wdtNumberFormat(e.count))},error:function(t){console.log(t)},complete:function(){t(a).find('[data-target="outer-container"]').css("visibility","visible"),t(a).find('[data-target="outer-container"]').css("opacity","1"),t(a).find('[data-target="spinner"]').css("display","none")}}))})),t('[data-dashboard-target="company-follows-metric-widget"]').length&&t('[data-dashboard-target="company-follows-metric-widget"]').each((function(e){let a=this,o=t(this).attr("data-company");o&&(t(a).find('[data-target="outer-container"]').css("visibility","hidden"),t(a).find('[data-target="outer-container"]').css("opacity","0"),t(a).find('[data-target="spinner"]').css("display","block"),jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/metrics/company-follows/",data:{company:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&t(a).find('[data-target="metric-widget-value"]').text(wdtNumberFormat(e.count))},error:function(t){console.log(t)},complete:function(){t(a).find('[data-target="outer-container"]').css("visibility","visible"),t(a).find('[data-target="outer-container"]').css("opacity","1"),t(a).find('[data-target="spinner"]').css("display","none")}}))})),t('[data-dashboard-target="sector-follows-metric-widget"]').length&&t('[data-dashboard-target="sector-follows-metric-widget"]').each((function(e){let a=this,o=t(this).attr("data-company");o&&(t(a).find('[data-target="outer-container"]').css("visibility","hidden"),t(a).find('[data-target="outer-container"]').css("opacity","0"),t(a).find('[data-target="spinner"]').css("display","block"),jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/metrics/sector-follows/",data:{company:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&t(a).find('[data-target="metric-widget-value"]').text(wdtNumberFormat(e.count))},error:function(t){console.log(t)},complete:function(){t(a).find('[data-target="outer-container"]').css("visibility","visible"),t(a).find('[data-target="outer-container"]').css("opacity","1"),t(a).find('[data-target="spinner"]').css("display","none")}}))}))})),jQuery((function(t){"use strict";t('input[name="wdt-show-occupation-on-dashboard"]').on("change",(function(e){t(this).is(":checked"),t(this).val()})),t('[data-target="wdt-portal-employer-dashboard"] [data-action="wdt-customize-d
1ashboard"]').on("click",(function(e){let a=t(this).parents('[data-target="wdt-portal-employer-dashboard"]').first(),o=t(a).find('[data-dashboard-target="employer-widget-customize-form"]').clone(!0),r=t(a).find('[data-target="custom-widgets"]'),n=[],i=t(r).find("[data-widget]");t(i).each((function(e){n.push(t(this).attr("data-widget"))}));for(let e of n)t(o).find('input[value="'+e+'"]').attr("checked",!0);_wdtRenderContentModal("Customize Widgets",o.html(),"modal-small")})),t(document).on("submit",'form[data-dashboard-target="employer-dashboard-widget-customize-form"]',(function(e){e.preventDefault();let a=t('[data-target="wdt-portal-employer-dashboard"]').first(),o=t('[data-target="wdt-portal-employer-dashboard"] [data-target="custom-widgets"]'),r=t(this).find('input[name="wdt-employer-dashboard-widget-selection"]'),n=t(a).attr("data-nonce"),i=[];t(r).each((function(e){let r=t(this).val(),n=t(this).is(":checked"),s=t(o).find('[data-widget="'+r+'"]');if(n){if(i.push(r),!t(s).length){let e=t.Event("wdt:addWidget");e._widget=r,t(a).trigger(e)}}else t(s).remove()})),t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/widgets/",data:{nonce:n,widget_keys:i},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){},error:function(t){wdtDisplayNotification("Unable to update widget preferences. Please contact administrator.","error",-1),console.log(t)},complete:function(){}}),wdtForceRemoveContentModal()})),t('[data-target="wdt-portal-employer-dashboard"]').on("wdt:removeWidget",(function(e){let a=e._widget;if(!a)return void wdtDisplayNotification("No widget specified for removal","error",-1);let o=t(this).find('[data-target="custom-widgets"]'),r=t(o).find('[data-widget="'+a+'"]');if(r.length){t(r).remove();let e=[],n=t(o).find("[data-widget]");t(n).each((function(a){e.push(t(this).attr("data-widget"))}));let i=[];for(let t of e)t!=a&&i.push(t);let s=t(this).attr("data-nonce"),d=this;t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/widgets/",data:{nonce:s,widget_keys:i},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){t(d).trigger("wdt:showWidgetButton")},error:function(t){wdtDisplayNotification("Unable to update widget preferences. Please contact administrator.","error",-1),console.log(t)},complete:function(){}})}else wdtDisplayNotification("Unable to find widget: "+a,"error",-1)})),t('[data-target="wdt-portal-employer-dashboard"]').on("wdt:addWidget",(function(e){let a=e._widget;if(!a)return"";let o=t(this).attr("data-nonce"),r=this;t.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/widget/",data:{nonce:o,widget_key:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){let a=t(e);t(r).find('[data-target="custom-widgets"]').append(a),console.log(a),t(a).trigger("wdt:trigger"),t(r).trigger("wdt:showWidgetButton")},error:function(t){wdtDisplayNotification("Unable to retrieve widget. Please contact administrator.","error",-1),console.log(t)},complete:function(){}})})),t('[data-target="wdt-portal-employer-dashboard"]').on("wdt:showWidgetButton",(function(e){let a=t(this).find('[data-dashboard-target="employer-widget-customize-form"]').clone(!0),o=t(this).find('[data-target="custom-widgets"]'),r=t(a).find('input[type="checkbox"]'),n=!1;r.each((function(e){let a=t(this).val();if(!t(o).find('[data-widget="'+a+'"]').length)return n=!0,!1})),n?t(this).find('[data-target="wdt-portal-employer-dashboard-add-widget"]').show():t(this).find('[data-target="wdt-portal-employer-dashboard-add-widget"]').hide()})),t('[data-target="wdt-portal-employer-dashboard"]').trigger("wdt:showWidgetButton")})),jQuery(document).ready((function(t){"use strict";t('#wdt-portal-login [data-action="resend-2fa-email"]').on("click",(function(e){t(this).prop("disabled",!0);let a=t("#wdt-portal-login #wdt-2fa-form").first();t(a).find("#wdt-login-form-code").prop("disabled",!0),t(a).find("#wdt-2fa-form-code-resent").val("true"),t(a).trigger("submit")}))}));let reportBanner=()=>{let t=jQuery;return{formatDateRange:function(e){if(!e||!e.includes("|")){let a=(document.cookie.match(/(?:^|;\s*)wdt_dashboard_date_range_start=([^;]*)/)||[])[1],o=(document.cookie.match(/(?:^|;\s*)wdt_dashboard_date_range_end=([^;]*)/)||[])[1];a&&o&&(e=decodeURIComponent(a)+"|"+decodeURIComponent(o),t('[wdt-report-target="date-range"]').val(e),t('[data-target="wdt-form-select-combobox-text"]').text("Current Fiscal Period"))}const[a,o]=e.split("|");let r={"01":"Jan","02":"Feb","03":"Mar","04":"Apr","05":"May","06":"Jun","07":"Jul","08":"Aug","09":"Sep",10:"Oct",11:"Nov",12:"Dec"},[n,i,s]=a.split("-"),[d,l,c]=o.split("-");
1return`${`${r[i]} ${s}, ${n}`} – ${`${r[l]} ${c}, ${d}`}`},getDateRange:function(){let e=t('[wdt-report-target="date-range"]').first().val().split("|");return{startDate:"-1"==e[0]?"":e[0],endDate:"-1"==e[1]?"":e[1]}},generateReportCSV:function(e,a,o,r){return new Promise(((n,i)=>{t.ajax({url:WDT.rest_url+"wedatatools/v1/portal/report/generate-report-csv",method:"get",dataType:"json",beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},data:{nonce:r,report:e,date_from:a,date_to:o}}).error((t=>{i(t)})).success((t=>{if("error"===t.status)return void i(t);let e=[];for(let a of t.data)e.push(a.map((t=>t.join(","))).join("\n"));t.data=e.join("\n\n\n"),n(t)}))}))}}};function wdtCareerCalculatorCalculate(t){if(!t.retirement_age||!t.age)return null;let e={};e.years_left=wdtGetNumber(t.retirement_age)-wdtGetNumber(t.age)-wdtGetNumber(t.education_duration),e.training_total_cost=t.education_cost,e.training_living_expenses=t.living_costs,e.training_total_income=t.education_income,e.training_duration=t.education_duration;let a=wdtGetNumber(t.retirement_age)-wdtGetNumber(t.age),o=wdtGetTrainingDuration(t.education_duration),r=Math.round(wdtGetNumber(t.education_cost)/o),n=Math.round(wdtGetNumber(t.grants)/o),i=r+wdtGetNumber(t.living_costs)-n;i<0&&(i=0);let s=wdtGetNumber(t.education_income),d=t.target_income,l=wdtGetNumber(t.current_yearly_income),c=t.inflation_rate/100;e.targetBenefits=wdtGetDiscountedBenefitsArray(d,c,a,s,i,o),e.currentBenefits=wdtGetBenefitsArray(l,c,a),e.payback=wdtGetPaybackPeriod(e.currentBenefits,e.targetBenefits);let p=wdtGetReturnOnInvestment(e.currentBenefits,e.targetBenefits);return e.roi_amount=p.roi_amount,e.roi_percentage=p.roi_percentage,e}function wdtGetDiscountedBenefitsArray(t,e,a,o,r,n){let i=[],s=[...Array(a).keys()],d=0,l=0;for(let a of s)a<n?(l=wdtGetBenefits(t,e,a+1),i.push(d=wdtGetBenefits(o-r,e,a+1))):i.push(d+wdtGetBenefits(t,e,a+1)-l);return i}function wdtGetBenefitsArray(t,e,a){let o=[],r=[...Array(a).keys()];for(let a of r)o.push(wdtGetBenefits(t,e,a+1));return o}function wdtGetBenefits(t,e,a){return Math.round(wdtGetNumber(wdtPresentValue(e,a,t)))}function wdtGetNumber(t){let e=parseFloat(t);return e||0}function wdtPresentValue(t,e,a){return t=wdtGetNumber(t),e=wdtGetNumber(e),(a=wdtGetNumber(a))/t*(1-Math.pow(1+t,-e))}function wdtGetTrainingDuration(t){return Math.ceil(wdtGetNumber(t))}function wdtGetPaybackPeriod(t,e){for(let a=0;a<e.length&&a<t.length;a++)if(e[a]>t[a])return a+1;return-1}function wdtGetReturnOnInvestment(t,e){if(e.length>0&&t.length>0){let a=e[e.length-1],o=t[t.length-1];return{roi_amount:a-o,roi_percentage:Math.floor((a-o)/o*100)}}return{roi_amount:0,roi_percentage:0}}function filterNodes(t,e){var a=[];jQuery("#vis-filter-sectors").val();
1return t.titles&&t.titles.forEach((function(o){var r,n,i,s=countJobsForNoc(o.noc,e);if(o.jobs=s,isSearchMatch(o)){if("openings"==jQuery("#vis-filter-size").val()){var d=d3.scaleLog().domain([d3.min(t.titles,(function(t){return t.jobs>0?t.jobs:1})),d3.max(t.titles,(function(t){return t.jobs>0?t.jobs:1}))]).range([20,50]),l=d3.scaleLog().domain([d3.min(t.titles,(function(t){return t.jobs>0?t.jobs:1})),d3.max(t.titles,(function(t){return t.jobs>0?t.jobs:1}))]).range([8,20]);s>0?(r=d(s),i=l(s)):(r=d(1),i=l(1)),n=r+10}else if("salary"==jQuery("#vis-filter-size").val()){const e=t.titles.map((t=>+t.median_salary)).filter((t=>Number.isFinite(t)&&t>0)),a=e.length>0,s=a?d3.min(e):1,d=a?d3.max(e):1,l=a?d3.quantile([...e].sort(d3.ascending),.95):1,c=Math.max(s,l||d),p=20,u=24,f=50,g=10,m=12,w=20,h=d3.scaleLinear().domain([Math.sqrt(s),Math.sqrt(c)]).range([u,f]).clamp(!0),b=d3.scaleLinear().domain([Math.sqrt(s),Math.sqrt(c)]).range([m,w]).clamp(!0);if(o.median_salary>0){const t=Math.sqrt(o.median_salary);r=h(t),i=b(t)}else r=p,i=g;n=r+10}else r=35,i=13,n=45;var c,p,u,f,g,m=splitStringIntoSegments("fr"==jQuery("#vis-filter-lang").val()&&""!==o.label_fr?o.label_fr:o.label?o.label:o.title);m.length<=1?(c="",p=m[0],u=""):2==m.length?(c="",p=m[0],u=m[1]):m.length>=3&&(c=m[0],p=m[1],u=m[2]),f="fr"==jQuery("#vis-filter-lang").val()?o.title_fr:o.title,g=(jQuery("#vis-filter-lang").val(),o.desc);var w,h=o.pdf_link,b=o.pdf_link_fr;w=(jQuery("#vis-filter-lang").val(),o.skills);jQuery("#vis-filter-sectors").val(),o.sectors.split(",");var y={noc:o.noc,title:f,median_salary:o.median_salary,in_demand:o.in_demand,skills:w,jobs:s,radius:r,collide:n,text_scale:i,label1:c,label2:p,label3:u,desc:g,pdf_link:h,pdf_link_fr:b,edit_link:o.edit_link};a.push(y)}})),a}function filterLinks(t){var e=[],a=(jQuery("#vis-filter-sectors").val(),escape(jQuery("#vis-search").val().toLowerCase()),[]);
1return t.titles&&t.titles.forEach((function(t){t.sectors.split(",");isSearchMatch(t)&&a.push(t.noc)})),t.titles&&t.links.forEach((function(t){if(-1!=a.indexOf(t.source)&&-1!=a.indexOf(t.target)){"A"!=t.source.charAt(4)&&t.target.charAt(4);var o={source:t.source,target:t.target,value:2};e.push(o)}})),e}function countJobsForNoc(t,e){var a=0;return e.forEach((function(e){t==e.noc_code&&a++})),a}function buildDetailTemplate(t,e){var a="",o="";"0000"!=t.noc&&"00"!=t.noc&&(o=t.noc);let r="",n=[];for(let e=1;e<=t.noc.length;e++)n.push("noc"+t.noc.slice(0,e));return r=n.join("/"),a+='<div class="heading active"><h2>'+t.title+'&nbsp;&nbsp; <span style="color: #747474;"><a href="/noc/'+r+'/">'+o+"</a></span>"+(WDT.admin&&t.edit_link?'&nbsp;&nbsp;<a href="'+t.edit_link+'" target="_blank">Edit</a>':"")+"</h2></div>",a+='<div class="detail-content">',t.in_demand&&(a+='<div class="wdt-job-posting-badge"><p class="wdt-job-posting-badge-content in-demand"><i class="fa fa-star" aria-hidden="true"></i> This job is in demand.</p></div>'),a+='<section class="detail-panel-text"><h3 class="active">Job Description</h3><div class="section-content" style="display: block;"><p>'+t.desc+"</p></div></section>",t.jobs>1?a+='<section class="job-listings"><h3>'+t.jobs+' Active Job Postings</h3><div class="section-content">'+returnJobsHTML(e,t.noc)+"</div></section>":t.jobs>0&&(a+='<section class="job-listings"><h3>'+t.jobs+' Active Job Posting</h3><div class="section-content">'+returnJobsHTML(e,t.noc)+"</div></section>"),WDT_CONFIG.occupations_enabled&&(a+='<section class="more-info"><h3>More Information</h3><div class="section-content"><p>For more information on this occupation, including job duties, working conditions, and required training and education, visit the <a href="'+getNocLink(t.noc)+'" target="_blank">career profile</a>.</p></div></section>'),a+='<div id="placeholder-skills"></div>',a+='<div id="placeholder-wage-salary-insights"></div>',a+='<div id="placeholder-related-blogs"></div>',a+='<div id="placeholder-related-trades"></div>',a+='<div id="placeholder-related-programs"></div>',a+='<div id="placeholder-related-training"></div>',a+="</div>"}function returnJobsHTML(t,e){var a="";return t.forEach((function(t){e==t.noc_code&&(a+='<div class="job-listing">',a+='<p><a class="job-posting-link" rel="noreferrer" href="'+t.url+'" target="_blank" data-post-id="'+t.post_id+'" data-employer="'+t.employer+'" data-noc="'+t.noc_code+'" data-nocs="'+t.noc_code+'" data-nocs-2021="" data-post-title="'+t.title+'" data-tool="Career Explorer">'+t.title+"</a> ⋅ <strong>"+t.employer+"</strong><br>",a+=t.content+"</p>",a+="</div>")})),a}function activatePanelTabs(){jQuery("#vis-detail-panel").find(".detail-inner").find("section").find("h3").on("click",(function(t){jQuery(this).siblings(".section-content").slideToggle(),jQuery(this).toggleClass("active")})),jQuery("#vis-detail-panel .job-posting-link").on("click",(function(t){t.preventDefault();var e=jQuery(this).data("post-id"),a=jQuery(this).data("employer"),o=jQuery(this).data("post-title"),r=jQuery(this).data("nocs");("function"==typeof trackResearchEvent&&trackResearchEvent("weexplore|click-job-post|"+e),"function"==typeof wdt_event_cap)&&wdt_event_cap({t:"Career Explorer",ac:"Click Job Post",e:a,d:o,no2021:r,na:""});window.open(jQuery(this).attr("href"),"_blank")}))}function fetchRelatedBlogPosts(t){var e="";jQuery(".page-id-2198").length>0&&jQuery.getJSON("/wp-json/wp/v2/posts?filter[tag]="+t,(function(t){if(e+='<section class="related-blogs"><h3>Related Blog Posts</h3><div class="section-content">',t.length>=1)for(var a=0;a<t.length;a++)e+='<p><a href="'+t[a].link+'" target="_blank">'+t[a].title.rendered+"</a></p>";e+="</div></section>",t.length>=1&&(jQuery("#placeholder-related-blogs").html(e),jQuery("#placeholder-related-blogs").find("section").find("h3").on("click",(function(t){jQuery(this).siblings(".section-content").slideToggle(),jQuery(this).toggleClass("active")})))}))}function fetchRelatedTrades(t){let e="",a=jQuery("#wdt-career-explorer").data("nonce");jQuery.ajax({url:WDT.rest_url+"wedatatools/v1/career-explorer/skilled-trades/",method:"GET",dataType:"json",data:{noc:t,nonce:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:a=>{if(a&&a.success&&a.trades.length){let o=a.trades;e+='<section class="related-trades"><h3>Related Skilled Trades</h3><div class="section-content">';
1for(let a of o)e+='<p><a href="'+getNocLink(t)+"?wdt-page=skilled-trades#trade"+a.id+'" target="_blank">'+a.title+"</a></p>";e+="</section>",jQuery("#placeholder-related-trades").html(e),jQuery("#placeholder-related-trades").find("section").find("h3").on("click",(function(t){jQuery(this).siblings(".section-content").slideToggle(),jQuery(this).toggleClass("active")}))}},error:t=>{console.log(t)}})}function fetchRelatedPrograms(t){let e="",a=jQuery("#wdt-career-explorer").data("nonce");jQuery.ajax({url:WDT.rest_url+"wedatatools/v1/career-explorer/education-programs/",method:"GET",dataType:"json",data:{noc:t,nonce:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:t=>{if(t&&t.success&&t.programs.length){let a=t.programs;e+='<section class="related-programs"><h3>Related Education Programs</h3><div class="section-content">';for(let t of a)e+='<p><a href="'+t.url+'" target="_blank">'+t.title+"</a></p>";e+="</section>",jQuery("#placeholder-related-programs").html(e),jQuery("#placeholder-related-programs").find("section").find("h3").on("click",(function(t){jQuery(this).siblings(".section-content").slideToggle(),jQuery(this).toggleClass("active")}))}},error:t=>{console.log(t)}})}function fetchRelatedTraining(t){let e="",a=jQuery("#wdt-career-explorer").data("training-nonce");jQuery.ajax({url:WDT.rest_url+"wedatatools/v1/training/programs",method:"GET",dataType:"json",data:{nocs:t,nonce:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:t=>{if(console.log(t),t&&t.hits&&t.hits.length){let a=t.hits;e+='<section class="related-training"><h3>Related Training Programs</h3><div class="section-content">';for(let t of a)e+='<p><a href="'+t.program_url+'" target="_blank">'+t.title+"</a></p>";e+="</section>",console.log(e),jQuery("#placeholder-related-training").html(e),jQuery("#placeholder-related-training").find("section").find("h3").on("click",(function(t){jQuery(this).siblings(".section-content").slideToggle(),jQuery(this).toggleClass("active")}))}},error:t=>{console.log(t)}})}function fetchWageSalaryData(t){let e=new Date((new Date).setFullYear((new Date).getFullYear()-1));e=e.toLocaleDateString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"});let a=new Date;a=a.toLocaleDateString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"});let o="",r=jQuery("#wdt-career-explorer").data("nonce");jQuery.ajax({url:`${WDT.rest_url}wedatatools/v1/wages/breakdown/individual?noc_slugs_2021=${t}&start_date=${e}&end_date=${a}`,method:"GET",dataType:"json",data:{noc_slugs_2021:t,start_date:e,end_date:a,nonce:r},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)}}).done((e=>{if(e.hasOwnProperty("success")&&e.success&&e.body.nocs_2021[t]){let a=e.body.nocs_2021[t][0],r=e.body.nocs_2021[t][50],n=e.body.nocs_2021[t][100];if(0!=a&&0!=r&&0!=n){let t=(r-a)/(n-a)*100;t<.94?t=.94:t>94&&(t=94);let e=`<div class="salary-details" style="display: block;">\n                    <p>The following salary data has been extracted from job posts indexed on this website over last year:</p>\n                    <div class="wdt-salary-graph-component">\n                        <div class="salary-line">\n                            <div class="lowest"></div>\n                            <div class="median" style="--wdt-career-explorer-salary-details-median: ${t}%"></div>\n                            <div class="highest"></div>\n                        </div>\n                        \n                        <div class="salary-bars">\n                            <div class="lowest">\n                                <p>Lowest Observed</p>\n                                <p class="salary">$${a.toLocaleString("en")}</p>\n                            </div>\n                            <div class="median">\n                                <p>Median</p>\n                                <p class="salary">$${r.toLocaleString("en")}</p>\n                            </div>\n                            <div class="highest">\n                                <p>Highest Observed</p>\n                                <p class="salary">
1$${n.toLocaleString("en")}</p>\n                            </div>\n                        </div>\n                    </div>\n                </div>`;o+=`<section class="median-salary"><h3>Wage / Salary</h3><div class="section-content">${e}</div></section>`}}jQuery("#placeholder-wage-salary-insights").html(o),jQuery("#placeholder-wage-salary-insights").find("section").find("h3").on("click",(function(t){jQuery(this).siblings(".section-content").slideToggle(),jQuery(this).toggleClass("active")})),jQuery("#placeholder-wage-salary-insights .salary-bars > div").on("click",(function(t){let e=jQuery(this).attr("class").replace("selected","").trim();if(jQuery(this).hasClass("selected"))return jQuery(this).removeClass("selected"),void jQuery(`#placeholder-wage-salary-insights .salary-line > div.${e}`).removeClass("selected");jQuery("#placeholder-wage-salary-insights .salary-line > div.selected").removeClass("selected"),jQuery("#placeholder-wage-salary-insights .salary-bars > div.selected").removeClass("selected"),jQuery(this).addClass("selected"),jQuery(`#placeholder-wage-salary-insights .s
1alary-line > div.${e}`).addClass("selected")}))}))}function fetchSkillsData(t){let e="",a=jQuery("#wdt-career-explorer").data("nonce");jQuery.ajax({url:`${WDT.rest_url}wedatatools/v1/nocs/skills/html`,method:"GET",dataType:"json",data:{noc:t,nonce:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)}}).done((t=>{if(t.hasOwnProperty("success")&&t.success){t.skills.map((t=>t.key));e+=`<section class="skills"><h3>Skills</h3><div class="section-content">${t.html}</div></section>`;let a=jQuery("#placeholder-skills");a.html(e),a.has("section > h3").length&&a.find("section > h3").on("click",(function(t){jQuery(this).siblings(".section-content").slideToggle(),jQuery(this).toggleClass("active")}))}}))}function jobsRow(t){return{title:t.TITLE,employer:t.EMPLOYER,noc:t.NOC_CODE,url:t.URL,post_id:t.POST_ID,desc:t.DESCRIPTION}}function getNocLink(t){let e=String(t),a=wfwe_vars.permalink_structure.replace("%postname%/","noc");for(let o=1;o<=t.length;o++)a+="/noc"+e.substring(0,o);return a}function isSearchMatch(t){var e=jQuery("#vis-search").val().toLowerCase(),a=jQuery("#vis-filter-sectors").val(),o=t.sectors.split(",");return(""==e||-1!=t.title.toLowerCase().indexOf(e)||-1!=t.desc.toLowerCase().indexOf(e))&&("all"==a&&"A"!=t.noc.charAt(4)||-1!=o.indexOf(a))}function splitStringIntoSegments(t){if(t.includes("|"))return t.split("|");const e=t.split(/\s+/),a=t.length;let o=[],r="",n=0;for(const t of e)n+t.length+1>a/3&&r.length>=8&&(o.push(r.trim()),r="",n=0),r+=t+" ",n+=t.length+1;return r&&o.push(r.trim()),o.every((t=>t.length<8))&&(3===o.length&&(o[1]=o[1]+" "+o.pop()),2===o.length&&o[0].length<8&&(o=[o.join(" ")])),o}jQuery((t=>{"use strict";t("#wdt-report-banner-share").length&&t("#wdt-report-banner-share").on("click",(function(){const t=window.location.href;navigator.clipboard.writeText(t).then((()=>{wdtDisplayNotification("Link copied to your clipboard","info",5e3)})).catch((t=>{wdtDisplayNotification("Failed to copy link to your clipboard","error",5e3)}))})),t(document).on("change",'#wdt-report-banner form [name="fiscalYear"]',(function(){let e=t(this).parents("form").first(),a=t(this).val(),o=t(t(e).find('template[data-date-range-fy="'+a+'"]').clone(!0).html());console.log(o);let r=t(e).find("#wdt-cams-form-date-range-label");t(o).insertAfter(r),t(r).remove(),t(e).find('[data-target="wdt-material-date-range"]').trigger("wdt:initialize")})),t(document).on("change",'#wdt-report-banner form [name="dateRange"]',(function(){let e=t(this).parents("form").first();t(this).attr("data-save-val").includes("|")?t(e).find('[data-target="cir-dates-fiscal-year-help-text"]').show():t(e).find('[data-target="cir-dates-fiscal-year-help-text"]').hide()})),t(document).on("click",'#wdt-report-banner [data-action="wdt-report-banner-open-filters"]',(function(e){if(t('[data-target="wdt-portal-tipout-panel-right"][data-state="active"] #wdt-portal-report-banner-filter-form-container').length)t('#wdt-portal [data-target="wdt-portal-tipout-panel-right"]').trigger("wdt:closePanel");else{let e=t(this).parents("#wdt-report-banner").first(),a=t(e).find("#wdt-report-banner-filters-template #wdt-portal-report-banner-filter-form-container");a.detach();let o=t.Event("wdt:populatePanel");o._html=a[0],t('#wdt-portal [data-target="wdt-portal-tipout-panel-right"]').trigger(o),t('#wdt-portal [data-target="wdt-portal-tipout-panel-right"]').trigger("wdt:showPanel")}e.stopPropagation()})),t(document).on("wdt:beforeClearPanel",'#wdt-portal [data-target="wdt-portal-tipout-panel-right"]',(function(e){let a=t(this).find("#wdt-portal-report-banner-filter-form-container");t(a).length&&(t(a).detach(),t("#wdt-report-banner-filters-template").append(t(a[0])))})),t(document).on("click","#wdt-report-banner #wdt-about-report",(function(){!t("#wdt-about-panel").attr("hidden")?(t("#wdt-about-panel").attr("hidden","hidden"),t("#wdt-about-report").removeClass("is-open")):(t("#wdt-about-panel").removeAttr("hidden"),t("#wdt-about-report").addClass("is-open")),t('table[data-floating-head="true"]').trigger("reflow")}))})),jQuery(document).ready((function(t){"use strict";t(document).on("mouseenter",'table[data-tablebuilder-table="true"] [data-hover-text]',(function(){let t=this.querySelector(".wdt-tablebuilder-cell-wrapper")||this;t.scrollWidth>t.clientWidth+1||t.scrollHeight>t.clientHeight+1?this.setAttribute("title",this.getAttribute("data-hover-text")):this.removeAttribute("title")})),t(document).on("wdt:_tbsort",'table[data-tablebuilder-table="true"]',(function(e,a,o){const r=t(this),n=r.find("thead th").eq(a),i=o?t(o):n;if(!n.length)return;if(!r.data("wdtSortSeeded")){r.data("wdtSortSeeded",!0);const t=r.find("thead th"),e=t.filter("[data-sort-order]").first();e.length&&(r.data("wdtPrevCol",t.index(e)),r.data("wdtPrevOrder",e.attr("data-sort-order")))}const s=r.data("wdtPrevCol"),d=r.data("wdtPrevOrder")||"asc",l=s===a&&"asc"===d?"desc":"asc";r.data("wdtPrevCol",a),r.data("wdtPrevOrder",l),t(i).siblings().removeAttr("data-sort-order"),t(i).attr("data-sort-order",l);const c=t.Event("wdt:sort",{colIdx:a,order:l,th:n[0],clickedTh:i[0]});if(r.trigger(c),c.isDefaultPrevented())return;const p=r.find("tbody").first();if(!p.length)return;const u=p.find("tr").get();function f(e,a){const o=t(e).children().eq(a),r=o.attr("data-sort-value");return null!=r?r:o.text().trim()}function g(t){if(null==t||""===t)return{type:"empty",v:""};const e=Number(t.replace?.(/[, ]+/g,"").trim?.()??t);if(!Number.isNaN(e)&&isFinite(e))return{type:"num",v:e};const a=Date.parse(t);return Number.isNaN(a)?{type:"str",v:String(t).toLowerCase()}:{type:"date",v:a}}u.sort((function(t,e){const o=g(f(t,a)),r=g(f(e,a));return("asc"===l?1:-1)*function(t,e){if("empty"===t.type&&"empty"!==e.type)return 1;if("empty"===e.type&&"empty"!==t.type)return-1;const a={num:2,date:2,str:1,empty:0}
1;return a[t.type]!==a[e.type]?a[t.type]-a[e.type]:"num"===t.type||"date"===t.type?t.v-e.v:t.v.localeCompare(e.v,void 0,{numeric:!0,sensitivity:"base"})}(o,r)}));for(const t of u)p.append(t);const m=n.add(i);r.find("thead th").removeClass("is-sorted is-asc is-desc"),m.addClass("is-sorted "+("asc"===l?"is-asc":"is-desc")),r.trigger("reflow")})),t(document).on("click",'table[data-tablebuilder-table="true"] th[data-sortable="true"]',(function(e){e.preventDefault(),e.stopPropagation();const a=t(this).index();t(this).closest("table").trigger("wdt:_tbsort",[a,this])})),t(document).on("wdt:refreshFloatThead",'table[data-tablebuilder-table="true"]',(function(e){if("true"===t(this).attr("data-floating-head")&&"true"!==t(this).attr("data-is-floated")){t("#wpadminbar").outerHeight();let e=null;"true"===t(this).attr("data-responsive-container")&&(e=function(t){return t.parents().first()}),t(this).off("floatThead.wdtDock").on("floatThead.wdtDock",(function(e,a,o){if(!o||!o.length)return;o.children(".wdt-dock").length||o.wrapInner('<div class="wdt-dock" style="will-change:transform;backface-visibility:hidden;"></div>');const r=o.children(".wdt-dock"),n=t(this),i=t("#wpadminbar").outerHeight()||0,s=o.outerHeight();function d(){let t=0;window.visualViewport&&(t=Math.max(0,window.visualViewport.offsetTop));const e=n[0].getBoundingClientRect(),a=Math.max(0,e.bottom-i-s);t>a&&(t=a),r.css("transform",t?`translateY(${t}px)`:"")}const l=()=>requestAnimationFrame(d);t(window).off(".wdtDock").on("scroll.wdtDock resize.wdtDock",l),window.visualViewport&&(visualViewport.addEventListener("scroll",l,{passive:!0}),visualViewport.addEventListener("resize",l,{passive:!0})),d()})),t(this).off(".wdtInit").on("reflowed.wdtInit",(function(e,a){const o=this;t(a).off("click.tbsort").on("click.tbsort",'th[data-sortable="true"]',(function(e){e.preventDefault(),e.stopPropagation();const a=t(this).index();t(o).trigger("wdt:_tbsort",[a,this])})),t(this).off("reflowed.wdtInit")})),t(this).floatThead({position:"fixed",top:t("#wpadminbar").length?t("#wpadminbar").height():0,responsiveContainer:e}),t(this).attr("data-is-floated","true"),function(e,{debounce:a=120,minInterval:o=160,thresholdPx:r=1,observeAncestors:n=2,ancestorSelectors:i=[],pauseWhenOffscreen:s=!0}={}){const d=e[0],l=e.data("wdtFloatReflow");if(l){try{l.ro.disconnect()}catch{}try{l.io.disconnect?.()}catch{}t(window).off(".floatReflow."+l.id),clearTimeout(l.to),e.removeData("wdtFloatReflow")}const c=Math.random().toString(36).slice(2),p=new Map,u=t=>({w:t.offsetWidth,h:t.offsetHeight});let f=!0,g=null;s&&"IntersectionObserver"in window&&(g=new IntersectionObserver((t=>{f=t.some((t=>t.isIntersecting)),f&&_()}),{root:null,threshold:0}),g.observe(d));const m=new Set([d]);if(i.length)i.forEach((t=>{const a=e.closest(t)[0];a&&m.add(a)}));else{let t=d.parentElement,e=0;for(;t&&e<n;)m.add(t),e+=1,t=t.parentElement}m.forEach((t=>p.set(t,u(t))));let w=null,h=!1,b=!1,y=0;const v=()=>{const t=Date.now();if(t-y<o)return;y=t,b=!0;let a=!1;try{e.floatThead("reflow"),a=!0}catch(t){}a||e.trigger("reflow"),setTimeout((()=>{b=!1}),50)},_=()=>{b||s&&!f||h||(h=!0,clearTimeout(w),w=setTimeout((()=>{h=!1,requestAnimationFrame(v)}),a))},k=new ResizeObserver((t=>{if(b)return;let e=!1;for(const a of t){const t=a.target,o=p.get(t)||{w:0,h:0},n=u(t);(Math.abs(n.w-o.w)>r||Math.abs(n.h-o.h)>r)&&(p.set(t,n),e=!0)}e&&_()}));m.forEach((t=>k.observe(t))),t(window).on("resize.floatReflow."+c+" orientationchange.floatReflow."+c,_),e.data("wdtFloatReflow",{ro:k,io:g,to:w,id:c}),setTimeout(_,0)}(t(this))}})),t('table[data-tablebuilder-table="true"]').trigger("wdt:refreshFloatThead")})),jQuery(document).ready((function(t){"use strict";var e,a,o,r,n,i,s,d={current_occupation_name:"",target_occupation_name:"",in_demand:!1,job_period:6,job_count:0,program_name:!1,training_duration:!1,training_living_expenses:!1,training_total_cost:!1,training_grants:!1,training_total_income:!1,years_left:!1,roi_amount:!1,roi_percentage:!1,payback_years:!1};if(t("#wdt-ccc").length){function l(e){let a=wdtGetNumber(t(e).find(".wfwe-extracted-salary-item-value").data("value"));t("#wdt-ccc-target-income").val(a),wdtElementNotification(t("#wdt-ccc-target-income").parents("label").first(),"Updated field."),b()}function c(e){let a=t(e).attr("data-accordion"),o=t(e).parents(".wdt-ccc-accordion").first();t(e).find(".wdt-ccc-arrow-down").removeClass("rotated"),t(e).removeClass("active"),t("#"+a).slideUp(200),o.attr("data-status","collapsed")}function p(e){t(".wdt-ccc-accordion-panel").each((function(a){t(this).is(e)||c(this)}));let a=t(e).attr("data-accordion"),o=t(e).parents(".wdt-ccc-accordion").first();t(e).find(".wdt-ccc-arrow-down").addClass("rotated"),t(e).addClass("active"),t("#"+a).slideDown({duration:200,start:function(){t(this).css({display:"grid"})}}),o.attr("data-status","active")}function u(e,o){var r;console.log(e);var n=[],i=[],s=[];t("#wdt-ccc-bar-chart").each((function(t){a&&a.destroy();var l=this.getContext("2d"),c=[],p=["January","February","March","April","May","June","July","August","September","October","November","December"],u=["01","02","03","04","05","06","07","08","09","10","11","12"],f=new Date,g=f.getFullYear(),m=f.getMonth();for(t=0;t<60;t++)m<0&&(g-=1,m=11),s.push(p[m]),c.push(g+"-"+u[m]),m-=1;s=s.reverse(),c=c.reverse();let w=e.month_buckets?Object.keys(e.month_buckets).sort():[];for(let t of w)if(n.push(e.month_buckets[t].active),i.push(e.month_buckets[t].expired),e.month_buckets[t].total>0&&-1==o){let e=new Date(t+"-01");switch(console.log(e),o=12*(f.getFullYear()-e.getFullYear()),o-=e.getMonth(),o+=f.getMonth(),jQuery(".chart
1-span").removeClass("selected"),!0){case o<=6:jQuery(".chart-span[data-months=6]").addClass("selected"),o=6;break;case o<=12:jQuery(".chart-span[data-months=12]").addClass("selected"),o=12;break;case o<=24:jQuery(".chart-span[data-months=24]").addClass("selected"),o=24}}-1==o&&(jQuery(".chart-span").removeClass("selected"),jQuery(".chart-span[data-months=6]").addClass("selected"),o=6),console.log(n),console.log(i);let h=0,b=n.slice(0-o),y=i.slice(0-o);for(let t of b)h+=t;for(let t of y)h+=t;d.job_count=h,d.job_period=o,r={labels:s.slice(0-o),datasets:[{label:"Expired Job Postings",backgroundColor:"#999999",borderColor:"#999999",borderWidth:3,data:i.slice(0-o)},{label:"Active Job Postings",backgroundColor:WDT.colors.primary,borderColor:WDT.colors.primary,borderWidth:3,data:n.slice(0-o)}]};a=new Chart(l,{type:"bar",data:r,options:{responsive:!0,maintainAspectRatio:!0,legend:{display:!1},scales:{xAxes:[{stacked:!0,ticks:{fontSize:12}}],yAxes:[{stacked:!0,ticks:{precision:0,fontSize:12}}]},tooltips:{enabled:!1},title:{display:!0,text:"JOB POSTING ACTIVITY"},plugins:{datalabels:{opacity:0}}}})}))}function f(){let t='<div class="wdt-ccc-description">';if(d.target_occupation_name&&""!=d.target_occupation_name&&(t+=" <b>Target Occupation: </b>"+d.target_occupation_name,d.in_demand&&(t+=", which is an <b>in-demand occupation</b>."),t+="<br>",d.job_count&&wdtGetNumber(d.job_count)>0)){wdtGetNumber(d.job_count);t+="<b>Job Postings (last "+d.job_period+" months): </b>"+d.job_count+"<br>"}return d.training_total_cost&&wdtGetNumber(d.training_total_cost)>0&&(t+="<b>Estimated Training Cost: </b>"+m(d.training_total_cost)+"<br>"),t+="</div>",t}function g(){if(d.years_left&&wdtGetNumber(d.years_left)>0){let e='<p><span class="wdt-scorecard-highlight">'+d.years_left+"</span></p><p>years left in the workforce</p>";t("#wdt-ccc-years-left-card").html(e)}if(!isNaN(d.roi_amount)){let e=wdtGetNumber(d.roi_amount)<0,a=isFinite(Math.abs(wdtGetNumber(d.roi_percentage))),o=a?Math.abs(wdtGetNumber(d.roi_percentage))+"%":"infinite",r='<p>Make</p><p><span class="wdt-scorecard-highlight small-highlight">'+m(Math.abs(wdtGetNumber(d.roi_amount)))+"</span></p>"+(e?"<p>less with this change</p>":"<p>more in your career</p>");t("#wdt-ccc-income-difference-card").html(r);t("#wdt-ccc-roi-card");if(e){let e='<p><span class="wdt-scorecard-highlight small-highlight">NEGATIVE</span></p><p>return on investment</p>';t("#wdt-ccc-roi-card").html(e)}else if(a){let e='<p>Earn</p><p><span class="wdt-scorecard-highlight">'+o+"</span></p><p>return on investment</p>";t("#wdt-ccc-roi-card").html(e)}else{let e="<p>Choose a current occupation to compare income potential</p>";t("#wdt-ccc-roi-card").html(e)}}if(!isNaN(d.payback_years)){let e=t("#wdt-ccc-payback-card");if(wdtGetNumber(d.payback_years)>=0){let t='<p><span class="wdt-scorecard-highlight">'+wdtGetNumber(d.payback_years)+"</span></p><p>year payback</p>";e.html(t)}else{let t='<p><span class="wdt-scorecard-highlight small-highlight">NOT ON TRACK</span></p><p>to pay back investment</p>';e.html(t)}}}function m(t){return wdtGetNumber(t).toLocaleString("en-US",{style:"currency",currency:"USD"})}function w(e){t("#wdt-ccc-training-programs").append('<button class="wdt-ccc-content-btn wdt-ccc-education-program" data-title="'+e.title+'" data-cost="'+e.cost+'" data-duration="'+e.years+'" data-commitment="'+e.commitment+'"><p class="wdt-ccc-content-title">'+e.title+'</p><p class="wdt-ccc-content-details">'+e.institution+'</p><p class="wdt-ccc-content-details">'+e.years+" years, "+e.commitment+'</p><p class="wdt-ccc-content-cost">$'+wdtGetNumber(e.cost).toLocaleString("en-US")+" Program Cost</p></button>")}function h(e){let a=e.average,o=e.highest,r=e.percentile_25th,n=e.percentile_75th,i=e.median;t(".wfwe-range-bar-node.average").each((function(e){let r=0==o?0:Math.round(a/o*100);t(this).css("left","calc("+r+"% - 10px)")})),t(".wfwe-range-bar-node.median").each((function(e){let a=0==o?0:Math.round(i/o*100);t(this).css("left","calc("+a+"% - 10px)")})),t(".wfwe-range-bar-node.percentile_25th").each((function(e){let a=0==o?0:Math.round(r/o*100);t(this).css("left","calc("+a+"% - 10px)")})),t(".wfwe-range-bar-node.percentile_75th").each((function(e){let a=0==o?0:Math.round(n/o*100);t(this).css("left","calc("+a+"% - 10px)")}))}function b(){j(),t(".wfwe-extracted-salary-item-value").each((function(e){void 0!==t(this).data("value")&&t(this).text(wdtGetNumber(t(this).data("value")).toLocaleStr
1ing("en-US",{style:"currency",currency:"USD"}))})),C(),v(),y()}function y(){if(t("select#wdt-ccc-current-occupation").val()){let e=t("select#wdt-ccc-current-occupation"),a=t(e).find('option[value="'+e.val()+'"]');t("#current-occupation-panel-label").text(a.text())}else t("#current-occupation-panel-label").text("");if(t("select#wdt-ccc-target-occupation").val()){let e=t("select#wdt-ccc-target-occupation"),a=t(e).find('option[value="'+e.val()+'"]');t("#target-occupation-panel-label").text(a.text())}else t("#target-occupation-panel-label").text("");if(t("input#wdt-ccc-training-cost").val()){let e=t("input#wdt-ccc-training-cost").val();e>0?t("#training-cost-panel-label").text("Education Cost: "+wdtGetNumber(e).toLocaleString("en-US",{style:"currency",currency:"USD"})):t("#training-cost-panel-label").text("")}else t("#training-cost-panel-label").text("")}function v(){t(".wdt-ccc-segment").each((function(e){let a=t(this).find("*[required]");var o=!0;a.each((function(e){t(this).attr("disabled")||""!=t(this).val()&&null!=t(this).val()||(o=!1)})),o?t('.wdt-ccc-accordion-panel[data-accordion="'+t(this).attr("id")+'"]').addClass("complete"):t('.wdt-ccc-accordion-panel[data-accordion="'+t(this).attr("id")+'"]').removeClass("complete")}))}function _(){k(),t("#wdt-ccc-line-graph").each((function(a){let o=wdtGetNumber(t("#wdt-ccc-retirement").val())-wdtGetNumber(t("#wdt-ccc-age").val()),r=[];for(let t=1;t<=o;t++)r.push("Year "+t);e&&e.destroy();var n=this.getContext("2d"),d={datasets:[{label:"Current Occupation",data:s,borderColor:wdtCareerCalculator.primary,backgroundColor:wdtCareerCalculator.primary,fill:!1},{label:"Target Occupation",data:i,borderColor:wdtCareerCalculator.secondary,backgroundColor:wdtCareerCalculator.secondary,fill:!1}],labels:r};let l="COMPARING EARNING POTENTIAL BETWEEN NOW AND EXPECTED RETIREMENT",c="Cumulative Earnings",p="Years Remaining In The Workforce";if(e=new Chart(n,{type:"line",data:d,options:{responsive:!0,maintainAspectRatio:!1,scales:{yAxes:[{ticks:{beginAtZero:!0,callback:function(t,e,a){return t.toLocaleString("en-US",{style:"currency",currency:"USD"})}},scaleLabel:{display:!0,align:"start",labelString:c}}],xAxes:[{scaleLabel:{display:!0,align:"start",labelString:p}}]},tooltips:{callbacks:{label:function(t,e){return e.datasets[t.datasetIndex].label+": "+t.yLabel.toLocaleString("en-US",{style:"currency",currency:"USD"})}}},title:{display:!0,text:l},plugins:{datalabels:{opacity:0}},legend:{labels:{defaultFontFamily:"proxima-nova"}},function:t=>t.toLocaleString("en-US",{style:"currency",currency:"USD"})}}),t("#wdt-ccc-line-graph-table").length>0){let e=[];for(let t of d.datasets)e.push({data:t.data,label:t.label});t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/career-calculator/line-graph-table/",data:{nonce:t(this).data("nonce"),title:l,xAxisTitle:p,yAxisTitle:c,xLabels:JSON.stringify(d.labels),datasets:JSON.stringify(e)},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:e=>{t("#wdt-ccc-line-graph-table").html(e)},error:e=>{t("#wdt-ccc-line-graph-table").html("")}})}})),g(),t("#wdt-ccc-results-brief-container").html(f()),d.target_occupation_name&&""!=d.target_occupation_name&&t("#wdt-ccc-results-target-name").text(d.target_occupation_name)}function k(){let e=wdtGetPaybackPeriod(s,i),a="You are not on track to payback before retirement.";e>=0&&(a=e+" Years."),t("#wdt-ccc-payback-period").text(a);let o=wdtGetReturnOnInvestment(s,i);t("#wdt-ccc-roi").text(m(o.roi_amount)),d.payback_years=e,d.roi_amount=o.roi_amount,d.roi_percentage=o.roi_percentage}function x(){o&&(d.target_occupation_name=o.occupation_data.occupation_name,d.in_demand=o.occupation_data.in_demand);let t=wdtCareerCalculatorCalculate(D());s=t.currentBenefits,i=t.targetBenefits,d.years_left=t.years_left,d.training_total_cost=t.training_total_cost,d.training_living_expenses=t.training_living_expenses,d.training_total_income=t.training_total_income,d.training_duration=t.training_duration}function j(){let e=t("#wdt-ccc-training-cost").val();e&&e>0?t(".wdt-ccc-education-secondary").removeAttr("disabled"):t(".wdt-ccc-education-secondary").attr("disabled",!0)}
1function C(){let e=t("#wdt-ccc-extracted-salaries"),a=wdtGetNumber(t(e).find("#wdt-ccc-extracted-median").first().find(".wfwe-extracted-salary-item-value").data("value")),o=wdtGetNumber(t(e).find("#wdt-ccc-extracted-highest").first().find(".wfwe-extracted-salary-item-value").data("value"));o>2*a&&(o=2*a),o<=0?e.css("display","none"):(e.css("display","grid"),t(e).find(".wfwe-extracted-salary-item-container").each((function(e){let a=wdtGetNumber(t(this).find(".wfwe-extracted-salary-item-value").data("value")),r=1;o>0&&(r=a/o),r=r>1?1:r,t(this).find(".wdt-ccc-extracted-salary-item-bar").css("transform","scaleY( "+r+" )")})))}function D(){return{current_occupation:t("#wdt-ccc-current-occupation").val(),age:t("#wdt-ccc-age").val(),retirement_age:t("#wdt-ccc-retirement").val(),current_yearly_income:t("#wdt-ccc-income").val(),target_occupation:t("#wdt-ccc-target-occupation").val(),target_income:t("#wdt-ccc-target-income").val(),inflation_rate:t("#wdt-ccc-target-inflation").val(),education_cost:t("#wdt-ccc-training-cost").val(),education_duration:t("#wdt-ccc-training-duration").val(),program_commitment:t("#wdt-ccc-training-commitment").val(),living_costs:t("#wdt-ccc-training-living").val(),education_income:t("#wdt-ccc-training-income").val(),grants:t("#wdt-ccc-training-reimbursement").val()}}Chart.defaults.global.defaultFontFamily="proxima-nova",u([],6),b(),t("#wdt-ccc-target-occupation").on("wdt:ajaxresult",(function(e){let a=e.resultObj,o=t(this).parents(".wdt-ajax-select-container").first(),r=t(o).find(".wdt-ajax-select-search-results-result:not(.invalid-result)").length,n=t("#wdt-ccc-current-occupation").find("option[selected]").val()==a.value||a.disabled,i=t('<li id="wdt-ajax-select-search-results-result-'+r+'" aria-selected="false" role="option" class="wdt-ajax-select-search-results-result" data-value="'+a.value+'" '+(n?"disabled":"")+">"+a.text+"</li>");t(o).find(".wdt-ajax-select-search-results").append(i),e.preventDefault()})),t("#wdt-ccc-current-occupation").on("wdt:ajaxresult",(function(e){let a=e.resultObj,o=t(this).parents(".wdt-ajax-select-container").first(),r=t(o).find(".wdt-ajax-select-search-results-result:not(.invalid-result)").length,n=t("#wdt-ccc-target-occupation").find("option[selected]").val()==a.value||a.disabled,i=t('<li id="wdt-ajax-select-search-results-result-'+r+'" aria-selected="false" role="option" class="wdt-ajax-select-search-results-result" data-value="'+a.value+'" '+(n?"disabled":"")+">"+a.text+"</li>");t(o).find(".wdt-ajax-select-search-results").append(i),e.preventDefault()})),t("#wdt-ccc-form").on("reset",(function(e){confirm("Are you sure you want to reset all fields to blank on this calculator?")||e.preventDefault(),t("#wdt-ccc-current-occupation").html(""),t("#wdt-ccc-target-occupation").html(""),t("#wdt-ccc-current-occupation").val(null).trigger("change"),t("#wdt-ccc-target-occupation").val(null).trigger("change")})),t("#wdt-ccc-target-occupation").on("change",(function(){t(this).val();let e=Date.now();r=e,t("#wdt-ccc-loading-modal").addClass("open"),t("body,html").addClass("wdt-modal-open"),t.ajax({url:WDT.rest_url+"wedatatools/v1/career-calculator/occupation-data/",dataType:"json",data:{termSlug:t(this).val()},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:a=>{if(t("#wdt-ccc-loading-modal").removeClass("open"),t("body,html").removeClass("wdt-modal-open"),r!=e)return void console.log("Newer data request active. Discarding "+e+" results...");let n=a;o=n;let i=0;for(let e of Object.keys(n.salary_data))n.salary_data[e]&&0!=wdtGetNumber(n.salary_data[e])&&(i+=wdtGetNumber(n.salary_data[e])),t(".wfwe-extracted-salary-item[data-node="+e+"]>.wfwe-extracted-salary-item-value").data("value",Math.round(wdtGetNumber(n.salary_data[e])));0==i?(t("#wdt-ccc-extracted-salary-header").hide(),t("#wfwe-chart-extracted-salary").hide()):(t("#wdt-ccc-extracted-salary-header").show(),t("#wfwe-chart-extracted-salary").css("display","grid")),t("#wdt-ccc-education-salary-header").hide(),t("#wdt-ccc-extracted-salary-title").find("span#wdt-ccc-addtl-info").html("&nbsp;("+n.salary_data.salary_count+" sample"+(n.salary_data.salary_count>1||0==n.salary_data.salary_count?"s":"")+")"),t("#wdt-ccc-extracted-salary-desc").find("span#wdt-ccc-addtl-info").html("&nbsp;for "+n.occupation_data.occupation_name),t("#wdt-ccc-education-salary-desc").find("span#wdt-ccc-addtl-info").html("&nbsp;for "+n.occupation_data.occupation_name),t("#wdt-ccc-training-programs").empty(),n.education_programs.length>0?t("#wdt-ccc-training-programs-container").show():t("#wdt-ccc-training-programs-container").hide();for(let t of n.education_programs)w(t);t("#wdt-ccc-target-income").val(n.salary_data.percentile_25th),u(n.job_posting_activity,-1),n.occupation_data.in_demand?t("#wdt-ccc-in-demand-container").html('<p class="wdt-job-posting-badge-content in-demand"><i class="fa fa-star" aria-hidden="true"></i> This job is in demand.</p>'):t("#wdt-ccc-in-demand-container").empty(),h(n.salary_data),b()},error:e=>{t("#wdt-ccc-loading-modal").removeClass("open"),t("body,html").removeClass("wdt-modal-open"),console.log(e)}})})),t(".wfwe-extracted-salary-item-container").on("click",(function(e){l(t(this).find(".wfwe-extracted-salary-item").first())}
1)),t(".wfwe-extracted-salary-item").on("click",(function(t){t.preventDefault,l(this)})),t(document).on("click",".wdt-ccc-content-btn.wdt-ccc-education-program",(function(e){e.preventDefault(),t("#wdt-ccc-training-cost").val(t(this).data("cost")),t("#wdt-ccc-training-duration").val(t(this).data("duration")),t("#wdt-ccc-training-commitment").val(t(this).data("commitment")),d.program_name=t(this).data("title"),b()})),t(".wfwe-extracted-salary-item-container").on("mouseover",(function(){let e=this;t(".wfwe-extracted-salary-item-container").each((function(a){t(e).is(this)||t(this).find(".wdt-ccc-extracted-salary-item-bar").addClass("unfocused")}))})),t(".wfwe-extracted-salary-item-container").on("mouseleave",(function(e){t(".wfwe-extracted-salary-item-container").each((function(e){t(this).find(".wdt-ccc-extracted-salary-item-bar").removeClass("unfocused")}))})),t(".wdt-ccc-accordion-panel").on("keydown",(function(e){let a=t(this).parents(".wdt-ccc-accordion").first();switch(e.which){case 13:case 32:t(this).trigger("click"),e.preventDefault();break;case 38:let o=t(a).prev(".wdt-ccc-accordion");o.length?o.find(".wdt-ccc-accordion-panel").focus():t('.wdt-ccc-accordion-panel[data-position="last"]').focus(),e.preventDefault();break;case 40:let r=t(a).next(".wdt-ccc-accordion");r.length?r.find(".wdt-ccc-accordion-panel").focus():t('.wdt-ccc-accordion-panel[data-position="first"]').focus(),e.preventDefault();break;default:return}})),t(".wdt-cc-navigation-button").on("click",(function(e){e.preventDefault(),e.stopPropagation(),p(t("#"+t(this).attr("data-show")).find(".wdt-ccc-accordion-panel"))})),t(".wdt-ccc-accordion-panel").on("click",(function(e){e.preventDefault(),e.stopPropagation(),"active"==t(this).parents(".wdt-ccc-accordion").first().attr("data-status")?c(this):p(this)})),t("#wdt-ccc-current-none").on("change",(function(){this.checked?(t("#wdt-ccc-current-occupation").trigger("wdt:disable"),t("#wdt-ccc-income").prop("disabled",!0)):(t("#wdt-ccc-current-occupation").trigger("wdt:undisable"),t("#wdt-ccc-income").prop("disabled",!1))})),t("#wdt-ccc").find("input,select").on("change",(function(){b()})),t("#wdt-ccc").find("input,select").on("invalid",(function(){p(t(this).parents(".wdt-ccc-accordion").first().find(".wdt-ccc-accordion-panel"))})),t("#wdt-ccc-form").on("submit",(function(e){e.preventDefault();let a=t(this).find("*[required]"),r=!0;if(a.each((function(e){r&&(r=t(this)[0].reportValidity())})),r){if(wdt_career_calc_event_cap(D()),t(this).find("#wdt-ccc-calculate-btn").attr("disabled",!0),t(".wdt-ccc-accordion-panel").each((function(e){c(t(this))})),o&&o.occupation_data&&o.occupation_data.occupation_code){var i=0;function l(){++i>=1&&p()}function p(){t("#wdt-ccc-loading-modal").removeClass("open"),t("body,html").removeClass("wdt-modal-open"),t("#wdt-ccc-results").css("display","grid"),t([document.documentElement,document.body]).animate({scrollTop:t("#wdt-ccc-results").offset().top},1e3)}t("#wdt-ccc-loading-modal").addClass("open"),t("body,html").addClass("wdt-modal-open"),x(),_(),s=o.occupation_data.occupation_code,d=l,t("#wdt-ccc-related-results").each((function(e){let a=this,o=Date.now();n=o,t.ajax({url:WDT.rest_url+"wedatatools/v1/career-calculator/related-results/",data:{nocCode:s,nonce:t(a).data("nonce")},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:e=>{if(n!=o)return void console.log("Newer related request active. Discarding "+o+" results...");let r=e;t(a).html(r),d()},error:t=>{console.log(t),d()}})}))}var s,d;t(this).find("#wdt-ccc-calculate-btn").attr("disabled",!1)}})),jQuery(".chart-span").on("click",(function(t){t.preventDefault(),jQuery(this).siblings().removeClass("selected"),jQuery(this).addClass("selected");var e=jQuery(this).data("months");o&&u(o.job_posting_activity,e),_()}))}})),jQuery(document).ready((function(t){"use strict";if(jQuery("#vis-job-relationships").length>0){let s=(t,e,a,o,r,n)=>{if(t.stopPropagation(),e.hasClass("career-bubble-clicked"))e.removeClass("career-bubble-clicked"),n.style("stroke","rgba(0,0,0,0)").attr("marker-end","url(#end)"),a.style("stroke",(function(t){return"#01448b"}));else{e.addClass("career-bubble-clicked");var i=[];o&&o.forEach((function(t){r.noc==t.source.noc?i.push(t.target.noc):r.noc==t.target.noc&&i.push(t.source.noc)})),a.style("stroke",(function(t){return r.noc==t.noc||i.indexOf(t.noc)>=0?"#00ac9f":"#01448b"})),n.style("stroke",(function(t){return r===t.source||r===t.target?"#00ac9f":"rgba(0,0,0,0)"})).attr("marker-end",(function(t){return r===t.source||r===t.target?"url(#end-highlight)":"url(#end)"}))}};jQuery("body").width()>900&&jQuery("#wdt-career-explorer-sidebar").addClass("visible"),jQuery("#wdt-career-explorer-sidebar-toggle").on("click",(function(t){jQuery("#wdt-career-explorer-sidebar").toggleClass("visible")})),jQuery("#wdt-career-explorer-clear-filters").on("click",(function(t){jQuery("#vis-filter-sectors").val("all"),jQuery("#vis-filter-size").val("equal"),jQuery("#vis-filter-lang").val("en"),jQuery("#vis-search").val("").trigger("change")})),document.addEventListener("gesturestart",(function(t){t.preventDefault()}));var e=d3.select("#vis-job-relationships"),a=+jQuery(window).width(),o=jQuery("#vis-job-relationships").height(),r=e.append("g").attr("class","canvas"),n=r.append("svg:defs");n.selectAll("marker.default").data(["end"]).enter().append("svg:marker").attr("id",String).attr("class","default").attr("viewBox","0 -5 10 10").attr("refX",49).attr("refY",0).attr("markerWidth",3).attr("markerHeight",3).attr("orient","auto").append("svg:path").attr("d","M0,-5L10,0L0,5").attr("fill","rgba(0,0,0,0)"),n.selectAll("marker.highlight").data(["end-highlight"]).enter().append("svg:marker").attr("id",String).attr("class","highlight").attr("viewBox","0 -5 10 10").attr("refX",49).attr("refY",0).attr("markerWidth",3).attr("markerHeight",3).attr("orient","auto").append("svg:path").attr("d","M0,-5L10,0L0,5").attr("fill","#00ac9f");var i=d3.zoom().scaleExtent([.25,2]);e.call(i.on("zoom",(function(){r.attr("transform",d3.event.transform)})));let d=jQuery("#wdt-career-explorer").data("listing-nonce");jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/job-board/listings/",data:{nonce:d},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(n){if(n.success&&n.listings){let d=n.listings;console.log(d),d3.json("/data/job-relationships.json",(function(n,l){if(n)throw n;var c=filterNodes(l,d),p=filterLinks(l),u=d3.scaleLog().domain([d3.min(c,(function(t){return t.median_salary})),d3.max(c,(function(t){return t.median_salary}))]).range([9,20]),f=d3.scaleLinear().domain([d3.min(c,(function(t){return t.median_salary})),d3.max(c,(function(t){return t.median_salary}))]).range([60,150]),g=d3.forceSimulation(c).force("center",d3.forceCenter(a/2,o/2)).on("tick",(function(){m.attr("x1",(function(t){return t.source.x})).attr("y1",(function(t){return t.source.y})).attr("x2",(function(t){return t.target.x})).attr("y2",(function(t){return t.target.y})),w.attr("cx",(function(t){return t.x})).attr("cy",(function(t){return t.y})),h.attr("x",(function(t){return t.x})).attr("y",(function(t){return t.y+5})),b.attr("x",(function(t){return t.x})).attr("y",(function(t){return t.y+5})),y.attr("x",(function(t){return t.x})).attr("y",(function(t){return t.y+5})),v.attr("cx",(function(t){return t.x})).attr("cy",(function(t){return t.y+t.radius})),_.attr("x",(function(t){return t.x})).attr("y",(function(t){return t.y+t.radius+4}))})),m=r.append("g").attr("class","links").selectAll("line"),w=r.append("g").attr("class","nodes").selectAll("circle"),h=r.append("g").attr("class","labels").selectAll("text"),b=r.append("g").attr("class","labels2").selectAll("text"),y=r.append("g").attr("class","labels3").selectAll("text"),v=r.append("g").attr("class","nodes-job").selectAll("circle"),_=r.append("g").attr("class","labels-job").selectAll("text");function k(){c=filterNodes(l,d),p=filterLinks(l),(w=w.data(c,(function(t){return t.noc})).attr("r",(function(t){return t.radius}
1))).exit().remove(),w=w.enter().append("circle").attr("r",(function(t){return t.radius})).attr("stroke-width",5).attr("stroke",(function(t){return t.in_demand,"#01448b"})).attr("stroke-dasharray",(function(t){return"A"==t.noc.charAt(4)?"1, 6":""})).attr("stroke-linecap","round").attr("fill",(function(t){return t.in_demand?"#01448b":"#ffffff"})).on("click",(function(e){(x(),jQuery("#vis-detail-panel").find(".detail-inner").html(buildDetailTemplate(e,d)),fetchRelatedBlogPosts(e.noc),fetchRelatedTrades(e.noc),fetchRelatedPrograms(e.noc),fetchRelatedTraining(e.noc),fetchWageSalaryData(e.noc),fetchSkillsData(e.noc),activatePanelTabs(),"function"==typeof trackResearchEvent&&trackResearchEvent("weexplore|click-noc-bubble|"+e.noc),"function"==typeof wdt_event_cap)&&wdt_event_cap({t:"Career Explorer",ac:"Click Occupation",e:"",d:"",no2021:e.noc,na:""});let a=t(this);s(d3.event,a,w,p,e,m)})).merge(w),(v=v.data(c,(function(t){return t.noc})).attr("r",(function(t){return t.jobs>0?10:0}))).exit().remove(),v=v.enter().append("circle").attr("r",(function(t){return t.jobs>0?10:0})).attr("fill","#00ac9f").on("click",(function(t){(x(),jQuery("#vis-detail-panel").find(".detail-inner").html(buildDetailTemplate(t,d)),fetchRelatedBlogPosts(t.noc),fetchRelatedTrades(t.noc),fetchRelatedPrograms(t.noc),fetchRelatedTraining(t.noc),fetchWageSalaryData(t.noc),fetchSkillsData(t.noc),activatePanelTabs(),"function"==typeof trackResearchEvent&&trackResearchEvent("weexplore|click-noc-bubble|"+t.noc),"function"==typeof wdt_event_cap)&&wdt_event_cap({t:"Career Explorer",ac:"Click Occupation",e:"",d:"",no2021:t.noc,na:""})})).merge(v),(h=h.data(c,(function(t){return t.noc})).text((function(t){return t.label1})).attr("font-size",(function(t){return t.text_scale}))).exit().remove(),h=h.enter().append("text").text((function(t){return t.label1})).attr("font-size",(function(t){return u(t.text_scale)})).attr("dy","-1em").attr("text-anchor","middle").attr("fill",(function(t){return t.in_demand?"#ffffff":"#00000"})).on("click",(function(e){(x(),jQuery("#vis-detail-panel").find(".detail-inner").html(buildDetailTemplate(e,d)),fetchRelatedBlogPosts(e.noc),fetchRelatedTrades(e.noc),fetchRelatedPrograms(e.noc),fetchRelatedTraining(e.noc),fetchWageSalaryData(e.noc),fetchSkillsData(e.noc),activatePanelTabs(),"function"==typeof trackResearchEvent&&trackResearchEvent("weexplore|click-noc-bubble|"+e.noc),"function"==typeof wdt_event_cap)&&wdt_event_cap({t:"Career Explorer",ac:"Click Occupation",e:"",d:"",no2021:e.noc,na:""});let a=t(this);s(d3.event,a,w,p,e,m)})).merge(h),(b=b.data(c,(function(t){return t.noc})).text((function(t){return t.label2})).attr("font-size",(function(t){return t.text_scale}))).exit().remove(),b=b.enter().append("text").text((function(t){return t.label2})).attr("font-size",(function(t){return u(t.text_scale)})).attr("dy",(function(t){return""==t.label1&&""!=t.label2&&""!=t.label3?"-0.5em":"0em"})).attr("text-anchor","middle").attr("fill",(function(t){return t.in_demand?"#ffffff":"#00000"})).on("click",(function(e){(x(),jQuery("#vis-detail-panel").find(".detail-inner").html(buildDetailTemplate(e,d)),fetchRelatedBlogPosts(e.noc),fetchRelatedTrades(e.noc),fetchRelatedPrograms(e.noc),fetchRelatedTraining(e.noc),fetchWageSalaryData(e.noc),fetchSkillsData(e.noc),activatePanelTabs(),"function"==typeof trackResearchEvent&&trackResearchEvent("weexplore|click-noc-bubble|"+e.noc),"function"==typeof wdt_event_cap)&&wdt_event_cap({t:"Career Explorer",ac:"Click Occupation",e:"",d:"",no2021:e.noc,na:""});let a=t(this);s(d3.event,a,w,p,e,m)})).merge(b),(y=y.data(c,(function(t){return t.noc})).text((function(t){return t.label3})).attr("font-size",(function(t){return t.text_scale}))).exit().remove(),y=y.enter().append("text").text((function(t){return t.label3})).attr("font-size",(function(t){return u(t.text_scale)})).attr("dy",(function(t){return""==t.label1&&""!=t.label2&&""!=t.label3?"0.5em":"1em"})).attr("text-anchor","middle").attr("fill",(function(t){return t.in_demand?"#ffffff":"#00000"})).on("click",(function(e){(x(),jQuery("#vis-detail-panel").find(".detail-inner").html(buildDetailTemplate(e,d)),fetchRelatedBlogPosts(e.noc),fetchRelatedTrades(e.noc),fetchRelatedPrograms(e.noc),fetchRelatedTraining(e.noc),fetchWageSalaryData(e.noc),fetchSkillsData(e.noc),activatePanelTabs(),"function"==typeof trackResearchEvent&&trackResearchEvent("weexplore|click-noc-bubble|"+e.noc),"function"==typeof wdt_event_cap)&&wdt_event_cap({t:"Career Explorer",ac:"Click Occupation",e:"",d:"",no2021:e.noc,na:""});let a=t(this);s(d3.event,a,w,p,e,m)})).merge(y),(_=_.data(c,(function(t){return t.noc})).text((function(t){return t.jobs>0?t.jobs:""}
1))).exit().remove(),_=_.enter().append("text").text((function(t){return t.jobs>0?t.jobs:""})).attr("font-size",10).attr("text-anchor","middle").attr("fill","#ffffff").on("click",(function(e){(x(),jQuery("#vis-detail-panel").find(".detail-inner").html(buildDetailTemplate(e,d)),fetchRelatedBlogPosts(e.noc),fetchRelatedTrades(e.noc),fetchRelatedPrograms(e.noc),fetchRelatedTraining(e.noc),fetchWageSalaryData(e.noc),fetchSkillsData(e.noc),activatePanelTabs(),"function"==typeof trackResearchEvent&&trackResearchEvent("weexplore|click-noc-bubble|"+e.noc),"function"==typeof wdt_event_cap)&&wdt_event_cap({t:"Career Explorer",ac:"Click Occupation",e:"",d:"",no2021:e.noc,na:""});let a=t(this);s(d3.event,a,w,p,e,m)})).merge(_),(m=m.data(p,(function(t){return t.source.id+"-"+t.target.id}))).exit().remove(),m=m.enter().append("line").attr("marker-end","url(#end)").merge(m),e.on("click",(function(){m.style("stroke","rgba(0,0,0,0)").attr("marker-end","url(#end)"),w.style("stroke",(function(){return"#01448b"}))})),g.nodes(c),g.force("charge",d3.forceManyBody().strength(50)),g.force("collide",d3.forceCollide().radius((function(t){return t.collide}))),g.force("link",d3.forceLink(p).id((function(t){return t.noc})).distance((function(t){return f(t.source.median_salary)}))),g.force("center"),g.alphaDecay(.08),g.velocityDecay(.4),g.alpha(1).stop();for(var a=0,o=Math.ceil(Math.log(g.alphaMin())/Math.log(1-g.alphaDecay()));a<o;++a)g.tick();g.restart()}function x(){jQuery("#vis-detail-panel").hasClass("visible")||jQuery("#vis-detail-panel").addClass("visible")}function j(){jQuery("#vis-detail-panel").removeClass("visible")}k(),jQuery("#vis-reset").on("click",(function(t){t.preventDefault(),d3.selectAll("svg").call(i.transform,d3.zoomIdentity),jQuery("#vis-filter-sectors").val("all"),jQuery("#vis-search").val(""),jQuery("#vis-filter-size").val("equal"),j(),k()})),jQuery("#vis-filter-sectors").on("change",(function(t){k();var e=jQuery(this).val();"function"==typeof wdt_dual_event_cap&&wdt_dual_event_cap("weexplore","filter-by-skill-type",e)})),jQuery("#vis-filter-lang").on("change",(function(t){k()})),jQuery("#vis-search").on("change",(function(t){k()})),jQuery("#vis-filter-lang").siblings("i").on("click",(function(t){})),jQuery("#vis-filter-size").on("change",(function(t){k()})),jQuery("#weexplore-switch").on("change",(function(t){"jobs"==jQuery(this).val()&&(location.href=wfwe_path_weexplore),"list"==jQuery(this).val()&&(location.href=wfwe_path_jobs),"map"==jQuery(this).val()&&(location.href=wfwe_path_map),"census"==jQuery(this).val()&&(location.href=wfwe_path_census)})),jQuery(".close-detail-panel").on("click",(function(t){j()})),"shown"!=localStorage.getItem("popState")&&localStorage.setItem("popState","shown")}))}},error:function(t){console.log(t)},complete:function(){}})}})),jQuery(document).ready((function(t){"use strict";t(document).on("submit",'form[data-target="wdt-portal-my-clients-assign-staff-form"]',(async function(e){let a=t(this).find('button[type="submit"]');e.preventDefault(),t(a).prop("disabled",!0);let o=t(this).find('button[type="submit"]').html();t(a).html('<div class="wdt-spinner wdt-spinner-small"></div>'),t(this).trigger("wdt:preSubmit");let r=t(this).data("preSubmitPromises");r&&(await Promise.all(r),t(this).data("preSubmitPromises",null));let n=[],i=t(this).find('[name="clients[]"]');t(i).each((function(e){n.push(t(this).val())})),n=[...new Set(n)];let s=this,d=t(s).serializeArray();jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/add-staff-to-clients/",data:d,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?wdtDisplayNotification("Successfully assigned staff to clients.","success",5e3):wdtDisplayNotification("Could not assign staff: "+t.response,"error",-1)},error:function(t){t.responseJSON.response?wdtDisplayNotification("Could not assign staff: "+t.responseJSON.response,"error",-1):wdtDisplayNotification("Could not assign staff: error making request.","error",-1)},complete:function(){t(s).trigger("wdt:complete"),t(a).html(o)}})})),t(document).on("change",'[data-target="wdt-portal-my-clients-assign-staff-form"] [name="staff[]"]',(function(){let e=t(this).parents('[data-target="wdt-portal-my-clients-assign-staff-form"]').first(),a=t(this).find("option:selected").length>0;
1t(e).find('button[type="submit"]').prop("disabled",!a)})),t(document).on("wdt:initializeAssignStaff","#wdt-portal-my-clients-assign-staff-form",(function(e){let a=this,o=e._clients,r=e._serviceProvider,n=t(a).find('[name="staff[]"]').parents('[data-wdt-material-form-target="typeahead-select-container"]');t(n).attr("data-action",t(n).attr("data-action")+"?serviceProviders[]="+r),t(a).find('[name="service_provider"]').val(r);let i=o.length;for(let e of o)t(a).find('[name="nonce"]').before('<input type="hidden" name="clients[]" value="'+e+'">'),t(a).find("");t(a).find('[data-target="wdt-portal-my-clients-assign-staff-tasks-client-count"]').text(i),t(a).find('[data-target="wdt-material-form-date-input"]').trigger("wdtrf:register")}))})),jQuery(document).ready((function(t){"use strict";function e(e){let a=t(e).find('[name="staff[]"] option:selected').length>0,o=t(e).find('[name="staff_assignment_mode"]:checked').length>0,r=!t(e).find('[data-target="assign-staff-task-assignments-section"]').is(":visible")||t(e).find('[name="task_assignment_mode"]:checked').length>0;t(e).find('[data-target="assign-staff-existing-save"]').prop("disabled",!(a&&o&&r))}function a(e){let a=t(e).find('[data-target="assign-staff-remove-task-section"]'),o=t(e).find('[data-target="assign-staff-reassign-warning"]');if(!("reassign-remaining"===t(e).find('[name="remove_task_assignment_mode"]:checked').val())||!a.is(":visible"))return void o.hide();let r=t(e).data("client-staff-map")||{},n=new Set((t(e).find('[data-target="assign-staff-remove-staff-select"] select.wdt-ajax-select-source').val()||[]).map(String));if(0===n.size)return void o.hide();let i=!1;for(let t in r){let e=r[t];if(Array.isArray(e)&&0!==e.length&&(0!==e.filter((function(t){return n.has(String(t))})).length&&0===e.filter((function(t){return!n.has(String(t))})).length)){i=!0;break}}i?o.show():o.hide()}function o(e){let a=(t(e).find('[data-target="assign-staff-remove-staff-select"] select.wdt-ajax-select-source').val()||[]).length>0,o=!t(e).find('[data-target="assign-staff-remove-task-section"]').is(":visible")||t(e).find('[name="remove_task_assignment_mode"]:checked').length>0;t(e).find('[data-target="assign-staff-existing-save"]').prop("disabled",!(a&&o))}t(document).on("change",'[data-target="wdt-assign-staff-existing"] [name="staff_action"]',(function(){let r=t(this).closest('[data-target="wdt-assign-staff-existing"]'),n=t(this).val();if("add-replace"===n)t(r).find('[data-target="assign-staff-remove-fields"]').hide(),t(r).find('[data-target="assign-staff-reassign-warning"]').hide(),t(r).find('[data-target="assign-staff-add-replace-fields"]').show(),t(r).data("has-tasks")&&t(r).find('[data-target="assign-staff-task-assignments-section"]').show(),t(r).data("show-intake")&&t(r).find('[data-target="assign-staff-intake-tasks-label"]').show(),e(r);else if("remove-all"===n){if(t(r).find('[data-target="assign-staff-add-replace-fields"]').hide(),t(r).find('[data-target="assign-staff-remove-fields"]').show(),t(r).data("has-tasks")&&t(r).find('[data-target="assign-staff-remove-task-section"]').show(),t(r).data("remove-staff-loaded"))a(r);else{let e=t(r).data("clients"),n=t(r).data("assignment-nonce");t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/clients/assigned-staff/",data:{nonce:n,clients:e},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.success){t(r).data("client-staff-map",e.client_staff_map),t(r).data("remove-staff-loaded",!0);let n=t(r).find('[data-target="assign-staff-remove-staff-select"]'),i=n.find(".wdt-ajax-local-options"),s=n.find("select.wdt-ajax-select-source");i.empty(),s.empty();for(let a of e.staff)i.append(t("<li></li>").addClass("wdt-ajax-select-search-results-result").attr({"aria-selected":"false",role:"option","data-value":a.id,"data-depth":"0"}).text(a.name)),s.append(t("<option></option>").attr({value:a.id,selected:"selected"}).text(a.name));wdtRefreshAjaxSelectOptions(n),o(r),a(r)}},error:function(){}})}o(r)}})),t(document).on("change",'[data-target="wdt-assign-staff-existing"] [name="staff[]"]',(function(){e(t(this).closest('[data-target="wdt-assign-staff-existing"]'))})),t(document).on("change",'[data-target="wdt-assign-staff-existing"] [name="staff_assignment_mode"]',(function(){e(t(this).closest('[data-target="wdt-assign-staff-existing"]'))})),t(document).on("change",'[data-target="wdt-assign-staff-existing"] [name="task_assignment_mode"]',(function(){e(t(this).closest('[data-target="wdt-assign-staff-existing"]'))})),t(document).on("change",'[data-target="wdt-assign-staff-existing"] [name="remove_task_assignment_mode"]',(function(){let e=t(this).closest('[data-target="wdt-assign-staff-existing"]');o(e),a(e)})),t(document).on("change",'[data-target="assign-staff-remove-staff-select"] select.wdt-ajax-select-source',(function(){let e=t(this).closest('[data-target="wdt-assign-staff-existing"]');o(e),a(e)})),t(document).on("click",'[data-target="assign-staff-existing-save"]',(function(){let e=t(this).closest('[data-target="wdt-assign-staff-existing"]'),a=t(e).find('[name="staff_action"]:checked').val(),o=t(e).data("clients");if(wdtForceRemoveContentModal(),"remove-all"!==a){if("add-replace"===a){let a=t(e).find('[name="staff_assignment_mode"]:checked').val(),r=t(e).find('[name="task_assignment_mode"]:checked').val(),n=t(e).find('[name="staff[]"]').val(),i=t(e).data("assignment-nonce");t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/update-staff-assignments/",data:{nonce:i,clients:o,staff:n,staff_assignment_mode:a,task_assignment_mode:r},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success?(wdtDisplayNotification("Successfully updated staff assignments.","success",5e3),t(document).trigger("wdt:existingStaffAssignmentsComplete")):wdtDisplayNotification(e.response||"Could not update staff assignments.","error",-1)},error:function(t){let e=t.responseJSON?.response||"Error making request.";wdtDisplayNotification("Could not update staff assignments: "+e,"error",-1)}})}}else{let a=t(e).find('[name="remove_task_assignment_mode"]:checked').val(),r=t(e).find('[data-target="assign-staff-remove-staff-select"] select.wdt-ajax-select-source').val()||[],n=t(e).data("assignment-nonce");t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/remove-staff-assignments/",data:{nonce:n,clients:o,staff:r,task_assignment_mode:a},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success?(wdtDisplayNotification("Successfully removed staff assignments.","success",5e3),t(document).trigger("wdt:existingStaffAssignmentsComplete")):wdtDisplayNotification(e.response||"Could not remove staff assignments.","error",-1)},error:function(t){let e=t.responseJSON?.response||"Error making request.";wdtDisplayNotification("Could not remove staff assignments: "+e,"error",-1)}})}})),t(document).on("wdt:initializeAssignStaffExisting",'[data-target="wdt-assign-staff-existing"]',(function(e){let a=this,o=e._clients,r=e._serviceProvider,n=e._clientsWithStaffCount,i=e._clientsWithStaffIds,s=e._tasksNonce,d=e._hasReferrals,l=e._hasNewClients,c=e._hasOldClients;t(a).data("clients",o),t(a).data("service-provider",r),t(a).find('[data-target="assign-staff-client-count"]').text(n);let p=new URL(WDT.portal_url);p.searchParams.set("wdt-page","my-clients");for(let t of i)p.searchParams.append("client_ids[]",t);t(a).find('[data-target="assign-staff-clients-link"]').attr("href",p.toString());let u=new URL(WDT.portal_url);u.searchParams.set("wdt-page","tasks");for(let t of o)u.searchParams.append("client[]",t);t(a).find('[data-target="assign-staff-tasks-link"]').attr("href",u.toString());let f=d||l;if(t(a).data("show-intake",f),f){let e;e=d||c?!d&&c?"Include intake tasks for new clients only":d&&(l||c)?"Include intake tasks for referrals and new clients only":"Include intake tasks":"Include intake tasks",t(a).find('[data-target="assign-staff-intake-tasks-text"]').text(e)}t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/case-tasks/",data:{nonce:s,number:1,page:1,client:o},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.success){let o=e.body.total;t(a).find('[data-target="assign-staff-task-count"]').text(o),t(a).data("has-tasks",o>0)}},error:function(){}})}))})),jQuery((function(t){"use strict";function e(){let e=[],a=t("select#wdt-skilled-trades-red-seal");a.length&&e.push({label:"red-seal",text:a.val()});let o=t("select#wdt-skilled-trades-education");o.length&&e.push({label:"education",text:o.val()});let r=t("select#wdt-skilled-trades-sector");return r.length&&e.push({label:"sector",text:r.val()}),e}function a(){let e=t("select#wdt-skilled-trades-red-seal"),a=t("select#wdt-skilled-trades-education"),o=t("select#wdt-skilled-trades-sector");if(e.length&&a.length&&o.length){let r=e.val(),n=a.val(),i=o.val(),s=e.find("option"),d=a.find("option"),l=o.find("option");s.each((function(e){t(this).prop("hidden",null);let a=t(this).val();""!=a&&(t('#wdt-trade-search-results>.wdt-preview-panel[data-red-seal="'+a+'"]'+(""!=n?'[data-education="'+n+'"]':"")+(""!=i?'[data-sector="'+i+'"]':"")).length||t(this).prop("hidden",!0))})),d.each((function(e){t(this).prop("hidden",null);let a=t(this).val();""!=a&&(t('#wdt-trade-search-results>.wdt-preview-panel[data-education="'+a+'"]'+(""!=r?'[data-red-seal="'+r+'"]':"")+(""!=i?'[data-sector="'+i+'"]':"")).length||t(this).prop("hidden",!0))})),l.each((function(e){t(this).prop("hidden",null);let a=t(this).val();""!=a&&(t('#wdt-trade-search-results>.wdt-preview-panel[data-sector="'+a+'"]'+(""!=r?'[data-red-seal="'+r+'"]':"")+(""!=n?'[data-education="'+n+'"]':"")).length||t(this).prop("hidden",!0))}))}}function o(e,a,o=[]){wdtAnnounce("Filtering results");var r=t("#"+e+"-results").find(".wdt-preview-panel");let n=!0;return r.each((function(e){let r=!0;if(a.length>=3){var i=t(this).text().toLowerCase().trim(),s=t(this).children("a").data("alt-titles"),d=(t(this),s?Array.from(s.split(",")):[i]),l=!1,c={};d.push(i);try{d.forEach((function(t){if(l=t.trim().toLowerCase().indexOf(a)>=0)throw c}))}catch(t){if(t!==c)throw t}r=l}if(r&&o.length)for(let e of o){if(!e.text)continue;let a=t(this).data(e.label);if(!a||a!=e.text){r=!1;break}}r?(t(this).show(),n=!1):t(this).hide()})),n}t("#wdt-occupation-search,#wdt-trade-search,#wdt-edu-program-search").on("keyup",(function(a){let r=t(this).attr("id");var n=t(this).val().toLowerCase().trim();let i=e();a.keyCode>=48&&a.keyCode<=57||a.keyCode>=65&&a.keyCode<=90||a.keyCode>=97&&a.keyCode;o(r,n,i)?t(this).addClass("wdt-panel-search-error"):t(this).removeClass("wdt-panel-search-error")})),t("#wdt-trade-search-filters").find("select,input").on("change",(function(r){let n="wdt-trade-search";o(n,t("#"+n).val().toLowerCase().trim(),e())?t("#wdt-trade-search").addClass("wdt-panel-search-error"):t("#wdt-trade-search").removeClass("wdt-panel-search-error"),a()})),t("#wdt-skilled-trades-filter-clear").on("click",(function(e){t("#wdt-trade-search-filters").find("select>option:selected").prop("selected",!1),t("#wdt-trade-search").val(""),t("#wdt-trade-search").removeClass("wdt-panel-search-error"),o("wdt-trade-search","",[]),a()})),t(".wdt-button[data-action=wdt_occupations_selected_occupation]").on("click",(e=>{let a=t(e.target).prev().data("noc");a?wfwe_setCookie("wdt_occupations_selected_occupation",a,365):console.error("Error: Could not perform action. Could not find a NOC")}))}
1)),jQuery(document).ready((function(t){"use strict";if(t("button.wdt-occupation-profile-email").on("click",(function(e){let a=t(this).data("nonce"),o=t(this).data("noc-code");var r;a&&o&&(r=o,t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/career-profile/share/",data:{nocCode:r},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&t("body").append(e.html)},error:function(t){console.log(t),wdtDisplayNotification("Error retrieving Share Profile Modal.","error",-1)}}))})),jQuery(".wfwe-extracted-salary-item, .wfwe-range-bar > .wfwe-range-bar-node").on("click",(function(){jQuery(this).closest("#wfwe-chart-extracted-salary").find(".wfwe-range-bar-node").css("z-index",10),jQuery(this).closest("#wfwe-chart-extracted-salary").find(".wfwe-range-bar-node").addClass("minimized");var t=jQuery(this).data("node");jQuery(this).closest("#wfwe-chart-extracted-salary").find(".wfwe-range-bar-node."+t).removeClass("minimized"),jQuery(this).closest("#wfwe-chart-extracted-salary").find(".wfwe-range-bar-node."+t).css("z-index",15)})),jQuery(".wfwe-extracted-salary-item, .wfwe-range-bar > .wfwe-range-bar-node").on("mouseover",(function(){jQuery(this).closest("#wfwe-chart-extracted-salary").find(".wfwe-range-bar-node").css("z-index",10),jQuery(this).closest("#wfwe-chart-extracted-salary").find(".wfwe-range-bar-node").addClass("minimized");var t=jQuery(this).data("node");jQuery(this).closest("#wfwe-chart-extracted-salary").find(".wfwe-range-bar-node."+t).removeClass("minimized"),jQuery(this).closest("#wfwe-chart-extracted-salary").find(".wfwe-range-bar-node."+t).css("z-index",15)})),jQuery(".wfwe-extracted-salary-item, .wfwe-range-bar > .wfwe-range-bar-node").on("mouseleave",(function(){jQuery(this).closest("#wfwe-chart-extracted-salary").find(".wfwe-range-bar-node").removeClass("minimized")})),t("#wfwe-chart-extracted-salaries").length,t("#wfwe-participants-by-age-group").length>0){var e=document.getElementById("wfwe-participants-by-age-group").getContext("2d");new Chart(e,{type:"doughnut",data:{datasets:[{data:wfwe_data_participants_by_age,backgroundColor:["#4285f4","#db4436","#fa8f03","#149d58","#ab47bc","#2aacc1","#fa7044"]}],labels:["15 to 24 years","25 to 34 years","35 to 44 years","45 to 54 years","55 to 64 years","65 to 74 years","75 years and over"]},options:{cutoutPercentage:40,animation:{animateRotate:!1,animateScale:!0},legend:{position:"right"},plugins:{datalabels:{formatter:function(t,e){var a=0;e.chart.data.datasets[0].data.map((function(t){a+=t}));var o=(100*t/a).toFixed(0);return o>0?o+"%":""},color:"white"}}}})}if(t("#wfwe-participants-by-industry").length>0){var a=document.getElementById("wfwe-participants-by-industry").getContext("2d");new Chart(a,{type:"doughnut",data:{datasets:[{data:wfwe_data_participants_by_industry,backgroundColor:["#4285f4","#db4436","#fa8f03","#149d58","#ab47bc","#2aacc1","#fa7044","#9e9d24","#5c6bc0","#f06292","#15796b","#c2195b","#7e57c2","#36a9f4","#8bc34a","#fbd835","#fa8c01","#8d6e63","#9e9e9e","#607d8b"]}],labels:["Agriculture, forestry, fishing and hunting","Mining, quarrying, and oil and gas extraction","Utilities","Construction","Manufacturing","Wholesale trade","Retail trade","Transportation and warehousing","Information and cultural industries","Finance and insurance","Real estate and rental and leasing","Professional, scientific and technical services","Management of companies and enterprises","Administrative and support, waste management and remediation services","Educational services","Health care and social assistance","Arts, entertainment and recreation","Accommodation and food services","Other services","Public administration"]},options:{cutoutPercentage:40,animation:{animateRotate:!1,animateScale:!0},legend:{display:!1},plugins:{datalabels:{formatter:function(t,e){var a=0;e.chart.data.datasets[0].data.map((function(t){a+=t}));var o=(100*t/a).toFixed(0);return o>0?o+"%":""},color:"white"}}}})}if(t("#wfwe-participants-by-employment-type").length>0){var o=document.getElementById("wfwe-participants-by-employment-type").getContext("2d");new Chart(o,{type:"doughnut",data:{datasets:[{data:wfwe_data_participants_by_employment_type,backgroundColor:["#2aacc1","#4285f4"]}],labels:["Part Time","Full Time"]},options:{cutoutPercentage:40,animation:{animateRotate:!1,animateScale:!0},legend:{position:"right"},plugins:{datalabels:{formatter:function(t,e){var a=0;e.chart.data.datasets[0].data.map((function(t){a+=t}));var o=(100*t/a).toFixed(0);return o>0?o+"%":""},color:"white"}}}})}if(t("#wfwe-participants-by-gender").length>0){var r=document.getElementById("wfwe-participants-by-gender").getContext("2d");new Chart(r,{type:"doughnut",data:{datasets:[{data:wfwe_data_participants_by_sex,backgroundColor:["#4285f4","#ab47bc"]}],labels:["Male","Female"]},options:{cutoutPercentage:40,animation:{animateRotate:!1,animateScale:!0},legend:{position:"right"},plugins:{datalabels:{formatter:function(t,e){var a=0;e.chart.data.datasets[0].data.map((function(t){a+=t}));var o=(100*t/a).toFixed(0);return o>0?o+"%":""},color:"white"}}}})}if(t("#wfwe-participants-by-labour-status").length>0){var n=document.getElementById("wfwe-participants-by-labour-status").getContext("2d");new Chart(n,{type:"doughnut",data:{datasets:[{data:wfwe_data_participants_by_labour_status,backgroundColor:["#4285f4","#db4436"]}],labels:["Employed","Unemployed"]},options:{cutoutPercentage:40,animation:{animateRotate:!1,animateScale:!0},legend:{position:"right"},plugins:{datalabels:{formatter:function(t,e){var a=0;e.chart.data.datasets[0].data.map((function(t){a+=t}));var o=(100*t/a).toFixed(0);return o>0?o+"%":""},color:"white"}}}})}if(t("#wfwe-participants-by-education").length>0){var i=document.getElementById("wfwe-participants-by-education").getContext("2d");new Chart(i,{type:"doughnut",data:{datasets:[{data:wfwe_data_participants_by_education,backgroundColor:["#4285f4","#db4436","#fa8f03","#149d58","#ab47bc","#2aacc1","#fa
17044","#9e9d24","#5c6bc0","#f06292","#15796b","#c2195b","#7e57c2","#36a9f4","#8bc34a","#fbd835","#fa8c01","#8d6e63","#9e9e9e","#607d8b","#555555"]}],labels:["No certificate, diploma or degree","Secondary (high) school diploma or equivalency certificate","Apprenticeship or trades certificate or diploma","College, CEGEP or other non-university certificate or diploma","University certificate or diploma below bachelor level","University certificate, diploma or degree at bachelor level or above"]},options:{cutoutPercentage:40,animation:{animateRotate:!1,animateScale:!0},legend:{display:!1},plugins:{datalabels:{formatter:function(t,e){var a=0;e.chart.data.datasets[0].data.map((function(t){a+=t}));var o=(100*t/a).toFixed(0);return o>0?o+"%":""},color:"white"}}}})}t(document).on("mousedown","#wdt-career-profile-modal-container",(function(e){t("body").find("#wdt-career-profile-modal-container").remove()})),t(document).on("mousedown","#wdt-career-profile-modal",(function(t){t.stopPropagation()})),t(document).on("submit","#wdt-career-profile-modal-form",(function(e){e.preventDefault();let a=t(this).find("*[required]"),o=!0;if(a.each((function(e){o&&(o=t(this)[0].reportValidity())})),!o)return;let r=t(this).data("nonce"),n=t(this).data("noc-code"),i=t(this).find('input[name="email"]').first().val(),s=t(this).find('input[name="message"]').first().val();jQuery.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/career-profile/send/",data:{nonce:r,nocCode:n,emailAddress:i,message:s},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){t("body").find("#wdt-career-profile-modal-container").remove(),wdtDisplayNotification("Successfully sent email.","success")},error:function(e){t("body").find("#wdt-career-profile-modal-container").remove(),wdtDisplayNotification("Error sending email. Please double check recipients email address.","error",-1),console.log(e)}})}))})),jQuery(document).ready((function(t){"use strict";var e=t("#wdt-add-employer-page");if(e.length){var a=e.data("nonce"),o=e.find('[data-target="add-employer-search-results"]'),r=e.find('template[data-target="spinner"]'),n=e.find('template[data-target="no-results"]'),i=e.find('template[data-target="employer-search-table"]'),s=e.find('[data-action="add-employer-search"]'),d=e.find("#wdt-add-employer-search-form");if(s.length&&d.length&&o.length){var l=e.find('[data-target="add-employer-continue"]');l.hide();var c=l.attr("href")||"",p=null,u="";s.on("click",m),d.on("submit",(function(t){t.preventDefault(),m()}))}}function f(){if(""!==c&&""!==u){var t=new URL(c,window.location.href);t.searchParams.set("wdt-employer-name",u),l.attr("href",t.toString())}l.show()}function g(){o.empty(),o.append(t(n[0].content.cloneNode(!0))),f()}function m(){var e=d.find('[name="query"]'),n=d.find('[name="cityTown"]'),s=e.val()?e.val().trim():"",l=n.val()?n.val().trim():"";s?(p&&p.abort(),u=s,o.empty(),o.append(t(r[0].content.cloneNode(!0))),p=t.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/employers",data:{query:s,cityTown:l,includeArchived:1,format:"add-employer-existing-table",nonce:a},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&e.body&&e.body.employers&&e.body.employers.length?function(e){o.empty();var a=t(i[0].content.cloneNode(!0)),r=a.find("tbody");r.length&&r.html(e.join("")),o.append(a),f()}(e.body.employers):g()},error:function(t){"abort"!==t.statusText&&g()},complete:function(){p=null}})):e.trigger("focus")}})),jQuery(document).ready((function(t){"use strict";t(document).on("click",'[data-action="wdt-employer-directory-follow"]',(function(e){e.preventDefault(),e.stopPropagation();let a=t(this),o=a.attr("data-employer-slug");if(!o||a.prop("disabled"))return;let r=a.attr("data-follow-nonce")||"",n=a.hasClass("is-following"),i=!n,s=n?"unfollow":"follow";function d(t){a.toggleClass("is-following",t),a.toggleClass("not-following",!t),a.attr("title",t?"Unfollow employer":"Follow employer")}d(i),a.prop("disabled",!0),t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/companies/"+s,data:{object_slug:o,employer_id:a.attr("data-employer-id")||0,nonce:r},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){if(!t||!t.success)return d(n),void wdtDisplayNotification("Could not update followed employers.","error",-1);wdtDisplayNotification(i?"Employer added to My Employers.":"Employer removed from My Employers.","success",3e3)},error:function(){d(n),wdtDisplayNotification("Could not update followed employers.","error",-1)},complete:function(){a.prop("disabled",!1)}})}));var e=null;function a(t){let e=t.closest('[data-target="wdt-employer-directory-note-form"]'),a=e.data("employerIds")||[];wdtSyncEmployerNoteTaskFields(t,e,a[0])}t(document).on("click",'#wdt-portal-employer-archive [data-action="wdt-employer-archive-open-tag-modal"]',(function(e){let a=t("#wdt-portal-employer-archive-bulk-edit").clone(!0);_wdtRenderContentModal("Bulk Tag",a.html(),"wdt-portal-modal-alt");let o=t("#wdt-content-modal").find('[name="post-id[]"]'),r=t('#wdt-portal-employer-archive [data-target="wdt-portal-employer-archive-table"] tbody [name="select"]'),n=t(r).map((function(){if(this.checked)return t(this).val()})).get();for(let e of n){let a=t('<option value="'+e+'" selected>'+e+"</option>");o.append(a)}})),t(document).on("submit",'form[data-target="wdt-portal-employer-bulk-edit-form"]',(function(e){let a=t("#wdt-portal-employer-archive #wdt-portal-employer-archive-table");e.preventDefault();let o=t(this).serializeArray();t(a).trigger("wdt:loadState"),t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/employers/employer-mgmt/tag/",data:o,beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(a).trigger("wdt:loadState"),wdtForceRemoveContentModal()},success:function(t){t.success&&wdtDisplayNotification("Successfully tagged postings.","success",3e3)},error:function(t){console.log(t)},complete:function(){t(a).trigger("wdt:refresh")}})})),t(document).on("click",'form[data-target="wdt-portal-employer-bulk-edit-form"] [data-action="close-bulk-edit-form"]',(function(t){wdtForceRemoveContentModal()})),t(document).on("click",'#wdt-portal-employer-archive [data-target="wdt-portal-employer-archive-table"] [data-action="restore-employer"]',(function(e){let a=t("#wdt-portal-employer-archive #wdt-portal-employer-archive-table"),o=t(this).attr("data-post-id"),r=t(this).attr("data-post-title"),n=t(this).attr("data-nonce");_wdtRenderConfirmModal("Restore Posting","Are you sure you want to move <strong>"+r+"</strong> out of the trash?",(function(){t(a).trigger("wdt:loadState"),t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/employers/employer-mgmt/restore/",data:{"post-id":[o],nonce:n},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success&&wdtDisplayNotification("Successfully restored postings","success",3e3)},error:function(t){console.log(t)},complete:function(){t(a).trigger("wdt:refresh")}})}),(function(){}),"Restore","wdt-portal-modal-alt")})),t(document).on("click",'#wdt-portal-employer-archive [data-target="wdt-portal-employer-archive-table"] [data-action="delete-employer"]',(function(e){let a=t("#wdt-portal-employer-archive #wdt-portal-employer-archive-table"),o=t(this).attr("data-post-id"),r=t(this).attr("data-post-title"),n=t(this).attr("data-nonce");_wdtRenderConfirmModal("Delete Posting","Are you sure you want to move <strong>"+r+"</strong> to the trash?",(function(){t(a).trigger("wdt:loadState"),t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/employers/employer-mgmt/delete/",data:{"post-id":[o],nonce:n},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success&&wdtDisplayNotification("Successfully deleted postings","success",3e3)},error:function(t){console.log(t)},complete:function(){t(a).trigger("wdt:refresh")}})}),(function(){}),"Move To Trash","wdt-portal-modal-alt")})),t(document).on("click",'#wdt-portal-employer-archive [data-action="wdt-employer-archive-delete-postings"]',(function(e){let a=t(this).attr("nonce"),o=t("#wdt-portal-employer-archive #wdt-portal-employer-archive-table"),r=t('#wdt-portal-employer-archive [data-target="wdt-portal-employer-archive-table"] tbody [name="select"]'),n=t(r).map((function(){if(this.checked)return t(this).val()})).get();_wdtRenderConfirmModal("Delete Postings","Are you sure you want to move <strong>all</strong> selected employer postings to the trash?",(function(){t(o).trigger("wdt:loadState"),t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/employers/employer-mgmt/delete/",data:{"post-id":n,nonce:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success&&wdtDisplayNotification("Successfully deleted postings.","success",3e3)},error:function(t){console.log(t)},complete:function(){t(o).trigger("wdt:refresh")}})}),(function(){}),"Move To Trash","wdt-portal-modal-alt")})),t(document).on("change",'#wdt-portal-employer-archive [data-target="wdt-portal-employer-archive-table"] thead [name="select"]',(function(e){let a=t(this).parents("#wdt-portal-employer-archive").first();t(this).prop("checked")?t(a).find('[data-target="wdt-portal-employer-archive-table"] tbody [name="select"]').each((function(){t(this).prop("checked",!0)})):t(a).find('[data-target="wdt-portal-employer-archive-table"] tbody [name="select"]').each((function(){t(this).prop("checked",!1)})),t(a).find('[data-target="wdt-portal-employer-archive-table"] tbody [name="select"]').first().trigger("change")})),t(document).on("change",'#wdt-portal-employer-archive [data-target="wdt-portal-employer-archive-table"] tbody [name="select"]',(function(e){t('#wdt-portal-employer-archive [data-target="wdt-portal-dropdown-menu-toggle"]').trigger("wdt:refresh")})),t(document).on("wdt:refresh",'#wdt-portal-employer-archive [data-action="wdt-portal-dropdown-menu-toggle"]',(function(e){let a=t(this).parents("#wdt-portal-employer-archive").first(),o=t(a).find('[data-target="wdt-portal-employer-archive-table"] tbody [name="select"]'),r=t(o).filter(":checked"),n=r.map((function(){return t(this).val()})).get();t(this).prop("disabled",!n.length),o.length>0&&n.length===o.length?t(a).find('[data-target="wdt-portal-employer-archive-table"] thead [name="select"]').prop("checked",!0):t(a).find('[data-target="wdt-portal-employer-archive-table"] thead [name="select"]').prop("checked",!1);let i=[];r.each((function(){let e=t(this).attr("data-status");i.push("archived"===e?"archived":"active")}));let s=i.some((function(t){return"archived"===t})),d=i.some((function(t){return"active"===t})),l=!0===d&&!1===s,c=!0===s&&!1===d;t(a).find('[data-action="wdt-employer-directory-archive"]').prop("disabled",!1===l),t(a).find('[data-action="wdt-employer-directory-unarchive"]').prop("disabled",!1===c)})),t(document).on("wdt:populateTable","#wdt-portal-employer-archive #wdt-portal-employer-archive-table",(function(a){a.stopPropagation();let o=this;t(o).find('thead [name="select"]').prop("checked",!1);let r=t(this).attr("data-nonce"),n=t(this).attr("data-sort"),i=t(
1o).data("currentPage")||1,s=t('[data-archive-table] [name="perPage"]').val()||null,d=t('[data-archive-table] [name="search"]').val()||null,l=wdtSerializeMaterialForm(t("[data-filter-form]").first()),c={};for(let t in l){let e=l[t];e.length&&(c[t]=1===e.length?e[0].value:e.map((t=>t.value)))}let p=t("[data-archive-table-toggle] input");t(p).length&&t(p).prop("checked")&&(c[t(p).attr("name")]="true");let u={nonce:r,number:s,query:d,page:i,sort:n,format:"employer-directory-table",...c};for(let t in u)(null===u[t]||""===u[t]||Array.isArray(u[t])&&!u[t].length)&&delete u[t];e&&e.abort(),e=jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/employers/",data:u,beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(o).trigger("wdt:loadState")},success:function(e){if(t(o).find("tbody").html(""),t('#wdt-portal-employer-archive [data-action="wdt-portal-dropdown-menu-toggle"]').trigger("wdt:refresh"),e.success){let a=t.Event("wdt:updatePageDisplay");if(a.page=e.body.page,a.maxPage=e.body.max_page,t(o).trigger(a),e.body.employers.length)for(let a of e.body.employers){let e=t("<tbody>").html(a.html).children("tr").first();t(o).find("tbody").append(e)}else t('#wdt-portal-employer-archive [data-target="no-matches-found"]').show();let r=e.body.total;r&&(t('#wdt-portal-employer-archive [data-target="result-count-container"]').show(),t('#wdt-portal-employer-archive [data-target="result-count-container"] [data-target="result-count"]').text(wdtNumberFormat(r)));let n=e.body.page,i=e.body.max_page;t(o).data("max_page",i),1===n?(t('#wdt-portal-employer-archive [data-target="wdt-pagination"] [data-pg-action="first"]').prop("disabled",!0),t('#wdt-portal-employer-archive [data-target="wdt-pagination"] [data-pg-action="prev"]').prop("disabled",!0)):(t('#wdt-portal-employer-archive [data-target="wdt-pagination"] [data-pg-action="first"]').prop("disabled",!1),t('#wdt-portal-employer-archive [data-target="wdt-pagination"] [data-pg-action="prev"]').prop("disabled",!1)),n===i?(t('#wdt-portal-employer-archive [data-target="wdt-pagination"] [data-pg-action="next"]').prop("disabled",!0),t('#wdt-portal-employer-archive [data-target="wdt-pagination"] [data-pg-action="last"]').prop("disabled",!0)):(t('#wdt-portal-employer-archive [data-target="wdt-pagination"] [data-pg-action="next"]').prop("disabled",!1),t('#wdt-portal-employer-archive [data-target="wdt-pagination"] [data-pg-action="last"]').prop("disabled",!1))}t(o).trigger("wdt:changeCustomColumns")},error:function(t){"abort"!==t.statusText&&(wdtDisplayNotification("Unable to retrieve employers. Please contact administrator.","error",-1),console.log(t))},complete:function(){t(o).trigger("wdt:unloadState")}})})),t(document).on("click",'#wdt-portal-employer-archive [data-action="wdt-employer-directory-email-contacts"]',(function(e){let a=t('#wdt-portal-employer-archive [data-target="wdt-portal-employer-archive-table"] tbody [name="select"]:checked'),o=t(a).map((function(){return t(this).data("email")})).get().filter((function(t){return!!t}));o.length?window.location.href="mailto:?bcc="+encodeURIComponent(o.join(",")):wdtDisplayNotification("No email addresses found for selected employers.","error",3e3)})),t(document).on("click",'#wdt-portal-employer-archive [data-action="wdt-employer-directory-archive"]',(function(e){let a=t('#wdt-portal-employer-archive [data-target="wdt-portal-employer-archive-table"] tbody [name="select"]:checked'),o=t(a).map((function(){let e=parseInt(t(this).attr("data-employer-id"),10);return e>0?e:null})).get().filter(Boolean);if(!o.length)return void wdtDisplayNotification("No employers selected.","error",3e3);let r=o.length;_wdtRenderConfirmModal("Archive Employers","Are you sure you want to archive "+r+" employer"+(1!==r?"s":"")+"?",(function(){let e=t("#wdt-portal-employer-archive #wdt-portal-employer-archive-table");t(e).trigger("wdt:loadState"),wdtForceRemoveContentModal();let a=o.map((function(e){return t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/employer-profiles/archive",data:{employerId:e},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)}})}));t.when.apply(t,a).then((function(){wdtDisplayNotification("Successfully archived selected employers.","success",3e3)}),(function(){wdtDisplayNotification("Failed to archive some employers.","error",3e3)})).always((function(){t(e).trigger("wdt:refresh")}))}),(function(){}),"Archive","wdt-portal-modal-alt")})),t(document).on("click",'#wdt-portal-employer-archive [data-action="wdt-employer-directory-unarchive"]',(function(e){let a=t('#wdt-portal-employer-archive [data-target="wdt-portal-employer-archive-table"] tbody [name="select"]:checked'),o=t(a).map((function(){let e=parseInt(t(this).attr("data-employer-id"),10);return e>0?e:null}
1)).get().filter(Boolean);if(!o.length)return void wdtDisplayNotification("No employer profiles found for selected employers.","error",3e3);let r=o.length;_wdtRenderConfirmModal("Unarchive Employers","Are you sure you want to unarchive "+r+" employer"+(1!==r?"s":"")+"?",(function(){let e=t("#wdt-portal-employer-archive #wdt-portal-employer-archive-table");t(e).trigger("wdt:loadState"),wdtForceRemoveContentModal();let a=o.map((function(e){return t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/employer-profiles/unarchive",data:{employerId:e},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)}})}));t.when.apply(t,a).then((function(){wdtDisplayNotification("Successfully unarchived selected employers.","success",3e3)}),(function(){wdtDisplayNotification("Failed to unarchive some employers.","error",3e3)})).always((function(){t(e).trigger("wdt:refresh")}))}),(function(){}),"Unarchive","wdt-portal-modal-alt")})),t(document).on("click",'#wdt-portal-employer-archive [data-action="wdt-employer-directory-add-note"]',(function(e){let a=t('#wdt-portal-employer-archive [data-target="wdt-portal-employer-archive-table"] tbody [name="select"]:checked'),o=t(a).map((function(){let e=parseInt(t(this).attr("data-employer-id"),10);return e>0?e:null})).get().filter(Boolean);if(!o.length)return void wdtDisplayNotification("No employer profiles found for selected employers.","error",3e3);let r={};t(a).each((function(){let e=parseInt(t(this).attr("data-employer-id"),10);if(!(e>0))return;let a=t(this).closest("tr").find('[data-column="title"] .wdt-employer-directory-title-row').first().text().trim();r[e]=a||"Employer #"+e}));let n=t('[data-target="wdt-employer-directory-note-form-template"]').html();wdtRenderContentModal({title:"Add Note",content:n,className:"wdt-portal-modal-alt",id:"wdt-employer-bulk-notes-modal"});let i=t('#wdt-employer-bulk-notes-modal [data-target="wdt-employer-directory-note-form"]');i.data("employerIds",o),i.data("employerNames",r),i.find('[data-date-picker="wdt-material-form"]').removeClass("hasDatepicker").removeAttr("id").removeData("registered"),i.trigger("wdt:initializeForm");let s=i.find('[data-employer-note-form-target="employer-select"]');o.forEach((function(e){let a=t.Event("wdt:select");a.value=e,a.label=r[e],s.trigger(a)}))})),t(document).on("wdt:initializeForm",'#wdt-employer-bulk-notes-modal [data-target="task-forms"] li',(function(){let e=t(this).closest('[data-target="wdt-employer-directory-note-form"]'),a=e.data("employerIds")||[],o=e.data("employerNames")||{},r=t(this).find('[data-task-form-target="employer-select"]');a.forEach((function(e){let a=t.Event("wdt:select");a.value=e,a.label=o[e],r.trigger(a)}))})),t(document).on("wdt:showForm",'#wdt-employer-bulk-notes-modal [data-target="task-form-container"]',(function(){a(t(this))})),t(document).on("change",'#wdt-employer-bulk-notes-modal [name="relatedClientId"]',(function(){t(this).closest('[data-target="wdt-employer-directory-note-form"]').find('[data-target="task-forms"] [data-target="task-form-container"]').each((function(){a(t(this))}))})),t(document).on("click",'#wdt-employer-bulk-notes-modal [data-action="employer-notes-cancel"]',(function(t){wdtForceRemoveContentModal()})),t(document).on("submit",'#wdt-employer-bulk-notes-modal [data-target="wdt-employer-directory-note-form"]',(function(e){e.preventDefault();let a=t(this),o=a.find('[data-target="employer-notes-save"]'),r=a.data("employerIds")||[];if(!r.length)return void wdtDisplayNotification("No employer profiles selected.","error",3e3);let n=a.find('[name="noteDate"]').val(),i=a.find('[name="noteTime"]').val(),s=n+(i?" "+i:""),d={employerIds:r,noteContent:a.find('[name="noteContent"]').val(),noteDate:s},l=a.find('[name="activityTypeId"]').val();l&&(d.activityTypeSlug=l);let c=parseInt(a.find('[name="relatedClientId"]').val());c&&(d.relatedClientId=c),a.trigger("wdt:collectCaseTasks");let p=a.data("wdt:caseTasks");null!==p&&(p.length&&(d.tasks=p),o.prop("disabled",!0),t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/employer-case-notes/bulk-create",data:d,beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){o.prop("disabled",!1),e.success?(wdtDisplayNotification(e.message||"Case notes created.","success",3e3),wdtForceRemoveContentModal(),t("#wdt-portal-employer-archive #wdt-portal-employer-archive-table").trigger("wdt:refresh")):wdtDisplayNotification(e.message||"Could not save notes.","error",-1)},error:function(){o.prop("disabled",!1),wdtDisplayNotification("Could not save notes.","error",-1)}}))})),initializeArchiveTable(t("#wdt-portal-employer-archive [data-archive-table]"))})),jQuery(document).ready((function(t){"use strict";
1let e=t("#wdt-create-employer-page");if(!e.length)return;let a=e.data("profile-url-base"),o=e.find("#wdt-create-employer-form"),r=e.find("#wdt-create-employer-save-btn"),n=null;function i(t){r.prop("disabled",t)}function s(a){e.find(".wdt-create-employer-error-notice").remove();let r=t('<div class="wdt-inline-notice-banner wdt-banner-error wdt-create-employer-error-notice"></div>').text(a);o.before(r),r[0].scrollIntoView({behavior:"smooth",block:"nearest"})}o.on("input",'[name="wdt-employer-posting-website"]',(function(){this.setCustomValidity("")})),o.on("input",'[name="wdt-employer-posting-phone"], [name="wdt-employer-posting-alt-phone"], [name="wdt-employer-posting-fax"]',(function(){this.setCustomValidity("")})),o.on("input",'[name="wdt-employer-posting-postalzip"]',(function(){this.setCustomValidity("")})),r.on("click",(function(){n||function(){let e=o.find("*[required]"),a=!0;if(e.each((function(){a&&(t(this).is(":hidden")||t(this).prop("disabled")||(a=this.reportValidity()))})),!a)return!1;let r=o.find('[name="wdt-employer-posting-website"]')[0],n=r.value.trim();if(n&&"http"!==n.substring(0,4))return r.setCustomValidity("Please include the full URL (e.g. https://example.com)"),r.reportValidity(),!1;r.setCustomValidity("");let i=["wdt-employer-posting-phone","wdt-employer-posting-alt-phone","wdt-employer-posting-fax"];for(let t=0;t<i.length;t++)if(!wdtValidatePhoneInput(o.find('[name="'+i[t]+'"]')[0]))return!1;let s=o.find('[name="wdt-employer-posting-postalzip"]')[0],d=s.value.trim();return d&&!/^[A-Za-z]\d[A-Za-z]\s?\d[A-Za-z]\d$/.test(d)?(s.setCustomValidity("Enter a valid postal code (e.g. M5V 2T6)"),s.reportValidity(),!1):(s.setCustomValidity(""),!0)}()&&(i(!0),n=t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/employers/employer-mgmt/create/",data:o.serialize(),beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){if(t.success&&t.post_id){let e=a+"&wdt-employer="+t.post_id;wdtRenderContentModal({title:"",content:'<div class="wdt-content-modal-heading-icon success wdt-create-employer-confirmation-icon" aria-hidden="true"></div><h2 class="wdt-create-employer-confirmation-title" data-testid="create-employer-confirmation">Employer has been added</h2><p class="wdt-create-employer-confirmation-text">You can now review the profile and add any additional details.</p><button type="button" class="wdt-create-employer-confirmation-btn" data-testid="create-employer-view-profile-btn">View Employer Profile</button>',className:"modal-small wdt-create-employer-confirmation-modal",closeable:!1,modalType:"success"}),document.querySelector(".wdt-create-employer-confirmation-btn").addEventListener("click",(function(){window.location.href=e}))}else s(t.message||"Could not save the employer profile. Please try again."),i(!1)},error:function(t){s(t&&t.responseJSON&&t.responseJSON.message||"An error occurred. Please try again."),i(!1)},complete:function(){n=null}}))}))})),jQuery(document).ready((function(){jQuery("#wemap-census").length&&(jQuery.getJSON("/data/census-tract-data.json",(function(t){!function(t){jQuery("#wemap-help").on("click",(function(){jQuery(".wemap-help-modal").toggleClass("open"),jQuery(".wemap-help-modal .close-help-modal")[0].focus()})),jQuery(".wemap-help-modal .close-help-modal").on("click",(function(){jQuery(".wemap-help-modal").toggleClass("open"),jQuery("#wemap-help")[0].focus()})),jQuery(".wemap-help-modal .close-help-modal").keypress((function(t){if(t.preventDefault(),13==t.which)return jQuery(".wemap-help-modal .close-help-modal").click(),!1})),jQuery(".wemap-help-modal .close-help-modal").keydown((function(t){if(9==t.which)return t.preventDefault(),jQuery(".wemap-help-modal .close-help-modal").click(),!1}));var a={},o={},r={};for(var n in t)for(var i in Object.assign(a,t[n]),r[n]=0,t[n])Object.assign(o,t[n][i]);let s='<svg aria-hidden="true" class="wemap-census-topic-icon" width="7px" height="7px" version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><path d="m6.5781 100 86.844-50-86.844-50v100z" fill-rule="evenodd"/></svg>';var d="";for(var i in a){d+='<div class="wemap-census-sidebar-topic-container" tabindex="0">'+s+'<h3 class="wemap-census-sidebar-topic">'+i+"</h3></div>",d+='<table class="wemap-census-table">';var l="",c="";for(var p in a[i]){0==(g=a[i][p].indent)&&(l=p,c=a[i][p].label);var u=a[i][p].label,f="false";g>0&&(f="true"),d+='<tr tabindex="0" id="topic-filter-'+p+'" class="topic-filter" data-section="'+i+'" data-parent-topic="'+l+'" data-parent-topic-label="'+c+'" data-topic="'+p+'" data-level="'+g+'" data-filterable="'+f+'">',d+='<td class="table-label indent-'+g+'">'+u+"</td>",d+='<td class="button-column">',d+='<i class="button-filter fa fa-filter" aria-hidden="true"></i>',d+="</td>",d+='<td class="skip-to-right-sidebar-button-td" tabindex="0">Focus on right sidebar</td>',d+="</tr>"}d+="</table>"}jQuery("#wemap-census-sidebar").find(".wemap-census-sidebar-content").html(d),jQuery("#wemap-census-sidebar table tr").keypress((function(t){if(13==t.which)return jQuery(".skip-to-right-sidebar-button-td.show").length&&"skip-to-right-sidebar-button-td show"==document.activeElement.className?(jQuery("#wemap-census-sidebar-right h2")[0].focus(),jQuery(this).children(".skip-to-right-sidebar-button-td").removeClass("show")):(jQuery(this).click(),jQuery(".skip-to-right-sidebar-button-td.show").length&&jQuery(".skip-to-right-sidebar-button-td.show").removeClass("show"),jQuery(this).children(".skip-to-right-sidebar-button-td").addClass("show")),!1})),jQuery("#wemap-census-sidebar table tr").focusin((function(t){jQuery(".skip-to-right-sidebar-button-td.show").length&&"topic-filter"==jQuery(":focus").attr("class")&&jQuery(".skip-to-right-sidebar-button-td.show").removeClass("show")})),jQuery(".skip-to-right-sidebar-button-td.show").keypress((function(){13==e.which&&jQuery("#wemap-census-sidebar-right h3")[0].focus()})),jQuery("#wemap-census-sidebar tr").on("click",(function(t){t.preventDefault(),t.stopPropagation(),jQuery(".topic-filter").removeClass("active"),jQuery(this).addClass("active"),jQuery("#wemap-filter-clear").prop("disabled",!1),k(jQuery(this).data("topic"))}));d='<h2 tabindex="0">Selected Regions:</h2>';for(var i in d+='<div class="selected-regions-table-container"></div>',a){d+='<div class="wemap-census-sidebar-topic-container" tabindex="0">'+s+'<h3 class="wemap-census-sidebar-topic">'+i+"</h3></div>",d+='<table class="wemap-census-table">',d+='<tr><th></th><th>Total</th><th><i class="fa fa-male" aria-hidden="true"></i></th><th><i class="fa fa-female" aria-hidden="true"></i></th></tr>';l="",c="";for(var p in a[i]){var g;0==(g=a[i][p].indent)&&(l=p,c=a[i][p].label);u=a[i][p].label,f="false";g>0&&(f="true"),d+='<tr data-section="'+i+'" data-parent-topic="'+l+'" data-parent-topic-label="'+c+'" data-topic="'+p+'" data-level="'+g+'" data-filterable="'+f+'">',d+='<td class="table-label indent-'+g+'">'+u+"</td>",d+='<td id="total_'+p+'" class="data-column">'+"-"+"</td>",d+='<td id="total_m_'+p+'" class="data-column">'+"-"+"</td>",d+='<td id="total_f_'+p+'" class="data-column">'+"-"+"</td>",d+="</tr>"}d+="</table>"}jQuery("#wemap-census-sidebar-right").find(".wemap-census-sidebar-content").html(d),jQuery("#wemap-census-sidebar-right tr").on("click",(function(t){t.preventDefault(),t.stopPropagation(),jQuery(this).data("filterable")})),jQuery(".wemap-census-sidebar-topic-container").on("click",(function(t){t.preventDefault(),t.stopPropagation(),jQuery(this).next("table").toggle(),jQuery(this).toggleClass("expanded");var e=[];
1w.forEach((function(t){1==t.getProperty("selected")&&e.push(t.getProperty("CTUID"))})),_(e)})),jQuery(".wemap-census-sidebar-topic-container").keypress((function(t){if(13==t.which)return jQuery(this).click(),!1}));new google.maps.LatLngBounds(new google.maps.LatLng(wemap_census.bounds_lat1,wemap_census.bounds_long1),new google.maps.LatLng(wemap_census.bounds_lat2,wemap_census.bounds_long2));var m=new google.maps.Map(document.getElementById("wemap-census-map"),{center:{lat:Number(wemap_census.map_center_lat),lng:Number(wemap_census.map_center_long)},gestureHandling:"greedy",minZoom:7,maxZoom:18,mapTypeControl:!1,streetViewControl:!1,fullscreenControl:!1,zoom:10,zoomControl:!0,zoomControlOptions:{position:google.maps.ControlPosition.TOP_RIGHT},styles:[{featureType:"all",elementType:"geometry.fill",stylers:[{weight:"2.00"}]},{featureType:"all",elementType:"geometry.stroke",stylers:[{color:"#9c9c9c"}]},{featureType:"all",elementType:"labels.text",stylers:[{visibility:"on"}]},{featureType:"landscape",elementType:"all",stylers:[{color:"#f2f2f2"}]},{featureType:"landscape",elementType:"geometry.fill",stylers:[{color:"#ffffff"}]},{featureType:"landscape.man_made",elementType:"geometry.fill",stylers:[{color:"#ffffff"}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"road",elementType:"all",stylers:[{saturation:-100},{lightness:45}]},{featureType:"road",elementType:"geometry.fill",stylers:[{color:"#eeeeee"}]},{featureType:"road",elementType:"labels.text.fill",stylers:[{color:"#7b7b7b"}]},{featureType:"road",elementType:"labels.text.stroke",stylers:[{color:"#ffffff"}]},{featureType:"road.highway",elementType:"all",stylers:[{visibility:"simplified"}]},{featureType:"road.arterial",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"transit",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"water",elementType:"all",stylers:[{color:"#46bcec"},{visibility:"on"}]},{featureType:"water",elementType:"geometry.fill",stylers:[{color:"#c8d7d4"}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{color:"#070707"}]},{featureType:"water",elementType:"labels.text.stroke",stylers:[{color:"#ffffff"}]}]}),w=new google.maps.Data({map:m});w.loadGeoJson("/data/census_tracts.geojson",{idPropertyName:"CTUID"}),w.setStyle((function(t){return{zIndex:5,strokeColor:"#00448b",fillColor:"#00448b"}}));var h=[],b=new google.maps.Data({map:m});function y(){jQuery("#wemap-census-sidebar").addClass("visible"),jQuery("#wemap-census-sidebar-toggle").removeClass("closed")}function v(){jQuery("#wemap-census-sidebar").removeClass("visible"),jQuery("#wemap-census-sidebar-toggle").addClass("closed")}function _(e){console.time();var a={};let r=[];if(jQuery(".wemap-census-sidebar-topic-container.expanded").each((function(){r.push(jQuery(this).find(".wemap-census-sidebar-topic").text())})),0!=r.length){for(var n in o)a[n]={total:0,total_m:0,total_f:0};for(var n in e.forEach((function(e){for(var o in t[e])if(r.indexOf(o)>=0)for(var n in t[e][o]){var i=parseInt(t[e][o][n].total),s=t[e][o][n].total_m?parseInt(t[e][o][n].total_m):0,d=t[e][o][n].total_f?parseInt(t[e][o][n].total_f):0;a[n].total=a[n].total+i,a[n].total_m=a[n].total_m+s,a[n].total_f=a[n].total_f+d}})),o){let t=jQuery("#total_"+n).parent(),e=t.html();if(void 0===e)continue;let r=Math.round(100*a[n].total)/100,i=Math.round(100*a[n].total_m)/100,s=Math.round(100*a[n].total_f)/100;if(1002==n){let t=null,e=null;for(var n in o)if(1e3==n&&(e=a[n]),1001==n&&(t=a[n]),t&&e)break;let d=j(t.total_m,e.total_m),l=j(t.total_f,e.total_f),c=j(t.total,e.total);i=null!==d?d:"N/A",s=null!==l?l:"N/A",r=null!==c?c:"N/A"}let d=e.substring(0,e.indexOf("</td>")+5)+`<td id="total_${n}">${r}</td><td id="total_m_${n}">${i}</td><td id="total_f_${n}">${s}</td>`,l=e.substring(0,e.indexOf("</td>")+5)+`<td id="total_${n}">-</td><td id="total_m_${n}">-</td><td id="total_f_${n}">-</td>`;d!=e&&l!=e&&(e=d,t.html(e))}console.timeEnd()}else console.timeEnd()}function k(e){var a=[],o=jQuery("select#filter-type").val();for(var n in t)for(var i in r[n]=0,t[n])t[n][i].hasOwnProperty(e)&&("absolute"==o?r[n]=t[n][i][e].total:t[n].Population.hasOwnProperty("1000")?r[n]=t[n][i][e].total/t[n].Population[1e3].total:r[n]=0,t[n][i][e].total>0&&("absolute"==o?a.push(t[n][i][e].total):a.push(t[n][i][e].total/t[n].Population[1e3].total)));Math.min.apply(Math,a);var s=Math.max.apply(Math,a);x(!1,0);var d=[];
1w.forEach((function(t){1==t.getProperty("selected")&&d.push(t.getProperty("CTUID"))})),w.forEach((function(t){var e=r[t.getProperty("CTUID")],a=e/s;a<=.2&&(a=.2),a>=.9&&(a=.9),w.overrideStyle(t,{fillOpacity:a}),d.forEach((function(a){a==t.getProperty("CTUID")&&("absolute"!=o&&(e=(e*=100).toFixed(2)+"%"),jQuery("table#selected-tracts-table tbody").append("<tr><td>"+t.getProperty("CTUID")+"</td><td>"+e+"</td></tr>"))}))})),h.forEach((function(t){var e=r[t.getTitle()];if("absolute"==o)t.setLabel({text:""+e,fontSize:"10px"});else{var a=Math.round(1e4*e)/100+"%";t.setLabel({text:a,fontSize:"10px"})}}))}function x(t,e){jQuery(".selected-regions-table-container").html("");var a='<table id="selected-tracts-table" class="selected-regions-table"><thead><tr><td>Region</td><td>Data</td></tr></thead><tbody></tbody></table>';if(jQuery(".selected-regions-table-container").append(a),t&&e.length>0){d="",e.forEach((function(t){d+="<tr>",d+="<td>"+t+"</td>",d+="<td></td>",d+="</tr>"})),jQuery("#selected-tracts-table > tbody").append(d);var o=jQuery(".topic-filter.active");o.length>0&&k(o.data("topic"))}}function j(t,e){if(t===e)return 0;if(0===t)return null;{let a=(e-t)/e*100;return Math.round(a)}}b.addListener("addfeature",(function(t){if("Point"==t.feature.getGeometry().getType()){var e=t.feature.getGeometry().get(),a=t.feature.getProperty("CTUID");document.createElement("div").innerHTML=a;var o=new google.maps.Marker({position:e,label:{text:" ",fontSize:"10px"},icon:{path:google.maps.SymbolPath.CIRCLE,scale:0},title:a,map:m});h.push(o)}})),b.loadGeoJson("/data/census_tracts_center.geojson"),b.setStyle({clickable:!1,icon:{path:google.maps.SymbolPath.CIRCLE,scale:0}}),w.addListener("mouseover",(function(t){})),w.addListener("click",(function(e){1==e.feature.getProperty("selected")?(e.feature.setProperty("selected",!1),w.overrideStyle(e.feature,{fillColor:"#00448b"})):(e.feature.setProperty("selected",!0),w.overrideStyle(e.feature,{fillColor:"#00ac9f"}));var a=[];w.forEach((function(t){1==t.getProperty("selected")&&a.push(t.getProperty("CTUID"))})),_(a),jQuery("select#weexplore-regions").val("none");var o=e.feature.getProperty("CTUID");t[o];x(!0,a),a.length>0?(jQuery("#wemap-census-sidebar-right").addClass("visible").removeClass("mobile-hidden"),jQuery("#wemap-clear-selected-tracts").prop("disabled",!1)):(jQuery("#wemap-census-sidebar-right").removeClass("visible"),jQuery("#wemap-clear-selected-tracts").prop("disabled",!0))})),jQuery("select#weexplore-regions").on("change",(function(t){if(t.preventDefault(),t.stopPropagation(),"none"!=jQuery(this).val()){jQuery("#wemap-clear-selected-tracts").prop("disabled",!1);var e=jQuery(this).val().split(",");w.forEach((function(t){var a=t.getProperty("CTUID");-1!=e.indexOf(a)?(t.setProperty("selected",!0),w.overrideStyle(t,{strokeColor:"#00448b",fillColor:"#00ac9f"})):(t.setProperty("selected",!1),w.overrideStyle(t,{strokeColor:"#00448b",fillColor:"#00448b"}))})),_(selectedTracts),x(!0,e),e.length>0?(jQuery("#wemap-census-sidebar-right").addClass("visible"),jQuery("#wemap-clear-selected-tracts").prop("disabled",!1)):(jQuery("#wemap-census-sidebar-right").removeClass("visible"),jQuery("#wemap-clear-selected-tracts").prop("disabled",!0))}else w.forEach((function(t){t.setProperty("selected",!1),w.overrideStyle(t,{strokeColor:"#00448b",fillColor:"#00448b"})}))})),m.addListener("click",(function(){})),jQuery("#wemap-census-sidebar-right-close").on("click",(function(t){jQuery("#wemap-census-sidebar-right").removeClass("visible")})),jQuery("#weexplore-switch").on("change",(function(t){location.href=""+jQuery(this).val()})),jQuery("select#filter-type").on("change",(function(t){var e=jQuery(this).val();"absolute"==e?(jQuery("#legend-label-less").html("Fewer People or Households"),jQuery("#legend-label-more").html("More People or Households")):"relative"==e&&(jQuery("#legend-label-less").html("Low Population Concentration"),jQuery("#legend-label-more").html("High Population Concentration"));var a=jQuery(".topic-filter.active");a.length>0&&k(a.data("topic"))})),jQuery("#wemap-census-clear-filters").on("click",(function(t){t.preventDefault(),t.stopPropagation(),h.forEach((function(t){t.setLabel({text:" "})})),jQuery(".topic-filter").removeClass("active"),jQuery("#wemap-filter-clear").prop("disabled",!0),jQuery(".wemap-census-sidebar-topic-container").next("table").hide(),jQuery(".wemap-census-sidebar-topic-container").removeClass("expanded"),jQuery("select#filter-type").val("absolute"),w.forEac
1h((function(t){t.setProperty("selected",!1),w.overrideStyle(t,{strokeColor:"#00448b",fillColor:"#00448b",fillOpacity:.25})})),jQuery("#wemap-census-sidebar-right").removeClass("visible"),jQuery("#wemap-clear-selected-tracts").prop("disabled",!0),jQuery("select#weexplore-regions").val("none")})),jQuery("#wemap-census-sidebar-open").on("click",(function(t){t.preventDefault(),t.stopPropagation(),y()})),jQuery("#wemap-census-sidebar-toggle").on("click",(function(t){t.preventDefault(),t.stopPropagation(),jQuery("#wemap-census-sidebar").hasClass("visible")?v():y()})),jQuery("body").width()>900&&jQuery("#wemap-census-sidebar").addClass("visible")}(t)})),jQuery(".skip-to-left-sidebar-button").keypress((function(t){13==t.which&&(jQuery("#wemap-census-sidebar .wemap-census-sidebar-topic-container")[0].focus(),jQuery("#wemap-census-sidebar").addClass("visible"),jQuery("#wemap-census-sidebar-right").addClass("mobile-hidden"))})),jQuery(".skip-to-right-sidebar-button").keypress((function(t){13==t.which&&(jQuery("#wemap-census-sidebar-right h2")[0].focus(),jQuery("#wemap-census-sidebar-right").removeClass("visible"))})))})),jQuery(document).ready((function(){var t=null;if(!jQuery("#wemap-census-2021").length)return;jQuery(".skip-to-left-sidebar-button").keypress((function(t){13==t.which&&(jQuery("#wemap-census-sidebar .wemap-census-sidebar-topic-container")[0].focus(),jQuery("#wemap-census-sidebar").addClass("visible"),jQuery("#wemap-census-sidebar-right").addClass("mobile-hidden"))})),jQuery(".skip-to-right-sidebar-button").keypress((function(t){13==t.which&&(jQuery("#wemap-census-sidebar-right h2")[0].focus(),jQuery("#wemap-census-sidebar-right").removeClass("visible"))}));let a=t=>{let e=t.getProperty("CTUID");return e||(e=t.getProperty("DGUID").substring(9)),e},o=!1,r=()=>new Promise(((t,e)=>{!1===o?jQuery.getJSON(WDT.plugin_data_url+"census-map/census-sections-structure-2021.json",(function(e){o=e,t(e)})):t(o)}));!async function(){let o=await r();jQuery("#wemap-help").on("click",(function(){jQuery(".wemap-help-modal").toggleClass("open"),jQuery(".wemap-help-modal .close-help-modal")[0].focus()})),jQuery(".wemap-help-modal .close-help-modal").on("click",(function(){jQuery(".wemap-help-modal").toggleClass("open"),jQuery("#wemap-help")[0].focus()})),jQuery(".wemap-help-modal .close-help-modal").keypress((function(t){if(t.preventDefault(),13==t.which)return jQuery(".wemap-help-modal .close-help-modal").click(),!1})),jQuery(".wemap-help-modal .close-help-modal").keydown((function(t){if(9==t.which)return t.preventDefault(),jQuery(".wemap-help-modal .close-help-modal").click(),!1}));var n={},i={};let s=[];for(var d of o)s.hasOwnProperty(d.section)||(s[d.section]=[]),s[d.section].push({indent:1,name:d.name,id:d.id,parent:d.parent,aggregate:d.aggregate});t=[];for(let e of o)t[e.id]={name:e.name,id:e.id,parent:e.parent,aggregate:e.aggregate};let l='<svg aria-hidden="true" class="wemap-census-topic-icon" width="7px" height="7px" version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><path d="m6.5781 100 86.844-50-86.844-50v100z" fill-rule="evenodd"/></svg>';var c="";for(let t of Object.keys(s)){c+='<div class="wemap-census-sidebar-topic-container" tabindex="0">'+l+'<h3 class="wemap-census-sidebar-topic">'+t+"</h3></div>",c+='<table class="wemap-census-table" style="width: 100%;">';var p="",u="";let e=0,a=t,o=0;for(var f in s[t]){f=s[t][f],0==o&&(p=f.parent,u=a),null==f.parent?(o=0,e=0,a=t):f.parent&&parseInt(f.parent)>parseInt(e)?(o++,e=f.parent,a=f.name):f.parent&&parseInt(f.parent)<parseInt(e)&&(o--,e=f.parent,a=f.name);var g=f.name,m="false";o>0&&(m="true"),dataPoint=f.id,c+='<tr tabindex="0" id="topic-filter-'+dataPoint+'" class="topic-filter" data-section="'+t+'" data-parent-topic="'+p+'" data-parent-topic-label="'+u+'" data-topic="'+dataPoint+'" data-level="'+o+'" data-filterable="'+m+'">',c+='<td class="table-label indent-'+o+'">'+g+"</td>",c+='<td class="button-column"><i class="button-filter fa fa-filter" aria-hidden="true"></i></td>',c+='<td class="skip-to-right-sidebar-button-td" tabindex="0">Focus on right sidebar</td>',c+="</tr>"}c+="</table>"}jQuery("#wemap-census-sidebar").find(".wemap-census-sidebar-content").html(c),jQuery("#wemap-census-sidebar table tr").keypress((function(t){if(13==t.which)return jQuery(".skip-to-right-sidebar-button-td.show").length&&"skip-to-right-sidebar-button-td show"==document.activeElement.className?(jQuery("#wemap-census-sidebar-right h2")[0].focus(),jQuery(this).children(".skip-to-right-sidebar-button-td").removeClass("show")):(jQuery(this).click(),jQuery(".skip-to-right-sidebar-button-td.show").length&&jQuery(".skip-to-right-sidebar-button-td.show").removeClass("show"),jQuery(this).children(".skip-to-right-sidebar-button-td").addClass("show")),!1})),jQuery("#wemap-census-sidebar table tr").focusin((function(t){jQuery(".skip-to-right-sidebar-button-td.show").length&&"topic-filter"==jQuery(":focus").attr("class")&&jQuery(".skip-to-right-sidebar-button-td.show").removeClass("show")})),jQuery(".skip-to-right-sidebar-button-td.show").keypress((function(){13==e.which&&jQuery("#wemap-census-sidebar-right h3")[0].focus()})),jQuery("#wemap-census-sidebar tr").on("click",(function(t){t.preventDefault(),t.stopPropagation(),jQuery(".topic-filter").removeClass("active"),jQuery(this).addClass("active"),jQuery("#wemap-filter-clear").prop("disabled",!1),D(jQuery(this).data("topic"))})),c='<h2 tabindex="0">Selected Regions:</h2>',c+='<div class="selected-regions-table-container"><table id="selected-tracts-table" class="selected-regions-table"><thead><tr><td>Region</td><td>Data</td></tr></thead><tbody></tbody></table></div>';for(let t of Object.keys(s)){c+='<div class="wemap-census-sidebar-topic-container" tabindex="0">'+l+'<h3 class="wemap-census-sidebar-topic">'+t+"</h3></div>",c+='<table class="wemap-census-table" style="width: 100%;">',c+='<tr><th></th><th>Total</th><th><i class="fa fa-male" aria-hidden="true"></i></th><th><i class="fa fa-female" aria-hidden="true"></i></th></tr>';p="",u="";var w=0;let e="";for(var f in s[t]){f=s[t][f],0==w&&(p=f.parent,u=e),null==f.parent?(w=0,current_parent=0,e=t):f.parent&&parseInt(f.parent)>parseInt(current_parent)?(w++,current_parent=f.parent,e=f.name):f.parent&&parseInt(f.parent)<parseInt(current_parent)&&(w--,current_parent=f.parent,e=f.name);
1g=f.name,m="false";w>0&&(m="true"),c+='<tr data-section="'+t+'" data-parent-topic="'+p+'" data-parent-topic-label="'+u+'" data-topic="'+f.id+'" data-level="'+w+'" data-filterable="'+m+'">',c+='<td class="table-label indent-'+w+'">'+g+"</td>",c+='<td id="total_'+f.id+'" class="data-column">-</td>',c+='<td id="total_m_'+f.id+'" class="data-column">-</td>',c+='<td id="total_f_'+f.id+'" class="data-column">-</td>',c+="</tr>"}c+="</table>"}jQuery("#wemap-census-sidebar-right").find(".wemap-census-sidebar-content").html(c),jQuery(document).on("click","#wemap-census-sidebar-right tr",(function(t){t.preventDefault(),t.stopPropagation()})),jQuery(document).on("click",".wemap-census-sidebar-topic-container",(function(t){t.preventDefault(),t.stopPropagation(),jQuery(this).next("table").toggle(),jQuery(this).toggleClass("expanded");var e=[];b.forEach((function(t){1==t.getProperty("selected")&&e.push(a(t))})),C(e)})),jQuery(document).on("keypress",".wemap-census-sidebar-topic-container",(function(t){if(13==t.which)return jQuery(this).click(),!1})),new google.maps.LatLngBounds(new google.maps.LatLng(wemap_census.bounds_lat1,wemap_census.bounds_long1),new google.maps.LatLng(wemap_census.bounds_lat2,wemap_census.bounds_long2));var h=new google.maps.Map(document.getElementById("wemap-census-map"),{center:{lat:Number(wemap_census.map_center_lat),lng:Number(wemap_census.map_center_long)},gestureHandling:"greedy",minZoom:7,maxZoom:18,mapTypeControl:!1,streetViewControl:!1,fullscreenControl:!1,zoom:10,zoomControl:!0,zoomControlOptions:{position:google.maps.ControlPosition.TOP_RIGHT},styles:[{featureType:"all",elementType:"geometry.fill",stylers:[{weight:"2.00"}]},{featureType:"all",elementType:"geometry.stroke",stylers:[{color:"#9c9c9c"}]},{featureType:"all",elementType:"labels.text",stylers:[{visibility:"on"}]},{featureType:"landscape",elementType:"all",stylers:[{color:"#f2f2f2"}]},{featureType:"landscape",elementType:"geometry.fill",stylers:[{color:"#ffffff"}]},{featureType:"landscape.man_made",elementType:"geometry.fill",stylers:[{color:"#ffffff"}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"road",elementType:"all",stylers:[{saturation:-100},{lightness:45}]},{featureType:"road",elementType:"geometry.fill",stylers:[{color:"#eeeeee"}]},{featureType:"road",elementType:"labels.text.fill",stylers:[{color:"#7b7b7b"}]},{featureType:"road",elementType:"labels.text.stroke",stylers:[{color:"#ffffff"}]},{featureType:"road.highway",elementType:"all",stylers:[{visibility:"simplified"}]},{featureType:"road.arterial",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"transit",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"water",elementType:"all",stylers:[{color:"#46bcec"},{visibility:"on"}]},{featureType:"water",elementType:"geometry.fill",stylers:[{color:"#c8d7d4"}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{color:"#070707"}]},{featureType:"water",elementType:"labels.text.stroke",stylers:[{color:"#ffffff"}]}]}),b=new google.maps.Data({map:h});b.loadGeoJson("/data/census_tracts_2021.geojson",{idPropertyName:"CTUID"}),b.setStyle((function(t){return{zIndex:5,strokeColor:"#00448b",fillColor:"#00448b"}}));var y=[],v=new google.maps.Data({map:h});function _(){jQuery("#wemap-census-sidebar").addClass("visible"),jQuery("#wemap-census-sidebar-toggle").removeClass("closed")}v.addListener("addfeature",(function(t){if("Point"==t.feature.getGeometry().getType()){var e=t.feature.getGeometry().get(),a=t.feature.getProperty("CTUID");document.createElement("div").innerHTML=a;var o=new google.maps.Marker({position:e,label:{text:" ",fontSize:"10px"},icon:{path:google.maps.SymbolPath.CIRCLE,scale:0},title:a,map:h});y.push(o)}})),v.loadGeoJson("/data/census_tracts_center_2021.geojson"),v.setStyle({clickable:!1,icon:{path:google.maps.SymbolPath.CIRCLE,scale:0}}),b.addListener("click",(function(t){1==t.feature.getProperty("selected")?(t.feature.setProperty("selected",!1),b.overrideStyle(t.feature,{fillColor:"#00448b"})):(t.feature.setProperty("selected",!0),b.overrideStyle(t.feature,{fillColor:"#00ac9f"}));var e=[];let o=[];b.forEach((function(t){if(1==t.getProperty("selected")){let r=a(t);e.push(r),o.push({tract_id:r,total:""})}})),e.length>0?(jQuery("#wemap-census-sidebar-right").addClass("visible").removeClass("mobile-hidden"),jQuery("#wemap-clear-selected-tracts").prop("disabled",!1)):(jQuery("#wemap-census-sidebar-right").removeClass("visible"),jQuery("#wemap-clear-selected-tracts").prop("disabled",!0)),C(e),jQuery("select#weexplore-regions").val("none"),T(!0,e)})),jQuery("select#weexplore-regions").on("change",(function(t){if(t.preventDefault(),t.stopPropagation(),"none"!=jQuery(this).val()){jQuery("#wemap-clear-selected-tracts").prop("disabled",!1);var e=jQuery(this).val().split(",");b.forEach((function(t){var o=a(t);-1!=e.indexOf(o)?(t.setProperty("selected",!0),b.overrideStyle(t,{strokeColor:"#00448b",fillColor:"#00ac9f"})):(t.setProperty("selected",!1),b.overrideStyle(t,{strokeColor:"#00448b",fillColor:"#00448b"}))})),C(e),T(!0,e),e.length>0?(jQuery("#wemap-census-sidebar-right").addClass("visible"),jQuery("#wemap-clear-selected-tracts").prop("disabled",!1)):(jQuery("#wemap-census-sidebar-right").removeClass("visible"),jQuery("#wemap-clear-selected-tracts").prop("disabled",!0))}else b.forEach((function(t){t.setProperty("selected",!1),b.overrideStyle(t,{strokeColor:"#00448b",fillColor:"#00448b"})}))})),jQuery("#wemap-census-sidebar-right-close").on("click",(function(t){jQuery("#wemap-census-sidebar-right").removeClass("visible")})),jQuery("#weexplore-switch").on("change",(function(t){location.href=""+jQuery(this).val()})),jQuery("select#filter-type").on("change",(function(t){var e=jQuery(this).val();"absolute"==e?(jQuery("#legend-label-less").html("Fewer People or Households"),jQuery("#legend-label-more").html("More People or Households")):"relative"==e&&(jQuery("#legend-label-less").html("Low Population Concentration"),jQuery("#legend-label-more").html("High Population Concentration"));var a=jQuery(".topic-filter.active");a.length>0&&D(a.data("topic"))})),jQuery("#wemap-census-clear-filters").on("click",(function(t){t.preventDefault(),t.stopPropagation(),y.forEac
1h((function(t){t.setLabel({text:" "})})),jQuery(".topic-filter").removeClass("active"),jQuery("#wemap-filter-clear").prop("disabled",!0),jQuery(".wemap-census-sidebar-topic-container").next("table").hide(),jQuery(".wemap-census-sidebar-topic-container").removeClass("expanded"),jQuery("select#filter-type").val("absolute"),b.forEach((function(t){t.setProperty("selected",!1),b.overrideStyle(t,{strokeColor:"#00448b",fillColor:"#00448b",fillOpacity:.25})})),jQuery("#wemap-census-sidebar-right").removeClass("visible"),jQuery("#wemap-clear-selected-tracts").prop("disabled",!0),jQuery("select#weexplore-regions").val("none")})),jQuery("#wemap-census-sidebar-open").on("click",(function(t){t.preventDefault(),t.stopPropagation(),_()})),jQuery("#wemap-census-sidebar-toggle").on("click",(function(t){t.preventDefault(),t.stopPropagation(),jQuery("#wemap-census-sidebar").hasClass("visible")?(jQuery("#wemap-census-sidebar").removeClass("visible"),jQuery("#wemap-census-sidebar-toggle").addClass("closed")):_()}));let k=(t,e,a="true")=>new Promise((async o=>{fetch(`https://api.wedatatools.com/v2/census/?census_year=2021&fields=census_year,topic_id,total,total_male,total_female&region_id=${t.join(",")}&topic_id=${e.join(",")}&aggregate=${a}`).then((t=>t.json())).then((t=>o("true"===a?t.data.aggregates:t.data)))})),x=(t,e)=>new Promise((async a=>{fetch(`https://api.wedatatools.com/v2/census/?census_year=2021&action=relative_tract_population_percentage&topic_id=${e}&region_id=${t.join(",")}`).then((t=>t.json())).then((t=>a(t.data)))})),j=(t,e)=>{let a=parseFloat(t),o=parseFloat(e);return Number.isNaN(a)||Number.isNaN(o)||0===a?"N/A":(Math.round((o-a)/a*100*100)/100).toLocaleString("en-US")};async function C(e){let a={},o=[];if(jQuery(".wemap-census-sidebar-topic-container.expanded").each((function(){o.push(jQuery(this).find(".wemap-census-sidebar-topic").text())})),0==o.length)return;for(let t in n)a[t]={total:0,total_m:0,total_f:0};let i=[];e.forEach((t=>{let e="A0005";t.indexOf(".")>=0&&(e="S0507"),i.push(e+t)}));let s=[],d={},l=await r();for(let t of l)d[t.id]=t,o.indexOf(t.section)>=0&&s.push(t.id);let c=s.slice();for(let t of s){let e=d[t]&&d[t].derive;e&&(-1===c.indexOf(e.from)&&c.push(e.from),-1===c.indexOf(e.to)&&c.push(e.to))}let p=!1;if(p=await k(i,c),!1===p||void 0===p)return;let u={};for(let t of p)u[t.topic_id]=t;for(let a of s){let o=jQuery("#total_"+a).parent();if(0===o.length)continue;let r,n,i,s=o.html(),l=d[a]&&d[a].derive,c=u[a];if(e.length>1&&l&&"percent_change"===l.op){let t=u[l.from],e=u[l.to];r=j(t&&t.total,e&&e.total),n=j(t&&t.total_male,e&&e.total_male),i=j(t&&t.total_female,e&&e.total_female)}else{if(!c)continue;r=Math.round(100*parseInt(c.total))/100,n=Math.round(100*parseInt(c.total_male))/100,i=Math.round(100*parseInt(c.total_female))/100,r=Number.isNaN(r)?"N/A":r.toLocaleString("en-US"),n=Number.isNaN(n)?"N/A":n.toLocaleString("en-US"),i=Number.isNaN(i)?"N/A":i.toLocaleString("en-US"),e.length>1&&t[a]&&!1===t[a].aggregate&&(r="N/A",n="N/A",i="N/A")}let p=s.substring(0,s.indexOf("</td>")+5)+`<td id="total_${a}">${r}</td><td id="total_m_${a}">${n}</td><td id="total_f_${a}">${i}</td>`,f=s.substring(0,s.indexOf("</td>")+5)+`<td id="total_${a}">-</td><td id="total_m_${a}">-</td><td id="total_f_${a}">-</td>`;p!=s&&f!=s&&(s=p,o.html(s))}}async function D(t){let e=[],o=jQuery("select#filter-type").val(),r=[];jQuery(".wemap-census-sidebar-topic-container.expanded").each((function(){r.push(jQuery(this).find(".wemap-census-sidebar-topic").text())}));let n=await(t=>new Promise((e=>{let o=[];t.forEach((function(t){o.push(a(t))})),e(o)})))(b),s=[];n.forEach((t=>{let e="A0005";t.indexOf(".")>=0&&(e="S0507"),s.push(e+t)}));let d=[t],l={};if(l="absolute"==o?await k(s,d,"false"):await x(s,d),!1===l||void 0===l)return;for(let t of l){let a=t.total,o=t.region_id.replaceAll("A0005","").replaceAll("S0507","");i[o]=a,a>0&&e.push(a)}let c=Math.max.apply(Math,e);T(!1,0);let p="",u=[];b.forEach((function(t){let e=a(t),r=i[e],n=r/c;n<=.2&&(n=.2),n>=.9&&(n=.9),b.overrideStyle(t,{fillOpacity:n}),1==t.getProperty("selected")&&("absolute"!=o?r+="%":r=r.toLocaleStr
1ing("en-US"),p+=`<tr><td>${e}</td><td>${r}</td></tr>`,u.push({tract_id:e,total:r}))})),jQuery("table#selected-tracts-table tbody").append(p),y.forEach((function(t,e){let a=t.getTitle(),r="A0005";a.indexOf(".")>=0&&(r="S0507");let n=i[a];if(!/\d{1,2}[\,\.]{1}\d{1,2}/.test(n)&&!/^\d+$/.test(n))return console.log("Could not get the total for:",a),!0;"absolute"==o?t.setLabel({text:n.toLocaleString("en-US"),fontSize:"10px"}):t.setLabel({text:n+"%",fontSize:"10px"})}))}function T(t,e){if(jQuery(".selected-regions-table-container tbody").html(""),t&&e.length>0){c="",e.forEach((function(t){c+="<tr>",c+="<td>"+t+"</td>",c+="<td></td>",c+="</tr>"})),jQuery("#selected-tracts-table > tbody").html(c);var a=jQuery(".topic-filter.active");a.length>0&&D(a.data("topic"))}}jQuery("body").width()>900&&jQuery("#wemap-census-sidebar").addClass("visible")}()})),jQuery((function(t){"use strict";var e;t(document).on("wdt:loadState",'[data-target="wdt-portal-uploaded-files-table"]',(function(e){let a=t(this).parents('[data-target="portal-table-container"]').first();t(this).find('tbody[data-target="portal-table-body"]').find("td").addClass("wdt-portal-table-body-element-loading"),t(a).find('[data-target="spinner"]').show()})),t(document).on("wdt:refresh",'[data-target="wdt-portal-uploaded-files-table"]',(function(a){a.stopPropagation();let o=t(this).parents('[data-target="portal-table-container"]').first(),r=this,n={nonce:t(this).attr("data-nonce"),ownerID:a._ownerID};for(let t in n)null===n[t]&&delete n[t];e&&e.abort(),e=jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/files/",data:n,beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(r).trigger("wdt:loadState")},success:function(e){if(t(r).find('tbody[data-target="portal-table-body"]').html(""),e.success&&e.body.files.length){let r=!1;for(let n of e.body.files){let e=t(t(o).find('[data-target="template-table"]').get(0).content).find('[data-target="template-row"]').clone();if(n.filename){if(t(e).find('[data-column="filename"]').text(n.filename),n.private){let a=t(t(e).find('[data-target="private-icon"]').clone(!0).html());t(e).find('[data-column="filename"]').append(a)}if(n.is_resume){let a=t(t(e).find('[data-target="resume-icon"]').clone(!0).html());t(e).find('[data-column="filename"]').append(a)}}let i=(n.filename?n.filename.split(".").pop().toLowerCase():"").toUpperCase();n.is_resume&&(i=i?i+", Resume":"Resume"),t(e).find('[data-column="filetype"]').text(i),n.uploader&&t(e).find('[data-column="uploader"]').text(n.uploader.name),n.filesize&&t(e).find('[data-column="filesize"]').text(n.filesize),n.date&&t(e).find('[data-column="date"]').text(n.date),n.id&&t(e).find("[data-file-id]").attr("data-file-id",n.id),n.filename&&t(e).find("[data-file-name]").attr("data-file-name",n.filename),n.permissions.length?(n.permissions.includes("download")||t(e).find('[data-action="wdt-portal-download-user-file"]').remove(),n.permissions.includes("delete")||t(e).find('[data-action="wdt-portal-delete-user-file"]').remove(),n.permissions.includes("mark-private")||(t(e).find('[data-action="wdt-portal-set-user-file-private"]').remove(),t(e).find('[data-action="wdt-portal-set-user-file-public"]').remove()),n.permissions.includes("mark-resume")||(t(e).find('[data-action="wdt-portal-mark-file-as-resume"]').remove(),t(e).find('[data-action="wdt-portal-remove-file-resume-status"]').remove())):t(e).find("[wdt-portal-dropdown-menu-container]").remove(),n.private?t(e).find('[data-action="wdt-portal-set-user-file-private"]').remove():t(e).find('[data-action="wdt-portal-set-user-file-public"]').remove(),n.is_resume?t(e).find('[data-action="wdt-portal-mark-file-as-resume"]').remove():t(e).find('[data-action="wdt-portal-remove-file-resume-status"]').remove(),t(o).find('tbody[data-target="portal-table-body"]').append(e),!r&&a._autoMarkedResumeFiles&&a._autoMarkedResumeFiles.includes(n.filename)&&(wdtElementNotification(t(e).find('[data-column="filename"]'),"Auto-marked as resume based on filename"),r=!0)}}},error:function(t){"abort"!==t.statusText&&(wdtDisplayNotification("Unable to retrieve files. Please contact administrator.","error",-1),console.log(t))},complete:function(){t(o).find('[data-target="spinner"]').hide()}})})),t('[data-target="wdt-portal-uploaded-files-table"]').trigger("wdt:ready")})),jQuery((function(t){"use strict";var e=[];const a="resume-auto-detected";function o(e){let o=t(e),n=o.find('input[type="file"]').get(0),s=o.find('[name="isResume"]');
1if(!n||0===s.length)return;let d=n.files?.[0]??null;null!==d&&d.name.toLowerCase().includes("resume")&&i(d)?(s.prop("checked",!0),function(t){t.data("wdtResumeAutoChecked",!0),t.trigger("wdt:toggle-checkbox-badge",{key:a,show:!0})}(s)):!0===s.data("wdtResumeAutoChecked")&&(s.prop("checked",!1),r(s))}function r(t){t.data("wdtResumeAutoChecked",!1),t.trigger("wdt:toggle-checkbox-badge",{key:a,show:!1})}function n(e){let a=t(e),o=a.find('input[type="file"]').get(0),r=(o?.files?.length??0)>0;a.find('[data-target="wdt-upload-file-submit"]').prop("disabled",!r)}function i(t){return!!["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"].includes(t.type)||/\.(pdf|doc|docx)$/i.test(t.name)}t(document).on("submit",'form[data-target="wdt-upload-file-form"]',(function(a){a.preventDefault();let o=this,r=new FormData(t(this).get(0)),n=t(this).find('input[type="file"]').get(0),s=n?.files?.[0]??null,d="true"===r.get("isResume");if(n&&(n.setCustomValidity(""),d&&s&&!i(s)))return n.setCustomValidity("Only PDF or Word documents can be marked as a resume."),void n.reportValidity();if(e=[],!d){let a=t(this).find('input[type="file"]').get(0)?.files??[];for(let t of a)t.name.toLowerCase().includes("resume")&&e.push(t.name)}t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/files/upload/",data:r,cache:!1,contentType:!1,processData:!1,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?wdtDisplayNotification("Successfully uploaded file.","success",3e3):t.message?wdtDisplayNotification(t.message,"error",-1):wdtDisplayNotification("Unable to upload file.","error",-1)},error:function(t){t?.responseJSON?.message?wdtDisplayNotification(t.responseJSON.message,"error",-1):t?.responseJSON?.data?.params?.files?wdtDisplayNotification(t.responseJSON.data.params.files,"error",-1):wdtDisplayNotification("Unable to upload file.","error",-1),console.log(t)},complete:function(){let e=t.Event("wdt:complete");e._ownerID=r.get("ownerID"),t(o).trigger(e)}})})),t(document).on("change",'form[data-target="wdt-upload-file-form"] input[type="file"], form[data-target="wdt-upload-file-form"] [name="isResume"]',(function(){t(this).closest("form").find('input[type="file"]').get(0)?.setCustomValidity("")})),t(document).on("change",'form[data-target="wdt-upload-file-form"] input[type="file"]',(function(){let e=t(this).closest("form");o(e),n(e)})),t(document).on("click",'form[data-target="wdt-upload-file-form"] [data-target="file-upload-clear"]',(function(){let e=t(this).closest("form");setTimeout((function(){o(e),n(e)}),0)})),t(document).on("change",'form[data-target="wdt-upload-file-form"] [name="isResume"]',(function(){r(t(this))})),t(document).on("wdt:complete",'#wdt-content-modal form[data-target="wdt-upload-file-form"]',(function(t){wdtForceRemoveContentModal()})),t(document).on("wdt:complete",'form[data-target="wdt-upload-file-form"]',(function(a){if(t('[data-target="wdt-portal-uploaded-files-table"]').length){let o=t.Event("wdt:refresh");o._ownerID=a._ownerID,e.length&&(o._autoMarkedResumeFiles=e.slice(),e=[]),t('[data-target="wdt-portal-uploaded-files-table"]').trigger(o)}}))})),jQuery((t=>{"use strict";t("#wdt-company-profile-details").length&&t("#wdt-company-profile-map").each((function(){if(!t(this).data("map")){let e={lat:parseFloat(t(this).attr("data-lat")),lng:parseFloat(t(this).attr("data-lon"))},a=new google.maps.Map(t(this)[0],{center:e,zoom:14,gestureHandling:"none",zoomControl:!1,mapTypeControl:!1,streetViewControl:!1,fullscreenControl:!1,styles:[{featureType:"poi",elementType:"labels.text",stylers:[{visibility:"off"}]},{featureType:"poi.business",stylers:[{visibility:"off"}]},{featureType:"road",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"transit",stylers:[{visibility:"off"}]}]});new google.maps.Marker({position:e,map:a,title:t(this).attr("data-title")});t(this).data("map",a)}}))})),jQuery((function(t){"use strict";t(document).on("click",'[data-action="wdt-portal-download-user-file"][data-file-id]',(function(e){let a=this;t(a).trigger("wdt:start");let o=t(this).attr("data-file-id");t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/files/download/",data:{fileID:o},xhr:function(){var t=new XMLHttpRequest;return t.responseType="blob",t},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t,e,a){console.log(a);let o=a.getResponseHeader("X-WDT-Filename"),r=window.URL.createObjectURL(t),n=document.createElement("a");n.style.display="none",n.href=r,n.download=o,document.body.appendChild(n),n.click(),window.URL.revokeObjectURL(r)},error:function(t){console.log(t)},complete:function(){t(a).trigger("wdt:complete")}})})),t(document).on("click",'[data-action="wdt-portal-set-user-file-public"][data-file-id]',(function(e){let a=this;t(a).trigger("wdt:start");let o=t(this).attr("data-file-id");t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/files/privacy/",data:{fileID:o,private:!1},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?wdtDisplayNotification("Successfully marked file public.","success",3e3):wdtDisplayNotification("Encountered issue marking file public.","error",-1)},error:function(t){wdtDisplayNotification("Encountered issue marking file public.","error",-1),console.log(t)},complete:function(){t(a).trigger("wdt:complete")}})})),t(document).on("click",'[data-action="wdt-portal-set-user-file-private"][data-file-id]',(function(e){let a=this;t(a).trigger("wdt:start");let o=t(this).attr("data-file-id");t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/files/privacy/",data:{fileID:o,private:!0},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?wdtDisplayNotification("Successfully marked file private.","success",3e3):wdtDisplayNotification("Encountered issue marking file private.","error",-1)},error:function(t){wdtDisplayNotification("Encountered issue marking file private.","error",-1),console.log(t)},complete:function(){t(a).trigger("wdt:complete")}})})),t(document).on("click",'[data-action="wdt-portal-mark-file-as-resume"][data-file-id]',(function(e){let a=this;t(a).trigger("wdt:start");let o=t(this).attr("data-file-id");t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/files/resume/",data:{fileID:o,isResume:!0},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?wdtDisplayNotification("Successfully marked file as resume.","success",3e3):wdtDisplayNotification("Encountered issue marking file as resume.","error",-1)},error:function(t){wdtDisplayNotification("Encountered issue marking file as resume.","error",-1),console.log(t)},complete:function(){t(a).trigger("wdt:complete")}})})),t(document).on("click",'[data-action="wdt-portal-remove-file-resume-status"][data-file-id]',(function(e){let a=this;t(a).trigger("wdt:start");let o=t(this).attr("data-file-id");t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/files/resume/",data:{fileID:o,isResume:!1},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?wdtDisplayNotification("Successfully removed resume status.","success",3e3):wdtDisplayNotification("Encountered issue removing resume status.","error",-1)},error:function(t){wdtDisplayNotification("Encountered issue removing resume status.","error",-1),console.log(t)},complete:function(){t(a).trigger("wdt:complete")}})})),t(document).on("click",'[data-action="wdt-portal-delete-user-file"][data-file-id]',(function(e){let a=this,o=t(this).attr("data-file-id"),r=t(this).attr("data-file-name");wdtRenderConfirmModal({title:"Delete File",content:"Are you sure you want to delete <strong>"+r+"</strong>? This process cannot be undone.",confirmCallback:function(){t(a).trigger("wdt:start"),t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/files/delete/",data:{fileID:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?wdtDisplayNotification("Successfully deleted file.","success",3e3):wdtDisplayNotification("Encountered issue deleting file.","error",-1)},error:function(t){wdtDisplayNotification("Encountered issue deleting file.","error",-1),console.log(t)},complete:function(){t(a).trigger("wdt:complete")}})},destroyCallback:function(){},confirmText:"Delete",className:"wdt-portal-modal-alt",modalType:"failure"})})),t(document).on("click",'[data-action="wdt-portal-upload-user-file"]',(function(e){let a=t(this).next('[data-target="wdt-portal-upload-user-file-input"]');t(a).length<=0||t(a).trigger("click")})),t(document).on("change",'[data-target="wdt-portal-upload-user-file-input"]',(function(e){let a=this;t(a).trigger("wdt:start");let o=t(this).attr("data-user-id"),r=new FormData;for(let e of t(this).get(0).files)r.append("files",e);r.set("owner",o),t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/files/upload/",data:r,cache:!1,contentType:!1,processData:!1,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?wdtDisplayNotification("Successfully uploaded file.","success",3e3):t.message?wdtDisplayNotification(t.message,"error",-1):wdtDisplayNotification("Unable to upload file.","error",-1)},error:function(t){t?.responseJSON?.message?wdtDisplayNotification(t.responseJSON.message,"error",-1):t?.responseJSON?.data?.params?.files?wdtDisplayNotification(t.responseJSON.data.params.files,"error",-1):wdtDisplayNotification("Unable to upload file.","error",-1),console.log(t)},complete:function(){t(a).trigger("wdt:complete")}}),t(this).val(null)}))})),jQuery(document).ready((function(t){"use strict";var e;t(document).on("wdt:populateTable","#wdt-portal-training-event-archive #wdt-portal-training-archive-table",(function(a){a.stopPropagation();let o=this;t(o).find('thead [name="select"]').prop("checked",!1);let r=t(this).attr("data-nonce"),n=new URL(window.location).searchParams.get("status"),i=t(this).attr("data-sort"),s=t(o).data("currentPage")||1,d={nonce:r,number:t('[data-archive-table] [name="perPage"]').val()||null,query:t('[data-archive-table] [name="search"]').val()||null,page:s,sort:i,status:n};for(let t in d)null===d[t]&&delete d[t];e&&e.abort(),e=jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/training/events/",data:d,beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(o).trigger("wdt:loadState")}
1,success:function(e){t(o).find("tbody").html(""),t('#wdt-portal-training-event-archive [data-action="wdt-portal-dropdown-menu-toggle"]').trigger("wdt:refresh");let a=t.Event("wdt:updatePageDisplay");if(a.page=e.page,a.maxPage=e.totalPages,t(o).trigger(a),e.posts.length)for(let a of e.posts){let e=t(t(o).find("[data-table-template]").get(0).content).find("tr").first().clone();a&&t(e).find('[data-column="title"]').text(a.title).attr("title",a.title),a.statusLabel&&t(e).find('[data-column="title"]').append('<div class="wdt-portal-table-subtext active-subtext">'+a.statusLabel+"</div>"),a.url&&t(e).find('[data-column="title"]').append('<div class="wdt-portal-table-subtext link-subtext"><a class="wdt-portal-table-subtext-link" href="'+a.url+'">URL</a></div>'),a.author&&t(e).find('[data-column="title"]').append('<div class="wdt-portal-table-subtext user-subtext">'+a.author+"</div>"),a.serviceProvider&&t(e).find('[data-column="title"]').append('<div class="wdt-portal-table-subtext sp-subtext">'+a.serviceProvider+"</div>"),t(e).find('[data-column="title"]').append('<div class="wdt-portal-job-archive-table-post-btns" style="white-space: nowrap;" data-target="wdt-portal-job-archive-table-post-btns"></div>');let r=[];if("trash"!==a.status?(a.actions.includes("edit")&&a.editLink&&r.push('<a href="'+a.editLink+'" target="_blank" class="wdt-text-link">Edit</a>'),a.actions.includes("delete")&&r.push('<button class="wdt-text-link" data-action="delete-event-post" data-post-id data-post-title data-nonce="'+a.mgmtNonce+'">Delete</button>')):a.actions.includes("restore")&&r.push('<button class="wdt-text-link" data-action="restore-event-post" data-post-id data-post-title data-nonce="'+a.mgmtNonce+'">Restore</button>'),t(e).find('[data-column="title"] [data-target="wdt-portal-job-archive-table-post-btns"]').append(r.join(" | ")),a.employer&&(a.employer.link?t(e).find('[data-column="employer"]').html('<a href="'+a.employer.link+'" target="_blank">'+a.employer.title+"</a>"):t(e).find('[data-column="employer"]').text(a.employer.title)),a.hostedBy&&t(e).find('[data-column="hostedBy"]').text(a.hostedBy).attr("title",a.hostedBy),a.eventDate&&t(e).find('[data-column="eventDate"]').text(a.eventDate).attr("title",a.eventDate),a.deliveryMethod&&t(e).find('[data-column="deliveryMethod"]').text(a.deliveryMethod).attr("title",a.deliveryMethod),a.date){let o=a.date.split("at");t(e).find('[data-column="date"]').html('<span style="display: block;">'+o[0]+'</span><span style="display: block;">at '+o[1]+"</span>").attr("title",a.date)}a.slug&&t(e).find("[data-post-slug]").attr("data-post-slug",a.slug),a.title&&t(e).find("[data-post-title]").attr("data-post-title",a.title),a.id&&(t(e).find('[name="select"]').val(a.id),t(e).find("[data-post-id]").attr("data-post-id",a.id)),t(o).find("tbody").append(e)}else t('#wdt-portal-training-event-archive [data-target="no-matches-found"]').show();let r=e.total;r&&(t('#wdt-portal-training-event-archive [data-target="result-count-container"]').show(),t('#wdt-portal-training-event-archive [data-target="result-count-container"] [data-target="result-count"]').text(wdtNumberFormat(r)));let n=e.page,i=e.totalPages;t(o).data("max_page",e.totalPages),1===n?(t('#wdt-portal-training-event-archive [data-target="wdt-pagination"] [data-pg-action="first"]').prop("disabled",!0),t('#wdt-portal-training-event-archive [data-target="wdt-pagination"] [data-pg-action="prev"]').prop("disabled",!0)):(t('#wdt-portal-training-event-archive [data-target="wdt-pagination"] [data-pg-action="first"]').prop("disabled",!1),t('#wdt-portal-training-event-archive [data-target="wdt-pagination"] [data-pg-action="prev"]').prop("disabled",!1)),n===i?(t('#wdt-portal-training-event-archive [data-target="wdt-pagination"] [data-pg-action="next"]').prop("disabled",!0),t('#wdt-portal-training-event-archive [data-target="wdt-pagination"] [data-pg-action="last"]').prop("disabled",!0)):(t('#wdt-portal-training-event-archive [data-target="wdt-pagination"] [data-pg-action="next"]').prop("disabled",!1),t('#wdt-portal-training-event-archive [data-target="wdt-pagination"] [data-pg-action="last"]').prop("disabled",!1)),t(o).trigger("wdt:collapsableTableInit")},error:function(t){"abort"!==t.statusText&&(wdtDisplayNotification("Unable to retrieve training events. Please contact administrator.","error",-1),console.log(t))},complete:function(){t(o).trigger("wdt:unloadState")}})})),initializeArchiveTable(t("#wdt-portal-training-event-archive [data-archive-table]")),t(document).on("click",'#wdt-portal-training-event-archive [data-action="restore-event-post"]',(function(){let e=t(this).attr("data-post-id"),a=t(this).attr("data-post-title"),o=t(this).attr("data-nonce"),r=t(this);wdtRenderConfirmModal({title:"Restore Training Event",content:'Are you sure you want to restore "'+a+'"?',className:"wdt-portal-modal-alt",confirmCallback:function(){r.prop("disabled",!0),jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/training-event/restore/",data:{id:e,nonce:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success?(wdtDisplayNotification("Training event restored.","success",3e3),t("#wdt-portal-training-event-archive [data-archive-table] table").trigger("wdt:refresh")):(wdtDisplayNotification("Could not restore training event, unspecified error.","error",-1),r.prop("disabled",!1))},error:function(t){t.responseJSON&&t.responseJSON.message?wdtDisplayNotification("Could not restore training event: "+t.responseJSON.message,"error",-1):wdtDisplayNotification("Could not restore training event, unspecified error.","error",-1),console.log(t),r.prop("disabled",!1)}})}})})),t(document).on("click",'#wdt-portal-training-event-archive [data-action="delete-event-post"]',(function(){let e=t(this).attr("data-post-id"),a=t(this).attr("data-post-title"),o=t(this).attr("data-nonce");if(!confirm('Are you sure you want to delete "'+a+'"?'))return;let r=this;t(r).prop("disabled",!0),jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/training-event/delete/",data:{id:e,nonce:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success?(wdtDisplayNotification("Training event deleted.","success",3e3),t("#wdt-portal-training-event-archive [data-archive-table] table").trigger("wdt:refresh")):(wdtDisplayNotification("Could not delete training event, unspecified error.","error",-1),t(r).prop("disabled",!1))},error:function(e){e.responseJSON&&e.responseJSON.message?wdtDisplayNotification("Could not delete training event: "+e.responseJSON.message,"error",-1):wdtDisplayNotification("Could not delete training event, unspecified error.","error",-1),console.log(e),t(r).prop("disabled",!1)}})}))})),jQuery(document).ready((function(t){"use strict";var e=null;t(document).on("click",'#wdt-portal-job-archive [data-action="wdt-job-archive-open-tag-modal"]',(function(e){let a=t("#wdt-portal-job-archive-bulk-edit").clone(!0);_wdtRenderContentModal("Bulk Tag",a.html(),"wdt-portal-modal-alt");let o=t("#wdt-content-modal").find('[name="post-id[]"]'),r=t('#wdt-portal-job-archive [data-target="wdt-portal-job-archive-table"] tbody [name="select"]'),n=t(r).map((function(){if(this.checked)return t(this).val()})).get();for(let e of n){let a=t('<option value="'+e+'" selected>'+e+"</option>");o.append(a)}})),t(document).on("submit",'form[data-target="wdt-portal-job-bulk-edit-form"]',(function(e){let a=t("#wdt-portal-job-archive #wdt-portal-job-archive-table");e.preventDefault();let o=t(this).serializeArray();t(a).trigger("wdt:loadState"),t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/job-board/job-mgmt/tag/",data:o,beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(a).trigger("wdt:loadState"),wdtForceRemoveContentModal()},success:function(t){t.success&&wdtDisplayNotification("Successfully tagged postings.","success",3e3)},error:function(t){console.log(t)},complete:function(){t(a).trigger("wdt:refresh")}})})),t(document).on("click",'form[data-target="wdt-portal-job-bulk-edit-form"] [data-action="close-bulk-edit-form"]',(function(t){wdtForceRemoveContentModal()})),t(document).on("click",'#wdt-portal-job-archive [data-target="wdt-portal-job-archive-table"] [data-action="restore-job-post"]',(function(e){let a=t("#wdt-portal-job-archive #wdt-portal-job-archive-table"),o=t(this).attr("data-post-id"),r=t(this).attr("data-post-title"),n=t(this).attr("data-nonce");_wdtRenderConfirmModal("Restore Posting","Are you sure you want to move <strong>"+r+"</strong> out of the trash?",(function(){t(a).trigger("wdt:loadState"),t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/job-board/job-mgmt/restore/",data:{"post-id":[o],nonce:n},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success&&wdtDisplayNotification("Successfully restored postings","success",3e3)},error:function(t){console.log(t)},complete:function(){t(a).trigger("wdt:refresh")}})}),(function(){}),"Restore","wdt-portal-modal-alt")})),t(document).on("click",'#wdt-portal-job-archive [data-target="wdt-portal-job-archive-table"] [data-action="expire-job-post"]',(function(e){let a=t("#wdt-portal-job-archive #wdt-portal-job-archive-table"),o=t(this).attr("data-post-id"),r=t(this).attr("data-post-title"),n=t(this).attr("data-nonce");_wdtRenderConfirmModal("Expire Posting","Are you sure you want to expire <strong>"+r+"</strong>?",(function(){t(a).trigger("wdt:loadState"),t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/job-board/job-mgmt/expire/",data:{"post-id":o,nonce:n},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success&&wdtDisplayNotification("Successfully expired posting.","success",3e3)},error:function(t){console.log(t)},complete:function(){t(a).trigger("wdt:refresh")}})}),(function(){}),"Expire","wdt-portal-modal-alt")})),t(document).on("click",'#wdt-portal-job-archive [data-target="wdt-portal-job-archive-table"] [data-action="delete-job-post"]',(function(e){let a=t("#wdt-portal-job-archive #wdt-portal-job-archive-table"),o=t(this).attr("data-post-id"),r=t(this).attr("data-post-title"),n=t(this).attr("data-nonce");_wdtRenderConfirmModal("Delete Posting","Are you sure you want to move <strong>"+r+"</strong> to the trash?",(function(){t(a).trigger("wdt:loadState"),t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/job-board/job-mgmt/delete/",data:{"post-id":[o],nonce:n},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success&&wdtDisplayNotification("Successfully deleted posting","success",3e3)},error:function(t){console.log(t)},complete:function(){t(a).trigger("wdt:refresh")}})}),(function(){}),"Move To Trash","wdt-portal-modal-alt")})),t(document).on("click",'#wdt-portal-job-archive [data-action="wdt-job-archive-delete-postings"]',(function(e){let a=t(this).attr("nonce"),o=t("#wdt-portal-job-archive #wdt-portal-job-archive-table"),r=t('#wdt-portal-job-archive [data-target="wdt-portal-job-archive-table"] tbody [name="select"]'),n=t(r).map((function(){if(this.checked)return t(this).val()})).get();_wdtRenderConfirmModal("Delete Postings","Are you sure you want to move <strong>all</strong> selected job postings to the trash?",(function(){t(o).trigger("wdt:loadState"),t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/job-board/job-mgmt/delete/",data:{"post-id":n,nonce:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success&&wdtDisplayNotification("Successfully deleted postings.","success",3e3)},error:function(t){console.log(t)},complete:function(){t(o).trigger("wdt:refresh")}})}),(function(){}),"Move To Trash","wdt-portal-modal-alt")})),t(document).on("wdt:populateTable","#wdt-portal-job-archive #wdt-portal-job-archive-table",(function(a){a.stopPropagation();let o=this;t(o).find('thead [name="select"]').prop("checked",!1);let r=t(this).attr("data-nonce"),n=new URL(window.location),i=n.searchParams.get("status"),s=n.searchParams.get("mlTagged"),d=n.searchParams.get("reportedExpired"),l=n.searchParams.get("jobBoard"),c=t(this).attr("data-sort"),p=t(o).data("currentPage")||1,u={nonce:r,number:t('[data-archive-table] [name="perPage"]').val()||null,query:t('[data-archive-table] [name="search"]').val()||null,page:p,sort:c,status:i,mlTagged:s,reportedExpired:d,jobBoard:l,nocs:n.searchParams.getAll("nocs[]"),nocs2021:n.searchParams.getAll("nocs2021[]"),jobTags:n.searchParams.getAll("job-tags[]"),skills:n.searchParams.getAll("skills[]"),languages:n.searchParams.getAll("languages[]")};for(let t in u)null===u[t]&&delete u[t];e&&e.abort(),e=jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/jobs/",data:u,beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(o).trigger("wdt:loadState")}
1,success:function(e){if(t(o).find("tbody").html(""),t('#wdt-portal-job-archive [data-action="wdt-portal-dropdown-menu-toggle"]').trigger("wdt:refresh"),e.success){let a=t.Event("wdt:updatePageDisplay");if(a.page=e.body.page,a.maxPage=e.body.max_page,t(o).trigger(a),e.body.jobs.length)for(let a of e.body.jobs){let r=t(t(o).find("[data-table-template]").get(0).content).find("tr").first().clone();if(a.title&&t(r).find('[data-column="title"]').text(a.title).attr("title",a.title),a.instance&&a.instance.title){let o=t('<div class="wdt-portal-table-subtext"></div>');o.append(e.body.instance_icon||""),o.append(document.createTextNode(a.instance.title)),t(r).find('[data-column="title"]').append(o)}a.status_label&&t(r).find('[data-column="title"]').append('<div class="wdt-portal-table-subtext active-subtext">'+a.status_label+"</div>"),a.url&&t(r).find('[data-column="title"]').append('<div class="wdt-portal-table-subtext link-subtext"><a class="wdt-portal-table-subtext-link" href="'+a.url+'">URL</a></div>'),a.author&&t(r).find('[data-column="title"]').append('<div class="wdt-portal-table-subtext user-subtext">'+a.author+"</div>"),t(r).find('[data-column="title"]').append('<div class="wdt-portal-job-archive-table-post-btns" style="white-space: nowrap;" data-target="wdt-portal-job-archive-table-post-btns"></div>');let n=[];if("trash"!==a.status?(a.actions.includes("read")&&n.push('<a href="'+a.permalink+'" target="_blank" class="wdt-text-link">View</a>'),a.actions.includes("edit")&&a.edit_link&&n.push('<a href="'+a.edit_link+'" target="_blank" class="wdt-text-link">Edit</a>'),a.actions.includes("expire")&&n.push('<button class="wdt-text-link" data-action="expire-job-post" data-post-id data-post-title data-nonce="'+a.mgmt_nonce+'">Expire</button>'),a.actions.includes("delete")&&n.push('<button class="wdt-text-link" data-action="delete-job-post" data-post-id data-post-title data-nonce="'+a.mgmt_nonce+'">Delete</button>')):a.actions.includes("restore")&&n.push('<button class="wdt-text-link" data-action="restore-job-post" data-post-id data-post-title data-nonce="'+a.mgmt_nonce+'">Restore</button>'),t(r).find('[data-column="title"] [data-target="wdt-portal-job-archive-table-post-btns"]').append(n.join(" | ")),a.employer&&(a.employer.link?t(r).find('[data-column="employer"]').html('<a href="'+a.employer.link+'" target="_blank">'+a.employer.title+"</a>").attr("title",a.employer.title):t(r).find('[data-column="employer"]').text(a.employer.title).attr("title",a.employer.title)),a.date){let e=a.date.split("at");t(r).find('[data-column="date"]').html('<span style="display: block;">'+e[0]+'</span><span style="display: block;">at '+e[1]+"</span>").attr("title",a.date)}if(a.nocs&&a.nocs.length){let e=[],o=[];for(let t of a.nocs)e.push('<button class="wdt-text-link" data-action="add-filter" data-value="'+t.slug+'" data-name="nocs[]" title="Filter for posts including '+t.title+'." style="text-align: left;">'+t.title+"</button>"),o.push(t.title);t(r).find('[data-column="nocs"]').html(e.join(", ")).attr("title",o.join(", "))}if(a.nocs2021&&a.nocs2021.length){let e=[],o=[];for(let t of a.nocs2021)e.push('<button class="wdt-text-link" data-action="add-filter" data-value="'+t.slug+'" data-name="nocs2021[]" title="Filter for posts including '+t.title+'." style="text-align: left;">'+t.title+"</button>"),o.push(t.title);t(r).find('[data-column="nocs2021"]').html(e.join(", ")).attr("title",o.join(", "))}if(a.skills&&a.skills.length){let e=[],o=[];for(let t of a.skills)e.push('<button class="wdt-text-link" data-action="add-filter" data-value="'+t.slug+'" data-name="skills[]" title="Filter for posts including '+t.title+'." style="text-align: left;">'+t.title+"</button>"),o.push(t.title);t(r).find('[data-column="skills"]').html(e.join(", ")).attr("title",o.join(", "))}if(a.languages&&a.languages.length){let e=[],o=[];for(let t of a.languages)e.push('<button class="wdt-text-link" data-action="add-filter" data-value="'+t.slug+'" data-name="languages[]" title="Filter for posts including '+t.title+'." style="text-align: left;">'+t.title+"</button>"),o.push(t.title);t(r).find('[data-column="languages"]').html(e.join(", ")).attr("title",o.join(", "))}if(a.job_tags&&a.job_tags.length){let e=[],o=[];for(let t of a.job_tags)e.push('<button class="wdt-text-link" data-action="add-filter" data-value="'+t.slug+'" data-name="job-tags[]" title="Filter for posts including '+t.title+'." style="text-align: left;">'+t.title+"</button>"),o.push(t.title);t(r).find('[data-column="jobTags"]').html(e.join(", ")).attr("title",o.join(", "))}a.slug&&t(r).find("[data-post-slug]").attr("data-post-slug",a.slug),a.title&&t(r).find("[data-post-title]").attr("data-post-title",a.title),a.id&&(t(r).find('[name="select"]').val(a.id),t(r).find("[data-post-id]").attr("data-post-id",a.id
1)),t(o).find("tbody").append(r)}else t('#wdt-portal-job-archive [data-target="no-matches-found"]').show();let r=e.body.total;r&&(t('#wdt-portal-job-archive [data-target="result-count-container"]').show(),t('#wdt-portal-job-archive [data-target="result-count-container"] [data-target="result-count"]').text(wdtNumberFormat(r)));let n=e.body.page,i=e.body.max_page;t(o).data("max_page",e.body.max_page),1===n?(t('#wdt-portal-job-archive [data-target="wdt-pagination"] [data-pg-action="first"]').prop("disabled",!0),t('#wdt-portal-job-archive [data-target="wdt-pagination"] [data-pg-action="prev"]').prop("disabled",!0)):(t('#wdt-portal-job-archive [data-target="wdt-pagination"] [data-pg-action="first"]').prop("disabled",!1),t('#wdt-portal-job-archive [data-target="wdt-pagination"] [data-pg-action="prev"]').prop("disabled",!1)),n===i?(t('#wdt-portal-job-archive [data-target="wdt-pagination"] [data-pg-action="next"]').prop("disabled",!0),t('#wdt-portal-job-archive [data-target="wdt-pagination"] [data-pg-action="last"]').prop("disabled",!0)):(t('#wdt-portal-job-archive [data-target="wdt-pagination"] [data-pg-action="next"]').prop("disabled",!1),t('#wdt-portal-job-archive [data-target="wdt-pagination"] [data-pg-action="last"]').prop("disabled",!1)),t(o).trigger("wdt:collapsableTableInit")}t(o).trigger("wdt:changeCustomColumns")},error:function(t){"abort"!==t.statusText&&(wdtDisplayNotification("Unable to retrieve jobs. Please contact administrator.","error",-1),console.log(t))},complete:function(){t(o).trigger("wdt:unloadState")}})})),initializeArchiveTable(t("#wdt-portal-job-archive [data-archive-table]"))})),jQuery((function(t){var e;t(document).on("click",'[data-target="wdt-people-custom-columns-form"] [data-action="reset-defaults"]',(function(e){let a=t(this).parents('[data-target="wdt-people-custom-columns-form"]').first(),o=t(a).find('[data-rf-target="wdt-material-form-checkbox"]');t(o).each((function(e){"true"===t(this).attr("data-default")?t(this).prop("checked",!0):t(this).prop("checked",!1)})),t(o).first().trigger("change")})),t(document).on("dragstart",'[data-target="wdt-people-custom-columns-form"] [draggable="true"]',(function(a){e=this,a.originalEvent.dataTransfer.dropEffect="move",t(this).addClass("wdt-people-custom-columns-form-dragging-ghost"),setTimeout((function(e){t(e).removeClass("wdt-people-custom-columns-form-dragging-ghost"),t(e).addClass("wdt-people-custom-columns-form-dragging-origin")}),1,this)})),t(document).on("dragend",'[data-target="wdt-people-custom-columns-form"] [draggable="true"]',(function(a){e=null,t('[data-target="wdt-people-custom-columns-form"] [draggable="true"]').removeClass("wdt-people-custom-columns-form-dragover"),t(this).removeClass("wdt-people-custom-columns-form-dragging-ghost"),t(this).removeClass("wdt-people-custom-columns-form-dragging-origin")})),t(document).on("dragover",'[data-target="wdt-people-custom-columns-form"] [draggable="true"]',(function(e){t('[data-target="wdt-people-custom-columns-form"] [draggable="true"]').removeClass("wdt-people-custom-columns-form-dragover"),t(this).addClass("wdt-people-custom-columns-form-dragover")})),t(document).on("drop",'[data-target="wdt-people-custom-columns-form"] [draggable="true"]',(function(a){let o=t(e);o.length&&o!==this&&(t(o).insertBefore(this),t(this).parents('[data-target="wdt-people-custom-columns-form"]').first().trigger("wdt:formReordered"))})),t(document).on("change",'[data-target="wdt-people-custom-columns-form"] [data-rf-target="wdt-material-form-checkbox"]',(function(e){let a=t(this).parents('[data-target="wdt-people-custom-columns-form"]').first();t(a).find('[data-action="reset-defaults"]').trigger("wdt:assessButtonState")})),t(document).on("wdt:assessButtonState",'[data-target="wdt-people-custom-columns-form"] [data-action="reset-defaults"]',(function(e){let a=t(this).parents('[data-target="wdt-people-custom-columns-form"]').first(),o=t(a).find('[data-rf-target="wdt-material-form-checkbox"]'),r=!0;t(o).each((function(e){if("true"===t(this).attr("data-default")&&!1===t(this).prop("checked")||"true"!==t(this).attr("data-default")&&!0===t(this).prop("checked"))return r=!1,!1})),r?t(this).prop("disabled",!0):t(this).prop("disabled",!1)})),t('[data-target="wdt-people-custom-columns-form"] [data-action="reset-defaults"]').trigger("wdt:assessButtonState")})),jQuery((function(t){"use strict";t(document).on("submit","#wdt-report-job-posting-form",(async function(e){e.preventDefault(),await resolveAllInvisRecaptchas(t(this).get(0));let a=t(this).serializeArray();t.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/report-job-posting/report/",data:a,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){wdtDisplayNotification("Successfully reported job posting","success",5e3)},error:function(t){console.log(t),wdtDisplayNotification("Encountered issue reporting job posting.","error",-1)},complete:function(){wdtForceRemoveContentModal()}})}))})),jQuery((function(t){"use strict";t(document).on("wdt:buildState",'[data-target="wdt-new-rule-form"]',(function(e){let a={};a.noc=t(this).find('select[name="noc-tag"]').val(),a.naics=t(this).find('select[name="naics-tags[]"]').val(),a["match-text"]=t(this).find('input[name="simple-match-text"]').val(),a["match-type"]=t(this).find('[name="match-type"]:checked').val(),a["sector-specific"]=t(this).find('[name="sector-specific"]:checked').val(),a["negative-matches"]=t(this).find('[name="do-not-match"]').val(),t(this).data("state",a)})),t(document).on("click",'[data-target="wdt-new-rule-form"] [data-action="wdt-new-rule-form-advance"]',(function(e){console.log("advance");let a=t(this).parents('[data-target="wdt-new-rule-form"]').first();t(a).trigger("wdt:buildState");let o=t(a).data("state");t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/nocs/rule-summary/",data:{state:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){_wdtRenderContentModal("",t.html)},error:function(t){console.log(t),wdtDisplayNotification("Error preparing summary.","error",-1)},complete:function(){}})})),t(document).on("click",'[data-action="wdt-new-rule-form-summary-back"]',(function(t){wdtForceRemoveContentModal()})),t(document).on("click",'[data-action="wdt-new-rule-form-summary-continue"]',(function(e){console.log("continue"),wdtForceRemoveContentModal();let a=t('[data-target="wdt-new-rule-form-container"]').first();t(a).find('[data-target="wdt-new-rule-form-testing-container"]').trigger("wdt:reset"),t(a).find('[data-target="wdt-new-rule-form-form-container"]').hide(),t(a).find('[data-target="wdt-new-rule-form-testing-container"]').show()})),t(document).on("change",'[data-target="wdt-new-rule-form-testing-container"] [name="rule-application"], [data-target="wdt-new-rule-form-testing-container"] [name="matches-filter"]',(function(e){let a=t(this).parents('[data-target="wdt-new-rule-form-testing-container"]');t(a).trigger("wdt:search")})),t(document).on("click",'[data-target="wdt-new-rule-form-testing-container"] [data-action="wdt-new-rule-form-back-to-rule"]',(function(e){let a=t(this).parents('[data-target="wdt-new-rule-form-container"]').first();t(a).find('[data-target="wdt-new-rule-form-form-container"]').show(),t(a).find('[data-target="wdt-new-rule-form-testing-container"]').hide()})),t(document).on("wdt:reset",'[data-target="wdt-new-rule-form-testing-container"]',(function(e){t(this).data("resetting",!0);let a=t(this).find('[name="matches-filter"]'),o=t.Event("wdt:select");o.value="all",t(a).trigger(o),t(this).find('[name="rule-application"]').prop("checked",!1),t(this).find('[data-target="wdt-new-rule-form-testing-matches"]').html(""),t(this).find('[data-target="wdt-new-rule-form-testing-result-section"]').hide(),t(this).data("resetting",!1)})),t(document).on("wdt:search",'[data-target="wdt-new-rule-form-testing-container"]',(function(e){if(1==t(this).data("resetting"))return;t(this).data("paginating")&&t(this).data("paginating",!1);let a=this,o=Date.now();t(a).data("searching",o);let r=t(a).parents('[data-target="wdt-new-rule-form-container"]').first(),n=t(a).find('[name="rule-application"]:checked').val(),i=t(r).find('[data-target="wdt-new-rule-form"]'),s=t(a).find('[data-target="wdt-new-rule-form-testing-banner-text"]'),d=t(i).data("state"),l=t(this).find('[data-target="wdt-form-select-input"]').val();t(this).data("page",1),t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/nocs/rule-matches/",data:{page:1,state:d,filter:l},beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(a).find('[data-target="wdt-new-rule-form-testing-matches"] *').css("opacity",0),t(a).find('[data-target="wdt-new-rule-form-testing-matches"]').prepend('<div class="wdt-spinner wdt-spinner-small"></div>')},success:function(e){o==t(a).data("searching")&&(e.success?e.total<=0?(t(s).html("No Matches found."),t(r).find('[data-target="wdt-new-rule-form-testing-matches"]').html("<span>There were no matches for this rule. Please double check your rule configuration or current filters.</span>")):(t(r).find('[data-target="wdt-new-rule-form-testing-matches"]').html(e.html),"future"==n?t(s).html("While this rule will not be applied to these posts, please review the list below to verify the rule is an accurate match."):"historical"==n&&t(s).html("This rule would be applied to <strong>
1"+e.total.toLocaleString("en-US")+"</strong> historical job posts but will NOT replace any previously assigned NOCs."),t(a).data("max_pages",e.max_pages)):(t(s).html("Unable to retrieve matches..."),t(a).find('[data-target="wdt-new-rule-form-testing-matches"]').html("")))},error:function(e){o==t(a).data("searching")&&(console.log(e),wdtDisplayNotification("Error retrieving matches.","error",-1),t(s).html("Unable to retrieve matches..."),t(a).find('[data-target="wdt-new-rule-form-testing-matches"]').html(""))},complete:function(){o==t(a).data("searching")&&(t(a).find('[data-target="wdt-new-rule-form-testing-result-section"]').show(),t(a).data("searching",!1))}})})),t(document).on("wdt:paginate",'[data-target="wdt-new-rule-form-testing-container"]',(function(e){if(1==t(this).data("resetting"))return;if(t(this).data("paginating"))return;if(t(this).data("searching"))return;let a=this,o=t(a).data("page");if(o?o++:o=1,!t(a).data("max_pages")||o>t(a).data("max_pages"))return;let r=Date.now();t(a).data("paginating",r);let n=t(a).parents('[data-target="wdt-new-rule-form-container"]').first(),i=t(n).find('[data-target="wdt-new-rule-form"]'),s=t(i).data("state"),d=t(a).find('[data-target="wdt-form-select-input"]').val();t(a).data("page",o),t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/nocs/rule-matches/",data:{page:o,state:s,filter:d},beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(a).find('[data-target="wdt-new-rule-form-testing-matches"]').append('<div data-target="wdt-new-rule-form-testing-matches-inner-spinner" class="wdt-spinner wdt-spinner-small"></div>')},success:function(e){e.success&&r==t(a).data("paginating")&&t(n).find('[data-target="wdt-new-rule-form-testing-matches"]').append(e.html)},error:function(t){console.log(t),wdtDisplayNotification("Error retrieving matches.","error",-1)},complete:function(){r==t(a).data("paginating")&&(t(a).find('[data-target="wdt-new-rule-form-testing-matches"] [data-target="wdt-new-rule-form-testing-matches-inner-spinner"]').remove(),t(a).data("paginating",!1))}})})),t(document).on("change",'[data-target="wdt-new-rule-form"] [name="sector-specific"]:checked',(function(e){let a=t(this).val(),o=t(this).parents('[data-target="wdt-new-rule-form"]').first();"specific"==a?t(o).find('[name="naics-tags[]"]').trigger("wdt:undisable"):"all"==a&&t(o).find('[name="naics-tags[]"]').trigger("wdt:disable")})),t(document).on("change",'[data-target="wdt-new-rule-form"] [name="match-type"]:checked',(function(e){let a=t(this).val(),o=t(this).parents('[data-target="wdt-new-rule-form"]').first();"advanced"==a?t(o).find('[data-new-rule-target="do-not-match"]').show():t(o).find('[data-new-rule-target="do-not-match"]').hide()})),t('[data-target="wdt-new-rule-form-testing-matches"]').on("scroll",(function(e){t(this)[0].scrollHeight-t(this)[0].scrollTop<=t(this)[0].clientHeight+40&&t(this).trigger("wdt:paginate")})),t(document).on("click",'[data-target="wdt-new-rule-form-testing-container"] [data-action="wdt-new-rule-form-apply-rule"]',(function(e){let a=this,o=t(a).parents('[data-target="wdt-new-rule-form-container"]').first(),r=t(o).find('[data-target="wdt-new-rule-form"]'),n=t(r).data("state"),i=t(o).find('[name="rule-application"][value="historical"]').is(":checked");t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/nocs/new-rule/",data:{state:n,historical:i},beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(a).prop("disabled",!0)},success:function(t){t.success&&(wdtDisplayNotification("Successfully created rule. Closing tab after 3 seconds...","success",-1),setTimeout((function(){window.close()}),3e3))},error:function(t){console.log(t),wdtDisplayNotification("Error creating rule.","error",-1)},complete:function(){}})}))})),jQuery(document).ready((function(t){var e,a,o,r,n,i,s,d,l,c,p,u={},f=[],g={},m=!1;let w;if(t("#wdt-portal-client-map-vars").length){let e=t("#wdt-portal-client-map-vars").val();try{g=JSON.parse(atob(e))}catch(t){}}t(document).on("change",'[data-target="wdt-portal-client-map-filters-form"] [name="service_coverage"]',(function(e){(m=t(this).is(":checked"))?t("#wdt-portal-client-map-footer").show():t("#wdt-portal-client-map-footer").hide(),j(),w&&b(w)}));class h{render({markers:t,position:e}){const a=t.reduce(((t,e)=>t+(e.metadata?e.metadata.count:0)),0);return new google.maps.Marker({position:e,label:{text:a.toString(),fontSize:"16px",color:"#ffffff"},icon:{path:google.maps.SymbolPath.CIRCLE,scale:25,fillColor:WDT.colors.primary,fillOpacity:1,strokeColor:"#ffffff",strokeWeight:4,strokeOpacity:1},zIndex:1})}}function b(a){!function(t){let e=t.marker,a=t.datum,o=x();var n='<div class="client-map-infowindow">';n+="<h5>"+a.title+"</h5>",(a.street||a.postalCode||a.city)&&(n+='<div class="infowindow-section"><div class="infowindow-section-content">',n+=[a.street,a.postalCode,a.city].join(", "),n+="</div></div>");a.statement&&(n+='<div class="infowindow-section"><div class="infowindow-section-content">',n+=a.statement,n+="</div></div>");if(o.length){n+='<div class="infowindow-section infowindow-bordered-section"><div class="infowindow-section-content">',n+='<div class="wdt-portal-client-map-filters-chip-container">';for(let t of o)n+=t;
1n+="</div>",n+="</div></div>"}n+='<div class="infowindow-section" data-target="info-window-spinner-container"><div class="infowindow-section-content"><div id="wdt-client-map-report-sp-spinner" class="wdt-spinner wdt-spinner-small"></div></div></div>',n+="</div>",r.setContent(n),k(r,e)}(a),w=a;let o=[{name:"service_provider[]",value:a.datum?.serviceProviderID}];m&&o.push({name:"geoshape",value:a.datum?.isochroneID});let n=t.Event("wdt:refreshMap");n._extraFilters=o,t("#wdt-portal-client-map").trigger(n);for(let t of p)t===a.marker||null!==t?._wdtdata?.datum?.serviceProviderID&&t?._wdtdata?.datum?.serviceProviderID===a?.datum?.serviceProviderID?t.setOpacity(1):t.setOpacity(.5);let i=a.datum;m&&i.serviceProviderID?function(a,o){let r=a.isochroneID,n=!1,i=null;s&&s.abort();s=t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/isochrones/",data:{id:r,nonce:g.isochrone_nonce},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success?(n=!0,i=t.id,function(t){j();let a={type:"FeatureCollection",name:"isochrone",crs:{type:"name",properties:{name:"urn:ogc:def:crs:OGC:1.3:CRS84"}},features:[{type:"Feature",properties:{name:"isochrone"},geometry:t}]};(d=new google.maps.Data({map:e})).setStyle({strokeColor:WDT.colors.primary,fillColor:WDT.colors.primary,fillOpacity:.5}),d.addGeoJson(a)}(t.isochrone,t.bounds)):wdtDisplayNotification("Error retrieving isochrone for service provider "+a.title+".","error",-1)},error:function(t,e,o){"abort"!==e&&(console.log(o),wdtDisplayNotification("Error retrieving isochrone for service provider "+a.title+".","error",-1))},complete:function(){t("#client-map-spinner").remove(),o(n,i)}})}(a.datum,(function(e,a){e&&a?(l&&l.abort(),l=t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/report/client-map/",data:{service_provider:i.serviceProviderID,geoshape:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.success){let a=0,o=0;for(let t of e.result.postal_code_data)t.in_geoshape&&(o+=t.count),a+=t.count;t("#wdt-client-map-report-sp-spinner").parents('[data-target="info-window-spinner-container"]').first().after('<div class="infowindow-section infowindow-bordered-section"><div class="infowindow-section-content"><strong>'+o+"</strong>&nbsp;Clients within 20 min</div></div>")}else wdtDisplayNotification("Error retrieving map data.","error",-1)},error:function(t,e,a){"abort"!==e&&(console.log(a),wdtDisplayNotification("Error retrieving map data.","error",-1))},complete:function(){t("#wdt-client-map-report-sp-spinner").parents('[data-target="info-window-spinner-container"]').remove()}})):t("#wdt-client-map-report-sp-spinner").parents('[data-target="info-window-spinner-container"]').remove()})):t("#wdt-client-map-report-sp-spinner").parents('[data-target="info-window-spinner-container"]').remove()}function y(){j(),w=null,t("#wdt-portal-client-map").trigger("wdt:refreshMap");for(let t of p)t.setOpacity(1)}function v(t){let e=0,a=[];for(let o of t.postal_code_data)o.latitude&&o.longitude||(e+=o.count,a.push(o.postal_code));e>0&&console.log(e+" clients were not displayed on the map due to missing geocode data for their postal code...")}function _(){return new deck.HeatmapLayer({id:"heatmap-layer",data:f,getPosition:t=>t.coordinates,getWeight:t=>t.weight,radiusPixels:25,intensity:2,threshold:.002,colorRange:[[0,255,0,120],[150,255,0,180],[200,255,0,200],[255,255,0,200],[255,128,0,200],[255,0,0,200]]})}function k(t,a){let o=a.getPosition(),r=a.getIcon();c&&c.setMap(null);let n=40;r&&"object"==typeof r&&r.size&&(n=r.size.height||n),c=new google.maps.Marker({position:o,map:e,icon:r,visible:!1}),t.setOptions({pixelOffset:new google.maps.Size(0,-n)}),t.open({map:e,anchor:c})}function x(){let e=wdtSerializeMaterialForm(t('[data-target="wdt-portal-client-map-filters-form"]')),a=[];for(let t in e)if(Array.isArray(e[t])&&"map_mode"!==t&&"service_coverage"!==t)for(let o of e[t]){let t=document.createElement("span");t.innerText=o.label,t.classList.add("wdt-portal-client-map-filters-chip"),a.push('<span class="wdt-portal-client-map-filters-chip">'+o.label+"</span>")}return a}function j(){d&&d.setMap(null)}t(document).on("wdt:initMap","#wdt-portal-client-map",(function(t){(r=new google.maps.InfoWindow({maxWidth:280})).setContent(""),r.open(),r.close(),r.addListener("close",(()=>{y()}));let a=g.bounding_rectangle,o=new google.maps.LatLng(a.y1,a.x1),n=new google.maps.LatLng(a.y2,a.x2),i=new google.maps.LatLngBounds(o,n),s=new google.maps.LatLng(a.center.y,a.center.x);var d,l,c,f,m,w,h,v,_,k;(e=new google.maps.Map(document.getElementById("wdt-portal-client-map"),{restriction:{latLngBounds:(d=i,l=.5,c=d.getSouthWest
1(),f=d.getNorthEast(),m=f.lat()-c.lat(),w=f.lng()-c.lng(),h=m*l,v=w*l,_=new google.maps.LatLng(c.lat()-h,c.lng()-v),k=new google.maps.LatLng(f.lat()+h,f.lng()+v),new google.maps.LatLngBounds(_,k)),strictBounds:!1},center:s,gestureHandling:"greedy",mapTypeControl:!1,streetViewControl:!1,fullscreenControl:!1,zoom:8,zoomControl:!0,zoomControlOptions:{position:google.maps.ControlPosition.TOP_RIGHT},styles:[{featureType:"all",elementType:"geometry.fill",stylers:[{weight:"2.00"}]},{featureType:"all",elementType:"geometry.stroke",stylers:[{color:"#9c9c9c"}]},{featureType:"all",elementType:"labels.text",stylers:[{visibility:"on"}]},{featureType:"landscape",elementType:"all",stylers:[{color:"#f2f2f2"}]},{featureType:"landscape",elementType:"geometry.fill",stylers:[{color:"#ffffff"}]},{featureType:"landscape.man_made",elementType:"geometry.fill",stylers:[{color:"#ffffff"}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"road",elementType:"all",stylers:[{saturation:-100},{lightness:45}]},{featureType:"road",elementType:"geometry.fill",stylers:[{color:"#eeeeee"}]},{featureType:"road",elementType:"labels.text.fill",stylers:[{color:"#7b7b7b"}]},{featureType:"road",elementType:"labels.text.stroke",stylers:[{color:"#ffffff"}]},{featureType:"road.highway",elementType:"all",stylers:[{visibility:"simplified"}]},{featureType:"road.arterial",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"transit",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"water",elementType:"all",stylers:[{color:"#46bcec"},{visibility:"on"}]},{featureType:"water",elementType:"geometry.fill",stylers:[{color:"#c8d7d4"}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{color:"#070707"}]},{featureType:"water",elementType:"labels.text.stroke",stylers:[{color:"#ffffff"}]}]})).addListener("click",(function(){r.close(),y()}));let x=0;for(let t in g.sortation_area_counts)x+=g.sortation_area_counts[t];if(g.boundary){let t=g.boundary,a=new google.maps.Data({map:e});a.setStyle({strokeColor:WDT.colors.primary,fillColor:WDT.colors.primary,fillOpacity:0}),a.addGeoJson(t)}for(let t in g.sortation_areas){let a={type:"FeatureCollection",name:"boundary",crs:{type:"name",properties:{name:"urn:ogc:def:crs:OGC:1.3:CRS84"}},features:[{type:"Feature",properties:{name:t},geometry:g.sortation_areas[t]}]};u[t]=new google.maps.Data({map:e}),u[t].setStyle({strokeColor:WDT.colors.primary,fillColor:WDT.colors.primary,fillOpacity:0}),u[t].addGeoJson(a)}p=[];for(let t of g.service_provider_data){if(!t.latitude||!t.longitude)continue;let a={svg:'<svg xmlns="http://www.w3.org/2000/svg" width="54" height="69" viewBox="0 0 54 69" fill="none"> <g filter="url(#filter0_d_18_4256)"> <path d="M27.25 57.2302L25.7804 58.5868L27.25 60.1789L28.7196 58.5868L27.25 57.2302ZM27.25 57.2302C28.7196 58.5868 28.7199 58.5865 28.7202 58.5862L28.7212 58.5851L28.7245 58.5815L28.7361 58.5689L28.7792 58.5218C28.8167 58.4809 28.8714 58.421 28.9421 58.3429C29.0836 58.1869 29.2895 57.9584 29.5505 57.6648C30.0724 57.0777 30.8153 56.2294 31.7058 55.1782C33.4849 53.0779 35.8614 50.1571 38.2425 46.8831C40.6183 43.6163 43.0279 39.9581 44.8515 36.3868C46.6473 32.8701 48 29.2017 48 25.9802C48 14.5241 38.7061 5.23022 27.25 5.23022C15.7939 5.23022 6.5 14.5241 6.5 25.9802C6.5 29.2017 7.85268 32.8701 9.64848 36.3868C11.4721 39.9581 13.8817 43.6163 16.2575 46.8831C18.6386 50.1571 21.0151 53.0779 22.7942 55.1782C23.6847 56.2294 24.4276 57.0777 24.9495 57.6648C25.2105 57.9584 25.4164 58.1869 25.5579 58.3429C25.6286 58.421 25.6833 58.4809 25.7208 58.5218L25.7639 58.5689L25.7755 58.5815L25.7788 58.5851L25.7798 58.5862C25.7801 58.5865 25.7804 58.5868 27.25 57.2302Z" fill="#515667" stroke="white" stroke-width="4"/> <path d="M35.5 16.4808H19V38.4808H25.1875V32.9808H29.3125V38.4808H35.5V16.4808ZM21.75 26.1058H24.5V28.8558H21.75V26.1058ZM28.625 26.1058V28.8558H25.875V26.1058H28.625ZM30 26.1058H32.75V28.8558H30V26.1058ZM24.5 20.6058V23.3558H21.75V20.6058H24.5ZM25.875 20.6058H28.625V23.3558H25.875V20.6058ZM32.75 20.6058V23.3558H30V20.6058H32.75Z" fill="white"/> </g> <defs> <filter id="filter0_d_18_4256" x="0" y="-0.49939" width="54" height="69" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
1 <feFlood flood-opacity="0" result="BackgroundImageFix"/> <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> <feOffset dy="1"/> <feGaussianBlur stdDeviation="2"/> <feComposite in2="hardAlpha" operator="out"/> <feColorMatrix type="matrix" values="0 0 0 0 0.317647 0 0 0 0 0.337255 0 0 0 0 0.403922 0 0 0 0.75 0"/> <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_18_4256"/> <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_18_4256" result="shape"/> </filter> </defs> </svg>',width:60,height:60,labelOriginX:0,labelOriginY:0},o=new google.maps.Marker({position:new google.maps.LatLng(t.latitude,t.longitude),map:e,label:"",icon:{url:"data:image/svg+xml;base64,"+window.btoa(a.svg),origin:new google.maps.Point(0,0),labelOrigin:new google.maps.Point(a.labelOriginX,a.labelOriginY),scaledSize:new google.maps.Size(a.width,a.height)},zIndex:2}),r={datum:t,marker:o};o._wdtdata=r,o.addListener("click",(function(t){b(r)})),p.push(o)}e.data.setStyle({strokeColor:WDT.colors.primary,fillColor:WDT.colors.primary,fillOpacity:.25})})),t(document).on("wdt:refreshFilteredBoundCount","#wdt-portal-client-map",(function(e){let a=x();if(!a.length)return void t("#wdt-portal-client-map-footer-filtered-totals").hide();let o=t('[data-target="wdt-portal-client-map-filters-form"]').serializeArray();o.push({name:"display_in_service_provider_bounds",value:"true"}),i&&i.abort(),i=t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/report/client-map/",data:o,beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t("#wdt-portal-client-map-footer-filtered-totals").hide(),t('#wdt-portal-client-map-footer [data-target="spinner"]').show();let o=a.join("");t('#wdt-portal-client-map-footer-filtered-totals [data-target="chips"]').html(o)},success:function(e){if(e.success){t("#wdt-portal-client-map-footer-filtered-totals").show();let a=e.in_bounds,o=e.total;t('#wdt-portal-client-map-footer-filtered-totals [data-target="bounded-total"]').text(wdtNumberFormat(a)),t('#wdt-portal-client-map-footer-filtered-totals [data-target="total"]').text(wdtNumberFormat(o)),t('#wdt-portal-client-map-footer-filtered-totals [data-target="bounded-percent"]').text(wdtNumberFormat(a/o*100,1)+"%")}else wdtDisplayNotification("Error retrieving map data.","error",-1)},error:function(t,e,a){"abort"!==e&&(console.log(a),wdtDisplayNotification("Error retrieving map data.","error",-1))},complete:function(){t('#wdt-portal-client-map-footer [data-target="spinner"]').hide()}})})),t(document).on("wdt:refreshMap","#wdt-portal-client-map",(function(i){void 0===e&&t(this).trigger("wdt:initMap");let s=t('[data-target="wdt-portal-client-map-filters-form"]').serializeArray();i._extraFilters&&(s=function(t,e){const a=new Map;for(const o of[...t,...e]){const{name:t,value:e}=o,r=Array.isArray(e)?e:[e];a.has(t)?a.set(t,a.get(t).concat(r)):a.set(t,r)}return Array.from(a.entries()).map((([t,e])=>({name:t,value:e})))}(s,i._extraFilters)),n&&n.abort(),n=t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/report/client-map/",data:s,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(n){if(n.success){let i=n.result;t("#wdt-portal-client-map").trigger("wdt:clearMap");let s=t('[data-target="wdt-portal-client-map-filters-form"] [name="map_mode"]:checked');if("heatmap"===(t(s).length?t(s).val():"markers"))!function(t,e){let o=[],r=0;for(let t of e.postal_code_data)t.count>r&&(r=t.count);for(let t of e.postal_code_data)t.latitude&&t.longitude&&o.push({coordinates:[parseFloat(t.longitude),parseFloat(t.latitude)],weight:Math.log1p(t.count)/Math.log1p(r)});f=o,a||((a=new deck.GoogleMapsOverlay({})).setMap(t),google.maps.event.trigger(t,"resize"));a.setProps({layers:[_()]});const n=t.getCenter();t.panBy(1,0),setTimeout((function(){t.panTo(n)}),50),v(e)}(e,i);else!function(t,e){let a=[];for(let o of e.postal_code_data){if(!o.latitude||!o.longitude)continue;if(!1===o.in_geoshape)continue;let e=new google.maps.Marker({position:new google.maps.LatLng(o.latitude,o.longitude),map:t,label:{text:o.count.toString(),fontSize:"16px",color:"#ffffff"},icon:{path:google.maps.SymbolPath.CIRCLE,scale:25,fillColor:WDT.colors.primary,fillOpacity:1,strokeColor:"#ffffff",strokeWeight:4,strokeOpacity:1},metadata:{count:o.count},zIndex:1});e.setMap(null),e.addListener("click",(function(a){var n='<div class="client-map-infowindow">';n+="<h5>"+o.postal_code+"</h5>",n+='<div class="infowindow-section"><div class="infowindow-section-content">',n+=o.count.toString()+" client(s) residing in this postal code.",n+="</div></div>",n+="</div>",r.setContent(n),k(r,e),t.setCenter(e.getPosition())})),a.push(e)}
1let n=new markerClusterer.SuperClusterViewportAlgorithm({maxZoom:15});o=new markerClusterer.MarkerClusterer({algorithm:n,markers:a,map:t,gridSize:50,maxZoom:15,renderer:new h}),google.maps.event.addListener(o,"click",(function(e){const a=e.markers,o=new google.maps.LatLngBounds;a.forEach((t=>o.extend(t.getPosition()))),t.fitBounds(o)})),v(e)}(e,i)}else wdtDisplayNotification("Error retrieving map data.","error",-1)},error:function(t,e,a){"abort"!==e&&(console.log(a),wdtDisplayNotification("Error retrieving map data.","error",-1))},complete:function(){t("#client-map-spinner").remove()}})})),t(document).on("wdt:clearMap","#wdt-portal-client-map",(function(t){o&&o.clearMarkers(),a&&a.setProps({layers:[]})})),t("#wdt-portal-client-map").length&&t("#wdt-portal-client-map").trigger("wdt:refreshMap"),t("#wdt-portal-client-map-footer-unfiltered-totals").length&&t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/report/client-map/",data:{display_in_service_provider_bounds:!0},beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t("#wdt-portal-client-map-footer-unfiltered-totals").hide(),t('#wdt-portal-client-map-footer [data-target="spinner"]').show()},success:function(e){if(e.success){t("#wdt-portal-client-map-footer-unfiltered-totals").show();let a=e.in_bounds,o=e.total;t('#wdt-portal-client-map-footer-unfiltered-totals [data-target="bounded-total"]').text(wdtNumberFormat(a)),t('#wdt-portal-client-map-footer-unfiltered-totals [data-target="total"]').text(wdtNumberFormat(o)),t('#wdt-portal-client-map-footer-unfiltered-totals [data-target="bounded-percent"]').text(wdtNumberFormat(a/o*100,1)+"%")}else wdtDisplayNotification("Error retrieving map data.","error",-1)},error:function(t,e,a){"abort"!==e&&(console.log(a),wdtDisplayNotification("Error retrieving map data.","error",-1))},complete:function(){t('#wdt-portal-client-map-footer [data-target="spinner"]').hide()}}),t(document).on("change",'[data-target="wdt-portal-client-map-filters-form"] [name]',(function(e){"service_coverage"!==t(this).attr("name")&&(t("#wdt-portal-client-map").trigger("wdt:refreshFilteredBoundCount"),w?b(w):t("#wdt-portal-client-map").trigger("wdt:refreshMap"))}))})),jQuery((function(t){"use strict";if(!t("#wdt-portal-client-report").length)return;let{generateReportCSV:e,formatDateRange:a,getDateRange:o}=reportBanner();t('#wdt-portal-client-report [data-target="wdt-resumes-simple-chart"]').on("wdt:trigger",(function(e){let{startDate:a,endDate:r}=o(),n=t.Event("wdt:update");n.wdt={},n.wdt.mode="clients",n.wdt.dateFrom=a,n.wdt.dateTo=r,t(this).trigger(n)})),t('#wdt-portal-client-report [data-target="wdt-logins-simple-chart"]').on("wdt:trigger",(function(e){let{startDate:a,endDate:r}=o(),n=t.Event("wdt:update");n.wdt={},n.wdt.mode="client_logins",n.wdt.dateFrom=a,n.wdt.dateTo=r,t(this).trigger(n)})),t('#wdt-portal-client-report [data-target="wdt-most-active-chart"]').on("wdt:trigger",(function(e){let a=t('[wdt-report-target="date-range"]').first().val().split("|"),o="-1"==a[0]?"":a[0],r="-1"==a[1]?"":a[1],n=(t(this).parents("#wdt-portal-client-report").first(),t.Event("wdt:update"));n.wdt={},n.wdt.mode="client_logins",n.wdt.dateFrom=o,n.wdt.dateTo=r,t(this).trigger(n)})),t('#wdt-portal-client-report [data-target="portal-analytics-clients-table"]').on("wdt:trigger",(function(e){let{startDate:a,endDate:r}=o(),n=t(this).parents("#wdt-portal-client-report").first(),i=t(n).find('[wdt-report-target="wdt-portal-client-report-activity-perpage"]').val(),s=t.Event("wdt:update");s.wdt={},s.wdt.role=["client"],s.wdt.dateFrom=a,s.wdt.dateTo=r,s.wdt.perPage=i,t(this).trigger(s)})),t('#wdt-portal-report-chart-client-container [data-report-action="toggle-column"]').on("change",(function(e){let a=t('#wdt-portal-report-chart-client-container [data-report-target="toggle-column"]'),o=[],r=[];a.each((function(e){t(this).is(":checked")?o.push(t(this).attr("value")):r.push(t(this).attr("value"))}));for(let e of o)t('#wdt-portal-report-chart-client-container .wdt-portal-table-body-element[data-column="'+e+'"]').removeClass("wdt-hidden-portal-element"),t('#wdt-portal-report-chart-client-container .wdt-portal-table-head-element[data-column="'+e+'"]').removeClass("wdt-hidden-portal-element");for(let e of r)t('#wdt-portal-report-chart-client-container .wdt-portal-table-body-element[data-column="'+e+'"]').addClass("wdt-hidden-portal-element"),t('#
1wdt-portal-report-chart-client-container .wdt-portal-table-head-element[data-column="'+e+'"]').addClass("wdt-hidden-portal-element")})),t('[wdt-report-target="date-range"]').length&&t('[wdt-report-target="date-range"]').each((function(e){let o=t(this).val();o=a(o),t('[data-target="wdt-portal-client-report-range"]').text(o)})),t('button[type="submit"].date-range-submit').on("click",(function(e){t('#wdt-portal-client-report [data-target="wdt-resumes-simple-chart"]').trigger("wdt:trigger"),t('#wdt-portal-client-report [data-target="wdt-logins-simple-chart"]').trigger("wdt:trigger"),t('#wdt-portal-client-report [data-target="wdt-most-active-chart"]').trigger("wdt:trigger"),t('#wdt-portal-client-report [data-target="portal-analytics-clients-table"]').trigger("wdt:trigger");let o=t('[wdt-report-target="date-range"]').val();o=a(o),t('[data-target="wdt-portal-client-report-range"]').text(o)})),t('#wdt-portal-client-report [wdt-report-target="wdt-portal-client-report-activity-perpage"]').on("change",(function(e){t('#wdt-portal-client-report [data-target="portal-analytics-clients-table"]').trigger("wdt:trigger")})),t('#wdt-portal-client-report [data-target="wdt-resumes-simple-chart"][data-loaded="true"]').length&&t('#wdt-portal-client-report [data-target="wdt-resumes-simple-chart"][data-loaded="true"]').each((function(e){t(this).trigger("wdt:trigger")})),t('#wdt-portal-client-report [data-target="wdt-resumes-simple-chart"]').on("wdt:loaded",(function(e){t(this).trigger("wdt:trigger")})),t('#wdt-portal-client-report [data-target="wdt-logins-simple-chart"][data-loaded="true"]').length&&t('#wdt-portal-client-report [data-target="wdt-logins-simple-chart"][data-loaded="true"]').each((function(e){t(this).trigger("wdt:trigger")})),t('#wdt-portal-client-report [data-target="wdt-logins-simple-chart"]').on("wdt:loaded",(function(e){t(this).trigger("wdt:trigger")})),t('#wdt-portal-client-report [data-target="wdt-most-active-chart"][data-loaded="true"]').length&&t('#wdt-portal-client-report [data-target="wdt-most-active-chart"][data-loaded="true"]').each((function(e){t(this).trigger("wdt:trigger")})),t('#wdt-portal-client-report [data-target="wdt-most-active-chart"]').on("wdt:loaded",(function(e){t(this).trigger("wdt:trigger")})),t('#wdt-portal-client-report [data-target="portal-analytics-clients-table"][data-loaded="true"]').length&&t('#wdt-portal-client-report [data-target="portal-analytics-clients-table"][data-loaded="true"]').each((function(e){t(this).trigger("wdt:trigger")})),t('#wdt-portal-client-report [data-target="portal-analytics-clients-table"]').on("wdt:loaded",(function(e){t(this).trigger("wdt:trigger")})),t("#wdt-report-banner-download").on("click",(async function(){t(this).addClass("pending");let a=t(this).attr("data-nonce"),{startDate:r,endDate:n}=o();try{let{status:o,data:i}=await e("generate_client_report_csv",r,n,a);if("success"!==o)return void wdtDisplayNotification("Could not export this report.","error",5e3);let s=`client-report-${r.replaceAll("-","_")}-${n.replaceAll("-","_")}.csv`,d=t(`<a id="download-csv" class="wdt-sr-only" href="data:text/plain;charset=utf-8,${encodeURIComponent(i)}" download="${s}">Download CSV</a>`);d.insertAfter("#wdt-report-banner-download")[0].click(),d.remove(),t(this).removeClass("pending")}catch(e){console.log(e),t(this).removeClass("pending")}}))})),jQuery((function(t){"use strict";if(!t("#wdt-portal-interactions-report").length)return;let{generateReportCSV:e,formatDateRange:a,getDateRange:o}=reportBanner();t('#wdt-portal-interactions-report [data-target="portal-interactions-table"]').on("wdt:trigger",(function(e){let{startDate:a,endDate:r}=o(),n=t('#wdt-portal-interactions-report [data-reports-target="mode-radio"]'),i="";n.each((function(e){t(this).is(":checked")&&(i=t(this).val())}));let s=t(this).parents("#wdt-portal-interactions-report").first(),d=t(s).find('[wdt-report-target="wdt-portal-interactions-report-interactions-perpage"]').val(),l=t.Event("wdt:update");l.wdt={},l.wdt.dateFrom=a,l.wdt.dateTo=r,l.wdt.mode=i,l.wdt.perPage=d,t(this).trigger(l)})),t('#wdt-portal-interactions-report [data-reports-target="mode-radio"]').on("change",(function(e){t('#wdt-portal-interactions-report [data-target="portal-interactions-table"]').trigger("wdt:trigger")})),t('#wdt-portal-interactions-report [wdt-report-target="wdt-portal-interactions-report-interactions-perpage"]').on("change",(function(e){t('#wdt-portal-interactions-report [data-target="portal-interactions-table"]').trigger("wdt:trigger")})),t('[wdt-report-target="date-range"]').length&&t('[wdt-report-target="date-range"]').each((function(e){let o=t(this).val();o=a(o),t('[data-target="wdt-portal-client-report-range"]').text(o)})),t('button[type="submit"].date-range-submit').on("click",(function(e){t('#wdt-portal-interactions-report [data-target="portal-interactions-table"]').trigger("wdt:trigger");let o=t('[wdt-report-target="date-range"]').val();o=a(o),t('[data-target="wdt-portal-client-report-range"]').text(o)})),t('#wdt-portal-interactions-report [data-target="portal-interactions-table"][data-loaded="true"]').length&&t('#wdt-portal-interactions-report [data-target="portal-interactions-table"][data-loaded="true"]').each((function(e){t(this).trigger("wdt:trigger")})),t('#wdt-portal-interactions-report [data-target="portal-interactions-table"]').on("wdt:loaded",(function(e){t(this).trigger("wdt:trigger")})),t("#wdt-report-banner-download").on("click",(async function(){t(this).addClass("pe
1nding");let a=t(this).attr("data-nonce"),{startDate:r,endDate:n}=o();try{let{status:o,data:i}=await e("generate_interactions_report_csv",r,n,a);if("success"!==o)return void wdtDisplayNotification("Could not export this report.","error",5e3);let s=`interactions-report-${r.replaceAll("-","_")}-${n.replaceAll("-","_")}.csv`,d=t(`<a id="download-csv" class="wdt-sr-only" href="data:text/plain;charset=utf-8,${encodeURIComponent(i)}" download="${s}">Download CSV</a>`);d.insertAfter("#wdt-report-banner-download")[0].click(),d.remove(),t(this).removeClass("pending")}catch(e){console.log(e),t(this).removeClass("pending")}}))})),jQuery((function(t){"use strict";if(!t("#wdt-portal-portal-report").length)return;let{generateReportCSV:e,formatDateRange:a,getDateRange:o}=reportBanner();t('#wdt-portal-portal-report [data-target="wdt-account-growth-breakdown"]').on("wdt:trigger",(function(e){let{startDate:a,endDate:r}=o(),n=t.Event("wdt:update");n.wdt={},n.wdt.dateFrom=a,n.wdt.dateTo=r,t(this).trigger(n)})),t('#wdt-portal-portal-report [data-target="wdt-logins-full-chart"]').on("wdt:trigger",(function(e){let{startDate:a,endDate:r}=o(),n=t.Event("wdt:update");n.wdt={},n.wdt.dateFrom=a,n.wdt.dateTo=r,t(this).trigger(n)})),t('#wdt-portal-portal-report [data-target="portal-activity-table"]').on("wdt:trigger",(function(e){let{startDate:a,endDate:r}=o(),n=t.Event("wdt:update");n.wdt={},n.wdt.dateFrom=a,n.wdt.dateTo=r,t(this).trigger(n)})),t('[wdt-report-target="date-range"]').length&&t('[wdt-report-target="date-range"]').each((function(e){let o=t(this).val();o=a(o),t('[data-target="wdt-portal-client-report-range"]').text(o)})),t('button[type="submit"].date-range-submit').on("click",(function(e){t('#wdt-portal-portal-report [data-target="wdt-account-growth-breakdown"]').trigger("wdt:trigger"),t('#wdt-portal-portal-report [data-target="wdt-logins-full-chart"]').trigger("wdt:trigger"),t('#wdt-portal-portal-report [data-target="portal-activity-table"]').trigger("wdt:trigger");let o=t('[wdt-report-target="date-range"]').val();o=a(o),t('[data-target="wdt-portal-client-report-range"]').text(o)})),t('#wdt-portal-portal-report [data-target="wdt-accounts-snapshot-chart"][data-loaded="true"]').length&&t('#wdt-portal-portal-report [data-target="wdt-accounts-snapshot-chart"][data-loaded="true"]').each((function(e){t(this).trigger("wdt:update")})),t('#wdt-portal-portal-report [data-target="wdt-accounts-snapshot-chart"]').on("wdt:loaded",(function(e){t(this).trigger("wdt:update")})),t('#wdt-portal-portal-report [data-target="wdt-account-growth-breakdown"][data-loaded="true"]').length&&t('#wdt-portal-portal-report [data-target="wdt-account-growth-breakdown"][data-loaded="true"]').each((function(e){t(this).trigger("wdt:trigger")})),t('#wdt-portal-portal-report [data-target="wdt-account-growth-breakdown"]').on("wdt:loaded",(function(e){t(this).trigger("wdt:trigger")})),t('#wdt-portal-portal-report [data-target="wdt-logins-full-chart"][data-loaded="true"]').length&&t('#wdt-portal-portal-report [data-target="wdt-logins-full-chart"][data-loaded="true"]').each((function(e){t(this).trigger("wdt:trigger")})),t('#wdt-portal-portal-report [data-target="wdt-logins-full-chart"]').on("wdt:loaded",(function(e){t(this).trigger("wdt:trigger")})),t('#wdt-portal-portal-report [data-target="portal-activity-table"][data-loaded="true"]').length&&t('#wdt-portal-portal-report [data-target="portal-activity-table"][data-loaded="true"]').each((function(e){t(this).trigger("wdt:trigger")})),t('#wdt-portal-portal-report [data-target="portal-activity-table"]').on("wdt:loaded",(function(e){t(this).trigger("wdt:trigger")})),t("#wdt-report-banner-download").on("click",(async function(){t(this).addClass("pending");let a=t(this).attr("data-nonce"),{startDate:r,endDate:n}=o();try{let{status:o,data:i}=await e("generate_portal_report_csv",r,n,a);if("success"!==o)return void wdtDisplayNotification("Could not export this report.","error",5e3);let s=`portal-report-${r.replaceAll("-","_")}-${n.replaceAll("-","_")}.csv`,d=t(`<a id="download-csv" class="wdt-sr-only" href="data:text/plain;charset=utf-8,${encodeURIComponent(i)}" download="${s}">Download CSV</a>`);d.insertAfter("#wdt-report-banner-download")[0].click(),d.remove(),t(this).removeClass("pe
1nding")}catch(e){console.log(e),t(this).removeClass("pending")}}))})),jQuery((function(t){"use strict";if(!t("#wdt-portal-resumes-report").length)return;let{generateReportCSV:e,formatDateRange:a,getDateRange:o}=reportBanner();t('#wdt-portal-resumes-report [data-target="wdt-resumes-growth-breakdown"]').on("wdt:trigger",(function(e){let{startDate:a,endDate:r}=o(),n=t.Event("wdt:update");n.wdt={},n.wdt.dateFrom=a,n.wdt.dateTo=r,t(this).trigger(n)})),t('#wdt-portal-resumes-report [data-target="wdt-resumes-simple-chart"]').on("wdt:trigger",(function(e){let{startDate:a,endDate:r}=o(),n=t.Event("wdt:update");n.wdt={},n.wdt.mode="all",n.wdt.dateFrom=a,n.wdt.dateTo=r,t(this).trigger(n)})),t('[wdt-report-target="date-range"]').length&&t('[wdt-report-target="date-range"]').each((function(e){let o=t(this).val();o=a(o),t('[data-target="wdt-portal-client-report-range"]').text(o)})),t('button[type="submit"].date-range-submit').on("click",(function(e){t('#wdt-portal-resumes-report [data-target="wdt-resumes-growth-breakdown"]').trigger("wdt:trigger"),t('#wdt-portal-resumes-report [data-target="wdt-resumes-simple-chart"]').trigger("wdt:trigger");let o=t('[wdt-report-target="date-range"]').val();o=a(o),t('[data-target="wdt-portal-client-report-range"]').text(o)})),t('#wdt-portal-resumes-report [data-target="wdt-resumes-snapshot-chart"][data-loaded="true"]').length&&t('#wdt-portal-resumes-report [data-target="wdt-resumes-snapshot-chart"][data-loaded="true"]').each((function(e){t(this).trigger("wdt:update")})),t('#wdt-portal-resumes-report [data-target="wdt-resumes-snapshot-chart"]').on("wdt:loaded",(function(e){t(this).trigger("wdt:update")})),t('#wdt-portal-resumes-report [data-target="wdt-resumes-growth-breakdown"][data-loaded="true"]').length&&t('#wdt-portal-resumes-report [data-target="wdt-resumes-growth-breakdown"][data-loaded="true"]').each((function(e){t(this).trigger("wdt:trigger")})),t('#wdt-portal-resumes-report [data-target="wdt-resumes-growth-breakdown"]').on("wdt:loaded",(function(e){t(this).trigger("wdt:trigger")})),t('#wdt-portal-resumes-report [data-target="wdt-resumes-simple-chart"][data-loaded="true"]').length&&t('#wdt-portal-resumes-report [data-target="wdt-resumes-simple-chart"][data-loaded="true"]').each((function(e){t(this).trigger("wdt:trigger")})),t('#wdt-portal-resumes-report [data-target="wdt-resumes-simple-chart"]').on("wdt:loaded",(function(e){t(this).trigger("wdt:trigger")})),t("#wdt-report-banner-download").on("click",(async function(){t(this).addClass("pending");let a=t(this).attr("data-nonce"),{startDate:r,endDate:n}=o();try{let{status:o,data:i}=await e("generate_resumes_report_csv",r,n,a);if("success"!==o)return void wdtDisplayNotification("Could not export this report.","error",5e3);let s=`resumes-report-${r.replaceAll("-","_")}-${n.replaceAll("-","_")}.csv`,d=t(`<a id="download-csv" class="wdt-sr-only" href="data:text/plain;charset=utf-8,${encodeURIComponent(i)}" download="${s}">Download CSV</a>`);d.insertAfter("#wdt-report-banner-download")[0].click(),d.remove(),t(this).removeClass("pending")}catch(e){console.log(e),t(this).removeClass("pending")}}))})),jQuery((function(t){"use strict";if(!t("#wdt-portal-staff-report").length)return;let{generateReportCSV:e,formatDateRange:a,getDateRange:o}=reportBanner();t('#wdt-portal-staff-report [data-target="wdt-resumes-simple-chart"]').on("wdt:trigger",(function(e){let{startDate:a,endDate:r}=o(),n=t.Event("wdt:update");n.wdt={},n.wdt.mode="staff",n.wdt.dateFrom=a,n.wdt.dateTo=r,t(this).trigger(n)})),t('#wdt-portal-staff-report [data-target="wdt-logins-simple-chart"]').on("wdt:trigger",(function(e){let{startDate:a,endDate:r}=o(),n=t.Event("wdt:update");n.wdt={},n.wdt.mode="staff_logins",n.wdt.dateFrom=a,n.wdt.dateTo=r,t(this).trigger(n)})),t('#wdt-portal-staff-report [data-target="wdt-most-active-chart"]').on("wdt:trigger",(function(e){let{startDate:a,endDate:r}=o(),n=t.Event("wdt:update");n.wdt={},n.wdt.mode="staff_logins",n.wdt.dateFrom=a,n.wdt.dateTo=r,t(this).trigger(n)})),t('#wdt-portal-staff-report [data-target="portal-analytics-clients-table"]').on("wdt:trigger",(function(e){let{startDate:a,endDate:r}=o(),n=t(this).parents("#wdt-portal-staff-report").first(),i=t(n).find('[wdt-report-target="wdt-portal-staff-report-activity-perpage"]').val(),s=t.Event("wdt:update");s.wdt={},s.wdt.role="staff",s.wdt.dateFrom=a,s.wdt.dateTo=r,s.wdt.perPage=i,t(this).trigger(s)})),t('#wdt-portal-report-chart-staff-container [data-report-action="toggle-column"]').on("change",(function(e){let a=t('#wdt-portal-report-chart-staff-container [data-report-target="toggle-column"]'),o=[],r=[];a.each((function(e){t(this).is(":checked")?o.push(t(this).attr("value")):r.push(t(this).attr("value"))}));for(let e of o)t('#wdt-portal-report-chart-staff-container .wdt-portal-table-body-element[data-column="'+e+'"]').removeClass("wdt-hidden-portal-element"),t('#
1wdt-portal-report-chart-staff-container .wdt-portal-table-head-element[data-column="'+e+'"]').removeClass("wdt-hidden-portal-element");for(let e of r)t('#wdt-portal-report-chart-staff-container .wdt-portal-table-body-element[data-column="'+e+'"]').addClass("wdt-hidden-portal-element"),t('#wdt-portal-report-chart-staff-container .wdt-portal-table-head-element[data-column="'+e+'"]').addClass("wdt-hidden-portal-element")})),t('[wdt-report-target="date-range"]').length&&t('[wdt-report-target="date-range"]').each((function(e){let o=t(this).val();o=a(o),t('[data-target="wdt-portal-client-report-range"]').text(o)})),t('button[type="submit"].date-range-submit').on("click",(function(e){t('#wdt-portal-staff-report [data-target="wdt-resumes-simple-chart"]').trigger("wdt:trigger"),t('#wdt-portal-staff-report [data-target="wdt-logins-simple-chart"]').trigger("wdt:trigger"),t('#wdt-portal-staff-report [data-target="wdt-most-active-chart"]').trigger("wdt:trigger"),t('#wdt-portal-staff-report [data-target="portal-analytics-clients-table"]').trigger("wdt:trigger");let o=t('[wdt-report-target="date-range"]').val();o=a(o),t('[data-target="wdt-portal-client-report-range"]').text(o)})),t('#wdt-portal-staff-report [wdt-report-target="wdt-portal-staff-report-activity-perpage"]').on("change",(function(e){t('#wdt-portal-staff-report [data-target="portal-analytics-clients-table"]').trigger("wdt:trigger")})),t('#wdt-portal-staff-report [data-target="wdt-resumes-simple-chart"][data-loaded="true"]').length&&t('#wdt-portal-staff-report [data-target="wdt-resumes-simple-chart"][data-loaded="true"]').each((function(e){t(this).trigger("wdt:trigger")})),t('#wdt-portal-staff-report [data-target="wdt-resumes-simple-chart"]').on("wdt:loaded",(function(e){t(this).trigger("wdt:trigger")})),t('#wdt-portal-staff-report [data-target="wdt-logins-simple-chart"][data-loaded="true"]').length&&t('#wdt-portal-staff-report [data-target="wdt-logins-simple-chart"][data-loaded="true"]').each((function(e){t(this).trigger("wdt:trigger")})),t('#wdt-portal-staff-report [data-target="wdt-logins-simple-chart"]').on("wdt:loaded",(function(e){t(this).trigger("wdt:trigger")})),t('#wdt-portal-staff-report [data-target="wdt-most-active-chart"][data-loaded="true"]').length&&t('#wdt-portal-staff-report [data-target="wdt-most-active-chart"][data-loaded="true"]').each((function(e){t(this).trigger("wdt:trigger")})),t('#wdt-portal-staff-report [data-target="wdt-most-active-chart"]').on("wdt:loaded",(function(e){t(this).trigger("wdt:trigger")})),t('#wdt-portal-staff-report [data-target="portal-analytics-clients-table"][data-loaded="true"]').length&&t('#wdt-portal-staff-report [data-target="portal-analytics-clients-table"][data-loaded="true"]').each((function(e){t(this).trigger("wdt:trigger")})),t('#wdt-portal-staff-report [data-target="portal-analytics-clients-table"]').on("wdt:loaded",(function(e){t(this).trigger("wdt:trigger")})),t("#wdt-report-banner-download").on("click",(async function(){t(this).addClass("pending");let a=t(this).attr("data-nonce"),{startDate:r,endDate:n}=o();try{let{status:o,data:i}=await e("generate_staff_report_csv",r,n,a);if("success"!==o)return void wdtDisplayNotification("Could not export this report.","error",5e3);let s=`staff-report-${r.replaceAll("-","_")}-${n.replaceAll("-","_")}.csv`,d=t(`<a id="download-csv" class="wdt-sr-only" href="data:text/plain;charset=utf-8,${encodeURIComponent(i)}" download="${s}">Download CSV</a>`);d.insertAfter("#wdt-report-banner-download")[0].click(),d.remove(),t(this).removeClass("pending")}catch(e){console.log(e),t(this).removeClass("pending")}}))})),jQuery((function(t){"use strict";t(document).on("submit",'form[data-target="wdt-accept-transfer-request-form"]',(function(e){e.preventDefault();let a=t(this).serializeArray();t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/transfer-request/approve/",data:a,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){let e="";e+='<p style="text-align: left; margin-bottom: 30px;" class="wdt-portal-modal-body-text">This transfer request has been approved. An email notification has been sent to the client, and the caseworker who requested the transfer.</p>',e+='<button style="margin-left: 0; margin-bottom: 30px;" class="wdt-portal-modal-btn" data-action="wdt-remove-content-modal">Close</button>',e+='<p style="text-align: left; margin-bottom: 30px;" class="wdt-portal-modal-body-text"><i>Returning to the Client Profile in 10 seconds...</i></p>',wdtRenderContentModal({title:"Transfer Request Approved",content:'<p style="text-align: left; margin-bottom: 30px;" class="wdt-portal-modal-body-text">This transfer request has been approved. An email notification has been sent to the client, and the caseworker who requested the transfer.</p><button style="margin-left: 0; margin-bottom: 30px;" class="wdt-portal-modal-btn" data-action="wdt-remove-content-modal">Close</button><p style="text-align: left; margin-bottom: 30px;" class="wdt-portal-modal-body-text"><i>Returning to the Client Profile in 10 seconds...</i></p>',className:"wdt-portal-modal-alt",id:"wdt-transfer-request-resolved-modal",customDestroy:!0,closeable:!1,modalType:"success"}),setTimeout((function(){location.reload()}),1e4)},error:function(t){console.log(t),wdtRemoveContentModal(),wdtDisplayNotification("Error accepting transfer request.","error",-1)}})})),t(document).on("submit",'form[data-target="wdt-decline-transfer-request-form"]',(function(e){e.preventDefault();let a=t(this).serializeArray();t.ajax({type:"POST",url:WDT.rest_url+"wedatatools/v1/portal/transfer-request/decline/",data:a,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){let e="";e+='<p style="text-align: left; margin-bottom: 30px;" class="wdt-portal-modal-body-text">This transfer request has been declined. An email notification has been sent to the client, and the caseworker who requested the transfer.</p>',e+='<button style="margin-left: 0; margin-bottom: 30px;" class="wdt-portal-modal-btn" data-action="wdt-remove-content-modal">Close</button>',e+='<p style="text-align: left; margin-bottom: 30px;" class="wdt-portal-modal-body-text"><i>Returning to the Client Profile in 10 seconds...</i></p>',wdtRenderContentModal({title:"Transfer Request Declined",content:'<p style="text-align: left; margin-bottom: 30px;" class="wdt-portal-modal-body-text">This transfer request has been declined. An email notification has been sent to the client, and the caseworker who requested the transfer.</p><button style="margin-left: 0; margin-bottom: 30px;" class="wdt-portal-modal-btn" data-action="wdt-remove-content-modal">Close</button><p style="text-align: left; margin-bottom: 30px;" class="wdt-portal-modal-body-text"><i>Returning to the Client Profile in 10 seconds...</i></p>',className:"wdt-portal-modal-alt",id:"wdt-transfer-request-resolved-modal",customDestroy:!0,closeable:!1,modalType:"failure"}),setTimeout((function(){location.reload()}),1e4)},error:function(t){console.log(t),wdtRemoveContentModal(),wdtDisplayNotification("Error declining transfer request.","error",-1)}})})),t(document).on("wdt:customDestroyContentModal","#wdt-transfer-request-resolved-modal",(function(t){location.reload()}))})),jQuery((function(t){"use strict";t(document).on("wdt:ajaxresultfilter",'[data-target="wdt-create-transfer-request-form"] [name="preferredServiceProvider"]',(function(e){let a=e._option;t(this).attr("data-current-service-provider")==t(a).attr("data-value")&&t(a).attr("disabled",!0)})),t(document).on("change",'form[data-target="wdt-create-transfer-request-form"] [name="transferReason"]',(function(e){let a=t(this).parents('[data-target="wdt-create-transfer-request-form"]').first(),o=t(a).find('[name="otherTransferReason"]'),r=t(o).parents('[data-rf-target="wdt-material-form-text-input-label"]').first();"other"===t(this).val()?(t(r).show(),t(o).prop("required",!0)):(t(r).hide(),t(o).prop("required",!1))})),t(document).on("submit",'form[data-target="wdt-create-transfer-request-form"]',(function(e){e.preventDefault();let a=this,o=t(a).attr("data-client-name"),r=t(a).attr("data-ssm-name"),n=t(a).serializeArray();jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/transfer-request",data:n,beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(a).find('button[type="submit"]').prop("disabled",!0)},success:function(t){let e="";e+='<p style="text-align: left; margin-bottom: 30px;" class="wdt-portal-modal-body-text">Your transfer request for <strong>'+o+"</strong> has been sent to <strong>"+r+"</strong> for review. You will receive an email notification once the request has been processed.</p>",e+='<button style="margin-left: 0; margin-bottom: 30px;" class="wdt-portal-modal-btn" data-action="wdt-remove-content-modal">Close</button>',e+='<p style="text-align: left; margin-bottom: 30px;" class="wdt-portal-modal-body-text"><i>Returning to the Client Profile in 10 seconds...</i></p>',wdtRenderContentModal({title:"Transfer Request Submitted",content:e,className:"wdt-portal-modal-alt",id:"wdt-transfer-request-created-modal",customDestroy:!0,closeable:!1,modalType:"success"}),setTimeout((function(){location.reload()}),1e4)},error:function(e){console.log(e),wdtDisplayNotification("Unable to submit transfer request.","error",-1),t(a).find('button[type="submit"]').prop("disabled",!1)},complete:function(){}})})),t(document).on("wdt:customDestroyContentModal","#wdt-transfer-request-created-modal",(function(t){location.reload()}))})),jQuery(document).ready((function(t){"use strict";t('#wdt-register-form [name="wdt_user_email_address"]').on("change",(function(e){let a=t(this).val(),o=t(this).attr("data-nonce"),r=this;jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/email/exists/",data:{email:a,nonce:o},beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(r)[0].setCustomValidity("")},success:function(e){e.success&&t(r)[0].setCustomValidity("Email address is already in use.")},error:function(t){wdtDisplayNotification("Encountered issue verifying email address.","error",-1)},complete:function(){}})})),t('#wdt-register-form [name="wdt_user_password"]').on("change",(function(e){let a=t('#wdt-register-form [name="wdt_user_password2"]');t(this).trigger("wdt:checkPWValidity"),t(a).trigger("wdt:checkPWValidity")})),t('#wdt-register-form [name="wdt_user_password2"]').on("change",(function(e){let a=t('#wdt-register-form [name="wdt_user_password"]');t(this).trigger("wdt:checkPWValidity"),t(a).trigger("wdt:checkPWValidity")})),t('#wdt-register-form [name="wdt_user_password"]').on("wdt:checkPWValidity",(function(e){let a=t('#wdt-register-form [name="wdt_user_password2"]');t(this)[0].setCustomValidity("");let o=t(this).val();o.includes("/")||o.includes("\\")?t(this)[0].setCustomValidity("Password cannot contain slashes."):o.length<8?t(this)[0].setCustomValidity("Password must be a minimum of 8 characters."):o.match("^(?=.*?[A-Za-z])(?=.*\\d)")?o===t(a).val()||t(this)[0].setCustomValidity("Passwords do not match."):t(this)[0].setCustomValidity("Password must contain at least 1 letter and 1 number.")})),t("#wdt-register-form").on("submit",(function(e){let a=t("#wdt-register-form-recaptcha").data("captcha-id");
1var o=grecaptcha.getResponse(a);if(o)jQuery("#wdt-register-form-recaptcha").val(o);else{let t="Please complete the RECAPTCHA";e.preventDefault(),alert(t)}})),t("#wdt-register-form #wdt-register-form-service-provider-section #wdt-register-form-service-provider-nudge").on("wdt:show",(function(e){t(this).removeClass("wdt-display-none"),t(this).prop("required",!0),t(this).find('[name="wdt_user_wants_counselling"]').prop("required",!0),t(this).find('[name="wdt_user_wants_counselling"]:checked').trigger("change")})),t("#wdt-register-form #wdt-register-form-service-provider-section #wdt-register-form-service-provider-nudge").on("wdt:hide",(function(e){t(this).addClass("wdt-display-none"),t(this).find('[name="wdt_user_wants_counselling"]').prop("required",!1),t(this).find('[name="wdt_user_wants_counselling"]:checked').trigger("change")})),t("#wdt-register-form #wdt-register-form-service-provider-section #wdt-register-form-service-providers-container").on("wdt:show",(function(e){t(this).removeClass("wdt-display-none"),t(this).find('[name="wdt_service_provider_slug"]').prop("required",!0),t(this).find('[name="wdt_service_provider_slug"]').trigger("change")})),t("#wdt-register-form #wdt-register-form-service-provider-section #wdt-register-form-service-providers-container").on("wdt:hide",(function(e){let a=t(this).parents("#wdt-register-form-service-provider-section").first();t(this).addClass("wdt-display-none"),t(this).find('[name="wdt_service_provider_slug"]').prop("required",!1),t(a).find('[data-target="service-provider-terms"]').addClass("wdt-display-none")})),t('#wdt-register-form #wdt-register-form-service-provider-section [name="wdt_user_receiving_counselling"]').on("change",(function(e){let a=t(this).parents("#wdt-register-form-service-provider-section").first(),o=t(this).val();"yes"===o?(t(a).find("#wdt-register-form-service-provider-nudge").trigger("wdt:hide"),t(a).find("#wdt-register-form-service-providers-container").trigger("wdt:show")):"no"===o&&(t(a).find("#wdt-register-form-service-providers-container").trigger("wdt:hide"),t(a).find("#wdt-register-form-service-provider-nudge").trigger("wdt:show"))})),t('#wdt-register-form #wdt-register-form-service-provider-section [name="wdt_user_wants_counselling"]').on("change",(function(e){let a=t(this).parents("#wdt-register-form-service-provider-section").first(),o=t(this).val();"yes"===o?(t(a).find('[name="wdt_service_provider_slug"]').trigger("wdt:randomSelect"),t(a).find("#wdt-register-form-service-providers-container").trigger("wdt:show")):"no"===o&&t(a).find("#wdt-register-form-service-providers-container").trigger("wdt:hide")})),t('#wdt-register-form #wdt-register-form-service-provider-section [name="wdt_service_provider_slug"]').on("change",(function(e){let a=t(this).parents("#wdt-register-form-service-provider-section").first(),o=t(this).val();t(a).find('[data-target="service-provider-terms"]').addClass("wdt-display-none"),t(a).find('[data-target="service-provider-terms"][data-service-provider="'+o+'"]').removeClass("wdt-display-none")})),t("#wdt-register-form").each((function(e){t(this).find("#wdt-register-form-service-providers-container").trigger("wdt:hide"),t(this).find("#wdt-register-form-service-provider-nudge").trigger("wdt:hide"),t(this).find('[name="wdt_user_receiving_counselling"]:checked').trigger("change")}))})),jQuery((function(t){"use strict";t(document).on("wdt:toggle-checkbox-badge",'[data-rf-target="wdt-material-form-checkbox"]',(function(e,a){if(!(a=a||{}).key)return;let o=t(this),r=(o.is("label")?o:o.closest("label")).find('[data-checkbox-badge="'+a.key+'"]');0!==r.length&&r.prop("hidden",!0!==a.show)}))})),jQuery(document).ready((function(t){"use strict";t(document).on("change",'[data-archive-page] [data-target="wdt-portal-job-archive-table"] thead [name="select"]',(function(e){let a=t(this).parents("[data-archive-page]").first();t(this).prop("checked")?t(a).find('[data-target="wdt-portal-job-archive-table"] tbody [name="select"]').each((function(e){t(this).prop("checked",!0)})):t(a).find('[data-target="wdt-portal-job-archive-table"] tbody [name="select"]').each((function(e){t(this).prop("checked",!1)})),t(a).find('[data-target="wdt-portal-job-archive-table"] tbody [name="select"]').first().trigger("change")})),t(document).on("change",'#wdt-portal-job-archive [data-target="wdt-portal-job-archive-table"] tbody [name="select"]',(function(e){let a=t(this).parents("[data-archive-page]").first();t(a).find('[data-target="wdt-portal-dropdown-menu-toggle"]').trigger("wdt:refresh")})),t(document).on("wdt:refresh",'[data-archive-page] [data-action="wdt-portal-dropdown-menu-toggle"]',(function(e){let a=t(this).parents("[data-archive-page]").first(),o=t(a).find('[data-archive-table] tbody [name="select"]'),r=t(o).map((function(){if(this.checked)return t(this).val()})).get();r.length?t(this).prop("disabled",!1):t(this).prop("disabled",!0),o.length>0&&r.length===o.length?t(a).find('[data-target="wdt-portal-job-archive-table"] thead [name="select"]').prop("checked",!0):t(a).find('[data-target="wdt-portal-job-archive-table"] thead [name="select"]').prop("checked",!1)}))})),jQuery(document).ready((function(t){"use strict";t(document).on("change",'[data-target="wdt-portal-cams-report-filters-form"] [data-dimension-field="true"]',(function(e){const a=t('[data-target="wdt-portal-cams-report-filters-form"] [data-dimension-field="true"]'),o=t(this),r=a.not(o);let n=o.parents('[data-target="wdt-form-select-combobox-container"]').find('[role="listbox"] [role="option"]'),i=[];if(t(n).each((function(e){i.push(t(this).attr("value"))})),o.val()===r.val()){wdtDisplayNotification("The primary and secondary views cannot be the same.","info",5e3);let e=(i.indexOf(o.val())+1)%i.length,a=t.Event("wdt:select");a.value=i[e],r.trigger(a)}})),t(document).on("click",'[data-target="wdt-portal-cams-report-filters-form"] section [data-target="wdt-portal-cams-report-filters-form-accordion-header"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-cams-report-filters-form"]'),o=t(this).parents("section"),r=t(o).find('[data-target="wdt-portal-cams-report-filters-form-collapsable-content"]');"inactive"===t(r).attr("data-state")?t(r).trigger("wdt:expand"):t(r).trigger("wdt:collapse"),0===t(a).find('section [data-target="wdt-portal-cams-report-filters-form-collapsable-content"]:not([data-state="inactive"])').length?t(a).find('[data-target="wdt-portal-cams-report-filters-form-collapse-expand-button"]').trigger("wdt:setExpand"):t(a).find('[data-target="wdt-portal-cams-report-filters-form-collapse-expand-button"]').trigger("wdt:setCollapse")})),t(document).on("wdt:collapse",'[data-target="wdt-portal-cams-report-filters-form"] section [data-target="wdt-portal-cams-report-filters-form-collapsable-content"]',(function(e){let a=t(this).parents("section"),o=t(a).find('[data-target="wdt-portal-cams-report-filters-form-accordion-header"]');t(o).attr("data-state","inactive"),t(this).attr("data-state","inactive"),t(this).slideUp("fast")})),t(document).on("wdt:expand",'[data-target="wdt-portal-cams-report-filters-form"] section [data-target="wdt-portal-cams-report-filters-form-collapsable-content"]',(function(e){let a=t(this).parents("section"),o=t(a).find('[data-target="wdt-portal-cams-report-filters-form-accordion-header"]');t(o).attr("data-state","active"),t(this).attr("data-state","active"),t(this).slideDown("fast")})),t(document).on("wdt:setCollapse",'[data-target="wdt-portal-cams-report-filters-form"] [data-target="wdt-portal-cams-report-filters-form-collapse-expand-button"]',(function(e){t(this).attr("data-action","w
1dt-portal-cams-report-filters-form-collapse-all"),t(this).text("Collapse All")})),t(document).on("wdt:setExpand",'[data-target="wdt-portal-cams-report-filters-form"] [data-target="wdt-portal-cams-report-filters-form-collapse-expand-button"]',(function(e){t(this).attr("data-action","wdt-portal-cams-report-filters-form-expand-all"),t(this).text("Expand All")})),t(document).on("click",'[data-target="wdt-portal-cams-report-filters-form"] [data-action="wdt-portal-cams-report-filters-form-collapse-all"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-cams-report-filters-form"]');t(a).find('[data-target="wdt-portal-cams-report-filters-form-collapsable-content"]').each((function(e){t(this).trigger("wdt:collapse")})),t(a).find('[data-target="wdt-portal-cams-report-filters-form-collapse-expand-button"]').trigger("wdt:setExpand")})),t(document).on("click",'[data-target="wdt-portal-cams-report-filters-form"] [data-action="wdt-portal-cams-report-filters-form-expand-all"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-cams-report-filters-form"]');t(a).find('[data-target="wdt-portal-cams-report-filters-form-collapsable-content"]').each((function(e){t(this).trigger("wdt:expand")})),t(a).find('[data-target="wdt-portal-cams-report-filters-form-collapse-expand-button"]').trigger("wdt:setCollapse")}))})),jQuery((t=>{"use strict";function e(t){return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(t)}t(document).on("submit",'#wdt-portal-data-extracts form[data-target="wdt-cams-report-date-form"]',(function(e){e.preventDefault();let a=t(this).parents("#wdt-portal-data-extracts").first();t(a).find('[data-target="wdt-portal-data-extracts-downloads-container"]').trigger("wdt:updateDateRange")})),t(document).on("wdt:updateDateRange",'#wdt-portal-data-extracts [data-target="wdt-portal-data-extracts-downloads-container"]',(function(a){let o=t(this).parents("#wdt-portal-data-extracts").first(),r=t(o).find('[wdt-report-target="date-range"]').val().split("|");t(this).attr("data-start-date",r[0]),t(this).attr("data-end-date",r[1]),t(o).find('[data-target="date-range-label"]').text(e(new Date(r[0]+" 12:00:00"))+" - "+e(new Date(r[1]+" 12:00:00")))})),t(document).on("click",'#wdt-portal-data-extracts [data-target="wdt-portal-data-extracts-downloads-item"] [data-action="download-portal-extract"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-data-extracts-downloads-item"]').first();t(a).find("button").hide(),t(a).find("button").after('<div data-target="spinner" class="wdt-spinner wdt-spinner-small"></div>');let o=t('#wdt-portal-data-extracts [wdt-report-target="date-range"]').val().split("|"),r=t.Event("wdt:portalExtract");r._startDate=o[0],r._endDate=o[1],t(this).trigger(r)})),t(document).on("wdt:portalExtract",'#wdt-portal-data-extracts [data-target="wdt-portal-data-extracts-downloads-item"] [data-action="download-portal-extract"][data-rest-url]',(function(e){t(this).addClass("pending");let a={startDate:e._startDate,endDate:e._endDate},o=this;t.ajax({type:"GET",url:t(this).attr("data-rest-url"),data:a,xhrFields:{responseType:"blob"},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t,e,a){let o="report.csv";const r=a.getResponseHeader("Content-Disposition");if(r){const t=r.match(/filename\*=(?:UTF-8'')?([^;]+)/i),e=r.match(/filename="?([^";]+)"?/i),a=t?t[1]:e?e[1]:null;if(a)try{o=decodeURIComponent(a.trim())}catch{o=a.trim()}}const n=window.URL.createObjectURL(t),i=document.createElement("a");i.href=n,i.download=o,document.body.appendChild(i),i.click(),i.remove(),window.URL.revokeObjectURL(n)},error:function(t,e,a){wdtDisplayNotification("Failed to download: "+(a||e),"error",-1)},complete:function(){t(o).trigger("wdt:extractComplete")}})})),t(document).on("wdt:extractComplete",'#wdt-portal-data-extracts [data-target="wdt-portal-data-extracts-downloads-item"] [data-action="download-portal-extract"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-data-extracts-downloads-item"]').first();t(a).find("button").show(),t(a).find('[data-target="spinner"]').remove()})),t('#wdt-portal-data-extracts [data-target="wdt-portal-data-extracts-downloads-container"]').trigger("wdt:updateDateRange")})),jQuery(document).ready((function(t){"use strict";t(document).on("wdt:preSubmit",'form[data-target="wdt-portal-my-clients-assign-staff-form"]',(function(e){if(!t(this).find('[data-target="toggle-intake-tasks"]').is(":checked"))return;let a=t(this).data("preSubmitPromises")?t(this).data("preSubmitPromises"):[],o=[],r=t(this).find('[name="clients[]"]');t(r).each((function(e){o.push(t(this).val())})),o=[...new Set(o)];for(let e of o){let o=t(this).find('[data-target="task-form-container"] [data-target="task-form-inner"]');t(o).each((function(o){let r=t(this).find('input[name="task-client"]');t(r).length||(t(this).append('<input type="hidden" name="task-client"/>'),r=t(this).find('input[name="task-client"]')),t(r).val(e),t(this).find('[name="task-assigned"]').prop("disabled",!1),t(this).find('[name="task-service-provider"]').prop("disabled",!1),t(this).trigger("wdt:submit");let n=t(this).data("submission");
1t(this).data("submission",null),n&&a.push(Promise.resolve(n))}))}t(this).remove('[data-target="task-form-container"]'),t(this).data("preSubmitPromises",a)})),t(document).on("change",'[data-target="wdt-portal-my-clients-assign-staff-form"] [data-target="toggle-intake-tasks"]',(function(e){let a=t(this).parents('[data-target="wdt-portal-my-clients-assign-staff-form"]').first();t(this).is(":checked")?t(a).find('[data-target="intake-task-forms"]').show():t(a).find('[data-target="intake-task-forms"]').hide()})),t(document).on("change",'[data-target="wdt-portal-my-clients-assign-staff-form"] [name="staff[]"]',(function(e){var a=t(this).find("option:selected");a=a.map((function(){return{label:t(this).text(),value:t(this).val()}})).get();let o=t(this).parents('[data-target="wdt-portal-my-clients-assign-staff-form"]').first(),r=t(o).find('#wdt-portal-my-clients-assign-staff-form-intake-tasks-section [data-target="task-form-container"]');t(r).each((function(e){let o=t(this).find('[name="task-assigned"]'),r=t(o).parents('[data-wdt-material-form-target="typeahead-select-container"]').first();if(t(r).trigger("wdt-clearall"),a.length)for(let e of a){let a=t.Event("wdt:select");a.label=e.label,a.value=e.value,t(r).trigger(a),t(r).trigger("change")}else{let e=t.Event("wdt:select");e.label="Unassigned",e.value="-1",t(r).trigger(e),t(r).trigger("change")}}))})),t(document).on("wdt:initializeAssignStaff","#wdt-portal-my-clients-assign-staff-form",(function(e){let a=e._serviceProvider;t(this).find('[data-task-form-target="service-provider-select"] select').data("wdt:suppressEvents",!0);let o=t(this).find('[data-target="task-form-container"] [data-task-form-target="service-provider-select"]');t(o).each((function(e){let o=t.Event("wdt:select");o.label="Client Service Provider",o.value=a,t(this).trigger(o)})),t(this).find('[data-task-form-target="service-provider-select"] select').data("wdt:suppressEvents",!1)}))})),jQuery(document).ready((function(t){"use strict";function e(t){let e=new FormData(t),a=[];for(let[t,o]of e.entries())(""===o||o instanceof File&&0===o.size)&&a.push(t);a.forEach((function(t){e.delete(t)}));let o=e.get("employerId");return o&&String(o).startsWith("sp:")&&e.set("employerId",String(o).replace("sp:","")),e}t("#wdt-training-event-form").on("change",'[name="interval"]',(function(){let e=""!==t(this).val(),a=t(this).parents("#wdt-training-event-form");t(a).find('[name="endDate"]')[0].setCustomValidity(""),t(a).find('[name="registrationDate"]')[0].setCustomValidity("");let o=t(a).find('[name="endDate"]').parents('[data-target="wdt-material-form-date-input-label"]').first(),r=t(a).find('[name="registrationDate"]').parents('[data-target="wdt-material-form-date-input-label"]').first();e?(wdtElementNotification(o,"Added end date field."),o.show(),r.hide()):(wdtElementNotification(r,"Added registration date field."),o.hide(),r.show())})),t("#wdt-training-event-form").on("change input",'[name="endDate"]',(function(){this.setCustomValidity("")})),t("#wdt-training-event-form").on("change input",'[name="registrationDate"]',(function(){this.setCustomValidity("")})),t("#wdt-training-event-form").on("change",'[name="employerId"]',(function(){let e=t(this).closest("#wdt-training-event-form").find('[name="hostType"][type="hidden"]');e.length&&e.val(t(this).val().startsWith("sp:")?"sp":"company")})),t("#wdt-training-event-form").on("change",'[name="promotionType"]',(function(){let e=t(this).closest("#wdt-training-event-form"),a="flyer"===t(this).val(),o=e.find('[name="url"]');o.parents('[data-rf-target="wdt-material-form-text-input-label"]').first().toggle(!a),o[0].setCustomValidity("");let r=e.find('[name="flyer"]');r[0].setCustomValidity(""),r.parents('[data-rf-target="wdt-material-form-file-input"]').first().toggle(a)})),t("#wdt-training-event-form").on("change",'[name="medium"]',(function(){let e=t(this).closest("#wdt-training-event-form"),a=t(this).val(),o="inclass"===a||"both"===a,r=e.find('[name="location"]').parents('[data-rf-target="wdt-material-form-text-input-label"]').first();o?(wdtElementNotification(r,"Added location field."),r.show()):r.hide()})),t("#wdt-training-event-form").on("change input",'[name="url"]',(function(){this.setCustomValidity("")})),t("#wdt-training-event-form").on("change",'[name="flyer"]',(function(){this.setCustomValidity("")})),t("#wdt-training-event-form").on("submit",(function(e){e.preventDefault();let a=""!==t(this).find('[name="interval"]').val(),o=t(this).find('[name="endDate"]'),r=t(this).find('[name="registrationDate"]'),n=t(this).find('[name="url"]')[0],i=t(this).find('[name="employerId"]').closest('[data-wdt-material-form-target="typeahead-select-container"]').find('[data-target="wdt-ajax-select-input"]')[0];if(o[0].setCustomValidity(""),r[0].setCustomValidity(""),n.setCustomValidity(""),i&&i.setCustomValidity(""),a&&!o.val())return o[0].setCustomValidity("End date is required for recurring events."),o[0].reportValidity(),!1;if(!a&&!r.val())return r[0].setCustomValidity("Registration date is required for non-recurring events."),r[0].reportValidity(),!1;if(!("sp"===t(this).find('[name="hostType"]:checked').val()||"sp"===t(this).find('[name="hostType"][type="hidden"]').val())&&i&&!t(this).find('[name="employerId"]').val())return i.setCustomValidity("A company is required."),i.reportValidity(),!1;if("flyer"===t(this).find('[name="promotionType"]:checked').val()){let e=t(this).find('[name="flyer"]')[0].files.length>0,a=t(this).find('[name="existingFlyer"]').val();if(!e&&!a){let e=t(this).find('[name="flyer"]')[0];return e.setCustomValidity("A flyer is required."),e.reportValidity(),!1}}else{if(!t(this).find('[name="url"]').val())return n.setCustomValidity("Enter a valid URL starting with https://"),n.reportValidity(),!1}t(this).find('[name="id"]').length?t(this).trigger("wdt:submitUpdate"):t(this).trigger("wdt:submitCreate")})),t("#wdt-training-event-form").on("wdt:submitCreate",(function(){let a=e(this);t(this).find('[type="submit"]').prop("disabled",!0).text("Saving...");let o=this;jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/training-event/",data:a,contentType:!1,processData:!1,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.success){let t=new URL(window.location);t.searchParams.set("wdt-page","training-event-edit"),t.searchParams.set("wdt-event",e.id),window.location.href=t.toString()}else wdtDisplayNotification("Could not save training event, unspecified error.","error",-1),t(o).find('[type="submit"]').prop("disabled",!1).text("Save")},error:function(e){e.responseJSON&&e.responseJSON.message?wdtDisplayNotification("Could not save training event: "+e.responseJSON.message,"error",-1):wdtDisplayNotification("Could not save training event, unspecified error.","error",-1),console.log(e),t(o).find('[type="submit"]').prop("disabled",!1).text("Save")}
1,complete:function(){}})})),t("#wdt-training-event-form").on("wdt:submitUpdate",(function(){let a=e(this);t(this).find('[type="submit"]').prop("disabled",!0).text("Updating...");let o=this;jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/training-event/update/",data:a,contentType:!1,processData:!1,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success?(wdtDisplayNotification("Successfully updated training event.","success",3e3),location.reload()):(wdtDisplayNotification("Could not update training event, unspecified error.","error",-1),t(o).find('[type="submit"]').prop("disabled",!1).text("Update"))},error:function(e){e.responseJSON&&e.responseJSON.message?wdtDisplayNotification("Could not update training event: "+e.responseJSON.message,"error",-1):wdtDisplayNotification("Could not update training event, unspecified error.","error",-1),console.log(e),t(o).find('[type="submit"]').prop("disabled",!1).text("Update")},complete:function(){}})}))})),jQuery(document).ready((function(t){"use strict";t('[data-target="wdt-portal-action-ribbon"] [data-action="wdt-portal-training-publish"]').on("click",(function(){let e=t(this).attr("data-nonce"),a=t(this).attr("data-post-id");t(this).prop("disabled",!0),jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/training-event/publish/",data:{nonce:e,id:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){t.success&&(wdtDisplayNotification("Successfully published training event.","success",3e3),location.reload())},error:function(t){console.log(t),wdtDisplayNotification("Could not publish training event.","error",-1)}})})),t('[data-target="wdt-portal-action-ribbon"] [data-action="wdt-portal-training-delete"]').on("click",(function(){let e=t(this).attr("data-nonce"),a=t(this).attr("data-post-id"),o=t(this);wdtRenderConfirmModal({title:"Delete Training Event",content:"Are you sure you want to delete this training event? This cannot be undone.",className:"wdt-portal-modal-alt",confirmCallback:function(){o.prop("disabled",!0),jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/portal/training-event/delete/",data:{nonce:e,id:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t){if(t.success){wdtDisplayNotification("Training event deleted.","success",2e3);let t=new URL(window.location);t.searchParams.set("wdt-page","training-archive"),t.searchParams.delete("wdt-event"),setTimeout((function(){window.location.href=t.toString()}),2e3)}},error:function(t){console.log(t),wdtDisplayNotification("Could not delete training event.","error",-1),o.prop("disabled",!1)}})}})}))})),jQuery(document).ready((function(t){"use strict";function e(){t("body").find('[data-target="wdt-job-edit-form"]#wdt-mapbox-modal-container').remove()}t(document).on("click",'#wdt-portal-job-edit-form [data-action="display-esa-requirements"]',(function(e){let a=t(this).parents("#wdt-portal-job-edit-form").first(),o=t(a).find('[data-target="esa-requirements"]');t(o).is(":visible")?(t(this).removeClass("is-open"),t(o).hide()):(t(this).addClass("is-open"),t(o).show())})),t('#wdt-portal-job-edit-form input[name="wdt-job-posting-instance"]').on("change",(function(e){let a=t(this).val();a||(a="__invalid__");let o=t(this).parents("#wdt-portal-job-edit-form").first(),r=t(o).find('select[name="wdt-job-posting-employer"]');if(t(r).length<=0)return;t(r).trigger("wdt-clearall");let n=t(r).parents('[data-typeahead-target="wdt-ajax-select-container"]').first(),i=t(n).attr("data-action"),s=new URL("https://url.com"+i);s.searchParams.set("instance",a),t(n).attr("data-action",s.href.split("https://url.com").pop())})),t('#wdt-portal-job-edit-form select[name="wdt-job-posting-employer"]').on("change",(function(e){let a=t(this).val();a?jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/employers/location/",data:{employer_id:a},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.success&&e.location){let a=e.location,o="Populated location data from the selected company.";a.addlocations||a.city||a.province||a.postalzip||a.longitude||a.latitude||(o="No location data found."),wdtElementNotification(jQuery("#wdt-portal-job-edit-form #wdt-portal-job-edit-form-city-label"),o),t('#wdt-portal-job-edit-form [name="wdt-job-posting-street"]').val(a.address).trigger("change"),t('#
1wdt-portal-job-edit-form [name="wdt-job-posting-city"]').val(a.city).trigger("change"),t('#wdt-portal-job-edit-form [name="wdt-job-posting-stateprov"]').val(a.province).trigger("change"),t('#wdt-portal-job-edit-form [name="wdt-job-posting-postalzip"]').val(a.postalzip).trigger("change"),t('#wdt-portal-job-edit-form [name="wdt-job-posting-longitude"]').val(a.longitude).trigger("change"),t('#wdt-portal-job-edit-form [name="wdt-job-posting-latitude"]').val(a.latitude).trigger("change")}},error:function(t){},complete:function(){}}):t('#wdt-portal-job-edit-form [name="wdt-job-posting-company-address-override"]').prop("disabled",!0).trigger("change")})),t('#wdt-portal-job-edit-form [name="wdt-job-posting-url"], #wdt-portal-job-edit-form [name="wdt-job-posting-email"],  #wdt-portal-job-edit-form [name="wdt-job-posting-wage"], #wdt-portal-job-edit-form [name="wdt-job-posting-wage-high"]').on("input",(function(e){t('#wdt-portal-job-edit-form [name="wdt-job-posting-url"]')[0].setCustomValidity(""),t('#wdt-portal-job-edit-form [name="wdt-job-posting-email"]')[0].setCustomValidity(""),t('#wdt-portal-job-edit-form [name="wdt-job-posting-wage"]')[0].setCustomValidity(""),t('#wdt-portal-job-edit-form [name="wdt-job-posting-wage-high"]')[0].setCustomValidity("")})),t('#wdt-portal-job-edit-form [name="wdt-job-posting-wage-unit"]').on("change",(function(e){t('#wdt-portal-job-edit-form [name="wdt-job-posting-wage-unit"]')[0].setCustomValidity("")})),t('#wdt-portal-job-edit-form [name="wdt-job-posting-vacancy-confirm"]').on("change",(function(e){t('#wdt-portal-job-edit-form [name="wdt-job-posting-vacancy-confirm"]').each((function(){this.setCustomValidity("")}))})),t("#wdt-portal-job-edit-form").on("wdt:newRuleTrigger",(function(e){let a=this,o=t(a).find('[name="wdt-quick-edit-new-rule"]').is(":checked"),r=t(a).find('[name="wdt-job-posting-nocs-2021[]"]').val(),n=t(a).find('[name="wdt-job-posting-title"]').val();if(r&&!Array.isArray(r)&&(r=[r]),o&&r.length){let e=new URL(t(a).attr("data-rule-link"));e.searchParams.set("wdt-job-title",n),e.searchParams.set("wdt-noc",r[0]),window.open(e.href,"_blank")}})),t("#wdt-portal-job-edit-form").on("submit",(function(e){e.preventDefault();let a=t(this).attr("data-action"),o=t(this).find('[name="wdt-job-posting-url"]'),r=t(this).find('[name="wdt-job-posting-email"]'),n=t(this).find('[name="wdt-job-posting-wage"]'),i=t(this).find('[name="wdt-job-posting-wage-high"]'),s=t(this).find('[name="wdt-job-posting-wage-unit"]');if(!o.val()&&!r.val())return o[0].setCustomValidity("Please either enter a valid URL or email for this posting."),o[0].reportValidity(),!1;if(o[0].setCustomValidity(""),o.val()){if("http"!=o.val().substring(0,4))return o[0].setCustomValidity("Please specify protocol (http:// or https://)"),o[0].reportValidity(),!1;o[0].setCustomValidity("")}if(n.val()&&!s.val())return s[0].setCustomValidity("Please enter a Wage Unit"),s[0].reportValidity(),!1;if(s[0].setCustomValidity(""),s.val()&&!n.val())return n[0].setCustomValidity("Please enter a Wage"),n[0].reportValidity(),!1;if(n[0].setCustomValidity(""),i.val()&&!n.val())return n[0].setCustomValidity("Please enter a low wage value when specifying a range"),n[0].reportValidity(),!1;if(i[0].setCustomValidity(""),i.val()&&n.val()&&parseFloat(i.val())<=parseFloat(n.val()))return i[0].setCustomValidity("High wage must be greater than low wage"),i[0].reportValidity(),!1;if(i[0].setCustomValidity(""),i.val()&&n.val()){let t=parseFloat(n.val()),e=parseFloat(i.val());if(e<=2e5&&e-t>5e4)return i[0].setCustomValidity("The wage range cannot exceed $50,000 unless the high end of the range exceeds $200,000 (ESA requirement)"),i[0].reportValidity(),!1;i[0].setCustomValidity("")}let d=t(this).find('[name="wdt-job-posting-vacancy-confirm"][value="no"]');if(d.length&&d.is(":checked"))return d[0].setCustomValidity("This posting must represent a current vacancy to comply with Ontario's Employment Standards Act requirements."),d[0].reportValidity(),!1;"publish"==a?t(this).trigger("wdt:submitPublish"):"update"==a?t(this).trigger("wdt:submitUpdate"):wdtDisplayNotification("Form configured improperly","error",-1)})),t("#wdt-portal-job-edit-form").on("wdt:submitPublish",(function(e){let a=t.param(t(this).serializeArray());t(this).find("#wdt-portal-job-edit-form-submit-button").prop("disabled",!0),t(this).find("#wdt-portal-job-edit-form-submit-button").text("Publishing...",!0);let o=this;jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/job-board/job-mgmt/create/",data:a,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.success){t(o).trigger("wdt:newRuleTrigger");let e=new URL(window.location);e.searchParams.set("wdt-page","my-jobs"),window.location.href=e.toString()}else wdtDisplayNotification("Could not publish job post, unspecified error.","error",-1),t(o).find("#wdt-portal-job-edit-form-submit-button").prop("disabled",!1),t(o).find("#wdt-portal-job-edit-form-submit-button").text("Publish",!0)},error:function(e){e.responseJSON&&e.responseJSON.message?wdtDisplayNotification("Could not publish job post: "+e.responseJSON.message,"error",-1):wdtDisplayNotification("Could not publish job post, unspecified error.","error",-1),console.log(e),t(o).find("#wdt-portal-job-edit-form-submit-button").prop("disabled",!1),t(o).find("#wdt-portal-job-edit-form-submit-button").text("Publish",!0)},complete:function(){}})})),t("#wdt-portal-job-edit-form").on("wdt:submitUpdate",(function(e){let a=t(this).serializeArray();t(this).find('input[type="checkbox"]').each((function(e){let o=t(this).attr("name"),r=t(this).is(":checked");o&&!r&&a.push({name:o,value:"false"})}));let o=t.param(a);t(this).find("#wdt-portal-job-edit-form-submit-button").prop("disabled",!0),t(this).find("#wdt-portal-job-edit-form-submit-button").text("Updating...",!0);let r=this;jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/job-board/job-mgmt/update/",data:o,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success?(t(r).trigger("wdt:newRuleTrigger"),wdtDisplayNotification("Successfully updated post.","success",3e3),location.reload()):(t(r).find("#wdt-portal-job-edit-form-submit-button").prop("disabled",!1),t(r).find("#wdt-portal-job-edit-form-submit-button").text("Update",!0),wdtDisplayNotification("Could not update job post, unspecified error.","error",-1))},error:function(e){e.responseJSON&&e.responseJSON.message?wdtDisplayNotification("Could not update job post: "+e.responseJSON.message,"error",-1):wdtDisplayNotification("Could not update job post, unspecified error.","error",-1),t(r).find("#wdt-portal-job-edit-form-submit-button").prop("disabled",!1),t(r).find("#wdt-portal-job-edit-form-submit-button").text("Update",!0),console.log(e)}
1,complete:function(){}})})),t('#wdt-portal-job-edit-form button[data-action="delete"]').on("click",(function(e){let a=t(this).attr("data-nonce"),o=t(this).attr("data-post-id");jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/job-board/job-mgmt/delete/",data:{nonce:a,"post-id":o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.success){wdtDisplayNotification("Successfully deleted post.","success",3e3);let t=new URL(window.location);t.searchParams.set("wdt-page","my-jobs"),window.location.href=t.toString()}else t(this).prop("disabled",!1)},error:function(e){console.log(e),t(this).prop("disabled",!1)},complete:function(){}})})),t('#wdt-portal-edit-job-post [data-action="wdt-portal-job-publish"]').on("click",(function(e){let a=t(this).attr("data-nonce"),o=t(this).attr("data-post-id");jQuery.ajax({method:"POST",url:WDT.rest_url+"wedatatools/v1/job-board/job-mgmt/publish/",data:{nonce:a,"post-id":o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success?(wdtDisplayNotification("Successfully published post.","success",3e3),location.reload()):t(this).prop("disabled",!1)},error:function(e){console.log(e),t(this).prop("disabled",!1)},complete:function(){}})})),jQuery('#wdt-portal-job-edit-form button[data-action="geocode"]').on("click",(function(a){let o=this,r=t(this).parents("#wdt-portal-job-edit-form").first();a.preventDefault(),a.stopPropagation();var n=jQuery(this).data("nonce"),i={street:r.find('input[name="wdt-job-posting-street"]').val(),locality:r.find('input[name="wdt-job-posting-city"]').val(),region:r.find('input[name="wdt-job-posting-stateprov"]').val(),postalzip:r.find('input[name="wdt-job-posting-postalzip"]').val()};i.locality&&["on","ontario","nl","newfoundland and labrador","pe","prince edward island","ns","nova scotia","nb","new brunswick","qc","quebec","mb","manitoba","sk","saskatchewan","ab","alberta","bc","british columbia","yt","yukon","nt","northwest territories","nu","nunavut"].includes(i.region.toLowerCase())&&(i.country="Canada"),jQuery(this).prop("disabled",!0),jQuery.ajax({type:"POST",url:WDT.admin_url+"admin-ajax.php",data:{action:"wdt_get_mapbox_coords",nonce:n,address:i},success:function(a){if(a.success)if((a=a.data).latitude&&a.longitude){var o=a.latitude,r=a.longitude;t('#wdt-portal-job-edit-form input[name="wdt-job-posting-latitude"]').val(o).trigger("change"),t('#wdt-portal-job-edit-form input[name="wdt-job-posting-longitude"]').val(r).trigger("change"),wdtDisplayNotification("Successfully added Latitude and Longitude to post.","success",3e3)}else a.points&&(e(),function(e,a,o){let r='<div id="wdt-mapbox-modal-container" data-target="wdt-job-edit-form">';r+='<div data-query="'+a+'" data-nonce="'+o+'" id="wdt-mapbox-modal">',r+="<h2>No Match Found</h2>",r+='<p>Sorry, we couldn\'t find a good Geocode match... Below are some suggestions we could find. Select an address to populate the latitude/longitude, or select "None of these are correct".</p>',r+="<p>You searched: <strong>"+a+"</strong></p>";for(let t of e){let e=t.lat,a=t.lon;r+='<div data-lat="'+e+'" data-lon="'+a+'" class="mapbox-option">',r+='<div class="mapbox-address">'+t.title+"</div>",t.in_region||(r+='<div class="mapbox-out-of-region">Out Of Region</div>'),r+='<div class="mapbox-relevance">Relevance '+t.relevance+"</div>",r+='<button class="mapbox-select-btn button button-primary">Use Coordinates</button>',r+='<a class="mapbox-view-btn button button-secondary" href="https://www.google.com/maps/search/?api=1&query='+e+","+a+'" target="_blank"> View On Map</a>',r+="</div>"}r+='<div id="no-mapbox-suggestion" class="mapbox-option">',r+="<div>None of these are correct</div>",r+='<button class="mapbox-select-btn button button-primary">Select</button>',r+="</div>",r+='<div class="mapbox-modal-buttons">',r+='<button id="mapbox-modal-cancel" class="button button-secondary">Close</button>',r+="</div>",r+="</div>",r+="</div>",t("body").append(r)}(a.points,a.query,n));else wdtDisplayNotification("Did not successfully retrieve coordinates.","error",5e3)},error:function(t){console.log(t),wdtDisplayNotification(t.responseJSON.data,"error",5e3)},complete:function(){jQuery(o).prop("disabled",!1)}})})),t(document).on("click",'[data-target="wdt-job-edit-form"] .mapbox-select-btn',(function(a){let o=t(this).parent(".mapbox-option"),r=o.attr("id"),n=t("#wdt-mapbox-modal").data("query"),i=t("#wdt-mapbox-modal").data("nonce");if("no-mapbox-suggestion"==r){let e="Unable to geocode address for query: "+n;jQuery.ajax({type:"POST",url:WDT.admin_url+"admin-ajax.php",data:{action:"wdt_log_failed_geocode",text:e,nonce:i},error:function(t){console.log(t),wdtDisplayNotification("Encountered an issue logging address lookup failure.","error",5e3)}});let a="<p>Sorry to hear that. We've logged this address for future reference. In the mean time, you may want to try to manually extract this from Google Maps.</p>";a+='<a href="https://support.google.com/maps/answer/18539" target="_blank">Instructions</a>',a+="<br>",a+="<br>",a+='<a href="https://www.google.com/maps/search/?api=1&query='+n+'" target="_blank">Address Link on Google Maps</a>',a+="<br>",a+="<br>",a+='<div class="mapbox-modal-buttons"><button id="mapbox-modal-cancel" class="button button-secondary">Close</button></div>',t("#wdt-mapbox-modal").html(a)}else{let a="Unable to geocode address for query: "+n+". Selected: "+t(o).find(".mapbox-address").text();jQuery.ajax({type:"POST",url:WDT.admin_url+"admin-ajax.php",data:{action:"wdt_log_failed_geocode",text:a,nonce:i},error:function(t){console.log(t),wdtDisplayNotification("Encountered an issue logging address lookup failure.","error",5e3)}});let r=o.data("lat"),s=o.data("lon");t('#wdt-portal-job-edit-form input[name="wdt-job-posting-latitude"]').val(r).trigger("change"),t('#
1wdt-portal-job-edit-form input[name="wdt-job-posting-longitude"]').val(s).trigger("change"),e(),wdtDisplayNotification("Successfully added Latitude and Longitude to post.","success",3e3)}})),t(document).on("click",'[data-target="wdt-job-edit-form"] #mapbox-modal-cancel, [data-target="wdt-job-edit-form"]#wdt-mapbox-modal-container',(function(t){e()})),t(document).on("click",'[data-target="wdt-job-edit-form"] .mapbox-view-btn, [data-target="wdt-job-edit-form"] #wdt-mapbox-modal',(function(t){t.stopPropagation()}))})),jQuery((t=>{"use strict";if(!t("#wdt-client-intake-report").length)return;let e=()=>({start_date:t(".wdt-form-date-input.wdt-date-range-start-date").val(),end_date:t(".wdt-form-date-input.wdt-date-range-end-date").val()}),a=t=>{if(!t.match(/^\d{4}-\d{2}-\d{2}$/))return!1;let e=new Date(t),a=e.getTime();return!(!a&&0!==a)&&e.toISOString().slice(0,10)===t},o=()=>{let{start_date:o,end_date:r}=e(),n=t('input[name="wdt-end-date"]').attr("wdt-max-date")?t('input[name="wdt-end-date"]').attr("wdt-max-date"):"";return a(o)&&a(r)?(o=new Date(o),r=new Date(r),n=new Date(n),o>r?(wdtDisplayNotification("The end date must be larger than the start date.","error",5e3),!1):!(r>n)||(wdtDisplayNotification("The end date cannot be a day past today.","error",5e3),!1)):(wdtDisplayNotification("The start or end date is invalid.","error",5e3),!1)};o(),t(document).on("submit","#wdt-client-intake-report form.cir-dates",(function(e){e.preventDefault(),o()||e.preventDefault();let a=wdtMergeForms([t(this).get(0),t("#wdt-client-intake-report form#wdt-client-intake-additional-fields").get(0)],{method:"GET"});document.body.appendChild(a),a.submit()})),t("#wdt-client-intake-report #wdt-report-banner-download").on("click",(function(a){t(this).parents("#wdt-client-outcomes-report").first();t(this).addClass("pending");let o=e(),r={format:"csv",startDate:o.start_date,endDate:o.end_date},n=this;t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/reports/client-intake",data:r,xhrFields:{responseType:"blob"},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t,e,a){let o="report.csv";const r=a.getResponseHeader("Content-Disposition");if(r){const t=r.match(/filename\*=(?:UTF-8'')?([^;]+)/i),e=r.match(/filename="?([^";]+)"?/i),a=t?t[1]:e?e[1]:null;if(a)try{o=decodeURIComponent(a.trim())}catch{o=a.trim()}}const n=window.URL.createObjectURL(t),i=document.createElement("a");i.href=n,i.download=o,document.body.appendChild(i),i.click(),i.remove(),window.URL.revokeObjectURL(n)},error:function(t,e,a){wdtDisplayNotification("Failed to download: "+(a||e),"error",-1)},complete:function(){t(n).removeClass("pending")}})}))})),jQuery((t=>{"use strict";function e(){let e=wdtMergeForms([t("form#wdt-outcomes-report-filter-form").get(0),t('#wdt-client-outcomes-report form[data-target="wdt-cams-report-date-form"]').get(0)],{method:"GET"});wdtSaveFormCookie("wdt_outcomes_filters",e),document.body.appendChild(e),e.submit()}t("#wdt-client-outcomes-report").length&&(t(document).on("wdt:sort","#wdt-client-outcomes-report-table",(function(e){let a=e.colIdx,o=e.order;e.preventDefault();let r=t(this).find("tbody"),n=[],i=r.children("tr"),s=null;function d(t){let e=t.attr("data-sort-value");return e||(e=t.text().trim()),e=e.replace("%","").replace(/,/g,"").trim(),""===e?0:isNaN(e)?e:parseFloat(e)}i.each((function(){let e=t(this);e.hasClass("wdt-client-outcomes-report-table-body-primary-row")?(s={parent:e,children:[]},n.push(s)):s&&s.children.push(e)})),n.sort((function(t,e){let r=d(t.parent.children().eq(a)),n=d(e.parent.children().eq(a));return isNaN(r)||isNaN(n)?"asc"===o?String(r).localeCompare(String(n)):String(n).localeCompare(String(r)):"asc"===o?r-n:n-r}
1)),r.empty(),n.forEach((t=>{r.append(t.parent),t.children.forEach((t=>r.append(t)))}))})),t("#wdt-client-outcomes-report #wdt-report-banner-download").on("click",(function(e){let a=t(this).parents("#wdt-client-outcomes-report").first();t(this).addClass("pending");let o=t(a).find('[wdt-report-target="date-range"]').val().split("|"),r=t('#wdt-outcomes-report-filter-form [name="serviceDeliverySites[]"]').val(),n={format:"csv",startDate:o[0],endDate:o[1],serviceDeliverySites:r},i=this;t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/reports/client-outcomes",data:n,xhrFields:{responseType:"blob"},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t,e,a){let o="report.csv";const r=a.getResponseHeader("Content-Disposition");if(r){const t=r.match(/filename\*=(?:UTF-8'')?([^;]+)/i),e=r.match(/filename="?([^";]+)"?/i),a=t?t[1]:e?e[1]:null;if(a)try{o=decodeURIComponent(a.trim())}catch{o=a.trim()}}const n=window.URL.createObjectURL(t),i=document.createElement("a");i.href=n,i.download=o,document.body.appendChild(i),i.click(),i.remove(),window.URL.revokeObjectURL(n)},error:function(t,e,a){wdtDisplayNotification("Failed to download: "+(a||e),"error",-1)},complete:function(){t(i).removeClass("pending")}})})),t(document).on("wdt:refresh",'#wdt-client-outcomes-report [data-target="primary-view-label"]',(function(e){let a=t("#wdt-client-outcomes-report #wdt-primary-view-placeholder"),o=t(a).parents('[data-target="wdt-form-select-combobox-container"]').first(),r=t(a).val(),n=t(o).find('[data-target="wdt-form-select-listbox-item"][value="'+r+'"]'),i=t(n).attr("data-label");t(this).text(i)})),t("button.table-expand").on("click",(function(){let e=t(this).attr("id");t(this).toggleClass("open"),t(`tr[data-parent="${e}"]`).each((function(){t(this).toggle()}))})),t(document).on("submit","form#wdt-outcomes-report-filter-form",(function(t){t.preventDefault(),e()})),t(document).on("submit",'#wdt-client-outcomes-report form[data-target="wdt-cams-report-date-form"]',(function(t){t.preventDefault(),e()})),t("#wdt-client-outcomes-report #wdt-report-banner-download").on("click",(async function(){t(this).addClass("pending");let e=t(this).attr("data-nonce"),{startDate:a,endDate:o}=getDateRange();try{let{status:r,data:n}=await generateReportCSV("generate_client_report_csv",a,o,e);if("success"!==r)return void wdtDisplayNotification("Could not export this report.","error",5e3);let i=`client-report-${a.replaceAll("-","_")}-${o.replaceAll("-","_")}.csv`,s=t(`<a id="download-csv" class="wdt-sr-only" href="data:text/plain;charset=utf-8,${encodeURIComponent(n)}" download="${i}">Download CSV</a>`);s.insertAfter("#wdt-report-banner-download")[0].click(),s.remove(),t(this).removeClass("pending")}catch(e){console.log(e),t(this).removeClass("pending")}})),t('#wdt-client-outcomes-report [data-target="primary-view-label"]').trigger("wdt:refresh"))})),jQuery((function(t){"use strict";function e(t,e){for(let a of e)if(a.name===t)return a.value;return null}function a(t){return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(t)}function o(e){let a=wdtMergeForms([t("form#wdt-satisfaction-report-filter-form").get(0),t('#wdt-portal-cams-satisfaction-report form[data-target="wdt-cams-report-date-form"]').get(0)],{method:"GET"});wdtSaveFormCookie("wdt_satisfaction_filters",a),wdtAddFormToURLHistory(a);let o=t(a).serializeArray(),r=new FormData(a);o.push({name:"format",value:e});let n=r.get("dateRange");if(n){let t=n.split("|");o.push({name:"startDate",value:t[0]}),o.push({name:"endDate",value:t[1]})}return o}t("#wdt-portal-cams-satisfaction-report #wdt-report-banner-download").on("click",(function(e){t(this).addClass("pending");let a=o("csv"),r=this;t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/reports/client-satisfaction",data:a,xhrFields:{responseType:"blob"},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t,e,a){let o="report.csv";const r=a.getResponseHeader("Content-Disposition");if(r){const t=r.match(/filename\*=(?:UTF-8'')?([^;]+)/i),e=r.match(/filename="?([^";]+)"?/i),a=t?t[1]:e?e[1]:null;if(a)try{o=decodeURIComponent(a.trim())}catch{o=a.trim()}}const n=window.URL.createObjectURL(t),i=document.createElement("a");i.href=n,i.download=o,document.body.appendChild(i),i.click(),i.remove(),window.URL.revokeObjectURL(n)},error:function(t,e,a){wdtDisplayNotification("Failed to download: "+(a||e),"error",-1)}
1,complete:function(){t(r).removeClass("pending")}})})),t('#wdt-portal-cams-satisfaction-report [data-target="wdt-portal-cams-satisfaction-report-render-container"]').on("wdt:refreshSatisfactionReport",(function(r){let n=o("html"),i=this;t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/reports/client-satisfaction",data:n,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){t(i).html(e.report)},error:function(t){},complete:function(){let o=new Date(e("startDate",n)+" 12:00:00"),r=new Date(e("endDate",n)+" 12:00:00");t('[data-target="date-range"]').text(a(o)+" - "+a(r))}})})),t(document).on("submit",'#wdt-portal-cams-satisfaction-report [data-target="wdt-cams-report-date-form"]',(function(e){e.preventDefault(),t('#wdt-portal-cams-satisfaction-report [data-target="wdt-portal-cams-satisfaction-report-render-container"]').trigger("wdt:refreshSatisfactionReport")})),t(document).on("change",'#wdt-satisfaction-report-filter-form [data-cams-report-field="true"]',(function(e){t('#wdt-portal-cams-satisfaction-report [data-target="wdt-portal-cams-satisfaction-report-render-container"]').trigger("wdt:refreshSatisfactionReport")})),t('#wdt-portal-cams-satisfaction-report [data-target="wdt-portal-cams-satisfaction-report-render-container"]').trigger("wdt:refreshSatisfactionReport")})),jQuery((function(t){"use strict";t('[data-target="portal-interactions-table"]').on("wdt:response",(function(e){let a=t(this).parents('[data-target="portal-table-container"]').first(),o=e.wdt.result;if(o.length)for(let e of o){let o=t(t(a).find('[data-target="template-table"]').get(0).content).find('[data-target="template-row"]').clone(),r=o.find('td[data-column="object"]');r.length&&e.title&&r.text(e.title);let n=o.find('td[data-column="views"]');n.length&&e.views&&n.text(wdtNumberFormat(e.views));let i=o.find('td[data-column="postings"]');i.length&&e.postings&&i.text(wdtNumberFormat(e.postings));let s=o.find('td[data-column="follows"]');s.length&&e.follows&&s.text(wdtNumberFormat(e.follows)),t(a).find('[data-target="portal-table-body"]').append(o)}else t(a).find('[data-target="portal-table-body"]').append('<tr><td colspan="999">No results found.</td></tr>')})),t('[data-target="portal-interactions-table"]').on("wdt:update",(function(e){let a=e.wdt&&e.wdt.perPage?e.wdt.perPage:25,o=e.wdt&&e.wdt.mode?e.wdt.mode:"",r=e.wdt&&e.wdt.dateFrom?e.wdt.dateFrom:"",n=e.wdt&&e.wdt.dateTo?e.wdt.dateTo:"",i={companies:"Employer",occupations:"Occupations",sectors:"Sectors"},s=i[o]?i[o]:"Employer";t(this).find('thead th[data-column="object"] .wdt-portal-table-head-element-content-text').text(s);let d=t(this).attr("data-nonce"),l=t(this).parents('[data-target="portal-table-container"]').first(),c=this;jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/report/interactions/",data:{nonce:d,number:a,mode:o,date_from:r,date_to:n},beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(l).find('[data-target="portal-table-body"]').html(""),t(l).find('[data-target="spinner"]').show()},success:function(e){if(e.success){let a=t.Event("wdt:response");a.wdt={},a.wdt.result=e.result,t(c).trigger(a)}},error:function(t){wdtDisplayNotification("Unable to retrieve interaction data. Please contact administrator.","error",-1),console.log(t)},complete:function(){t(l).find('[data-target="spinner"]').hide()}})})),t('[data-target="portal-interactions-table"]').on("wdt:loaded",(function(e){t(this).attr("data-loaded","true")})),t('[data-target="portal-interactions-table"]').trigger("wdt:loaded")})),jQuery((function(t){"use strict";var e=t("#wdt-portal-service-delivery-snapshot-report"),a=e.find('[data-target="wdt-service-delivery-snapshot-render-container"]');function o(a){var o=wdtMergeForms([t("form#wdt-service-delivery-snapshot-filter-form").get(0),e.find('form[data-target="wdt-cams-report-date-form"]').get(0)],{method:"GET"});wdtSaveFormCookie("wdt_snapshot_filters",o),wdtAddFormToURLHistory(o);var r=t(o).serializeArray(),n=new FormData(o).get("dateRange");if(n){var i=n.split("|");r.push({name:"startDate",value:i[0]}),r.push({name:"endDate",value:i[1]})}return r.push({name:"format",value:a}),r}function r(t,e){for(var a=0;a<e.length;a++)if(e[a].name===t)return e[a].value;return null}function n(t){return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(t)}e.find("#wdt-report-banner-download").on("click",(function(){var e=t(this).addClass("pe
1nding"),a=o("csv");t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/reports/service-delivery-snapshot",data:a,xhrFields:{responseType:"blob"},beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(t,e,a){var o="ServiceDeliverySnapshotReport.csv",r=a.getResponseHeader("Content-Disposition");if(r){var n=r.match(/filename\*=(?:UTF-8'')?([^;]+)/i),i=r.match(/filename="?([^";]+)"?/i),s=n?n[1]:i?i[1]:null;if(s)try{o=decodeURIComponent(s.trim())}catch{o=s.trim()}}var d=window.URL.createObjectURL(t),l=document.createElement("a");l.href=d,l.download=o,document.body.appendChild(l),l.click(),l.remove(),window.URL.revokeObjectURL(d)},error:function(t,e,a){wdtDisplayNotification("Failed to download: "+(a||e),"error",-1)},complete:function(){e.removeClass("pending")}})})),a.on("wdt:refreshSnapshotReport",(function(){var e=o("html"),i=this;a.html("<p>Loading&hellip;</p>"),t.ajax({type:"GET",url:WDT.rest_url+"wedatatools/v1/portal/reports/service-delivery-snapshot",data:e,beforeSend:function(t){t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){t(i).html(e.report)},error:function(){t(i).html("<p>Failed to load report.</p>")},complete:function(){var a=r("startDate",e),o=r("endDate",e);a&&o&&t('[data-target="date-range"]').text(n(new Date(a+" 12:00:00"))+" - "+n(new Date(o+" 12:00:00")))}})})),t(document).on("submit",'#wdt-portal-service-delivery-snapshot-report form[data-target="wdt-cams-report-date-form"], #wdt-portal-service-delivery-snapshot-report form[data-target="wdt-portal-cams-report-filters-form"]',(function(t){t.preventDefault(),a.trigger("wdt:refreshSnapshotReport")})),t(document).on("change",'#wdt-service-delivery-snapshot-filter-form [data-cams-report-field="true"]',(function(){a.trigger("wdt:refreshSnapshotReport")})),a.trigger("wdt:refreshSnapshotReport")})),jQuery(document).ready((function(t){"use strict";const e='[data-target="wdt-case-tasks-accordion-list"], [data-nested-case-tasks="true"]';function a(t){return'[data-target="wdt-case-tasks-accordion-list"]'+t+', [data-nested-case-tasks="true"]'+t}function o(e){return t(e).is('[data-nested-case-tasks="true"]')?t(e).find('[data-target="task-forms"]'):t(e)}function r(e){t(e).is('[data-nested-case-tasks="true"]')&&t(e).find('[data-target="sub-tasks-section"]').trigger("wdt:refreshTasksContainer")}t(document).on("change",'[data-target="task-form-container"] [name="task-assigned"]',(function(e){let a=t(this).parents('[data-target="task-form-container"]').first().find('[data-target="task-form-heading"]').first(),o=[];t(this).find("option[selected]").each((function(e){let a=t(this).text(),r=t(this).attr("data-colour"),n=a.split(" "),i=[],s=n.shift();a.includes("(Me)")&&n.pop();let d=n.pop();d&&i.push(d),s&&i.unshift(s);let l="";for(let t of i)l+=t.charAt(0);o.push({name:a,colour:r,initials:l})}));let r=t(a).find('[data-target="wdt-task-avatar"]');if(o.length<=0)t(r).attr("title","Unassigned"),t(r).text("U"),t(r).css("background-color","#00448b");else if(1===o.length){let e=o[0];t(r).attr("title",e.name),t(r).text(e.initials),t(r).css("background-color",e.colour)}else if(o.length>1){let e=[],a=[];for(let t of o)e.push(t.id),a.push(t.name);t(r).attr("title",a.join(", ")),t(r).text(o.length)}})),t(document).on("click",a(' li [data-target="task-form-container"] [data-target="task-form"] [data-action="cancel-task"]'),(function(a){let o=t(this).parents(e).first(),n=t(this).parents('[data-target="task-form-container"]').first();t(n).trigger("wdt:showHeading"),t(n).parents("li").first().remove(),r(o)})),t(document).on("click",a(' [data-target="task-form-container"] [data-action="wdt-portal-client-case-task-form-heading-remove-btn"]'),(function(a){let o=t(this).parents(e).first(),n=t(this).parents('[data-target="task-form-container"]').first();t(n).remove(),r(o)})),t(document).on("click",a(' [data-target="task-form-container"] [data-action="wdt-portal-client-case-task-form-heading-edit-btn"]'),(function(a){let o=t(this).parents(e).first(),n=t(this).parents("li").first();t(n).find('[data-target="task-form"]').trigger("wdt:uninitializeForm");let i=t(n).clone(!0);t(i).insertAfter(n),t(i).find('[data-target="task-form"]').trigger("wdt:initializeForm"),t(i).find('[data-target="task-form-container"]').data("original",n),t(i).find('[data-target="task-form-container"]').trigger("wdt:showForm"),r(o)})),t(document).on("click",a(' [data-target="task-form-container"] [data-target="task-form"] [data-action="save-task"]'),(function(e){let a=t(this).parents('[data-target="task-form-container"]').first();t(a).trigger("wdt:saveTask")})),t(document).on("wdt:saveTask",a(' [data-target="task-form-container"]'),(function(e){let a=t(this).find('[data-target="task-form"]').first(),o=t(this).find('[data-target="task-form-heading"]'),r=t(a).find('[name="task-name"]'),n=t(a).find('[name="task-date"]'),i=t(a).find('[name="task-assigned"]'),s=[r,n,i,t(a).find('[name="task-detail
1s"]'),t(a).find('[name="task-service-provider"]')];for(let a of s){if(!a.length)continue;if(!t(a)[0].reportValidity())return void e.preventDefault()}let d=[];t(i).find("option[selected]").each((function(e){let a=t(this).text(),o=t(this).attr("data-colour"),r=a.split(" "),n=[],i=r.shift();a.includes("(Me)")&&r.pop();let s=r.pop();s&&n.push(s),i&&n.unshift(i);let l="";for(let t of n)l+=t.charAt(0);d.push({name:a,colour:o,initials:l})}));let l=t(r).val(),c=t(n).val(),p=new Date;p.setHours(12,0,0,0);let u=p.getTime(),f=new Date(c+" 12:00:00"),g=f.getTime(),m=f.toLocaleDateString("en-us",{day:"numeric",month:"short",year:"numeric"}),w=!1,h=g-u;h<-864e5?w=!0:h<0?(m="Yesterday",w=!0):0===h?m="Today":h<=864e5&&(m="Tomorrow");let b=t(o).find('[data-target="wdt-task-avatar"]');if(1===d.length){let e=d[0];t(b).attr("title",e.name),t(b).text(e.initials),t(b).css("background-color",e.colour)}if(d.length>1){let e=[],a=[];for(let t of d)e.push(t.id),a.push(t.name);t(b).attr("title",a.join(", ")),t(b).text(d.length)}t(o).find('[data-target="task-form-title"]').text(l),t(o).find('[data-target="task-form-date"]').text(m),w?t(o).find('[data-target="task-form-date"]').addClass("overdue"):t(o).find('[data-target="task-form-date"]').removeClass("overdue");let y=t(this).data("original");y&&y.length&&t(y).remove(),t(this).trigger("wdt:showHeading")})),t(document).on("wdt:showHeading",a(' [data-target="task-form-container"]'),(function(a){let r=t(this).parents(e).first(),n=t(r).find('[data-action="create-followup"]');t(n).show(),t(n).trigger("wdt:show"),o(r).find("li").show(),t(r).find('[data-target="task-form-container"]').attr("data-active","false")})),t(document).on("wdt:showForm",a(' [data-target="task-form-container"]'),(function(a){let r=t(this).parents(e).first(),n=t(this).parents("li").first(),i=t(r).find('[data-action="create-followup"]');t(i).hide(),t(i).trigger("wdt:hide"),o(r).find("li").hide(),t(n).show(),t(r).find('[data-target="task-form-container"]').attr("data-active","false"),t(this).attr("data-active","true")}))})),jQuery(document).ready((function(t){"use strict";t(document).on("wdt:showHeading",'[data-target="task-form-container"]',(function(e){t(this).find('[data-target="task-form-heading"]').show(),t(this).find('[data-target="task-form"]').hide()})),t(document).on("wdt:showForm",'[data-target="task-form-container"]',(function(e){t(this).find('[data-target="task-form-heading"]').hide(),t(this).find('[data-target="task-form"]').show()})),t(document).on("wdt:beforeAjaxRequest",'[data-task-form-target="staff-select"]',(function(t,e){e.data.self_option=!0})),t(document).on("wdt:ajaxResults",'[data-task-form-target="staff-select"]',(function(t,e){e.req&&e.req.page&&1===e.req.page&&e.results.unshift({text:"Unassigned",id:"-1"})})),t(document).on("change",'[data-target="task-form-inner"] [data-task-form-target="client-select"]',(function(e){let a=t(this).parents('[data-target="task-form-inner"]').first(),o=t(this).find("select").val(),r=t(a).find('[data-task-form-target="employer-select"]').find("select").val();o&&!r?(t(a).find('[data-task-form-target="assign-to-client"]').prop("disabled",!1),t(a).find('[data-task-form-target="assign-to-client"]').parents("label").first().show(),t(a).find('[data-task-form-target="assign-to-client"]').trigger("wdtrf:refresh")):(t(a).find('[data-task-form-target="assign-to-client"]').prop("disabled",!0),t(a).find('[data-task-form-target="assign-to-client"]').parents("label").first().hide(),t(a).find('[data-task-form-target="assign-to-client"]').trigger("wdtrf:refresh"))})),t(document).on("change",'[data-target="task-form-inner"] [name="task-employer"]',(function(e){let a=t(this).parents('[data-target="task-form-inner"]').first(),o=t(this).val(),r=t(a).find('[data-task-form-target="assign-to-client"]'),n=t(a).find('[data-task-form-target="client-select"]').find("select").val();o?(t(r).is(":checked")&&t(r).prop("checked",!1).trigger("change"),t(r).prop("disabled",!0),t(r).parents("label").first().hide(),t(r).trigger("wdtrf:refresh")):n?(t(r).prop("disabled",!1),t(r).parents("label").first().show(),t(r).trigger("wdtrf:refresh")):(t(r).prop("disabled",!0),t(r).parents("label").first().hide(),t(r).trigger("wdtrf:refresh"))})),t(document).on("change",'[data-target="task-form-inner"] [data-task-form-target="assign-to-client"]',(function(e){let a=t(this).parents('[data-target="task-form-inner"]').first(),o=t(this).is(":checked"),r=t(a).find('[data-task-form-target="client-select"]'),n=t(a).find('[data-task-form-target="staff-select"]'),i=t(a).find('[data-task-form-target="service-provider-select"]');
1if(o){let e=t(r).find("select").val();if(!e)return;let a=t(r).find('option[selected][value="'+e+'"]').text();t(r).trigger("wdt:disable"),t(i).trigger("wdt:disable"),t(n).trigger("wdt-clearall");let o=t.Event("wdt:select");o.label=a,o.value=e,t(n).trigger(o),t(n).trigger("wdt:disable")}else t(n).trigger("wdt-clearall"),t(r).trigger("wdt:undisable"),t(n).trigger("wdt:undisable"),t(i).trigger("wdt:undisable")})),t(document).on("wdt:afterselect",'[data-task-form-target="staff-select"]',(function(e){if("-1"!==e.selected.value){let e=t.Event("wdt:removeselection");e._value="-1",t(this).trigger(e)}else{let e=this,a=t(this).find("option");t(a).each((function(a){let o=t(this).val();if("-1"!==o){let a=t.Event("wdt:removeselection");a._value=o,t(e).trigger(a)}}))}})),t(document).on("change",'[data-task-form-target="service-provider-select"] select',(function(e){if(t(this).data("wdt:suppressEvents"))return;let a=t(this).parents('[data-target="task-form-inner"]'),o=t(this).val();console.log(o);let r=[],n=t(a).find('[name="task-assigned"]'),i=t(n).parents('[data-wdt-material-form-target="typeahead-select-container"]').first(),s=t(a).find('[name="task-client"]'),d=t(s).parents('[data-wdt-material-form-target="typeahead-select-container"]').first();if(r.push(i),r.push(d),o)for(let e of r){let a=t(e).find("select").first();if(t(a).trigger("wdt:undisable"),o===t(a).attr("data-service-provider"))return;t(a).attr("data-service-provider",o),t(a).trigger("wdt-clearall");let r=t(e).attr("data-action");r=r.split("?").shift(),r+="?serviceProviders[]="+o,t(e).attr("data-action",r)}else for(let e of r){let a=t(e).find("select").first();t(a).trigger("wdt-clearall"),t(a).trigger("wdt:disable"),t(a).prop("data-service-provider",!1)}let l=t.Event("wdt:select");l.label="Unassigned",l.value="-1",t(i).trigger(l)})),t(document).on("wdt:select",'[data-task-form-target="staff-select"]',(function(e){let a=this,o=e.value;parseInt(o)<=0||t.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/user/colour/",data:{user_id:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&t(a).find('select option[value="'+o+'"]').attr("data-colour",e.colour)},error:function(t){console.log(t)},complete:function(){}})})),t(document).on("click",'[data-target="task-form-container"] [data-target="task-complete"]',(function(e){let a=this,o="complete"!==t(this).attr("data-state");o?(t(a).attr("title","Complete"),t(a).attr("data-state","complete")):(t(a).attr("title","Incomplete"),t(a).attr("data-state","incomplete"));let r=t(this).parents('[data-target="task-form-container"]').first();t(r).find('[data-target="task-form-inner"] [name="task-complete"]').val(o?"true":"false")})),t(document).on("change",'[data-target="task-form-inner"] [name="task-recurring-period"]',(function(e){let a=t(this).parents('[data-target="task-form-inner"]').first(),o=t(this).val(),r=t(a).find('[data-task-form-target="recurrence-fieldset"]');o&&"post-employment-outreach"!==o?t(r).show():t(r).hide(),"post-employment-outreach"===o&&(t(a).find('[name="task-name"]').val("Post-Employment Check-In"),wdtElementNotification(t(a).find('[name="task-name"]').parents("label").first(),"Updated task name."))})),t(document).on("change",'[data-target="task-form-inner"] [data-date-change-listener][data-date-nonce]',(function(e){let a=t(this).parents('[data-target="task-form-inner"]').first();t(a).find('[data-target="date-explanation"]').hide();let o=t(this).attr("data-date-nonce"),r=t(a).find('[name="task-date"]').val(),n=t(a).find('[name="task-recurring-period"]').val(),i=1,s=!1;"post-employment-outreach"===n&&(s=!0,i=3),r&&n&&t.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/date/recurrence/",data:{nonce:o,datetime:r,period:n,number:i},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.dates.length<2)return;let o=[];for(let t of e.dates){let e=Date.parse(t),a=new Date(e);o.push(a.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}))}s&&e.dates.length>=4?t(a).find('[data-target="date-explanation"] [data-target="data-explanation-content"]').html('<p>The 1 month checkpoint is <span style="color: #0066EB">'+o[0]+'</span>. The 3 month checkpoint is <span style="color: #0066EB">'+o[1]+'</span>. The 6 month checkpoint is <span style="color: #0066EB">'+o[2]+'</span>. The 12 month checkpoint is <span style="color: #0066EB">'+o[3]+"</span>.</p>"):t(a).find('[data-target="date-explanation"] [data-target="data-explanation-content"]').html('<p>The first task is due <span style="color: #0066EB">'+o[0]+'</span>. The next due date is <span style="color: #0066EB">'+o[1]+"</span>.</p>"),t(a).find('[data-target="date-explanation"]').show()},error:function(t){console.log(t)},complete:function(){}})}))})),jQuery(document).ready((function(t){"use strict";t(document).on("wdt:initializeForm",'[data-nested-case-tasks="true"]',(function(e){t(this).find('[data-target="sub-tasks-section"]').trigger("wdt:refreshTasksContainer")})),t(document).on("wdt:refreshTasksContainer",'[data-nested-case-tasks="true"] [data-target="sub-tasks-section"]',(function(e){t(this).find('[data-target="task-forms"] li').length?t(this).show():t(this).hide()})),t(document).on("wdt:show",'[data-nested-case-tasks="true"] [data-target="wdt-nested-case-tasks-followup-container"] [data-action="create-followup"]',(function(e){t(this).parents('[data-target="wdt-nested-case-tasks-followup-container"]').first().show()})),t(document).on("wdt:hide",'[data-nested-case-tasks="true"] [data-target="wdt-nested-case-tasks-followup-container"] [data-action="create-followup"]',(function(e){t(this).parents('[data-target="wdt-nested-case-tasks-followup-container"]').first().hide()})),t(document).on("click",'[data-nested-case-tasks="true"] [data-action="create-followup"]',(function(e){let a=t(this).parents('[data-nested-case-tasks="true"]').first(),o=t(a).find('[data-target="task-form-template"]'),r=t(o).clone(),n=t("<li>"+r.html()+"</li>");t(n).find('[data-date-picker="wdt-material-form"]').removeClass("hasDatepicker").removeAttr("id").removeData("registered"),t(a).find('[data-target="task-forms"]').append(n),t(n).trigger("wdt:initializeForm"),t(n).find('[data-target="task-form-container"]').trigger("wdt:showForm"),t(a).find('[data-target="sub-tasks-section"]').trigger("wdt:refreshTasksContainer")})),t(document).on("wdt:collectCaseTasks",'[data-nested-case-tasks="true"]',(function(e){let a=this;t(a).data("wdt:caseTasks",null);let o=t(a).find('[data-target="task-forms"] [data-target="task-form-inner"]'),r=[],n=!0;o.each((function(){if(!n)return!1;t(this).trigger("wdt:buildRequestPayload");let e=t(this).data("wdt:requestPayload");if(!e)return n=!1,!1;r.push(e)})),n&&t(a).data("wdt:caseTasks",r)}))})),jQuery((function(t){t(document).on("change",'#wdt-portal-client-case-note-form select[name="employer_id"]',(function(){let e=t(this).closest("#wdt-portal-client-case-note-form"),a=t(this).val(),o=e.find('[data-case-note-form-target="employer-contact-select"]');0!==o.length&&(o.trigger("wdt-clearall"),null!==a&&""!==a?(o.attr("data-action",WDT.rest_url+"wedatatools/v1/portal/typeahead/employer-contacts?employerId="+a),o.show()):o.hide())}))})),jQuery((function(t){"use strict";let e=null;t(document).on("wdt:showPanel",'#wdt-portal [data-portal-component="wdt-portal-tipout-panel"]',(function(a){e=document.activeElement,t(this).attr("aria-hidden","false"),t(this).attr("data-state","active"),t(this).addClass("wdt-portal-tipout-panel-sh
1ow"),this.focus({preventScroll:!0})})),t(document).on("wdt:hidePanel",'#wdt-portal [data-portal-component="wdt-portal-tipout-panel"]',(function(a){t(this).attr("aria-hidden","true"),t(this).attr("data-state","inactive"),t(this).removeClass("wdt-portal-tipout-panel-show"),e&&(t(e).trigger("focus"),e=null)})),t(document).on("keydown",'#wdt-portal [data-portal-component="wdt-portal-tipout-panel"][data-state="active"]',(function(e){if("Tab"!==e.key)return;let a=t(this).find('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])').filter(":visible");if(!a.length)return;let o=a.first()[0],r=a.last()[0];e.shiftKey?document.activeElement===o&&(e.preventDefault(),r.focus()):document.activeElement===r&&(e.preventDefault(),o.focus())})),t(document).on("wdt:togglePanel",'#wdt-portal [data-portal-component="wdt-portal-tipout-panel"]',(function(e){t(this).hasClass("wdt-portal-tipout-panel-show")?t(this).trigger("wdt:hidePanel"):t(this).trigger("wdt:showPanel")})),t(document).on("wdt:showLoadingState",'#wdt-portal [data-portal-component="wdt-portal-tipout-panel"]',(function(e){t(this).find('[data-target="wdt-portal-tipout-panel-content"]').hide();let a=t(this).find('[data-target="wdt-portal-tipout-panel-right-spinner"]');t(a).length||t(this).append('<div class="wdt-spinner wdt-spinner-small" data-target="wdt-portal-tipout-panel-right-spinner"></div>')})),t(document).on("wdt:hideLoadingState",'#wdt-portal [data-portal-component="wdt-portal-tipout-panel"]',(function(e){t(this).find('[data-target="wdt-portal-tipout-panel-content"]').show(),t(this).find('[data-target="wdt-portal-tipout-panel-right-spinner"]').remove()})),t(document).on("wdt:clearPanel",'#wdt-portal [data-portal-component="wdt-portal-tipout-panel"]',(function(e){t(this).trigger("wdt:beforeClearPanel"),t(this).find('[data-target="wdt-portal-tipout-panel-content"]').empty()})),t(document).on("wdt:populatePanel",'#wdt-portal [data-portal-component="wdt-portal-tipout-panel"]',(function(e){let a=e._html;t(this).find('[data-target="wdt-portal-tipout-panel-content"]').html(a)})),t(document).on("wdt:closePanel",'#wdt-portal [data-portal-component="wdt-portal-tipout-panel"]',(function(e){t(this).trigger("wdt:clearPanel"),t(this).trigger("wdt:hidePanel")})),t(document).on("click",'#wdt-portal [data-portal-component="wdt-portal-tipout-panel"] [data-action="close-portal-tipout-panel"]',(function(e){let a=t(this).parents('[data-portal-component="wdt-portal-tipout-panel"]').first();t(a).trigger("wdt:closePanel")})),t(document).on("click",'#wdt-portal [data-portal-component="wdt-portal-tipout-panel"] [data-action="toggle-portal-tipout-panel"]',(function(e){let a=t(this).parents('[data-portal-component="wdt-portal-tipout-panel"]').first();t(a).trigger("wdt:togglePanel")})),t(document).on("click",'#wdt-portal [data-portal-component="wdt-portal-tipout-panel"]',(function(t){t.stopPropagation()})),t(document).on("click keydown",(function(e){"keydown"===e.type&&"Escape"!==e.key||t('#wdt-portal [data-portal-component="wdt-portal-tipout-panel"][data-state="active"]:not([data-toggle-shown="true"])').length&&t('#wdt-portal [data-portal-component="wdt-portal-tipout-panel"]').trigger("wdt:closePanel")}))})),jQuery((function(t){"use strict";t('[data-target="wdt-portal-chart-container"] [data-target="wdt-account-growth-breakdown"]').on("wdt:update",(function(e){let a=this,o="",r="";e.wdt&&(o=e.wdt.dateFrom?e.wdt.dateFrom:"",r=e.wdt.dateTo?e.wdt.dateTo:"");let n=t(this).attr("data-nonce"),i=t(this).parents('[data-target="wdt-portal-chart-container"]').first().find('[data-target="spinner"]'),s=setTimeout((function(){t(i).css("display","block"),t(a).css("opacity","0.5")}),200),d=this;jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/report/accounts/",data:{nonce:n,date_from:o,date_to:r},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&function(e,a){let o=t(e).parents('[data-target="wdt-portal-chart-container"]').first(),r=t(o).find('[data-target="figure"]');r.text(wdtNumberFormat(a.total));let n=r.width(),i=r.parent().width();r.css("transform","scale(1)"),n>i-15&&r.css("transform","scale("+(i-15)/n+")");let s=t(o).find('[data-target="progress-container"]'),d=s.find('[data-target="progress-item"]');d.css("width","0"),d.each((function(e){let o=t(this).attr("data-item");a.hasOwnProperty(o)&&t(this).css("width",a[o]/a.total*100+"%")}));
1let l=t(o).find('[data-target="legend-container"]'),c=l.find('[data-target="legend-item"]');c.text("0%"),c.each((function(e){let o=t(this).attr("data-item");if(a.hasOwnProperty(o)){let e=parseInt(a[o]/a.total*100);isNaN(e)&&(e=0),t(this).text(e+"%")}"unknown"===o&&0===a[o]?t(this).hide():t(this).show()}))}(d,e.result)},error:function(t){console.log(t)},complete:function(){clearTimeout(s),t(i).css("display","none"),t(d).css("opacity","1"),t(d).css("visibility","visible")}})})),t('[data-target="wdt-portal-chart-container"] [data-target="wdt-account-growth-breakdown"]').on("wdt:loaded",(function(e){t(this).attr("data-loaded","true")})),t('[data-target="wdt-portal-chart-container"] [data-target="wdt-account-growth-breakdown"]').trigger("wdt:loaded")})),jQuery((function(t){"use strict";var e,a;t('[data-target="wdt-portal-chart-container"] [data-target="wdt-accounts-snapshot-chart"]').on("wdt:update",(function(o){!function(o){let r=t(o).attr("data-nonce"),n=t(o).parents('[data-target="wdt-portal-chart-container"]').first().find('[data-target="spinner"]');t(n).css("display","block"),t(o).css("opacity","0.5"),jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/report/accounts/",data:{nonce:r},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(r){r.success&&function(o,r){let n=[r.clients,r.leads,r.staff],i=["Clients","Referrals","Staff"];r.unknown&&(n.push(r.unknown),i.push("Unknown"));e||(a=t(o).get(0),Chart.defaults.global.defaultFontFamily="proxima-nova",e=new Chart(a,{type:"doughnut",data:{datasets:[{data:n,backgroundColor:["#19448B","#23AC9F","#949494","#307fe2"]}],labels:i},options:{maintainAspectRatio:!1,cutoutPercentage:70,animation:{animateRotate:!1,animateScale:!0},legend:{position:"bottom"},elements:{center:{text:wdtNumberFormat(r.total)+" Portal Accounts",color:"#000",sidePadding:20,minFontSize:20,lineHeight:25}}}}))}(o,r.result)},error:function(t){console.log(t)},complete:function(){t(n).css("display","none"),t(o).css("opacity","1")}})}(this)})),t('[data-target="wdt-portal-chart-container"] [data-target="wdt-accounts-snapshot-chart"]').on("wdt:loaded",(function(e){t(this).attr("data-loaded","true")})),t('[data-target="wdt-portal-chart-container"] [data-target="wdt-accounts-snapshot-chart"]').trigger("wdt:loaded")})),jQuery((function(t){"use strict";var e,a;function o(t){return t.getUTCFullYear()+"-"+(t.getUTCMonth()+1).toString().padStart("2","0")+"-"+t.getUTCDate().toString().padStart("2","0")}t('[data-target="wdt-portal-chart-container"] [data-target="wdt-logins-simple-chart"]').on("wdt:update",(function(r){let n="",i="",s="all_logins";r.wdt&&(n=r.wdt.dateFrom?r.wdt.dateFrom:"",i=r.wdt.dateTo?r.wdt.dateTo:"",s=r.wdt.mode);let d=this,l=t(d).attr("data-nonce"),c=t(d).parents('[data-target="wdt-portal-chart-container"]').first().find('[data-target="spinner"]'),p=setTimeout((function(){t(c).css("display","block"),t(d).css("opacity","0.5")}),200);jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/report/logins/",data:{nonce:l,date_from:n,date_to:i},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(r){r.success&&function(r,n,i,s){let d=n,l={},c=new Date(s),p=new Date(i),u=c.getTime()-p.getTime();if(u<=0)return void console.log("Invalid date range");let f=u/864e5;c.setDate(c.getDate()-f);for(let t=0;t<=f;t++)l[o(c)]=0,c.setDate(c.getDate()+1);for(let t of d){let e=o(new Date(t));l.hasOwnProperty(e)&&l[e]++}let g=[],m=[];for(let t in l){let e=new Date(t),a={month:"short",day:"numeric",timeZone:"UTC"};g.push(e.toLocaleDateString("en-US",a)),m.push(l[t])}e?(e.data.labels=g,e.data.datasets.forEach((function(t){t.data=m})),e.update()):(a=t(r).get(0),e=new Chart(a,{type:"line",data:{labels:g,datasets:[{label:"Logins",data:m,fill:!1,backgroundColor:"#1A7FE2",borderColor:"#1A7FE2",tension:.3,borderJoinStyle:"round",pointStyle:"circle",pointRadius:1,pointHitRadius:10,pointHoverRadius:10,pointHoverBackgroundColor:"#BDDEF1",pointHoverBorderColor:"#1A7FE2",pointHoverBorderWidth:3,clip:!1}]},options:{maintainAspectRatio:!1,legend:{display:!1},scales:{yAxes:[{ticks:{autoSkip:!0,autoSkipPadding:50,beginAtZero:!0,suggestedMax:10}}],xAxes:[{gridLines:{display:!1},ticks:{autoSkip:!0,autoSkipPadding:66,maxRotation:0}}]},legend:{position:"bottom",display:!1}}}))}(d,r.result[s],n,i)},error:function(t){console.log(t)},complete:function(){clearTimeout(p),t(c).css("display","none"),t(d).css("opacity","1")}})})),t('[data-target="wdt-portal-chart-container"] [data-target="wdt-logins-simple-chart"]').on("wdt:loaded",(function(e){t(this).attr("data-loaded","true")})),t('[data-target="wdt-portal-chart-container"] [data-target="wdt-logins-simple-chart"]').trigger("wdt:loaded")})),jQuery((function(t){"use strict";var e,a;t('[data-target="wdt-portal-chart-container"] [data-target="wdt-most-active-chart"]').on("wdt:update",(function(o){let r="",n="all";o.wdt&&(r=o.wdt.dateFrom,n=o.wdt.mode),function(o,r,n){let i=t(o).attr("data-nonce"),s=t(o).parents('[data-target="wdt-portal-chart-container"]').first().find('[data-target="spinner"]');t(s).css("display","block"),t(o).css("opacity","0.5"),jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/report/active-users/",data:{nonce:i,mode:r,date_from:n},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(n){n.success&&n.result&&n.result.hasOwnProperty(r)&&function(o,r){let n=[],i=[];for(let t of r)n.push(t.count),i.push(t.name);let s=[];for(let t of i){let e=20,a=[],o="",r=t.split(" ");for(let t=0;t<r.length;t++){let n=r[t];t==r.length-1?(o.length+n.length>e&&(a.push(o),o=""),o+=n,a.push(o)):o.length+n.length>e?(o.length>0&&(a.push(o),o=""),o+=n+" "):o+=n+" "}s.push(a)}
1i=s,e?(e.data.labels=i,e.data.datasets.forEach((t=>{t.data=n})),e.update()):(Chart.defaults.global.defaultFontFamily="proxima-nova",a=t(o).get(0),e=new Chart(a,{type:"horizontalBar",data:{datasets:[{label:"Logins",data:n,backgroundColor:"#00448B",barThickness:25}],labels:i},options:{maintainAspectRatio:!1,legend:{display:!1},scales:{yAxes:[{gridLines:{display:!1}}],xAxes:[{ticks:{suggestedMin:0,precision:0,beginAtZero:!0}}]}}}))}(o,n.result[r])},error:function(t){console.log(t)},complete:function(){t(s).css("display","none"),t(o).css("opacity","1")}})}(this,n,r)})),t('[data-target="wdt-portal-chart-container"] [data-target="wdt-most-active-chart"]').on("wdt:loaded",(function(e){t(this).attr("data-loaded","true")})),t('[data-target="wdt-portal-chart-container"] [data-target="wdt-most-active-chart"]').trigger("wdt:loaded")})),jQuery((function(t){"use strict";var e,a;function o(t){return t.getUTCFullYear()+"-"+(t.getUTCMonth()+1).toString().padStart("2","0")+"-"+t.getUTCDate().toString().padStart("2","0")}t('[data-target="wdt-portal-chart-container"] [data-target="wdt-resumes-simple-chart"]').on("wdt:update",(function(r){let n="",i="",s="all";r.wdt&&(n=r.wdt.dateFrom?r.wdt.dateFrom:"",i=r.wdt.dateTo?r.wdt.dateTo:"",s=r.wdt.mode);let d=this,l=t(d).attr("data-nonce"),c=t(d).parents('[data-target="wdt-portal-chart-container"]').first().find('[data-target="spinner"]'),p=setTimeout((function(){t(c).css("display","block"),t(d).css("opacity","0.5")}),200);jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/report/resumes/",data:{nonce:l,date_from:n,date_to:i},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(r){r.success&&function(r,n,i,s){let d=t(r).parents('[data-target="wdt-portal-chart-container"]').first(),l=n,c={},p=new Date(s),u=new Date(i),f=p.getTime()-u.getTime();if(f<=0)return void console.log("Invalid date range");let g=f/864e5;p.setDate(p.getDate()-g);for(let t=0;t<=g;t++)c[o(p)]={edited:0,created:0,viewed:0},p.setDate(p.getDate()+1);for(let t in l)for(let e of l[t]){let a=o(new Date(e));c.hasOwnProperty(a)&&c[a][t]++}let m=[];e||(Chart.defaults.global.defaultFontFamily="proxima-nova",a=t(r).get(0),e=new Chart(a,{type:"line",data:{labels:[],datasets:[{label:"Edited",data:[],fill:!1,borderColor:"#1A7FE2",backgroundColor:"#1A7FE2",tension:.3,borderJoinStyle:"round",pointStyle:"circle",pointRadius:1,pointHitRadius:10,pointHoverRadius:10,pointHoverBackgroundColor:"#BDDEF1",pointHoverBorderColor:"#1A7FE2",pointHoverBorderWidth:3,clip:!1},{label:"Created",data:[],fill:!1,borderColor:"#23AC9F",backgroundColor:"#23AC9F",tension:.3,borderJoinStyle:"round",pointStyle:"circle",pointRadius:1,pointHitRadius:10,pointHoverRadius:10,pointHoverBackgroundColor:"#c2e8d3",pointHoverBorderColor:"#23AC9F",pointHoverBorderWidth:3,clip:!1},{label:"Viewed",data:[],fill:!1,borderColor:"#84889F",backgroundColor:"#84889F",tension:.3,borderJoinStyle:"round",pointStyle:"circle",pointRadius:1,pointHitRadius:10,pointHoverRadius:10,pointHoverBackgroundColor:"#dadee1",pointHoverBorderColor:"#84889F",pointHoverBorderWidth:3,clip:!1}]},options:{maintainAspectRatio:!1,scales:{yAxes:[{ticks:{autoSkip:!0,autoSkipPadding:50,beginAtZero:!0,precision:0,suggestedMax:10}}],xAxes:[{gridLines:{display:!1},ticks:{autoSkip:!0,autoSkipPadding:66,maxRotation:0}}]},legend:{display:!1},legendCallback:function(t){var e=document.createElement("ul");return t.data.datasets.forEach((function(t,a){e.innerHTML+=`\n                               <li>\n                                  <div class="wdt-portal-resumes-chart-legend-icon" style="background-color: ${t.backgroundColor}"></div>\n                                 ${t.label}\n                              </li>\n                           `})),e.outerHTML}}}));t(d).find('[data-target="wdt-portal-resumes-chart-legend"]').html(e.generateLegend()),e.data.labels=m,e.data.datasets.forEach((function(t){t.data=[]}));for(let t in c){let a=new Date(t),o={month:"short",day:"numeric",timeZone:"UTC"};m.push(a.toLocaleDateString("en-US",o)),e.data.datasets[0].data.push(c[t].edited),e.data.datasets[1].data.push(c[t].created),e.data.datasets[2].data.push(c[t].viewed)}
1e.update()}(d,r.result[s],n,i)},error:function(t){console.log(t)},complete:function(){clearTimeout(p),t(c).css("display","none"),t(d).css("opacity","1")}})})),t('[data-target="wdt-portal-chart-container"] [data-target="wdt-resumes-simple-chart"]').on("wdt:loaded",(function(e){t(this).attr("data-loaded","true")})),t('[data-target="wdt-portal-chart-container"] [data-target="wdt-resumes-simple-chart"]').trigger("wdt:loaded")})),jQuery((function(t){"use strict";var e,a;t('[data-target="wdt-portal-chart-container"] [data-target="wdt-resumes-snapshot-chart"]').on("wdt:update",(function(o){!function(o){let r=t(o).attr("data-nonce"),n=t(o).parents('[data-target="wdt-portal-chart-container"]').first().find('[data-target="spinner"]');t(n).css("display","block"),t(o).css("opacity","0.5"),jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/report/resumes-snapshot/",data:{nonce:r},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(r){r.success&&function(o,r){let n=[r.clients,r.leads,r.staff],i=["Clients","Referrals","Staff"];r.unknown&&(n.push(r.unknown),i.push("Unknown"));e||(a=t(o).get(0),Chart.defaults.global.defaultFontFamily="proxima-nova",e=new Chart(a,{type:"doughnut",data:{datasets:[{data:n,backgroundColor:["#19448B","#23AC9F","#949494","#307fe2"]}],labels:i},options:{maintainAspectRatio:!1,cutoutPercentage:70,animation:{animateRotate:!1,animateScale:!0},legend:{position:"bottom"},elements:{center:{text:r.total+" Resumes",color:"#000",sidePadding:20,minFontSize:20,lineHeight:25}}}}))}(o,r.result)},error:function(t){console.log(t)},complete:function(){t(n).css("display","none"),t(o).css("opacity","1")}})}(this)})),t('[data-target="wdt-portal-chart-container"] [data-target="wdt-resumes-snapshot-chart"]').on("wdt:loaded",(function(e){t(this).attr("data-loaded","true")})),t('[data-target="wdt-portal-chart-container"] [data-target="wdt-resumes-snapshot-chart"]').trigger("wdt:loaded")})),jQuery((function(t){"use strict";var e,a;t('[data-target="wdt-portal-chart-container"] [data-target="wdt-top-viewed-chart"]').on("wdt:update",(function(o){let r="",n="",i="companies";o.wdt&&(r=o.wdt.dateFrom?o.wdt.dateFrom:"",n=o.wdt.dateTo?o.wdt.dateTo:"",i=o.wdt.mode);let s=this,d=t(s).attr("data-nonce"),l=t(s).parents('[data-target="wdt-portal-chart-container"]').first().find('[data-target="spinner"]'),c=setTimeout((function(){t(l).css("display","block"),t(s).css("opacity","0.5")}),200);jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/report/views/",data:{nonce:d,mode:i,date_from:r,date_to:n},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(o){o.success&&function(o,r){let n=[],i=[];for(let t of r)n.push(t.views),i.push(t.title);let s=[];for(let t of i){let e=20,a=[],o="",r=t.split(" ");for(let t=0;t<r.length;t++){let n=r[t];t==r.length-1?(o.length+n.length>e&&(a.push(o),o=""),o+=n,a.push(o)):o.length+n.length>e?(o.length>0&&(a.push(o),o=""),o+=n+" "):o+=n+" "}s.push(a)}i=s,e?(e.data.labels=i,e.data.datasets.forEach((t=>{t.data=n})),e.update()):(Chart.defaults.global.defaultFontFamily="proxima-nova",a=t(o).get(0),e=new Chart(a,{type:"horizontalBar",data:{datasets:[{label:"Views",data:n,backgroundColor:"#00448B",barThickness:25}],labels:i},options:{maintainAspectRatio:!1,legend:{display:!1},scales:{yAxes:[{gridLines:{display:!1}}],xAxes:[{ticks:{suggestedMin:0,precision:0,beginAtZero:!0}}]}}}))}(s,o.result)},error:function(t){console.log(t)},complete:function(){clearTimeout(c),t(l).css("display","none"),t(s).css("opacity","1")}})})),t('[data-target="wdt-portal-chart-container"] [data-target="wdt-top-viewed-chart"]').on("wdt:loaded",(function(e){t(this).attr("data-loaded","true")})),t('[data-target="wdt-portal-chart-container"] [data-target="wdt-top-viewed-chart"]').trigger("wdt:loaded")})),jQuery((function(t){"use strict";t(document).on("wdt:update",'[data-target="wdt-portal-chart-container"] [data-target="wdt-wage-insights-chart"]',(function(e){let a="",o="";e.wdt&&(a=e.wdt.dateFrom?e.wdt.dateFrom:"",o=e.wdt.dateTo?e.wdt.dateTo:"");let r=this,n=t(r).attr("data-nonce"),i=t(r).parents('[data-target="wdt-portal-chart-container"]').first().find('[data-target="spinner"]'),s=[],d=t(r).attr("data-occupations");d&&(s=d.split("|"));let l=[],c=t(r).attr("data-sectors");c&&(l=c.split("|"));let p=[],u=t(r).attr("data-employers");u&&(p=u.split("|"));let f=setTimeout((function(){t(i).css("display","block"),t(r).css("opacity","0.5")}),200),g={nonce:n,start_date:a,end_date:o};s&&(g.noc_slugs_2021=s),l&&(g.sector_slugs=l),p&&(g.employer_slugs=p),jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/wages/breakdown/individual/",data:g,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&e.body&&function(e,a){let o=[""],r=[],n={},i=t(e).data("chartObj");i&&i.destroy();t(e).prev('[data-target="wdt-wage-insights-chart-explanation"]').remove(),t(e).hide();t(e).parents('[data-target="wdt-portal-chart-container"]').first();let s=[],d=t(e).attr("data-occupations");d&&(s=d.split("|"));let l=[],c=t(e).attr("data-sectors");c&&(l=c.split("|"));let p=[],u=t(e).attr("data-employers");u&&(p=u.split("|"));if(0==s.length&&0==l.length&&0==p.length)return void t(e).before('<p data-target="wdt-wage-insights-chart-explanation">No items specified for this view. Please review your followed Occupations, Sectors, or Companies.</p>');if(!(a.nocs_2021&&0!=a.nocs_2021.length||a.naics&&0!=a.naics.length||a.employer_slug&&0!=a.employer_slug.length))return void t(e).before('<p data-target="wdt-wage-insights-chart-explanation">No results found, please try adjusting the date range.</p>');t(e).show();for(let t of s)if(a.nocs_2021&&a.nocs_2021[t]){let e=a.nocs_2021[t],i=e.label;i.length>50&&(i=i.substring(0,50)+"..."),o.push(i);let s=o.length-1;n[s]={}
1,n[s][e[0]]="Lowest Observed",n[s][e[50]]="Median",n[s][e[100]]="Highest Observed",r.push({label:e.label,data:[{x:e[0],y:s},{x:e[50],y:s},{x:e[100],y:s}],fill:!1,backgroundColor:"#307fe2",borderColor:"#307fe2",pointStyle:function(t){return t.dataIndex%2==0?"line":"circle"},pointRadius:function(t){t.dataIndex;return 7},pointBorderWidth:function(t){return t.dataIndex%2==0?3:1},pointRotation:90,pointHitRadius:7,pointHoverRadius:7,pointHoverBackgroundColor:"#307fe2",pointHoverBorderColor:"#307fe2",pointHoverBorderWidth:3,clip:!1,showLine:!0})}for(let t of l)if(a.naics&&a.naics[t]){let e=a.naics[t];o.push(e.label);let i=o.length-1;n[i]={},n[i][e[0]]="Lowest Observed",n[i][e[50]]="Median",n[i][e[100]]="Highest Observed",r.push({label:e.label,data:[{x:e[0],y:i},{x:e[50],y:i},{x:e[100],y:i}],fill:!1,backgroundColor:"#307fe2",borderColor:"#307fe2",pointStyle:function(t){return t.dataIndex%2==0?"line":"circle"},pointRadius:function(t){t.dataIndex;return 7},pointBorderWidth:function(t){return t.dataIndex%2==0?3:1},pointRotation:90,pointHitRadius:7,pointHoverRadius:7,pointHoverBackgroundColor:"#307fe2",pointHoverBorderColor:"#307fe2",pointHoverBorderWidth:3,clip:!1,showLine:!0})}for(let t of p)if(a.employer_slug&&a.employer_slug[t]){let e=a.employer_slug[t];o.push(e.label);let i=o.length-1;n[i]={},n[i][e[0]]="Lowest Observed",n[i][e[50]]="Median",n[i][e[100]]="Highest Observed",r.push({label:e.label,data:[{x:e[0],y:i},{x:e[50],y:i},{x:e[100],y:i}],fill:!1,backgroundColor:"#307fe2",borderColor:"#307fe2",pointStyle:function(t){return t.dataIndex%2==0?"line":"circle"},pointRadius:function(t){t.dataIndex;return 7},pointBorderWidth:function(t){return t.dataIndex%2==0?3:1},pointRotation:90,pointHitRadius:7,pointHoverRadius:7,pointHoverBackgroundColor:"#307fe2",pointHoverBorderColor:"#307fe2",pointHoverBorderWidth:3,clip:!1,showLine:!0})}let f=[];for(let t of o){let e=20,a=[],o="",r=t.split(" ");for(let t=0;t<r.length;t++){let n=r[t];t==r.length-1?(o.length+n.length>e&&(a.push(o),o=""),o+=n,a.push(o)):o.length+n.length>e?(o.length>0&&(a.push(o),o=""),o+=n+" "):o+=n+" "}f.push(a)}o=f,t(e).data("ctx",t(e).get(0));let g=t(e).data("ctx");i=new Chart(g,{type:"scatter",data:{yLabels:o,datasets:r},options:{maintainAspectRatio:!1,responsive:!0,onResize:function(t,e){var a=t.chart.width;let o=3*a/100,r=0;a<350&&(o=4*a/100,r=45),o>16&&(o=16),t.scales["y-axis-1"].options.ticks.fontSize=o,t.scales["y-axis-1"].options.ticks.minRotation=r},scales:{yAxes:[{gridLines:{display:!1},ticks:{padding:15,beginAtZero:!0,stepSize:1,autoSkip:!1,fontFamily:"proxima-nova",reverse:!0,fontColor:"#000000",alignment:"start",callback:function(t,e,a){return o[t]?o[t]:""}}}],xAxes:[{position:"bottom",ticks:{beginAtZero:!0,fontSize:15,callback:function(t,e,a){return function(t,e){const a=/\.0+$|(\.[0-9]*[1-9])0+$/;var o=[{value:1,symbol:""},{value:1e3,symbol:"k"},{value:1e6,symbol:"M"},{value:1e9,symbol:"G"},{value:1e12,symbol:"T"},{value:1e15,symbol:"P"},{value:1e18,symbol:"E"}].slice().reverse().find((function(e){return t>=e.value}));return o?(t/o.value).toFixed(e).replace(a,"$1")+o.symbol:"0"}(t)}}}]},legend:{position:"bottom",display:!1},tooltips:{enabled:!1,custom:function(t){var e=document.getElementById("wdt-chartjs-custom-tooltip");if(e||((e=document.createElement("div")).id="wdt-chartjs-custom-tooltip",document.body.appendChild(e)),0!==t.opacity){if(e.classList.remove("above","below","no-transform"),t.yAlign?e.classList.add(t.yAlign):e.classList.add("no-transform"),t.body){t.title;var a=t.body[0].lines[0];let o=(a=a.substring(1,a.length-1)).split(", "),r=n[o[1]][o[0]];e.innerHTML='<div style="font-size: 13px; color: #000; line-height: 18px; text-transform: uppercase; font-weight: 400; letter-spacing: 0.3px;">'+r+'</div><div style="font-size: 15px; color: #000; font-weight: bold; line-height: 18px;">'+parseInt(o[0]).toLocaleString("en-US",{style:"currency",currency:"USD"})+"</div>"}var o=this._chart.canvas.getBoundingClientRect();e.style.opacity=1,e.style.position="absolute",e.style.left=o.left+window.pageXOffset+t.caretX+"px",e.style.top=o.top+window.pageYOffset+t.caretY+"px",e.style.fontFamily=t._bodyFontFamily,e.style.fontSize=t.bodyFontSize+"px",e.style.fontStyle=t._body
1FontStyle,e.style.padding=t.yPadding+"px "+t.xPadding+"px",e.style.pointerEvents="none",e.style["background-color"]="#D8DBE5",e.style.border="1px solid #C9C9C9",e.style.transform="translate(-50%, calc( -100% - 10px ) )"}else e.style.opacity=0}}}}),i.data.datasets=r,i.options.scales.yAxes[0].ticks.suggestedMax=f.length;var m=i.chart.width;let w=3*m/100,h=0;m<350&&(w=4*m/100,h=45);w>16&&(w=16);i.scales["y-axis-1"].options.ticks.fontSize=w,i.scales["y-axis-1"].options.ticks.minRotation=h,i.update(),t(e).data("chartObj",i)}(r,e.body)},error:function(t){console.log(t)},complete:function(){clearTimeout(f),t(i).css("display","none"),t(r).css("opacity","1")}})})),t('[data-target="wdt-portal-chart-container"] [data-target="wdt-wage-insights-chart"]').on("wdt:loaded",(function(e){t(this).attr("data-loaded","true")})),t('[data-target="wdt-portal-chart-container"] [data-target="wdt-wage-insights-chart"]').trigger("wdt:loaded")})),jQuery((function(t){"use strict";function e(t){return t.getUTCFullYear()+"-"+(t.getUTCMonth()+1).toString().padStart("2","0")+"-"+t.getUTCDate().toString().padStart("2","0")}t(document).on("wdt:update",'[data-target="wdt-portal-chart-container"] [data-target="wdt-job-activity-chart-strip"]',(function(e){t(this).data("chart",null),t(this).data("ctx",null);let a="",o="";e.wdt&&(a=e.wdt.dateFrom?e.wdt.dateFrom:"",o=e.wdt.dateTo?e.wdt.dateTo:"");let r=this,n=t(r).attr("data-nonce"),i=t(r).parents('[data-target="wdt-portal-chart-container"]').first().find('[data-target="spinner"]'),s=setTimeout((function(){t(i).css("display","block"),t(r).css("opacity","0.5")}),200),d=[],l=t(r).attr("data-occupations");l&&(d=l.split("|"));let c=[],p=t(r).attr("data-sectors");p&&(c=p.split("|"));let u=[],f=t(r).attr("data-employers");f&&(u=f.split("|"));let g={nonce:n,start_date:a,end_date:o};d&&(g.noc_2021_slugs=d),c&&(g.sector_slugs=c),u&&(g.employer_slugs=u),jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/job-posting-history/day/",data:g,beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){if(e.success&&e.body&&e.body.day_buckets){let n=t.Event("wdt:refreshchart");n._data=e.body.day_buckets,n._dateFrom=a,n._dateTo=o,t(r).trigger(n)}},error:function(t){console.log(t)},complete:function(){clearTimeout(s),t(i).css("display","none"),t(r).css("opacity","1")}})})),t(document).on("wdt:refreshchart",'[data-target="wdt-portal-chart-container"] [data-target="wdt-job-activity-chart-strip"]',(function(a){let o=t(this),r=a._data,n=a._dateFrom,i=a._dateTo,s=(t(o).parents('[data-target="wdt-portal-chart-container"]').first(),{}),d=new Date(i),l=new Date(n),c=d.getTime()-l.getTime();if(c<=0)return void console.log("Invalid date range");let p=c/864e5;d.setDate(d.getDate()-p);for(let t=0;t<=p;t++)s[e(d)]=0,d.setDate(d.getDate()+1);for(let t in r){let a=r[t].total;s[e(new Date(t))]=a}let u=t(this).data("chartObj");if(!u){t(o).data("ctx",t(o).get(0));let e=t(o).data("ctx");u=new Chart(e,{type:"line",data:{labels:[],datasets:[{label:"Total",data:[],fill:!1,backgroundColor:"#307fe2",borderColor:"#307fe2",tension:0,borderJoinStyle:"round",pointStyle:"circle",pointRadius:1,pointHitRadius:7,pointHoverRadius:7,pointHoverBackgroundColor:"#307fe2",pointHoverBorderColor:"#307fe2",pointHoverBorderWidth:3,clip:!1}]},options:{maintainAspectRatio:!1,responsive:!0,legend:{display:!1},scales:{yAxes:[{gridLines:{display:!1},ticks:{display:!1,autoSkip:!0,autoSkipPadding:50,beginAtZero:!0,suggestedMax:10}}],xAxes:[{gridLines:{display:!1},ticks:{display:!1,autoSkip:!0,autoSkipPadding:66,maxRotation:0}}]},legend:{position:"bottom",display:!1},tooltips:{enabled:!1,custom:function(t){var e=document.getElementById("wdt-chartjs-custom-tooltip");if(e||((e=document.createElement("div")).id="wdt-chartjs-custom-tooltip",document.body.appendChild(e)),0!==t.opacity){if(e.classList.remove("above","below","no-transform"),t.yAlign?e.classList.add(t.yAlign):e.classList.add("no-transform"),t.title&&t.body){let a=t.title[0],o=t.body[0].lines[0];e.innerHTML='<div style="font-size: 13px; color: #000; line-height: 18px; text-transform: uppercase; font-weight: 400; letter-spacing: 0.3px;">'+a+'</div><div style="font-size: 15px; color: #000; font-weight: bold; line-height: 18px;">'+o+" Posts</div>"}var a=this._chart.canvas.getBoundingClientRect();e.style.opacity=1,e.style.position="absolute",e.style.left=a.left+window.pageXOffset+t.caretX+"px",e.style.top=a.top+window.pageYOffset+t.caretY+"px",e.style.fontFamily=t._bodyFontFamily,e.style.fontSize=t.bodyFontSize+"px",e.style.fontStyle=t._body
1FontStyle,e.style.padding=t.yPadding+"px "+t.xPadding+"px",e.style.pointerEvents="none",e.style["background-color"]="#D8DBE5",e.style.border="1px solid #C9C9C9",e.style.transform="translate(-50%, calc( -100% - 10px ) )"}else e.style.opacity=0}}}})}u.data.labels=[],u.data.datasets.forEach((function(t){t.data=[]}));for(let t in s){let e=new Date(t),a={month:"short",day:"numeric",timeZone:"UTC"};u.data.labels.push(e.toLocaleDateString("en-US",a)),u.data.datasets[0].data.push(s[t])}u.update(),t(this).data("chartObj",u)})),t('[data-target="wdt-portal-chart-container"] [data-target="wdt-job-activity-chart-strip"]').on("wdt:loaded",(function(e){t(this).attr("data-loaded","true")})),t('[data-target="wdt-portal-chart-container"] [data-target="wdt-job-activity-chart-strip"]').trigger("wdt:loaded")})),jQuery((function(t){"use strict";var e,a;function o(t){return t.getUTCFullYear()+"-"+(t.getUTCMonth()+1).toString().padStart("2","0")+"-"+t.getUTCDate().toString().padStart("2","0")}t('[data-target="wdt-portal-chart-container"] [data-target="wdt-logins-full-chart"]').on("wdt:update",(function(r){let n="",i="";r.wdt&&(n=r.wdt.dateFrom?r.wdt.dateFrom:"",i=r.wdt.dateTo?r.wdt.dateTo:"");let s=this,d=t(s).attr("data-nonce"),l=t(s).parents('[data-target="wdt-portal-chart-container"]').first().find('[data-target="spinner"]'),c=setTimeout((function(){t(l).css("display","block"),t(s).css("opacity","0.5")}),200);jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/report/logins/",data:{nonce:d,date_from:n,date_to:i},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(r){r.success&&function(r,n,i,s){let d=t(r).parents('[data-target="wdt-portal-chart-container"]').first(),l={},c=new Date(s),p=new Date(i),u=c.getTime()-p.getTime();if(u<=0)return void console.log("Invalid date range");let f=u/864e5;c.setDate(c.getDate()-f);for(let t=0;t<=f;t++)l[o(c)]={all_logins:0,staff_logins:0,client_logins:0},c.setDate(c.getDate()+1);for(let t in n)for(let e of n[t]){let a=o(new Date(e));l.hasOwnProperty(a)&&l[a].hasOwnProperty(t)&&l[a][t]++}e||(a=t(r).get(0),e=new Chart(a,{type:"line",data:{labels:[],datasets:[{label:"Total",data:[],fill:!1,backgroundColor:"#1A7FE2",borderColor:"#1A7FE2",tension:.3,borderJoinStyle:"round",pointStyle:"circle",pointRadius:1,pointHitRadius:10,pointHoverRadius:10,pointHoverBackgroundColor:"#BDDEF1",pointHoverBorderColor:"#1A7FE2",pointHoverBorderWidth:3,clip:!1},{label:"Staff",data:[],fill:!1,backgroundColor:"#23AC9F",borderColor:"#23AC9F",tension:.3,borderJoinStyle:"round",pointStyle:"circle",pointRadius:1,pointHitRadius:10,pointHoverRadius:10,pointHoverBackgroundColor:"#c2e8d3",pointHoverBorderColor:"#23AC9F",pointHoverBorderWidth:3,clip:!1},{label:"Clients",data:[],fill:!1,backgroundColor:"#84889F",borderColor:"#84889F",tension:.3,borderJoinStyle:"round",pointStyle:"circle",pointRadius:1,pointHitRadius:10,pointHoverRadius:10,pointHoverBackgroundColor:"#dadee1",pointHoverBorderColor:"#84889F",pointHoverBorderWidth:3,clip:!1}]},options:{maintainAspectRatio:!1,responsive:!0,legend:{display:!1},scales:{yAxes:[{ticks:{autoSkip:!0,autoSkipPadding:50,beginAtZero:!0,suggestedMax:10}}],xAxes:[{gridLines:{display:!1},ticks:{autoSkip:!0,autoSkipPadding:66,maxRotation:0}}]},legend:{position:"bottom",display:!1},legendCallback:function(t){var e=document.createElement("ul");return t.data.datasets.forEach((function(t,a){e.innerHTML+=`\n                               <li>\n                                  <div class="wdt-portal-logins-full-legend-icon" style="background-color: ${t.backgroundColor}"></div>\n                                 ${t.label}\n                              </li>\n                           `})),e.outerHTML}}}));t(d).find('[data-target="wdt-portal-logins-full-legend"]').html(e.generateLegend()),e.data.labels=[],e.data.datasets.forEach((function(t){t.data=[]}));for(let t in l){let a=new Date(t),o={month:"short",day:"numeric",timeZone:"UTC"};e.data.labels.push(a.toLocaleDateString("en-US",o)),e.data.datasets[0].data.push(l[t].all_logins),e.data.datasets[1].data.push(l[t].staff_logins),e.data.datasets[2].data.push(l[t].client_logins)}
1e.update()}(s,r.result,n,i)},error:function(t){console.log(t)},complete:function(){clearTimeout(c),t(l).css("display","none"),t(s).css("opacity","1")}})})),t('[data-target="wdt-portal-chart-container"] [data-target="wdt-logins-full-chart"]').on("wdt:loaded",(function(e){t(this).attr("data-loaded","true")})),t('[data-target="wdt-portal-chart-container"] [data-target="wdt-logins-full-chart"]').trigger("wdt:loaded")})),jQuery((function(t){"use strict";t('[data-target="portal-analytics-clients-table"]').on("wdt:response",(function(e){let a=t(this).parents('[data-target="portal-table-container"]').first(),o=e.wdt.body;if(o.clients.length){t(a).find('[data-target="portal-table-body"]').html("");for(let e of o.clients){let o=t(t(a).find('[data-target="template-table"]').get(0).content).find('[data-target="template-row"]').clone(),r=o.find('td[data-column="user"]');if(!(r.length&&e.first_name&&e.last_name&&e.id))continue;r.text(e.first_name+" "+e.last_name);let n=o.find('td[data-column="active"]');n.length&&e.last_login&&n.text(e.last_login);let i=o.find('td[data-column="logins"]');i.length&&e.events&&e.events.login&&i.text(wdtNumberFormat(e.events.login));let s=o.find('td[data-column="resumes"]');s.length&&e.events&&e.events["edit-resume"]&&s.text(wdtNumberFormat(e.events["edit-resume"]));let d=o.find('td[data-column="suggestions"]');if(d.length&&e.events){let t=0;e.events["accept-company"]&&(t+=e.events["accept-company"]),e.events["accept-occupation"]&&(t+=e.events["accept-occupation"]),e.events["accept-sector"]&&(t+=e.events["accept-sector"]),d.text(wdtNumberFormat(t))}let l=o.find('td[data-column="occupations"]');l.length&&e.events&&e.events["follow-occupation"]&&l.text(wdtNumberFormat(e.events["follow-occupation"]));let c=o.find('td[data-column="sectors"]');c.length&&e.events&&e.events["follow-sector"]&&c.text(wdtNumberFormat(e.events["follow-sector"]));let p=o.find('td[data-column="companies"]');p.length&&e.events&&e.events["follow-company"]&&p.text(wdtNumberFormat(e.events["follow-company"])),t(a).find('[data-target="portal-table-body"]').append(o)}}else t(a).find('[data-target="portal-table-body"]').append('<tr><td colspan="999">No results found.</td></tr>')})),t('[data-target="portal-analytics-clients-table"]').on("wdt:update",(function(e){let a=e.wdt&&e.wdt.perPage?e.wdt.perPage:25,o=e.wdt&&e.wdt.query?e.wdt.query:"",r=e.wdt&&e.wdt.role?e.wdt.role:["client","lead"],n=t(this).attr("data-nonce"),i=t(this).parents('[data-target="portal-table-container"]').first(),s=this;jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/clients/",data:{nonce:n,number:a,query:o,types:r,include_analytics:!0,report_context:!0},beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(i).find('[data-target="portal-table-body"]').html(""),t(i).find('[data-target="spinner"]').show()},success:function(e){if(e.success){let a=t.Event("wdt:response");a.wdt={},a.wdt.body=e.body,t(s).trigger(a)}},error:function(t){wdtDisplayNotification("Unable to retrieve clients. Please contact administrator.","error",-1),console.log(t)},complete:function(){t(i).find('[data-target="spinner"]').hide()}})})),t('[data-target="portal-analytics-clients-table"]').on("wdt:loaded",(function(e){t(this).attr("data-loaded","true")})),t('[data-target="portal-analytics-clients-table"]').trigger("wdt:loaded")})),jQuery((function(t){"use strict";t('[data-target="wdt-portal-chart-container"] [data-target="wdt-resumes-growth-breakdown"]').on("wdt:update",(function(e){let a="",o="";e.wdt&&(a=e.wdt.dateFrom,o=e.wdt.dateTo);let r=this,n=t(r).attr("data-nonce"),i=t(r).parents('[data-target="wdt-portal-chart-container"]').first().find('[data-target="spinner"]'),s=setTimeout((function(){t(i).css("display","block"),t(r).css("opacity","0.5")}),200);jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/report/resumes-snapshot/",data:{nonce:n,date_from:a,date_to:o},beforeSend:t=>{t.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce)},success:function(e){e.success&&function(e,a){let o=t(e).parents('[data-target="wdt-portal-chart-container"]').first(),r=t(o).find(wdtNumberFormat('[data-target="figure"]'));r.text(a.total);let n=r.width(),i=r.parent().width();r.css("transform","scale(1)"),n>i-15&&r.css("transform","scale("+(i-15)/n+")");let s=t(o).find('[data-target="progress-container"]'),d=s.find('[data-target="progress-item"]');d.css("width","0"),d.each((function(e){let o=t(this).attr("data-item");a.hasOwnProperty(o)&&t(this).css("width",a[o]/a.total*100+"%")}));
1let l=t(o).find('[data-target="legend-container"]'),c=l.find('[data-target="legend-item"]');c.text("0%"),c.each((function(e){let o=t(this).attr("data-item");if(a.hasOwnProperty(o)){let e=parseInt(a[o]/a.total*100);isNaN(e)&&(e=0),t(this).text(e+"%")}"unknown"===o&&0===a[o]?t(this).hide():t(this).show()}))}(r,e.result)},error:function(t){console.log(t)},complete:function(){clearTimeout(s),t(i).css("display","none"),t(r).css("opacity","1"),t(r).css("visibility","visible")}})})),t('[data-target="wdt-portal-chart-container"] [data-target="wdt-resumes-growth-breakdown"]').on("wdt:loaded",(function(e){t(this).attr("data-loaded","true")})),t('[data-target="wdt-portal-chart-container"] [data-target="wdt-resumes-growth-breakdown"]').trigger("wdt:loaded")})),jQuery((function(t){"use strict";t('[data-target="portal-activity-table"]').on("wdt:response",(function(e){let a=t(this).parents('[data-target="portal-table-container"]').first(),o=function(t){let e=[];for(let a in t)e.push({label:a,data:t[a]});return e}(e.wdt.result);if(o.length){o.sort((function(t,e){return e.data.all-t.data.all}));for(let e of o){let o=t(t(a).find('[data-target="template-table"]').get(0).content).find('[data-target="template-row"]').clone(),r=o.find('td[data-column="activities"]');r.length&&e.label&&r.text(e.label);let n=o.find('td[data-column="all"]');n.length&&e.data.all&&n.text(wdtNumberFormat(e.data.all));let i=o.find('td[data-column="staff"]');i.length&&e.data.staff&&i.text(wdtNumberFormat(e.data.staff));let s=o.find('td[data-column="clients"]');s.length&&e.data.client&&s.text(wdtNumberFormat(e.data.client));let d=o.find('td[data-column="leads"]');d.length&&e.data.lead&&d.text(wdtNumberFormat(e.data.lead)),t(a).find('[data-target="portal-table-body"]').append(o)}}else t(a).find('[data-target="portal-table-body"]').append('<tr><td colspan="999">No results found.</td></tr>')})),t('[data-target="portal-activity-table"]').on("wdt:update",(function(e){let a=e.wdt&&e.wdt.perPage?e.wdt.perPage:-1,o=e.wdt&&e.wdt.dateFrom?e.wdt.dateFrom:"",r=e.wdt&&e.wdt.dateTo?e.wdt.dateTo:"",n=t(this).attr("data-nonce"),i=t(this).parents('[data-target="portal-table-container"]').first(),s=this;jQuery.ajax({method:"GET",url:WDT.rest_url+"wedatatools/v1/portal/report/user-events/",data:{nonce:n,number:a,date_from:o,date_to:r},beforeSend:e=>{e.setRequestHeader("X-WDT-NONCE",WDT.rest_nonce),t(i).find('[data-target="portal-table-body"]').html(""),t(i).find('[data-target="spinner"]').show()},success:function(e){if(e.success){let a=t.Event("wdt:response");a.wdt={},a.wdt.result=e.result,t(s).trigger(a)}},error:function(t){wdtDisplayNotification("Unable to retrieve interaction data. Please contact administrator.","error",-1),console.log(t)},complete:function(){t(i).find('[data-target="spinner"]').hide()}})})),t('[data-target="portal-activity-table"]').on("wdt:loaded",(function(e){t(this).attr("data-loaded","true")})),t('[data-target="portal-activity-table"]').trigger("wdt:loaded")}));

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.