function variantDateFormatToMoment(n){return moment(n,"D/MM/YYYY hh:ss A")}function isVipMembershipProduct(n){return/^VIP/.test(n)}function isJson(n){try{return typeof JSON.parse(n)=="object"}catch(t){return!1}return!0}var corpApp=angular.module("corpApp",["ngRoute","ngMessages","ngResource","ngAnimate","ngAria","angular-loading-bar","ui.bootstrap","nemLogging","uiGmapgoogle-maps","bootstrapLightbox","socialLinks","ui.mask","corpApp.filters","corpApp.baseModule","corpApp.corpServices","corpApp.corpDirectives","corpApp.newsModule","corpApp.heroModule","corpApp.breadcrumbModule","corpApp.navigationModule","corpApp.programNavigationModule","corpApp.locationMapPageModule","corpApp.contactSwimSchoolModule","corpApp.swimSchoolPageModule","corpApp.swimSchoolUpdateModule","corpApp.savePaymentTokenModule","corpApp.paymentNABModule","corpApp.uCommerceShopCategoriesModule","corpApp.uCommerceProductsByCategoryModule","corpApp.uCommerceOrderDetailsModule","corpApp.uCommerceProductByIDModule","corpApp.footerLinksModule","corpApp.loginModule","corpApp.registerModule","corpApp.logoutModule","corpApp.relatedNewsModule","corpApp.availableCoursesModule","corpApp.documentListModule","corpApp.linksListModule","corpApp.landingModule","corpApp.shopBreadcrumbModule","corpApp.shopNavigationModule","corpApp.resetPasswordModule","corpApp.jobsBoardSearchModule","corpApp.jobsBoardDetailModule","corpApp.jobsBoardEmployerDashboardModule","corpApp.GoogleMapWidget","corpApp.SurveyMonkeyWidgetModule","corpApp.testimonialModule","corpApp.incidentsModule","corpApp.spinnerService","corpApp.creditCardService","corpApp.adminRegisterCourseModule","corpApp.UnsubscribeModule","corpApp.FundraisingNavigationModule","corpApp.FundraisingBannerModule","corpApp.FundraisingFeaturedImageModule","corpApp.FundraisingTimeLeftModule","corpApp.FundraisingTestimonialModule","corpApp.FundraisingRafflesModule","corpApp.raffleQuickSelectCompService","corpApp.FundraisingQuickSelectionsModule","corpApp.FundraisingProgressModule","corpApp.FundraisingTestimonialModule","corpApp.FundraisingCallToActionModule","corpApp.FundraisingModularContentModule","corpApp.FundraisingSocialMediaLinks","corpApp.StaffManualRaffleEntryModule","corpApp.myRoyalLoginModule","corpApp.myRoyalRegisterModule","corpApp.myRoyalLogoutModule","corpApp.myRoyalDashModule","corpApp.myRoyalMyAccountModule","corpApp.passwordResetModule","corpApp.FundraisingAdminModule","corpApp.myRoyalChangeDetailsModule","corpApp.CallCentreLinksModule","corpApp.CallCentreService","corpApp.StaffPortalService","corpApp.MyRoyalService","corpApp.FundraisingService","corpApp.StaffPortalLoginModule","corpApp.StaffPortalNavModule","corpApp.StaffPortalMainContentModule","corpApp.StaffPortalMyRoyalAdminModule","corpApp.StaffPortalBatchEnrolmentModule","corpApp.StaffPortalFundraisingPurchasesModule",]),corpConfig,corpDirectives,basefilters,baseModule,documentListModule,GoogleMapWidgetModule,heroModule,linksListModule,savePaymentTokenModule,SurveyMonkeyWidgetModule,testimonialModule,newsModule,relatedNewsModule,breadcrumbModule,footerLinksModule,landingModule,programNavigationModule,shopBreadcrumbModule,shopNavigationModule,orderdetailsModule,productbyidModule,productsbycategoryModule,mockItems,navigationModule,adminRegisterCourseModule,availableCoursesModule,passwordResetModule,loginModule,logoutModule,registerModule,resetPasswordModule,jobsBoardDetailModule,jobsBoardEmployerDashboardModule,jobsBoardSearchModule,incidentsModule,CallCentreLinksModule,FundraisingAdminModule,FundraisingBannerModule,FundraisingCallToActionModule,FundraisingFeaturedImageModule,FundraisingModularContentModule,FundraisingNavigationModule,FundraisingProgressModule,FundraisingQuickSelectionModule,shareModule,FundraisingTestimonialModule,FundraisingTimeLeftModule,FundraisingRafflesModule,myRoyalChangeDetailsModule,myRoyalDashModule,myRoyalLoginModule,myRoyalLogoutModule,myRoyalMyAccountModule,myRoyalRegisterModule,UnsubscribeModule,contactSwimSchoolModule,locationMapPageModule,swimSchoolPageModule,swimSchoolUpdateModule,corpServices,spinnerModule,StaffPortalBatchEnrolmentModule,StaffPortalLoginModule,StaffPortalMainContentModule,StaffPortalMyRoyalAdminModule,StaffPortalNavModule;corpApp.config(["$compileProvider",function(n){n.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|file|blob):/)}]);corpConfig=angular.module("corpApp.corpConfig",[]);corpConfig.config(function(n){n.configure({key:"AIzaSyBzYNBZVMFsPlRj4xzAtlthA8sT3Kzd5LQ",v:"3.20",libraries:"weather,geometry,visualization"})});corpConfig.config(function(n){n.templateUrl="/Content/Third Party/angular-bootstrap-lightbox/lightbox.html"});window.jsCommon=window.jsCommon||{},function(n){n.getUrlParameter=function(n){for(var i,r=window.location.search.substr(1).split("&"),t=0;t<r.length;t++)if(i=r[t].split("="),i[0]==n)return decodeURIComponent(i[1]);return!1};n.addUrlParameter=function(n,t,i){var r=encodeURIComponent(i);return n=window.location.pathname.indexOf("?")>=0?n+"&":n+"?",n+t+"="+r};n.changeUrlParameter=function(n,t,i){var r=new RegExp("([?&])"+t+"=.*?(&|$)","i"),u=n.indexOf("?")!==-1?"&":"?";return n.match(r)?n.replace(r,"$1"+t+"="+i+"$2"):n+u+t+"="+i};n.redirectToReturnUrl=function(){var t=n.getUrlParameter("returnUrl");t?window.location.replace(t):location.reload(!0)};n.findPos=function(n){var t=0;if(n.offsetParent){do t+=n.offsetTop;while(n=n.offsetParent);return[t]}return 0};n.findIndexInObjectArray=function(n,t,i){for(var r=0,u=n.length;r<u;r++)if(n[r][t]===i)return r;return-1};n.toSentanceCase=function(n){var t=n.split("."),r="",u,f,e;for(i=0;i<t.length;i++){for(u="",f=t[i].replace(/^(\s*).*$/,"$1").length,t[i]=t[i].replace(/^\s+/,""),e=t[i].charAt(t[i]).toUpperCase()+t[i].slice(1),j=0;j<f;j++)u=u+" ";r=r+u+e+"."}return r.substring(0,r.length-1)};n.isBrowserCompatible=function(){var n={init:function(){this.browser=this.searchString(this.dataBrowser)||"Other";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"Unknown"},searchString:function(n){for(var i,t=0;t<n.length;t++)if(i=n[t].string,this.versionSearchString=n[t].subString,i.indexOf(n[t].subString)!==-1)return n[t].identity},searchVersion:function(n){var i=n.indexOf(this.versionSearchString),t;if(i!==-1)return t=n.indexOf("rv:"),this.versionSearchString==="Trident"&&t!==-1?parseFloat(n.substring(t+3)):parseFloat(n.substring(i+this.versionSearchString.length+1))},dataBrowser:[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer"},{string:navigator.userAgent,subString:"Trident",identity:"Explorer"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.userAgent,subString:"Safari",identity:"Safari"},{string:navigator.userAgent,subString:"Opera",identity:"Opera"}]};return(n.init(),n.browser=="Explorer"&&n.version<=8)?!1:!0};n.scrollTo=function(n){if(n.length)n.on("click",function(n){var t=$(this.hash);t.length&&(n.preventDefault(),$("html,body").animate({scrollTop:t.offset().top},1e3))})};n.resizeHeightToViewport=function(n){if(n.length&&$(window).width()>=768){var t=$(window).height()-150,i=n.data("minHeight");t<i&&(t=i);n.css({height:t+"px"})}};n.convertToDateObj=function(n){var t=n.split(/[\.\-\/]/),i=parseInt(t[2],10),r=parseInt(t[1],10),u=parseInt(t[0],10),f=new Date(i,r-1,u,0,0,0,0);return{yyyy:i,mm:r,dd:u,date:f}}}(window.jsCommon);window.jsConversion=window.jsConversion||{},function(n){n.toBoolean=function(n){switch(n){case"True":return!0;case"False":return!1;default:return Boolean(n)}}}(jsConversion);window.jsDates=window.jsDates||{},function(n){n.getCurrentDateString=function(){return moment().format("DD/MM/YYYY")};n.parseDate=function(n){var t=n.split(" ");return t.length>1?moment(n,"DD/MM/YYYY HH:mm:ss").toDate():moment(n,"DD/MM/YYYY").toDate()};n.parseDateForJson=function(n){var t=n.split(" ");return t.length>1?moment(n,"DD/MM/YYYY HH:mm:ss").format(n,"YYYY-MM-DD HH:mm:ss"):moment(n,"DD/MM/YYYY").format("YYYY-MM-DD")};n.parseDateObjectFromJson=function(n,t){if(n=="0001-01-01T00:00:00")return"";var i=n.split("T");return i.length>1&&t==!0?moment(n,moment.ISO_8601).format(n,"DD/MM/YYYY HH:mm:ss"):moment(n,moment.ISO_8601).format("DD/MM/YYYY")};n.parseDateToCalendarDateFromJson=function(n,t){if(n=="0001-01-01T00:00:00")return"";var i=n.split("T");return i.length>1&&t==!0?n.replace("Z",""):moment(n,moment.ISO_8601).format("YYYY-MM-DD")};n.isValidDate=function(n){return n==undefined?!1:moment(n,"DD/MM/YYYY").isValid()};n.getDateDifference=function(t,i){return n.parseDate(i)-n.parseDate(t)};n.isValidDateRange=function(t,i){if(t==""||i==""||t==undefined||i==undefined)return!0;if(n.isValidDate(t)==!1)return!1;if(n.isValidDate(i)==!0){var r=n.getDateDifference(t,i);if(r<0)return!1}return!0}}(window.jsDates);corpDirectives=angular.module("corpApp.corpDirectives",[]);corpDirectives.directive("ngEnter",function(){return function(n,t,i){t.bind("keydown keypress",function(t){t.which===13&&(n.$apply(function(){n.$eval(i.ngEnter)}),t.preventDefault())})}});corpDirectives.directive("ngElementReady",["$parse",function(n){return{restrict:"A",link:function(t,i,r){i.ready(function(){t.$apply(function(){var i=n(r.ngElementReady);i(t)})})}}}]);corpDirectives.directive("ngParseTweet",["$timeout",function(n){return{restrict:"A",link:function(t,i){i.ready(function(){n(function(){t.$apply(function(){var n="#"+i[0].id;tweetParser(n);jQuery(n).find("a").attr("target","_blank")})})})}}}]);corpDirectives.directive("ngDateLowerThan",["$filter",function(n){return{require:"ngModel",link:function(t,i,r,u){var f=function(t){var i=n("date")(t,"dd/MM/yyyy"),f=n("date")(r.ngDateLowerThan,"dd/MM/yyyy"),e=jsDates.isValidDateRange(i,f);return u.$setValidity("dateLowerThan",e),t};u.$parsers.unshift(f);u.$formatters.push(f);r.$observe("dateLowerThan",function(){f(u.$viewValue)})}}}]);corpDirectives.directive("ngDateGreaterThan",["$filter",function(n){return{require:"ngModel",link:function(t,i,r,u){var f=function(t){var i=n("date")(r.ngDateGreaterThan,"dd/MM/yyyy"),f=n("date")(t,"dd/MM/yyyy"),e=jsDates.isValidDateRange(i,f);return u.$setValidity("dateGreaterThan",e),t};u.$parsers.unshift(f);u.$formatters.push(f);r.$observe("dateGreaterThan",function(){f(u.$viewValue)})}}}]);corpDirectives.directive("ngValidDate",["$filter",function(n){return{require:"ngModel",link:function(t,i,r,u){var f=function(t){var i=n("date")(t,"dd/MM/yyyy"),r;return r=i==""||i==undefined?!0:jsDates.isValidDate(i),u.$setValidity("validDate",r),t};u.$parsers.unshift(f);u.$formatters.push(f);r.$observe("validDate",function(){f(u.$viewValue)})}}}]);corpDirectives.directive("ngValidatePassword",["$filter",function(){return{require:"ngModel",link:function(n,t,i,r){var u=function(n){var t=!1;return/^(?=.{8,20}$)(?=.*[a-z])(?=.*[A-Z])(?=.*[\d\w]).+$/.test(n)&&(t=!0),r.$setValidity("validatePassword",t),n};r.$parsers.unshift(u);r.$formatters.push(u);i.$observe("validatePassword",function(){u(r.$viewValue)})}}}]);corpDirectives.directive("ngFieldValuesMustMatch",["$filter",function(){return{require:"ngModel",link:function(n,t,i,r){var u=function(n){var t,u=i.ngFieldValuesMustMatch;return t=n!=u?!1:!0,r.$setValidity("fieldValuesMustMatch",t),n};r.$parsers.unshift(u);r.$formatters.push(u);i.$observe("fieldValuesMustMatch",function(){u(r.$viewValue)})}}}]);corpDirectives.directive("ngValidateCurrency",["$filter",function(){return{require:"ngModel",link:function(n,t,i,r){var u=function(n){var t;return t=/^\d+(\.\d{2})?$/.test(n)||n==""||n==undefined?!0:!1,r.$setValidity("validateCurrency",t),n};r.$parsers.unshift(u);r.$formatters.push(u);i.$observe("validateCurrency",function(){u(r.$viewValue)})}}}]);corpDirectives.directive("ngCheckboxGroupHasSelection",["$filter",function(){return{require:"ngModel",link:function(n,t,i,r){var u=function(n){var t=!1;return n>0&&(t=!0),r.$setValidity("checkboxGroupHasSelection",t),n};r.$parsers.unshift(u);r.$formatters.push(u);i.$observe("checkboxGroupHasSelection",function(){u(r.$viewValue)})}}}]);corpDirectives.filter("CurrencyFormat",["$filter",function(){return function(n){return n=parseFloat(n),n=n%1==0?n.toFixed(0):n.toFixed(2),"$"+n.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}}]);corpDirectives.directive("ngValidatePhoneNumber",["$filter",function(){return{require:"ngModel",link:function(n,t,i,r){var u=function(n){var t;return t=/^(\+?[\d ]*\(?[\d ]*\)?[\d ]+){6,}$/.test(n)||n==""||n==undefined?!0:!1,r.$setValidity("validatePhoneNumber",t),n};r.$parsers.unshift(u);r.$formatters.push(u);i.$observe("validatePhoneNumber",function(){u(r.$viewValue);e})}}}]);corpDirectives.directive("ngValidatePostcode",["$filter",function(){return{require:"ngModel",link:function(n,t,i,r){var u=function(n){var t=/^\d{4}$/.test(n)||n==""||n==undefined;return r.$setValidity("validatePostcode",t),n};r.$parsers.unshift(u);r.$formatters.push(u);i.$observe("validatePhoneNumber",function(){u(r.$viewValue)})}}}]);corpDirectives.directive("compileHtml",function(n,t,i){return{restrict:"A",link:function(n,r,u){var f=t.parseAsHtml(u.compileHtml),e=function(){return f(n)};n.$watch(e,function(t){var u=i(t);r.append(u(n))})}}});corpDirectives.directive("setGoal",["XDbPageEventsService","$q",function(n,t){var i=function(i,r,u){var f=t.defer(),e=function(n){f.resolve(n)},o=function(){f.reject()};return n.create({id:i,goalId:r,sku:u},e,o),f.promise};return{restrict:"A",link:function(n,t,r){var u=r.setGoal.split(","),f=u[0],o=u[1],s=u[2],e=t[0];$(t).click(function(n){n.preventDefault();i(f,o).then(function(){return console.debug("Successfully processed goal '"+f+"'."),!0},function(){console.debug("Failed to process goal '"+f+"'.")}).finally(function(){e.target&&e.target!="_self"||(window.location=e.href)})})}}}]);corpDirectives.directive("spinner",function(){return{restrict:"EA",replace:!0,transclude:!0,scope:{name:"@?",group:"@?",show:"=?",imgSrc:"@?",register:"@?",onLoaded:"&?",onShow:"&?",onHide:"&?"},template:'<span ng-show="show">  <img ng-show="imgSrc" ng-src="{{imgSrc}}" />  <span ng-transclude><\/span><\/span>',controller:["$scope","spinnerService",function(n,t){n.register=n.hasOwnProperty("register")?!!n.register:!0;var i={name:n.name,group:n.group,show:function(){n.show=!0},hide:function(){n.show=!1},toggle:function(){n.show=!n.show}};if(n.register===!0&&t._register(i),(n.onShow||n.onHide)&&n.$watch("show",function(r){if(r&&n.onShow)n.onShow({spinnerService:t,spinnerApi:i});else if(!r&&n.onHide)n.onHide({spinnerService:t,spinnerApi:i})}),n.onLoaded)n.onLoaded({spinnerService:t,spinnerApi:i})}]}});corpDirectives.directive("smartWizard",[function(){function n(n,t){t.smartWizard({selected:0,theme:"dots",justified:!0,darkMode:!1,autoAdjustHeight:!0,cycleSteps:!1,enableURLhash:!0,transition:{animation:"none",speed:"400",easing:""},toolbarSettings:{toolbarPosition:"none",toolbarButtonPosition:"right",showNextButton:!1,showPreviousButton:!1,toolbarExtraButtons:[]}})}return{restrict:"AE",link:n}}]);corpDirectives.directive("signaturePad",["$interval","$timeout","$window",function(n,t,i){"use strict";var r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjgAAADcCAQAAADXNhPAAAACIklEQVR42u3UIQEAAAzDsM+/6UsYG0okFDQHMBIJAMMBDAfAcADDATAcwHAAwwEwHMBwAAwHMBzAcAAMBzAcAMMBDAcwHADDAQwHwHAAwwEMB8BwAMMBMBzAcADDATAcwHAADAcwHADDAQwHMBwAwwEMB8BwAMMBDAfAcADDATAcwHAAwwEwHMBwAAwHMBzAcAAMBzAcAMMBDAcwHADDAQwHwHAAwwEwHMBwAMMBMBzAcAAMBzAcwHAADAcwHADDAQwHMBwAwwEMB8BwAMMBDAfAcADDATAcwHAAwwEwHMBwAAwHMBzAcCQADAcwHADDAQwHwHAAwwEMB8BwAMMBMBzAcADDATAcwHAADAcwHMBwAAwHMBwAwwEMBzAcAMMBDAfAcADDAQwHwHAAwwEwHMBwAAwHMBzAcAAMBzAcAMMBDAcwHADDAQwHwHAAwwEMB8BwAMMBMBzAcADDATAcwHAADAcwHMBwAAwHMBwAwwEMB8BwAMMBDAfAcADDATAcwHAAwwEwHMBwAAwHMBzAcAAMBzAcAMMBDAcwHADDAQwHwHAAwwEMB8BwAMMBMBzAcADDkQAwHMBwAAwHMBwAwwEMBzAcAMMBDAfAcADDAQwHwHAAwwEwHMBwAMMBMBzAcAAMBzAcwHAADAcwHADDAQwHMBwAwwEMB8BwAMMBMBzAcADDATAcwHAADAcwHMBwAAwHMBwAwwEMBzAcAMMBDAegeayZAN3dLgwnAAAAAElFTkSuQmCC";return{restrict:"EA",replace:!0,template:'<div class="signature" style="border:rgb(169, 169, 169); border-style: solid; border-width:1px;width: 100%; max-width:{{width}}px; height: 100%; max-height:{{height}}px;"><canvas style="display: block; margin: 0 auto;" ng-mouseup="onMouseup()" ng-mousedown="notifyDrawing({ drawing: true })"><\/canvas><\/div>',scope:{accept:"=?",clear:"=?",disabled:"=?",dataurl:"=?",height:"@",width:"@",notifyDrawing:"&onDrawing"},controller:["$scope",function(n){n.accept=function(){return{isEmpty:n.dataurl===r,dataUrl:n.dataurl}};n.onMouseup=function(){n.updateModel();n.notifyDrawing({drawing:!1})};n.updateModel=function(){t().then(function(){n.dataurl=n.signaturePad.isEmpty()?r:n.signaturePad.toDataURL()})};n.clear=function(){n.signaturePad.clear();n.dataurl=r};n.$watch("dataurl",function(t){t&&n.signaturePad.toDataURL()!==t&&n.setDataUrl(t)})}],link:function(r,u){function v(n){r.$apply(function(){r.notifyDrawing({drawing:!0})});n.preventDefault()}function y(n){r.$apply(function(){r.updateModel();r.notifyDrawing({drawing:!1})});n.preventDefault()}var f=u.find("canvas")[0],a=f.parentElement,e=0,o=f.getContext("2d"),h=parseInt(r.width,10),c=parseInt(r.height,10),s,l;f.width=h;f.height=c;r.signaturePad=new SignaturePad(f);r.setDataUrl=function(n){var i=Math.max(window.devicePixelRatio||1,1);o.setTransform(1,0,0,1,0,0);o.scale(i,i);r.signaturePad.clear();r.signaturePad.fromDataURL(n);t().then(function(){o.setTransform(1,0,0,1,0,0);o.scale(1/e,1/e)})};r.$watch("disabled",function(n){n?r.signaturePad.off():r.signaturePad.on()});s=function(){var r=Math.min(a.clientWidth/h,1),u=Math.min(a.clientHeight/c,1),n=Math.min(r,u),t,i;n!==e&&(t=h*n,i=c*n,f.style.height=Math.round(i)+"px",f.style.width=Math.round(t)+"px",e=n,o.setTransform(1,0,0,1,0,0),o.scale(1/e,1/e))};l=n(s,200);r.$on("$destroy",function(){n.cancel(l);l=null});angular.element(i).bind("resize",s);r.$on("$destroy",function(){angular.element(i).unbind("resize",s)});s();u.on("touchstart",v);u.on("touchend",y)}}}]);corpDirectives.directive("compareTo",function(){return{require:"ngModel",link:function(n,t,i,r){r.$validators.compareTo=function(t){return t==n.$eval(i.compareTo)};n.$watch(i.compareTo,function(){r.$validate()})}}});corpDirectives.directive("fileModel",function(){return{restrict:"A",require:"ngModel",link:function(n,t,i,r){t.on("change",function(){r.$setViewValue(t[0].files)})}}});basefilters=angular.module("corpApp.filters",[]);basefilters.filter("timeAgo",["$interval",function(n){function t(n){return moment(n).fromNow()}return n(function(){},6e4),t.$stateful=!0,t}]);basefilters.filter("trustHtml",["$sce",function(n){return function(t){return n.trustAsHtml(t)}}]);basefilters.filter("jobItemStatus",["$sce",function(){return function(n){return n.Published?n.New?"New":"Published":n.Deleted?"Deleted":"Draft"}}]);baseModule=angular.module("corpApp.baseModule",["ngRoute","ngSanitize"]);baseModule.controller("BaseCtrl",["$scope","$q","$timeout","$sce",function(n,t,i,r){n.pageErrors={};n.data={};n.pager={};n.HandleResponseErrors=function(t){if(t.HasResponseErrors)return n.onSubmitFail()};n.callWebApiService=function(n,i){var r=t.defer(),u=function(n){r.resolve(n)},f=function(n){r.reject(n)};return n.get(i,u,f),r.promise};n.onSubmitFail=function(){return n.pageErrors={submitFail:!0},!1};n.hasPageErrors=!1;n.$watch("pageErrors",function(){n.hasPageErrors=!jQuery.isEmptyObject(n.pageErrors)},!0);n.renderHtml=function(n){return r.trustAsHtml(n)};n.stripHtmlTags=function(t){return n.renderHtml(String(t).replace(/<[^>]+>/gm,""))};n.limitTextLength=function(n,t,i){if(t=t|0,t<=0||n.length<=t)return n;var r=n.substring(0,t),u=r.lastIndexOf(" ");return u===-1?r+i:r.substring(0,u)+i};n.initPager=function(){n.pager.totalItems=1e3;n.pager.currentPage=1;n.pager.pageSize=10;n.pager.itemCounter=1;n.pager.numPages=5;var t=$(document).width();n.pager.maxSize=t<768?3:10};n.resetPager=function(){n.pager.currentPage=1};n.pagerPageChanged=function(){n.pager.itemCounter=n.pager.currentPage*n.pager.pageSize-n.pager.pageSize+1;n.populatePageData()}}]);documentListModule=angular.module("corpApp.documentListModule",["ngRoute","ngSanitize"]);documentListModule.controller("DocumentListCtrl",["$scope","DocumentListService","$controller",function(n,t,i){n.populateControlData=function(i){n.callWebApiService(t,{id:i}).then(function(t){return n.HandleResponseErrors(t),t.HasResponseErrors||t.Title==null||(n.Title=t.Title,n.Show=t.Title.length>0,n.Links=t.Documents),!0},function(){n.onSubmitFail()})};n.init=function(t){angular.extend(this,i("BaseCtrl",{$scope:n}));n.populateControlData(t)}}]);GoogleMapWidgetModule=angular.module("corpApp.GoogleMapWidget",["ngRoute","ngSanitize"]);GoogleMapWidgetModule.controller("GoogleMapWidgetCtrl",["$scope","$controller","$sce",function(n,t,i){n.init=function(){var t=window.location.search.replace("?","");(t==""||t=="undefined")&&(t="Royal+Life+Saving+WA");n.googleMapURL="https://www.google.com/maps/embed/v1/search?q="+t+"&key=AIzaSyAFw2BJPtobHrSKJASSh9jBT0TPXUDarGw";n.googleMapURL=i.trustAsResourceUrl(n.googleMapURL)}}]);heroModule=angular.module("corpApp.heroModule",["ngRoute","ngSanitize"]);heroModule.controller("HeroCtrl",["$scope","$controller","HeroService",function(n,t,i){n.populatePageData=function(t){n.callWebApiService(i,{id:t}).then(function(t){return n.HandleResponseErrors(t),n.Data=t,!0},function(){n.onSubmitFail()})};n.init=function(i){angular.extend(this,t("BaseCtrl",{$scope:n}));n.populatePageData(i)}}]);linksListModule=angular.module("corpApp.linksListModule",["ngRoute","ngSanitize"]);linksListModule.controller("LinksListCtrl",["$scope","LinksService","$controller",function(n,t,i){n.populateControlData=function(i){n.callWebApiService(t,{id:i}).then(function(t){return n.HandleResponseErrors(t),n.Title=t.Title,n.Show=!jQuery.isEmptyObject(n.Title),n.Links=t.Links,!0},function(){n.onSubmitFail()})};n.init=function(t){angular.extend(this,i("BaseCtrl",{$scope:n}));n.populateControlData(t)}}]);window.onload=function(){var r=function(n){switch(n){case"H1":return"18px";case"H2":return"16px";case"H3":return"18px";case"H4":return"11px";case"H5":return"6px";case"H6":return"8px";default:return""}},u=function(n){n.children[1].removeAttribute("style");var t="padding-top: "+r(n.children[0].tagName);n.children[1].setAttribute("style",t)},t=document.getElementsByClassName("rlsswa-accordion"),n;for(i=0;i<t.length;i++)n=document.createElement("button"),n.className="rlsswa-accordion",n.innerHTML=t[i].innerHTML,n.type="button",t[i].parentNode.replaceChild(n,t[i]),u(n),n.onclick=function(){this.classList.toggle("active");this.nextElementSibling.classList.toggle("show");try{this.children[1].removeAttribute("style");var n="padding-top: "+r(this.children[0].tagName);this.children[1].classList.value.includes("fa-caret-up")?(this.children[1].classList.remove("fa-caret-up"),this.children[1].classList.add("fa-caret-down"),this.children[1].setAttribute("style",n)):(this.children[1].classList.remove("fa-caret-down"),this.children[1].classList.add("fa-caret-up"),this.children[1].setAttribute("style",n))}catch(t){}}};savePaymentTokenModule=angular.module("corpApp.savePaymentTokenModule",["ngRoute","ngSanitize","ui.bootstrap"]);savePaymentTokenModule.controller("SavePaymentTokenCtrl",["$scope","$controller","$http","$timeout","SavePaymentTokenService","creditCardService",function(n,t,i,r,u,f){n.populateControlData=function(t){n.loading=!0;n.expMonthList=n.initExpMonthList();n.expYearList=n.initExpYearList();r(function(){n.validateCardExp()});n.callWebApiService(u,{id:t}).then(function(t){return n.loading=!1,t.HasResponseErrors?(n.hideForm=!0,n.pageErrorMessage="There was an error finding this organisation or payment service details",n.HandleResponseErrors(t)):(n.hideForm=!1,n.organisation=t.OrganisationName,n.paymentServiceType=t.PaymentServiceType,n.settings=t.Settings),!0},function(){n.onSubmitFail()})};n.init=function(i){angular.extend(this,t("BaseCtrl",{$scope:n}));n.submitSuccess=!1;n.formData={payment:{}};n.populateControlData(i)};var e=function(){n.formData={firstName:"",lastName:"",email:"",phoneNum:"",vipMemberNum:"",payment:{selectedExpMonth:n.expMonthList[0],selectedExpYear:n.expYearList[0]}};n.validateCardExp()};n.submitData=function(t){if(t.stopPropagation(),t.preventDefault(),n.loading=!0,n.pageErrors={},n.pageActionMessage="",n.showErrorMsg=!1,n.savePaymentTokenForm.$submitted=!0,!n.savePaymentTokenForm.$valid){n.loading=!1;n.showErrorMsg=!0;n.pageErrors={formInvalid:!0};n.pageErrorMessage="Please fill out all the required fields correctly.";return}var r=n.formData;r.payment.cardExpiryMonth=r.payment.selectedExpMonth.expMonth;r.payment.cardExpiryYear=r.payment.selectedExpYear.expYear;i.post("/api/SavePaymentToken/",JSON.stringify(r),{headers:{"Content-Type":"application/json",Accept:"application/json"}}).then(function(t){return n.HandleResponseErrors(t),n.loading=!1,t.data.HasResponseErrors===!0?(n.showErrorMsg=!0,n.pageErrors={formInvalid:!0},n.pageErrorMessage="There was an error saving this credit card details"):(n.submitSuccess=!0,n.pageActionMessage="The tokenised credit card data has been saved successfully",e()),!0},function(t){return(n.loading=!1,t.status===400&&t.data.ModelState["request.Email"])?(n.contactusForm.email.$error.email=!0,!1):(n.onSubmitFail(),!1)})};n.initExpMonthList=function(){var i=[],t,r;for(i.push({expMonth:0,text:"Expiry Month"}),t=1;t<=12;t++)r="0",r=t.toString().length==1?r+t.toString():t.toString(),i.push({expMonth:t,text:r});return n.formData.payment.selectedExpMonth=i[0],i};n.initExpYearList=function(){var i=[],t;for(currentYear=(new Date).getFullYear(),i.push({expYear:0,text:"Expiry Year"}),t=currentYear;t<=currentYear+21;t++)i.push({expYear:t,text:t.toString()});return n.formData.payment.selectedExpYear=i[0],i};n.validateCardExp=function(){n.formData!==undefined&&n.formData!==null&&n.formData.payment!==undefined&&n.formData.payment!==null&&(n.formData.payment.selectedExpYear!==undefined&&n.formData.payment.selectedExpYear!==null&&(n.formData.payment.selectedExpYear.expYear==0?(n.savePaymentTokenForm.$setValidity("expYear",!1),jQuery(".expYear").addClass("ng-invalid")):(n.savePaymentTokenForm.$setValidity("expYear",!0),jQuery(".expYear").removeClass("ng-invalid"))),n.formData.payment.selectedExpMonth!==undefined&&n.formData.payment.selectedExpMonth!==null&&(n.formData.payment.selectedExpMonth.expMonth==0?(n.savePaymentTokenForm.$setValidity("expMonth",!1),jQuery(".expMonth").addClass("ng-invalid")):(n.savePaymentTokenForm.$setValidity("expMonth",!0),jQuery(".expMonth").removeClass("ng-invalid"))))};n.validateCardNumber=function(){f.validateCardType(n.formData.payment.cardNumber.toString())&&f.validateLuhn(n.formData.payment.cardNumber.toString())?(n.savePaymentTokenForm.cardNumber.$setValidity("validateCardNumber",!0),jQuery("#creditCard").removeClass("ng-invalid")):(n.savePaymentTokenForm.cardNumber.$setValidity("validateCardNumber",!1),jQuery("#creditCard").addClass("ng-invalid"))}}]);SurveyMonkeyWidgetModule=angular.module("corpApp.SurveyMonkeyWidgetModule",["ngRoute","ngSanitize"]);SurveyMonkeyWidgetModule.controller("SurveyMonkeyWidgetCtrl",["$scope","$controller","$sce","SurveyMonkeyWidgetService",function(n,t,i,r){n.populatePageData=function(t){n.callWebApiService(r,{id:t}).then(function(t){if(n.HandleResponseErrors(t),t!=null&&t!="undefined"&&t!=""){var r=t,u=r.Script.substring(0,r.Script.indexOf("<a"));n.installScript=i.trustAsHtml(u)}return!0},function(){n.onSubmitFail()})};n.init=function(i){angular.extend(this,t("BaseCtrl",{$scope:n}));n.populatePageData(i)}}]);testimonialModule=angular.module("corpApp.testimonialModule",["ngRoute","ngSanitize"]);testimonialModule.controller("testimonialCtrl",["$scope","$controller","$q","XDbPageEventsService","sharedProperties",function(n,t,i,r){n.goalId="";n.pageId="";n.init=function(t,i){n.goalId=i;n.pageId=t};$("#myModal").on("shown.bs.modal",function(){$("#myInput").focus()});$("#myModal").on("shown.bs.modal",function(){var u=n.goalId,f=n.pageId,t=i.defer(),e=function(n){t.resolve(n)},o=function(){t.reject()};return r.create({id:f,goalId:u,sku:"NOSKU"},e,o),t.promise})}]);newsModule=angular.module("corpApp.newsModule",["ngRoute","ngSanitize"]);newsModule.controller("NewsCtrl",["$scope","$controller","NewsService",function(n,t,i){n.populatePageData=function(){n.callWebApiService(i,{ItemId:n.ItemId,Page:n.Page,Initial:n.Initial,PageSize:n.PageSize}).then(function(t){return n.HandleResponseErrors(t),n.data.items=n.Page==0?t.NewsItems:n.data.items.concat(t.NewsItems),n.MoreAvailable=t.MoreAvailable,!0},function(){n.onSubmitFail()})};n.LoadMore=function(){n.Page=n.Page+1;n.populatePageData()};n.displayImage=function(n,t){return"url('"+(n<2?t.ImageSrc:t.Thumbnail)+"')"};n.init=function(i,r,u){angular.extend(this,t("BaseCtrl",{$scope:n}));n.Page=0;n.ItemId=i;n.Initial=r;n.PageSize=u;n.MoreAvailable=!1;n.populatePageData()}}]);relatedNewsModule=angular.module("corpApp.relatedNewsModule",["ngRoute","ngSanitize"]);relatedNewsModule.controller("RelatedNewsCtrl",["$scope","$controller","RelatedNewsService",function(n,t,i){n.populatePageData=function(){n.callWebApiService(i,{ItemId:n.ItemId}).then(function(t){return n.HandleResponseErrors(t),n.data.items=t.NewsItems,!0},function(){n.onSubmitFail()})};n.init=function(i){angular.extend(this,t("BaseCtrl",{$scope:n}));n.ItemId=i;n.populatePageData()}}]);breadcrumbModule=angular.module("corpApp.breadcrumbModule",["ngRoute","ngSanitize"]);breadcrumbModule.controller("BreadcrumbCtrl",["$scope","$controller","BreadcrumbService",function(n,t,i){n.populateControlData=function(t){n.callWebApiService(i,{id:t}).then(function(t){return n.HandleResponseErrors(t),n.data.items=t.BreadcrumbItems,!0},function(){n.onSubmitFail()})};n.init=function(i){angular.extend(this,t("BaseCtrl",{$scope:n}));n.data={};n.populateControlData(i)}}]);footerLinksModule=angular.module("corpApp.footerLinksModule",["ngRoute","ngSanitize"]);footerLinksModule.controller("FooterLinksCtrl",["$scope","$controller","FooterLinksService","FundraisingFooterLinksService",function(n,t,i,r){n.populateControlData=function(t){n.callWebApiService(i,{request:t}).then(function(t){return n.HandleResponseErrors(t),n.data=t,!0},function(){n.onSubmitFail()})};n.populateFundraisingControlData=function(t){n.callWebApiService(r,{request:t}).then(function(t){return n.HandleResponseErrors(t),n.data=t,!0},function(){n.onSubmitFail()})};n.init=function(i){i=i=="2"?"2":"1";angular.extend(this,t("BaseCtrl",{$scope:n}));n.data={};i=="2"?n.populateFundraisingControlData(i):n.populateControlData(i)}}]);landingModule=angular.module("corpApp.landingModule",["ngRoute","ngSanitize"]);landingModule.controller("DynamicLandingCtrl",["$scope","$controller","LandingService",function(n,t,i){n.loadPage=function(t){n.callWebApiService(i,{id:t}).then(function(t){return n.HandleResponseErrors(t),n.data.pages=t.Pages,!0},function(){n.onSubmitFail()})};n.init=function(t){n.loadPage(t)},function(){angular.extend(this,t("BaseCtrl",{$scope:n}))}()}]);navigationModule=angular.module("corpApp.navigationModule",["ngRoute","ngSanitize"]);navigationModule.controller("NavigationCtrl",["$scope","$controller","NavigationService",function(n,t,i){n.populateControlData=function(t,r,u){n.callWebApiService(i,{ItemId:t,LevelsDeep:r,Footer:u}).then(function(t){var i,r;for(n.HandleResponseErrors(t),n.data.items=t.NavigationItems,i=0;i<t.NavigationItems.length;i++)if(t.NavigationItems[i].Name=="Programs"&&t.NavigationItems[i].Active)for(r=0;r<t.NavigationItems[i].Children.length;r++)t.NavigationItems[i].Children[r].Active&&(n.ProgramNav=t.NavigationItems[i].Children[r]);return!0},function(){n.onSubmitFail()})};n.init=function(i,r,u){angular.extend(this,t("BaseCtrl",{$scope:n}));n.data={};n.ProgramNav=null;n.populateControlData(i,r,u);jQuery("#mobilenav").click(function(){jQuery("#mobilenav").attr("aria-expanded")==="false"?($(".mobileMenuIcon").addClass("fa-close").removeClass("fa-bars"),$(".menu-mobile-text").html("CLOSE")):($(".mobileMenuIcon").addClass("fa-bars").removeClass("fa-close"),$(".menu-mobile-text").html("MENU"))})}}]);programNavigationModule=angular.module("corpApp.programNavigationModule",["ngRoute","ngSanitize"]);programNavigationModule.controller("ProgramNavigationCtrl",["$scope","$controller","ProgramNavigationService",function(n,t,i){n.populateControlData=function(t,r){n.callWebApiService(i,{ItemId:t,LevelsDeep:r}).then(function(t){return n.HandleResponseErrors(t),n.data.items=t.NavigationItems,n.Home=t.Home,n.NavLogo=t.NavLogo,n.Logo=t.Logo,t.ShowProgramNav&&(n.ShowProgramNavigation=!0),!0},function(){n.onSubmitFail()})};n.init=function(i,r){angular.extend(this,t("BaseCtrl",{$scope:n}));n.data={};n.ShowProgramNavigation=!1;n.populateControlData(i,r)}}]);shopBreadcrumbModule=angular.module("corpApp.shopBreadcrumbModule",["ngRoute","ngSanitize"]);shopBreadcrumbModule.controller("ShopBreadcrumbCtrl",["$scope","$controller","ShopBreadcrumbService",function(n,t,i){n.populateControlData=function(t){n.callWebApiService(i,{ContextUrl:t}).then(function(t){return n.HandleResponseErrors(t),n.data.items=t.BreadcrumbItems,!0},function(){n.onSubmitFail()})};n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));n.data={};n.populateControlData(window.location.href)}}]);shopNavigationModule=angular.module("corpApp.shopNavigationModule",["ngRoute","ngSanitize"]);shopNavigationModule.controller("ShopNavigationCtrl",["$scope","$controller","ShopNavigationService",function(n,t,i){n.populateControlData=function(t){n.callWebApiService(i,{ContextUrl:t}).then(function(t){return n.HandleResponseErrors(t),n.data=t,!0},function(){n.onSubmitFail()})};n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));n.data={};n.populateControlData(window.location.href)}}]);navigationModule=angular.module("corpApp.paymentNABModule",["ngRoute","ngSanitize"]);navigationModule.controller("PaymentCtrl",["$scope","$controller","PaymentService",function(n,t,i){n.populateControlData=function(t,r,u,f,e){n.callWebApiService(i,{CreditcardNumber:t,ExpiryDate:r,CardHolderName:u,Amount:f,PONumber:e}).then(function(t){return n.HandleResponseErrors(t),n.result=t.PaymentSuccesfull,!0},function(){n.onSubmitFail()})};n.init=function(i,r,u,f,e){angular.extend(this,t("BaseCtrl",{$scope:n}));n.data={};n.populateControlData(i,r,u,f,e)}}]);orderdetailsModule=angular.module("corpApp.uCommerceOrderDetailsModule",["ngRoute","ngSanitize"]);orderdetailsModule.controller("OrderDetailsCtrl",["$scope","$window","$controller","GetOrderCompletedService",function(n,t,i,r){n.getOrderDetails=function(i){n.callWebApiService(r,{ContextUrl:window.location.pathname,paramOrderGuid:i}).then(function(i){if(n.HandleResponseErrors(i),n.order=i.CartItems,n.order){var r={google_conversion_id:1025525086,google_conversion_language:"en",google_conversion_format:"1",google_conversion_color:"ffffff",google_conversion_label:"ztPaCOqZqAQQ3oqB6QM",google_conversion_value:"AUD"+angular.copy(n.order.OrderTotal),google_conversion_currency:"AUD",google_remarketing_only:!1};t.google_trackConversion(r)}else $(".main-content").hide();return!0},function(){n.onSubmitFail();$(".main-content").hide()})};n.init=function(){angular.extend(this,i("BaseCtrl",{$scope:n}));n.errorWithOrder=jsCommon.getUrlParameter("error")?jsCommon.getUrlParameter("error").toLowerCase():"false";n.getOrderDetails(jsCommon.getUrlParameter("id"))}}]);Array.prototype.pushUnique=function(n){return this.indexOf(n)===-1?(this.push(n),!0):!1};productbyidModule=angular.module("corpApp.uCommerceProductByIDModule",["ngRoute","ngSanitize"]);productbyidModule.factory("ProductDetailFactory",function(){return{ProductSku:"",VariantSku:"",ProductName:"",Quantity:0}});productbyidModule.service("sharedProperties",function(){sessionStorage.getItem("cartCount")||sessionStorage.setItem("cartCount",0);var n=parseInt(sessionStorage.getItem("cartCount"));return{getCartCount:function(){return n},setCartCount:function(t){n=t;sessionStorage.setItem("cartCount",t)},initTooltip:function(n){var t="#"+n+" .link-btn";$(t).qtip({content:"<p><strong>ADDED TO CART<\/strong><\/p><p><a href='/view-cart' title='View Cart'>View Cart<\/a><\/p>",position:{my:"bottom center",at:"top center"},style:{classes:"addtocart-success-tooltip"},show:!0,hide:{fixed:!0,event:"unfocus"},events:{hidden:function(n,t){t.disable(!0)}}})}}}).controller("ProductByIdCtrl",["$scope","$controller","ProductByIDService","AddToCartService","ProductDetailFactory","sharedProperties",function(n,t,i,r,u,f){n.ProductDetail=u;n.populateControlData=function(t){n.callWebApiService(i,{ContextUrl:t}).then(function(t){return n.HandleResponseErrors(t),n.data.item=t.ProductRLSSWA,n.data.item.displayPrice=n.data.item.Price,n.data.item.displaySalePrice=n.data.item.SalePrice,n.data.addToCartObj.ProductSku=t.ProductRLSSWA.ProductSku,t.ProductRLSSWA.ShortDesc=t.ProductRLSSWA.ShortDesc.replace(/(?:\r\n|\r|\n)/g,"<br />"),n.data.item.Variants&&n.initVariantData(),isVipMembershipProduct(t.ProductRLSSWA.ProductSku)&&(n.data.item.isVipMembership=!0,n.data.VipPaymentDates=[{date:1,name:"1st"},{date:15,name:"15th"}]),!0},function(){n.onSubmitFail()})};n.initVariantData=function(){var i={},t;for(n.data.VariantArray=[],Object.keys(n.data.item.Variants[0].Properties).map(function(t,r){i[t]=[];n.data.VariantArray[r]=t;n.data.VariantSelection[t]=null}),t=0;t<n.data.item.Variants.length;t++)Object.keys(n.data.item.Variants[t].Properties).map(function(r){i[r].pushUnique(n.data.item.Variants[t].Properties[r])});n.data.item.VariantKeys=i;Object.keys(n.data.VariantSelection).map(function(t){n.$watch('data.VariantSelection["'+t+'"]',function(){for(var r=n.data.VariantArray.indexOf(t)+1,i=r;i<n.data.VariantArray.length;i++)n.data.VariantSelection[n.data.VariantArray[i]]=null})});n.data.selectVariant=function(t){if(t){var i=JSON.parse(t);n.data.addToCartObj.VariantSku=i.VariantSku;n.data.item.displayPrice=i.Price;n.data.item.displaySalePrice=i.SalePrice}}};n.addToCart=function(){if(n.AddToCartForm.$submitted=!0,n.AddToCartForm.$valid&&!n.AddToCartForm.$pending){n.AddToCartForm.$pending=!0;var t=n.data.addToCartObj.VariantSku?n.data.addToCartObj.VariantSku:"null";isVipMembershipProduct(n.data.addToCartObj.ProductSku)&&(sessionStorage.setItem("vipPaymentDate",n.data.item.vipPaymentDate),sessionStorage.setItem("vipMonthlyCommitment",n.data.item.Price.replace("$","")),sessionStorage.setItem("vipDateOfBirth",n.data.item.vipDateOfBirth));n.callWebApiService(r,{ContextUrl:window.location.pathname,VariantSku:t,Quantity:n.data.addToCartObj.Quantity}).then(function(t){return n.HandleResponseErrors(t),f.initTooltip(n.data.addToCartObj.OccurenceId),f.setCartCount(t.NumberOfItems),Object.keys(n.data.VariantSelection).map(function(t){n.data.VariantSelection[t]=null}),n.AddToCartForm.$submitted=!1,n.AddToCartForm.$pending=!1,window.location.href="/view-cart",!0},function(){n.onSubmitFail()})}};n.increaseQty=function(){n.data.addToCartObj.Quantity=parseInt(n.data.addToCartObj.Quantity)+1};n.decreaseQty=function(){n.data.addToCartObj.Quantity=parseInt(n.data.addToCartObj.Quantity)<2?1:parseInt(n.data.addToCartObj.Quantity)-1};n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));n.data={};n.data.VariantSelection={};n.data.addToCartObj={Quantity:1};n.populateControlData(window.location.pathname);n.showControls=function(){(n.AddToCartForm.$submitted=!0,n.AddToCartForm.$valid)&&(n.AddToCartForm.$pending||(isVipMembershipProduct(n.data.addToCartObj.ProductSku)&&(sessionStorage.setItem("vipPaymentDate",n.data.item.vipPaymentDate),sessionStorage.setItem("vipMonthlyCommitment",n.data.item.Price.replace("$","")),sessionStorage.setItem("vipDateOfBirth",n.data.item.vipDateOfBirth)),n.ProductDetail.ProductSku=n.ProductSKU,n.ProductDetail.VariantSku=n.data.addToCartObj.VariantSku,n.ProductDetail.CourseName=n.data.item.Name,n.ProductDetail.Quantity=n.data.addToCartObj.Quantity,jQuery(".popcagbg").slideFadeToggle2(),jQuery(".popcag").slideFadeToggle1()))}}}]).controller("TrainingCourseByIdCtrl",["$scope","$controller","$sce","ProductByIDService","AddToCartService","GetCartService","ProductDetailFactory","sharedProperties",function(n,t,r,u,f,e,o,s){n.ProductDetail=o;n.populateControlData=function(){n.callWebApiService(u,{ContextUrl:window.location.pathname}).then(function(t){function u(t){var i,r,u;if(t.Properties===undefined)return!1;if(i=!(t.Properties.Days===undefined||t.Properties.Days===null||t.Properties.Days.length===0),n.data.item.IsButtonLayout){if(t.Properties.End===undefined||t.Properties.End===null||t.Properties.End.length===0)return!1}else if(!i)return!1;return i?(r=JSON.parse(t.Properties.Days),u=new Date(r[r.length-1].End),u>=new Date):variantDateFormatToMoment(t.Properties.End).toDate()>=new Date}for(n.HandleResponseErrors(t),t.ProductRLSSWA.ShortDesc=t.ProductRLSSWA.ShortDesc.replace(/(?:\r\n|\r|\n)/g,"<br />"),i=0;i<t.ProductRLSSWA.Variants.length;i++){var r=t.ProductRLSSWA.Variants[i].Properties.Location;r!==undefined&&r!==null&&r.length>0&&(r=r.replace(/ /g,"+"),t.ProductRLSSWA.Variants[i].Properties.locationLink=window.location.hostname+"/course location/?"+r)}return n.data.item=t.ProductRLSSWA,n.data.item.Variants.sort(function(n,t){return(n=n.Properties.Days!==undefined&&n.Properties.Days!==null&&n.Properties.Days.length>0?new Date(JSON.parse(n.Properties.Days)[0].Start):variantDateFormatToMoment(n.Properties.Start),t=t.Properties.Days!==undefined&&t.Properties.Days!==null&&t.Properties.Days.length>0?new Date(JSON.parse(t.Properties.Days)[0].Start):variantDateFormatToMoment(t.Properties.Start),n>t)?1:n<t?-1:0}),n.data.item.Variants=n.data.item.Variants.filter(u),n.data.item.Variants!=null&&n.data.item.Variants.length>0&&n.initVariantData(),n.data.addToCartObj.ProductSku=t.ProductRLSSWA.ProductSku,!0},function(){n.onSubmitFail()})};n.initVariantData=function(){var s={},h,e,i,t,c,l,r,u,f,a,o;for(n.data.CourseOccurences=[],n.data.FilteredCourseOccurences=n.data.CourseOccurences,n.data.VariantArray=[],n.data.Locations=[],Object.keys(n.data.item.Variants[0].Properties).map(function(t,i){s[t]=[];n.data.VariantArray[i]=t;n.data.VariantSelection[t]=null}),h=!1,e=null,i=0;i<n.data.item.Variants.length;i++)t=n.data.item.Variants[i],c="https://"+window.location.hostname+"/course location/?"+t.Properties.Location.replace(/ /g,"+"),t.Properties!==undefined&&(l=t.Properties.Days!==undefined&&t.Properties.Days!==null&&t.Properties.Days.length>0,l?(r=JSON.parse(t.Properties.Days),u=moment(r[0].Start),f=moment(r[r.length-1].End)):(r=undefined,u=variantDateFormatToMoment(t.Properties.Start),f=variantDateFormatToMoment(t.Properties.End)),a=parseInt(t.Properties.PlacesLeft)<=0?"full":parseInt(t.Properties.PlacesLeft)<=5?"hurry":"default",o={start:u,end:f,title:(t.SalePrice?t.SalePrice:t.Price)+" "+t.Properties.Location,date:f.isAfter(u,"day")?u.format("DD/MM/YYYY")+" - "+f.format("DD/MM/YYYY"):u.format("DD/MM/YYYY"),location:t.Properties.Location,locationLink:c,days:r,className:a,variantSku:t.VariantSku,variantPrice:t.Price,variantSalePrice:t.SalePrice,variantLimitedPlaces:parseInt(t.Properties.PlacesLeft)<=5&&parseInt(t.Properties.PlacesLeft)>0?"True":"False",variantCourseFull:parseInt(t.Properties.PlacesLeft)<=0?"True":"False",occurenceId:"occurenceId"+i,requiresWebsiteDisclaimer:t.RequiresWebsiteDisclaimer,assignedStaff:t.AssignedStaff},n.data.CourseOccurences.push(o),n.data.Locations.pushUnique(o.location),!h&&t.Properties.PlacesLeft>0&&(e=o,h=!0),Object.keys(n.data.item.Variants[i].Properties).map(function(t){s[t].pushUnique(n.data.item.Variants[i].Properties[t])}));n.data.item.VariantKeys=s;n.data.selectVariant=function(t){n.data.addToCartObj.VariantSku=t.variantSku;n.data.item.selectedCourse={date:t.end.isAfter(t.start,"day")?t.start.format("DD/MM/YYYY")+" - "+t.end.format("DD/MM/YYYY"):t.start.format("DD/MM/YYYY"),time:t.start.format("hh:mma")+" - "+t.end.format("hh:mma"),location:t.location,locationLink:t.locationLink,days:t.days,price:t.variantPrice,salePrice:t.variantSalePrice,limitedPlaces:t.variantLimitedPlaces,courseFull:t.variantCourseFull,requiresWebsiteDisclaimer:t.requiresWebsiteDisclaimer,assignedStaff:t.assignedStaff};n.checkIfVariantInBasket()};n.changeFilterButtons=function(){function t(t){return n.data.calendarFilter?t.location==n.data.calendarFilter:t.location}n.data.FilteredCourseOccurences=n.data.CourseOccurences.filter(t);n.$apply()};n.changeFilter=function(){function t(t){return n.data.calendarFilter?t.location==n.data.calendarFilter:t.location}n.data.FilteredCourseOccurences=n.data.CourseOccurences.filter(t);$("#calendar").fullCalendar("removeEvents");$("#calendar").fullCalendar("addEventSource",n.data.FilteredCourseOccurences);$("#calendar").fullCalendar("rerenderEvents")};$(document).ready(function(){$("#calendar").fullCalendar({header:{left:"",center:"title",right:"today prev,next"},eventSources:[n.data.CourseOccurences],eventClick:function(t){$(this).closest("#calendar").find("a.fc-event").removeClass("selected");$(this).hasClass("selected")||$(this).addClass("selected");var i=angular.element($("#trainingcoursebyid")),u=i.controller(),r=i.scope();r.$apply(function(){n.data.courseSelectHeading="Selected Course";r.data.selectVariant(t)})},eventRender:function(n,t){t.qtip({content:n.variantCourseFull=="True"?"Course Full":"Starting "+n.start.format("ddd h:mma")+" at "+n.location+(n.variantLimitedPlaces=="True"?" (LIMITED SPACES)":""),position:{my:"bottom center",at:"top center"},style:{classes:"qtip-rounded "+n.className}})}});$("#calendar").fullCalendar("gotoDate",e.start);n.data.selectVariant(e)})};n.getBasket=function(t){n.callWebApiService(e,{ContextUrl:window.location.pathname}).then(function(i){return n.HandleResponseErrors(i),n.basket=i.CartItems,n.basket==null&&s.setCartCount(0),t(),!0},function(){n.onSubmitFail()})};n.checkIfVariantInBasket=function(){var i=!1,t,r;if(n.basket&&n.basket.TrainingLineItems&&n.basket.TrainingLineItems.length>0)for(t=0;t<n.basket.TrainingLineItems.length;t++)r=n.basket.TrainingLineItems[t].VariantSku,r==n.data.addToCartObj.VariantSku&&(i=!0);n.variantInBasket=i};n.addToCart=function(){n.AddToCartForm.$submitted=!0;n.AddToCartForm.$pending||(n.AddToCartForm.$pending=!0,n.callWebApiService(f,{ContextUrl:window.location.pathname,VariantSku:n.data.addToCartObj.VariantSku,Quantity:n.data.addToCartObj.Quantity}).then(function(t){return n.HandleResponseErrors(t),s.initTooltip(n.data.addToCartObj.OccurenceId),s.setCartCount(t.NumberOfItems),n.variantInBasket=!0,n.AddToCartForm.$submitted=!1,n.AddToCartForm.$pending=!1,window.location.href="/view-cart",!0},function(){n.onSubmitFail()}))};n.selectAndAddToCart=function(t,i){var u=t,r;n.data.addToCartObj.VariantSku=u;r=i;n.data.addToCartObj.OccurenceId=r;n.addToCart()};n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));n.data={};n.data.VariantSelection={};n.data.selectedCourse={};n.data.addToCartObj={Quantity:1};n.data.courseSelectHeading="Next Available Course";n.getBasket(n.populateControlData);n.showControls=function(t){(n.AddToCartForm.$submitted=!0,n.AddToCartForm.$valid)&&(n.AddToCartForm.$pending||(n.ProductDetail.VariantSku=t!==undefined&&t!==null?t.variantSku:n.data.addToCartObj.VariantSku,n.ProductDetail.ProductSku=n.ProductSKU,n.ProductDetail.CourseName=n.data.item.Name,n.ProductDetail.Quantity=n.data.addToCartObj.Quantity,jQuery(".popcagbg").slideFadeToggle2(),jQuery(".popcag").slideFadeToggle1()))}}}]).controller("ViewCartIconCtrl",["$scope","$controller","sharedProperties",function(n,t,i){n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));n.cartCount=i.getCartCount}}]).controller("ViewCartCtrl",["$scope","$controller","GetCartService","GetAbandonedCartService","UpdateCartService","ShippingService","AddPromoCodeService","SuburbQueryService","sharedProperties",function(n,t,i,r,u,f,e,o,s){function h(){n.EnrolmentForm[n.personalDetailFormSectionName].$setPristine();n.EnrolmentForm[n.personalDetailFormSectionName].$setUntouched();n.EnrolmentForm[n.usiDetailFormSectionName].$setPristine();n.EnrolmentForm[n.usiDetailFormSectionName].$setUntouched();n.EnrolmentForm[n.addressDetailFormSectionName].$setPristine();n.EnrolmentForm[n.addressDetailFormSectionName].$setUntouched();n.EnrolmentForm[n.contactDetailFormSectionName].$setPristine();n.EnrolmentForm[n.contactDetailFormSectionName].$setUntouched();n.EnrolmentForm[n.emergencyContactDetailFormSectionName].$setPristine();n.EnrolmentForm[n.emergencyContactDetailFormSectionName].$setUntouched();n.EnrolmentForm[n.declarationFormSectionName].$setPristine();n.EnrolmentForm[n.declarationFormSectionName].$setUntouched();n.EnrolmentForm.$setPristine();n.EnrolmentForm.$setUntouched()}function c(n){var t,i,r;if(n!==undefined&&n!==null&&n.length>0)for(t=0;t<n.length;t++)n[t]!==undefined&&n[t]!==null&&n[t].CourseGovernmentDiscountEligible&&n[t].GovernmentDiscountEligibleCount>0&&n[t].UnitDiscount>0&&(i=n[t].GovernmentDiscountEligibleCount,r=i*n[t].Price/n[t].Quantity,n[t].UnitDiscount=n[t].UnitDiscount-r)}n.loadEnrolmentDetails=function(t,i,r){h();n.selectedEnrolment={item:t,enrolmentIndex:r,itemIndex:i};var u=n.enrolments[t.VariantSku][r];n.displayEnrolment=u?u:{price:t.Total};!n.displayEnrolment.email&&n.basket.Email&&(n.displayEnrolment.email=n.basket.Email);n.dialogCourseName=t.ParentItem;n.courseGovernmentDiscountEligible=t.CourseGovernmentDiscountEligible;n.dialog.dialog("open");n.EnrolmentForm.$submitted=!1;n.showEnrolmentFormSection(n.personalDetailFormSectionName)};n.toTitleCase=function(n){for(var t=n.toLowerCase().split(" "),i=0;i<t.length;i++)t[i]=t[i].charAt(0).toUpperCase()+t[i].substring(1);return t.join(" ")};n.addEnrolment=function(t){var r,i,t;if(n.EnrolmentForm.$submitted=!0,n.EnrolmentForm.$valid&&n.govtDiscountValidState()){if(n.selectedEnrolment.enrolmentIndex>=0)n.enrolments[n.selectedEnrolment.item.VariantSku][n.selectedEnrolment.enrolmentIndex]=n.displayEnrolment;else for(n.displayEnrolment.id||(n.displayEnrolment.id=Math.floor(Date.now()/1e3)),n.enrolments[n.selectedEnrolment.item.VariantSku].push(n.displayEnrolment),r=n.getGovtDiscountSelectionCountFromEnrolmentArray(n.enrolments[n.selectedEnrolment.item.VariantSku]),n.selectedEnrolment.item.Quantity=n.enrolments[n.selectedEnrolment.item.VariantSku].length,n.updateQty(n.selectedEnrolment.item,r),i=0;i<n.basket.TrainingLineItems.length;i++)t=n.basket.TrainingLineItems[i].VariantSku,t==n.selectedEnrolment.item.VariantSku&&(n.basket.TrainingLineItems[i].error={noEnrolments:!1});n.closeDialog();n.setEnrolments(n.enrolments);n.loadEnrolments()}};n.removeEnrolment=function(t,i,r){n.selectedEnrolment={item:t,enrolmentIndex:r,itemIndex:i};n.enrolments[t.VariantSku].splice(r,1);n.selectedEnrolment.item.Quantity=n.enrolments[t.VariantSku].length;n.selectedEnrolment.item.Quantity<1&&(n.selectedEnrolment.item.Quantity=1);var u=n.getGovtDiscountSelectionCountFromEnrolmentArray(n.enrolments[t.VariantSku]);n.updateQty(t,u);n.setEnrolments(n.enrolments);n.loadEnrolments()};n.setEnrolments=function(n){n!==null&&n!==undefined&&angular.forEach(n,function(n){n.forEach(function(n){n.dobSerialised=n.dob.toString()})});sessionStorage.setItem("enrolments",JSON.stringify(n))};n.loadEnrolments=function(){var r,i,t;for(sessionStorage.getItem("enrolments")||n.setEnrolments({}),n.enrolments=JSON.parse(sessionStorage.getItem("enrolments")),n.enrolments!==null&&n.enrolments!==undefined&&angular.forEach(n.enrolments,function(n){n.forEach(function(n){n.dob=n.dobSerialised})}),t=0;t<n.basket.TrainingLineItems.length;t++)r=n.basket.TrainingLineItems[t].VariantSku,n.enrolments[r]||(n.enrolments[r]=[]);n.enrolmentNames={hasNames:!1,names:{}};for(i in n.enrolments)for(t=0;t<n.enrolments[i].length;t++)n.enrolmentNames.hasNames=!0,n.enrolmentNames.names[n.enrolments[i][t].id]=n.enrolments[i][t]};n.selectPerson=function(){var t=JSON.parse(n.selectedPerson);t.dob=t.dobSerialised;n.displayEnrolment=t};n.getAbandonedBasket=function(t,i,u,f){n.callWebApiService(r,{emailAddress:t,basketId:i,orderGuid:u}).then(function(t){return window.location.replace(window.location.href.replace(window.location.search,"")),n.getBasketCallback(t,f)},function(){n.onSubmitFail()})};n.getBasket=function(t){n.callWebApiService(i,{ContextUrl:window.location.pathname}).then(function(i){return n.getBasketCallback(i,t)},function(){n.onSubmitFail()})};n.getBasketCallback=function(t,i){return n.HandleResponseErrors(t),n.basket=t.CartItems,s.setCartCount(t.CartItems.TotalItems),sessionStorage.getItem("shippingPostcode")?(n.shippingPostcode=parseInt(sessionStorage.getItem("shippingPostcode")),n.getShippingEstimate()):n.basket.ShippingTotal=0,n.checkIfShippableItems(),c(n.basket.TrainingLineItems),i(),!0};n.checkIfShippableItems=function(){for(var i=!1,t=0;t<n.basket.ProductLineItems.length;t++)n.basket.ProductLineItems[t].IsShippable=="True"&&(i=!0);n.hasShippableItems=i};n.updateQty=function(t,i){n.callWebApiService(u,{ContextUrl:window.location.pathname,Quantity:t.Quantity,OrderLineId:t.OrderLineId,GovernmentDiscountEligibleQuantity:i}).then(function(t){return n.HandleResponseErrors(t),n.basket=t.CartItems,n.basket==null&&s.setCartCount(0),s.setCartCount(t.CartItems.TotalItems),n.getShippingEstimate(),!0},function(){n.onSubmitFail()})};n.removeItem=function(t){n.callWebApiService(u,{ContextUrl:window.location.pathname,Quantity:0,OrderLineId:t.OrderLineId,GovernmentDiscountEligible:!1}).then(function(i){return n.HandleResponseErrors(i),n.basket=i.CartItems,n.basket==null&&s.setCartCount(0),s.setCartCount(i.CartItems.TotalItems),n.getShippingEstimate(),n.checkIfShippableItems(),isVipMembershipProduct(t.Sku)&&(sessionStorage.removeItem("vipPaymentDate"),sessionStorage.removeItem("vipMonthlyCommitment"),sessionStorage.removeItem("vipDateOfBirth")),n.enrolments[t.VariantSku]&&(delete n.enrolments[t.VariantSku],n.setEnrolments(n.enrolments),n.loadEnrolments()),!0},function(){n.onSubmitFail()})};n.goToCourseFormSection=function(t){(n.EnrolmentForm.$setSubmitted(),n.EnrolmentForm[n.currentFormSectionName].$valid||n.EnrolmentForm[n.currentFormSectionName].$pristine)&&(n.currentFormSectionName=t,n.EnrolmentForm.$submitted=!1,n.showEnrolmentFormSection(t))};n.showEnrolmentFormSection=function(t){var i=$("*[name="+t+"]"),r=$(i).find(".form-section"),u=$(i).find(".form-section-toggle-btn-collapse"),f=$(i).find(".form-section-toggle-btn-expand");r.is(":visible")||($(".form-section").slideUp(),$(".form-section-toggle-btn-collapse").hide(),$(".form-section-toggle-btn-expand").show(),r.slideDown(),f.hide(),u.show());n.currentFormSectionName=t};n.closeDialog=function(){n.dialog.dialog("close");n.selectedPerson="{}";n.selectedEnrolment=null;n.EnrolmentForm.$submitted=!1};n.updateShippingEstimate=function(){n.ShippingEstimateForm.$submitted=!0;n.ShippingEstimateForm.$valid&&!n.ShippingEstimateForm.$pending&&(n.ShippingEstimateForm.$pending=!0,sessionStorage.setItem("shippingPostcode",n.shippingPostcode),n.getShippingEstimate())};n.getShippingEstimate=function(){n.callWebApiService(f,{ContextUrl:window.location.pathname,Postcode:parseInt(sessionStorage.getItem("shippingPostcode"))}).then(function(t){return n.HandleResponseErrors(t),n.basket.ShippingTotal=t.ShippingEstimate,n.ShippingEstimateForm.$submitted=!1,n.ShippingEstimateForm.$pending=!1,!0},function(){n.onSubmitFail()})};n.applyPromoCode=function(){n.PromoCodeForm.$submitted=!0;n.PromoCodeForm.$valid&&!n.PromoCodeForm.$pending&&(n.PromoCodeForm.$pending=!0,n.callWebApiService(e,{ContextUrl:window.location.pathname,PromoCode:n.promocode}).then(function(t){return n.HandleResponseErrors(t),n.getBasket(n.loadEnrolments),n.PromoCodeForm.$submitted=!1,n.PromoCodeForm.$pending=!1,n.promocode="",!0},function(){n.onSubmitFail()}))};n.courseWithoutEnrolment=function(){for(var r,i=!1,t=0;t<n.basket.TrainingLineItems.length;t++)r=n.basket.TrainingLineItems[t].VariantSku,n.enrolments[r].length?n.basket.TrainingLineItems[t].error={noEnrolments:!1}:(i=!0,n.basket.TrainingLineItems[t].error={noEnrolments:!0});return i};n.checkout=function(){n.courseWithoutEnrolment()||window.location.replace("/view-cart/checkout")};n.querySuburb=function(t){n.suburbLocked=!1;t!==null&&t!==undefined&&t.length>2&&(n.suburbSuggestions=[],n.suburbSelected===!1&&n.callWebApiService(o,{suburb:t}).then(function(t){return n.HandleResponseErrors(t),n.suburbSuggestions=t.Suburbs,!0},function(){n.onSubmitFail()}))};n.selectSuburbSelection=function(t){n.suburbLocked=!0;n.suburbSelected=!0;n.suburbSuggestions=[];n.displayEnrolment.suburb=t.Suburb;n.displayEnrolment.postcode=t.Postcode;n.displayEnrolment.state=t.State;n.suburbSelected=!1};n.govtDiscountSelected=function(n){var t=!1;return n!==undefined&&n!==null&&(n.aged15to24||n.secondarySchoolAgedPersonsNotAtSchool||n.jobSeekerOrJobKeeper||n.youthAllowanceAustudyAbstudy||n.pensionerConcessionOrHealthCareCard||n.healthBenefitsVeteransAffairs||n.inmatesCustodialInstitution)&&(t=!0),t};n.validUsiSupplied=function(){return n.displayEnrolment!==undefined&&n.displayEnrolment!==null&&n.displayEnrolment.usi!==undefined&&n.displayEnrolment.usi!==null&&n.displayEnrolment.usi.length===10};n.govtDiscountValidState=function(){var t=n.govtDiscountSelected(n.displayEnrolment.governmentDiscountEligibility);return!t||n.validUsiSupplied()};n.getGovtDiscountSelectionCountFromEnrolmentArray=function(t){var r=0,i;if(t!==undefined&&t!==null)for(i=0;i<t.length;i++)n.govtDiscountSelected(t[i].governmentDiscountEligibility)&&r++;return r};n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));n.personalDetailFormSectionName="PersonalDetailForm";n.usiDetailFormSectionName="UsiDetailForm";n.addressDetailFormSectionName="AddressDetailForm";n.contactDetailFormSectionName="ContactDetailForm";n.emergencyContactDetailFormSectionName="EmergencyContactDetailForm";n.declarationFormSectionName="DeclarationForm";n.courseGovernmentDiscountEligibleFormSectionName="GovernmentDiscountEligibleForm";n.basket=null;n.enrolments={};n.enrolmentNames={};n.dialog=null;n.selectedEnrolment=null;n.selectedPerson="{}";n.dialogCourseName=null;n.courseGovernmentDiscountEligible=!1;n.hasShippableItems=!1;n.PromoCodeForm={responseError:null};n.displayEnrolment={governmentDiscountEligibility:{}};var r=!1,u=location.search.substring(1),i={};u&&(i=JSON.parse('{"'+decodeURI(u).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')+'"}'),i&&i.e&&i.b&&i.o&&(r=!0));r?n.getAbandonedBasket(i.e,i.b,i.o,n.loadEnrolments):n.getBasket(n.loadEnrolments);n.suburbSelected=!1;n.suburbLocked=!1;$(function(){var t=.8,i=$(window).width(),r=i*t,u=$(window).height(),f=u*t;n.dialog=$("#dialog-form").dialog({autoOpen:!1,modal:!0,width:r,height:f,open:function(){$("body").css("overflow","hidden")},close:function(){$("body").css("overflow","auto")},dialogClass:"enrolment-dialog"})})}}]).controller("CheckoutCtrl",["$scope","$controller","$q","XDbPageEventsService","GetCartService","ShippingService","IsLoggedInService","PaymentService","sharedProperties",function(n,t,r,u,f,e,o,h,c){n.PageID="";n.GoalID="";n.ProductSKU="";n.setGoal=function(n,t,i){var f=r.defer(),e=function(n){f.resolve(n)},o=function(){f.reject()};return u.create({id:n,goalId:t,sku:i},e,o),f.promise};n.checkSku=function(t,i,r){if(r!="undefined"&&r.length>0&&r!=null)for(s=0;s<r.length;s++){var u=r[s].Sku;n.setGoal(t,i,u).then(function(){return console.debug("Successfully processed goal 'Request Visit'."),!0},function(){return console.debug("Failed to process goal 'Request Visit'."),!1}).finally(function(){window.location.replace(link.href)})}};n.getBasket=function(){n.callWebApiService(f,{ContextUrl:window.location.pathname}).then(function(t){var r,i;for(n.HandleResponseErrors(t),n.basket=t.CartItems,n.basket==null&&(c.setCartCount(0),window.location.replace("/")),n.basket&&n.basket.BillingDetails&&(n.checkoutDetails.account.email=n.basket.BillingDetails.Email||"",n.checkoutDetails.billing.firstname=n.basket.BillingDetails.FirstName||"",n.checkoutDetails.billing.surname=n.basket.BillingDetails.SurName||"",n.checkoutDetails.billing.company=n.basket.BillingDetails.Company||"",n.checkoutDetails.billing.phone=n.basket.BillingDetails.Phone||"",n.checkoutDetails.billing.mobilephone=n.basket.BillingDetails.MobilePhone||"",n.checkoutDetails.billing.streetaddress=n.basket.BillingDetails.StreetAddress||"",n.checkoutDetails.billing.suburb=n.basket.BillingDetails.Suburb||"",n.checkoutDetails.billing.postcode=n.basket.BillingDetails.PostCode||""),r=n.basket.TrainingLineItems.concat(n.basket.ProductLineItems),n.ProductSKU=r,sessionStorage.getItem("shippingPostcode")?(n.shippingPostcode=sessionStorage.getItem("shippingPostcode"),n.getShippingEstimate()):n.basket.ShippingTotal=0,i=0;i<n.basket.ProductLineItems.length;i++)n.basket.ProductLineItems[i].IsShippable=="True"&&(n.hasShippableItems=!0);return n.checkoutDetails.billingSameDelivery=!n.hasShippableItems,n.showPickupOption=angular.copy(n.hasShippableItems),n.showGuestCheckoutOption=!n.hasVipMembershipItems(),!0},function(){n.onSubmitFail()})};n.getShippingEstimate=function(t){var i=parseInt(sessionStorage.getItem("shippingPostcode"));t&&(i=t,sessionStorage.setItem("shippingPostcode",i));n.callWebApiService(e,{ContextUrl:window.location.pathname,Postcode:i}).then(function(t){return n.HandleResponseErrors(t),n.basket.ShippingTotal=t.ShippingEstimate,!0},function(){n.onSubmitFail()})};n.hasVipMembershipItems=function(){for(var i=!1,t=0;t<n.basket.ProductLineItems.length;t++)isVipMembershipProduct(n.basket.ProductLineItems[t].Sku)&&(i=!0);return i};n.getLoggedInUser=function(){n.callWebApiService(o,{request:1}).then(function(t){return n.HandleResponseErrors(t),n.loggedInUser=t.LoggedIn,!0},function(){n.onSubmitFail()})};n.verifyEnrolmentsForCourses=function(){var i=!0,r=sessionStorage.getItem("enrolments")?JSON.parse(sessionStorage.getItem("enrolments")):null,t,u;if(n.basket.TrainingLineItems.length&&r==null)i=!1,n.enrolmentsMissing=!0;else for(t=0;t<n.basket.TrainingLineItems.length;t++)u=n.basket.TrainingLineItems[t].VariantSku,r[u]||(i=!1,n.enrolmentsMissing=!0);return i};n.changePickupOrder=function(){n.hasShippableItems=!n.pickupOrder;n.checkoutDetails.billingSameDelivery=!n.hasShippableItems};n.payNow=function(){var s,t,r,f;if(n.CheckoutForm.$submitted=!0,n.OverbookedCoursesError=!1,n.OverbookedCourses=null,n.CheckoutForm.$valid&&n.verifyEnrolmentsForCourses()&&!n.CheckoutForm.$pending){n.CheckoutForm.$pending=!0;var u=20,e=n.checkoutDetails.delivery.firstname,o=n.checkoutDetails.delivery.surname,l=e+" "+o;e.length>u&&(n.checkoutDetails.delivery.firstname=e.substr(0,u));l.length>u&&(n.checkoutDetails.delivery.surname=o.substr(0,o.length-(l.length-u)));s=n.checkoutDetails.billingSameDelivery?angular.copy(n.checkoutDetails.delivery):n.checkoutDetails.billing;t={};sessionStorage.getItem("vipPaymentDate")?(t.PreferredPaymentDate=sessionStorage.getItem("vipPaymentDate"),t.MonthlyCommitment=sessionStorage.getItem("vipMonthlyCommitment"),t.DateOfBirth=sessionStorage.getItem("vipDateOfBirth")):t=null;r=sessionStorage.getItem("enrolments")?JSON.parse(sessionStorage.getItem("enrolments")):null;f=null;r!=null&&(f=[],Object.keys(r).map(function(t){for(var i,u,o,e=0;e<r[t].length;e++){for(i=r[t][e],i.occurenceId=t,u=0;u<n.basket.TrainingLineItems.length;u++)if(o=n.basket.TrainingLineItems[u].VariantSku,o===t){var s=n.basket.TrainingLineItems[u].Price,l=n.basket.TrainingLineItems[u].VAT,c=n.basket.TrainingLineItems[u].Quantity,h=n.basket.TrainingLineItems[u].UnitDiscount;h>0&&s>0&&c>0&&(i.price=s-h)}i.dob=i.dob.toString();i.dobParsed=moment(i.dob,n.dobFormat).format();f.push(i)}}));n.submitPaymentRequest=function(){n.PaymentRequest=new h;n.PaymentRequest.ContextUrl=window.location.pathname;n.PaymentRequest.account=n.checkoutDetails.account?n.checkoutDetails.account:null;n.PaymentRequest.billing=s?s:null;n.PaymentRequest.delivery=n.checkoutDetails.delivery?n.checkoutDetails.delivery:null;n.PaymentRequest.payment=n.checkoutDetails.payment?n.checkoutDetails.payment:null;n.PaymentRequest.enrolments=f;n.PaymentRequest.pickup=n.pickupOrder;n.PaymentRequest.guest=n.checkoutDetails.guest;n.PaymentRequest.VipMembership=t;n.PaymentRequest.$save(function(r){var u,k;if(r.PaymentSuccessful){for(t!=null&&(sessionStorage.removeItem("vipPaymentDate"),sessionStorage.removeItem("vipMonthlyCommitment"),sessionStorage.removeItem("vipDateOfBirth"),t=null),n.checkSku(n.PageID,n.GoalID,n.ProductSKU),u=[],i=0;i<n.basket.ProductLineItems.length;i++){var f="p00000",h="Unnamed Product Item",l=0,a=1;n.basket.ProductLineItems[i].Sku!=null&&n.basket.ProductLineItems[i].Sku!=""&&(f=n.basket.ProductLineItems[i].Sku);n.basket.ProductLineItems[i].VariantSku!=null&&n.basket.ProductLineItems[i].VariantSku!=""&&(f=n.basket.ProductLineItems[i].VariantSku);n.basket.ProductLineItems[i].ProductName!=null&&n.basket.ProductLineItems[i].ProductName!=""&&(h=n.basket.ProductLineItems[i].ProductName);n.basket.ProductLineItems[i].Price!=null&&n.basket.ProductLineItems[i].Price!=""&&(l=n.basket.ProductLineItems[i].Price);n.basket.ProductLineItems[i].Quantity!=null&&n.basket.ProductLineItems[i].Quantity!=""&&(a=n.basket.ProductLineItems[i].Quantity);u.push({sku:f,name:h,category:"Product Item",price:l,quantity:a})}for(i=0;i<n.basket.TrainingLineItems.length;i++){var e="t00000",v="Unnamed Training Item",y=0,p=1;n.basket.TrainingLineItems[i].Sku!=null&&n.basket.TrainingLineItems[i].Sku!=""&&(e=n.basket.TrainingLineItems[i].Sku);n.basket.TrainingLineItems[i].VariantSku!=null&&n.basket.TrainingLineItems[i].VariantSku!=""&&(e=n.basket.TrainingLineItems[i].VariantSku);n.basket.TrainingLineItems[i].ProductName!=null&&n.basket.TrainingLineItems[i].ProductName!=""&&(v=n.basket.TrainingLineItems[i].ProductName);n.basket.TrainingLineItems[i].Price!=null&&n.basket.TrainingLineItems[i].Price!=""&&(y=n.basket.TrainingLineItems[i].Price);n.basket.TrainingLineItems[i].Quantity!=null&&n.basket.TrainingLineItems[i].Quantity!=""&&(p=n.basket.TrainingLineItems[i].Quantity);u.push({sku:e,name:v,category:"Training Item",price:y,quantity:p})}var w="transact-ion0-guid-0is0-missing00000",b=0,o=0,s=0;n.basket.OrderGuid!=null&&n.basket.OrderGuid!=""&&(w=n.basket.OrderGuid);n.basket.SubTotal!=null&&n.basket.SubTotal!=""&&(b=n.basket.SubTotal);n.basket.TaxTotal!=null&&n.basket.TaxTotal!=""&&(o=n.basket.TaxTotal);n.basket.ShippingTotal!=null&&n.basket.ShippingTotal!=""&&(s=n.basket.ShippingTotal);k=b+s+o;window.dataLayer=window.dataLayer||[];dataLayer.push({transactionId:w,transactionAffiliation:window.location.hostname+" Store",transactionTotal:k,transactionTax:o,transactionShipping:s,transactionProducts:u,event:"TransactionComplete",eventCallback:function(){window.location.replace("/view-cart/checkout/thank-you?id="+r.OrderGuid+"&error="+r.HasResponseErrors);c.setCartCount(0)},eventTimeout:1e4})}else n.CheckoutForm.error=r.ErrorMessage,n.CheckoutForm.$submitted=!1,n.CheckoutForm.$pending=!1,r.OverbookedCourses!==null&&r.OverbookedCourses.length>0&&(n.OverbookedCoursesError=!0,n.OverbookedCourses=r.OverbookedCourses)})};n.submitPaymentRequest()}};n.AutoFillBillingDrop=function(n){var t=n.FillEnrol[n.FormFillUser];n.checkoutDetails.billing.firstname=t.firstName!=null?t.firstName:"";n.checkoutDetails.billing.surname=t.surname!=null?t.surname:"";n.checkoutDetails.billing.company=t.company!=null?t.company:"";n.checkoutDetails.billing.phone=t.phoneMobile!=null?t.phoneMobile:"";n.checkoutDetails.billing.streetaddress=t.address!=null?t.address:"";n.checkoutDetails.billing.suburb=t.suburb!=null?t.suburb:"";n.checkoutDetails.billing.postcode=t.postcode!=null?t.postcode:"";n.checkoutDetails.billing.state=t.state!=null?t.state:""};n.AutoFillDeliveryDrop=function(n){var t=n.FillEnrol[n.FormFillDeliveryUser];n.checkoutDetails.delivery.firstname=t.firstName!=null?t.firstName:"";n.checkoutDetails.delivery.surname=t.surname!=null?t.surname:"";n.checkoutDetails.delivery.company=t.company!=null?t.company:"";n.checkoutDetails.delivery.phone=t.phoneMobile!=null?t.phoneMobile:"";n.checkoutDetails.delivery.streetaddress=t.address!=null?t.address:"";n.checkoutDetails.delivery.suburb=t.suburb!=null?t.suburb:"";n.checkoutDetails.delivery.postcode=t.postcode!=null?t.postcode:"";n.checkoutDetails.delivery.state=t.state!=null?t.state:""};n.init=function(i,r){var u,f;if(angular.extend(this,t("BaseCtrl",{$scope:n})),n.PageID=i,n.GoalID=r,n.checkoutDetails={register:!1,guest:!0,account:{},delivery:{firstname:"",surname:"",company:"",phone:"",streetaddress:"",suburb:"",postcode:"",mobilephone:""},billing:{firstname:"",surname:"",company:"",phone:"",streetaddress:"",suburb:"",postcode:"",mobilephone:""},hasShippableItems:!1,showPickupOption:!1},n.getLoggedInUser(),n.getBasket(),n.dobFormat="DD/MM/YYYY",n.FillEnrol=[],u=sessionStorage.getItem("enrolments")!=null?JSON.parse(sessionStorage.getItem("enrolments")):null,u!=null)for(first in u)for(f=0;f<u[first].length;f++)u[first][f].index=f,u[first][f].variantSku=first,n.FillEnrol.push(u[first][f]);n.ShowAutoFillout=!1;n.FillEnrol!=null&&(n.ShowAutoFillout=!0);n.showAutoHelp=!1;n.showAutoHelp2=!1;n.FillEnrol!=null&&n.FillEnrol.length>0&&(n.checkoutDetails.account.email=n.FillEnrol[0].email,n.FormFillUser=n.FillEnrol[0].index,n.AutoFillBillingDrop(n),n.FormFillDeliveryUser=n.FillEnrol[0].index,n.AutoFillDeliveryDrop(n))};n.currentYear=(new Date).getFullYear();n.Range=function(n,t){for(var r=[],i=n;i<=t;i++)r.push(i);return r}}]);productbyidModule.filter("dynamicFilter",function(){return function(n,t,i,r,u,f){var s=[],e,o;if(t[r]||u==0)for(e=0;e<n.length;e++)o=!0,Object.keys(t).map(function(i,r){if(r<u&&t[i]){var f=isJson(t[i])?JSON.parse(t[i]).Properties[i]:t[i];n[e].Properties[i]!=f&&(o=!1)}}),o&&f?s.pushUnique(n[e].Properties[i]):o&&s.push(n[e]);return s}}).filter("moment",function(){return function(n,t){return moment(n).format(t)}}).filter("ordinalSuffix",function(){return function(n){var t=["th","st","nd","rd"],i=n%100;return t[(i-20)%10]||t[i]||t[0]}}).filter("roundUp",function(){return function(n){var t=Math.round((n+1e-5)*100)/100;return t.toFixed(2)}}).filter("displayDate",function(){return function(n,t,i){var r,u,f;return n===undefined||n===null||n.length===0?(r=moment(variantDateFormatToMoment(t)),u=moment(variantDateFormatToMoment(i))):(f=JSON.parse(n),r=moment(f[0].Start),u=moment(f[f.length-1].End)),u.isAfter(r,"day")?r.format("DD/MM/YYYY")+" - "+u.format("DD/MM/YYYY"):r.format("DD/MM/YYYY")}}).filter("displayTimes",function(){return function(n){var i="",t;if(n!==undefined&&n!==null&&n.length>0)for(n=JSON.parse(n),t=0;t<n.length;t++)i=i+moment(n[t].Start).format("ddd Do h:mma")+" - "+moment(n[t].End).format("h:mma")+(t+1<n.length&&n.length!=1?", ":"");return i}}).filter("variantPropertiesHorz",function(){return function(n,t){var i="";return Object.keys(n).map(function(r,u){separatorStr=u==0?"":t+" ";i=i+separatorStr+n[r]}),i}});productbyidModule.directive("ngMatch",["$parse",function(n){function t(t,i,r,u){if(u&&r.ngMatch){var e=n(r.ngMatch),f=function(n){var i=e(t),r=n===i;return u.$setValidity("match",r),n};u.$parsers.unshift(f);u.$formatters.push(f);r.$observe("ngMatch",function(){f(u.$viewValue)})}}return{link:t,restrict:"A",require:"?ngModel"}}]).directive("creditCardType",["creditCardService",function(n){function t(t,i,r,u){var f=function(t){var i=t&&n.validateCardType(t.toString())&&n.validateLuhn(t.toString());return u.$setValidity("invalid",i),t};u.$parsers.unshift(f)}return{link:t,require:"ngModel"}}]).directive("validDate",function(){function n(n,t,i,r){var u=function(n){var t=jsCommon.convertToDateObj(n),i=t.mm===t.date.getMonth()+1&&t.dd===t.date.getDate()&&t.yyyy===t.date.getFullYear()&&t.yyyy.toString().length==4;return r.$setValidity("invalid",i),n};r.$parsers.unshift(u)}return{link:n,require:"ngModel"}});productsbycategoryModule=angular.module("corpApp.uCommerceProductsByCategoryModule",["ngRoute","ngSanitize"]);productsbycategoryModule.controller("ProductsByCategoryCtrl",["$scope","$controller","ProductsByCategoryService",function(n,t,i){n.populateControlData=function(t){n.callWebApiService(i,{ContextUrl:t}).then(function(t){return n.HandleResponseErrors(t),n.data.items=t.ProductsByCategory,n.categoryName=t.CategoryName,!0},function(){n.onSubmitFail()})};n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));n.data={};n.populateControlData(window.location.pathname)}}]);mockItems=[{ThumbnailUrl:"/Content/RLSSWA/Images/DELETEME-placeholder-categoryimg.png",Name:"Manuals & Books",Url:"#"},{ThumbnailUrl:"/Content/RLSSWA/Images/DELETEME-placeholder-categoryimg.png",Name:"Manuals & Books",Url:"#"},{ThumbnailUrl:"/Content/RLSSWA/Images/DELETEME-placeholder-categoryimg.png",Name:"Clothing",Url:"#"},{ThumbnailUrl:"/Content/RLSSWA/Images/DELETEME-placeholder-categoryimg.png",Name:"Rescue Equipment",Url:"#"},{ThumbnailUrl:"/Content/RLSSWA/Images/DELETEME-placeholder-categoryimg.png",Name:"First Aid Kits",Url:"#"}];navigationModule=angular.module("corpApp.uCommerceShopCategoriesModule",["ngRoute","ngSanitize"]);navigationModule.controller("ShopCategoriesCtrl",["$scope","$controller","ShopCategoriesService",function(n,t,i){n.populateControlData=function(t){n.callWebApiService(i,{ContextUrl:t}).then(function(t){return n.HandleResponseErrors(t),n.data.items=t.ShopCategories,!0},function(){n.onSubmitFail()})};n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));n.data={};n.populateControlData(window.location.pathname)}}]);adminRegisterCourseModule=angular.module("corpApp.adminRegisterCourseModule",["ngRoute","ngSanitize"]);adminRegisterCourseModule.controller("adminRegisterCourseCtrl",["$scope","$controller","AdminRegisterCourseService",function(n,t,i){n.courseid="";n.firstname="";n.lastname="";n.email="";n.status="";n.register=function(){n.status="";n.callWebApiService(i,{CourseId:n.courseid,FirstName:n.firstname,LastName:n.lastname,Email:n.email}).then(function(t){return n.HandleResponseErrors(t),n.status=t.Status,!0},function(){n.onSubmitFail()})};n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}))}}]);availableCoursesModule=angular.module("corpApp.availableCoursesModule",["ngRoute","ngSanitize"]);availableCoursesModule.factory("CourseDetailFactory",function(){return{CourseID:"",CourseName:""}});availableCoursesModule.controller("AvailableCoursesCtrl",["$scope","$controller","AvailableCoursesService","RegisterFreeCoursesService","MyRoyalRegisterService","CourseDetailFactory",function(n,t,i,r,u,f){n.Registered=!1;n.userRegError=!1;n.selectedItem=null;n.CourseDetail=f;n.populatePageData=function(t){n.callWebApiService(i,{id:t}).then(function(t){return n.HandleResponseErrors(t),n.Courses=t.Courses,!0},function(){n.onSubmitFail()})};n.RegisterFreeCourse=function(t){n.CourseDetail.CourseID&&(t=n.CourseDetail.CourseID);n.callWebApiService(r,{id:t}).then(function(t){if(n.HandleResponseErrors(t),t.result)n.userRegError=!1,n.Registered=!0,window.location.href="/my-royal";else return n.userRegError=!0,!1;return!0},function(){n.onSubmitFail()})};n.RegisterFreeCourseLoggedIn=function(t){n.submitAttempted=!0;n.callWebApiService(r,{id:t}).then(function(t){if(t.result)n.userRegError=!1,n.Registered=!0,window.location.href="/my-royal";else return n.userRegError=!0,!1;return!0},function(){n.onSubmitFail()})};n.init=function(i){angular.extend(this,t("BaseCtrl",{$scope:n}));n.populatePageData(i);n.showControls=function(t){n.selectedItem=n.Courses.filter(function(n){return n.CourseOId===t})[0];n.CourseDetail.CourseID=n.selectedItem.CourseOId;n.CourseDetail.CourseName=n.selectedItem.CourseName;jQuery(".poplogbg").slideFadeToggle2();jQuery(".poplog").slideFadeToggle1()}}}]);passwordResetModule=angular.module("corpApp.passwordResetModule",["ngRoute","ngSanitize"]);passwordResetModule.controller("passwordResetCtrl",["$scope","$controller","$http","PasswordResetQueryCheckService","forgotPasswordService",function(n,t,i,r,u){n.QSInvalid=!1;n.noPWMatch=!1;n.noPWLength=!1;n.EmailSuccess=!1;n.ForgotEmailError=!1;n.loading=!1;n.dataString=null;n.ivString=null;var f="/Professional-Services/Endorsed-Swim-Schools/Swim-School-Login",e="/My-Royal";n.getParameterByName=function(n,t){t||(t=window.location.href);n=n.replace(/[\[\]]/g,"\\$&");var r=new RegExp("[?&]"+n+"(=([^&#]*)|&|#|$)"),i=r.exec(t);return i?i[2]?i[2]:"":null};n.assessQS=function(){var t=n.getParameterByName("data"),i=n.getParameterByName("iv");t!=""&&i!=""&&t!=null&&i!=null?n.callWebApiService(r,{EncryptedData:t,IV:i}).then(function(r){n.Domain=r.Domain;r.Valid===!0?(n.QSInvalid=!1,n.dataString=t,n.ivString=i):n.QSInvalid=!0}):n.QSInvalid=!0};n.checkPasswords=function(){n.submitAttempted=!0;n.Password==n.Password2?n.Password.length>7&&!n.Password.toLowerCase().includes("password")?(n.noPWMatch=!1,n.noPWLength=!1,n.resetPassword()):(n.noPWMatch=!1,n.noPWLength=!0):n.noPWMatch=!0};n.resetPassword=function(){n.loading=!0;n.submitAttempted=!0;var t={EncryptedData:n.dataString,IV:n.ivString,Password:n.Password};i.post("/api/PasswordReset/",JSON.stringify(t),{headers:{"Content-Type":"application/json",Accept:"application/json"}}).then(function(t){return n.loading=!1,n.HandleResponseErrors(t),t.data.Valid?($(".Success-Popup-bg").slideFadeToggle(),$(".Success-Popup").slideFadeToggle(),setTimeout(function(){t.Domain=="SwimSchool"?window.location.replace(f):window.location.replace(e)},9e3)):n.QSInvalid=!0,!0},function(){n.onSubmitFail()})};n.forgotPassword=function(){n.ForgotEmail!=""&&n.ForgotEmail!=null&&n.ForgotEmail.includes("@")?(n.loading=!0,n.ForgotEmailError=!1,n.submitAttempted=!0,n.callWebApiService(u,{email:n.ForgotEmail,domain:n.Domain}).then(function(t){if(n.loading=!1,n.HandleResponseErrors(t),t.Valid)n.loading=!1,n.EmailSuccess=!0,n.ResponseMessage=t.ResponseMessage;else return n.loading=!1,n.EmailSuccess=!1,n.ResponseMessage=t.ResponseMessage!==""?t.ResponseMessage:"There has been an error attempting to reset your password. Please try again later, or contact us for support.",!1;return!0},function(){n.onSubmitFail()})):n.ForgotEmailError=!0};n.init=function(i){n.ResponseMessage="";angular.extend(this,t("BaseCtrl",{$scope:n}));n.assessQS();i(function(){i("#MRForgotEmail").keypress(function(t){t.key==="Enter"&&n.forgotPassword()})});i(function(){i("#MRPWReset1").keypress(function(t){t.key==="Enter"&&n.forgotPassword()})});i(function(){i("#MRPWReset2").keypress(function(t){t.key==="Enter"&&n.forgotPassword()})});i(function(){i("#mr-forgot2").on("click",function(){i(".popregbg2").slideFadeToggle();i(".popreg2").slideFadeToggle()})});i(function(){i(".regclose2").on("click",function(){i(".popregbg2").slideFadeToggle();i(".popreg2").slideFadeToggle()})});i.fn.slideFadeToggle=function(n,t){return this.animate({opacity:"toggle",height:"toggle"},"fast",n,t)};i(function(){i("#successbtn").on("click",function(){n.Domain=="SwimSchool"?window.location.replace(f):window.location.replace(e)})})}(jQuery)}]);loginModule=angular.module("corpApp.loginModule",["ngRoute","ngSanitize"]);loginModule.controller("LoginCtrl",["$scope","$controller","LoginService",function(n,t,i){n.Login=function(t){n.submitAttempted=!0;n.LoginForm.$valid&&n.callWebApiService(i,{Email:n.Email,Password:n.Password}).then(function(i){return n.HandleResponseErrors(i),i.LoginSuccessful?(n.IncorrectPassword=!1,window.location.replace(t?t:i.MyAccountPage)):n.IncorrectPassword=!0,!0},function(){n.onSubmitFail()})};n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));n.data={}}}]);logoutModule=angular.module("corpApp.logoutModule",["ngRoute","ngSanitize"]);logoutModule.controller("LogoutCtrl",["$scope","$controller","LogoutService",function(n,t,i){n.Logout=function(t){n.callWebApiService(i,{Id:"Logout"}).then(function(i){return n.HandleResponseErrors(i),window.location.replace(t?t:"/"),!0},function(){n.onSubmitFail()})};angular.extend(this,t("BaseCtrl",{$scope:n}))}]);registerModule=angular.module("corpApp.registerModule",["ngRoute","ngSanitize"]);registerModule.controller("RegisterCtrl",["$scope","$controller","RegisterService",function(n,t,i){n.Register=function(){n.submitAttempted=!0;n.RegisterForm.$valid&&n.callWebApiService(i,{FirstName:n.FirstName,Surname:n.Surname,Email:n.Email,Password:n.Password}).then(function(t){return n.HandleResponseErrors(t),n.AlreadyRegistered=t.AlreadyRegistered,n.Success=t.RegisterSuccessful,!0},function(){n.onSubmitFail()})};n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));n.data={}}}]);resetPasswordModule=angular.module("corpApp.resetPasswordModule",["ngRoute","ngSanitize"]);resetPasswordModule.controller("ResetPasswordCtrl",["$scope","$controller","CheckResetService","ResetService","RequestResetService",function(n,t,i,r,u){n.DoResetFoo=function(){n.submitAttempted=!0;n.ResetForm.$valid&&n.callWebApiService(r,{password:n.Password,request:n.ResetGuid}).then(function(t){return n.HandleResponseErrors(t),n.DoReset=!1,t.Complete?n.ResetPass=!0:n.RequestResetFail=!0,!0},function(){n.onSubmitFail()})};n.DoRequestReset=function(){n.submitAttempted=!0;n.InvalidEmail=!1;n.ResetRequestForm.$valid&&n.callWebApiService(u,{email:n.Email}).then(function(t){return n.HandleResponseErrors(t),t.Complete?(n.RequestReset=!1,n.RequestResetSuccess=!0):t.InvalidEmail?n.InvalidEmail=!0:(n.RequestReset=!1,n.RequestResetFail=!0),!0},function(){n.onSubmitFail()})};n.CheckReset=function(t){n.callWebApiService(i,{request:t}).then(function(t){return n.HandleResponseErrors(t),t?n.DoReset=!0:n.InvalidReset=!0,!0},function(){n.onSubmitFail()})};n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));n.data={};var i=jsCommon.getUrlParameter("Reset");i!=!1?(n.ResetGuid=i,n.CheckReset(i)):n.RequestReset=!0}}]);jobsBoardDetailModule=angular.module("corpApp.jobsBoardDetailModule",["ngRoute","ngSanitize"]);jobsBoardDetailModule.controller("JobsBoardDetailCtrl",["$scope","$controller","$filter","JobsBoardDetailService","JobsCUDService","JobsConfigService",function(n,t,i,r,u,f){n.getMaxToDate=function(){if(!jQuery.isEmptyObject(n.job)&&!jQuery.isEmptyObject(n.JobsboardEditForm.jobadstart.$viewValue)){var t=moment(n.job.AdvertStartDisplay,"DD/MM/YYYY").add(28,"days");return t.format("DD/MM/YYYY")}return""};n.getMinToDate=function(){if(!jQuery.isEmptyObject(n.job)&&!jQuery.isEmptyObject(n.JobsboardEditForm.jobadstart.$viewValue)){var t=moment(),i=moment(n.job.AdvertStartDisplay,"DD/MM/YYYY"),r=t.diff(i,"days");return r>0?t.format("DD/MM/YYYY"):i.format("DD/MM/YYYY")}return""};n.getReferenceData=function(){n.callWebApiService(f,{request:"true"}).then(function(t){return n.HandleResponseErrors(t),n.referenceData=t,!0},function(){n.onSubmitFail()})};n.getJob=function(t){n.callWebApiService(r,{Id:t}).then(function(t){n.HandleResponseErrors(t);n.jobs=t.Jobs;var i=t.Jobs[0];return i.AdvertStartDisplay=moment(i.AdvertStart).format("DD/MM/YYYY"),i.AdvertEndDisplay=moment(i.AdvertEnd).format("DD/MM/YYYY"),i.ContactDetails.PostCode=parseInt(i.ContactDetails.PostCode),i.Published=i.Published.toString(),n.job=i,!0},function(){n.onSubmitFail()})};n.saveJob=function(){n.JobsboardEditForm.$submitted=!0;n.validAdvertEndDate();n.JobsboardEditForm.$valid&&!n.JobsboardEditForm.$pending?(n.JobsboardEditForm.$pending=!0,n.job.AdvertStart=jsDates.parseDateForJson(n.job.AdvertStartDisplay),n.job.AdvertEnd=jsDates.parseDateForJson(n.job.AdvertEndDisplay),n.job.ContactDetails.Url&&(n.job.ContactDetails.Url=n.job.ContactDetails.Url.replace(/https?:\/\//i,"")),n.submitJobSaveRequest=function(){n.JobSaveRequest=new u;n.JobSaveRequest.job=n.job;n.JobSaveRequest.$save(function(t){t.HasResponseErrors?(n.JobsboardEditForm.error=t.ErrorMessage,n.JobsboardEditForm.$submitted=!1,n.JobsboardEditForm.$pending=!1):window.location.replace("/jobs-board/employer-dashboard")})},n.submitJobSaveRequest()):$("html,body").scrollTop($(".page-title").offset().top)};n.defaultAdvertEnd=function(){jsDates.isValidDate(n.JobsboardEditForm.jobadstart.$viewValue)&&(n.setDefaultAdvertEnd(),n.validAdvertEndDate())};n.setDefaultAdvertEnd=function(){var t=moment(n.job.AdvertStartDisplay,"DD/MM/YYYY").add(14,"days");n.job.AdvertEndDisplay=t.format("DD/MM/YYYY")};n.validAdvertEndDate=function(){var t=i("date")(n.getMinToDate(),"dd/MM/yyyy"),r=i("date")(n.job.AdvertEndDisplay,"dd/MM/yyyy"),u=jsDates.isValidDateRange(t,r);n.JobsboardEditForm.jobadend.$setValidity("dateGreaterThan",u);var t=i("date")(n.job.AdvertEndDisplay,"dd/MM/yyyy"),r=i("date")(n.getMaxToDate(),"dd/MM/yyyy"),f=jsDates.isValidDateRange(t,r);n.JobsboardEditForm.jobadend.$setValidity("dateLowerThan",f)};n.init=function(i){angular.extend(this,t("BaseCtrl",{$scope:n}));n.job={};n.getReferenceData();i=i?i:jsCommon.getUrlParameter("id");i?n.getJob(i):(n.job.AdvertStartDisplay=jsDates.getCurrentDateString(),n.setDefaultAdvertEnd())}}]).filter("moment",function(){return function(n,t){return moment(n).format(t)}}).filter("numberWithCommas",function(){return function(n){return n?n.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","):""}}).filter("convertLineBreaks",function(){return function(n){return n=String(n).trim(),n.length>0?"<p>"+n.replace(/[\r\n]+/g,"<\/p><p>")+"<\/p>":null}}).directive("validDate",function(){function n(n,t,i,r){var u=function(n){var t=jsCommon.convertToDateObj(n),i=t.mm===t.date.getMonth()+1&&t.dd===t.date.getDate()&&t.yyyy===t.date.getFullYear()&&t.yyyy.toString().length==4;return r.$setValidity("invalid",i),n};r.$parsers.unshift(u)}return{link:n,require:"ngModel"}});jobsBoardEmployerDashboardModule=angular.module("corpApp.jobsBoardEmployerDashboardModule",["ngRoute","ngSanitize","ui.filters"]);jobsBoardEmployerDashboardModule.controller("JobsBoardEmployerDashboardCtrl",["$scope","$controller","JobsService","IsEmployerLoggedInService","JobsCUDService",function(n,t,i,r,u){n.getJobs=function(){n.callWebApiService(i,{ContextUrl:window.location.pathname}).then(function(t){return n.HandleResponseErrors(t),n.jobs=t.Jobs,$("table.jobs .controls a[title]").qtip(),!0},function(){n.onSubmitFail()})};n.deleteJob=function(t){confirm("Are you sure you want to delete Job '"+t.Name+"'?")==!0&&(n.submitJobDeleteRequest=function(t){n.JobDeleteRequest=new u;n.JobDeleteRequest.job=t;n.JobDeleteRequest.job.Deleted=!0;n.JobDeleteRequest.$save(function(t){t.HasResponseErrors?n.JobsBoardDashboardForm.error=t.ErrorMessage:window.location.replace("/jobs-board/employer-dashboard")})},n.submitJobDeleteRequest(t))};n.getEmployerDetails=function(){n.callWebApiService(r,{request:1}).then(function(t){return n.HandleResponseErrors(t),n.employer=t,!0},function(){n.onSubmitFail()})};n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));n.refinements={};n.getEmployerDetails();n.getJobs()}}]).filter("moment",function(){return function(n,t){return moment(n).format(t)}}).directive("qtip",function(){return{restrict:"A",scope:{qtipVisible:"="},link:function(n,t,i){var u=i.qtipMy||"bottom center",f=i.qtipAt||"top center",e=i.qtipClass||"qtip",r=i.qtipContent||i.qtip;i.qtipTitle&&(r={title:i.qtipTitle,text:i.qtip});$(t).qtip({content:r,position:{my:u,at:f,target:t},hide:{fixed:!0,delay:100},style:e});i.qtipVisible&&n.$watch("qtipVisible",function(n){$(t).qtip("toggle",n)})}}});loginModule.controller("EmployerLoginCtrl",["$scope","$controller","LoginService",function(n,t,i){n.Login=function(t){n.submitAttempted=!0;n.LoginForm.$valid&&n.callWebApiService(i,{Email:n.Email,Password:n.Password}).then(function(i){return n.HandleResponseErrors(i),i.LoginSuccessful?(n.IncorrectPassword=!1,window.location.replace(t?t:i.MyAccountPage)):n.IncorrectPassword=!0,!0},function(){n.onSubmitFail()})};n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));n.data={}}}]);jobsBoardSearchModule=angular.module("corpApp.jobsBoardSearchModule",["ngRoute","ngSanitize","ui.filters"]);jobsBoardSearchModule.controller("JobsBoardSearchCtrl",["$scope","$controller","JobsService","IsEmployerLoggedInService","JobsConfigService",function(n,t,i,r,u){n.getReferenceData=function(){n.callWebApiService(u,{request:"true"}).then(function(t){return n.HandleResponseErrors(t),n.referenceData=t,!0},function(){n.onSubmitFail()})};n.getJobs=function(t,r){t.ContextUrl=window.location.pathname;n.callWebApiService(i,t).then(function(t){return n.HandleResponseErrors(t),n.jobs=t.Jobs,r&&r(),!0},function(){n.onSubmitFail()})};n.submitSearch=function(){if(n.JobsboardSearchForm.$submitted=!0,!n.JobsboardSearchForm.$pending){n.JobsboardSearchForm.$pending=!0;var t={};angular.copy(n.refinements,t);Object.keys(n.refinements).map(function(i){if(i!="Keyword"){var r=[];Object.keys(n.refinements[i]).map(function(t){n.refinements[i][t]&&r.push(t)});t[i]=r}});n.getJobs(t,function(){n.JobsboardSearchForm.$submitted=!1;n.JobsboardSearchForm.$pending=!1})}};n.checkedLoggedInEmployer=function(){n.callWebApiService(r,{request:1}).then(function(t){return n.HandleResponseErrors(t),n.loggedInEmployer=t.LoggedIn,!0},function(){n.onSubmitFail()})};n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));n.refinements={};n.getReferenceData();n.checkedLoggedInEmployer();n.getJobs({})}}]).filter("moment",function(){return function(n,t){return moment(n).format(t)}});incidentsModule=angular.module("corpApp.incidentsModule",["ngRoute","ngSanitize"]);incidentsModule.controller("IncidentsCtrl",["$scope","IncidentsListService","$controller","$timeout",function(n,t,i){n.populateIncidentsList=function(){n.loading=!0;n.callWebApiService(t,{}).then(function(t){return n.loading=!1,n.HandleResponseErrors(t),t.HasResponseErrors?n.ErrorMessage=t.ErrorMessage:(n.Incidents=t.IncidentList,n.Show=!0,n.ErrorMessage=null),!0},function(){n.onSubmitFail()})};n.sort={column:"PurchaseOrderDate",descending:!1};n.selectedCls=function(t){return t===n.sort.column&&"sort-"+n.sort.descending};n.changeSorting=function(t){var i=n.sort;i.column===t?i.descending=!i.descending:(i.column=t,i.descending=!1)};n.init=function(){angular.extend(this,i("BaseCtrl",{$scope:n}));n.accessDenied=!1;n.date=new Date;n.head={SiteId:"Site ID",SiteName:"Site Name",TradeCode:"Trade Code",Priority:"Priority",CauseCode:"Cause Code",PurchaseOrderNumber:"Purchase Order Number",WorkOrderNumber:"Work Order Number",PurchaseOrderDate:"Purchase Order Date",SupplierCompanyName:"Supplier Company Name",WpSupplierId:"Wp Supplier Id",IncidentDescription:"Incident Description",IncidentComments:"Incident Comments",PurchaseOrderStatus:"Purchase Order Status"};n.populateIncidentsList()}}]);CallCentreLinksModule=angular.module("corpApp.CallCentreLinksModule",["ngRoute","ngSanitize","ngCookies"]);CallCentreLinksModule.controller("CallCentreLinksCtrl",["$scope","$controller","$http","$timeout","callCentreService",function(n,t,i,r,u){n.loading=!0;n.callCentreLinks=[];n.init=function(i,r){angular.extend(this,t("BaseCtrl",{$scope:n}));n.populatePageData(i,r)};n.populatePageData=function(t,i){u.GetCallCentreLinks(i).then(function(t){if(n.callCentreLinks=t,n.callCentreLinks)for(var i=0,r=n.callCentreLinks.length;i<r;++i)n.callCentreLinks[i].ApplyGeomantData&&(n.callCentreLinks[i].Destination+=window.location.search)},function(n){console.log(n)}).finally(function(){n.loading=!1})}}]);FundraisingAdminModule=angular.module("corpApp.FundraisingAdminModule",["ngRoute","ngSanitize"]);FundraisingAdminModule.controller("FundraisingAdminCtrl",["$scope","$controller","$filter","$window","$timeout","FundraisingAdminLoginService","FundraisingAdminLogoutService","FundraisingAdminGetUsersService","FundraisingAdminAddUserService","FundraisingAdminRemoveUserService","FundraisingAdminEditUserService",function(n,t,i,r,u,f,e,o,s,h,c){n.username="";n.password="";n.salesPersons=[];n.selectedSalesPerson={};n.isAdd=!1;n.isLoggedIn=!1;n.isPinWriteable=!1;n.handleWsError=function(t){t.status===401?n.pageErrors={unauthorised:!0}:n.onSubmitFail()};n.login=function(){n.pageErrors={};n.callWebApiService(f,{Username:n.username,Password:n.password}).then(function(t){return n.HandleResponseErrors(t),n.isLoggedIn=!0,n.getSalesPersons(),!0},function(t){n.handleWsError(t)})};n.logout=function(){n.pageErrors={};n.callWebApiService(e,{}).then(function(t){return n.HandleResponseErrors(t),window.location.reload(),!0},function(t){n.handleWsError(t)})};n.add=function(){n.isAdd=!0;n.selectedSalesPerson={Username:"",Name:"",Email:"",Pin:""};n.isPinWriteable=!0};n.edit=function(t){n.isAdd=!1;n.selectedSalesPerson=t};n.delete=function(t){n.pageErrors={};n.callWebApiService(h,{Username:t.Username}).then(function(t){return n.HandleResponseErrors(t),n.salesPersons=n.salesPersons.filter(function(t){return t.Username!==n.selectedSalesPerson.Username}),n.salesPersons.length>0&&n.selectSalesPerson(n.salesPersons[0]),!0},function(t){n.handleWsError(t)})};n.save=function(){n.pageErrors={};var t=n.isAdd?s:c;n.callWebApiService(t,n.selectedSalesPerson).then(function(t){if(n.HandleResponseErrors(t),n.selectedSalesPerson.Pin="",n.isAdd)n.isAdd=!1,n.salesPersons.push(n.selectedSalesPerson),n.selectSalesPerson(n.salesPersons[n.salesPersons.length-1]);else{var i=-1;$.each(n.salesPersons,function(t,r){r.Username===n.selectedSalesPerson.Username&&(i=t)});i!==-1&&(n.salesPersons[i]=n.selectedSalesPerson,n.selectSalesPerson(n.salesPersons[i]))}return n.isPinWriteable=!1,!0},function(t){n.handleWsError(t)})};n.cancel=function(){n.isAdd?(n.isAdd=!1,n.salesPersons.length>0&&n.selectSalesPerson(n.salesPersons[0])):$.each(n.salesPersons,function(t,i){i.Username===n.selectedSalesPerson.Username&&n.selectSalesPerson(i)})};n.getSalesPersons=function(){n.pageErrors={};n.callWebApiService(o,{}).then(function(t){return n.HandleResponseErrors(t),n.salesPersons=t.SalesPersons,n.salesPersons.length>0&&n.selectSalesPerson(n.salesPersons[0]),!0},function(t){n.handleWsError(t)})};n.selectSalesPerson=function(t){n.selectedSalesPerson=angular.extend({},t)};n.changePinWriteable=function(){n.isPinWriteable=!n.isPinWriteable};n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}))}}]);FundraisingBannerModule=angular.module("corpApp.FundraisingBannerModule",["ngRoute","ngSanitize"]);FundraisingBannerModule.controller("FundraisingBannerCtrl",["$scope","$controller","$filter","$window","$timeout","FundraisingBannerService","RaffleInfoService",function(n,t,i,r,u,f){n.windowWidth=r.innerWidth;n.populatePageData=function(t){n.callWebApiService(f,{id:t}).then(function(t){return n.HandleResponseErrors(t),n.Data=t,!!n.Data.BackgroundImage,!!n.Data.MobileBackgroundImage,!!n.Data.Image,!!n.Data.MobileImage,!0},function(){n.onSubmitFail()})};n.init=function(i){angular.extend(this,t("BaseCtrl",{$scope:n}));n.populatePageData(i)};r.onresize=function(){u(function(){n.windowWidth=r.innerWidth})}}]);FundraisingCallToActionModule=angular.module("corpApp.FundraisingCallToActionModule",["ngRoute","ngSanitize"]);FundraisingCallToActionModule.controller("FundraisingCallToActionCtrl",["$scope","$controller","$filter","FundraisingCallToActionService",function(n,t,i,r){n.populatePageData=function(t){n.callWebApiService(r,{id:t}).then(function(t){return n.HandleResponseErrors(t),n.Data=t,!0},function(){n.onSubmitFail()})};n.init=function(i){angular.extend(this,t("BaseCtrl",{$scope:n}));n.populatePageData(i)}}]);FundraisingFeaturedImageModule=angular.module("corpApp.FundraisingFeaturedImageModule",["ngRoute","ngSanitize"]);FundraisingFeaturedImageModule.controller("FundraisingFeaturedImageCtrl",["$scope","$controller","$filter","FundraisingFeaturedImageService",function(n,t,i,r){n.populatePageData=function(t){n.callWebApiService(r,{id:t}).then(function(t){return n.HandleResponseErrors(t),n.Data=t,!0},function(){n.onSubmitFail()})};n.init=function(i){angular.extend(this,t("BaseCtrl",{$scope:n}));n.populatePageData(i)}}]);FundraisingModularContentModule=angular.module("corpApp.FundraisingModularContentModule",["ngRoute","ngSanitize"]);FundraisingModularContentModule.controller("FundraisingModularContentCtrl",["$scope","$controller","$filter","$sce","FundraisingModularContentService",function(n,t,i,r,u){n.populatePageData=function(t){n.callWebApiService(u,{id:t}).then(function(t){return n.HandleResponseErrors(t),n.Data=t,n.Data.LSContent=r.trustAsHtml(n.Data.LSContent),n.Data.RSContent=r.trustAsHtml(n.Data.RSContent),n.MobileHideLS=n.Data.MobileHideLS,n.MobileHideRS=n.Data.MobileHideRS,!0},function(){n.onSubmitFail()})};n.CalcScreenTabletSize=function(){n.ScreenTabletSize=window.innerWidth<992?!0:!1};$(window).resize(function(){n.$apply(function(){n.CalcScreenTabletSize()})});n.init=function(i){angular.extend(this,t("BaseCtrl",{$scope:n}));n.MobileHideLS=!1;n.MobileHideRS=!1;n.ScreenTabletSize=!1;n.populatePageData(i);n.CalcScreenTabletSize()}}]);FundraisingNavigationModule=angular.module("corpApp.FundraisingNavigationModule",["ngRoute","ngSanitize"]);FundraisingNavigationModule.controller("FundraisingNavigationCtrl",["$scope","$controller","NavigationService","RaffleInfoService",function(n,t,i,r){n.populateControlData=function(t,u,f){n.callWebApiService(i,{ItemId:t,LevelsDeep:u,Footer:f}).then(function(t){var i,r;for(n.HandleResponseErrors(t),n.data.items=t.NavigationItems,i=0;i<t.NavigationItems.length;i++)if(t.NavigationItems[i].Name=="Programs"&&t.NavigationItems[i].Active)for(r=0;r<t.NavigationItems[i].Children.length;r++)t.NavigationItems[i].Children[r].Active&&(n.ProgramNav=t.NavigationItems[i].Children[r]);return!0},function(){n.onSubmitFail()});n.callWebApiService(r,{id:t}).then(function(t){var i,r,u;return n.HandleResponseErrors(t),n.RaffleData=t,n.isRafflePage=t.RaffleStoreItem&&t.RaffleStoreItem.RafflePageUrl.indexOf(location.pathname)!==-1&&location.pathname!=="/",i=new Date,n.isRaffleActive=!1,n.RaffleData.Raffles.length>0&&(r=moment(n.RaffleData.Raffles[0].StartDate).toDate(),u=moment(n.RaffleData.Raffles[0].EndDate).toDate(),r<=i&&u>=i&&(n.isRaffleActive=!0)),!0},function(){n.onSubmitFail()})};n.init=function(i,r,u){angular.extend(this,t("BaseCtrl",{$scope:n}));n.data={};n.ProgramNav=null;n.populateControlData(i,r,u);jQuery("#mobilenav").click(function(){jQuery("#mobilenav").attr("aria-expanded")==="false"?($(".mobileMenuIcon").addClass("fa-close").removeClass("fa-bars"),$(".menu-mobile-text").html("CLOSE")):($(".mobileMenuIcon").addClass("fa-bars").removeClass("fa-close"),$(".menu-mobile-text").html("MENU"))})}}]);FundraisingProgressModule=angular.module("corpApp.FundraisingProgressModule",["ngRoute","ngSanitize"]);FundraisingProgressModule.controller("FundraisingProgressBarCtrl",["$scope","$controller","$http","FundraisingProgressService",function(n,t,i,r){n.populatePageData=function(t,i){n.callWebApiService(r,{id:i,itemId:t}).then(function(t){return n.HandleResponseErrors(t),angular.extend(n,t),n.showProgress=t.FundraisingTarget>0,!0},function(){n.onSubmitFail()})};n.init=function(i,r){angular.extend(this,t("BaseCtrl",{$scope:n}));n.populatePageData(i,r)}}]);angular.module("corpApp.raffleQuickSelectCompService",["ngResource"]).factory("raffleQuickSelectCompService",["$rootScope",function(n){var t=function(t,i,r){n.$broadcast("quickSelectChanged",{event:t,item:i,amount:r})},i=function(t){n.$broadcast("showOrHideQuickSelection",{toShow:t})};return{QuickSelections:[],QuickSelectChanged:t,ShowOrHideQuickSelection:i}}]);FundraisingQuickSelectionModule=angular.module("corpApp.FundraisingQuickSelectionsModule",["ngRoute","ngSanitize","ngCookies"]);FundraisingQuickSelectionModule.controller("FundraisingQuickSelectionsCtrl",["$scope","$controller","$http","$timeout","RaffleQuickSelectionsService","raffleQuickSelectCompService",function(n,t,i,r,u,f){n.QuickSelectionsService=f;n.QuickSelections=n.QuickSelectionsService.QuickSelections;n.ShowQuickSelects=!0;n.populatePageData=function(t,i){var r={CurrentItemId:t,DataSourceId:i};n.callWebApiService(u,r).then(function(t){n.HandleResponseErrors(t);var i=n.QuickSelectionsService.QuickSelections;return $.each(t.QuickSelections,function(n,t){i.push(t)}),!0},function(){n.onSubmitFail()})};n.init=function(i,r){angular.extend(this,t("BaseCtrl",{$scope:n}));n.populatePageData(i,r)};n.quickSelectAmount=function(t,i,r){$.each(n.QuickSelections,function(n,t){t.ariaPressed=!1});i.ariaPressed=!0;f.QuickSelectChanged(t,i,r)};n.$on("showOrHideQuickSelection",function(t,i){n.ShowQuickSelects=i.toShow})}]);FundraisingRafflesModule=angular.module("corpApp.FundraisingRafflesModule",["ngRoute","ngSanitize","ngCookies"]);FundraisingRafflesModule.controller("FundraisingRafflesCtrl",["$scope","$controller","$filter","$sce","$interval","$cookies","RaffleInfoService","GeomantGetMemberDetailsService","raffleQuickSelectCompService","$http","$timeout","creditCardService",function(n,t,i,r,u,f,e,o,s,h,c,l){function a(n){var r=window.location.href,i,t;return(n=n.replace(/[\[\]]/g,"\\$&"),i=new RegExp("[?&]"+n+"(=([^&#]*)|&|#|$)"),t=i.exec(r),!t)?null:t[2]?decodeURIComponent(t[2].replace(/\+/g," ")):""}function it(t){if(t!==undefined&&t!=null){n.Details.VipRegistration.vipConfirm=[];for(var i=0;i<t.length;i++)n.Details.VipRegistration.vipConfirm.push(!1)}}function k(t){window.location.replace(window.location.origin+n.Data.Raffles[0].TransactionCompletePage+"?ordernumber="+t.data.OrderNumber+"&notickets="+t.data.HasResponseErrors)}function rt(n,t){t||(t=decodeURIComponent(window.location.href));n=n.replace(/[\[\]]/g,"\\$&");var r=new RegExp("[?&]"+n+"(=([^&#]*)|&|#|$)"),i=r.exec(t);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null}function ut(){window.scroll({top:0,left:0,behavior:"smooth"})}var v;n.QuickSelections=s.QuickSelections;n.stepSelectName="select";n.stepRegularGivingName="regular-giving";n.stepBillingName="billing";n.paybyOptionCashName="cash";n.paybyOptionCardName="card";var y="Please fill out all the required fields correctly.",d="Please supply signature authorisation (signature entered in box).",p=568,w=70,g="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjgAAADcCAQAAADXNhPAAAACIklEQVR42u3UIQEAAAzDsM+/6UsYG0okFDQHMBIJAMMBDAfAcADDATAcwHAAwwEwHMBwAAwHMBzAcAAMBzAcAMMBDAcwHADDAQwHwHAAwwEMB8BwAMMBMBzAcADDATAcwHAADAcwHADDAQwHMBwAwwEMB8BwAMMBDAfAcADDATAcwHAAwwEwHMBwAAwHMBzAcAAMBzAcAMMBDAcwHADDAQwHwHAAwwEwHMBwAMMBMBzAcAAMBzAcwHAADAcwHADDAQwHMBwAwwEMB8BwAMMBDAfAcADDATAcwHAAwwEwHMBwAAwHMBzAcCQADAcwHADDAQwHwHAAwwEMB8BwAMMBMBzAcADDATAcwHAADAcwHMBwAAwHMBwAwwEMBzAcAMMBDAfAcADDAQwHwHAAwwEwHMBwAAwHMBzAcAAMBzAcAMMBDAcwHADDAQwHwHAAwwEMB8BwAMMBMBzAcADDATAcwHAADAcwHMBwAAwHMBwAwwEMB8BwAMMBDAfAcADDATAcwHAAwwEwHMBwAAwHMBzAcAAMBzAcAMMBDAcwHADDAQwHwHAAwwEMB8BwAMMBMBzAcADDkQAwHMBwAAwHMBwAwwEMBzAcAMMBDAfAcADDAQwHwHAAwwEwHMBwAMMBMBzAcAAMBzAcwHAADAcwHADDAQwHMBwAwwEMB8BwAMMBMBzAcADDATAcwHAADAcwHMBwAAwHMBwAwwEMBzAcAMMBDAegeayZAN3dLgwnAAAAAElFTkSuQmCC";n.validationErrorMessage=y;n.steps=[n.stepSelectName,n.stepBillingName];n.handleWsError=function(t){t.status===401?(n.pageErrors={unauthorised:!0},t.data={},t.data.ResponseErrors=!0):n.onSubmitFail()};var b=function(){n.ticketSoldOut=!0;jQuery(".buyBoxForm").removeClass("buyBoxFormExpand");n.payNowError=!0;n.responseErrorMessage="The raffle is sold out — Thank you for your support!";n.Checkout=!1;c(function(){$(".purchaseTicketsError .errorMessage").focus()})},nt=function(t){n.ticketNotEnough=!0;jQuery(".buyBoxForm").removeClass("buyBoxFormExpand");n.payNowError=!0;n.responseErrorMessage=t;n.Checkout=!1;c(function(){$(".purchaseTicketsError .errorMessage").focus()})},tt=function(){n.payNowError=!0;n.responseErrorMessage="Payment error – please try submitting your payment again.";n.fireCheckout(!0);c(function(){$(".purchaseTicketsError .errorMessage").focus()})};n.populatePageData=function(t){var i={CurrentItemId:t,IncludePastRaffles:!1,IncludeFutureRaffles:!1};n.callWebApiService(e,i).then(function(t){var i,u,e;if(n.HandleResponseErrors(t),n.Data=t,n.raffleInfoError=t.HasResponseErrors,n.raffleInfoErrorMessage=t.ErrorMessage,n.paymentOnly=t.PaymentOnly,t.TicketSoldOut&&b(),n.ticketNotEnough=!1,n.paymentMethods=t.PaymentMethods,n.headerText=t.CustomPurchaseSettings!=null&&t.CustomPurchaseSettings.MainItemHeaderText!=null&&t.CustomPurchaseSettings.MainItemHeaderText.length>0?t.CustomPurchaseSettings.MainItemHeaderText:t.PaymentOnly?"PAY FOR MY LUCKY NUMBERS":"BUY TICKETS",t.CustomPurchaseSettings!=null&&t.CustomPurchaseSettings.MainItemLabel!=null&&t.CustomPurchaseSettings.MainItemLabel.length>0?n.MainItemLabel=t.CustomPurchaseSettings.MainItemLabel:t.PaymentOnly?n.headerText="AMOUNT DUE":n.MainItemLabel="RAFFLE TICKETS",n.MainItemSubtext=t.CustomPurchaseSettings!=null&&t.CustomPurchaseSettings.MainItemSubtext!=null&&t.CustomPurchaseSettings.MainItemSubtext.length>0?r.trustAsHtml(t.CustomPurchaseSettings.MainItemSubtext):null,n.displayDonations=t.CustomPurchaseSettings!=null&&t.CustomPurchaseSettings.DisplayDonations,n.donationOptional=t.CustomPurchaseSettings!=null&&t.CustomPurchaseSettings.DonationOptional,n.donationPlaceholderText=t.CustomPurchaseSettings!=null&&t.CustomPurchaseSettings.DonationPlaceholderText,n.DonationItemLabel=t.CustomPurchaseSettings!=null&&t.CustomPurchaseSettings.DonationItemLabel!=null&&t.CustomPurchaseSettings.DonationItemLabel.length>0?t.CustomPurchaseSettings.DonationItemLabel:"DONATION AMOUNT",t.CustomPurchaseSettings!=null&&t.CustomPurchaseSettings.DonationItemSubtext!=null&&t.CustomPurchaseSettings.DonationItemSubtext.length>0&&(n.DonationItemSubtext=r.trustAsHtml(t.CustomPurchaseSettings.DonationItemSubtext)),n.displayVipRegistration=t.CustomPurchaseSettings!=null&&t.CustomPurchaseSettings.DisplayVipRegistration,n.resizeVipSignaturePad(),n.Details.VipRegistration.allowOtherApproval=!1,n.Details.VipRegistration.otherApprovalReceived=!1,n.Details.VipRegistration.vipConfirm=[],t.CustomPurchaseSettings!==null&&t.CustomPurchaseSettings.ConfirmationCheckboxes!==undefined&&t.CustomPurchaseSettings.ConfirmationCheckboxes!==null&&it(t.CustomPurchaseSettings.ConfirmationCheckboxes),n.MonthlyAmountLabel=t.CustomPurchaseSettings!=null&&t.CustomPurchaseSettings.MonthlyAmountLabel!=null&&t.CustomPurchaseSettings.MonthlyAmountLabel.length>0?t.CustomPurchaseSettings.MonthlyAmountLabel:"MONTHLY AMOUNT",n.FieldProperties={},t.CustomPurchaseSettings!=null&&t.CustomPurchaseSettings.CustomPurchaseSettingsSet===!0?(n.FieldProperties.FieldDisplayOptionTitle=t.CustomPurchaseSettings.FieldDisplayOptionTitle,n.FieldProperties.FieldDisplayOptionCompany=t.CustomPurchaseSettings.FieldDisplayOptionCompany,n.FieldProperties.FieldDisplayOptionStreetAddress=t.CustomPurchaseSettings.FieldDisplayOptionStreetAddress,n.FieldProperties.FieldDisplayOptionStreetAddressLine2=t.CustomPurchaseSettings.FieldDisplayOptionStreetAddressLine2,n.FieldProperties.FieldDisplayOptionSuburb=t.CustomPurchaseSettings.FieldDisplayOptionSuburb,n.FieldProperties.FieldDisplayOptionPostcode=t.CustomPurchaseSettings.FieldDisplayOptionPostcode,n.FieldProperties.FieldDisplayOptionState=t.CustomPurchaseSettings.FieldDisplayOptionState,n.FieldProperties.FieldDisplayOptionCcv=t.CustomPurchaseSettings.FieldDisplayOptionCcv,n.FieldProperties.FieldDisplayOptionPhoneNumber=t.CustomPurchaseSettings.FieldDisplayOptionPhoneNumber,n.FieldProperties.FieldDisplayOptionSecondaryPhoneNumber=t.CustomPurchaseSettings.FieldDisplayOptionSecondaryPhoneNumber,n.FieldProperties.FieldDisplayOptionVipWithdrawalDate=t.CustomPurchaseSettings.FieldDisplayOptionVipWithdrawalDate,n.FieldProperties.FieldDisplayOptionAuthorisedBy=t.CustomPurchaseSettings.FieldDisplayOptionAuthorisedBy,n.FieldProperties.PlaceholderTextTitle=t.CustomPurchaseSettings.PlaceholderTextTitle,n.FieldProperties.PlaceholderTextCompany=t.CustomPurchaseSettings.PlaceholderTextCompany,n.FieldProperties.PlaceholderTextStreetAddress=t.CustomPurchaseSettings.PlaceholderTextStreetAddress,n.FieldProperties.PlaceholderTextStreetAddressLine2=t.CustomPurchaseSettings.PlaceholderTextStreetAddressLine2,n.FieldProperties.PlaceholderTextSuburb=t.CustomPurchaseSettings.PlaceholderTextSuburb,n.FieldProperties.PlaceholderTextPostcode=t.CustomPurchaseSettings.PlaceholderTextPostcode,n.FieldProperties.PlaceholderTextState=t.CustomPurchaseSettings.PlaceholderTextState,n.FieldProperties.PlaceholderTextCcv=t.CustomPurchaseSettings.PlaceholderTextCcv,n.FieldProperties.PlaceholderTextCreditCardNumber=t.CustomPurchaseSettings.PlaceholderTextCreditCardNumber,n.FieldProperties.PlaceholderTextPhoneNumber=t.CustomPurchaseSettings.PlaceholderTextPhoneNumber,n.FieldProperties.PlaceholderTextSecondaryPhoneNumber=t.CustomPurchaseSettings.PlaceholderTextSecondaryPhoneNumber,n.FieldProperties.PlaceholderTextAuthorisedBy=t.CustomPurchaseSettings.PlaceholderTextAuthorisedBy):(n.FieldProperties.FieldDisplayOptionTitle="Optional",n.FieldProperties.FieldDisplayOptionCompany="Optional",n.FieldProperties.FieldDisplayOptionStreetAddress="Optional",n.FieldProperties.FieldDisplayOptionStreetAddressLine2="Suppressed",n.FieldProperties.FieldDisplayOptionSuburb="Optional",n.FieldProperties.FieldDisplayOptionPostcode="Mandatory",n.FieldProperties.FieldDisplayOptionState="Mandatory",n.FieldProperties.FieldDisplayOptionCcv="Mandatory",n.FieldProperties.FieldDisplayOptionPhoneNumber="Mandatory",n.FieldProperties.FieldDisplayOptionSecondaryPhoneNumber="Suppressed",n.FieldProperties.FieldDisplayOptionVipWithdrawalDate="Mandatory",n.FieldProperties.FieldDisplayOptionAuthorisedBy="Suppressed",n.FieldProperties.PlaceholderTextTitle="Title (optional)",n.FieldProperties.PlaceholderTextCompany="Company (optional)",n.FieldProperties.PlaceholderTextStreetAddress="Street Address (optional)",n.FieldProperties.PlaceholderTextStreetAddressLine2="Street Address Line 2 (optional)",n.FieldProperties.PlaceholderTextSuburb="Suburb (optional)",n.FieldProperties.PlaceholderTextPostcode="Postcode",n.FieldProperties.PlaceholderTextState="State",n.FieldProperties.PlaceholderTextCcv="CCV",n.FieldProperties.PlaceholderTextCreditCardNumber="Credit Card Number",n.FieldProperties.PlaceholderTextPhoneNumber="10-digit Phone Number (include area code for land line)",n.FieldProperties.PlaceholderTextSecondaryPhoneNumber="Secondary Phone Number (include area code for land line)",n.FieldProperties.PlaceholderTextAuthorisedBy="Authorised By"),t!==null&&t.CustomPurchaseSettings!=null&&t.CustomPurchaseSettings.DisableManualAmountEntry!==null&&(n.disableManualAmountEntry=t.CustomPurchaseSettings.DisableManualAmountEntry),t!==null&&t.CustomPurchaseSettings!=null&&t.CustomPurchaseSettings.AllowPurchaseWithoutEmail!==null&&t.CustomPurchaseSettings.AdminMailboxForPurchasesWithoutEmail!==null&&t.CustomPurchaseSettings.AdminMailboxForPurchasesWithoutEmail!==""&&(n.allowPurchaseWithoutEmail=t.CustomPurchaseSettings.AllowPurchaseWithoutEmail,n.adminMailboxForPurchasesWithoutEmail=t.CustomPurchaseSettings.AdminMailboxForPurchasesWithoutEmail),n.displayPledge=t.CustomPurchaseSettings!=null&&t.CustomPurchaseSettings.AllowPledge,n.raffleBook=t.CustomPurchaseSettings!=null&&t.CustomPurchaseSettings.IsRaffleBook,n.raffleBookSize=n.raffleBook&&n.Data.Raffles[0]?n.Data.Raffles[0].BookSize:0,n.raffleExcludeState=n.Data.Raffles[0]?n.Data.Raffles[0].ExcludesState:null,n.raffleRedirectMessage=n.Data.Raffles[0]?n.Data.Raffles[0].RedirectMessage:"",t!==null&&t.CustomPurchaseFields!==null)for(i=0;i<t.CustomPurchaseFields.length;i++)t.CustomPurchaseFields[i].FieldValue=rt(t.CustomPurchaseFields[i].FieldName);t.CustomPurchaseSettings.RaffleSendSmsOnCompletion&&(n.Details.Billing.raffleToSendSms=!0);n.paybyOption=n.Data.CustomPurchaseSettings.DisplayCashPayment&&!n.Data.CustomPurchaseSettings.DisplayCardPayment?n.paybyOptionCashName:n.paybyOptionCardName;n.verifyAgent=n.Data.CustomPurchaseSettings.DisplayCashPayment||n.Data.CustomPurchaseSettings.VerifiedAgentPurchasePage;n.Data.CustomPurchaseSettings.DisplayCashPayment&&(n.Details.CashPayment.username=f.get("agentid"));try{u=a("ref");u&&(n.ticketReference=("00000"+parseInt(u)).slice(-6));e=a("amount");e&&(n.amountDue=Math.trunc(parseFloat(e)*100)/100)}catch(o){console.warn("Page pre-fill unsuccessful")}return n.standAloneRegularGiving=t!==null&&t.CustomPurchaseSettings!=null&&t.CustomPurchaseSettings.EnableRegularGiving&&t.CustomPurchaseSettings.StandaloneRegularGivingPage,n.regularGivingEnabled()&&!n.standAloneRegularGiving&&(n.steps=[n.stepSelectName,n.stepRegularGivingName,n.stepBillingName],n.monthlyGivingAmount=null),!0},function(){n.onSubmitFail()})};n.getCustomFieldListSelection=function(t,i){return h.get("/api/RaffleInfo/CustomFieldDropList?listId="+i+"&filter="+t).then(function(n){return n.data},function(){n.onSubmitFail()})};n.resizeVipSignaturePad=function(){var t=jQuery("#vipSignaturePad").find("canvas");t.css("height",n.getSignaturePadWidth());t.css("width","")};n.getSignaturePadWidth=function(){var n=p,t=window.innerWidth>0?window.innerWidth:screen.width;return t-w<p&&(n=t-w),n};n.initExpMonthList=function(){var i=[],t,r;for(i.push({expMonth:0,text:"Expiry Month"}),t=1;t<=12;t++)r="0",r=t.toString().length==1?r+t.toString():t.toString(),i.push({expMonth:t,text:r});return n.Details.Payment.expMonth=i[0],i};n.initExpYearList=function(){var i=[],t;for(currentYear=(new Date).getFullYear(),i.push({expYear:0,text:"Expiry Year"}),t=currentYear;t<=currentYear+21;t++)i.push({expYear:t,text:t.toString()});return n.Details.Payment.expYear=i[0],i};n.initDobDayList=function(){var i=[],t,r;for(i.push({dobDay:0,text:"DOB: (DAY)"}),t=1;t<=31;t++)r="0",r=t.toString().length===1?r+t.toString():t.toString(),i.push({dobDay:t,text:r});return n.Details.ContactDetails.dobDay=i[0],i};n.initDobMonthList=function(){var i=[],t;for(i.push({dobMonth:0,text:"DOB: (MONTH)"}),t=1;t<=12;t++)i.push({dobMonth:t,text:moment.months(t-1)});return n.Details.ContactDetails.dobMonth=i[0],i};n.initDobYearList=function(){var i=[],t,r;for(i.push({dobYear:0,text:"DOB: (YEAR)"}),t=0;t<100;t++)r=(new Date).getFullYear(),i.push({dobYear:r-t,text:(r-t).toString()});return n.Details.ContactDetails.dobYear=i[0],i};n.quantityChanged=function(t){n.resetErrors();n.Checkout=!1;n.regularGivingAccepted=!1;n.monthlyGivingAmount=0;t!==null&&(n.selectedNumTickets=t);n.QuickSelections&&$.each(n.QuickSelections,function(n,t){t.ariaPressed=!1});n.Data.CustomPurchaseSettings.QuickSelections&&$.each(n.Data.CustomPurchaseSettings.QuickSelections,function(n,t){t.ariaPressed=!1});n.applyDiscount()};n.donationAmountChanged=function(){n.resetErrors();n.Checkout=!1;n.applyDiscount()};n.validateState=function(){n.raffleExcludeState!=null&&(_.contains(n.raffleExcludeState,n.Details.Billing.state)?(n.PurchaseTicketsForm.State.$setValidity("validateState",!1),jQuery("#billing-state").addClass("ng-invalid")):(n.PurchaseTicketsForm.State.$setValidity("validateState",!0),jQuery("#billing-state").removeClass("ng-invalid")))};n.getOptionalDonationAmount=function(){return n.displayDonations===!0?n.donationAmount>0?n.donationAmount:0:0};v=function(){var t=[],i,r,u,f;return n.selectedNumTickets!=null&&t.push({Sku:n.Data.RaffleStoreItem.Sku,Quantity:Math.floor(n.selectedNumTickets),Name:n.Data.RaffleStoreItem.DisplayName,UnitPrice:n.Data.RaffleStoreItem.Price}),n.paymentOnly===!0&&(i=Math.round(n.amountDue?n.amountDue/.01:0),t.push({Sku:n.Data.CustomPurchaseSettings.PayOnlineItemSku,Quantity:i,Name:"Pay Online",UnitPrice:.01})),n.displayDonations===!0&&(r=Math.round(n.donationAmount?n.donationAmount/.01:0),t.push({Sku:n.Data.CustomPurchaseSettings.DonationItemSku,Quantity:r,Name:"Donation",UnitPrice:.01})),n.displayVipRegistration===!0&&n.monthlyVipAmount>0&&(u=Math.floor(n.monthlyVipAmount/n.Data.RaffleStoreItem.Price),t.push({Sku:n.Data.CustomPurchaseSettings.VipPaymentItemSku,Quantity:u,Name:"VIP Registration",UnitPrice:n.Data.RaffleStoreItem.Price})),n.regularGivingAccepted&&n.monthlyGivingAmount>0&&t.push({Sku:n.Data.RaffleStoreItem.Sku,Quantity:n.regularGivingTicketQuantity,Name:"Monthly Giving",UnitPrice:n.Data.RaffleStoreItem.Price}),f={ClearExistingCart:!0,Products:t,PurchasePageId:n.ItemId},n.products=t,h.post("/api/RaffleAddToCart/",JSON.stringify(f),{headers:{"Content-Type":"application/json",Accept:"application/json"}})};n.setPriceAlert=function(t,i,r){n.priceError=!0;n.cartPrice=t;n.suggestedAmount=r;n.priceErrorMessage=i};n.clearPriceAlert=function(){n.priceError=!1;n.priceErrorMessage=""};n.resetErrors=function(){n.responseErrorMessage="";n.payNowError=!1;n.ticketNotEnough=!1;n.ticketSoldOut=!1;n.submitValidationErrors=[]};n.resetPaymentDetails=function(){n.Details.Payment.name="";n.Details.Payment.cardNumber=undefined;n.Details.Payment.expMonth=n.expMonthList[0];n.Details.Payment.expYear=n.expYearList[0];n.Details.Payment.ccv=""};n.fireCheckout=function(t){var i,r,u;t||n.resetErrors();n.clearPriceAlert();n.displayVipRegistration===!0&&n.monthlyVipAmount<n.Data.CustomPurchaseSettings.VipMinimumMonthlyAmount?(i="Please enter an amount that is equal to or above the minimum monthly threshold ($"+n.Data.CustomPurchaseSettings.VipMinimumMonthlyAmount+")",n.setPriceAlert(n.cartPrice,i,n.Data.CustomPurchaseSettings.VipMinimumMonthlyAmount)):n.displayVipRegistration===!0&&n.monthlyVipAmount%n.Data.RaffleStoreItem.Price>0?(r=Math.floor(n.monthlyVipAmount/n.Data.RaffleStoreItem.Price)*n.Data.RaffleStoreItem.Price,u="Please enter an amount that is a multiple of the VIP ticket price ($"+n.Data.RaffleStoreItem.Price+")",n.setPriceAlert(n.cartPrice,u,r)):v().then(function(i){return n.HandleResponseErrors(i),i.data.HasResponseErrors===!0?setTimeout(function(){jQuery(".validationMarker").addClass("showValidationMarker")},1e3):(n.cartPrice=i.data.OrderTotal,n.discountAmount=i.data.DiscountAmount,n.bonusTicketQuantity=i.data.BonusTicketQuantity,n.BasketId=i.data.BasketId,n.Checkout=!0,jQuery(".buyBoxForm").addClass("buyBoxFormExpand"),n.validateCardExp(n.Details.Payment.expMonth,n.Details.Payment.expYear),n.validateDob(),n.resizeVipSignaturePad(),t||c(function(){$(".buyBoxForm .titleSelect").focus()},500),n.navigateNext()),!0},function(){n.onSubmitFail()})};n.monthlyGivingFireCheckout=function(t){n.regularGivingAccepted=t;var i=n.calculateMinimumMonthlyGivingAmount();t&&n.monthlyGivingAmount<i?n.setPriceAlert(n.cartPrice,"Minimum monthly amount is $"+i,i):n.fireCheckout(null)};n.pay=function(t){var i,u,r,e;if(t.preventDefault(),n.resetErrors(),n.Details&&n.Details.CashPayment&&n.Details.CashPayment.username&&f.put("agentid",n.Details.CashPayment.username),n.Data.CustomPurchaseSettings.DisplayCashPayment||n.validateCardExp(n.Details.Payment.expMonth,n.Details.Payment.expYear),n.validateDob(),n.Data.CustomPurchaseFields&&$.each(n.Data.CustomPurchaseFields,function(n,t){t.FieldType=="Drop list"&&(t.FieldValue=t.ddlSelectedItem&&t.ddlSelectedItem.Key?t.ddlSelectedItem.Key:undefined)}),n.validationErrorMessage=y,!n.isSignatureRequired()||n.Details.VipRegistration.otherApprovalReceived||n.isSignaturePopulated()||(n.PurchaseTicketsForm.$invalid=!0,n.validationErrorMessage=d),n.PurchaseTicketsForm.$valid===!1&&n.PurchaseTicketsForm.$error!==undefined&&n.PurchaseTicketsForm.$error!==null&&n.PurchaseTicketsForm.$error.length>0&&(n.PurchaseTicketsForm.$invalid=!0),(n.displayVipRegistration||n.regularGivingAccepted)&&n.Details!==undefined&&n.Details!==null&&n.Details.VipRegistration!==undefined&&n.Details.VipRegistration!==null&&n.Details.VipRegistration.vipConfirm!==undefined&&n.Details.VipRegistration.vipConfirm!==null)for(i=0;i<n.Details.VipRegistration.vipConfirm.length;i++)n.Details.VipRegistration.vipConfirm[i]||n.submitValidationErrors.includes(n.Data.CustomPurchaseSettings.ConfirmationCheckboxes[i].ValidationMessage)||(n.submitValidationErrors.push(n.Data.CustomPurchaseSettings.ConfirmationCheckboxes[i].ValidationMessage),n.PurchaseTicketsForm.$invalid=!0);if(n.showErrorMessages=!0,n.PurchaseTicketsForm.$invalid?(jQuery(".validationMarker").addClass("showValidationMarker"),u=$(".buyBoxForm.buyBoxFormExpand").find(".ng-invalid"),u.length>0?u[0].focus():$(".buyBoxValidation .validationMarker").focus()):jQuery(".validationMarker").removeClass("showValidationMarker"),n.PurchaseTicketsForm.$submitted=!0,n.PurchaseTicketsForm.$invalid!==!0){n.loading=!0;jQuery(".buyBoxForm").removeClass("buyBoxFormExpand");r={Title:n.Details.Billing.title,FirstName:n.Details.Billing.firstName,LastName:n.Details.Billing.lastName,CompanyName:n.Details.Billing.company==null?"":n.Details.Billing.company,PhoneNumber:n.Details.Billing.phone,SecondaryPhoneNumber:n.Details.Billing.secondaryPhone,Email:n.Details.Billing.email,AddressDetails:{StreetAddress:n.Details.Billing.address==null?"":n.Details.Billing.address,StreetAddressLine2:n.Details.Billing.addressLine2==null?"":n.Details.Billing.addressLine2,Suburb:n.Details.Billing.suburb==null?"":n.Details.Billing.suburb,PostCode:n.Details.Billing.postcode,State:n.Details.Billing.state}};n.Details.Billing.noEmailPurchase&&(r.Email=n.adminMailboxForPurchasesWithoutEmail);n.displayVipRegistration===!0&&(r.DateOfBirth=n.getEnteredDob(),r.Gender=n.Details.ContactDetails.gender);e=n.displayPledge?{PaymentType:2}:{PaymentType:1,PayBy:n.paybyOption,CreditCardDetails:{CardName:n.Details.Payment.name,CardNumber:n.Details.Payment.cardNumber!==undefined?n.Details.Payment.cardNumber.toString():"",CardExpiryMonth:n.Details.Payment.expMonth!==undefined?n.Details.Payment.expMonth.expMonth.toString():"",CardExpiryYear:n.Details.Payment.expYear.expYear!==undefined?n.Details.Payment.expYear.expYear.toString():"",CardCcv:n.Details.Payment.ccv!==undefined?n.Details.Payment.ccv.toString():""},CashPayment:{Username:n.Details.CashPayment.username,Pin:n.Details.CashPayment.pin,SiteId:n.Details.CashPayment.siteid},AuthorisedBy:n.Details.Billing.authorisedBy};var o={PaymentOnly:n.paymentOnly,Reference:n.Data.CustomPurchaseSettings.ReferenceFieldPrefix+n.ticketReference},s={VipConfirmations:n.Details.VipRegistration.vipConfirm,MonthlyCommitment:n.monthlyVipAmount,Comments:n.Details.VipRegistration.comments,Signature:n.Details.VipRegistration.otherApprovalReceived?undefined:n.Details.VipRegistration.signature,OtherApprovalReceived:n.Details.VipRegistration.otherApprovalReceived,PreferredMonthlyWithdrawalDate:n.Details.VipRegistration.preferredMonthlyWithdrawalDate},c={RegularGivingSelected:n.regularGivingAccepted,RegularGivingConfirmations:n.Details.VipRegistration.vipConfirm,MonthlyCommitment:n.monthlyGivingAmount,Comments:n.Details.VipRegistration.comments,Signature:n.Details.VipRegistration.otherApprovalReceived?undefined:n.Details.VipRegistration.signature,OtherApprovalReceived:n.Details.VipRegistration.otherApprovalReceived,PreferredMonthlyWithdrawalDate:n.Details.VipRegistration.preferredMonthlyWithdrawalDate},l={ContactDetails:r,PaymentDetails:e,CustomFields:n.Data.CustomPurchaseFields,PaymentOnlyPurchase:o,CurrentItemId:n.ItemId,VipRegistrationDetails:s,RegularGivingDetails:c,RaffleToSendSms:n.Details.Billing.raffleToSendSms,GeomantPaymentDetails:n.geomantPaymentDetails};h.post("/api/RafflePurchase/",JSON.stringify(l),{headers:{"Content-Type":"application/json",Accept:"application/json"}}).then(function(t){var i,e,o,r,u,f;if(n.HandleResponseErrors(t),i=t.data,n.loading=!1,i.HasResponseErrors==!0&&!i.IsPaid){if(n.resetPaymentDetails(),i.TicketSoldOut)return b(),!0;if(i.TicketNotEnough)return nt(i.ErrorMessage),!0;if(i.IsPaymentError)return tt(),!0;if(i.IsValidationError)n.payNowError=!1,n.fireCheckout(!0);else return n.payNowError=!0,n.responseErrorMessage=i.ErrorMessage||"Unfortunately we were unable to process your request and the transaction was unsuccessful. Please try again later.",n.fireCheckout(!0),!0}if(setTimeout(function(){jQuery(".validationMarker").addClass("showValidationMarker");$(".buyBoxValidation .validationMarker").focus()},1e3),t.data.HasResponseErrors==!1||t.data.IsPaid){for(e="00000000-0000-0000-0000-000000000000",n.BasketId!=null&&(e=n.BasketId),o=[],r=0;r<n.products.length;r++)u=n.products[r].UnitPrice,f=n.products[r].Quantity,u===.01&&(u=f*u,f=1),o.push({sku:n.products[r].Sku,name:n.products[r].Name,category:"Fundraising Item",price:u,quantity:f});window.dataLayer=window.dataLayer||[];window.dataLayer.hasOwnProperty("push")?window.dataLayer.push({transactionId:e,transactionAffiliation:window.location.hostname+" Store",transactionTotal:n.total,transactionTax:0,transactionShipping:0,transactionProducts:o,event:"TransactionComplete",eventCallback:function(){k(t)},eventTimeout:1e4}):k(t)}return!0},function(t){n.loading=!1;n.handleWsError(t);setTimeout(function(){jQuery(".validationMarker").addClass("showValidationMarker")},1e3)})}};n.isSignatureRequired=function(){var t=!1;return(n.displayVipRegistration===!0||n.regularGivingAccepted)&&(n.Details===undefined||n.Details.VipRegistration===undefined||!n.Details.VipRegistration.otherApprovalReceived)&&(t=!0),t};n.isSignaturePopulated=function(){var t=!1;return n.Details===undefined||n.Details.VipRegistration===undefined||n.Details.VipRegistration.signature==undefined||n.Details.VipRegistration.signature==null||n.Details.VipRegistration.signature===g||(t=!0),t};n.validateCardExp=function(t,i){n.displayPledge||n.paybyOption===n.paybyOptionCashName||n.Details!==undefined&&n.Details!==null&&n.Details.Payment!==undefined&&n.Details.Payment!==null&&(i.expYear===0?(n.PurchaseTicketsForm["Card Expiry Year"].$setValidity("Card Expiry Year",!1),jQuery(".expYear").addClass("ng-invalid")):(n.PurchaseTicketsForm["Card Expiry Year"].$setValidity("Card Expiry Year",!0),jQuery(".expYear").removeClass("ng-invalid")),t.expMonth===0?(n.PurchaseTicketsForm["Card Expiry Month"].$setValidity("Card Expiry Month",!1),jQuery(".expMonth").addClass("ng-invalid")):n.PurchaseTicketsForm["Card Expiry Month"].$setValidity("Card Expiry Month",!0))};n.validateCardNumber=function(){n.displayPledge||n.paybyOption===n.paybyOptionCashName||(n.Details.Payment.cardNumber!==undefined&&n.Details.Payment.cardNumber!==null&&l.validateCardType(n.Details.Payment.cardNumber.toString())&&l.validateLuhn(n.Details.Payment.cardNumber.toString())?(n.PurchaseTicketsForm["Card Number"].$setValidity("validateCardNumber",!0),jQuery("#creditCard").removeClass("ng-invalid")):(n.PurchaseTicketsForm["Card Number"].$setValidity("validateCardNumber",!1),jQuery("#creditCard").addClass("ng-invalid")))};n.getEnteredDob=function(){var t=n.Details.ContactDetails.dobYear.text+"-"+n.Details.ContactDetails.dobMonth.dobMonth+"-"+n.Details.ContactDetails.dobDay.text;return moment.utc(t,"YYYY-M-DD",!0)};n.validateDob=function(){var t=!1;if(n.PurchaseTicketsForm&&n.displayVipRegistration===!0){var u=n.Details.ContactDetails.dobYear.text+"-"+n.Details.ContactDetails.dobMonth.dobMonth+"-"+n.Details.ContactDetails.dobDay.text,i=moment.utc(u,"YYYY-M-DD",!0),r=moment().subtract(18,"years");t=i.isValid();t&&i<r?(jQuery(".ddlDobDay").removeClass("ng-invalid"),jQuery(".ddlDobMonth").removeClass("ng-invalid"),jQuery(".ddlDobYear").removeClass("ng-invalid"),n.dobValidationError=!1,n.dobValidationErrorMessage=""):(n.PurchaseTicketsForm.$invalid=!0,jQuery(".ddlDobDay").addClass("ng-invalid"),jQuery(".ddlDobMonth").addClass("ng-invalid"),jQuery(".ddlDobYear").addClass("ng-invalid"),n.dobValidationError=!0,t===!1?n.dobValidationErrorMessage="Invalid date of birth value":i>r&&(n.dobValidationErrorMessage="Minimum VIP signup age is 18 years old"))}return t};n.calculateTotal=function(){var i=n.displayDonations===!0&&n.donationAmount>0?n.donationAmount:0,r=n.paymentOnly===!0&&n.amountDue>0?n.amountDue:0,u=n.selectedNumTickets!=null&&n.selectedNumTickets>0?n.selectedNumTickets*n.Data.RaffleStoreItem.Price:0,f=n.displayVipRegistration===!0&&n.monthlyVipAmount>0?n.monthlyVipAmount:0,t=i+r+u+f;return(n.total!==t&&n.cartPrice+n.discountAmount!==t&&(n.Checkout=!1,n.total=t),n.paymentOnly===!0&&n.PurchaseTicketsForm["Ticket Reference"]!==undefined&&n.PurchaseTicketsForm["Ticket Reference"].$invalid===!0)?0:(n.discountAmount>0&&n.total===n.cartPrice+n.discountAmount&&(n.total=n.cartPrice),n.total)};n.applyDiscount=function(){v().then(function(t){return n.HandleResponseErrors(t),t.data.HasResponseErrors===!0||(n.cartPrice=t.data.OrderTotal,n.discountAmount=t.data.DiscountAmount,n.bonusTicketQuantity=t.data.BonusTicketQuantity,n.BasketId=t.data.BasketId,n.total=t.data.OrderTotal,n.Checkout=!1,n.regularGivingEnabled()&&(n.raffleSalesEnabled()||n.standAloneRegularGiving?(n.standAloneRegularGiving&&(n.regularGivingAccepted=!0),n.monthlyGivingAmount=n.selectedNumTickets*n.Data.RaffleStoreItem.Price-t.data.DiscountAmount,n.regularGivingTicketQuantity=n.selectedNumTickets):n.displayDonations&&(n.monthlyGivingAmount=n.donationAmount))),!0},function(){n.onSubmitFail()})};n.$on("quickSelectChanged",function(t,i){n.quickSelectAmount(i.event,i.item,i.amount)});n.quickSelectAmount=function(t,i,r){var f=!1,u,e;n.Data.RaffleStoreItem&&n.paymentOnly===!1&&n.Data.CustomPurchaseSettings.HideMainRaffleItem!==!0?(n.quantityChanged(r),f=!0):n.displayVipRegistration===!0?n.monthlyVipAmount=r:n.displayDonations===!0?n.donationAmount=r:n.paymentOnly===!0&&(n.amountDue=r);$.each(n.QuickSelections,function(n,t){t.ariaPressed=!1});$.each(n.Data.CustomPurchaseSettings.QuickSelections,function(n,t){t.ariaPressed=!1});i.ariaPressed=!0;u=$(t.currentTarget).parent();e=u.parent();e.children(".quickSelectionItem").removeClass("unselected").not(u).addClass("unselected");f||n.applyDiscount()};n.monthlyGivingQuickSelectAmount=function(t,i,r){n.selectedNumTickets=r;n.quantityChanged(r);$.each(n.Data.CustomPurchaseSettings.RegularGivingQuickSelections,function(n,t){t.ariaPressed=!1});i.ariaPressed=!0;$(".monthlyGivingQuickSelectionItem").removeClass("unselected").not(t.currentTarget).addClass("unselected")};n.csuitePopulate=function(t){n.loading=!0;h.defaults.useXDomain=!0;n.callInfoError=!1;h.get(n.Data.CustomPurchaseSettings.CsuiteCallInfoEndpoint+"/"+n.Data.CustomPurchaseSettings.CsuiteClientId+"/"+t).then(function(t){n.loading=!1;t.data.HasError===!0?(n.callInfoError=!0,n.callInfoValidationErrorMessage=t.data.ReturnMessage):(t.data.Title!=null&&(n.Details.Billing.title=t.data.Title.toUpperCase()),n.Details.Billing.firstName=t.data.FirstName,n.Details.Billing.lastName=t.data.LastName,n.Details.Billing.email=t.data.Email,n.Details.Billing.phone=t.data.PhoneNumber,n.Details.Billing.company=t.data.Company,n.Details.Billing.address=t.data.StreetAddress,n.Details.Billing.suburb=t.data.Suburb,n.Details.Billing.postcode=t.data.Postcode,t.data.State!=null&&(n.Details.Billing.state=t.data.State.toUpperCase()))},function(){n.loading=!1;n.callInfoError=!0;n.callInfoValidationErrorMessage="Error contacting call info service.";n.onSubmitFail()})};n.geomantPopulate=function(t,i){n.loading=!0;h.defaults.useXDomain=!0;n.callInfoError=!1;n.callWebApiService(o,{ContactId:i,CampaignId:t,RequestPageId:n.ItemId}).then(function(t){n.loading=!1;t.HasResponseErrors&&(n.callInfoError=!0,n.callInfoValidationErrorMessage="Error retrieving contact data from Geomant");n.Details.Billing.title=t.Title;n.Details.Billing.firstName=t.FirstName;n.Details.Billing.lastName=t.LastName;n.Details.Billing.email=t.Email;n.Details.Billing.phone=t.ContactNumber;n.Details.Billing.secondaryPhone=t.SecondaryContactNumber;n.Details.Billing.company=t.CompanyName;n.Details.Billing.address=t.PostalAddress;n.Details.Billing.addressLine2=t.PostalAddressLine2;n.Details.Billing.suburb=t.PostalCity;n.Details.Billing.postcode=t.PostalPostcode;t.PostalState!=null&&(n.Details.Billing.state=t.PostalState.toUpperCase())},function(){n.loading=!1;n.callInfoError=!0;n.callInfoValidationErrorMessage="Error contacting Geomant service.";n.onSubmitFail()})};n.stepChange=function(t){n.CurrentStep=t;$("#smartwizard .nav li span.active").addClass("done").removeClass("active");var i="."+t+"-link";$(i).addClass("active").removeClass("inactive").removeClass("done");s.ShowOrHideQuickSelection(t===n.stepSelectName);ut()};n.stepNext=function(){var r=!0,u=n.steps.indexOf(n.CurrentStep),i,t;if(n.steps[u]===n.stepSelectName&&(n.raffleInfoError=!1,n.validationErrors=[],n.Data.CustomPurchaseFields!==undefined&&n.Data.CustomPurchaseFields!=null))for(i=0;i<n.Data.CustomPurchaseFields.length;i++)t=n.Data.CustomPurchaseFields[i],t.Required&&((t.FieldType==="Text"||t.FieldType==="Text area")&&(t.FieldValue===undefined||t.FieldValue===null||t.FieldValue.length===0)||t.FieldType==="Drop list"&&(t.ddlSelectedItem===undefined||t.ddlSelectedItem===null))&&(n.raffleInfoError=!0,r=!1,n.validationErrors.push(n.Data.CustomPurchaseFields[i].FieldName+" is required"));r&&(n.steps[u]===n.stepSelectName?n.fireCheckout(!1):n.navigateNext())};n.stepPrev=function(){var t,i;n.clearPriceAlert();t=n.steps.indexOf(n.CurrentStep);t>0&&(i="."+n.steps[t]+"-link",$(i).addClass("inactive").removeClass("active").removeClass("done"),n.stepChange(n.steps[t-1]))};n.navigateNext=function(){var t=n.steps.indexOf(n.CurrentStep);t<n.steps.length-1&&n.stepChange(n.steps[t+1])};n.selectButtonEnabled=function(){return!n.ticketSoldOut&&n.calculateTotal()>0||n.ticketReference!==undefined&&n.ticketReference!==null&&n.ticketReference.length===6&&n.amountDue>0||!n.donationOptional&&n.donationAmount>0?!0:!1};n.raffleSalesEnabled=function(){return n.Data!==undefined&&n.Data!==null&&n.Data.RaffleStoreItem&&n.paymentOnly===!1&&n.Data.CustomPurchaseSettings.HideMainRaffleItem!==!0&&!n.ticketSoldOut&&n.Data.Raffles.length>0};n.regularGivingEnabled=function(){return n.Data!=undefined&&n.Data!=null&&n.Data.CustomPurchaseSettings!==null&&n.Data.CustomPurchaseSettings.EnableRegularGiving&&n.Data.RaffleStoreItem&&n.Data.PaymentOnly===!1&&n.Data.CustomPurchaseSettings.HideMainRaffleItem!==!0&&!n.Data.TicketSoldOut&&n.Data.Raffles.length>0};n.calculateMinimumMonthlyGivingAmount=function(){var t=10;return n.raffleSalesEnabled&&(t=Math.ceil(t/n.Data.RaffleStoreItem.Price)*n.Data.RaffleStoreItem.Price),t};n.stepsContain=function(t){return n.steps!==null&&n.steps.includes(t)};n.init=function(i){angular.extend(this,t("BaseCtrl",{$scope:n}));n.paymentMethods=[];n.Checkout=!1;n.CurrentStep=n.stepSelectName;n.Details={};n.Details.Billing={};n.Details.Payment={};n.Details.Payment.expYear=null;n.Details.CashPayment={};n.Details.CashPayment.siteid=a("SiteId");n.Details.VipRegistration={};n.FieldProperties={};n.Details.ContactDetails={};n.Details.ContactDetails.dobDay=null;n.Details.ContactDetails.dobMonth=null;n.Details.ContactDetails.dobYear=null;n.Details.ContactDetails.gender=null;n.dobDayList=n.initDobDayList();n.dobMonthList=n.initDobMonthList();n.dobYearList=n.initDobYearList();n.expMonthList=n.initExpMonthList();n.expYearList=n.initExpYearList();n.populatePageData(i);n.loading=!1;n.missingUcommerceRaffleItem=!1;n.ItemId=i;n.paymentOnly=null;n.showErrorMessages=!1;n.emailFormat=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;n.products=[];n.displayVipRegistration=!1;n.disableManualAmountEntry=!1;n.allowPurchaseWithoutEmail=!1;n.standAloneRegularGiving=!1;n.regularGivingAccepted=!1;n.regularGivingTicketQuantity=0;n.cartPrice=0;n.discountAmount=0;n.suggestedAmount=0;n.priceError=!1;n.priceErrorMessage="";n.submitValidationErrors=[];n.dobValidationError=!1;n.dobValidationErrorMessage="";n.callInfoError=!1;n.callInfoValidationErrorMessage="";var r=jsCommon.getUrlParameter("ContactId"),u=jsCommon.getUrlParameter("CampaignId");r&&(n.geomantDetailsProvidedInQueryString=!0,n.geomantPaymentDetails={ContactId:+r,CampaignId:+u,AgentId:jsCommon.getUrlParameter("AgentId"),ConversationId:jsCommon.getUrlParameter("ConversationId"),MemberId:jsCommon.getUrlParameter("MemberId")},n.geomantPopulate(+u,+r))}}]);shareModule=angular.module("corpApp.FundraisingSocialMediaLinks",[]);shareModule.controller("SocialShareCtrl",["$scope","$controller","FundraisingSocialMediaLinksService",function(n,t,i){n.populateControlData=function(t){n.callWebApiService(i,{request:t}).then(function(t){return n.HandleResponseErrors(t),n.data=t,!0},function(){n.onSubmitFail()})};n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));n.data={};n.populateControlData()}}]);FundraisingTestimonialModule=angular.module("corpApp.FundraisingTestimonialModule",["ngRoute","ngSanitize"]);FundraisingTestimonialModule.controller("FundraisingTestimonialCtrl",["$scope","$controller","$filter","FundraisingTestimonialService",function(n,t,i,r){n.populatePageData=function(t){n.callWebApiService(r,{id:t}).then(function(t){return n.HandleResponseErrors(t),n.Data=t,!0},function(){n.onSubmitFail()})};n.init=function(i){angular.extend(this,t("BaseCtrl",{$scope:n}));n.populatePageData(i)}}]);FundraisingTimeLeftModule=angular.module("corpApp.FundraisingTimeLeftModule",["ngRoute","ngSanitize"]);FundraisingTimeLeftModule.controller("FundraisingTimeLeftCtrl",["$scope","$controller","$filter","$interval","RaffleInfoService",function(n,t,i,r,u){n.Data={};n.Data.Days1="0";n.Data.Days2="0";n.Data.Hours1="0";n.Data.Hours2="0";n.Data.Minutes1="0";n.Data.Minutes2="0";n.Data.Seconds1="0";n.Data.Seconds2="0";n.printNumbers=function(){var e=new Date,t=Math.abs(n.finalDate-e)/1e3,i=Math.floor(t/86400),f,r,u;t-=i*86400;f=Math.floor(t/3600)%24;t-=f*3600;r=Math.floor(t/60)%60;t-=r*60;u=Math.round(t%60);i=i>=99?99:i;u===60&&(r+=1,u=0);n.Data.Days1=Math.floor(i/10);n.Data.Days2=i%10;n.Data.Hours1=Math.floor(f/10);n.Data.Hours2=f%10;n.Data.Minutes1=Math.floor(r/10);n.Data.Minutes2=r%10;n.Data.Seconds1=Math.floor(u/10);n.Data.Seconds2=u%10};n.populatePageData=function(){n.callWebApiService(u).then(function(t){var i,u,r;for(n.HandleResponseErrors(t),n.finalDate=new Date,i=0;i<t.Raffles.length;i++)u=t.Raffles[i].EndDate,r=new Date(u),r>n.finalDate&&(n.finalDate=r);return n.printNumbers(n.finalDate),n.finalDateSeconds=n.finalDate.getTime(),n.nowSeconds=Date.now(),!0},function(){n.onSubmitFail()})};n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));n.populatePageData();r(function(){n.printNumbers(n.finalDate)},1e3)}}]);FundraisingRafflesModule=angular.module("corpApp.StaffManualRaffleEntryModule",["ngRoute","ngSanitize"]);FundraisingRafflesModule.controller("StaffManualRaffleEntryCtrl",["$scope","$controller","$filter","$interval","RaffleInfoService","$http","StaffManualRaffleEntryService",function(n,t,i,r,u,f,e){n.populatePageData=function(){n.callWebApiService(u).then(function(t){return n.HandleResponseErrors(t),n.Data=t,!0},function(){n.onSubmitFail()})};n.initNumTicketsList=function(){var t=[],n;for(t.push({numTickets:1,text:"1 ticket"}),n=2;n<=10;n++)t.push({numTickets:n,text:n+" tickets"});for(n=11;n<=100;n++)n%5==0&&t.push({numTickets:n,text:n+" tickets"});for(n=101;n<=1e3;n++)n%50==0&&t.push({numTickets:n,text:n+" tickets"});return t};n.initExpMonthList=function(){var i=[],t,r;for(i.push({expMonth:0,text:"Expiry Month"}),t=1;t<=12;t++)r="0",r=t.toString().length==1?r+t.toString():t.toString(),i.push({expMonth:t,text:r});return n.Details.Payment.expMonth=i[0],i};n.initExpYearList=function(){var i=[],t;for(currentYear=(new Date).getFullYear(),i.push({expYear:0,text:"Expiry Year"}),t=currentYear;t<=currentYear+21;t++)i.push({expYear:t,text:t.toString()});return n.Details.Payment.expYear=i[0],i};n.fireCheckout=function(){n.Checkout=!0;jQuery(".buyBoxForm").addClass("buyBoxFormExpand");n.validateCardExp()};n.pay=function(){if(n.validateCardExp(),n.PurchaseTicketsForm.$invalid?jQuery(".validationMarker").addClass("showValidationMarker"):jQuery(".validationMarker").removeClass("showValidationMarker"),n.PurchaseTicketsForm.$submitted=!0,n.PurchaseTicketsForm.$valid){n.loading=!0;jQuery(".buyBoxForm").removeClass("buyBoxFormExpand");var t={FirstName:n.Details.Billing.firstName,LastName:n.Details.Billing.lastName,CompanyName:n.Details.Billing.company==null?"":n.Details.Billing.company,PhoneNumber:n.Details.Billing.phone,Email:n.Details.Billing.email,AddressDetails:{StreetAddress:n.Details.Billing.address==null?"":n.Details.Billing.address,Suburb:n.Details.Billing.suburb==null?"":n.Details.Billing.suburb,PostCode:n.Details.Billing.postcode,State:n.Details.Billing.state}},i={PaymentType:1,CreditCardDetails:{CardName:n.Details.Payment.name,CardNumber:n.Details.Payment.cardNumber.toString(),CardExpiryMonth:n.Details.Payment.expMonth.expMonth.toString(),CardExpiryYear:n.Details.Payment.expYear.expYear.toString(),CardCcv:n.Details.Payment.ccv.toString()}},r={Sku:n.Data.RaffleStoreItem.Sku,Quantity:n.selectedNumTickets,ContactDetails:t,PaymentDetails:i};f.post("/api/RafflePurchase/",JSON.stringify(r),{headers:{"Content-Type":"application/json",Accept:"application/json"}}).then(function(t){return n.HandleResponseErrors(t),n.loading=!1,t.data.HasResponseErrors==!0&&(n.responseError=!0),setTimeout(function(){jQuery(".validationMarker").addClass("showValidationMarker")},1e3),t.data.HasResponseErrors==!1&&alert("PAYMENT SUCCESS"),!0},function(){n.onSubmitFail()})}};n.validateCardExp=function(){n.Details!==undefined&&n.Details!==null&&n.Details.Payment!==undefined&&n.Details.Payment!==null&&(n.Details.Payment.expYear!==undefined&&n.Details.Payment.expYear!==null&&(n.Details.Payment.expYear.expYear==0?(n.PurchaseTicketsForm["Card Expiry Year"].$setValidity("Card Expiry Year",!1),jQuery(".expYear").addClass("ng-invalid")):(n.PurchaseTicketsForm["Card Expiry Year"].$setValidity("Card Expiry Year",!0),jQuery(".expYear").removeClass("ng-invalid"))),n.Details.Payment.expMonth!==undefined&&n.Details.Payment.expMonth!==null&&(n.Details.Payment.expMonth.expMonth==0?(n.PurchaseTicketsForm["Card Expiry Month"].$setValidity("Card Expiry Month",!1),jQuery(".expMonth").addClass("ng-invalid")):(n.PurchaseTicketsForm["Card Expiry Month"].$setValidity("Card Expiry Month",!0),jQuery(".expMonth").removeClass("ng-invalid"))))};n.getUserRef=function(){n.gettingData=!0;n.callWebApiService(e).then(function(t){return n.HandleResponseErrors(t),t.HasResponseErrors==!1?(n.Details.Billing.firstName=t.ClientDetails.FirstName,n.Details.Billing.lastName=t.ClientDetails.LastName,n.Details.Billing.email=t.ClientDetails.Email,n.Details.Billing.company=t.ClientDetails.CompanyName,n.Details.Billing.phone=t.ClientDetails.PhoneNumber,n.Details.Billing.address=t.ClientDetails.AddressDetails.StreetAddress,n.Details.Billing.suburb=t.ClientDetails.AddressDetails.Suburb,n.Details.Billing.postcode=parseInt(t.ClientDetails.AddressDetails.PostCode),n.Details.Billing.state=t.ClientDetails.AddressDetails.State):n.getDataFailed=!0,n.gettingData=!1,!0},function(){n.onSubmitFail()})};n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));n.gettingData=!1;n.getDataFailed=!1;n.Details={};n.Details.Billing={};n.Details.Payment={};n.Details.Payment.expYear=null;n.Details.Payment.expMonth=null;n.numTicketsList=n.initNumTicketsList();n.expMonthList=n.initExpMonthList();n.expYearList=n.initExpYearList();n.loading=!1;n.Staff={};n.fireCheckout()}}]);$(document).ready(function(){jsCommon.resizeHeightToViewport($(".window-full-height"));jsCommon.scrollTo($("a.scroll-to"));$(window).scroll(function(){$(this).scrollTop()>200?$(".scroll-to-top").fadeIn("slow"):$(".scroll-to-top").fadeOut("slow")});$("a.show-more").on("click",function(){$(this).parent().removeClass("show-more-on")})});myRoyalChangeDetailsModule=angular.module("corpApp.myRoyalChangeDetailsModule",["ngRoute","ngSanitize"]);myRoyalChangeDetailsModule.controller("myRoyalChangeDetailsCtrl",["$scope","$controller","MyRoyalGetDetailsService","MyRoyalChangeDetailsService",function(n,t,i,r){n.firstname="";n.lastname="";n.email="";n.dobFormat="DD/MM/YYYY";n.getDetails=function(){n.loading=!0;n.callWebApiService(i,{}).then(function(t){return n.loading=!1,n.HandleResponseErrors(t),n.firstname=t.FirstName,n.lastname=t.LastName,n.email=t.Email,t.DOB&&(n.dob=moment(t.DOB).format(n.dobFormat)),n.contactnumber=t.ContactNumber,n.postaladdress=t.PostalAddress,n.postalcity=t.PostalCity,n.postalpostcode=t.PostalPostcode,n.postalstate=t.PostalState,n.usi=t.USI,!0},function(){n.loading=!1;n.onSubmitFail()})};n.changeDetails=function(){n.loading=!0;n.callWebApiService(r,{FirstName:n.firstname,LastName:n.lastname,Email:n.email,DOB:moment(n.dob,n.dobFormat).toDate(),ContactNumber:n.contactnumber,PostalAddress:n.postaladdress,PostalCity:n.postalcity,PostalPostcode:n.postalpostcode,PostalState:n.postalstate,USI:n.usi}).then(function(t){return n.loading=!1,n.HandleResponseErrors(t),n.firstname=t.FirstName,n.lastname=t.LastName,n.email=t.Email,n.dob=t.DOB,n.contactnumber=t.ContactNumber,n.postaladdress=t.PostalAddress,n.postalcity=t.PostalCity,n.postalpostcode=t.PostalPostcode,n.postalstate=t.PostalState,n.usi=t.USI,n.$root.$broadcast("detailsChangedEvent"),!0},function(){n.loading=!1;n.onSubmitFail()})};n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));n.getDetails()}}]);myRoyalDashModule=angular.module("corpApp.myRoyalDashModule",["ngRoute","ngSanitize"]);myRoyalDashModule.controller("myRoyalDashCtrl",["$scope","$controller","$window","MyRoyalDashService","forgotPasswordService",function(n,t,r,u,f){n.CollectData=function(){n.loading=!0;n.callWebApiService(u,{id:"user"}).then(function(t){if(n.loading=!1,n.HandleResponseErrors(t),t.NotMyRoyalDomain)r.location.reload();else if(n.userData=t,n.userData!=null&&n.userData.Enrolments!=null)for(i=0;i<n.userData.Enrolments.length;i++)(n.userData.Enrolments[i].EnrolmentStatus===0||n.userData.Enrolments[i].EnrolmentStatus===1)&&(n.hideMe=!0);return!0},function(){n.onSubmitFail()})};n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));n.userData={};n.hideMe=!1;n.CollectData();n.loading=!0;n.showQuantity=3;n.changeDetailsSubmitted=!1;n.changeDetailsListener=undefined;jQuery(function(){jQuery("#mr-mrforgot").on("click",function(){jQuery(".popmyroyalforgotbg").slideFadeToggle2();jQuery(".popmyroyalforgot").slideFadeToggle()})});jQuery(function(){jQuery(".popmyroyalforgotclose").on("click",function(){jQuery(".popmyroyalforgotbg").slideFadeToggle2();jQuery(".popmyroyalforgot").slideFadeToggle()})});jQuery(function(){jQuery("#mr-mrupdatedetails").on("click",function(){jQuery(".popmyroyalchangedetailsbg").slideFadeToggle2();jQuery(".popmyroyalchangedetails").slideFadeToggle();n.changeDetailsListener=n.$on("detailsChangedEvent",function(){n.changeDetailsSubmitted=!0;jQuery(".popmyroyalchangedetailsclose").click()})})});jQuery(function(){jQuery(".popmyroyalchangedetailsclose").on("click",function(){jQuery(".popmyroyalchangedetailsbg").slideFadeToggle2();jQuery(".popmyroyalchangedetails").slideFadeToggle();n.changeDetailsListener&&(n.changeDetailsListener(),n.changeDetailsSubmitted&&r.location.reload())})});jQuery.fn.slideFadeToggle=function(n,t){return this.animate({opacity:"toggle",height:"toggle"},"fast",n,t)};jQuery.fn.slideFadeToggle2=function(n,t){return this.animate({opacity:"toggle"},"fast",n,t)}};n.forgotPassword=function(){n.submitAttempted=!0;n.callWebApiService(f,{email:n.ForgotEmail}).then(function(t){if(n.HandleResponseErrors(t),t.Valid)n.EmailSuccess=!0;else return n.EmailSuccess=!0,!1;return!0},function(){n.onSubmitFail()})};n.showAllEnrolments=function(){n.userData!==null&&n.userData.Enrolments!==null&&(n.showQuantity=n.userData.Enrolments.length)}}]);myRoyalLoginModule=angular.module("corpApp.myRoyalLoginModule",["ngRoute","ngSanitize"]);myRoyalLoginModule.controller("myRoyalLoginCtrl",["$scope","$controller","$http",function(n,t,i){n.loading=!1;n.IncorrectPassword=!1;n.MRLoginFunc=function(t){var r,u;n.loading=!0;n.submitAttempted=!0;r=t==null?"/my-royal":t;n.MyRoyalLoginForm.$valid?(u={Email:n.Email,Password:n.Password},i.post("/api/MyRoyalLogin/",JSON.stringify(u),{headers:{"Content-Type":"application/json",Accept:"application/json"}}).then(function(i){return n.loading=!1,n.HandleResponseErrors(i),i.data.LoginSuccessful?(n.IncorrectPassword=!1,window.location.pathname==="/my-royal/my-royal-login"?window.location.replace(r):t!=null?window.location.replace(t):window.location.reload()):n.IncorrectPassword=!0,!0},function(){n.onSubmitFail()})):n.loading=!1};n.init=function(i){angular.extend(this,t("BaseCtrl",{$scope:n}));n.data={};i(function(){i("#MRLoginEmail").keypress(function(t){t.key==="Enter"&&n.MRLoginFunc()})});i(function(){i("#MRLoginPassword").keypress(function(t){t.key==="Enter"&&n.MRLoginFunc()})});i(function(){i("#mr-register").on("click",function(){i(".popbg").slideFadeToggle2();i(".pop").slideFadeToggle()})});i(function(){i(".mrregclose").on("click",function(){i(".popbg").slideFadeToggle2();i(".pop").slideFadeToggle()})});i(function(){i("#mr-forgot").on("click",function(){i(".popregbg").slideFadeToggle2();i(".popreg").slideFadeToggle()})});i(function(){i(".regforclose").on("click",function(){i(".popregbg").slideFadeToggle2();i(".popreg").slideFadeToggle()})});i.fn.slideFadeToggle=function(n,t){return this.animate({opacity:"toggle",height:"toggle"},"fast",n,t)};i.fn.slideFadeToggle2=function(n,t){return this.animate({opacity:"toggle"},"fast",n,t)}}(jQuery)}]);myRoyalLogoutModule=angular.module("corpApp.myRoyalLogoutModule",["ngRoute","ngSanitize"]);myRoyalLogoutModule.controller("MyRoyalLogoutCtrl",["$scope","$controller","MyRoyalLogoutService",function(n,t,i){n.Logout=function(t){n.callWebApiService(i,{Id:"Logout"}).then(function(i){return n.HandleResponseErrors(i),window.location.replace(t?t:"/"),!0},function(){n.onSubmitFail()})};angular.extend(this,t("BaseCtrl",{$scope:n}))}]);myRoyalMyAccountModule=angular.module("corpApp.myRoyalMyAccountModule",["ngRoute","ngSanitize"]);myRoyalMyAccountModule.controller("myRoyalMyAccountCtrl",["$scope","$controller","MyRoyalDashService",function(n,t,r){n.CollectData=function(){n.callWebApiService(r,{id:"user"}).then(function(t){for(n.HandleResponseErrors(t),n.userData=t,i=0;i<t.Enrolments.length;i++)t.Enrolments[i].EnrolmentStatus==2&&(n.hasCourses=!0);return!0},function(){n.onSubmitFail()})};n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));n.userData={};n.hasCourses=!1;n.CollectData()}}]);myRoyalRegisterModule=angular.module("corpApp.myRoyalRegisterModule",["ngRoute","ngSanitize"]);myRoyalRegisterModule.controller("myRoyalRegisterCtrl",["$scope","$controller","$http","CourseDetailFactory","ProductDetailFactory","MyRoyalRegisterService","RegisterFreeCoursesService","AddToCartService","sharedProperties",function(n,t,i,r,u,f,e,o,s){function h(n,t){n===1?(jQuery(".poplogbg").slideFadeToggle2(),jQuery(".poplog").slideFadeToggle1(),t&&(jQuery(".popbgRegister").is(":visible")&&jQuery(".popbgRegister").slideFadeToggle2(),jQuery(".popRegister").is(":visible")&&jQuery(".popRegister").slideFadeToggle1(),jQuery(".popcagbg").is(":visible")&&jQuery(".popcagbg").slideFadeToggle2(),jQuery(".popcag").is(":visible")&&jQuery(".popcag").slideFadeToggle1())):n===2?(jQuery(".popbgRegister").slideFadeToggle2(),jQuery(".popRegister").slideFadeToggle1(),t&&(jQuery(".poplogbg").is(":visible")&&jQuery(".poplogbg").slideFadeToggle2(),jQuery(".poplog").is(":visible")&&jQuery(".poplog").slideFadeToggle1(),jQuery(".popcagbg").is(":visible")&&jQuery(".popcagbg").slideFadeToggle2(),jQuery(".popcag").is(":visible")&&jQuery(".popcag").slideFadeToggle1())):n===3&&(jQuery(".popcagbg").slideFadeToggle2(),jQuery(".popcag").slideFadeToggle1(),t&&(jQuery(".poplogbg").is(":visible")&&jQuery(".poplogbg").slideFadeToggle2(),jQuery(".poplog").is(":visible")&&jQuery(".poplog").slideFadeToggle1(),jQuery(".popbgRegister").is(":visible")&&jQuery(".popbgRegister").slideFadeToggle2(),jQuery(".popRegister").is(":visible")&&jQuery(".popRegister").slideFadeToggle1()))}n.loading=!1;n.IncorrectPassword=!1;n.CourseDetail=r||{};n.ProductDetail=u||{};n.addCourse=function(){return!n.CourseDetail||!n.CourseDetail.CourseID?!0:(n.callWebApiService(e,{id:n.CourseDetail.CourseID,emailAddress:n.Email}).then(function(t){return(n.HandleResponseErrors(t),n.loading=!1,!t.result)?(n.userRegError=!0,t.error&&t.error.length&&(n.userRegErrorMsg=t.error),!0):(n.userRegError=!1,n.Success=!0,n.CourseDetail.CourseID="",setTimeout(function(){t.RedirectUrl&&t.RedirectUrl!==""?window.location.replace(t.RedirectUrl):window.location.href="/view-cart"},9e3),!0)},function(){n.onSubmitFail()}),!0)};n.addProduct=function(){return!n.ProductDetail||!n.ProductDetail.CourseName?!0:(n.callWebApiService(o,{ContextUrl:window.location.pathname,VariantSku:n.ProductDetail.VariantSku,Quantity:n.ProductDetail.Quantity,EmailAddress:n.Email}).then(function(t){return n.HandleResponseErrors(t),s.initTooltip("occurrenceId0"),s.setCartCount(t.NumberOfItems),h(3,!1),window.location.href="/view-cart",!0},function(){n.onSubmitFail()}),!0)};n.Register=function(){if(n.loading=!0,n.submitAttempted=!0,!n.MyRoyalRegisterForm.$valid){n.loading=!1;return}n.callWebApiService(f,{FirstName:n.PopFirstName,Surname:n.PopSurname,Email:n.PopEmail,DOB:moment(n.PopDOB,n.dobFormat).toDate(),ContactNumber:n.PopContactNumber,PostalAddress:n.PopAddress,PostalCity:n.PopCity,PostalPostcode:n.PopPostcode,PostalState:n.PopState,USI:n.PopUSI,CourseId:n.CourseDetail.CourseID}).then(function(t){return n.loading=!1,n.HandleResponseErrors(t),n.AlreadyRegistered=t.AlreadyRegistered,n.Success=t.RegisterSuccessful,!0},function(){n.onSubmitFail()})};n.MRLoginACFunc=function(){if(n.loading=!0,n.submitAttempted=!0,!n.MyRoyalLoginForm.$valid){n.loading=!1;return}var t={Email:n.Email,Password:n.Password};i.post("/api/MyRoyalLogin/",JSON.stringify(t),{headers:{"Content-Type":"application/json",Accept:"application/json"}}).then(function(t){return(n.HandleResponseErrors(t),!t.data.LoginSuccessful)?(n.IncorrectPassword=!0,n.loading=!1,!0):(n.CourseDetail&&n.CourseDetail.CourseID?n.addCourse():n.ProductDetail&&(n.ProductDetail.ProductSku||n.ProductDetail.VariantSku)&&n.addProduct(),!0)},function(){n.onSubmitFail()})};n.MRContinueAsGuestFunc=function(){if(!n.MyRoyalContinueAsGuestForm.$valid){n.loading=!1;return}n.CourseDetail&&n.CourseDetail.CourseID?n.addCourse():n.ProductDetail&&n.ProductDetail.CourseName&&n.addProduct()};n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));n.data={};n.dobFormat="DD/MM/YYYY";jQuery.fn.slideFadeToggle1=function(n,t){return this.animate({opacity:"toggle",height:"toggle"},"fast",n,t)};jQuery.fn.slideFadeToggle2=function(n,t){return this.animate({opacity:"toggle"},"fast",n,t)};jQuery(function(){jQuery("#MRRegisterEmail").keypress(function(t){t.key==="Enter"&&n.Register()});jQuery("#MRRegisterFirstname").keypress(function(t){t.key==="Enter"&&n.Register()});jQuery("#MRRegisterLastName").keypress(function(t){t.key==="Enter"&&n.Register()});jQuery("#MRLoginEmail").keypress(function(t){t.key==="Enter"&&n.MRLoginACFunc()});jQuery("#MRLoginPassword").keypress(function(t){t.key==="Enter"&&n.MRLoginACFunc()});jQuery(".mr-forgot").on("click",function(){jQuery(".popregbg").slideFadeToggle2();jQuery(".popreg").slideFadeToggle1()});jQuery(".regforclose").on("click",function(){jQuery(".popregbg").slideFadeToggle2();jQuery(".popreg").slideFadeToggle1()});jQuery(".mr-freeregister").on("click",function(){h(2,!0)});jQuery(".mr-freelogin").on("click",function(){h(1,!0)});jQuery(".mr-freecontinueasguest").on("click",function(){h(3,!0)});jQuery(".registerFreeClose").on("click",function(){h(2,!1)});jQuery(".mrlogclose").on("click",function(){h(1,!1)});jQuery(".mrcagclose").on("click",function(){h(3,!1)});jQuery(".mr-freeforgot").on("click",function(){jQuery(".poplogbg").slideFadeToggle2();jQuery(".poplog").slideFadeToggle1();jQuery(".popcagbg").slideFadeToggle2();jQuery(".popcag").slideFadeToggle2();jQuery(".popbgForgottenFree").slideFadeToggle2();jQuery(".popForgottenFree").slideFadeToggle1()});jQuery(".popForgottenFreeClose").on("click",function(){jQuery(".poplogbg").slideFadeToggle2();jQuery(".poplog").slideFadeToggle1();jQuery(".popcagbg").slideFadeToggle2();jQuery(".popcag").slideFadeToggle2();jQuery(".popbgForgottenFree").slideFadeToggle2();jQuery(".popForgottenFree").slideFadeToggle1()})})}}]);UnsubscribeModule=angular.module("corpApp.UnsubscribeModule",["ngRoute","ngSanitize"]);UnsubscribeModule.controller("UnsubscribeCtrl",["$scope","$controller","$filter","$window","$timeout","UnsubscribeListService","UnsubscribeService",function(n,t,i,r,u,f,e){n.optOutLists=[];n.isSuccess=!1;n.contactId="";n.handleWsError=function(t){t.status===401?n.pageErrors={unauthorised:!0}:n.onSubmitFail()};n.getOptOutLists=function(t){n.pageErrors={};n.callWebApiService(f,{contactId:n.contactId,ds:t}).then(function(t){return n.HandleResponseErrors(t),n.optOutLists=t.MailingListsToOptOutFrom,!0},function(t){n.handleWsError(t)})};n.unsubscribe=function(){n.pageErrors={};n.isSuccess=!1;var t=$.map($.grep(n.optOutLists,function(n){return n.IsMemberOfOptOutList===!0}),function(n){return n.ListId});n.callWebApiService(e,{contactId:n.contactId,ids:t}).then(function(t){return n.HandleResponseErrors(t),n.isSuccess=!0,n.optOutLists=$.grep(n.optOutLists,function(n){return n.IsMemberOfOptOutList===!1}),!0},function(t){n.handleWsError(t)})};n.init=function(i,r){angular.extend(this,t("BaseCtrl",{$scope:n}));n.contactId=r;n.getOptOutLists(i)}}]);contactSwimSchoolModule=angular.module("corpApp.contactSwimSchoolModule",["ngRoute","ngSanitize","ui.bootstrap"]);contactSwimSchoolModule.controller("ContactSwimSchoolCtrl",["$scope","$controller","$http","filterFilter","ContactSwimSchoolService",function(n,t,i,r,u){n.populateControlData=function(t){n.loading=!0;n.callWebApiService(u,{id:t}).then(function(t){return n.loading=!1,t.HasResponseErrors?(n.loadErrorMessage="There was an error loading the details of this swimming school.",n.HandleResponseErrors(t)):(n.Name=t.Name,n.ProgramsOffered=t.ProgramsOffered),!0},function(){n.onSubmitFail()})};n.init=function(i){angular.extend(this,t("BaseCtrl",{$scope:n}));n.submitSuccess=!1;n.formData={schoolId:i,selectedPrograms:[]};n.populateControlData(i)};var f=function(){var i=r(n.ProgramsOffered,{selected:!0}),t=[];return _.each(i,function(n){t.push(n.Key)}),t};n.submitDetails=function(t){if(t.stopPropagation(),t.preventDefault(),n.loading=!0,n.pageErrors={},n.contactusForm.$valid){n.formData.selectedPrograms=f().join(";");var r=n.formData;i.post("/api/ContactSwimSchool/",JSON.stringify(r),{headers:{"Content-Type":"application/json",Accept:"application/json"}}).then(function(t){return n.HandleResponseErrors(t),t.data.HasResponseErrors===!0?(n.responseError=!0,n.pageErrors={formInvalid:!0}):n.submitSuccess=!0,!0},function(t){return(n.loading=!1,t.status===400&&t.data.ModelState["request.Email"])?(n.contactusForm.email.$error.email=!0,!1):(n.onSubmitFail(),!1)})}}}]);locationMapPageModule=angular.module("corpApp.locationMapPageModule",["ngRoute","ngSanitize","ui.bootstrap"]);locationMapPageModule.controller("LocationMapPageCtrl",["$scope","$controller","LocationMapPageService","$http","$sce","$filter","$compile","$timeout","$window",function(n,t,i,r,u,f,e,o,s){function ft(){var n=$(".loc_map-object");n.hasClass("show-single")?loadSingle():ct()}function p(n,t){document.cookie=n+"="+t+";;path=/"}function tt(n){for(var t,r=n+"=",u=document.cookie.split(";"),i=0;i<u.length;i++){for(t=u[i];t.charAt(0)==" ";)t=t.substring(1);if(t.indexOf(r)==0)return t.substring(r.length,t.length)}return""}function w(){var i=$(".loc_map-object"),r=i.attr("data-map-current"),t=r.split(",").map(Number),n={};return h.latitude!=null?h:(n.latitude=tt("latitude"),n.longitude=tt("longitude"),n.latitude&&n.latitude!="0")?n:(y&&a?(n.latitude=a.latitude,n.longitude=a.longitude):(n.latitude=t[0],n.longitude=t[1]),n)}function et(n,t,i,r){var u=new google.maps.LatLng(n,t),f=new google.maps.LatLng(i,r),e=google.maps.geometry.spherical.computeDistanceBetween(u,f)/1e3;return parseFloat(e.toFixed(1))}function b(){return ut()}function ot(n){var i=w(),t,r;if(i.latitude&&i.latitude!="0")for(t=0;t<n.length;t++)r=et(i.latitude,i.longitude,n[t].Latitude,n[t].Longitude),n[t].Distance=r;return n=f("orderBy")(n,"Distance"),{Results:n}}function it(n){if(n&&n.length===4)return/^\d{4}$/.test(n)}function rt(n){var u=new google.maps.Geocoder,t,r;if(it(n))t={componentRestrictions:{country:"AU",postalCode:n}};else{var f=$(".loc_map-object"),i=f.attr("data-country");i||(i="Australia");r=n+", "+i;t={address:r}}u.geocode(t,function(n,t){t==google.maps.GeocoderStatus.OK&&(h.latitude=n[0].geometry.location.lat(),h.longitude=n[0].geometry.location.lng(),b())})}function k(){var t=n.searchValue;p("query",t);t!=""&&t!=null?rt(t):(h={},b())}function st(t){var a=$(".loc_map-object"),y=d,r=w(),h=!1,f,u,i;if((r.latitude==null||r.latitude==""||r.latitude=="0")&&(r.latitude="-25.6242204",r.longitude="127.4229294",h=!0),f={zoom:y,center:new google.maps.LatLng(r.latitude,r.longitude),styles:nt.styles},l&&(f.mapTypeControl=!1),u=new google.maps.Map(a[0],f),h){var p=new google.maps.LatLng("-44.104601","112.546716"),b=new google.maps.LatLng("-9.559114","154.866052"),e=new google.maps.LatLngBounds;e.extend(p);e.extend(b);u.fitBounds(e)}if(console.log("map init"),t){for(i=0;i<t.length;i++)g[i]=ht(i,t[i]),v[i]=new google.maps.Marker({position:new google.maps.LatLng(t[i].Latitude,t[i].Longitude),infowindow:new google.maps.InfoWindow({content:g[i],maxWidth:l?300:500}),map:u,icon:{url:"/Content/RLSSWA/Images/map-marker.png",labelOrigin:new google.maps.Point(12,15)},label:{text:(i+1).toString(),fontSize:"12px",fontWeight:"bold"}}),google.maps.event.addListener(v[i],"click",function(){c&&c.close();c=this.infowindow;var t=$(c.content),n=c.getContent();c.setContent(n);this.infowindow.open(u,this)});o(function(){var t=$(".loc-result-info");if(t)if(l)t.on("click",function(){var i=$(this).data("markeridx"),t=n.locations[i].MoreInfoPageUrl;t&&s.open(t,"_blank")});else t.on("click",function(){var n=$(this).data("markeridx");google.maps.event.trigger(v[n],"click")})},100)}}function ht(n,t){var r=t.ShortTitle||t.LocationTitle,i='<h3 class="map-info-header bg-red"><span class="map-info-index">'+(n+1).toString()+"<\/span>"+r+"<\/h3>";t.HomePageUrl&&(i='<a title="Home Page" href="'+t.HomePageUrl+'" target="_blank">'+i+"<\/a>");var u=t.MoreInfoPageUrl?'<a class="bg-red col-md-12 col-xs-12" href="'+t.MoreInfoPageUrl+'" target="_blank">More Information<\/a>':'<span class="bg-red col-md-12 col-xs-12">More Information<\/span>',f=t.LogoUrl?'<div class="map-info-logo"><img alt="Logo" src="'+t.LogoUrl+'"><\/div>':"";return'<div class="infowindow-content">'+i+'<div class="map-info-body"><input id="info-idx" type="hidden" value="'+n+'"><p>'+(t.Address||"")+" <br>"+(t.Suburb||"")+" <br>"+(t.State||"")+" "+(t.PostCode>0?t.PostCode:"")+" <br>"+(t.Phone||"")+'<\/p><p><a href="https://www.google.com/maps?saddr=Current+Location&daddr=('+t.Latitude+","+t.Longitude+')" target="_blank" class="get-direction">Get directions&nbsp;<span class="fa fa-external-link"><\/span><\/a><\/p>'+f+'<\/div><div class="map-info-footer">'+u+"<\/div><\/div>"}function ct(){var t=n.searchValue;t!=""&&t!=null?rt(t):(h={},b())}var h={},d=4,v=[],g=[],c=!1,l=!1,a,nt,y,ut;/Mobi|Android/i.test(navigator.userAgent)&&(l=!0);n.locations=[];n.searchValue="";n.noResults=!1;n.loading=!1;n.populateControlData=function(){n.ShowDirectoryMap=!1;ft()};n.init=function(i){angular.extend(this,t("BaseCtrl",{$scope:n}));n.ItemId=i;n.populateControlData(i)};nt={styles:[{featureType:"landscape",elementType:"geometry.fill",stylers:[{color:"#b5dbdb"}]},{featureType:"landscape.man_made",elementType:"geometry.fill",stylers:[{color:"#fff5ea"}]},{featureType:"landscape.natural",elementType:"geometry.fill",stylers:[{color:"#ffe2d5"}]},{featureType:"poi",elementType:"geometry.fill",stylers:[{color:"#ffc9ae"}]},{featureType:"poi.park",elementType:"geometry.fill",stylers:[{color:"#c8dfd9"}]},{featureType:"road",elementType:"geometry.fill",stylers:[{color:"#ffc977"}]},{featureType:"road.local",elementType:"geometry.fill",stylers:[{color:"#ffffff"}]}]};y={data:{},get:function(n){var t=this,i=function(i){var r=i.coords;t.data.latitude=r.latitude;t.data.longitude=r.longitude;n(t.data)},r=function(n){console.warn("ERROR("+n.code+"): "+n.message)};navigator.geolocation.getCurrentPosition(i,r,{enableHighAccuracy:!0,timeout:5e3,maximumAge:0})}};y.get(function(n){a=n;p("latitude",n.latitude);p("longitude",n.longitude)});n.startSearch=function(n){return n.preventDefault(),k(),!1};ut=_.debounce(function(){var t=w(),r={ItemId:n.ItemId,Latitude:t.latitude,Longitude:t.longitude};n.callWebApiService(i,r).then(function(t){return n.ShowDirectoryMap=!t.HasResponseErrors,t.HasResponseErrors?n.HandleResponseErrors(t):(n.locations=ot(t.Locations).Results,d=l?11:12,st(n.locations)),!0},function(){n.onSubmitFail()})},500);n.enterKey=function(){k()};n.checkInput=function(){it(n.searchValue)&&k()}}]);loginModule.controller("SwimSchoolLoginCtrl",["$scope","$controller","SwimSchoolAdminLoginService","SwimSchoolAdminLogoutService",function(n,t,i){var r="/professional-services/endorsed-swim-schools/swim-school-login/swim-school-details";n.init=function(i){angular.extend(this,t("BaseCtrl",{$scope:n}));n.currentLoginDomain=i;n.isSignedInToDiffDomain=i.length>0;$(function(){$("#ss-forgot").on("click",function(){$(".popregbg").slideFadeToggle2();$(".popreg").slideFadeToggle()})});$(function(){$(".regforclose").on("click",function(){$(".popregbg").slideFadeToggle2();$(".popreg").slideFadeToggle()})});$.fn.slideFadeToggle=function(n,t){return this.animate({opacity:"toggle",height:"toggle"},"fast",n,t)};$.fn.slideFadeToggle2=function(n,t){return this.animate({opacity:"toggle"},"fast",n,t)}};n.handleWsError=function(t){t.status===401?n.IncorrectPassword=!0:n.onSubmitFail()};n.Login=function(){n.submitAttempted=!0;n.LoginForm.$valid&&n.callWebApiService(i,{Email:n.Email,Password:n.Password}).then(function(t){return n.HandleResponseErrors(t),n.isLoggedIn=!0,window.location.replace(r),!0},function(t){n.handleWsError(t)})}}]);swimSchoolPageModule=angular.module("corpApp.swimSchoolPageModule",["ngRoute","ngSanitize"]);swimSchoolPageModule.controller("SwimSchoolPageCtrl",["$scope","$controller","$http","$sce","filterFilter","SwimSchoolPageService",function(n,t,i,r,u,f){n.populateControlData=function(t){n.loading=!0;n.callWebApiService(f,{id:t}).then(function(t){if(n.loading=!1,t.HasResponseErrors)n.loadErrorMessage="There was an error loading the details of this swimming school.",n.HandleResponseErrors(t);else{n.school=t.School;var i="https://www.google.com/maps/embed/v1/place?q="+n.school.Latitude+","+n.school.Longitude+"&key=AIzaSyAFw2BJPtobHrSKJASSh9jBT0TPXUDarGw";n.googleMapUrl=r.trustAsResourceUrl(i)}return!0},function(){n.onSubmitFail()})};n.init=function(i){angular.extend(this,t("BaseCtrl",{$scope:n}));n.school={};n.populateControlData(i);$(".page-content .page-title:first").css("display","none")};n.showLogo=function(){return n.school.LogoUrl};n.showAbout=function(){return n.school.About};n.showLocation=function(){var t=n.school;return t.Address||t.Suburb||t.State||t.PostCode||t.Country||t.IsMobile};n.showContact=function(){var t=n.school;return t.CoordinatorName||t.Phone||t.Fax||t.Email||t.HomePageUrl};n.showPrograms=function(){var t=n.school;return t.ProgramsOffered&&t.ProgramsOffered.length>0}}]);swimSchoolUpdateModule=angular.module("corpApp.swimSchoolUpdateModule",["ngRoute","ngSanitize","ui.bootstrap"]);swimSchoolUpdateModule.controller("SwimSchoolUpdateCtrl",["$scope","$controller","$http","$window","filterFilter","SwimSchoolUpdateService",function(n,t,i,r,u,f){n.populateControlData=function(t){n.loading=!0;n.callWebApiService(f,{id:t}).then(function(t){return n.loading=!1,t.HasResponseErrors?(n.loadErrorMessage="There was an error loading the details of this swimming school.",n.HandleResponseErrors(t)):(angular.extend(n,t),_.each(n.School.ProgramsOffered,function(t){var i=_.find(n.Programs,function(n){return n.Key===t});i&&(i.selected=!0)})),!0},function(t){n.handleWsError(t)})};n.handleWsError=function(t){t.status===401?n.pageErrors={unauthorised:!0}:n.onSubmitFail()};n.init=function(i,r){angular.extend(this,t("BaseCtrl",{$scope:n}));i?r&&(n.loadErrorMessage="Your account has been disabled. Please contact your Administrator."):n.loadErrorMessage="You are not assigned to this Swim School. Please contact your administrator.";n.itemId=i;n.submitSuccess=!1;n.populateControlData(i);$(".page-content .page-title:first").css("display","none");$(function(){$("#ss-resetpwd").on("click",function(){$(".popregbg").slideFadeToggle2();$(".popreg").slideFadeToggle()})});$(function(){$(".regforclose").on("click",function(){$(".popregbg").slideFadeToggle2();$(".popreg").slideFadeToggle()})});$.fn.slideFadeToggle=function(n,t){return this.animate({opacity:"toggle",height:"toggle"},"fast",n,t)};$.fn.slideFadeToggle2=function(n,t){return this.animate({opacity:"toggle"},"fast",n,t)}};n.resetForm=function(){n.submitSuccess=!1};var e=function(){var i=u(n.Programs,{selected:!0}),t=[];return _.each(i,function(n){t.push(n.Key)}),t};n.updateDetails=function(t){if(t.stopPropagation(),t.preventDefault(),n.loading=!0,n.pageErrors={},n.schoolDetailsForm.$valid){n.School.ProgramsOffered=e();var u=n.School;i.post("/api/SwimSchoolUpdate/",JSON.stringify(u),{headers:{"Content-Type":"application/json",Accept:"application/json"}}).then(function(t){return n.HandleResponseErrors(t),t.data.HasResponseErrors?t.data.IsSchoolDisabled?n.loadErrorMessage="Access to this school details has been disabled. Please contact your Administrator.":(n.responseError=!0,n.pageErrors={formInvalid:!0}):n.submitSuccess=!0,r.scrollTo(0,0),!0},function(t){if(n.loading=!1,t.status===400){if(t.data.ModelState["request.Email"])return n.schoolDetailsForm.email.$error.email=!0,n.pageErrors={formInvalid:!0},!1}else n.handleWsError(t);return!1})}}}]);corpServices=angular.module("corpApp.corpServices",["ngResource"]),function(){var n="/api/",i=function(n){var t=jsCommon.getUrlParameter("sc_mode");return t!==!1&&(n+="?sc_mode="+encodeURIComponent(t)),n},r=function(n){return{get:{method:"GET",headers:{"X-XSRF-Token":angular.element('input[name="__RequestVerificationToken"]').attr("value")},cache:n},post:{method:"POST",headers:{"X-XSRF-Token":angular.element('input[name="__RequestVerificationToken"]').attr("value")}}}},u=function(n){return{get:{method:"GET",cache:n},post:{method:"POST"}}},t=function(n,t,f,e){return["$resource",function(o){return e?o(i(n),t,r(f)):o(i(n),t,u(f))}]};corpServices.factory("NewsService",t(n+"News/:id",{id:"@id"},!0,!1));corpServices.factory("RelatedNewsService",t(n+"RelatedNews/:id",{id:"@id"},!0,!1));corpServices.factory("NavigationService",t(n+"Navigation/:id",{id:"@id"},!0,!1));corpServices.factory("AvailableCoursesService",t(n+"AvailableCourses/:id",{id:"@id"},!0,!1));corpServices.factory("ProgramNavigationService",t(n+"ProgramNavigation/:id",{id:"@id"},!0,!1));corpServices.factory("LocationMapPageService",t(n+"LocationMapPage/:id",{id:"@id"},!1,!1));corpServices.factory("ContactSwimSchoolService",t(n+"ContactSwimSchool/:id",{id:"@id"},!1,!1));corpServices.factory("SwimSchoolPageService",t(n+"SwimSchoolPage/:id",{id:"@id"},!1,!1));corpServices.factory("SwimSchoolAdminLoginService",t(n+"SwimSchoolAdmin/Login/:id",{id:"@id"},!1,!1));corpServices.factory("SwimSchoolAdminLogoutService",t(n+"SwimSchoolAdmin/Logout/:id",{id:"@id"},!1,!1));corpServices.factory("SwimSchoolUpdateService",t(n+"SwimSchoolUpdate/:id",{id:"@id"},!1,!1));corpServices.factory("HeroService",t(n+"Hero/:id",{id:"@id"},!0,!1));corpServices.factory("SurveyMonkeyWidgetService",t(n+"SurveyMonkeyWidget/:id",{id:"@id"},!0,!1));corpServices.factory("LinksService",t(n+"Links/:id",{id:"@id"},!0,!1));corpServices.factory("DocumentListService",t(n+"DocumentList/:id",{id:"@id"},!0,!1));corpServices.factory("BreadcrumbService",t(n+"Breadcrumb/:id",{id:"@id"},!0,!1));corpServices.factory("PaymentService",t(n+"Payment/:id",{id:"@id"},!1,!1));corpServices.factory("SavePaymentTokenService",t(n+"SavePaymentToken/:id",{id:"@id"},!1,!1));corpServices.factory("ShopCategoriesService",t(n+"ShopCategories/:id",{id:"@id"},!0,!1));corpServices.factory("ProductsByCategoryService",t(n+"ProductsByCategory/:id",{id:"@id"},!0,!1));corpServices.factory("ProductByIDService",t(n+"ProductByID/:id",{id:"@id"},!0,!1));corpServices.factory("AddToCartService",t(n+"AddToCart/:id",{id:"@id"},!1,!1));corpServices.factory("AddPromoCodeService",t(n+"AddPromoCode/:id",{id:"@id"},!1,!1));corpServices.factory("GetCartService",t(n+"GetCart/:id",{id:"@id"},!1,!1));corpServices.factory("GetAbandonedCartService",t(n+"GetAbandonedCart/:id",{id:"@id"},!1,!1));corpServices.factory("UpdateCartService",t(n+"UpdateCart/:id",{id:"@id"},!1,!1));corpServices.factory("GetOrderCompletedService",t(n+"GetOrderCompleted/:id",{id:"@id"},!1,!1));corpServices.factory("LogoutService",t(n+"Logout/:id",{id:"@id"},!1,!1));corpServices.factory("LoginService",t(n+"Login/:id",{id:"@id"},!1,!1));corpServices.factory("IsLoggedInService",t(n+"IsLoggedIn/:id",{id:"@id"},!1,!1));corpServices.factory("RegisterService",t(n+"Register/:id",{id:"@id"},!1,!1));corpServices.factory("FooterLinksService",t(n+"FooterLinks/:id",{id:"@id"},!0,!1));corpServices.factory("LandingService",t(n+"Landing/:id",{id:"@id"},!0,!1));corpServices.factory("VacancyService",t(n+"Vacancy/:id",{id:"@id"},!1,!1));corpServices.factory("ShippingService",t(n+"Shipping/:id",{id:"@id"},!1,!1));corpServices.factory("SuburbQueryService",t(n+"Address/Suburbs/:id",{id:"@id"},!1,!1));corpServices.factory("ShopBreadcrumbService",t(n+"ShopBreadcrumb/:id",{id:"@id"},!0,!1));corpServices.factory("ShopNavigationService",t(n+"ShopNavigation/:id",{id:"@id"},!0,!1));corpServices.factory("CheckResetService",t(n+"CheckReset/:id",{id:"@id"},!1,!1));corpServices.factory("ResetService",t(n+"Reset/:id",{id:"@id"},!1,!1));corpServices.factory("RequestResetService",t(n+"RequestReset/:id",{id:"@id"},!1,!1));corpServices.factory("JobsConfigService",t(n+"JobsConfig/:id",{id:"@id"},!1,!1));corpServices.factory("JobsBoardDetailService",t(n+"JobsBoardDetail/:id",{id:"@id"},!1,!1));corpServices.factory("JobsCUDService",t(n+"JobsCUD/:id",{id:"@id"},!1,!1));corpServices.factory("JobsService",t(n+"Jobs/:id",{id:"@id"},!1,!1));corpServices.factory("IsEmployerLoggedInService",t(n+"IsEmployerLoggedIn/:id",{id:"@id"},!1,!1));corpServices.factory("IncidentsListService",t(n+"IncidentsReport/:id",{id:"@id"},!0,!1));corpServices.factory("FundraisingFooterLinksService",t(n+"FundraisingFooterLinks/:id",{id:"@id"},!0,!1));corpServices.factory("FundraisingSocialMediaLinksService",t(n+"FundraisingSocialMediaLinks/:id",{id:"@id"},!0,!1));corpServices.factory("FundraisingBannerService",t(n+"FundraisingBanner/:id",{id:"@id"},!0,!1));corpServices.factory("FundraisingFeaturedImageService",t(n+"FundraisingFeaturedImage/:id",{id:"@id"},!0,!1));corpServices.factory("FundraisingProgressService",t(n+"FundraisingProgress/:id",{id:"@id",itemId:"@itemId"},!0,!1));corpServices.factory("RaffleInfoService",t(n+"RaffleInfo/:id",{id:"@id"},!0,!1));corpServices.factory("RaffleQuickSelectionsService",t(n+"RaffleQuickSelections/:id",{id:"@id"},!0,!1));corpServices.factory("FundraisingTestimonialService",t(n+"FundraisingTestimonial/:id",{id:"@id"},!0,!1));corpServices.factory("FundraisingCallToActionService",t(n+"FundraisingCallToAction/:id",{id:"@id"},!0,!1));corpServices.factory("FundraisingModularContentService",t(n+"FundraisingModularContent/:id",{id:"@id"},!0,!1));corpServices.factory("StaffManualRaffleEntryService",t(n+"StaffManualRaffleEntry/:id",{id:"@id"},!0,!1));corpServices.factory("IncidentsListService",t(n+"IncidentsReport/:id",{id:"@id"},!0,!1));corpServices.factory("XDbPageEventsService",["$resource",function(t){return t(i(n+"XDbPageEvents/:id/:goalId/:sku"),{id:"@id",goalId:"@goalId",sku:"@sku"},{create:{method:"POST"}})}]);corpServices.factory("MyRoyalLogoutService",t(n+"Logout/:id",{id:"@id"},!1,!1));corpServices.factory("MyRoyalDashService",t(n+"MyRoyalDash/:id",{id:"@id"},!1,!1));corpServices.factory("MyRoyalIsLoggedInService",t(n+"IsLoggedIn/:id",{id:"@id"},!1,!1));corpServices.factory("MyRoyalRegisterService",t(n+"MyRoyalRegister/:id",{FirstName:"@FirstName",Surname:"@Surname",Email:"@Email",DOB:"@DOB",ContactNumber:"@ContactNumber",PostalAddress:"@PostalAddress",PostalCity:"@PostalCity",PostalPostcode:"@PostalPostcode",PostalState:"@PostalState",USI:"@USI",CourseId:"@CourseId"},!1,!1));corpServices.factory("RegisterFreeCoursesService",t(n+"RegisterFreeCourses/:id",{id:"@id"},!1,!1));corpServices.factory("forgotPasswordService",t(n+"ForgotPassword/:id",{email:"@email",domain:"@domain"},!1,!1));corpServices.factory("PasswordResetQueryCheckService",t(n+"PasswordResetQueryCheck/:id",{EncryptedData:"@EncryptedData",IV:"@IV"},!1,!1));corpServices.factory("FundraisingAdminLoginService",t(n+"FundraisingAdmin/Login/:id",{id:"@id"},!1,!1));corpServices.factory("FundraisingAdminLogoutService",t(n+"FundraisingAdmin/Logout/:id",{id:"@id"},!1,!1));corpServices.factory("FundraisingAdminGetUsersService",t(n+"FundraisingAdmin/GetUsers/:id",{id:"@id"},!1,!1));corpServices.factory("FundraisingAdminAddUserService",t(n+"FundraisingAdmin/AddUser/:id",{id:"@id"},!1,!1));corpServices.factory("FundraisingAdminEditUserService",t(n+"FundraisingAdmin/EditUser/:id",{id:"@id"},!1,!1));corpServices.factory("FundraisingAdminRemoveUserService",t(n+"FundraisingAdmin/RemoveUser/:id",{id:"@id"},!1,!1));corpServices.factory("AdminRegisterCourseService",t(n+"AdminRegisterCourse/:id",{id:"@id"},!1,!1));corpServices.factory("MyRoyalGetDetailsService",t(n+"MyRoyalChangeDetails/GetDetails/:id",{id:"@id"},!1,!1));corpServices.factory("MyRoyalChangeDetailsService",t(n+"MyRoyalChangeDetails/ChangeDetails/:id",{id:"@id"},!1,!1));corpServices.factory("UnsubscribeListService",t(n+"EXM/GetOptOutLists/:id",{id:"@id"},!1,!1));corpServices.factory("UnsubscribeService",t(n+"EXM/Unsubscribe/:id",{id:"@id"},!1,!1));corpServices.factory("GeomantGetMemberDetailsService",t(n+"Geomant/GetMemberDetails/:id",{id:"@id"},!0,!1))}();angular.module("corpApp.creditCardService",["ngResource"]).factory("creditCardService",function(){return{validateCardType:function(n){var t=/^5[1-5]/.test(n)?"mastercard":/^4/.test(n)?"visa":/^3[47]/.test(n)?"amex":undefined,i=16;return t==="amex"&&(i=15),typeof t=="undefined"?!1:n.length==i?!0:!1},validateLuhn:function(n){for(var e,t,r=n.length,u=n.split("").map(Number),f=u[r-1],o=(r-1)%2,i=r-1;i>0;i--)e=i-1,t=u[e],i%2==o&&(t*=2,t>9&&(t-=9)),f+=t;return 0==f%10}}});spinnerModule=angular.module("corpApp.spinnerService",["ngResource"]),function(){spinnerModule.factory("spinnerService",function(){var n={};return{_register:function(t){if(!t.hasOwnProperty("name"))throw new Error("Spinner must specify a name when registering with the spinner service.");if(n.hasOwnProperty(t.name))throw new Error("A spinner with the name '"+t.name+"' has already been registered.");n[t.name]=t},_unregister:function(t){n.hasOwnProperty(t)&&delete n[t]},_unregisterGroup:function(t){for(var i in n)n[i].group===t&&delete n[i]},_unregisterAll:function(){for(var t in n)delete n[t]},show:function(t){var i=n[t];if(!i)throw new Error("No spinner named '"+t+"' is registered.");i.show()},hide:function(t){var i=n[t];if(!i)throw new Error("No spinner named '"+t+"' is registered.");i.hide()},showGroup:function(t){var r=!1,u,i;for(u in n)i=n[u],i.group===t&&(i.show(),r=!0);if(!r)throw new Error("No spinners found with group '"+t+"'.");},hideGroup:function(t){var r=!1,u,i;for(u in n)i=n[u],i.group===t&&(i.hide(),r=!0);if(!r)throw new Error("No spinners found with group '"+t+"'.");},showAll:function(){for(var t in n)n[t].show()},hideAll:function(){for(var t in n)n[t].hide()}}})}();StaffPortalBatchEnrolmentModule=angular.module("corpApp.StaffPortalBatchEnrolmentModule",["ngMaterial","ngRoute","ngSanitize","ngCookies","md.data.table"]);StaffPortalBatchEnrolmentModule.controller("StaffPortalBatchEnrolmentCtrl",["$scope","$controller","$q","myRoyalService",function(n,t,i,r){function f(){var t=[];return angular.forEach(n.enrolments,function(i){i.errorMessage=null;i.status=n.statusActive;t.push(r.GetMyRoyalAccount(i.email).then(function(n){n!==undefined&&n!==null&&(i.myRoyalAccount=n.MyRoyalUser,i.myRoyalAccountExists=n.AccountExists)},function(t){i.errorMessage="Error: "+t.data.ExceptionMessage;i.status=n.statusError;console.error("Unsuccessful attempt to retrieve My Royal account data");console.error(t)}))}),t}function e(){var t=[];return angular.forEach(n.enrolments,function(i){i.errorMessage=null;i.status=n.statusActive;var u={Username:i.email,Firstname:i.firstName,Surname:i.lastName,Email:i.email,DateOfBirth:i.dob,ContactNumber:i.contactNumber,Address:i.address,Suburb:i.suburb,Postcode:i.postcode,State:i.state,Usi:i.usi};i.myRoyalAccountExists?t.push(r.UpdateMyRoyalAccountDetails(u).then(function(n){n!==undefined&&n!==null&&(i.myRoyalAccount=n.MyRoyalUser,i.myRoyalAccountExists=n.Success)},function(t){i.errorMessage="Error: "+t.data.ExceptionMessage;i.status=n.statusError;console.error("Unsuccessful attempt to update existing My Royal account details");console.error(t)}).finally(function(){})):t.push(r.CreateMyRoyalAccount(u).then(function(n){n!==undefined&&n!==null&&(i.myRoyalAccount=n.MyRoyalUser,i.myRoyalAccountExists=n.Success)},function(t){i.errorMessage="Error: "+t.data.ExceptionMessage;i.status=n.statusError;console.error("Unsuccessful attempt to create My Royal account");console.error(t)}).finally(function(){}))}),t}function o(t){var i=[];return angular.forEach(n.enrolments,function(u){u.enrolmentSuccess=null;u.vettrakWebEnrolmentId=null;u.moodleCourseId=null;u.errorMessage=null;u.status=n.statusActive;u.myRoyalAccountExists&&i.push(r.EnrolMyRoyalUserInOccurrence(u.email,t).then(function(t){t!==undefined&&t!==null?(u.enrolmentSuccess=t.Success,u.vettrakWebEnrolmentId=t.WebEnrolmentId,u.moodleCourseId=t.MoodleCourseId,u.status=n.statusDone):u.status=n.statusError},function(t){u.status=n.statusError;u.errorMessage="Error: "+t.data.ExceptionMessage;console.error("Unsuccessful attempt to enrol user in course");console.error(t)}).finally(function(){}))}),i}n.uploadFile=null;n.showTable=!1;n.enrolments=[];n.statusLoaded="Loaded";n.statusActive="Active";n.statusDone="Done";n.statusError="Error";var u="Email,First Name,Last Name,Date of Birth,Contact Number,Address,Suburb,Postcode,State,USI";n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));var i=new Blob([u],{type:"text/plain"});n.templateUrl=(window.URL||window.webkitURL).createObjectURL(i)};n.uploadBatchEnrolmentCsv=function(){n.showTable=!1;var t=new FileReader;t.onload=function(t){n.enrolments=[];var r=t.target.result,u=r.split(/\r\n|\n/),i=0;u.forEach(function(t){if(i>0){var u=t.split(/,/),f=u.length,r={};r.myRoyalAccount={};r.myRoyalAccountExists=!1;r.email=f>=0?u[0]:"";r.firstName=f>=1?u[1]:"";r.lastName=f>=2?u[2]:"";r.dob=f>=3?u[3]:"";r.contactNumber=f>=4?u[4]:"";r.address=f>=5?u[5]:"";r.suburb=f>=6?u[6]:"";r.postcode=f>=7?u[7]:"";r.state=f>=8?u[8]:"";r.usi=f>=9?u[9]:"";r.status=n.statusLoaded;try{r.dob.length>0&&(r.dobMoment=moment.utc(r.dob,"DD/MM/YYYY"),r.dob=r.dobMoment.toISOString())}catch(e){console.error("Error parsing DOB: ",e)}n.enrolments.push(r)}i++});n.showTable=!0};t.onerror=function(n){alert(n.target.error.name)};t.readAsText(n.uploadFile[0])};n.runBatchEnrolments=function(n){var t=f();i.all(t).then(function(){}).then(function(){var n=e();return i.all(n)}).then(function(){}).then(function(){var t=o(n);return i.all(t)}).then(function(){})}}]);StaffPortalBatchEnrolmentModule=angular.module("corpApp.StaffPortalFundraisingPurchasesModule",["ngMaterial","ngRoute","ngSanitize","ngCookies","md.data.table"]);StaffPortalBatchEnrolmentModule.controller("StaffPortalFundraisingPurchasesCtrl",["$scope","$controller","$q","staffPortalService","fundraisingService",function(n,t,i,r,u){function h(){n.raffles.length===0&&u.GetRaffles().then(function(t){t!==undefined&&t!==null?n.raffles=t.Raffles:console.log("No response...")},function(n){console.log("Error!",n);console.log(n)}).finally(function(){})}function s(t,i,r){for(var e=[],f=0;f<t.length;f++)e.push(+t[f].RafflePurchaseId),t[f].status=n.statusActive,t[f].sendMessage="Regenerating/sending email...";u.SendFundraisingPurchaseEmails(e,i,r).then(function(i){if(i!==undefined&&i!==null)for(console.log(i.Emails),f=0;f<t.length;f++){for(var r=0;r<i.Emails.length;r++)if(+i.Emails[r].RafflePurchaseId==+t[f].RafflePurchaseId){t[f].status=n.statusDone;t[f].sendMessage="Email successfully sent!";break}t[f].status!==n.statusDone&&(t[f].status=n.statusError,t[f].sendMessage="Error sending email")}else for(f=0;f<t.length;f++)t[f].status=n.statusError,t[f].sendMessage="Error sending email (no response)"},function(i){for(console.log("Error!",i),console.log(i),f=0;f<t.length;f++)t[f].status=n.statusError,t[f].sendMessage="Error sending email"}).finally(function(){n.bulkSubmitStatus=n.statusDone})}var o,e,f=null;n.loading=null;n.uploadFile=null;n.showTable=!1;n.raffles=[];n.search={};n.search.selectedRaffle=null;n.search.options={organisationCode:"",raffleCode:"",pageSize:10,pageNumber:1};n.search.results=[];n.search.label={page:"Page:",of:"of",rowsPerPage:"Rows per page:"};n.statusLoaded="Loaded";n.statusActive="Active";n.statusDone="Done";n.statusError="Error";n.overrideEmail="";n.overrideEmailSelected=!0;n.bulkSubmitStatus=null;n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));o=r.pageNameFundraisingPurchases;r.SubscribeToActivePageUpdates(n,function(n,t){t===o&&h()});e=r.GetCurrentUserInfo();e!==undefined&&e!==null&&(n.overrideEmail=e.Email);r.SubscribeToUserProfileChange(n,function(t,i){n.currentUserInfo=i;i!==undefined&&i!==null&&(n.overrideEmail=i.Email)})};n.selectedRaffleChanged=function(){n.search.selectedRaffle!==null?(n.showResults=!0,n.search.options.organisationCode=n.search.selectedRaffle.OrganisationCode,n.search.options.raffleCode=n.search.selectedRaffle.RaffleCode):n.showResults=!1;n.search.options.pageNumber=1;n.searchFundraisingPurchases(n.search.options)};n.searchFundraisingPurchasesPaginate=function(){n.searchFundraisingPurchases(n.search.options)};n.searchFundraisingPurchases=function(t){f!==null&&f.resolve();f=i.defer();n.loading=f.promise;u.SearchFundraisingPurchases(t).then(function(t){if(t!==undefined&&t!==null){for(var i=0;i<t.FundraisingPurchases.length;i++)t.FundraisingPurchases[i].status=n.statusLoaded;n.search.results=t.FundraisingPurchases;n.search.totalRecords=t.TotalRecords}else console.log("No response...")},function(n){console.log("Error!",n);console.log(n)}).finally(function(){f.resolve()})};n.sendFundraisingPurchaseEmail=function(t){var r=[t],i=null;n.overrideEmailSelected&&(i=n.overrideEmail);s(r,i,null)};n.sendAllSelectedFundraisingPurchaseEmails=function(){var i=n.search.results.filter(function(n){return n.PurchasePageId!==null&&n.selected}),t=null;n.overrideEmailSelected&&(t=n.overrideEmail);s(i,t,null);n.bulkSubmitStatus=n.statusActive};n.toggleAll=function(){var r=n.allSelected(),t=n.search.results,i;if(t!==undefined&&t!==null)for(i=0;i<t.length;i++)t[i].PurchasePageId!==null&&(t[i].selected=!r)};n.allSelected=function(){var r=!0,t=n.search.results,i;if(t!==undefined&&t!==null){for(i=0;i<t.length;i++)if(t[i].PurchasePageId!==null&&!t[i].selected){r=!1;break}}else r=!1;return r};n.anySelected=function(){var r=!1,t=n.search.results,i;if(t!==undefined&&t!==null)for(i=0;i<t.length;i++)if(t[i].PurchasePageId!==null&&t[i].selected){r=!0;break}return r}}]);StaffPortalLoginModule=angular.module("corpApp.StaffPortalLoginModule",["ngRoute","ngSanitize","ngCookies"]);StaffPortalLoginModule.controller("StaffPortalLoginCtrl",["$scope","$controller","$filter","$interval","$cookies","$http","$timeout","staffPortalService",function(n,t,i,r,u,f,e,o){n.loading=!0;n.currentUserInfo=null;n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));o.getCurrentUserInfo().success(function(t){t.Success===!0?(console.log(t),n.currentUserInfo=t.User):(console.log("Not authenticated..."),n.username="admin",n.password="")}).error(function(t){n.username="admin";n.password="";console.log(t)}).finally(function(){n.loading=!1})};n.login=function(t,i){n.loading=!0;o.login(t,i).success(function(t){console.log("Login: ",t);t.Success===!0?(n.currentUserInfo=t.User,console.log("Username: ",t.User.Username),console.log("FullName: ",t.User.FullName)):console.log("Unsuccessful authentication attempt")}).error(function(n){console.log("Unsuccessful authentication attempt");console.log(n)}).finally(function(){n.loading=!1})}}]);StaffPortalLoginModule=angular.module("corpApp.StaffPortalLoginModule",["ngMaterial","ngRoute","ngSanitize","ngCookies"]);StaffPortalLoginModule.controller("StaffPortalLoginCtrl",["$scope","$controller","$filter","$interval","$cookies","$http","$timeout","staffPortalService",function(n,t,i,r,u,f,e,o){n.loading=!0;n.loginError=null;n.currentUserInfo=null;n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));o.GetCurrentUserInfo().then(function(t){t!==undefined&&t!==null&&(n.currentUserInfo=t)},function(n){console.error(n)}).finally(function(){n.loading=!1})};n.login=function(){n.loginError=null;n.loading=!0;o.Login(n.username,n.password).then(function(t){t&&t.Success===!0?n.currentUserInfo=t.User:console.error("Unsuccessful authentication attempt")},function(t){t!==undefined&&t!==null?t.status===401?n.loginError="Bad username/password":t.status===403&&(n.loginError="Account is locked"):n.loginError="Server error";console.error("Unsuccessful authentication attempt");console.error(t)}).finally(function(){n.loading=!1})};n.logout=function(){n.loading=!0;o.Logout().then(function(){n.username=n.currentUserInfo.Username;n.password="";n.currentUserInfo=null},function(n){console.error("Unsuccessful logout attempt");console.error(n)}).finally(function(){n.loading=!1})}}]);StaffPortalMainContentModule=angular.module("corpApp.StaffPortalMainContentModule",["ngMaterial","ngRoute","ngSanitize","ngCookies"]);StaffPortalMainContentModule.controller("StaffPortalMainContentCtrl",["$scope","$controller","$compile","staffPortalService",function(n,t,i,r){function u(t){n.activePage=t}n.loading=!0;n.activePage=null;n.pageNameMyRoyalManageAccounts=null;n.pageNameBatchEnrolments=null;n.pageNameFundraisingPurchases=null;n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));n.pageNameMyRoyalManageAccounts=r.pageNameMyRoyalManageAccounts;n.pageNameBatchEnrolments=r.pageNameBatchEnrolments;n.pageNameFundraisingPurchases=r.pageNameFundraisingPurchases;r.SubscribeToActivePageUpdates(n,function(n,t){u(t)})}}]);StaffPortalMyRoyalAdminModule=angular.module("corpApp.StaffPortalMyRoyalAdminModule",["ngMaterial","ngRoute","ngSanitize","ngCookies","md.data.table"]);StaffPortalMyRoyalAdminModule.controller("StaffPortalMyRoyalAdminCtrl",["$scope","$controller","$filter","$interval","$cookies","$http","$timeout","myRoyalService",function(n,t,i,r,u,f,e,o){n.search={};n.search.options={filter:"",pageSize:5,pageNumber:1};n.loading=!0;n.showResults=!1;n.activePage=null;n.pageNameMyRoyalManageAccounts=null;n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));n.loading=!1};n.searchUsers=function(t){n.loading=!0;o.SearchUsers(t).then(function(t){t!==undefined&&t!==null?(n.search.results=t.MyRoyalUsers,n.search.totalRecords=t.TotalRecords,n.showResults=!0,console.log(t)):console.log("No response...")},function(n){console.log("Error!",n);console.log(n)}).finally(function(){n.loading=!1})};n.searchUsersPaginate=function(t,i){console.log("Page: "+t+", limit: "+i);n.searchUsers(n.search.options)};n.query={order:"Email",limit:5,page:1};n.unlockAccount=function(n,t){t.Locked="Unlocking";console.log("Unlocking account: "+t.Username);o.UnlockUser(t.Username).then(function(n){n!==undefined&&n!==null?t.Locked=!n.Success:console.log("No response...")},function(n){console.log("Error!",n);console.log(n)}).finally(function(){})}}]);StaffPortalNavModule=angular.module("corpApp.StaffPortalNavModule",["ngMaterial","ngRoute","ngSanitize","ngCookies"]);StaffPortalNavModule.controller("StaffPortalNavCtrl",["$scope","$controller","$filter","$interval","$cookies","$http","$timeout","staffPortalService",function(n,t,i,r,u,f,e,o){n.staffPortalPages=[];n.currentUserInfo=null;n.init=function(){angular.extend(this,t("BaseCtrl",{$scope:n}));o.SubscribeToUserProfileChange(n,function(t,i){n.currentUserInfo=i});n.staffPortalPages=o.GetStaffPortalPages()};n.currentUserIsInRole=function(n){return o.IsUserInRole(n)};n.navigatePage=function(n){o.SetActivePage(n.PageName)}}]);angular.module("corpApp.FundraisingService",["ngResource"]).factory("fundraisingService",["$interval","$log","$http","$rootScope",function(n,t,i){function o(){return i.get(r+u).then(function(n){return n.data})}function s(n){return i.get(r+f,{params:{OrganisationCode:n.organisationCode,RaffleCode:n.raffleCode,PageSize:n.pageSize,PageNumber:n.pageNumber}}).then(function(n){return n.data})}function h(n,t,u){return i.post(r+e,{RafflePurchaseIds:n,OverrideRecipientEmail:t,OverrideRecipientBcc:u}).then(function(n){return n.data})}var r="/api/StaffPortal/FundraisingPurchases",u="/Raffles",f="/SearchFundraisingPurchases",e="/SendFundraisingPurchaseEmails";return{GetRaffles:o,SearchFundraisingPurchases:s,SendFundraisingPurchaseEmails:h}}]);angular.module("corpApp.MyRoyalService",["ngResource"]).factory("myRoyalService",["$interval","$log","$http","$rootScope",function(n,t,i){function h(n){return i.get(r+f,{params:{filter:n.filter,pageSize:n.pageSize,pageNumber:n.pageNumber}}).then(function(n){return n.data})}function c(n){return i.post(r+e,{username:n}).then(function(n){return n.data})}function l(n){return i.get(r+u,{params:{username:n}}).then(function(n){return n.data})}function a(n){return i.post(r+u,{MyRoyalUser:n}).then(function(n){return n.data})}function v(n){return i.post(r+o,{MyRoyalUser:n}).then(function(n){return n.data})}function y(n,t){return i.post(r+s,{Username:n,CourseOccurrenceId:t}).then(function(n){return n.data})}var r="/api/StaffPortal/MyRoyalAdmin",f="/SearchUsers",e="/UnlockUser",u="/MyRoyalAccount",o="/UpdateMyRoyalAccount",s="/EnrolMyRoyalUserInOccurrence";return{SearchUsers:h,UnlockUser:c,GetMyRoyalAccount:l,CreateMyRoyalAccount:a,UpdateMyRoyalAccountDetails:v,EnrolMyRoyalUserInOccurrence:y}}]);angular.module("corpApp.StaffPortalService",["ngResource"]).factory("staffPortalService",["$interval","$log","$http","$rootScope",function(n,t,i,r){function g(){return i.get(f).then(function(n){return n&&n.data&&c(n.data),n.data})}function nt(n,t){return i.post(f+b,{username:n,password:t}).then(function(n){return n&&n.data&&c(n.data.User),n.data})}function tt(){return i.post(f+k,{}).then(function(n){return n&&n.data&&(c(null),w(null)),n.data})}function it(){return u!==null?u.Roles:[]}function rt(n){var i=!1,t;if(u!==null)for(t=0;t<u.Roles.length;t++)if(u.Roles[t].Name===n){i=!0;break}return i}function ut(){return h}function ft(n){w(n)}function et(n,t){var i=r.$on(p,t);n.$on("$destroy",i)}function ot(n,t){var i=r.$on(o,t);n.$on("$destroy",i)}function st(n,t){var i=r.$on(s,t);n.$on("$destroy",i)}function c(n){u=n;var t=[];n!==undefined&&n!==null&&(t=n.Roles);ht(t);lt(n)}function w(n){h!==n&&(h=n,ct(n))}function ht(n){r.$emit(o,n)}function ct(n){r.$emit(s,n)}function lt(n){r.$emit(p,n)}function at(){return d}var f="/api/StaffPortalLogin",b="/Login",k="/Logout",e="My Royal Administrator",l="Fundraising Administrator",a="My Royal Manage Accounts",v="Training Course Batch Enrolments",y="Fundraising Purchases",p="user-profile-changed-event",o="authorised-roles-updated-event",s="active-page-updated-event",u=null,h=null,d=[{PageName:a,NavDisplayName:"My Royal Accounts",RequiredRole:e},{PageName:v,NavDisplayName:"Batch Enrolments",RequiredRole:e},{PageName:y,NavDisplayName:"Fundraising Purchases",RequiredRole:l}];return{roleMyRoyalAdmin:e,roleFundraisingAdmin:l,pageNameMyRoyalManageAccounts:a,pageNameBatchEnrolments:v,pageNameFundraisingPurchases:y,eventAuthorisedRolesUpdated:o,eventActivePageUpdated:s,GetCurrentUserInfo:g,Login:nt,Logout:tt,GetStaffPortalPages:at,GetAuthorisedRoles:it,IsUserInRole:rt,GetActivePage:ut,SetActivePage:ft,SubscribeToUserProfileChange:et,SubscribeToRoleUpdates:ot,SubscribeToActivePageUpdates:st}}]);angular.module("corpApp.CallCentreService",["ngResource"]).factory("callCentreService",["$http","$rootScope",function(n){var t="/api/CallCentreLinks",i=function(i){return n.get(t,{params:{dataSourceId:i}}).then(function(n){return n&&n.data?n.data:null},function(n){return console.log(n),null})};return{GetCallCentreLinks:i}}])