function showLoader(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Loading, please wait.",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"We are processing your request",a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];$("#title-loading").text(e),$("#text-loading").text(t),a===!0?($("#button-loading").show(),$("#scene-loading").hide()):($("#button-loading").hide(),$("#scene-loading").show()),$("html").css({"overflow-y":"hidden"}),$("#loading-wrapper").fadeIn()}function hideLoader(){$("html").css({"overflow-y":"auto"}),$("#loading-wrapper").fadeOut(),$("#scene-loading").show(),$("#button-loading").hide()}function ShowHideDetails(e){var t=$(e),a=$(t.attr("data-sh-container")),n="undefined"==typeof t.attr("data-sh-show")?"Show":t.attr("data-sh-show"),o="undefined"==typeof t.attr("data-sh-hide")?"Hide":t.attr("data-sh-hide");t.hasClass("sh-active")?(a.slideUp(),t.removeClass("sh-active").html(n)):(a.slideDown(),t.addClass("sh-active").html(o))}function hasAttributeStartingWith(e,t){var a="undefined"==typeof e.attributes?e[0]:e;return Array.from(a.attributes).filter(function(e){return 0===e.nodeName.indexOf(t)}).length>0}function setDatepicker(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=e,n=phone?a.minPhone:a.min,o=phone?a.maxPhone:a.max,i="Please select a date between "+a.min+" and "+a.max;t=null===t?$("[name='"+a.name+"']"):t,t.length&&(t.attr("data-fv-date","true").attr("data-fv-date___format",format).attr("data-fv-date___message",i),phone?(t.attr("type","date").attr("min",n).attr("data-fv-date___min",n).attr("max",o).attr("data-fv-date___max",o),t.change(function(){validator.revalidateField(t.attr("name"))})):(t.attr("type","text").prop("readonly",!0).attr("data-fv-date___min",n).attr("data-fv-date___max",o),t.removeClass("hasDatepicker").datepicker({dateFormat:"dd/mm/yy",changeMonth:!0,constrainInput:!0,numberOfMonths:2,minDate:n,maxDate:o,onClose:function(){"undefined"==typeof a.revalidate&&fv[a.fv].revalidateField(t.attr("name"))}})))}function setDateTimepicker(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=e,n=a.min,o=a.max,i="Please select a date between "+a.min+" and "+a.max,r=a.minPhone.split(" ")[0],s="string"==typeof a.defaultDate&&a.defaultDate.split(" ")[0];t=null===t?$("[name='"+a.name+"']"):t,t.length&&(t.attr("data-fv-date","true").attr("data-fv-date___format",timeFormat).attr("data-fv-date___message",i),t.attr("type","text").attr("data-fv-date___min",n).attr("data-fv-date___max",o),t.datetimepicker({minDate:r,maxDate:moment().add(1,"minutes").valueOf(),useCurrent:!1,defaultDate:s,format:"DD/MM/YYYY HH:mm"}),t.on("change.datetimepicker",function(e){"undefined"==typeof a.revalidate&&fv[a.fv].revalidateField(t.attr("name"))}))}function postCodeLookupSearch(e){return function(t,a){var n=a.split(/[.\[\]]/).filter(function(e){return""!==e}),o=null,i=null;3===n.length?(o=e[n[0]],o=ko.isObservable(o)?o():o,o=ko.isObservable(o[n[1]])?o[n[1]]():o[n[1]],o=ko.isObservable(o[n[2]])?o[n[2]]():o[n[2]],i=$("#"+n[0]+n[1]+n[2]+"SearchList")):2===n.length?(o=e[n[0]],o=ko.isObservable(o)?o():o,o=ko.isObservable(o[n[1]])?o[n[1]]():o[n[1]],i=$("#"+n[0]+n[1]+"SearchList")):(o=e[a],o=ko.isObservable(o)?o():o,i=$("#"+a+"SearchList")),o.Addresses.removeAll(),t.closest(".form-group").find("svg").removeClass("fa-search").addClass("fa-circle-notch fa-spin").prop("disabled",!0),$.post("/Customers/LookupPostcode",{Postcode:t.val()}).done(function(e){i.show(),$.each(e.results,function(e,t){o.Addresses.push({value:t.id,text:t.description})})}).always(function(){t.closest(".form-group").find("svg").removeClass("fa-circle-notch fa-spin").addClass("fa-search").prop("disabled",!1)})}}function selectAddress(e){return function(t,a,n){var o,i=t.split(/[.\[\]]/).filter(function(e){return""!==e}),r=$(n.target).closest(".addressWrapper").find("[name$='.Country']"),s=null,l=null;3===i.length?(s=e[i[0]],s=ko.isObservable(s)?s():s,s=ko.isObservable(s[i[1]])?s[i[1]]():s[i[1]],s=ko.isObservable(s[i[2]])?s[i[2]]():s[i[2]],l=$("#"+i[0]+i[1]+i[2]+"SearchList")):2===i.length?(s=e[i[0]],s=ko.isObservable(s)?s():s,s=ko.isObservable(s[i[1]])?s[i[1]]():s[i[1]],l=$("#"+i[0]+i[1]+"SearchList")):(s=e[t],s=ko.isObservable(s)?s():s,l=$("#"+t+"SearchList")),o=s.address(),n.originalEvent&&$.post("/Customers/LookupAddress",{id:o}).done(function(e){var t=e,a=[t.organization,t.subBuilding,t.buildingName,t.buildingNumber],n=a.filter(function(e){return e}).join(", ");s.HouseNameOrNumber(n),s.Street(t.street),s.City(t.locality),s.County(t.region);var o;switch(t.countryCode.toUpperCase()){case"GB":switch(t.postcode.slice(0,2)){case"GY":o=r.find('option:contains("Channel Islands")').val(),o||(o=r.find('option:contains("Guernsey")').val());break;case"IM":o=r.find('option:contains("Isle of Man")').val();break;case"JE":o=r.find('option:contains("Jersey")').val();break;case"BT":o=r.find('option:contains("Northern Ireland")').val();break;default:o=r.find('option:contains("England and Wales")').val(),o||(o=r.find('option:contains("United Kingdom")').val())}break;case"IE":o=r.find('option:contains("Republic of Ireland")').val()}o&&(r.val(o),s.Country(o)),t.hasOwnProperty("geometry")&&s.hasOwnProperty("Longitude")&&s.hasOwnProperty("Latitude")&&(s.Latitude(t.geometry.coordinate.latitude),s.Longitude(t.geometry.coordinate.longitude))}).always(function(){l.hide(),s.Addresses.removeAll()})}}var AjaxBase=location.protocol+"//"+location.hostname+(location.port?":"+location.port:""),phone=!(!Modernizr.inputtypes.date||!(navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/BlackBerry/i)||navigator.userAgent.match(/webOS/i)));"function"!=typeof Object.assign&&(Object.assign=function(e){"use strict";if(null==e)throw new TypeError("Cannot convert undefined or null to object");e=Object(e);for(var t=1;t'+n.name+"",hasIcon:!1,fn:function(){t.execCmd("fontName",n.family,!0)}}),a.push("fontfamily_"+e)}),a}e.fn.attrBegins=function(t){var a="";return this.each(function(n){e.each(this.attributes,function(e,n){0===n.name.indexOf(t)&&(a=n.name)})}),a},e.extend(!0,e.trumbowyg,{langs:{en:{fontFamily:"Font"}}});var a={fontList:[{name:"Arial",family:"Arial, Helvetica, sans-serif"},{name:"Courier New",family:"'Courier New', Courier, monospace"},{name:"Georgia",family:"Georgia, serif"},{name:"Impact",family:"Impact, Charcoal, sans-serif"},{name:"Lucida Console",family:"'Lucida Console', Monaco, monospace"},{name:"Lucida Sans",family:"'Lucida Sans Uncide', 'Lucida Grande', sans-serif"},{name:"Palatino",family:"'Palatino Linotype', 'Book Antiqua', Palatino, serif"},{name:"Tahoma",family:"Tahoma, Geneva, sans-serif"},{name:"Times New Roman",family:"'Times New Roman', Times, serif"},{name:"Trebuchet",family:"'Trebuchet MS', Helvetica, sans-serif"},{name:"Verdana",family:"Verdana, Geneva, sans-serif"}]};e.extend(!0,e.trumbowyg,{plugins:{fontfamily:{init:function(e){e.o.plugins.fontfamily=e.o.plugins.fontfamily||a,e.addBtnDef("fontfamily",{dropdown:t(e),hasIcon:!1,text:e.lang.fontFamily})}}}}),e.fn.datetimepicker.Constructor.Default=e.extend({},e.fn.datetimepicker.Constructor.Default,{icons:{time:"far fa-clock",date:"far fa-calendar",up:"far fa-arrow-up",down:"far fa-arrow-down",previous:"far fa-chevron-left",next:"far fa-chevron-right",today:"far fa-calendar-check-o",clear:"far fa-trash",close:"far fa-times"}})}(jQuery),$(function(){$("body").on("click","[data-sh-container]",function(e){e.preventDefault(),ShowHideDetails(this)})});var format=phone?"YYYY-MM-DD":"DD/MM/YYYY",timeFormat="DD/MM/YYYY h:m";Number.prototype.formatMoney=function(e,t,a){var n=this,e=isNaN(e=Math.abs(e))?2:e,t=void 0==t?".":t,a=void 0==a?",":a,o=n<0?"-":"",i=parseInt(n=Math.abs(+n||0).toFixed(e))+"",r=(r=i.length)>3?r%3:0;return o+(r?i.substr(0,r)+a:"")+i.substr(r).replace(/(\d{3})(?=\d)/g,"$1"+a)+(e?t+Math.abs(n-i).toFixed(e).slice(2):"")},String.prototype.unformatMoney=function(e){var t=this,e=void 0==e?",":e,a=new RegExp(e,"g"),n=t.replace(a,"");return parseFloat(n)},String.prototype.toCapitalise=function(){return this.charAt(0).toUpperCase()+this.slice(1).toLowerCase()},String.prototype.isNumber=function(){return/^\d+$/.test(this)},Object.getOwnPropertyDescriptor(NodeList.prototype,"forEach")||Object.defineProperty(NodeList.prototype,"forEach",Object.getOwnPropertyDescriptor(Array.prototype,"forEach")),$(function(){function e(e){var a="undefined"!=typeof e?e:114e4;n=window.setTimeout(function(){$("#TimeOut").fadeIn();var e=59,a=6e3;o=window.setInterval(function(){0!=e?("undefined"!=typeof t&&t(166e-6*a),a--,a%100==0&&(e--,$("#Timer").html(e))):(window.clearInterval(o),window.location.href=AjaxBase+"/Account/Logout")},10)},a)}function t(e){m.clearRect(0,0,d,d),m.beginPath(),m.arc(f,f,f,-Math.PI,Math.PI),m.arc(f,f,f-u,Math.PI,-Math.PI,!0),m.closePath(),m.fill(),m.beginPath(),m.arc(f,f,f,-Math.PI,-Math.PI+2*Math.PI*e),m.arc(f,f,f-u,-Math.PI+2*Math.PI*e,-Math.PI,!0),m.closePath(),m.save(),m.clip(),m.fillStyle=h,m.fillRect(0,0,d,d),m.restore()}function a(e){$(i).stop(!0,!0).css({value:0}).animate({value:e},$.extend({},l.animation,{step:function(a){t(a),$(i).trigger("circle-animation-progress",[a/e,a])},complete:function(){$(i).trigger("circle-animation-end")}}))}if("undefined"==typeof timeout){var n,o;e(sessionTime),$("body").on("click","#TimeOut",function(){$.ajax({url:AjaxBase+"/account/refreshsession",dataType:"json",type:"GET",fail:function(){toastr.error(" An error occurred has ocurred refreshing your session."),window.location.href=AjaxBase+"/Account/Logout"},error:function(){toastr.error(" An error occurred has ocurred refreshing your session."),window.location.href=AjaxBase+"/Account/Logout"},success:function(t){window.clearInterval(o),$("#TimeOut").remove(),window.clearTimeout(n),e()}})})}if($("#timeoutCanvas").length>0){var i=$("#timeoutCanvas")[0],r=$("#timeoutCanvas").attr("startColor"),s=$("#timeoutCanvas").attr("endColor");"undefined"==typeof r&&(r="#17a2b8"),"undefined"==typeof s&&(s=r);var l={value:1,size:100,startAngle:-Math.PI,startColor:r,endColor:s,animation:!1};$.easing.circleProgressEase=function(e,t,a,n,o){return(t/=o/2)<1?n/2*t*t*t+a:n/2*((t-=2)*t*t+2)+a};var d=l.size,c=l.value,f=d/2,u=d/14;i.width=d,i.height=d;var m=i.getContext("2d"),h=m.createLinearGradient(0,0,d,0);h.addColorStop(0,l.startColor),h.addColorStop(1,l.endColor),m.fillStyle="rgba(0, 0, 0, .1)",l.animation?a(c):t(c),$(".number").click(function(){l.animation?a(c):t(c)})}});