text: /*! CommunityAllyWebApp 2021-07-26 */
  
  !function(e){var t=function(){function e(e,t){this.$http=e,this.$q=t,this.isLoading=!1}return e.prototype.$onInit=function(){this.refreshAddresses()},e.prototype.getPolyInfo=function(e,i){var n=this.$q.defer();this.isLoading=!0;var o=this;return this.$http.get(e).then(function(e){o.isLoading=!1;var t=e.data;_.each(t,function(e){"Group"==(e.polyType=i)&&(e.oneLiner=e.shortName+", "+e.appName)}),$.merge(o.addresses,t),n.resolve(o.addresses)},function(e){this.isLoading=!1;var t=e.data.exceptionMessage?e.data.exceptionMessage:e.data;alert("Failed to retrieve addresses: "+t),n.reject()}),n.promise},e.prototype.getGroupBoundPolys=function(){return this.getPolyInfo("/api/AdminMap/GetGroupBounds?filter="+this.filterAddresses,"Group")},e.prototype.getAddressPolys=function(){return this.getPolyInfo("/api/AdminMap/GetAll?filter="+this.filterAddresses,"Address")},e.prototype.refreshAddresses=function(){this.isLoading=!0,this.addresses=[];var t=this;this.getAddressPolys().then(function(){return t.getGroupBoundPolys()}).then(function(e){t.addressPoints=[],_.each(e,function(e){e.gpsPos&&(e.gpsPos.fullAddress=e.oneLiner,t.addressPoints.push(e.gpsPos))})})},e.prototype.onSavePoly=function(){this.isLoading=!0;var e={vertices:this.selectedAddress.gpsBounds.vertices},t="Address"===this.selectedAddress.polyType?"/api/AdminMap/UpdateAddress/"+this.selectedAddress.addressId:"/api/AdminMap/UpdateGroup/"+this.selectedAddress.groupId,i=this;this.$http.put(t,e).then(function(){i.isLoading=!1},function(){i.isLoading=!1})},e.prototype.onAddressSelected=function(e){if(this.selectedAddress=e,this.selectedAddress.gpsBounds||(this.selectedAddress.gpsBounds={vertices:[]}),this.selectedAddress.gpsBounds.vertices||(this.selectedAddress.gpsBounds.vertices=[]),0==this.selectedAddress.gpsBounds.vertices.length&&e.gpsPos){new google.maps.LatLng(e.gpsPos.lat,e.gpsPos.lon),new google.maps.LatLng(e.gpsPos.lat+.001,e.gpsPos.lon+.001);e.gpsBounds.vertices=[{lat:e.gpsPos.lat,lon:e.gpsPos.lon},{lat:e.gpsPos.lat+.001,lon:e.gpsPos.lon},{lat:e.gpsPos.lat+.001,lon:e.gpsPos.lon+.001},{lat:e.gpsPos.lat,lon:e.gpsPos.lon+.001}]}this.selectedGpsPoly=e.gpsBounds},e.$inject=["$http","$q"],e}();e.ManageAddressPolysController=t}(Ally||(Ally={})),CA.angularApp.component("manageAddressPolys",{templateUrl:"/ngApp/admin/manage-address-polys.html",controller:Ally.ManageAddressPolysController}),function(e){var i=function(){},t=function(){function e(e,t){this.$http=e,this.siteInfo=t,this.newAssociation=new i,this.changeShortNameData={appName:"Condo"},this.sendTestFromInmail=!1,this.noReplyEmailInfo={to:"",subject:"",body:""},this.retrieveGroups=function(){this.isLoading=!0;var t=this;this.$http.get("/api/Association/AdminList").then(function(e){t.isLoading=!1,t.groups=e.data,_.each(t.groups,function(e){0===e.appName?(e.appNameString="Condo",e.baseUrl="https://"+e.shortName+".CondoAlly.com/"):1===e.appName?(e.appNameString="NeighborhoodWatch",e.baseUrl="https://"+e.shortName+".WatchAlly.com/"):2===e.appName?(e.appNameString="Home",e.baseUrl="https://"+e.shortName+".HomeAlly.org/"):3===e.appName?(e.appNameString="Hoa",e.baseUrl="https://"+e.shortName+".HoaAlly.org/"):4===e.appName?(e.appNameString="Neighborhood",e.baseUrl="https://"+e.shortName+".NeighborhoodAlly.org/"):5===e.appName?(e.appNameString="PTA",e.baseUrl="https://"+e.shortName+".PTAAlly.org/"):6===e.appName&&(e.appNameString="BlockClub",e.baseUrl="https://"+e.shortName+".BlockClubAlly.org/")})},function(){t.isLoading=!1,alert("Failed to retrieve groups")})}}return e.prototype.$onInit=function(){this.curGroupApiUri=this.siteInfo.publicSiteInfo.baseApiUrl,this.curGroupId=this.curGroupApiUri.substring("https://".length,this.curGroupApiUri.indexOf(".")),this.curGroupCreationDate=this.siteInfo.privateSiteInfo.creationDate,this.premiumUpdateGroupId=parseInt(this.curGroupId),"hoa"===AppConfig.appShortName&&(this.changeShortNameData.appName="Hoa"),this.changeShortNameData.old=this.siteInfo.publicSiteInfo.shortName,this.newAllyPaymentEntry={paymentId:0,groupId:parseInt(this.curGroupId),amount:0,netAmount:null,description:"Annual Premium Plan",entryDateUtc:new Date,paymentDateUtc:new Date,paymentMethod:"Check",paymentMethodId:"",status:"Complete"}},e.prototype.changeShortName=function(){var t=this;this.changeShortNameResult=null,/[^a-zA-Z0-9]/.test(this.changeShortNameData.newShortName)?alert("The new short name must be alphanumeric"):this.changeShortNameData.newShortName===this.changeShortNameData.newShortName.toLowerCase()?0!==this.changeShortNameData.newShortName.length?(this.isLoading=!0,this.$http.put("/api/AdminHelper/ChangeShortName?oldShortName="+this.changeShortNameData.old+"&newShortName="+this.changeShortNameData.newShortName+"&appName="+this.changeShortNameData.appName,null).then(function(e){t.isLoading=!1,t.changeShortNameResult="Successfully changed"},function(e){t.isLoading=!1,t.changeShortNameResult="Failed to change: "+e.data.exceptionMessage})):alert("New short name must not be empty"):alert("The new short name must be lower-case")},e.prototype.findAssociationsForUser=function(){var t=this;this.isLoading=!0,this.$http.get("/api/AdminHelper/FindAssociationsForUser?email="+this.findUserAssociationsEmail).then(function(e){t.isLoading=!1,t.foundUserAssociations=e.data,_.forEach(t.foundUserAssociations,function(e){e.viewUrl="https://"+e.shortName+".condoally.com/",3===e.appName&&(e.viewUrl="https://"+e.shortName+".hoaally.org/")})},function(){t.isLoading=!1,alert("Failed to find associations for user")})},e.prototype.deleteAssociation=function(e){if(confirm("Are you sure you want to delete this association?")){this.isLoading=!0;var t=this;this.$http.delete("/api/Association/chtn/"+e.groupId).then(function(){t.isLoading=!1,t.retrieveGroups()},function(e){t.isLoading=!1,console.log(e.data.exceptionMessage),alert("Failed to delete group: "+e.data.exceptionMessage)})}},e.prototype.addAddress=function(){var t=this;this.newAddressId=null,this.isLoading=!0,this.$http.post("/api/AdminHelper/AddAddress?address="+encodeURIComponent(this.newAddress),null).then(function(e){t.isLoading=!1,t.newAddressId=e.data.newAddressId},function(e){t.isLoading=!1,alert("Failed to add address: "+e.data.exceptionMessage)})},e.prototype.onCreateAssociationClick=function(){this.isLoading=!0;var e=this;this.$http.post("/api/Association",this.newAssociation).then(function(){e.isLoading=!1,e.newAssociation=new i,e.retrieveGroups()})},e.prototype.onSendTestEmail=function(){this.makeHelperRequest("/api/AdminHelper/SendTestEmail?testEmailRecipient="+encodeURIComponent(this.testEmailRecipient)+"&sendFromInmail="+(this.sendTestFromInmail?"true":"false"))},e.prototype.onSendTaylorTestEmail=function(){this.makeHelperRequest("/api/AdminHelper/SendFromTaylorEmail?testEmailRecipient="+encodeURIComponent(this.testTaylorEmailRecipient))},e.prototype.onSendTaylorBulkUpdateEmail=function(){confirm("Are you sure you want to SEND TO EVERYONE?!?!")&&this.makeHelperRequest("/api/AdminHelper/SendBulkTaylorEmail3")},e.prototype.onSendTestPostmarkEmail=function(){this.isLoading=!0;var e=this;this.$http.get("/api/AdminHelper/SendTestPostmarkEmail?email="+this.testPostmarkEmail).success(function(){e.isLoading=!1,alert("Successfully sent email")}).error(function(){e.isLoading=!1,alert("Failed to send email")})},e.prototype.onSendTestCalendarEmail=function(){this.isLoading=!0;var e=this;this.$http.get("/api/AdminHelper/SendTestCalendarEmail").success(function(){e.isLoading=!1,alert("Successfully sent email")}).error(function(){e.isLoading=!1,alert("Failed to send email")})},e.prototype.onSendNoReplyEmail=function(){var t=this;this.isLoading=!0,this.$http.post("/api/AdminHelper/SendNoReplyPostmarkEmail",this.noReplyEmailInfo).then(function(){t.isLoading=!1,alert("Successfully sent email")},function(e){t.isLoading=!1,alert("Failed to send email: "+e.data.exceptionMessage)})},e.prototype.makeHelperRequest=function(e,t){var i;void 0===t&&(t=null),this.isLoadingHelper=!0,i=t?this.$http.post(e,t):this.$http.get(e);var n=this;i.then(function(){return n.isLoadingHelper=!1},function(e){n.isLoadingHelper=!1;var t=e.data?e.data.exceptionMessage:"";alert("Failed: "+t)})},e.prototype.onTestException=function(){this.makeHelperRequest("/api/AdminHelper/TestException")},e.prototype.onClearElmahLogs=function(){this.makeHelperRequest("/api/AdminHelper/ClearElmah")},e.prototype.onClearCurrentAppGroupCache=function(){this.makeHelperRequest("/api/AdminHelper/ClearCurrentGroupFromCache")},e.prototype.onClearEntireAppGroupCache=function(){this.makeHelperRequest("/api/AdminHelper/ClearGroupCache")},e.prototype.onSendInactiveGroupsMail=function(){var e={shortNameLines:this.inactiveShortNames};this.makeHelperRequest("/api/AdminHelper/SendInactiveGroupsMail",e)},e.prototype.logInAs=function(){var t=this;this.isLoading=!0,this.$http.get("/api/AdminHelper/LogInAs?email="+this.logInAsEmail).then(function(e){t.siteInfo.setAuthToken(e.data),window.location.href="/#!/Home",window.location.reload(!1)},function(e){alert("Failed to perform login: "+e.data.exceptionMessage)}).finally(function(){return t.isLoading=!1})},e.prototype.populateEmptyDocumentUsage=function(){var t=this;this.isLoading=!0;var e="/api/AdminHelper/FillInMissingDocumentUsage?numGroups=10";this.populateDocUsageGroupId&&(e+="&groupId="+this.populateDocUsageGroupId),this.$http.get(e).then(function(e){t.isLoading=!1,alert("Succeeded: "+e.data)},function(e){t.isLoading=!1,alert("Failed: "+e.data.exceptionMessage)})},e.prototype.onAddAllyPayment=function(){var t=this;this.isLoading=!0,this.$http.post("/api/AdminHelper/AddAllyPaymentEntry",this.newAllyPaymentEntry).then(function(e){t.isLoading=!1,t.newAllyPaymentEntry.amount=0,t.newAllyPaymentEntry.netAmount=null,t.newAllyPaymentEntry.paymentMethodId="",alert("Succeeded")},function(e){t.isLoading=!1,alert("Failed: "+e.data.exceptionMessage)})},e.prototype.updatePremiumCost=function(){var t=this;this.isLoading=!0;var e="/api/AdminHelper/SetPremiumCost/"+this.premiumUpdateGroupId+"?cost="+this.premiumNewCost;this.$http.put(e,null).then(function(e){t.isLoading=!1,t.premiumNewCost=0,alert("Succeeded")},function(e){t.isLoading=!1,alert("Failed: "+e.data.exceptionMessage)})},e.prototype.updatePremiumExpiration=function(){var t=this;this.isLoading=!0;var e="/api/AdminHelper/SetPremiumExpiration/"+this.premiumUpdateGroupId+"?expirationDate="+encodeURIComponent(this.premiumNewExpiration.toISOString());this.$http.put(e,null).then(function(e){t.isLoading=!1,t.premiumNewExpiration=null,alert("Succeeded")},function(e){t.isLoading=!1,alert("Failed: "+e.data.exceptionMessage)})},e.$inject=["$http","SiteInfo"],e}();e.ManageGroupsController=t}(Ally||(Ally={})),CA.angularApp.component("manageGroups",{templateUrl:"/ngApp/admin/manage-groups.html",controller:Ally.ManageGroupsController}),function(n){var e=function(){function e(e,t){this.$http=e,this.siteInfo=t,this.isLoading=!1,this.unitToEdit=new n.Unit,this.isEdit=!1,this.isHoaAlly=!1,this.isCondoAlly=!1}return e.prototype.$onInit=function(){this.isAdmin=this.siteInfo.userInfo.isAdmin,this.homeName=AppConfig.homeName||"Unit",this.isCondoAlly="condo"===AppConfig.appShortName,this.refresh()},e.prototype.refresh=function(){var t=this;this.isLoading=!0,this.$http.get("/api/Unit?includeAddressData=true").then(function(e){t.isLoading=!1,t.units=e.data},function(e){t.isLoading=!1,alert("Failed to load homes: "+e.data.exceptionMessage)})},e.prototype.onCreateUnitClick=function(){var t=this;if($("#AddUnitForm").validate(),$("#AddUnitForm").valid()){this.isLoading=!0;var e=function(){t.isLoading=!1,t.isEdit=!1,t.unitToEdit=new n.Unit,t.refresh()},i=function(e){t.isLoading=!1,alert("Failed to save: "+e.data.exceptionMessage)};this.isEdit?this.$http.put("/api/Unit",this.unitToEdit).then(e,i):this.$http.post("/api/Unit/AddSingle",this.unitToEdit).then(e,i)}},e.prototype.onEditUnitClick=function(e){this.isEdit=!0,this.unitToEdit=_.clone(e),e.fullAddress&&(this.unitToEdit.streetAddress=e.fullAddress.oneLiner),document.getElementById("unit-edit-panel").scrollIntoView()},e.prototype.onRefreshUnitFromGoogle=function(e){var t=this;this.isLoading=!0,this.$http.put("/api/Unit/ForceRefreshAddressFromGoogle?unitId="+e.unitId,null).then(function(){t.isLoading=!1,t.refresh()},function(e){t.isLoading=!1,alert("Failed to refresh: "+e.data.exceptionMessage)})},e.prototype.onDeleteUnitClick=function(e){var t=this;this.isLoading=!0,this.$http.delete("/api/Unit/"+e.unitId).then(function(){t.isLoading=!1,t.refresh()},function(e){t.isLoading=!1,alert("Failed to delete: "+e.data.exceptionMessage)})},e.prototype.onFastAddUnits=function(){var t=this;this.isLoading=!0,this.$http.post("/api/Unit/FastAdd?fastAdd="+this.lastFastAddName,null).then(function(){t.isLoading=!1,t.refresh()},function(e){t.isLoading=!1,alert("Failed fast add: "+e.data.exceptionMessage)})},e.prototype.onAddUnitsPerLine=function(){var e=this,t={action:"onePerLine",lines:this.unitNamePerLine};this.isLoading=!0,this.$http.post("/api/Unit/Multiline",t).then(function(){e.isLoading=!1,e.refresh()},function(){e.isLoading=!1,alert("Failed")})},e.prototype.onAddUnitsByAddressPerLine=function(){var t=this,e={action:"onePerLine",lines:this.unitAddressPerLine};this.isLoading=!0,this.$http.post("/api/Unit/FromAddresses",e).then(function(){t.isLoading=!1,t.unitAddressPerLine="",t.refresh()},function(e){t.isLoading=!1,alert("Failed to add: "+e.data.exceptionMessage)})},e.prototype.onDeleteAllClick=function(){var t=this;confirm("This will delete every unit! This should only be used for new sites!")&&(this.isLoading=!0,this.$http.delete("/api/Unit/DeleteAll?deleteAction=all").then(function(){t.isLoading=!1,t.refresh()},function(e){t.isLoading=!1,alert("Failed to delete units: "+e.data.exceptionMessage)}))},e.$inject=["$http","SiteInfo"],e}();n.ManageHomesController=e}(Ally||(Ally={})),CA.angularApp.component("manageHomes",{templateUrl:"/ngApp/admin/manage-homes.html",controller:Ally.ManageHomesController}),function(e){var t=function(){function e(e){this.$http=e,this.isLoading=!1,this.shouldHideLoginAndEmailMessages=!1}return e.prototype.$onInit=function(){this.shouldHideLoginAndEmailMessages="true"===window.localStorage.activityLog_hideLoginAndEmailMessages,this.retrieveEntries()},e.prototype.onHideLoginAndEmailMessagesChange=function(){window.localStorage.activityLog_hideLoginAndEmailMessages=this.shouldHideLoginAndEmailMessages,this.filterMessages()},e.prototype.retrieveEntries=function(){var t=this;this.isLoading=!0,this.$http.get("/api/ActivityLog").then(function(e){t.isLoading=!1,t.allLogEntries=e.data,_.each(t.allLogEntries,function(e){return e.postDate=moment(e.postDate).toDate()}),t.filterMessages()},function(e){t.isLoading=!1,alert("Failed to load activity log: "+e.data.exceptionMessage)})},e.prototype.filterMessages=function(){this.shouldHideLoginAndEmailMessages?this.filteredLogEntries=_.filter(this.allLogEntries,function(e){return"Logged in"!==e.activityMessage&&0!==e.activityMessage.indexOf("Group email sent")}):this.filteredLogEntries=this.allLogEntries},e.$inject=["$http"],e}();e.ViewActivityLogController=t}(Ally||(Ally={})),CA.angularApp.component("viewActivityLog",{templateUrl:"/ngApp/admin/view-activity-log.html",controller:Ally.ViewActivityLogController}),function(e){var t=function(){function e(e){this.$http=e,this.isLoading=!1}return e.prototype.$onInit=function(){this.refreshAddresses()},e.prototype.findCenter=function(e){for(var t={lat:0,lng:0},i=0;i<e.length;++i){var n=e[i];if(n){for(var o={lat:0,lng:0},s=0;s<n.vertices.length;++s){var a=n.vertices[s];o.lat+=a.lat,o.lng+=a.lng}o.lat/=n.vertices.length,o.lng/=n.vertices.length,t.lat+=o.lat,t.lng+=o.lng}}return t.lat/=e.length,t.lng/=e.length,t},e.prototype.refreshAddresses=function(){var t=this;this.isLoading=!0,this.neighborhoodPolys=[];var i=this;this.$http.get("/api/Neighborhood/GetAll").then(function(e){i.isLoading=!1,i.neighborhoods=e.data,i.neighborhoodPolys=_.select(i.neighborhoods,function(e){return e.Bounds}),i.mapCenter=i.findCenter(t.neighborhoodPolys)},function(e){i.isLoading=!1,alert("Failed to retrieve neighborhoods: "+e.data.exceptionMessage)})},e.$inject=["$http","$q"],e}();e.ViewPolysController=t}(Ally||(Ally={})),CA.angularApp.component("viewPolys",{templateUrl:"/ngApp/admin/view-polys.html",controller:Ally.ViewPolysController}),function(e){var t=function(){function e(e){this.$http=e,this.isLoading=!1}return e.prototype.$onInit=function(){this.mapCenter={lat:41.99114,lng:-87.690425},this.refreshCells()},e.prototype.addLine=function(e,t,i,n,o){var s=[{lat:t,lng:i},{lat:n,lng:o}];new google.maps.Polyline({path:s,geodesic:!1,strokeColor:"#FF0000",strokeOpacity:1,strokeWeight:2}).setMap(e)},e.prototype.onBuildingSelected=function(e){},e.prototype.onCellSelected=function(t){t.gpsBounds.mapShapeObject.setOptions({fillOpacity:.1}),this.selectedCell&&this.selectedCell.gpsBounds.mapShapeObject.setOptions({fillOpacity:.35}),this.selectedCell=t,_.each(this.selectedCell.streets,function(e){0!=e.minLat&&this.addLine(t.gpsBounds.mapShapeObject.map,e.minLat,e.minLon,e.maxLat,e.maxLon)})},e.prototype.refreshCells=function(){this.isLoading=!0;var t=this;this.$http.get("/api/ResearchMap").then(function(e){t.isLoading=!1,t.cells=e.data,t.isLoading=!0,t.$http.get("/api/ResearchMap/Buildings").then(function(e){t.isLoading=!1,t.buildings=e.data,t.buildingPoints=_.map(t.buildings,function(e){var t=e.addressPos;return t.ownerBuilding=e,t.onClick=function(){},t})})},function(e){t.isLoading=!1,alert("Failed to retrieve cells: "+e.data.exceptionMessage)})},e.prototype.onAddressSelected=function(e){if(this.selectedAddress=e,this.selectedAddress.gpsBounds||(this.selectedAddress.gpsBounds={vertices:[]}),this.selectedAddress.gpsBounds.vertices||(this.selectedAddress.gpsBounds.vertices=[]),0==this.selectedAddress.gpsBounds.vertices.length&&e.gpsPos){new google.maps.LatLng(e.gpsPos.lat,e.gpsPos.lon),new google.maps.LatLng(e.gpsPos.lat+.001,e.gpsPos.lon+.001);e.gpsBounds.vertices=[{lat:e.gpsPos.lat,lon:e.gpsPos.lon},{lat:e.gpsPos.lat+.001,lon:e.gpsPos.lon},{lat:e.gpsPos.lat+.001,lon:e.gpsPos.lon+.001},{lat:e.gpsPos.lat,lon:e.gpsPos.lon+.001}]}this.selectedGpsPoly=e.gpsBounds},e.$inject=["$http"],e}();e.ViewResearchController=t}(Ally||(Ally={})),CA.angularApp.component("viewResearch",{templateUrl:"/ngApp/admin/view-research.html",controller:Ally.ViewResearchController});var OverrideBaseApiPath=null,OverrideOriginalUrl=null,StripeApiKey="pk_live_fV2yERkfAyzoO9oWSfORh5iH";function RoutePath(e,t,i,n,o){void 0===o&&(o=null),"/"!==e[0]&&(e="/"+e),this.path=e,this.templateUrl=t,this.controller=i,this.menuTitle=n,this.role=o||Role_Authorized,this.controllerAs="function"==typeof i?"vm":null}function RoutePath_v2(e){"/"!==e.path[0]&&(e.path="/"+e.path),this.path=e.path,this.templateUrl=e.templateUrl,this.templateHtml=e.templateHtml,this.controller=e.controller,this.menuTitle=e.menuTitle,this.role=e.role||Role_Authorized,this.controllerAs="function"==typeof e.controller?"vm":null}CA.angularApp.config(["$routeProvider","$httpProvider","$provide","SiteInfoProvider","$locationProvider",function(i,e,t,n,o){o.hashPrefix("!");for(var s={app:["$q","$http","$rootScope","$sce","$location","xdLocalStorage","appCacheService",function(s,e,t,i,a,n,r){return Ally.SiteInfoHelper.loginInit(s,e,t,i,n).then(function(e){return t=a,i=e,n=r,o=s.defer(),i.userInfo?o.resolve():("/Home"!==t.path()&&"/Login"!==t.path()&&(n.set(AppCacheService.Key_AfterLoginRedirect,t.path()),n.set(AppCacheService.Key_WasLoggedIn401,"true")),o.reject(),t.path("/Login")),o.promise;var t,i,n,o})}]},a={app:["$q","$http","$rootScope","$sce","xdLocalStorage",Ally.SiteInfoHelper.loginInit]},r=angular.extend({},i,{when:function(e,t){return t.resolve=t.resolve?t.resolve:{},t.allyRole===Role_All?angular.extend(t.resolve,a):angular.extend(t.resolve,s),i.when(e,t),this}}),l=0;l<AppConfig.menu.length;++l){var d=AppConfig.menu[l],c={controller:d.controller,allyRole:d.role,reloadOnSearch:d.reloadOnSearch};d.templateUrl?c.templateUrl=d.templateUrl:c.template=d.templateHtml,d.controllerAs&&(c.controllerAs=d.controllerAs),r.when(d.path,c)}i.otherwise({redirectTo:"/Home"}),t.factory("http403Interceptor",["$q","$location","$rootScope","appCacheService","$injector",function(s,a,r,l,d){return{response:function(e){return e},responseError:function(e){var t=e.status;if(401===t||403===t){if(403===t&&r.dontHandle403)return s.reject(e);if(403===t&&r.isLoggedIn&&l.set(AppCacheService.Key_WasLoggedIn403,"true"),401===t&&HtmlUtil.isValidString(window.localStorage.rememberMe_Email)){var i=d.get("$http");if(!r.retryLoginDeffered){r.retryLoginDeffered=s.defer();var n={emailAddress:window.localStorage.rememberMe_Email,password:atob(window.localStorage.rememberMe_Password)};setTimeout(function(){i.post("/api/Login",n).then(function(e){var t=e.data;d.get("SiteInfo").setAuthToken(t.authToken),r.retryLoginDeffered.resolve()},function(){var e=r.retryLoginDeffered;r.onLogOut_ClearData(),e.reject()}).finally(function(){r.retryLoginDeffered=null})},1e3)}var o=s.defer();return r.retryLoginDeffered.promise.then(function(){o.resolve(i(e.config))},function(){o.reject(e)}),o.promise}"/Home"!==a.path()&&"/Login"!==a.path()&&(l.set(AppCacheService.Key_AfterLoginRedirect,a.path()),l.set(AppCacheService.Key_WasLoggedIn401,"true")),r.onLogOut_ClearData()}return s.reject(e)}}}]),e.interceptors.push("http403Interceptor"),e.defaults.transformResponse.push(function(e){return Ally.HtmlUtil2.isString(e)&&30<e.length||Ally.HtmlUtil2.convertStringsToDates(e),e}),t.factory("apiUriInterceptor",["$rootScope","SiteInfo",function(o,s){return"string"!=typeof o.authToken&&window.localStorage&&(o.authToken=window.localStorage.getItem("ApiAuthToken")),{request:function(e){var t="https://0.webappapi.mycommunityally.org/api/",i="https://0.webappapi.communityally.org/api/",n=HtmlUtil.startsWith(e.url,t)||HtmlUtil.startsWith(e.url,i);return(HtmlUtil.startsWith(e.url,"/api/")||n)&&(HtmlUtil.startsWith(e.url,"http")?n&&!HtmlUtil.isNullOrWhitespace(OverrideBaseApiPath)&&(HtmlUtil.startsWith(e.url,t)?e.url=OverrideBaseApiPath+e.url.substr(t.length):HtmlUtil.startsWith(e.url,i)&&(e.url=OverrideBaseApiPath+e.url.substr(i.length))):HtmlUtil.isNullOrWhitespace(OverrideBaseApiPath)?s.publicSiteInfo.baseApiUrl&&(e.url=s.publicSiteInfo.baseApiUrl+e.url.substr("/api/".length)):e.url=OverrideBaseApiPath+e.url.substr("/api/".length),e.headers.Authorization="Bearer "+o.authToken,HtmlUtil.isNullOrWhitespace(OverrideOriginalUrl)||(e.headers.ReferrerOverride=OverrideOriginalUrl)),e}}}]),e.interceptors.push("apiUriInterceptor")}]),CA.angularApp.run(["$rootScope","$http","$sce","$location","$templateCache","$cacheFactory","xdLocalStorage",function(r,e,t,l,i,n,o){r.bgImagePath="/assets/images/Backgrounds/",r.appConfig=AppConfig,r.isLoggedIn=!1,r.publicSiteInfo={},r.hideMenu=!1,r.isAdmin=!1,r.isSiteManager=!1,r.menuItems=_.where(AppConfig.menu,function(e){return!HtmlUtil.isNullOrWhitespace(e.menuTitle)}),r.mainMenuItems=_.where(r.menuItems,function(e){return e.role===Role_Authorized}),r.manageMenuItems=_.where(r.menuItems,function(e){return e.role===Role_Manager}),r.adminMenuItems=_.where(r.menuItems,function(e){return e.role===Role_Admin}),HtmlUtil.isLocalStorageAllowed()&&window.localStorage&&(r.publicSiteInfo=angular.fromJson(window.localStorage.getItem("siteInfo")),r.authToken=window.localStorage.getItem("ApiAuthToken"),null!==r.publicSiteInfo&&void 0!==r.publicSiteInfo||(r.publicSiteInfo={})),o.init({iframeUrl:"https://www.communityally.org/xd-local-storage.html"}).then(function(){}),r.onLogOut_ClearData=function(){r.userInfo={},r.isLoggedIn=!1,r.isAdmin=!1,r.isSiteManager=!1,r.authToken="",window.localStorage.rememberMe_Email=null,window.localStorage.rememberMe_Password=null,o.removeItem("allyApiAuthToken"),n.get("$http").removeAll(),window.localStorage&&window.localStorage.removeItem("siteInfo"),l.path("/Login")},r.onLogOut=function(){e.get("/api/Login/Logout").then(r.onLogOut_ClearData,r.onLogOut_ClearData)},r.$on("$routeChangeStart",function(){CA.clearTemplateCacheIfNeeded&&CA.clearTemplateCacheIfNeeded(i)}),r.$on("$routeChangeSuccess",function(e,t,i,n){r.curPath=l.path();var o="",s=l.path();-1!==s.indexOf("?")&&(o=s.substring(s.indexOf("?"),s.length));var a="";n&&n.name&&(a=l.protocol()+"://"+l.host()+"/#"+n.url),analytics.page({path:s,referrer:a,search:o,url:l.absUrl()})})}]),function(e){var t=function(){};(Ally||(Ally={})).MenuItem_v3=t}(),function(e){var t=function(){};e.RouteOptions_v3=t;var i=function(e){this.reloadOnSearch=!0,"/"!==e.path[0]&&(e.path="/"+e.path),this.path=e.path,this.templateHtml=e.templateHtml,this.menuTitle=e.menuTitle,this.role=e.role||Role_Authorized,this.reloadOnSearch=void 0!==e.reloadOnSearch&&e.reloadOnSearch};e.RoutePath_v3=i;var n=function(){function e(){}return e.dwollaPreviewShortNames=["qa","dwollademo","dwollademo1","900wainslie","elingtonvillagepoa"],e.dwollaEnvironmentName="prod",e}();e.AppConfigInfo=n;var o=function(){};e.PeriodicPaymentFrequency=o}(Ally||(Ally={}));var Role_Authorized="authorized",Role_All="all",Role_Manager="manager",Role_Admin="admin",PeriodicPaymentFrequencies=[{name:"Monthly",intervalName:"month",id:50},{name:"Quarterly",intervalName:"quarter",id:51},{name:"Semiannually",intervalName:"half-year",id:52},{name:"Annually",intervalName:"year",id:53}];function FrequencyIdToInfo(e){return PeriodicPaymentFrequencies[e-50]}var CondoAllyAppConfig={appShortName:"condo",appName:"Condo Ally",baseTld:"condoally.com",baseUrl:"https://condoally.com/",isChtnSite:!0,homeName:"Unit",memberTypeLabel:"Resident",menu:[new Ally.RoutePath_v3({path:"Home",templateHtml:"<chtn-home></chtn-home>",menuTitle:"Home"}),new Ally.RoutePath_v3({path:"Home/DiscussionThread/:discussionThreadId",templateHtml:"<chtn-home></chtn-home>"}),new Ally.RoutePath_v3({path:"Info/Docs",templateHtml:"<association-info></association-info>",menuTitle:"Documents & Info",reloadOnSearch:!1}),new Ally.RoutePath_v3({path:"Info/:viewName",templateHtml:"<association-info></association-info>"}),new Ally.RoutePath_v3({path:"Logbook",templateHtml:"<logbook-page></logbook-page>",menuTitle:"Calendar"}),new Ally.RoutePath_v3({path:"Map",templateHtml:"<chtn-map></chtn-map>",menuTitle:"Map"}),new Ally.RoutePath_v3({path:"BuildingResidents",templateHtml:"<group-members></group-members>",menuTitle:"Directory"}),new Ally.RoutePath_v3({path:"Committee/:committeeId/:viewName",templateHtml:"<committee-parent></committee-parent>"}),new Ally.RoutePath_v3({path:"Committee/:committeeId/Home/DiscussionThread/:discussionThreadId",templateHtml:"<committee-parent></committee-parent>"}),new Ally.RoutePath_v3({path:"ForgotPassword",templateHtml:"<forgot-password></forgot-password>",menuTitle:null,role:Role_All}),new Ally.RoutePath_v3({path:"Login",templateHtml:"<login-page></login-page>",menuTitle:null,role:Role_All}),new Ally.RoutePath_v3({path:"Help",templateHtml:"<help-form></help-form>",menuTitle:null,role:Role_All}),new Ally.RoutePath_v3({path:"SignUp",templateHtml:"<condo-sign-up-wizard></condo-sign-up-wizard>",menuTitle:null,role:Role_All}),new Ally.RoutePath_v3({path:"EmailAbuse/:idValue",templateHtml:"<email-abuse></email-abuse>",role:Role_All}),new Ally.RoutePath_v3({path:"DiscussionManage/:idValue",templateHtml:"<discussion-manage></discussion-manage>"}),new Ally.RoutePath_v3({path:"NeighborSignUp",templateHtml:"<neighbor-sign-up></neighbor-sign-up>",role:Role_All}),new Ally.RoutePath_v3({path:"GroupRedirect/:appName/:shortName",templateHtml:"<group-redirect></group-redirect>",role:Role_All}),new Ally.RoutePath_v3({path:"MemberSignUp",templateHtml:"<pending-member-sign-up></pending-member-sign-up>",menuTitle:null,role:Role_All}),new Ally.RoutePath_v3({path:"CPView/:slug",templateHtml:"<custom-page-view></custom-page-view>",menuTitle:null,role:Role_All}),new Ally.RoutePath_v3({path:"MyProfile",templateHtml:"<my-profile></my-profile>"}),new Ally.RoutePath_v3({path:"ManageResidents",templateHtml:"<manage-residents></manage-residents>",menuTitle:"Residents",role:Role_Manager}),new Ally.RoutePath_v3({path:"ManageCommittees",templateHtml:"<manage-committees></manage-committees>",menuTitle:"Committees",role:Role_Manager}),new Ally.RoutePath_v3({path:"ManagePolls",templateHtml:"<manage-polls></manage-polls>",menuTitle:"Polls",role:Role_Manager}),new Ally.RoutePath_v3({path:"Financials/OnlinePayments",templateHtml:"<financial-parent></financial-parent>",menuTitle:"Financials",role:Role_Manager}),new Ally.RoutePath_v3({path:"Mailing/Invoice",templateHtml:"<mailing-parent></mailing-parent>",menuTitle:"Mailing",role:Role_Manager}),new Ally.RoutePath_v3({path:"Mailing/:viewName",templateHtml:"<mailing-parent></mailing-parent>",role:Role_Manager}),new Ally.RoutePath_v3({path:"Settings/SiteSettings",templateHtml:"<settings-parent></settings-parent>",menuTitle:"Settings",role:Role_Manager}),new Ally.RoutePath_v3({path:"Settings/:viewName",templateHtml:"<settings-parent></settings-parent>",role:Role_Manager}),new Ally.RoutePath_v3({path:"Financials/:viewName",templateHtml:"<financial-parent></financial-parent>",role:Role_Manager}),new Ally.RoutePath_v3({path:"GroupAmenities",templateHtml:"<group-amenities></group-amenities>",role:Role_Manager}),new Ally.RoutePath_v3({path:"/Admin/ManageGroups",templateHtml:"<manage-groups></manage-groups>",menuTitle:"All Groups",role:Role_Admin}),new Ally.RoutePath_v3({path:"/Admin/ManageHomes",templateHtml:"<manage-homes></manage-homes>",menuTitle:"Homes",role:Role_Admin}),new Ally.RoutePath_v3({path:"/Admin/ViewActivityLog",templateHtml:"<view-activity-log></view-activity-log>",menuTitle:"Activity Log",role:Role_Admin}),new Ally.RoutePath_v3({path:"/Admin/ManageAddressPolys",templateHtml:"<manage-address-polys></manage-address-polys>",menuTitle:"View Groups on Map",role:Role_Admin}),new Ally.RoutePath_v3({path:"/Admin/ViewPolys",templateHtml:"<view-polys></view-polys>",menuTitle:"View Polygons",role:Role_Admin}),new Ally.RoutePath_v3({path:"/Admin/ViewResearch",templateHtml:"<view-research></view-research>",menuTitle:"View Research",role:Role_Admin})]},HomeAppConfig={appShortName:"home",appName:"Home Ally",baseTld:"homeally.org",baseUrl:"https://homeally.org/",isChtnSite:!1,homeName:"Home",memberTypeLabel:"User",menu:[new Ally.RoutePath_v3({path:"SignUp",templateHtml:"<home-sign-up></home-sign-up>",role:Role_All}),new Ally.RoutePath_v3({path:"ForgotPassword",templateHtml:"<forgot-password></forgot-password>",menuTitle:null,role:Role_All}),new Ally.RoutePath_v3({path:"Login",templateHtml:"<login-page></login-page>",menuTitle:null,role:Role_All}),new Ally.RoutePath_v3({path:"Help",templateHtml:"<help-form></help-form>",menuTitle:null,role:Role_All}),new Ally.RoutePath_v3({path:"CPView/:slug",templateHtml:"<custom-page-view></custom-page-view>",menuTitle:null,role:Role_All}),new Ally.RoutePath_v3({path:"MyProfile",templateHtml:"<my-profile></my-profile>"}),new Ally.RoutePath_v3({path:"Home",templateHtml:"<home-group-home></home-group-home>",menuTitle:"Home"}),new Ally.RoutePath_v3({path:"Info/Docs",templateHtml:"<association-info></association-info>",menuTitle:"Documents & Info"}),new Ally.RoutePath_v3({path:"Info/:viewName",templateHtml:"<association-info></association-info>"}),new Ally.RoutePath_v3({path:"Logbook",templateHtml:"<logbook-page></logbook-page>",menuTitle:"Calendar"}),new Ally.RoutePath_v3({path:"Users",templateHtml:"<home-users></home-users>",menuTitle:"Users",role:Role_Manager}),new Ally.RoutePath_v3({path:"/Admin/ViewActivityLog",templateHtml:"<view-activity-log></view-activity-log>",menuTitle:"View Activity Log",role:Role_Admin})]},HOAAppConfig=_.clone(CondoAllyAppConfig);HOAAppConfig.appShortName="hoa",HOAAppConfig.appName="HOA Ally",HOAAppConfig.baseTld="hoaally.org",HOAAppConfig.baseUrl="https://hoaally.org/",HOAAppConfig.homeName="Home",HOAAppConfig.menu.push(new Ally.RoutePath_v3({path:"HoaSignUp",templateHtml:"<hoa-sign-up-wizard></hoa-sign-up-wizard>",role:Role_All}));var NeighborhoodAppConfig=_.clone(CondoAllyAppConfig);NeighborhoodAppConfig.appShortName="neighborhood",NeighborhoodAppConfig.appName="Neighborhood Ally",NeighborhoodAppConfig.baseTld="neighborhoodally.org",NeighborhoodAppConfig.baseUrl="https://neighborhoodally.org/",NeighborhoodAppConfig.homeName="Home",NeighborhoodAppConfig.menu=_.reject(NeighborhoodAppConfig.menu,function(e){return"Residents"===e.menuTitle||"Directory"===e.menuTitle}),NeighborhoodAppConfig.menu.push(new Ally.RoutePath_v3({path:"BuildingResidents",templateHtml:"<group-members></group-members>",menuTitle:"Members"})),NeighborhoodAppConfig.menu.splice(0,0,new Ally.RoutePath_v3({path:"ManageResidents",templateHtml:"<manage-residents></manage-residents>",menuTitle:"Members",role:Role_Manager})),NeighborhoodAppConfig.menu=_.reject(NeighborhoodAppConfig.menu,function(e){return"Assessment History"===e.menuTitle}),NeighborhoodAppConfig.menu.splice(3,0,new Ally.RoutePath_v3({path:"DuesHistory",menuTitle:"Dues History",templateHtml:"<dues-history></dues-history>",role:Role_Manager})),NeighborhoodAppConfig.menu.push(new Ally.RoutePath_v3({path:"NeighborhoodSignUp",templateHtml:"<neighborhood-sign-up-wizard></neighborhood-sign-up-wizard>",role:Role_All}));var BlockClubAppConfig=_.clone(CondoAllyAppConfig);BlockClubAppConfig.appShortName="block-club",BlockClubAppConfig.appName="Block Club Ally",BlockClubAppConfig.baseTld="blockclubally.org",BlockClubAppConfig.baseUrl="https://blockclubally.org/",BlockClubAppConfig.homeName="Home",BlockClubAppConfig.memberTypeLabel="Member",BlockClubAppConfig.menu=_.reject(BlockClubAppConfig.menu,function(e){return"Residents"===e.menuTitle||"Directory"===e.menuTitle}),BlockClubAppConfig.menu.push(new Ally.RoutePath_v3({path:"BuildingResidents",templateHtml:"<group-members></group-members>",menuTitle:"Members"})),BlockClubAppConfig.menu.splice(0,0,new Ally.RoutePath_v3({path:"ManageResidents",templateHtml:"<manage-residents></manage-residents>",menuTitle:"Members",role:Role_Manager})),BlockClubAppConfig.menu=_.reject(BlockClubAppConfig.menu,function(e){return"Assessment History"===e.menuTitle}),BlockClubAppConfig.menu.splice(3,0,new Ally.RoutePath_v3({path:"AssessmentHistory",menuTitle:"Membership Dues History",templateHtml:"<assessment-history></assessment-history>",role:Role_Manager})),BlockClubAppConfig.menu.push(new Ally.RoutePath_v3({path:"NeighborhoodSignUp",templateHtml:"<neighborhood-sign-up-wizard></neighborhood-sign-up-wizard>",role:Role_All}));var PtaAppConfig=_.clone(CondoAllyAppConfig);PtaAppConfig.appShortName="pta",PtaAppConfig.appName="PTA Ally",PtaAppConfig.baseTld="ptaally.org",PtaAppConfig.baseUrl="https://ptaally.org/",PtaAppConfig.isChtnSite=!1,PtaAppConfig.homeName="Home",PtaAppConfig.memberTypeLabel="Member",PtaAppConfig.menu=[new Ally.RoutePath_v3({path:"Home",templateHtml:"<chtn-home></chtn-home>",menuTitle:"Home"}),new Ally.RoutePath_v3({path:"Info/Docs",templateHtml:"<association-info></association-info>",menuTitle:"Documents & Info"}),new Ally.RoutePath_v3({path:"Info/:viewName",templateHtml:"<association-info></association-info>"}),new Ally.RoutePath_v3({path:"Logbook",templateHtml:"<logbook-page></logbook-page>",menuTitle:"Calendar"}),new Ally.RoutePath_v3({path:"BuildingResidents",templateHtml:"<group-members></group-members>",menuTitle:"Members"}),new Ally.RoutePath_v3({path:"Committee/:committeeId/:viewName",templateHtml:"<committee-parent></committee-parent>"}),new Ally.RoutePath_v3({path:"ForgotPassword",templateHtml:"<forgot-password></forgot-password>",menuTitle:null,role:Role_All}),new Ally.RoutePath_v3({path:"Login",templateHtml:"<login-page></login-page>",menuTitle:null,role:Role_All}),new Ally.RoutePath_v3({path:"Help",templateHtml:"<help-form></help-form>",menuTitle:null,role:Role_All}),new Ally.RoutePath_v3({path:"MemberSignUp",templateHtml:"<pending-member-sign-up></pending-member-sign-up>",menuTitle:null,role:Role_All}),new Ally.RoutePath_v3({path:"MyProfile",templateHtml:"<my-profile></my-profile>"}),new Ally.RoutePath_v3({path:"ManageResidents",templateHtml:"<manage-residents></manage-residents>",menuTitle:"Members",role:Role_Manager}),new Ally.RoutePath_v3({path:"ManageCommittees",templateHtml:"<manage-committees></manage-committees>",menuTitle:"Committees",role:Role_Manager}),new Ally.RoutePath_v3({path:"ManagePolls",templateHtml:"<manage-polls></manage-polls>",menuTitle:"Polls",role:Role_Manager}),new Ally.RoutePath_v3({path:"AssessmentHistory",templateHtml:"<assessment-history></assessment-history>",menuTitle:"Membership Dues History",role:Role_Manager}),new Ally.RoutePath_v3({path:"Settings",templateHtml:"<chtn-settings></chtn-settings>",menuTitle:"Settings",role:Role_Manager}),new Ally.RoutePath_v3({path:"/Admin/ManageGroups",templateHtml:"<manage-groups></manage-groups>",menuTitle:"All Groups",role:Role_Admin}),new Ally.RoutePath_v3({path:"/Admin/ViewActivityLog",templateHtml:"<view-activity-log></view-activity-log>",menuTitle:"Activity Log",role:Role_Admin}),new Ally.RoutePath_v3({path:"/Admin/ManageAddressPolys",templateHtml:"<manage-address-polys></manage-address-polys>",menuTitle:"View Groups on Map",role:Role_Admin})];var AppConfig=null,lowerDomain=document.domain.toLowerCase();HtmlUtil.isNullOrWhitespace(OverrideOriginalUrl)||(lowerDomain=OverrideOriginalUrl),AppConfig=-1!==lowerDomain.indexOf("condo")?CondoAllyAppConfig:-1!==lowerDomain.indexOf("homeally")||-1!==lowerDomain.indexOf("helloathome")?HomeAppConfig:-1!==lowerDomain.indexOf("hoa")?HOAAppConfig:-1!==lowerDomain.indexOf("neighborhoodally")||-1!==lowerDomain.indexOf("helloneighborhood")?NeighborhoodAppConfig:-1!==lowerDomain.indexOf("chicagoblock")||-1!==lowerDomain.indexOf("blockclub")?BlockClubAppConfig:-1!==lowerDomain.indexOf("ptaally")?PtaAppConfig:(console.log("Unknown ally app"),CondoAllyAppConfig),(window.AppConfig=AppConfig).isPublicRoute=function(i){i||(i=window.location.hash),HtmlUtil.startsWith(i,"#!")&&(i=i.substr(2));var n=-1!==i.indexOf("/",1);n&&(i=i.substr(0,i.indexOf("/",1)));var e=_.find(AppConfig.menu,function(e){var t=e.path;return!!t&&(n&&-1!==t.indexOf("/",1)&&(t=t.substr(0,t.indexOf("/",1))),t===i)});return!!e&&e.role===Role_All},document.title=AppConfig.appName,$(document).ready(function(){$("header").css("background-image","url(/assets/images/header-img-"+AppConfig.appShortName+".jpg)")}),function(e){var t=function(){};(Ally||(Ally={})).DuesHistoryController=t}(),CA.angularApp.component("duesHistory",{templateUrl:"/ngApp/chtn/manager/dues-history.html",controller:Ally.DuesHistoryController});var __extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}}();!function(s){var e,t;(t=e||(e={}))[t.Monthly=50]="Monthly",t[t.Quarterly=51]="Quarterly",t[t.Semiannually=52]="Semiannually",t[t.Annually=53]="Annually";!function(e){function t(){return null!==e&&e.apply(this,arguments)||this}__extends(t,e)}(function(){this.isEmptyEntry=!1});var i=function(){function e(e,t,i,n){this.$http=e,this.$location=t,this.siteInfo=i,this.appCacheService=n,this.LocalStorageKey_ShowPaymentInfo="AssessmentHistory_ShowPaymentInfo",this.LocalStorageKey_ShouldColorCodePayments="AssessmentHistory_ColorCodePayment",this.NumPeriodsVisible=10,this.shouldShowCreateSpecialAssessment=!1,this.unitPayments={},this.showRowType="unit",this.isForMemberGroup=!1,this.isSavingPayment=!1,this.shouldColorCodePayments=!1,this.shouldShowFillInSection=!1,this.selectedFillInPeriod=null}return e.prototype.$onInit=function(){var t=this;this.baseApiUri=this.siteInfo.publicSiteInfo.baseApiUrl,this.isForMemberGroup="neighborhood"===AppConfig.appShortName||"block-club"===AppConfig.appShortName||"pta"===AppConfig.appShortName,this.isForMemberGroup?this.pageTitle="Membership Dues Payment History":this.pageTitle="Assessment Payment History",this.isForMemberGroup&&(this.NumPeriodsVisible=8),this.authToken=window.localStorage.getItem("ApiAuthToken"),this.isForMemberGroup?this.showRowType="member":AppConfig.isChtnSite?this.showRowType="unit":console.log("Unhandled app type for payment history: "+AppConfig.appShortName),this.showPaymentInfo="true"===window.localStorage[this.LocalStorageKey_ShowPaymentInfo],this.shouldColorCodePayments="true"===window.localStorage[this.LocalStorageKey_ShouldColorCodePayments];this.assessmentFrequency=this.siteInfo.privateSiteInfo.assessmentFrequency,this.isForMemberGroup&&(this.assessmentFrequency=53),this.payPeriodName="month",51===this.assessmentFrequency?this.payPeriodName="quarter":52===this.assessmentFrequency?this.payPeriodName="half-year":53===this.assessmentFrequency&&(this.payPeriodName="year"),this.maxPeriodRange=12,51===this.assessmentFrequency?this.maxPeriodRange=4:52===this.assessmentFrequency?this.maxPeriodRange=2:53===this.assessmentFrequency&&(this.maxPeriodRange=1),this.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];this.periodNames=this.monthNames,this.shortPeriodNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],51===this.assessmentFrequency?(this.periodNames=["Quarter 1","Quarter 2","Quarter 3","Quarter 4"],this.shortPeriodNames=["Q1","Q2","Q3","Q4"]):52===this.assessmentFrequency?(this.periodNames=["First Half","Second Half"],this.shortPeriodNames=["1st Half","2nd Half"]):53===this.assessmentFrequency&&(this.periodNames=[""],this.shortPeriodNames=[""]),this.startPeriodValue=(new Date).getMonth()+2,this.startYearValue=(new Date).getFullYear(),51===this.assessmentFrequency?this.startPeriodValue=Math.floor((new Date).getMonth()/4)+2:52===this.assessmentFrequency?this.startPeriodValue=Math.floor((new Date).getMonth()/6)+2:53===this.assessmentFrequency&&(this.startPeriodValue=1,this.startYearValue=(new Date).getFullYear()+1),this.startPeriodValue>this.maxPeriodRange&&(this.startPeriodValue=1,this.startYearValue+=1),this.isPeriodicPaymentTrackingEnabled=this.siteInfo.privateSiteInfo.isPeriodicPaymentTrackingEnabled,this.retrievePaymentHistory(),window.setTimeout(function(){return t.$http.get("/api/DocumentLink/0").then(function(e){return t.viewExportViewId=e.data.vid})},250)},e.prototype.onChangePeriodicPaymentTracking=function(){var e=this;this.isPeriodicPaymentTrackingEnabled!==this.siteInfo.privateSiteInfo.isPeriodicPaymentTrackingEnabled&&(this.isPeriodicPaymentTrackingEnabled,this.siteInfo.privateSiteInfo.isPeriodicPaymentTrackingEnabled=this.isPeriodicPaymentTrackingEnabled,this.isLoading=!0,this.$http.put("/api/Association/updatePeriodicPaymentTracking?isPeriodicPaymentTrackingEnabled="+this.isPeriodicPaymentTrackingEnabled,null).then(function(){e.isLoading=!1},function(){alert("Failed to update the payment tracking"),e.isLoading=!1}))},e.prototype.fillInEmptyPaymentsForUnit=function(e){for(var t=null!==e.owners&&0<e.owners.length?e.owners[0].userId:null,i=[],n=this.startPeriodValue,o=this.startYearValue,s=0;s<this.NumPeriodsVisible;++s){n<1&&(n=this.maxPeriodRange,--o);var a=_.find(e.allPayments,function(e){return e.period===n&&e.year===o});(void 0===a||a.isEmptyEntry)&&(a={isPaid:!1,period:n,year:o,amount:e.assessment,payerUserId:t,paymentDate:new Date,isEmptyEntry:!0}),i.push(a),n--}return i},e.prototype.fillInEmptyPaymentsForMember=function(e){for(var t=[],i=this.startPeriodValue,n=this.startYearValue,o=0;o<this.NumPeriodsVisible;++o){i<1&&(i=this.maxPeriodRange,--n);var s=_.find(e.enteredPayments,function(e){return e.period===i&&e.year===n});(void 0===s||s.isEmptyEntry)&&(s={isPaid:!1,paymentId:null,period:i,year:n,amount:0,payerUserId:e.userId,paymentDate:new Date,isEmptyEntry:!0,wePayCheckoutId:null,checkNumber:null,notes:null,payerNotes:null,wePayStatus:null,groupId:null,paymentsInfoId:null}),t.push(s),i--}return t},e.prototype.viewWePayDetails=function(e){this.appCacheService.set("hwpid",e),this.$location.path("/Financials/OnlinePayments")},e.prototype.viewOnlinePaymentDetails=function(e){this.appCacheService.set("onpayid",e.toString()),this.$location.path("/Financials/OnlinePayments")},e.prototype.addSpecialAssessment=function(){var i=this;this.createSpecialAssessment=parseInt(this.createSpecialAssessment)+1,this.isLoading=!0,this.$http.post("/api/PaymentHistory/SpecialAssessment",this.createSpecialAssessment).then(function(){i.isLoading=!1,i.shouldShowCreateSpecialAssessment=!1,i.retrievePaymentHistory()},function(e){i.isLoading=!1;var t=e.data.exceptionMessage?e.data.exceptionMessage:e.data;alert("Failed to add special assessment: "+t)})},e.prototype.showCreateSpecialAssessment=function(){this.shouldShowCreateSpecialAssessment=!0,this.createSpecialAssessment={year:(new Date).getFullYear(),month:(new Date).getMonth().toString(),notes:"",amount:null}},e.prototype.browsePast=function(){for(this.startPeriodValue=this.startPeriodValue-6;this.startPeriodValue<1;)this.startPeriodValue=this.maxPeriodRange+this.startPeriodValue,--this.startYearValue;this.displayPaymentsForRange(this.startYearValue,this.startPeriodValue)},e.prototype.browseFuture=function(){for(this.startPeriodValue=this.startPeriodValue+6;this.startPeriodValue>this.maxPeriodRange;)this.startPeriodValue-=this.maxPeriodRange,++this.startYearValue;this.displayPaymentsForRange(this.startYearValue,this.startPeriodValue)},e.prototype.displayPaymentsForRange=function(e,t){var i=this;this.startYearValue=e,this.startPeriodValue=t,this.visiblePeriodNames=[];for(var n=this.startYearValue,o=this.startPeriodValue,s=0;s<this.NumPeriodsVisible;++s){o<1&&(o=this.maxPeriodRange,--n);var a=this.shortPeriodNames[o-1];1!==o&&o!==this.maxPeriodRange||(a+=" "+n),this.isForMemberGroup&&(a=n+" - "+(n+1)),this.visiblePeriodNames.push({name:a,periodIndex:o,arrayIndex:s,year:n}),--o}this.isForMemberGroup?_.each(this.payers,function(e){return e.displayPayments=i.fillInEmptyPaymentsForMember(e)}):_.each(this.unitPayments,function(e){return e.payments=i.fillInEmptyPaymentsForUnit(e)})},e.prototype.retrievePaymentHistory=function(){var o=this;this.isLoading=!0,this.$http.get("/api/PaymentHistory?oldestDate=").then(function(e){var i=e.data;o.shouldShowFillInSection=o.siteInfo.userInfo.isAdmin||i.payments.length<2&&3<i.units.length,o.unitPayments={},_.each(i.units,function(e){o.unitPayments[e.unitId]=e;var t=o.unitPayments[e.unitId];for(t.displayOwners=_.first(e.owners,2);t.displayOwners.length<2;)t.displayOwners.push({name:""});t.payments=[]}),o.isForMemberGroup&&e.data.payers&&_.each(e.data.payers,function(t){t.enteredPayments=_.filter(i.payments,function(e){return e.payerUserId===t.userId})}),_.each(i.payments,function(e){o.unitPayments[e.unitId]&&o.unitPayments[e.unitId].payments.push(e)}),_.each(i.units,function(e){e.allPayments=e.payments});var t=[];for(var n in o.unitPayments)t.push(o.unitPayments[n]);o.unitPayments=s.HtmlUtil2.smartSortStreetAddresses(t,"name"),o.payers=_.sortBy(i.payers,function(e){return e.name}),o.displayPaymentsForRange(o.startYearValue,o.startPeriodValue),o.isLoading=!1},function(e){o.isLoading=!1,alert("Failed to retrieve payment history: "+e.data.exceptionMessage)})},e.prototype.getPaymentSumForPayPeriod=function(e){var t=0;if(AppConfig.isChtnSite)for(var i=_.keys(this.unitPayments),n=0;n<i.length;++n){var o=i[n];(s=this.unitPayments[o].payments[e])&&s.isPaid&&(t+=s.amount)}else for(n=0;n<this.payers.length;++n){var s;(s=this.payers[n].displayPayments[e])&&s.isPaid&&(t+=s.amount)}return t},e.prototype.onshowPaymentInfo=function(){window.localStorage[this.LocalStorageKey_ShowPaymentInfo]=this.showPaymentInfo,window.localStorage[this.LocalStorageKey_ShouldColorCodePayments]=this.shouldColorCodePayments},e.prototype.onUnitPaymentCellClick=function(e,t){t.unitId=e.unitId,this.editPayment={unit:e,payment:_.clone(t),periodName:this.periodNames[t.period-1],filteredPayers:_.filter(this.payers,function(t){return!_.some(e.owners,function(e){return e.userId===t.userId})})},setTimeout(function(){$("#paid-amount-textbox").focus()},10)},e.prototype.onMemberPaymentCellClick=function(e,t){t.payerUserId=e.userId,this.editPayment={unit:null,payment:_.clone(t),periodName:this.periodNames[t.period-1],filteredPayers:null},setTimeout(function(){$("#paid-amount-textbox").focus()},10)},e.prototype.onSavePayment=function(){var t=this,e=function(){t.isSavingPayment=!1,t.editPayment=null,t.retrievePaymentHistory()},i=function(e){t.isSavingPayment=!1,alert(e.data.message),t.editPayment=null};this.isSavingPayment=!0,this.editPayment.payment.paymentId?(analytics.track("editAssessmentHistoryPayment"),this.$http.put("/api/PaymentHistory",this.editPayment.payment).then(e,i)):(analytics.track("addAssessmentHistoryPayment"),this.$http.post("/api/PaymentHistory",this.editPayment.payment).then(e,i))},e.prototype.populatePaidForPeriod=function(){var o=this;if(this.selectedFillInPeriod){var s=_.keys(this.unitPayments);this.isLoading=!0;for(var a=0,e=function(e){var t=r.unitPayments[s[e]],i=_.find(t.payments,function(e){return e.year===o.selectedFillInPeriod.year&&e.period===o.selectedFillInPeriod.periodIndex});if(i&&i.isPaid)return"continue";var n={Year:r.selectedFillInPeriod.year,Period:r.selectedFillInPeriod.periodIndex,IsPaid:!0,Amount:t.assessment||0,PaymentDate:new Date,PayerUserId:r.siteInfo.userInfo.userId,Notes:"Auto-marking all entries for "+r.selectedFillInPeriod.name,unitId:t.unitId};++a,window.setTimeout(function(){return o.$http.post("/api/PaymentHistory",n)},350*a)},r=this,t=0;t<s.length;++t)e(t);window.setTimeout(function(){o.isLoading=!1,o.retrievePaymentHistory()},350*(a+1))}},e.prototype.onExportClick=function(e){var t=this;return window.setTimeout(function(){return t.$http.get("/api/DocumentLink/0").then(function(e){return t.viewExportViewId=e.data.vid})},500),analytics.track("exportAssessment"+e),!0},e.$inject=["$http","$location","SiteInfo","appCacheService"],e}();s.AssessmentHistoryController=i}(Ally||(Ally={})),CA.angularApp.component("assessmentHistory",{templateUrl:"/ngApp/chtn/manager/financial/assessment-history.html",controller:Ally.AssessmentHistoryController});__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}}();!function(e){var t=function(){function p(e,t,i,n){this.$http=e,this.appCacheService=t,this.uiGridConstants=i,this.$rootScope=n,this.isLoading=!1,this.financialCategoryMap=new Map,this.totalExpense=0,this.totalIncome=0,this.EditAmountTemplate="<div class='ui-grid-cell-contents'><span data-ng-if='row.entity.hasChildren'>{{row.entity.amount | currency}}</span><span data-ng-if='!row.entity.hasChildren'>$<input type='number' style='width: 85%;' data-ng-model='row.entity.amount' data-ng-change='grid.appScope.$ctrl.onAmountChange(row.entity)' /></span></div>"}return p.prototype.$onInit=function(){var t=this;this.expenseGridOptions={columnDefs:[{field:"categoryTreeLabel",displayName:"Category",width:"*"},{field:"amount",displayName:"Amount",width:120,type:"number",cellFilter:"currency",cellTemplate:this.EditAmountTemplate}],enableHorizontalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableVerticalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableColumnMenus:!1,enableRowHeaderSelection:!1,showTreeExpandNoChildren:!1,treeIndent:20,enableSorting:!1,enableTreeView:!0,showTreeRowHeader:!0,onRegisterApi:function(e){t.expenseGridApi=e,HtmlUtil.uiGridFixScroll(),t.expenseGridApi.treeBase.on.rowExpanded(t.$rootScope,function(e){})}},this.incomeGridOptions=_.clone(this.expenseGridOptions),this.incomeGridOptions.onRegisterApi=function(e){t.incomeGridApi=e,HtmlUtil.uiGridFixScroll()},this.refreshData()},p.prototype.refreshData=function(){var n=this;this.isLoading=!0,this.$http.get("/api/Budget/PageData").then(function(e){n.isLoading=!1,n.budgets=e.data.budgets,n.rootFinancialCategory=e.data.rootFinancialCategory,n.financialCategoryMap.clear();var i=function(e){if(n.financialCategoryMap.set(e.financialCategoryId,e),e.childCategories)for(var t=0;t<e.childCategories.length;++t)i(e.childCategories[t])};i(n.rootFinancialCategory)},function(e){n.isLoading=!1,alert("Failed to retrieve data, try refreshing the page. If the problem persists, contact support: "+e.data.exceptionMessage)})},p.prototype.onAmountChange=function(e){if(e)for(var t=e.parentRow;t;)t.amount=_.reduce(t.childRows,function(e,t){return e+t.amount},0),t=t.parentRow;var i=_.find(this.curBudget.budgetRows,function(e){return!e.parentRow&&"Income"===e.category.displayName});this.totalIncome=i.amount;var n=this.curBudget.budgetRows.filter(function(e){return!e.parentRow&&"Income"!==e.category.displayName});this.totalExpense=_.reduce(n,function(e,t){return e+t.amount},0)},p.prototype.createBudget=function(){var d=this;this.curBudget=new i,this.curBudget.budgetName="Unnamed",this.curBudget.budgetRows=[],this.expenseGridOptions.columnDefs.find(function(e){return"amount"===e.field}).cellTemplate=this.EditAmountTemplate;var c=function(t,e,i){var n=null!=t.childCategories&&0<t.childCategories.length;if(i=0===e&&"Income"===t.displayName||i,t.displayName){var o=i?e-1:e,s=p.catToTreePrefix(o),a=_.find(d.curBudget.budgetRows,function(e){return e.category.financialCategoryId===t.parentFinancialCategoryId}),r={financialCategoryId:t.financialCategoryId,categoryDisplayName:t.displayName,categoryTreeLabel:s+t.displayName,amount:0,$$treeLevel:o,hasChildren:n,category:t,parentRow:a,childRows:[],isIncomeRow:i,parentBudgetRowId:null};a&&r.parentRow.childRows.push(r),d.curBudget.budgetRows.push(r)}if(n)for(var l=0;l<t.childCategories.length;++l)c(t.childCategories[l],e+1,i)};c(this.rootFinancialCategory,-1,!1),this.refreshGridsFromCurBudget()},p.catToTreePrefix=function(e){return e<1?"":Array(4*(e-1)).join(String.fromCharCode(160))+"|--"},p.prototype.loadBudget=function(e){var o,s=this,a=function(e,t){return void 0===t&&(t=0),e&&e.parentFinancialCategoryId&&s.financialCategoryMap.has(e.parentFinancialCategoryId)?a(s.financialCategoryMap.get(e.parentFinancialCategoryId),t+1):t},t=this.expenseGridOptions.columnDefs.find(function(e){return"amount"===e.field});e.finalizedDateUtc?t.cellTemplate=null:t.cellTemplate=this.EditAmountTemplate,o=e.rows.map(function(e){var t=s.financialCategoryMap.has(e.financialCategoryId)?s.financialCategoryMap.get(e.financialCategoryId):void 0,i=a(t),n=p.catToTreePrefix(i);return{amount:e.amount,categoryDisplayName:e.categoryDisplayName,financialCategoryId:e.financialCategoryId,budgetId:e.budgetId,budgetRowId:e.budgetRowId,$$treeLevel:i,category:t,childRows:[],categoryTreeLabel:n+(t?t.displayName:e.categoryDisplayName),hasChildren:!1,isIncomeRow:!1,parentRow:null,parentBudgetRowId:e.parentBudgetRowId}});for(var i=function(e){var t=o[e],i=t.category;if(i){if(t.hasChildren=i.childCategories&&0<i.childCategories.length,t.hasChildren){var n=_.map(i.childCategories,function(e){return e.financialCategoryId});t.childRows=o.filter(function(e){return 0<=n.indexOf(e.financialCategoryId)})}i.parentFinancialCategoryId&&(t.parentRow=_.find(o,function(e){return e.financialCategoryId===i.parentFinancialCategoryId}))}else t.parentBudgetRowId&&(t.parentRow=_.find(o,function(e){return e.budgetRowId===t.parentBudgetRowId}),t.childRows=o.filter(function(e){return e.parentBudgetRowId===t.budgetRowId}))},n=0;n<o.length;++n)i(n);var r=this.rootFinancialCategory.childCategories.find(function(e){return"Income"===e.displayName}),l=o.find(function(e){return e.financialCategoryId===r.financialCategoryId}),d=function(e){e.isIncomeRow=!0,--e.$$treeLevel,e.categoryTreeLabel=p.catToTreePrefix(e.$$treeLevel)+e.categoryDisplayName,e.childRows&&e.childRows.forEach(function(e){return d(e)})};d(l),this.curBudget={budgetId:e.budgetId,budgetName:e.budgetName,budgetRows:o},this.refreshGridsFromCurBudget()},p.prototype.refreshGridsFromCurBudget=function(){var e=this,t=this.curBudget.budgetRows.filter(function(e){return 0<=e.$$treeLevel&&e.isIncomeRow});this.incomeGridOptions.data=t,this.incomeGridOptions.minRowsToShow=t.length,this.incomeGridOptions.virtualizationThreshold=t.length;var i=this.curBudget.budgetRows.filter(function(e){return!e.isIncomeRow});this.expenseGridOptions.data=i,this.expenseGridOptions.minRowsToShow=i.length,this.expenseGridOptions.virtualizationThreshold=i.length,window.setTimeout(function(){e.expenseGridApi.treeBase.expandAllRows(),e.incomeGridApi.treeBase.expandAllRows()},50),this.onAmountChange(null)},p.prototype.closeBudget=function(){this.curBudget=null,this.selectedBudget=null,this.incomeGridOptions.data=[],this.expenseGridOptions.data=[]},p.prototype.saveBudget=function(){this.curBudget.budgetId?this.saveExistingBudget():this.saveNewBudget()},p.prototype.saveExistingBudget=function(t){var i=this;void 0===t&&(t=!0),this.isLoading=!0;var e={budgetId:this.curBudget.budgetId,budgetName:this.curBudget.budgetName,rows:_.map(this.curBudget.budgetRows,function(e){return{budgetRowId:e.budgetRowId,amount:e.amount,financialCategoryId:e.financialCategoryId}})};return this.$http.put("/api/Budget",e).then(function(e){i.isLoading=!1,t&&i.completeRefresh()},function(e){return i.isLoading=!1,alert("Failed to save: "+e.data.exceptionMessage),Promise.reject(null)})},p.prototype.saveNewBudget=function(){var t=this;this.isLoading=!0;var e={budgetId:0,budgetName:this.curBudget.budgetName,rows:_.map(this.curBudget.budgetRows,function(e){return{budgetRowId:0,amount:e.amount,financialCategoryId:e.financialCategoryId}})};this.$http.post("/api/Budget",e).then(function(e){t.isLoading=!1,t.completeRefresh()},function(e){t.isLoading=!1,alert("Failed to retrieve data, try refreshing the page. If the problem persists, contact support: "+e.data.exceptionMessage)})},p.prototype.onBudgetSelected=function(){this.selectedBudget&&this.loadBudget(this.selectedBudget)},p.prototype.deleteBudget=function(){var t=this;confirm("Are you sure you want to deleted this budget?")&&(this.isLoading=!0,this.$http.delete("/api/Budget/"+this.curBudget.budgetId).then(function(e){t.isLoading=!1,t.completeRefresh()},function(e){t.isLoading=!1,alert("Failed to delete, try refreshing the page. If the problem persists, contact support: "+e.data.exceptionMessage)}))},p.prototype.completeRefresh=function(){this.curBudget=null,this.selectedBudget=null,this.incomeGridOptions.data=[],this.expenseGridOptions.data=[],this.refreshData()},p.prototype.finalizeBudget=function(){var t=this;confirm("This makes the budget permanently read-only. Are you sure you want to finalize the budget?")&&(this.isLoading=!0,this.saveExistingBudget(!1).then(function(){t.$http.put("/api/Budget/Finalize/"+t.curBudget.budgetId,null).then(function(e){t.isLoading=!1,t.curBudget=null,t.selectedBudget=null,t.incomeGridOptions.data=[],t.expenseGridOptions.data=[],t.completeRefresh()},function(e){t.isLoading=!1,alert("Failed to finalize, try refreshing the page. If the problem persists, contact support: "+e.data.exceptionMessage)})},function(e){t.isLoading=!1}))},p.$inject=["$http","appCacheService","uiGridConstants","$rootScope"],p}();e.BudgetToolController=t;var i=function(){};!function(e){function t(){return null!==e&&e.apply(this,arguments)||this}__extends(t,e)}(function(){})}(Ally||(Ally={})),CA.angularApp.component("budgetTool",{bindings:{},templateUrl:"/ngApp/chtn/manager/financial/budget-tool.html",controller:Ally.BudgetToolController}),function(e){var t=function(){function e(e,t,i,n){this.$http=e,this.siteInfo=t,this.appCacheService=i,this.$rootScope=n,this.isLoading=!1,this.selectedCategory=null,this.newCategoryParent=null,this.deleteCategoryRessignTo=null,this.shouldShowNewCategoryArea=!1,this.shouldShowDeleteCategoryArea=!1,this.didMakeChanges=!1,this.preselectById=null}return e.prototype.$onInit=function(){this.refresh()},e.prototype.refresh=function(){var s=this;this.isLoading=!0,this.$http.get("/api/Ledger/FinancialCategories").then(function(e){s.isLoading=!1,s.rootFinancialCategory=e.data,s.flatCategoryList=[];var o=function(e,t){if(e.displayName){var i="";1<t&&(i=Array(4*(t-2)).join(String.fromCharCode(160))+"|--"),e.dropDownLabel=i+e.displayName,s.flatCategoryList.push(e)}if(null!=e.childCategories&&0!=e.childCategories.length)for(var n=0;n<e.childCategories.length;++n)o(e.childCategories[n],t+1)};if(o(s.rootFinancialCategory,0),s.selectedCategory=s.flatCategoryList[0],s.preselectById){var t=s.flatCategoryList.filter(function(e){return e.financialCategoryId===s.preselectById});t&&0<t.length&&(s.selectedCategory=t[0]),s.preselectById=null}s.onCategorySelected()},function(e){s.isLoading=!1,alert("Failed to retrieve data, try refreshing the page. If the problem persists, contact support: "+e.data.exceptionMessage)})},e.prototype.onCategorySelected=function(){this.editName=this.selectedCategory?this.selectedCategory.displayName:""},e.prototype.closeManager=function(){this.onClosed({didMakeChanges:this.didMakeChanges})},e.prototype.showNewCategoryArea=function(){this.shouldShowNewCategoryArea=!0,this.shouldShowDeleteCategoryArea=!1,this.newName="",this.newCategoryParent=null},e.prototype.updateCategoryName=function(){var t=this;if(this.editName){this.isLoading=!0;var e="/api/Ledger/FinancialCategory/UpdateName/"+this.selectedCategory.financialCategoryId+"?newName="+encodeURIComponent(this.editName);this.$http.put(e,null).then(function(e){t.isLoading=!1,t.didMakeChanges=!0,t.shouldShowNewCategoryArea=!1,t.newName="",t.preselectById=t.selectedCategory.financialCategoryId,t.refresh()},function(e){t.isLoading=!1,alert("Failed to update: "+e.data.exceptionMessage)})}else alert("Please enter a name")},e.prototype.saveNewCategory=function(){var t=this;if(this.newName){this.isLoading=!0;var e="/api/Ledger/FinancialCategory/Add?name="+encodeURIComponent(this.newName);this.newCategoryParent&&(e+="&parentCategoryId="+this.newCategoryParent.financialCategoryId),this.$http.post(e,null).then(function(e){t.isLoading=!1,t.didMakeChanges=!0,t.preselectById=e.data,t.shouldShowNewCategoryArea=!1,t.refresh()},function(e){t.isLoading=!1,alert("Failed to save: "+e.data.exceptionMessage)})}else alert("Please enter a name")},e.prototype.deleteCategory=function(){var t=this;if("Income"!==this.selectedCategory.displayName){this.isLoading=!0;var e="/api/Ledger/FinancialCategory/"+this.selectedCategory.financialCategoryId;this.deleteCategoryRessignTo&&(e+="?reassignToCategoryId="+this.deleteCategoryRessignTo.financialCategoryId),this.$http.delete(e).then(function(e){t.isLoading=!1,t.didMakeChanges=!0,t.shouldShowDeleteCategoryArea=!1,t.refresh()},function(e){t.isLoading=!1,alert("Failed to delete: "+e.data.exceptionMessage)})}else alert("You cannot delete the income category")},e.$inject=["$http","SiteInfo","appCacheService","$rootScope"],e}();e.FinancialCategoryManagerController=t}(Ally||(Ally={})),CA.angularApp.component("financialCategoryManager",{bindings:{onClosed:"&"},templateUrl:"/ngApp/chtn/manager/financial/financial-category-manager.html",controller:Ally.FinancialCategoryManagerController}),function(e){var t=function(){function e(e,t,i,n,o){this.$http=e,this.siteInfo=t,this.$routeParams=i,this.$cacheFactory=n,this.$rootScope=o,this.selectedView=null,this.isLoading=!1}return e.prototype.$onInit=function(){HtmlUtil.isValidString(this.$routeParams.viewName)?this.selectedView=this.$routeParams.viewName:this.selectedView="OnlinePayments"},e.$inject=["$http","SiteInfo","$routeParams","$cacheFactory","$rootScope"],e}();e.FinancialParentController=t}(Ally||(Ally={})),CA.angularApp.component("financialParent",{templateUrl:"/ngApp/chtn/manager/financial/financial-parent.html",controller:Ally.FinancialParentController}),function(e){var t=function(){function e(e,t,i,n){this.$http=e,this.siteInfo=t,this.appCacheService=i,this.$location=n,this.isLoading=!1,this.incomeByCategoryData=null,this.incomeByCategoryLabels=null,this.incomeByCategoryCatIds=null,this.expenseByCategoryData=null,this.expenseByCategoryLabels=null,this.expenseByCategoryCatIds=null}return e.prototype.$onInit=function(){this.startDate=moment().subtract(30,"days").toDate(),this.endDate=moment().toDate();var o=this;this.doughnutChartOptions={onClick:function(e){var t=this.getElementAtEvent(e);if(t.length){var i=t[0],n=void 0;n="expense-category-chart"===e.target.id?o.expenseByCategoryCatIds[i._index]:(console.log("Clicked on income category: "+o.incomeByCategoryLabels[i._index]),o.incomeByCategoryCatIds[i._index]),o.appCacheService.set("ledger_preselect_start",o.startDate.getTime().toString()),o.appCacheService.set("ledger_preselect_end",o.endDate.getTime().toString()),o.appCacheService.set("ledger_preselect_categoryId",n.toString()),window.location.href="/#!/Financials/BankTransactions"}}},this.refreshData()},e.prototype.refreshData=function(){var t=this;this.isLoading=!0,this.$http.get("/api/FinancialReports/ChartData?startDate="+encodeURIComponent(this.startDate.toISOString())+"&endDate="+encodeURIComponent(this.endDate.toISOString())).then(function(e){t.isLoading=!1,t.reportData=e.data,t.incomeByCategoryData=_.map(t.reportData.incomeByCategory,function(e){return e.amount}),t.incomeByCategoryLabels=_.map(t.reportData.incomeByCategory,function(e){return e.parentFinancialCategoryName}),t.incomeByCategoryCatIds=_.map(t.reportData.incomeByCategory,function(e){return e.parentFinancialCategoryId}),t.expenseByCategoryData=_.map(t.reportData.expenseByCategory,function(e){return e.amount}),t.expenseByCategoryLabels=_.map(t.reportData.expenseByCategory,function(e){return e.parentFinancialCategoryName}),t.expenseByCategoryCatIds=_.map(t.reportData.expenseByCategory,function(e){return e.parentFinancialCategoryId})},function(e){t.isLoading=!1,alert("Failed to retrieve report data: "+e.data.exceptionMessage)})},e.prototype.onByCategoryClickChart=function(e,t){if(e&&0!==e.length){var i="expense-category-chart"===e[0]._chart.canvas.id;console.log("Clicked",i,e[0],t),i?console.log("Clicked on expense category: "+this.expenseByCategoryLabels[e[0]._index]):console.log("Clicked on income category: "+this.incomeByCategoryLabels[e[0]._index])}},e.$inject=["$http","SiteInfo","appCacheService","$location"],e}();e.FinancialReportsController=t}(Ally||(Ally={})),CA.angularApp.component("financialReports",{templateUrl:"/ngApp/chtn/manager/financial/financial-reports.html",controller:Ally.FinancialReportsController});__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}}();!function(i){var e=function(){function e(e,t,i,n,o,s){this.$http=e,this.siteInfo=t,this.appCacheService=i,this.uiGridConstants=n,this.$rootScope=o,this.$timeout=s,this.isLoading=!1,this.isLoadingEntries=!1,this.shouldExpandPending=!1,this.ledgerAccounts=[],this.accountsNeedingLogin=[],this.shouldShowAddTransaction=!1,this.editAccount=null,this.editingTransaction=null,this.createAccountInfo=null,this.HistoryPageSize=50,this.plaidHandler=null,this.newPlaidAccounts=[],this.hasPlaidAccounts=!1,this.filter=new a,this.isPremiumPlanActive=!1,this.ManageCategoriesDropId=-15,this.shouldShowCategoryEditModal=!1,this.spendingChartData=null,this.spendingChartLabels=null,this.showDonut=!0,this.isSuperAdmin=!1,this.shouldShowImportModal=!1,this.shouldShowOwnerFinanceTxn=!1}return e.prototype.$onInit=function(){var a=this;this.isPremiumPlanActive=this.siteInfo.privateSiteInfo.isPremiumPlanActive,this.isSuperAdmin=this.siteInfo.userInfo.isAdmin,this.homeName=AppConfig.homeName||"Unit",this.shouldShowOwnerFinanceTxn=this.siteInfo.privateSiteInfo.shouldShowOwnerFinanceTxn,this.ledgerGridOptions={columnDefs:[{field:"transactionDate",displayName:"Date",width:70,type:"date",cellFilter:"date:'shortDate'",enableFiltering:!1},{field:"accountName",filter:{type:this.uiGridConstants.filter.SELECT,selectOptions:[]},displayName:"Account",enableCellEdit:!1,width:140,enableFiltering:!0},{field:"description",displayName:"Description",enableCellEditOnFocus:!0,enableFiltering:!0,filter:{placeholder:"search"}},{field:"categoryDisplayName",editModelField:"financialCategoryId",displayName:"Category",width:170,editableCellTemplate:"ui-grid/dropdownEditor",editDropdownOptionsArray:[],enableFiltering:!0},{field:"unitGridLabel",editModelField:"associatedUnitId",displayName:this.homeName,width:120,editableCellTemplate:"ui-grid/dropdownEditor",editDropdownOptionsArray:[],enableFiltering:!0},{field:"amount",displayName:"Amount",width:95,type:"number",cellFilter:"currency",enableFiltering:!0,aggregationType:this.uiGridConstants.aggregationTypes.sum},{field:"id",displayName:"Actions",enableSorting:!1,enableCellEdit:!1,enableFiltering:!1,width:90,cellTemplate:'<div class="ui-grid-cell-contents text-center"><img style="cursor: pointer;" data-ng-click="grid.appScope.$ctrl.editEntry( row.entity )" src="/assets/images/pencil-active.png" /><span class="close-x mt-0 mb-0 ml-3" data-ng-click="grid.appScope.$ctrl.deleteEntry( row.entity )" style="color: red;">&times;</span></div>'}],enableFiltering:!0,enableSorting:!0,showColumnFooter:!0,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableVerticalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableColumnMenus:!1,enablePaginationControls:!0,paginationPageSize:this.HistoryPageSize,paginationPageSizes:[this.HistoryPageSize],enableRowHeaderSelection:!1,onRegisterApi:function(e){a.ledgerGridApi=e,HtmlUtil.uiGridFixScroll(),e.edit.on.afterCellEdit(a.$rootScope,function(t,e,i,n){if(console.log("edited row amount:"+t.amount+" Column",e," newValue:"+i+" oldValue:"+n),n!==i){if("categoryDisplayName"===e.field&&t.financialCategoryId===a.ManageCategoriesDropId)return t.financialCategoryId=n,void(a.shouldShowCategoryEditModal=!0);var o=a.flatCategoryList.find(function(e){return e.financialCategoryId===t.financialCategoryId});t.categoryDisplayName=o?o.displayName:null;var s=a.allUnits.find(function(e){return e.unitId===t.associatedUnitId});t.unitGridLabel=s?s.name:null,a.$http.put("/api/Ledger/UpdateEntry",t).then(function(){return a.regenerateDateDonutChart()})}})}},this.pendingGridOptions={columnDefs:[{field:"transactionDate",displayName:"Date",width:70,type:"date",cellFilter:"date:'shortDate'",enableFiltering:!1},{field:"accountName",filter:{type:this.uiGridConstants.filter.SELECT,selectOptions:[]},displayName:"Account",enableCellEdit:!1,width:140,enableFiltering:!0},{field:"description",displayName:"Description",enableCellEditOnFocus:!0,enableFiltering:!0,filter:{placeholder:"search"}},{field:"amount",displayName:"Amount",width:95,type:"number",cellFilter:"currency",enableFiltering:!0,aggregationType:this.uiGridConstants.aggregationTypes.sum}],enableSorting:!0,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableVerticalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableColumnMenus:!1,enablePaginationControls:!1,enableRowHeaderSelection:!1},this.previewImportGridOptions={columnDefs:[{field:"transactionDate",displayName:"Date",width:70,type:"date",cellFilter:"date:'shortDate'",enableFiltering:!1},{field:"description",displayName:"Description",enableCellEditOnFocus:!0,enableFiltering:!0,filter:{placeholder:"search"}},{field:"categoryDisplayName",editModelField:"financialCategoryId",displayName:"Category",width:170,editableCellTemplate:"ui-grid/dropdownEditor",editDropdownOptionsArray:[],enableFiltering:!0},{field:"unitGridLabel",editModelField:"associatedUnitId",displayName:this.homeName,width:120,editableCellTemplate:"ui-grid/dropdownEditor",editDropdownOptionsArray:[],enableFiltering:!0},{field:"amount",displayName:"Amount",width:95,type:"number",cellFilter:"currency",enableFiltering:!0,aggregationType:this.uiGridConstants.aggregationTypes.sum},{field:"id",displayName:"",enableSorting:!1,enableCellEdit:!1,enableFiltering:!1,width:40,cellTemplate:'<div class="ui-grid-cell-contents text-center"><span class="close-x mt-0 mb-0 ml-3" data-ng-click="grid.appScope.$ctrl.removeImportRow( row.entity )" style="color: red;">&times;</span></div>'}],enableSorting:!0,showColumnFooter:!1,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableVerticalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableColumnMenus:!1};var t=parseInt(this.appCacheService.getAndClear("ledger_preselect_start"));isNaN(t)?(this.filter.startDate=moment().subtract(30,"days").toDate(),this.filter.endDate=moment().toDate(),this.fullRefresh(),this.loadUnits()):window.setTimeout(function(){a.filter.startDate=new Date(t);var e=parseInt(a.appCacheService.getAndClear("ledger_preselect_end"));a.filter.endDate=new Date(e),a.preselectCategoryId=parseInt(a.appCacheService.getAndClear("ledger_preselect_categoryId")),isNaN(a.preselectCategoryId)&&(a.preselectCategoryId=void 0),a.fullRefresh()},100)},e.prototype.fullRefresh=function(){var r=this;this.isLoading=!0;var e="/api/Ledger/PageInfo?startDate="+encodeURIComponent(this.filter.startDate.toISOString())+"&endDate="+encodeURIComponent(this.filter.endDate.toISOString());3<this.filter.description.length&&(e+="&descriptionSearch="+encodeURIComponent(this.filter.description)),this.$http.get(e).then(function(e){r.isLoading=!1;var t=e.data;r.ledgerAccounts=t.accounts,_.forEach(r.ledgerAccounts,function(e){return e.shouldShowInGrid=!0});var i=r.ledgerAccounts.filter(function(e){return e.plaidNeedsRelogin});r.accountsNeedingLogin=[];for(var n=function(t){r.accountsNeedingLogin.find(function(e){return e.plaidItemId===i[t].plaidItemId})||r.accountsNeedingLogin.push(i[t])},o=0;o<i.length;++o)n(o);r.ledgerGridOptions.columnDefs.filter(function(e){return"accountName"===e.field})[0].filter.selectOptions=r.ledgerAccounts.map(function(e){return{value:e.accountName,label:e.accountName}}),r.hasPlaidAccounts=_.any(r.ledgerAccounts,function(e){return"plaid"===e.syncType}),r.allEntries=t.entries,r.pendingGridOptions.data=t.pendingEntries,r.flatCategoryList=[];var s=function(e,t){if(e.displayName){var i="";1<t&&(i=Array(4*(t-2)).join(String.fromCharCode(160))+"|--"),e.dropDownLabel=i+e.displayName,r.flatCategoryList.push(e)}if(null!=e.childCategories&&0!=e.childCategories.length)for(var n=0;n<e.childCategories.length;++n)s(e.childCategories[n],t+1)};s(t.rootFinancialCategory,0),r.updateLocalData();var a=[];a.push({id:null,value:""});for(o=0;o<r.flatCategoryList.length;++o)a.push({id:r.flatCategoryList[o].financialCategoryId,value:r.flatCategoryList[o].dropDownLabel});a.push({id:r.ManageCategoriesDropId,value:"Manage Categories..."}),r.ledgerGridOptions.columnDefs.find(function(e){return"categoryDisplayName"===e.field}).editDropdownOptionsArray=a,r.preselectCategoryId&&window.setTimeout(function(){var e=r.flatCategoryList.filter(function(e){return e.financialCategoryId===r.preselectCategoryId})[0];r.preselectCategoryId=void 0,r.ledgerGridApi.grid.columns.filter(function(e){return"Category"===e.displayName})[0].filters[0]={term:e.displayName}},100),r.allUnits&&r.populateGridUnitLabels()},function(e){r.isLoading=!1,alert("Failed to retrieve data, try refreshing the page. If the problem persists, contact support: "+e.data.exceptionMessage)})},e.prototype.populateGridUnitLabels=function(){var e=this;_.each(this.allEntries,function(t){t.isSplit&&(t.categoryDisplayName="(split)"),t.associatedUnitId&&(t.unitGridLabel=e.allUnits.find(function(e){return e.unitId===t.associatedUnitId}).name)})},e.prototype.refreshEntries=function(){var t=this;this.isLoadingEntries=!0;var e="/api/Ledger/PageInfo?startDate="+encodeURIComponent(this.filter.startDate.toISOString())+"&endDate="+encodeURIComponent(this.filter.endDate.toISOString());3<this.filter.description.length&&(e+="&descriptionSearch="+encodeURIComponent(this.filter.description)),this.$http.get(e).then(function(e){t.isLoadingEntries=!1,t.allEntries=e.data.entries,t.updateLocalData(),t.populateGridUnitLabels()})},e.prototype.updateLocalData=function(){var t=this.ledgerAccounts.filter(function(e){return e.shouldShowInGrid}).map(function(e){return e.ledgerAccountId}),e=this.allEntries.filter(function(e){return-1<t.indexOf(e.ledgerAccountId)});this.ledgerGridOptions.data=e,this.ledgerGridOptions.enablePaginationControls=e.length>this.HistoryPageSize,this.ledgerGridOptions.minRowsToShow=Math.min(e.length,this.HistoryPageSize),this.ledgerGridOptions.virtualizationThreshold=this.ledgerGridOptions.minRowsToShow,this.regenerateDateDonutChart()},e.prototype.regenerateDateDonutChart=function(){var i=this;if(this.spendingChartData=null,0!==this.allEntries.length){for(var n=function(t){var e=i.flatCategoryList.filter(function(e){return e.financialCategoryId===t});return e&&0<e.length?e[0].parentFinancialCategoryId?n(e[0].parentFinancialCategoryId):e[0].financialCategoryId:0},e=[],t=0;t<this.allEntries.length;++t)if(this.allEntries[t].isSplit)for(var o=0,s=this.allEntries[t].splitEntries;o<s.length;o++){var a=s[o];e.push(a)}else e.push(this.allEntries[t]);var l=_.groupBy(e,function(e){return n(e.financialCategoryId)}),d=[],c=_.keys(l),r=function(e){var t=+c[e],i=l[t],n=p.flatCategoryList.filter(function(e){return e.financialCategoryId===+t}),o=null;n&&0<n.length&&(o=n[0]);for(var s=0,a=0;a<i.length;++a)s+=i[a].amount;var r={parentCategoryId:t,parentCategoryDisplayName:o?o.displayName:"Uncategorized",sumTotal:Math.abs(s),numLedgerEntries:i.length};d.push(r)},p=this;for(t=0;t<c.length;++t)r(t);d=_.sortBy(d,function(e){return e.sumTotal}).reverse(),this.spendingChartData=[],this.spendingChartLabels=[];for(t=0;t<d.length;++t)this.spendingChartData.push(d[t].sumTotal),this.spendingChartLabels.push(d[t].parentCategoryDisplayName);this.showDonut=!1,this.$timeout(function(){return i.showDonut=!0},100)}},e.prototype.onAddTransaction=function(){0!==this.ledgerAccounts.length?(this.editingTransaction=new n,this.editingTransaction.ledgerAccountId=this.ledgerAccounts[0].ledgerAccountId,this.editingTransaction.transactionDate=new Date,window.setTimeout(function(){return document.getElementById("transaction-amount-input").focus()},50)):alert("Please add at least one account first")},e.prototype.completePlaidSync=function(e,t,i){var n=this;this.isLoading=!0,this.plaidSuccessProgressMsg="Contacting Plaid server for selected account information";var o={accessToken:e,updatePlaidItemId:t,selectedAccountIds:i},s=t?"/api/Plaid/UpdateAccessToken":"/api/Plaid/ProcessNewAccessToken";this.$http.post(s,o).then(function(e){n.isLoading=!1,n.plaidSuccessProgressMsg="Account information successfully retrieved",n.newPlaidAccounts=e.data,t&&window.location.reload()},function(e){n.isLoading=!1,n.plaidSuccessProgressMsg="Failed to retrieve account information from Plaid: "+e.data.exceptionMessage,alert("Failed to link: "+e.data.exceptionMessage)})},e.prototype.showAddAccount=function(){this.createAccountInfo=new t,this.createAccountInfo.type=null},e.prototype.updateAccountLink=function(n){var o=this;this.isPremiumPlanActive&&(this.isLoading=!0,this.$http.get("/api/Plaid/UpdateLinkToken/"+n.plaidItemId).then(function(e){o.isLoading=!1;var t=e.data;if(t){var i={token:t,onSuccess:function(e,t){console.log("Plaid update onSuccess"),o.completePlaidSync(e,n.plaidItemId,null)},onLoad:function(){},onExit:function(e,t){console.log("onExit.err",e,t)},onEvent:function(e,t){console.log("onEvent.eventName",e,t)},receivedRedirectUri:null};o.plaidHandler=Plaid.create(i),o.plaidHandler.open()}else alert("Something went wrong on the server. Please contact support.")},function(e){o.isLoading=!1,alert("Failed to update account link: "+e.data.exceptionMessage)}))},e.prototype.editEntry=function(e){this.editingTransaction=_.clone(e),this.editingTransaction.isSplit&&this.onSplitAmountChange()},e.prototype.deleteEntry=function(e){var t=this;confirm("Are you sure you want to delete this entry? Deletion is permanent.")&&(this.isLoading=!0,this.$http.delete("/api/Ledger/DeleteEntry/"+e.ledgerEntryId).then(function(e){t.isLoading=!1,t.editAccount=null,t.editingTransaction=null,t.fullRefresh()},function(e){t.isLoading=!1,alert("Failed to delete: "+e.data.exceptionMessage)}))},e.prototype.onSaveEntry=function(){var t=this;if(this.editingTransaction.isSplit){for(var e=0;e<this.editingTransaction.splitEntries.length;++e)if(!this.editingTransaction.splitEntries[e].amount)return void alert("A non-zero amount is required for all split transaction entries")}else{if(!this.editingTransaction.description)return void alert("Description is required");if(!this.editingTransaction.amount)return void alert("Non-zero amount is required")}this.isLoading=!0;var i=function(e){t.isLoading=!1,t.editingTransaction=null,t.refreshEntries()},n=function(e){t.isLoading=!1,alert("Failed to save: "+e.data.exceptionMessage)};this.editingTransaction.ledgerEntryId?this.$http.put("/api/Ledger/UpdateEntry",this.editingTransaction).then(i,n):this.$http.post("/api/Ledger/NewManualEntry",this.editingTransaction).then(i,n)},e.prototype.onSaveNewAccount=function(){var t=this;this.isLoading=!0;this.$http.post("/api/Ledger/NewBankAccount",this.createAccountInfo).then(function(e){t.isLoading=!1,t.createAccountInfo=null,t.fullRefresh()},function(e){t.isLoading=!1,alert("Failed to save: "+e.data.exceptionMessage)})},e.prototype.startPlaidFlow=function(){var n=this;this.createAccountInfo&&(this.createAccountInfo.type="plaid"),this.isPremiumPlanActive&&(this.isLoading=!0,this.$http.get("/api/Plaid/NewLinkToken").then(function(e){if(n.isLoading=!1,e.data){var t={token:e.data,onSuccess:function(e,t){console.log("Plaid onSuccess",t);var i=null;t&&t.accounts&&0<t.accounts.length&&(i=t.accounts.map(function(e){return e.id})),n.completePlaidSync(e,null,i)},onLoad:function(){},onExit:function(e,t){console.log("update onExit.err",e,t)},onEvent:function(e,t){console.log("update onEvent.eventName",e,t)},receivedRedirectUri:null};n.plaidHandler=Plaid.create(t),n.plaidHandler.open()}},function(e){n.isLoading=!1,alert("Failed to start Plaid sign-up: "+e.data.exceptionMessage),n.closeAccountAndReload()}))},e.prototype.openEditAccountModal=function(e){this.editAccount=_.clone(e)},e.prototype.closeAccountAndReload=function(){this.createAccountInfo=null,this.fullRefresh()},e.prototype.onEditAccount=function(){var t=this,e="/api/Ledger/UpdateAccount/"+this.editAccount.ledgerAccountId+"?newName="+encodeURIComponent(this.editAccount.accountName)+"&newType="+encodeURIComponent(this.editAccount.accountType);this.isLoading=!0,this.$http.put(e,null).then(function(e){t.isLoading=!1,t.editAccount=null,t.fullRefresh()},function(e){t.isLoading=!1,alert("Failed to update: "+e.data.exceptionMessage)})},e.prototype.syncPlaidAccounts=function(e){var t=this;this.isLoading=!0;var i=e?"/api/Plaid/SyncRecentTransactions":"/api/Plaid/SyncTwoYearTransactions";this.$http.get(i).then(function(e){t.isLoading=!1,t.refreshEntries()},function(e){t.isLoading=!1,alert("Failed to sync: "+e.data.exceptionMessage),e.data.exceptionMessage&&-1<e.data.exceptionMessage.indexOf("login credentials")&&window.location.reload()})},e.prototype.onFilterDescriptionChange=function(){(2<this.filter.description.length||0==this.filter.description.length)&&this.refreshEntries()},e.prototype.onEditTransactionCategoryChange=function(){},e.prototype.onCategoryManagerClosed=function(e){this.shouldShowCategoryEditModal=!1,e&&this.fullRefresh()},e.prototype.loadUnits=function(){var n=this;this.$http.get("/api/Unit").then(function(e){n.allUnits=e.data,_.every(n.allUnits,function(e){return HtmlUtil.isNumericString(e.name)})&&(n.allUnits=_.sortBy(n.allUnits,function(e){return parseFloat(e.name)}));var t=[];t.push({id:null,value:""});for(var i=0;i<n.allUnits.length;++i)t.push({id:n.allUnits[i].unitId,value:n.allUnits[i].name});n.ledgerGridOptions.columnDefs.find(function(e){return"unitGridLabel"===e.field}).editDropdownOptionsArray=t,n.allEntries&&n.populateGridUnitLabels()},function(){n.isLoading=!1,alert("Failed to retrieve your association's home listing, please contact support.")})},e.prototype.onDeleteAccount=function(){var t=this;confirm("Are you sure you want to remove this account?")&&(this.isLoading=!0,this.$http.delete("/api/Ledger/DeleteAccount/"+this.editAccount.ledgerAccountId).then(function(e){t.isLoading=!1,t.editAccount=null,t.fullRefresh()},function(e){t.isLoading=!1,alert("Failed to delete: "+e.data.exceptionMessage)}))},e.prototype.splitTransaction=function(){this.editingTransaction.splitEntries||(this.editingTransaction.splitEntries=[]),this.editingTransaction.splitEntries.push(new n),this.editingTransaction.isSplit=!0},e.prototype.onSplitAmountChange=function(){this.splitAmountTotal=this.editingTransaction.splitEntries.reduce(function(e,t){return e+t.amount},0);var e=Math.round(100*this.splitAmountTotal),t=Math.round(100*this.editingTransaction.amount);this.isSplitAmountEqual=e===t},e.prototype.removeSplit=function(e){this.editingTransaction.splitEntries.splice(this.editingTransaction.splitEntries.indexOf(e),1),this.onSplitAmountChange()},e.prototype.openImportFilePicker=function(){document.getElementById("importTransactionFileInput").click()},e.prototype.openImportModal=function(){this.shouldShowImportModal=!0,this.previewImportGridOptions.data=null},e.prototype.onImportFileSelected=function(e){var o=this,t=e.target.files[0];if(t){this.isLoading=!0;var i=new FormData;i.append("importFile",t);var n={headers:{"Content-Type":void 0}};this.$http.post("/api/Ledger/PreviewImport",i,n).then(function(e){o.isLoading=!1,document.getElementById("importTransactionFileInput").value="",o.previewImportGridOptions.data=e.data;for(var t=function(e){var t=o.previewImportGridOptions.data[e];t.ledgerEntryId=e;var i=o.allUnits.find(function(e){return e.unitId===t.associatedUnitId});i&&(t.unitGridLabel=i.name);var n=o.flatCategoryList.find(function(e){return e.financialCategoryId===t.financialCategoryId});t.categoryDisplayName=n?n.displayName:null},i=0;i<o.previewImportGridOptions.data.length;++i)t(i);o.previewImportGridOptions.minRowsToShow=e.data.length,o.previewImportGridOptions.virtualizationThreshold=o.previewImportGridOptions.minRowsToShow},function(e){o.isLoading=!1,alert("Failed to upload document: "+e.data.exceptionMessage)})}},e.prototype.importPreviewTransactions=function(){var t=this;if(this.bulkImportAccountId){this.isLoading=!0;for(var e=this.previewImportGridOptions.data,i=0;i<e.length;++i)e[i].ledgerAccountId=this.bulkImportAccountId;this.$http.post("/api/Ledger/BulkImport",this.previewImportGridOptions.data).then(function(e){t.previewImportGridOptions.data=null,t.shouldShowImportModal=!1,t.isLoading=!1,t.refreshEntries()},function(e){t.isLoading=!1,alert("Failed to import: "+e.data.exceptionMessage)})}else alert("Please select the account into which these transactions will be imported using the drop-down above the grid.")},e.prototype.removeImportRow=function(e){var t=this.previewImportGridOptions.data;t.splice(e.ledgerEntryId,1);for(var i=0;i<t.length;++i)t[i].ledgerEntryId=i},e.prototype.exportTransactionsCsv=function(){var e=[{headerText:"Date",fieldName:"transactionDate",dataMapper:function(e){return e?moment(e).format("YYYY-MM-DD"):""}},{headerText:"Description",fieldName:"description"},{headerText:"Category",fieldName:"categoryDisplayName"},{headerText:AppConfig.homeName,fieldName:"unitGridLabel"},{headerText:"Amount",fieldName:"amount"},{headerText:"Account",fieldName:"accountName"}],t=i.createCsvString(this.ledgerGridOptions.data,e);i.HtmlUtil2.downloadCsv(t,"Transactions.csv")},e.prototype.onShowOwnerTxnsChange=function(){var t=this;this.isLoading=!0;var e="/api/Ledger/SetOwnerTxnViewing?shouldAllow="+this.shouldShowOwnerFinanceTxn;this.$http.put(e,null).then(function(e){t.isLoading=!1,t.siteInfo.privateSiteInfo.shouldShowOwnerFinanceTxn=t.shouldShowOwnerFinanceTxn},function(e){t.isLoading=!1,alert("Failed to change setting: "+e.data.exceptionMessage)})},e.$inject=["$http","SiteInfo","appCacheService","uiGridConstants","$rootScope","$timeout"],e}();i.LedgerController=e;var t=function(){},n=function(){},a=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}__extends(t,e)}(i.LedgerEntry=n),function(){this.description="",this.startDate=new Date,this.endDate=new Date,this.category=""}),o=function(){};i.FinancialCategory=o}(Ally||(Ally={})),CA.angularApp.component("ledger",{templateUrl:"/ngApp/chtn/manager/financial/ledger.html",controller:Ally.LedgerController}),function(i){var e=function(){};i.ElectronicPayment=e;var t=function(){function e(e,t,i,n){this.$http=e,this.siteInfo=t,this.appCacheService=i,this.uiGridConstants=n,this.PaymentHistory=[],this.errorMessage="",this.showPaymentPage=!0,this.PeriodicPaymentFrequencies=PeriodicPaymentFrequencies,this.AssociationPaysAch=!0,this.AssociationPaysCC=!1,this.lateFeeInfo={},this.hasLoadedPage=!1,this.isLoading=!1,this.isLoadingUnits=!1,this.isLoadingPayment=!1,this.isLoadingLateFee=!1,this.isLoadingCheckoutDetails=!1,this.allowNewWePaySignUp=!1,this.shouldShowDwollaAddAccountModal=!1,this.shouldShowDwollaModalClose=!1,this.isDwollaIavDone=!1,this.shouldShowMicroDepositModal=!1,this.HistoryPageSize=50}return e.prototype.$onInit=function(){this.homeName=AppConfig.homeName,this.highlightWePayCheckoutId=this.appCacheService.getAndClear("hwpid");var e=this.appCacheService.getAndClear("onpayid");HtmlUtil.isNumericString(e)&&(this.highlightPaymentsInfoId=parseInt(e)),this.isAssessmentTrackingEnabled=this.siteInfo.privateSiteInfo.isPeriodicPaymentTrackingEnabled;this.allowNewWePaySignUp=-1<["tigertrace","7mthope","qa"].indexOf(this.siteInfo.publicSiteInfo.shortName),this.payments=[{Date:"",Unit:"",Resident:"",Amount:"",Status:""}],this.testFee={amount:200},this.signUpStep=0,this.signUpInfo={hasAssessments:null,assessmentFrequency:PeriodicPaymentFrequencies[0].name,frequencyIndex:0,allPayTheSame:!0,allPayTheSameAmount:0,units:[]},this.paymentsGridOptions={columnDefs:[{field:"submitDateUtc",displayName:"Date",width:140,type:"date",cellFilter:"date:'short'"},{field:"unitName",displayName:this.homeName,width:80},{field:"resident",displayName:"Resident",width:160},{field:"amount",displayName:"Amount",width:100,type:"number",cellFilter:"currency"},{field:"status",displayName:"Status",width:110},{field:"notes",displayName:"Notes"},{field:"id",displayName:"",width:140,cellTemplate:'<div class="ui-grid-cell-contents"><span class="text-link" data-ng-if="row.entity.wePayCheckoutId" data-ng-click="grid.appScope.$ctrl.showWePayCheckoutInfo( row.entity.wePayCheckoutId )">WePay Details</span><span class="text-link" data-ng-if="row.entity.payPalCheckoutId" data-ng-click="grid.appScope.$ctrl.showPayPalCheckoutInfo( row.entity.payPalCheckoutId )">PayPal Details</span><span class="text-link" data-ng-if="row.entity.paragonReferenceNumber" data-ng-click="grid.appScope.$ctrl.showParagonCheckoutInfo( row.entity.paragonReferenceNumber )">Paragon Details</span><span class="text-link" data-ng-if="row.entity.dwollaTransferUri" data-ng-click="grid.appScope.$ctrl.showDwollaTransferInfo( row.entity )">Dwolla Details</span></div>'}],enableSorting:!0,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableVerticalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableColumnMenus:!1,enablePaginationControls:!0,paginationPageSize:this.HistoryPageSize,paginationPageSizes:[this.HistoryPageSize],enableRowHeaderSelection:!1,onRegisterApi:function(e){HtmlUtil.uiGridFixScroll()}},this.refresh()},e.prototype.refresh=function(){var n=this;this.isLoading=!0,this.$http.get("/api/OnlinePayment").then(function(e){n.isLoading=!1,n.hasLoadedPage=!0,n.hasAssessments=n.siteInfo.privateSiteInfo.hasAssessments;var t=e.data;if(n.paymentInfo=t,n.paymentsGridOptions.data=n.paymentInfo.electronicPayments,n.paymentsGridOptions.enablePaginationControls=n.paymentInfo.electronicPayments.length>n.HistoryPageSize,n.paymentsGridOptions.minRowsToShow=Math.min(n.paymentInfo.electronicPayments.length,n.HistoryPageSize),n.paymentsGridOptions.virtualizationThreshold=n.paymentsGridOptions.minRowsToShow,n.lateFeeInfo={lateFeeDayOfMonth:t.lateFeeDayOfMonth,lateFeeAmount:t.lateFeeAmount},HtmlUtil.isNullOrWhitespace(n.lateFeeInfo.lateFeeAmount)||HtmlUtil.endsWith(n.lateFeeInfo.lateFeeAmount,"%")||(n.lateFeeInfo.lateFeeAmount="$"+n.lateFeeInfo.lateFeeAmount),n.refreshUnits(),n.updateTestFee(),n.highlightPaymentsInfoId){var i=t.electronicPayments.filter(function(e){return e.paymentId===n.highlightPaymentsInfoId});i&&0<i.length&&(i[0].wePayCheckoutId?n.showWePayCheckoutInfo(i[0].wePayCheckoutId):i[0].paragonReferenceNumber?n.showParagonCheckoutInfo(i[0].paragonReferenceNumber):i[0].dwollaTransferUri&&n.showDwollaTransferInfo(i[0])),n.highlightPaymentsInfoId=null}},function(e){n.isLoading=!1,alert("Failed to load page, please contact technical support. ("+e.data.exceptionMessage+")")})},e.prototype.refreshUnits=function(){var t=this;this.isLoadingUnits=!0;var i=this;this.$http.get("/api/Unit").then(function(e){i.units=e.data,_.each(i.units,function(e){null===e.adjustedAssessment&&(e.adjustedAssessment=e.assessment)}),i.assessmentSum=_.reduce(i.units,function(e,t){return e+t.assessment},0),i.adjustedAssessmentSum=_.reduce(i.units,function(e,t){return e+(t.adjustedAssessment||0)},0),i.isLoadingUnits=!1},function(e){t.isLoading=!1,alert("Failed to load units, please contact technical support. ("+e.data.exceptionMessage+")")})},e.prototype.getLateFeeDateSuper=function(){var e=this.lateFeeInfo.lateFeeDayOfMonth;if("string"==typeof e){if(HtmlUtil.isNullOrWhitespace(e))return"";e=parseInt(e),this.lateFeeInfo.lateFeeDayOfMonth=e}if(NaN==e||e<1)return e="";if(31<e)return e="";if(10<=e&&e<=20)return"th";var t=e%10;return 1===t?"st":2===t?"nd":3===t?"rd":"th"},e.prototype.updatePayPalCredentials=function(){this.isUpdatingPayPalCredentials=!0,this.payPalSignUpClientSecret="",this.payPalSignUpErrorMessage=""},e.prototype.saveAllowSetting=function(){var t=this;this.isLoading=!0,this.$http.put("/api/OnlinePayment/SaveAllow?allowPayments="+this.paymentInfo.areOnlinePaymentsAllowed,null).then(function(e){window.location.reload()},function(e){t.isLoading=!1,alert("Failed to save: "+e.data.exceptionMessage)})},e.prototype.enablePayPal=function(){var t=this;this.isLoading=!0,this.payPalSignUpErrorMessage=null;var e={clientId:this.payPalSignUpClientId,clientSecret:this.payPalSignUpClientSecret};this.$http.put("/api/OnlinePayment/EnablePayPal",e).then(function(e){t.payPalSignUpClientId="",t.payPalSignUpClientSecret="",window.location.reload()},function(e){t.isLoading=!1,t.payPalSignUpErrorMessage=e.data.exceptionMessage})},e.prototype.selectText=function(){setTimeout(function(){$(".editable-input").select()},50)},e.prototype.onWithdrawalClick=function(){var i=this;this.errorMessage="",this.$http.get("/api/OnlinePayment/PerformAction?action=withdrawal").then(function(e){var t=e.data;t.redirectUri?window.location.href=t.redirectUri:i.errorMessage=t.message},function(e){e.data&&e.data.exceptionMessage&&(i.errorMessage=e.data.exceptionMessage)})},e.prototype.onUnitAssessmentChanged=function(e){this.isLoadingUnits=!0,"string"==typeof e.adjustedAssessment&&(e.adjustedAssessment=parseFloat(e.adjustedAssessment));var t={unitId:e.unitId,assessment:e.adjustedAssessment,assessmentNote:e.adjustedAssessmentReason},i=this;this.$http.put("/api/Unit/UpdateAssessment",t).then(function(){i.isLoadingUnits=!1,i.assessmentSum=_.reduce(i.units,function(e,t){return e+t.assessment},0),i.adjustedAssessmentSum=_.reduce(i.units,function(e,t){return e+(t.adjustedAssessment||0)},0)})},e.prototype.onChangeFeePayerInfo=function(e){var t=this,i=!1,n=!1;if(this.paymentInfo.usersWithAutoPay&&0<this.paymentInfo.usersWithAutoPay.length){var o=[];if("ach"===e?o=_.where(this.paymentInfo.usersWithAutoPay,function(e){return"ACH"===e.wePayAutoPayFundingSource}):"cc"===e&&(o=_.where(this.paymentInfo.usersWithAutoPay,function(e){return"Credit Card"===e.wePayAutoPayFundingSource})),0<o.length){n=void 0!==_.find(o,function(e){return e.userId===t.siteInfo.userInfo.userId}),i=!0;var s="Adjusting the fee payer type will cause the follow units to have their auto-pay canceled and they will be informed by e-mail:\n";if(_.each(o,function(e){return s+=e.ownerName+"\n"}),s+="\nDo you want to continue?",!confirm(s))return void("ach"===e?this.paymentInfo.payerPaysAchFee=!this.paymentInfo.payerPaysAchFee:this.paymentInfo.payerPaysCCFee=!this.paymentInfo.payerPaysCCFee)}}this.isLoadingPayment=!0;var a=this;this.$http.put("/api/OnlinePayment",this.paymentInfo).then(function(){n?window.location.reload():(a.isLoadingPayment=!1,i&&a.refresh())}),this.updateTestFee()},e.prototype.getSignUpSum=function(){return _.reduce(this.signUpInfo.units,function(e,t){return e+parseFloat(t.assessment)},0)},e.prototype.signUp_HasAssessments=function(e){var t=this;this.signUpInfo.hasAssessments=e,this.signUpInfo.hasAssessments?(this.signUpInfo.units=[],_.each(this.units,function(e){t.signUpInfo.units.push({unitId:e.unitId,name:e.name,assessment:0})}),this.signUpStep=1):this.signUp_Commit()},e.prototype.signUp_AssessmentFrequency=function(e){this.signUpInfo.frequencyIndex=e,this.signUpInfo.assessmentFrequency=PeriodicPaymentFrequencies[e].name,this.signUpStep=2},e.prototype.saveLateFee=function(){var i=this;this.isLoadingLateFee=!0,this.$http.put("/api/OnlinePayment/LateFee?dayOfMonth="+this.lateFeeInfo.lateFeeDayOfMonth+"&lateFeeAmount="+this.lateFeeInfo.lateFeeAmount,null).then(function(e){i.isLoadingLateFee=!1;var t=e.data;t&&t.feeAmount&&0!==t.feeType?(i.lateFeeInfo.lateFeeAmount=t.feeAmount,1===t.feeType?i.lateFeeInfo.lateFeeAmount="$"+i.lateFeeInfo.lateFeeAmount:2===t.feeType&&(i.lateFeeInfo.lateFeeAmount=i.lateFeeInfo.lateFeeAmount+"%")):(""!==i.lateFeeInfo.lateFeeDayOfMonth&&alert("Failed to save the late fee. Please enter only a number for the date (ex. 5) and an amount (ex. 12.34) or percent (ex. 5%) for the fee. To disable late fees, clear the date field and hit save."),i.lateFeeInfo.lateFeeDayOfMonth="",i.lateFeeInfo.lateFeeAmount=null)},function(e){i.isLoadingLateFee=!1;var t=e.data.exceptionMessage?e.data.exceptionMessage:e.data;alert("Failed to update late fee: "+t)})},e.prototype.showPayPalCheckoutInfo=function(e){var t=this;this.viewingPayPalCheckoutId=e,this.viewingPayPalCheckoutId&&(this.isLoadingCheckoutDetails=!0,this.checkoutInfo={},this.$http.get("/api/OnlinePayment/PayPalCheckoutInfo?checkoutId="+e,{cache:!0}).then(function(e){t.isLoadingCheckoutDetails=!1,t.checkoutInfo=e.data},function(e){t.isLoadingCheckoutDetails=!1,alert("Failed to retrieve checkout details: "+e.data.exceptionMessage)}))},e.prototype.showWePayCheckoutInfo=function(e){var t=this;this.viewingWePayCheckoutId=e,this.viewingWePayCheckoutId&&(this.isLoadingCheckoutDetails=!0,this.checkoutInfo={},this.$http.get("/api/OnlinePayment/WePayCheckoutInfo?checkoutId="+e,{cache:!0}).then(function(e){t.isLoadingCheckoutDetails=!1,t.checkoutInfo=e.data},function(e){t.isLoadingCheckoutDetails=!1,alert("Failed to retrieve checkout details: "+e.data.exceptionMessage)}))},e.prototype.showParagonCheckoutInfo=function(e){var t=this;this.viewingParagonReferenceNumber=e,this.viewingParagonReferenceNumber&&(this.isLoadingCheckoutDetails=!0,this.checkoutInfo={},this.$http.get("/api/OnlinePayment/ParagonCheckoutInfo?paymentReferenceNumber="+e,{cache:!0}).then(function(e){t.isLoadingCheckoutDetails=!1,t.checkoutInfo=e.data},function(e){t.isLoadingCheckoutDetails=!1,alert("Failed to retrieve checkout details: "+e.data.exceptionMessage)}))},e.prototype.showDwollaTransferInfo=function(e){var t=this;this.viewingDwollaEntry=e,this.viewingDwollaEntry&&(this.isLoadingCheckoutDetails=!0,this.checkoutInfo={},this.$http.get("/api/OnlinePayment/DwollaCheckoutInfo/"+e.paymentId).then(function(e){t.isLoadingCheckoutDetails=!1,t.checkoutInfo=e.data},function(e){t.isLoadingCheckoutDetails=!1,alert("Failed to retrieve checkout details: "+e.data.exceptionMessage)}))},e.prototype.cancelDwollaTransfer=function(){var t=this;this.viewingDwollaEntry&&(this.isLoadingCheckoutDetails=!0,this.checkoutInfo={},this.$http.get("/api/Dwolla/CancelTransfer/"+this.viewingDwollaEntry.paymentId).then(function(e){t.isLoadingCheckoutDetails=!1,t.checkoutInfo=e.data},function(e){t.isLoadingCheckoutDetails=!1,alert("Failed to cancel transfer: "+e.data.exceptionMessage)}))},e.prototype.signUp_Commit=function(){var t=this;this.isLoading=!0,this.$http.post("/api/OnlinePayment/BasicInfo",this.signUpInfo).then(function(){t.isLoading=!1,t.refreshUnits(),t.hasAssessments=t.signUpInfo.hasAssessments,t.siteInfo.privateSiteInfo.hasAssessments=t.hasAssessments},function(e){t.isLoading=!1,e.data&&e.data.exceptionMessage&&(t.errorMessage=e.data.exceptionMessage)})},e.prototype.updateTestFee=function(){var e=parseFloat(this.testFee.amount);this.paymentInfo.payerPaysAchFee?(this.testFee.achResidentPays=e+1.5,this.testFee.achAssociationReceives=e):(this.testFee.achResidentPays=e,this.testFee.achAssociationReceives=e-1.5);var t=1.3+.029*e;this.paymentInfo.payerPaysCCFee?(this.testFee.ccResidentPays=e+t,this.testFee.ccAssociationReceives=e):(this.testFee.ccResidentPays=e,this.testFee.ccAssociationReceives=e-t)},e.prototype.admin_ClearAccessToken=function(){alert("TODO hook this up")},e.prototype.showDwollaSignUpModal=function(){this.shouldShowDwollaAddAccountModal=!0,window.setTimeout(function(){grecaptcha.render("recaptcha-check-elem")},200)},e.prototype.startDwollaSignUp=function(){var n=this,e=grecaptcha.getResponse();if(HtmlUtil.isNullOrWhitespace(e))alert("Please complete the reCAPTCHA field");else{this.shouldShowDwollaModalClose=!1,this.isDwollaIavDone=!1,this.isLoading=!0;this.$http.get("/api/Dwolla/GroupIavToken?token="+encodeURIComponent(e)).then(function(e){var t;n.isLoading=!1,n.dwollaIavToken=e.data.iavToken,t=n.dwollaIavToken,dwolla.configure(i.AppConfigInfo.dwollaEnvironmentName),dwolla.iav.start(t,{container:"dwolla-iav-container",stylesheets:["https://fonts.googleapis.com/css?family=Lato&subset=latin,latin-ext"],microDeposits:!0,fallbackToMicroDeposits:!0},function(e,t){if(console.log("Error: "+JSON.stringify(e)+" -- Response: "+JSON.stringify(t)),t&&t._links&&t._links["funding-source"]&&t._links["funding-source"].href){var i=t._links["funding-source"].href;n.$http.put("/api/Dwolla/SetGroupFundingSourceUri",{fundingSourceUri:i}).then(function(e){n.isDwollaIavDone=!0},function(e){n.isLoading=!1,n.shouldShowDwollaModalClose=!0,alert("Failed to complete sign-up")})}})},function(e){n.isLoading=!1,n.shouldShowDwollaAddAccountModal=!1,grecaptcha.reset(),alert("Failed to start instant account verification: "+e.data.exceptionMessage)})}},e.prototype.hideDwollaAddAccountModal=function(){this.shouldShowDwollaAddAccountModal=!1,this.dwollaIavToken=null,this.isDwollaIavDone&&(this.isLoading=!0,window.location.reload())},e.prototype.disconnectDwolla=function(){var t=this;confirm("Are you sure you want to disconnect the bank account? Residents will no longer be able to make payments.")&&(this.isLoading=!0,this.$http.put("/api/Dwolla/DisconnectGroupFundingSource",null).then(function(e){window.location.reload()},function(e){t.isLoading=!1,alert("Failed to disconnect account"+e.data.exceptionMessage)}))},e.prototype.showMicroDepositModal=function(){this.shouldShowMicroDepositModal=!0,this.dwollaMicroDepositAmount1String="0.01",this.dwollaMicroDepositAmount2String="0.01"},e.prototype.submitDwollaMicroDepositAmounts=function(){var t=this;this.isLoading=!0;var e={amount1String:this.dwollaMicroDepositAmount1String,amount2String:this.dwollaMicroDepositAmount2String,isForGroup:!0};this.$http.post("/api/Dwolla/VerifyMicroDeposit",e).then(function(e){window.location.reload()},function(e){t.isLoading=!1,alert("Failed to verify: "+e.data.exceptionMessage)})},e.$inject=["$http","SiteInfo","appCacheService","uiGridConstants"],e}();i.ManagePaymentsController=t}(Ally||(Ally={})),CA.angularApp.component("managePayments",{templateUrl:"/ngApp/chtn/manager/financial/manage-payments.html",controller:Ally.ManagePaymentsController});var PaymentBasicInfoUnitAssessment=function(){},PaymentBasicInfo=function(){};!function(e){var t=function(){this.isPrivate=!1};e.Committee=t;var i=function(){function e(e,t,i){this.$http=e,this.siteInfo=t,this.$cacheFactory=i,this.includeInactive=!1,this.activeCommittees=[],this.inactiveCommittees=[],this.showInactiveCommittees=!1,this.editCommittee=null,this.isLoading=!1}return e.prototype.$onInit=function(){this.retrieveCommittees()},e.prototype.startEditCommittee=function(e){this.editCommittee=e},e.prototype.showCreateModal=function(){this.editCommittee=new t,this.editCommittee.committeeType="Ongoing"},e.prototype.toggleCommitteeActive=function(e){this.isLoading=!0;var t=(e.deactivationDateUtc?"/api/Committee/Reactivate/":"/api/Committee/Deactivate/")+e.committeeId,i=this;this.$http.put(t,null).success(function(e){i.isLoading=!1,i.retrieveCommittees()}).error(function(e){i.isLoading=!1,alert("Failed to retrieve the modify committee: "+e.exceptionMessage)})},e.prototype.retrieveCommittees=function(){var t=this;this.isLoading=!0;this.$http.get("/api/Committee?includeInactive=true").success(function(e){t.isLoading=!1,t.activeCommittees=_.filter(e,function(e){return!e.deactivationDateUtc}),t.inactiveCommittees=_.filter(e,function(e){return!!e.deactivationDateUtc}),t.activeCommittees=_.sortBy(t.activeCommittees,function(e){return e.name.toLowerCase()}),t.inactiveCommittees=_.sortBy(t.inactiveCommittees,function(e){return e.name.toLowerCase()})}).error(function(e){t.isLoading=!1,alert("Failed to retrieve the committee listing")})},e.prototype.saveCommittee=function(){var t=this;if(HtmlUtil.isNullOrWhitespace(this.editCommittee.name))alert("Please enter a name for the new committee.");else if(this.editCommittee.committeeType){this.isLoading=!0;var e="/api/Committee"+(this.editCommittee.committeeId?"/"+this.editCommittee.committeeId.toString():"")+"?name="+encodeURIComponent(this.editCommittee.name)+"&type="+encodeURIComponent(this.editCommittee.committeeType)+"&isPrivate="+this.editCommittee.isPrivate.toString();(this.editCommittee.committeeId?this.$http.put:this.$http.post)(e,null).success(function(){t.isLoading=!1,t.editCommittee=null,t.retrieveCommittees()}).error(function(e){t.isLoading=!1,alert("Failed to save the committee: "+e.exceptionMessage)})}else alert("Please select a type for the new committee.")},e.$inject=["$http","SiteInfo","$cacheFactory"],e}();e.ManageCommitteesController=i}(Ally||(Ally={})),CA.angularApp.component("manageCommittees",{templateUrl:"/ngApp/chtn/manager/manage-committees.html",controller:Ally.ManageCommitteesController}),function(e){var i=function(){this.isAnonymous=!0,this.whoCanVote=2};e.Poll=i;var t=function(){};e.PollResponse=t;var n=function(){function e(e,t){this.$http=e,this.siteInfo=t,this.editingItem=new i,this.pollHistory=[],this.isLoading=!1,this.isSuperAdmin=!1}return e.prototype.$onInit=function(){this.isSuperAdmin=this.siteInfo.userInfo.isAdmin;var e=new Date;e.setDate((new Date).getDate()+3),this.defaultPoll=new i,this.defaultPoll.expirationDate=e,this.defaultPoll.answers=[{answerText:"Yes"},{answerText:"No"}],this.editingItem=angular.copy(this.defaultPoll),this.retrieveItems()},e.prototype.retrieveItems=function(){this.isLoading=!0;var i=this;this.$http.get("/api/Poll").then(function(e){i.pollHistory=e.data;for(var t=0;t<i.pollHistory.length;++t)i.pollHistory[t].expirationDate=new Date(i.pollHistory[t].expirationDate),i.pollHistory[t].fullResultAnswers=i.pollHistory[t].answers,i.pollHistory[t].answers=_.reject(i.pollHistory[t].answers,function(e){return 101===e.sortOrder});i.isLoading=!1})},e.prototype.addAnswer=function(){this.editingItem.answers||(this.editingItem.answers=[]),19<this.editingItem.answers.length?alert("You can only have 20 answers maxiumum per poll."):this.editingItem.answers.push({answerText:""})},e.prototype.cancelEdit=function(){this.editingItem=angular.copy(this.defaultPoll)},e.prototype.onSaveItem=function(){if(null!==this.editingItem){this.isLoading=!0;var t=this,e=function(){t.isLoading=!1,t.editingItem=angular.copy(t.defaultPoll),t.retrieveItems()},i=function(e){t.isLoading=!1,alert("Failed to save poll: "+e.data.exceptionMessage)};"number"==typeof this.editingItem.pollId?(analytics.track("editPoll"),this.$http.put("/api/Poll",this.editingItem).then(e,i)):(analytics.track("addPoll"),this.$http.post("/api/Poll",this.editingItem).then(e,i))}},e.prototype.onEditItem=function(e){this.editingItem=angular.copy(e),window.scrollTo(0,0)},e.prototype.onDeleteItem=function(e){var t=this;this.isLoading=!0,this.$http.delete("/api/Poll?pollId="+e.pollId).then(function(){t.retrieveItems()},function(e){t.isLoading=!1,403===e.status?alert("You cannot authorized to delete this poll."):alert("Failed to delete: "+e.data.exceptionMessage)})},e.prototype.onViewResults=function(e){if(e){var i=_.groupBy(e.responses,"answerId");e.chartData=[],e.chartLabels=[];var n,t=function(){if(!i.hasOwnProperty(o))return"continue";var t=parseInt(o);(n=_.find(e.fullResultAnswers,function(e){return e.pollAnswerId===t}))&&(e.chartLabels.push(n.answerText),e.chartData.push(i[o].length))};for(var o in i)t();e.responses&&e.responses.length<this.siteInfo.privateSiteInfo.numUnits&&(e.chartLabels.push("No Response"),e.chartData.push(this.siteInfo.privateSiteInfo.numUnits-e.responses.length)),e.answerCounts=[];for(var s=0;s<e.chartLabels.length;++s)e.answerCounts.push({label:e.chartLabels[s],count:e.chartData[s]});this.chartLabels=e.chartLabels,this.chartData=e.chartData,this.viewingPollResults=e}else this.viewingPollResults=null},e.$inject=["$http","SiteInfo"],e}();e.ManagePollsController=n}(Ally||(Ally={})),CA.angularApp.component("managePolls",{templateUrl:"/ngApp/chtn/manager/manage-polls.html",controller:Ally.ManagePollsController});__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}}();!function(r){var e=function(){};r.Unit=e;var t=function(){};r.PayerInfo=t;var i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t}(e),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t}(r.UnitWithOwner=i);r.UnitWithPayment=n;var o=function(){};r.HomeEntry=o;var s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t}(r.HomeEntry);r.HomeEntryWithName=s;var a=function(){},l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t}(r.Member=a),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t}(r.MemberWithBoard=l),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t}(r.Resident=d);r.UpdateResident=c;var p=function(){},h=function(){};r.PendingMember=h;var u=function(){function e(e,t,i,n,o,s){this.$http=e,this.$rootScope=t,this.fellowResidents=i,this.uiGridConstants=n,this.siteInfo=o,this.appCacheService=s,this.isAdmin=!1,this.showEmailSettings=!0,this.shouldShowHomePicker=!0,this.showKansasPtaExport=!1,this.multiselectMulti="single",this.isSavingUser=!1,this.isLoading=!1,this.isLoadingSettings=!1,this.shouldSortUnitsNumerically=!1,this.showEmailHistory=!1,this.bulkParseNormalizeNameCase=!1,this.showLaunchSite=!0,this.showPendingMembers=!1,this.isLoadingPending=!1,this.selectedResidentDetailsView="Primary",this.showAddHomeLink=!1,this.hasMemberNotOwnerRenter=!1}return e.prototype.$onInit=function(){var t=this;this.isAdmin=this.siteInfo.userInfo.isAdmin,this.siteLaunchedDateUtc=this.siteInfo.privateSiteInfo.siteLaunchedDateUtc,this.bulkImportRows=[new p],this.multiselectOptions="",this.allUnits=null,this.homeName=AppConfig.homeName||"Unit",this.showIsRenter="condo"===AppConfig.appShortName||"hoa"===AppConfig.appShortName,this.shouldShowResidentPermissions=this.showIsRenter||"block-club"===AppConfig.appShortName,this.shouldShowHomePicker="pta"!==AppConfig.appShortName,this.showKansasPtaExport="pta"===AppConfig.appShortName&&"KS"===this.siteInfo.privateSiteInfo.groupAddress.state,this.showEmailSettings=!this.siteInfo.privateSiteInfo.isEmailSendingRestricted,this.memberTypeLabel=AppConfig.memberTypeLabel,this.showLaunchSite="pta"!==AppConfig.appShortName,this.showPendingMembers="pta"===AppConfig.appShortName||"block-club"===AppConfig.appShortName||"neighborhood"===AppConfig.appShortName,this.hasMemberNotOwnerRenter="pta"===AppConfig.appShortName||"block-club"===AppConfig.appShortName||"neighborhood"===AppConfig.appShortName,this.showAddHomeLink=!this.siteInfo.privateSiteInfo.siteLaunchedDateUtc&&moment().isBefore(moment(this.siteInfo.privateSiteInfo.creationDate).add(5,"days")),this.showPendingMembers&&(this.pendingMemberSignUpUrl="https://"+HtmlUtil.getSubdomain()+"."+AppConfig.baseTld+"/#!/MemberSignUp",setTimeout(function(){var e=new Clipboard(".clipboard-button");e.on("success",function(e){r.HtmlUtil2.showTooltip(e.trigger,"Copied!"),e.clearSelection()}),e.on("error",function(e){r.HtmlUtil2.showTooltip(e.trigger,"Auto-copy failed, press CTRL+C now")})},750)),this.boardPositions=r.FellowResidentsService.BoardPositionNames,this.newResident={boardPosition:0,isRenter:!1},this.editUser=null;var i="residentSort_v2",e={field:"lastName",direction:this.uiGridConstants.ASC};if(this.residentSortInfo=e,window.localStorage){var n=window.localStorage.getItem(i);n&&(this.residentSortInfo=JSON.parse(n)),this.residentSortInfo.field||(this.residentSortInfo=e)}var o="hoa"===AppConfig.appShortName?140:this.showIsRenter?62:175,s=this;if(this.residentGridOptions={data:[],enableFiltering:!1,columnDefs:[{field:"firstName",displayName:"First Name",cellClass:"resident-cell-first",enableFiltering:!0},{field:"lastName",displayName:"Last Name",cellClass:"resident-cell-last",enableFiltering:!0},{field:"email",displayName:"Email",cellTemplate:'<div class="ui-grid-cell-contents" ng-class="col.colIndex()"><span ng-cell-text class="resident-cell-email" data-ng-style="{ \'color\': row.entity.postmarkReportedBadEmailUtc ? \'#F00\' : \'auto\' }">{{ row.entity.email }}</span></div>',enableFiltering:!0},{field:"phoneNumber",displayName:"Phone Number",width:150,cellClass:"resident-cell-phone",cellTemplate:'<div class="ui-grid-cell-contents" ng-class="col.colIndex()"><span ng-cell-text>{{ row.entity.phoneNumber | tel }}</span></div>',enableFiltering:!0},{field:"unitGridLabel",displayName:"condo"===AppConfig.appShortName?"Unit":"Residence",cellClass:"resident-cell-unit",width:o,visible:AppConfig.isChtnSite,sortingAlgorithm:function(e,t){return s.shouldSortUnitsNumerically?parseInt(e)-parseInt(t):e.toString().localeCompare(t.toString())},enableFiltering:!0},{field:"isRenter",displayName:"Renter",width:80,cellClass:"resident-cell-is-renter",visible:this.showIsRenter,cellTemplate:'<div class="ui-grid-cell-contents" style="text-align:center; padding-top: 8px;"><input type="checkbox" disabled="disabled" data-ng-checked="row.entity.isRenter"></div>',enableFiltering:!1},{field:"boardPosition",displayName:"Board",width:125,cellClass:"resident-cell-board",cellTemplate:'<div class="ui-grid-cell-contents" ng-class="col.colIndex()"><span ng-cell-text>{{ grid.appScope.$ctrl.getBoardPositionName(row.entity.boardPosition) }}</span></div>',enableFiltering:!1},{field:"isSiteManager",displayName:"Admin",width:80,cellClass:"resident-cell-site-manager",cellTemplate:'<div class="ui-grid-cell-contents" style="text-align:center; padding-top: 8px;"><input type="checkbox" disabled="disabled" data-ng-checked="row.entity.isSiteManager"></div>',enableFiltering:!1}],multiSelect:!1,enableSorting:!0,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableVerticalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableFullRowSelection:!0,enableColumnMenus:!1,enableRowHeaderSelection:!1,onRegisterApi:function(e){(s.gridApi=e).selection.on.rowSelectionChanged(s.$rootScope,function(e){e.isSelected;s.setEdit(e.entity)}),e.core.on.sortChanged(s.$rootScope,function(e,t){t&&0!==t.length&&(s.residentSortInfo={field:t[0].field,direction:t[0].sort.direction},window.localStorage.setItem(i,JSON.stringify(s.residentSortInfo)))}),HtmlUtil.uiGridFixScroll()}},this.pendingMemberGridOptions={data:[],columnDefs:[{field:"firstName",displayName:"First Name"},{field:"lastName",displayName:"Last Name"},{field:"email",displayName:"Email"},{field:"phoneNumber",displayName:"Phone Number",width:150,cellClass:"resident-cell-phone",cellTemplate:'<div class="ui-grid-cell-contents" ng-class="col.colIndex()"><span ng-cell-text>{{ row.entity.phoneNumber | tel }}</span></div>'}],multiSelect:!1,enableSorting:!0,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableVerticalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableFullRowSelection:!0,enableColumnMenus:!1,enableRowHeaderSelection:!1,onRegisterApi:function(e){(t.pendingMemberGridApi=e).selection.on.rowSelectionChanged(t.$rootScope,function(e){t.selectPendingMember(e.entity)}),HtmlUtil.uiGridFixScroll()}},window.innerWidth<769)for(var a=2;a<this.residentGridOptions.columnDefs.length;++a)this.residentGridOptions.columnDefs[a].visible=!1;this.emailHistoryGridOptions={columnDefs:[{field:"senderName",displayName:"Sender",width:150},{field:"recipientGroup",displayName:"Sent To",width:100},{field:"messageSource",displayName:"Source",width:100},{field:"subject",displayName:"Subject"},{field:"sendDateUtc",displayName:"Send Date",width:140,type:"date",cellFilter:"date:'short'"},{field:"numRecipients",displayName:"#Recip.",width:70},{field:"numAttachments",displayName:"#Attach.",width:80}],enableSorting:!0,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableVerticalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableColumnMenus:!1,enablePaginationControls:!0,paginationPageSize:20,paginationPageSizes:[20],enableRowHeaderSelection:!1,onRegisterApi:function(e){(t.emailHistoryGridApi=e).selection.on.rowSelectionChanged(t.$rootScope,function(e){t.viewingRecentEmailBody=e.entity.messageBody}),HtmlUtil.uiGridFixScroll()}},this.refreshResidents().then(function(){return t.loadSettings()}).then(function(){"true"===t.appCacheService.getAndClear("goToEmailHistory")&&(document.getElementById("toggle-email-history-link").scrollIntoView(),t.toggleEmailHistoryVisible()),t.showPendingMembers&&t.loadPendingMembers()})},e.prototype.getBoardPositionName=function(i){if(!i)return"";var e=jQuery.grep(r.FellowResidentsService.BoardPositionNames,function(e,t){return e.id===i})[0];return e?e.name:""},e.prototype.selectPendingMember=function(e){this.pendingMemberGridApi.selection.clearSelectedRows();var t=new c;t.firstName=e.firstName,t.lastName=e.lastName,t.email=e.email,t.phoneNumber=e.phoneNumber,t.pendingMemberId=e.pendingMemberId,t.boardPosition=0,t.shouldSendWelcomeEmail=!1,this.setEdit(t)},e.prototype.closeViewingEmail=function(){this.viewingRecentEmailBody=null,this.emailHistoryGridApi.selection.clearSelectedRows()},e.prototype.setEdit=function(e){var i=this;if(this.sentWelcomeEmail=!1,null!==e){this.selectedResidentDetailsView="Primary",this.editUserForm.$setPristine();var t=jQuery.extend({},e);if(this.editUser=t,this.editUser.showAdvancedHomePicker=!!this.allUnits&&20<this.allUnits.length,this.multiselectMulti="single","object"==typeof this.editUser.units&&(0<this.editUser.units.length&&(this.editUser.singleUnitId=this.editUser.units[0].unitId),1<this.editUser.units.length&&(this.editUser.showAdvancedHomePicker=!0,this.multiselectMulti="multiple")),this.allUnits&&20<this.allUnits.length&&"single"===this.multiselectMulti&&-5!==this.allUnits[0].unitId){var n=new r.Unit;n.name="None Selected",n.unitId=-5,this.allUnits.unshift(n)}_.each(this.allUnits,function(t){var e=void 0!==_.find(i.editUser.units,function(e){return e.unitId===t.unitId});t.isSelectedForEditUser=e}),this.gridApi.selection.clearSelectedRows(),setTimeout("$( '#edit-user-first-text-box' ).focus();",100)}else this.editUser=null},e.prototype.onSendWelcome=function(){this.isSavingUser=!0;var e=this;this.$http.put("/api/Residents/"+this.editUser.userId+"/SendWelcome",null).success(function(){e.isSavingUser=!1,e.sentWelcomeEmail=!0}).error(function(){e.isSavingUser=!1,alert("Failed to send the welcome email, please contact support if this problem persists.")})},e.prototype.populateGridUnitLabels=function(){_.each(this.residentGridOptions.data,function(e){var t=_.reduce(e.units,function(e,t){return 0<e.length?e+","+t.name:t.name},"");e.unitGridLabel=t})},e.prototype.refreshResidents=function(){var i=this;this.isLoading=!0;var n=this;return this.$http.get("/api/Residents").success(function(e){if(n.isLoading=!1,n.residentGridOptions.data=e,n.residentGridOptions.minRowsToShow=e.length,n.residentGridOptions.virtualizationThreshold=e.length,n.residentGridOptions.enableFiltering=15<e.length,n.gridApi.core.notifyDataChange(i.uiGridConstants.dataChange.COLUMN),n.hasOneAdmin=1===_.filter(e,function(e){return e.isSiteManager}).length&&1<e.length,n.residentSortInfo){var t=_.find(n.gridApi.grid.columns,function(e){return e.field===n.residentSortInfo.field});t&&n.gridApi.grid.sortColumn(t,n.residentSortInfo.direction,!1)}_.forEach(e,function(e){e.fullName=e.firstName+" "+e.lastName,"string"==typeof e.email&&-1!==e.email.indexOf("@condoally.com")&&(e.email=""),e.lastLoginDateUtc&&(e.lastLoginDateUtc=moment.utc(e.lastLoginDateUtc).toDate())}),n.populateGridUnitLabels(),!n.allUnits&&AppConfig.isChtnSite&&(n.isLoading=!0,n.$http.get("/api/Unit").then(function(e){n.isLoading=!1,n.allUnits=e.data,n.shouldSortUnitsNumerically=_.every(n.allUnits,function(e){return HtmlUtil.isNumericString(e.name)}),n.shouldSortUnitsNumerically&&(n.allUnits=_.sortBy(n.allUnits,function(e){return parseFloat(e.name)})),n.multiselectOptions=20<n.allUnits.length?"filter":""},function(){n.isLoading=!1,alert("Failed to retrieve your association's home listing, please contact support.")}))})},e.prototype.loadPendingMembers=function(){var t=this;this.isLoadingPending=!0,this.$http.get("/api/Member/Pending").then(function(e){t.isLoadingPending=!1,t.pendingMemberGridOptions.data=e.data,t.pendingMemberGridOptions.minRowsToShow=e.data.length,t.pendingMemberGridOptions.virtualizationThreshold=e.data.length},function(e){t.isLoadingPending=!1})},e.prototype.enableMultiHomePicker=function(){this.editUser&&(this.editUser.showAdvancedHomePicker=!0),this.multiselectMulti="multiple",this.allUnits&&0<this.allUnits.length&&null===this.allUnits[0].unitId&&this.allUnits.shift()},e.prototype.rejectPendingMember=function(){var t=this;this.editUser.pendingMemberId&&confirm("Are you sure you want to remove this pending member? This action cannot be undone.")&&(this.isLoading=!1,this.$http.put("/api/Member/Pending/Deny/"+this.editUser.pendingMemberId,null).then(function(){t.isLoading=!1,t.editUser=null,t.loadPendingMembers()},function(e){t.isLoading=!1,alert("Failed to reject pending member: "+e.data.exceptionMessage)}))},e.prototype.onSaveResident=function(){if(this.editUser&&($("#editUserForm").validate(),$("#editUserForm").valid()&&(this.editUser.userId!==this.$rootScope.userInfo.userId||!this.siteInfo.userInfo.isSiteManager||this.editUser.isSiteManager||confirm("If you remove yourself as a site admin you won't be able to continue making changes. Are you sure you want to remove yourself as a site admin?")))){this.editUser.showAdvancedHomePicker||(this.editUser.singleUnitId?this.editUser.units=[{unitId:this.editUser.singleUnitId,name:null,memberHomeId:null,userId:this.editUser.userId,isRenter:!1}]:this.editUser.units=[]),this.isSavingUser=!0;var i=this,e=function(e){i.isSavingUser=!1,"string"!=typeof e.data.errorMessage?(i.editUser.pendingMemberId&&i.loadPendingMembers(),i.editUser=null,i.refreshResidents()):alert("Failed to add resident: "+e.data.errorMessage)},n=!1,t=function(e){i.isSavingUser=!1;var t=n?"Failed to add new resident":"Failed to update resident";e&&e.data&&e.data.exceptionMessage&&(t+=": "+e.data.exceptionMessage),alert(t)};this.editUser.userId?(n=!1,analytics.track("editResident"),this.$http.put("/api/Residents/UpdateUser",this.editUser).then(e,t)):(n=!0,analytics.track("addNewResident"),this.$http.post("/api/Residents",this.editUser).then(e,t)),this.fellowResidents.clearResidentCache()}},e.prototype.OnAdminSetPassword=function(){var e={userName:this.adminSetPass_Username,password:this.adminSetPass_Password},t=this;this.$http.post("/api/AdminHelper/SetPassword",e).success(function(e){t.adminSetPass_ResultMessage=e}).error(function(e){var t=e.exceptionMessage?e.exceptionMessage:e;alert("Failed to set password: "+t)})},e.prototype.loadSettings=function(){var t=this;this.isLoadingSettings=!0;var i=this;this.$http.get("/api/Settings").success(function(e){i.isLoadingSettings=!1,t.residentSettings=e,t.siteInfo.privateSiteInfo.rentersCanViewDocs=t.residentSettings.rentersCanViewDocs,t.siteInfo.privateSiteInfo.whoCanCreateDiscussionThreads=t.residentSettings.whoCanCreateDiscussionThreads}).error(function(e){i.isLoadingSettings=!1,console.log("Failed to retrieve settings")})},e.prototype.exportResidentCsv=function(){"undefined"!=typeof analytics&&analytics.track("exportResidentCsv");var t=this,e=[{headerText:"First Name",fieldName:"firstName"},{headerText:"Last Name",fieldName:"lastName"},{headerText:"Phone",fieldName:"phoneNumber"},{headerText:"Email",fieldName:"email"},{headerText:"Unit",fieldName:"unitGridLabel"},{headerText:"Is Renter",fieldName:"isRenter"},{headerText:"Is Admin",fieldName:"isSiteManager"},{headerText:"Board Position",fieldName:"boardPosition",dataMapper:function(e){return t.getBoardPositionName(e)}},{headerText:"Alternate Mailing",fieldName:"mailingAddressObject",dataMapper:function(e){return e?e.oneLiner:""}},{headerText:"Alternate Phone",fieldName:"alternatePhoneNumber"},{headerText:"Manager Notes",fieldName:"managerNotes"},{headerText:"Last Login Date",fieldName:"lastLoginDateUtc",dataMapper:function(e){return e?moment(e).format("YYYY-MM-DD HH:mm:00"):"Has not logged-in"}}],i=r.createCsvString(this.residentGridOptions.data,e);r.HtmlUtil2.downloadCsv(i,"Residents.csv")},e.prototype.exportKansasPtaCsv=function(){if(this.siteInfo.privateSiteInfo.ptaUnitId){"undefined"!=typeof analytics&&analytics.track("exportKansasPtaCsv");for(var e=0,t=_.clone(this.residentGridOptions.data);e<t.length;e++){var i=t[e];i.Local_Unit=this.siteInfo.privateSiteInfo.ptaUnitId.toString(),i.Membership_Name=i.firstName&&"N/A"!==i.firstName?i.firstName:i.lastName,0!==i.boardPosition&&(i.Position=this.getBoardPositionName(i.boardPosition))}var n=r.createCsvString(this.residentGridOptions.data,[{headerText:"Local_Unit",fieldName:"Local_Unit"},{headerText:"First_Name",fieldName:"firstName"},{headerText:"Last_Name",fieldName:"lastName"},{headerText:"Number_of_Members",fieldName:"Number_of_Members"},{headerText:"Membership_Name",fieldName:"Membership_Name"},{headerText:"Name_Prefix",fieldName:"Name_Prefix"},{headerText:"Middle_Name",fieldName:"Middle_Name"},{headerText:"Name_Suffix",fieldName:"Name_Suffix"},{headerText:"Email",fieldName:"email"},{headerText:"Address_1",fieldName:"Address_1"},{headerText:"Address_2",fieldName:"Address_2"},{headerText:"Address_3",fieldName:"Address_3"},{headerText:"City",fieldName:"City"},{headerText:"State",fieldName:"State"},{headerText:"Zip",fieldName:"Zip"},{headerText:"Home_Telephone",fieldName:"phoneNumber"},{headerText:"Work_Telephone",fieldName:"Work_Telephone"},{headerText:"Mobile_Number",fieldName:"Mobile_Number"},{headerText:"Position",fieldName:"Position"},{headerText:"Begin_Date",fieldName:"Begin_Date"},{headerText:"End_Date",fieldName:"End_Date"},{headerText:"Second_Name",fieldName:"Second_Name"},{headerText:"Second_Email",fieldName:"Second_Email"},{headerText:"Teacher1",fieldName:"Teacher1"},{headerText:"Teacher2",fieldName:"Teacher2"},{headerText:"Teacher3",fieldName:"Teacher3"},{headerText:"Children_Names",fieldName:"Children_Names"}]);n="data:text/csv;charset=utf-8,"+n;var o=encodeURI(n),s=document.createElement("a");s.setAttribute("href",o),s.setAttribute("download","pta-members.csv"),document.body.appendChild(s),s.click(),setTimeout(function(){document.body.removeChild(s)},500)}else alert("You must first set your PTA unit ID in Manage -> Settings before you can export in this format.")},e.prototype.saveResidentSettings=function(){var e=this;analytics.track("editResidentSettings"),this.isLoadingSettings=!0,this.$http.put("/api/Settings",this.residentSettings).success(function(){e.isLoadingSettings=!1,e.fellowResidents.clearResidentCache(),e.siteInfo.privateSiteInfo.canHideContactInfo=e.residentSettings.canHideContactInfo,e.siteInfo.privateSiteInfo.isDiscussionEmailGroupEnabled=e.residentSettings.isDiscussionEmailGroupEnabled}).error(function(){e.isLoadingSettings=!1,alert("Failed to update settings, please try again or contact support.")})},e.prototype.onDeleteResident=function(){if(confirm("Are you sure you want to remove this person from your building?")&&(this.siteInfo.userInfo.userId!==this.editUser.userId||confirm("If you remove your own account you won't be able to login anymore. Are you still sure?"))){this.isSavingUser=!0;var e=this;this.$http.delete("/api/Residents?userId="+this.editUser.userId).success(function(){e.isSavingUser=!1,e.editUser=null,e.fellowResidents.clearResidentCache(),e.refreshResidents()}).error(function(){alert("Failed to remove the resident. Please let support know if this continues to happen."),e.isSavingUser=!1,e.editUser=null})}},e.prototype.onSendAllWelcome=function(){if(confirm("This will email all of the residents in your association. Do you want to proceed?")){this.isLoading=!0;var t=this;this.$http.put("/api/Residents/UserAction?userId&action=launchsite",null).success(function(e){t.isLoading=!1,t.sentWelcomeEmail=!0,t.allEmailsSent=!0}).error(function(){t.isLoading=!1,alert("Failed to send welcome email, please contact support if this problem persists.")})}},e.prototype.parseBulkCsv=function(){var a=$.csv.toArrays(this.bulkImportCsv);this.bulkImportRows=[];var r=function(e){e||(e="");var t=e.toLowerCase();return t=(t=(t=(t=(t=(t=(t=(t=t.replace(/0th /g,"0 ").replace(/1st /g,"1 ")).replace(/2nd /g,"2 ").replace(/3rd /g,"3 ")).replace(/4th /g,"4 ").replace(/5th /g,"5 ")).replace(/6th /g,"6 ").replace(/7th /g,"7 ")).replace(/8th /g,"8 ").replace(/9th /g,"9 ")).replace(/\./g,"").replace(/ /g,"")).replace(/street/g,"st").replace(/road/g,"rd").replace(/drive/g,"dr")).replace(/place/g,"pl").replace(/avenue/g,"ave")};if(this.allUnits)for(var l=0;l<this.allUnits.length;++l)this.allUnits[l].csvTestName=r(this.allUnits[l].name);var d,c,e=function(){for(var e=a[l];e.length<10;)e.push("");if("unit name"===e[0]&&"e-mail address"===e[1]&&"first name"===e[2])return"continue";for(var t=0;t<e.length;++t)HtmlUtil.isNullOrWhitespace(e[t])?e[t]=null:e[t]=e[t].trim();var i={unitName:e[0]||null,unitId:void 0,email:e[1],firstName:e[2],lastName:e[3],phoneNumber:e[4],isRenter:!HtmlUtil.isNullOrWhitespace(e[5]),isAdmin:!HtmlUtil.isNullOrWhitespace(e[6]),csvTestName:"",mailingAddress:e[7],alternatePhone:e[8],managerNotes:e[9]};HtmlUtil.isNullOrWhitespace(i.unitName)?i.unitId=null:(i.csvTestName=r(i.unitName),d=_.find(p.allUnits,function(e){return e.csvTestName===i.csvTestName}),i.unitId=d?d.unitId:void 0);var n=null;if(i.firstName&&-1!==i.firstName.toLowerCase().indexOf(" and ")){if(n=_.clone(i),c=i.firstName.split(" and "),i.firstName=c[0],n.firstName=c[1],i.email&&-1!==i.email.indexOf(" / ")){var o=i.email.split(" / ");i.email=o[0],n.email=o[1]}else n.email="";n.phoneNumber=""}if(p.bulkParseNormalizeNameCase){var s=function(e){return e?1===e.length?e.toUpperCase():e.charAt(0).toUpperCase()+e.substr(1).toLowerCase():e};i.firstName=s(i.firstName),i.lastName=s(i.lastName),n&&(n.firstName=s(n.firstName),n.lastName=s(n.lastName))}p.bulkImportRows.push(i),n&&p.bulkImportRows.push(n)},p=this;for(l=0;l<a.length;++l)e()},e.prototype.submitBulkRows=function(){this.isLoading=!0;var e=this;this.$http.post("/api/Residents/BulkLoad",this.bulkImportRows).success(function(){e.isLoading=!1,e.bulkImportRows=[new p],e.bulkImportCsv="",alert("Success"),e.refreshResidents()}).error(function(){e.isLoading=!1,alert("Bulk upload failed")})},e.prototype.addBulkRow=function(){var e={unitName:"",unitId:null,email:"",firstName:"",lastName:"",phoneNumber:"",isRenter:!1,isAdmin:!1,csvTestName:void 0,mailingAddress:"",alternatePhone:"",managerNotes:""};if(this.allUnits&&0<this.bulkImportRows.length){var t=this.bulkImportRows[this.bulkImportRows.length-1].unitId,i=_.findIndex(this.allUnits,function(e){return e.unitId===t});++i<this.allUnits.length&&(e.unitName=this.allUnits[i].name,e.unitId=this.allUnits[i].unitId)}this.bulkImportRows.push(e)},e.prototype.toggleEmailHistoryVisible=function(){var t=this;this.showEmailHistory=!this.showEmailHistory,this.viewingRecentEmailBody=null,this.showEmailHistory&&!this.emailHistoryGridOptions.data&&(this.isLoadingSettings=!0,this.$http.get("/api/Email/RecentGroupEmails").then(function(e){t.isLoadingSettings=!1,t.emailHistoryGridOptions.data=e.data},function(e){t.isLoadingSettings=!1,alert("Failed to load emails: "+e.data.exceptionMessage)}))},e.$inject=["$http","$rootScope","fellowResidents","uiGridConstants","SiteInfo","appCacheService"],e}();r.ManageResidentsController=u}(Ally||(Ally={})),CA.angularApp.component("manageResidents",{templateUrl:"/ngApp/chtn/manager/manage-residents.html",controller:Ally.ManageResidentsController}),function(e){var t=function(){function e(e,t,i){this.$http=e,this.siteInfo=t,this.$location=i,this.isLoading=!1,this.appShortName=AppConfig.appShortName}return e.prototype.$onInit=function(){var t=this;this.isLoading=!0,this.$http.get("/api/Association/GroupAmenities").then(function(e){t.isLoading=!1,t.groupAmenities=e.data},function(e){t.isLoading=!1,alert("Failed to retrieve amenity data: "+e.data.exceptionMessage)})},e.prototype.saveForm=function(){var t=this;this.isLoading=!0,this.$http.put("/api/Association/GroupAmenities",this.groupAmenities).then(function(e){t.$location.path("/Home")},function(e){t.isLoading=!1,alert("Failed to save: "+e.data.exceptionMessage)})},e.$inject=["$http","SiteInfo","$location"],e}();e.GroupAmenitiesController=t}(Ally||(Ally={})),CA.angularApp.component("groupAmenities",{templateUrl:"/ngApp/chtn/manager/settings/group-amenities.html",controller:Ally.GroupAmenitiesController}),function(s){var e=function(){function e(e,t,i,n,o){this.$http=e,this.siteInfo=t,this.appCacheService=i,this.$timeout=n,this.$scope=o,this.settings=new s.ChtnSiteSettings,this.isLoading=!1,this.isLoadingUsage=!1,this.shouldShowPremiumPlanSection=!0,this.shouldShowPaymentForm=!1,this.stripeApi=null,this.stripeCardElement=null,this.isActivatingAnnual=!0,this.monthlyDisabled=!1,this.planExpirationColor="red",this.groupEmailChartData=[],this.groupEmailAverage=0,this.genInvoiceNumMonths=1,this.genInvoiceShouldIncludeWireInfo=!1,this.emailUsageChartData=[],this.emailUsageChartLabels=[],this.emailUsageChartOptions={},this.emailUsageAverageNumMonths=0,this.emailUsageAverageSent=0,this.showInvoiceSection=!1,this.paymentType="creditCard",this.shouldShowPremiumPlanSection="condo"===AppConfig.appShortName||"hoa"===AppConfig.appShortName,this.homeNamePlural=AppConfig.homeName.toLowerCase()+"s",this.showInvoiceSection=t.userInfo.isAdmin;try{this.stripeApi=Stripe(StripeApiKey)}catch(e){console.log(e)}}return e.prototype.$onInit=function(){var t=this;this.monthlyDisabled=this.siteInfo.privateSiteInfo.numUnits<=10,this.refreshData(),this.showInvoiceSection&&this.$timeout(function(){return t.$http.get("/api/DocumentLink/0").then(function(e){return t.viewPremiumInvoiceViewId=e.data.vid})},250)},e.prototype.cancelPremiumAutoRenew=function(){var t=this;confirm("Are you sure?")&&(this.isLoading=!0,this.$http.put("/api/Settings/CancelPremium",null).then(function(e){t.isLoading=!1,t.settings.premiumPlanIsAutoRenewed=!1,t.shouldShowPaymentForm=!1,t.refreshData()},function(){t.isLoading=!1,alert("Failed to cancel the premium plan. Refresh the page and try again or contact support if the problem persists.")}))},e.prototype.showStripeError=function(e){var t=document.getElementById("card-errors");HtmlUtil.isNullOrWhitespace(e)?t.textContent="Unknown Error":t.textContent=e},e.prototype.initStripePayment=function(){var t=this,e=this.stripeApi.elements();this.stripeCardElement=e.create("card",{style:{base:{color:"#32325d",fontFamily:'"Helvetica Neue", Helvetica, sans-serif',fontSmoothing:"antialiased",fontSize:"16px","::placeholder":{color:"#aab7c4"}},invalid:{color:"#fa755a",iconColor:"#fa755a"}}}),this.stripeCardElement.mount("#stripe-card-element");this.stripeCardElement.on("change",function(e){document.getElementById("card-errors");e.error?t.showStripeError(e.error.message):t.showStripeError(null)})},e.prototype.submitCardToStripe=function(){var i=this;return this.isLoading=!0,this.stripeApi.createPaymentMethod({type:"card",card:this.stripeCardElement}).then(function(e){if(e.error)i.isLoading=!1,i.showStripeError(e.error.message);else{var t={stripePaymentMethodId:e.paymentMethod.id,shouldPayAnnually:i.isActivatingAnnual};i.$http.put("/api/Settings/ActivatePremium",t).then(function(e){i.isLoading=!1,i.settings.premiumPlanIsAutoRenewed=!0,i.shouldShowPaymentForm=!1,i.refreshData()},function(e){i.isLoading=!1,alert("Failed to activate the premium plan. Refresh the page and try again or contact support if the problem persists: "+e.data.exceptionMessage)})}i.$scope.$apply()})},e.prototype.generateStripeInvoice=function(e,t){var i=this,n="PublicSettings/ViewPremiumInvoice?vid="+this.viewPremiumInvoiceViewId+"&numMonths="+e+"&shouldIncludeWireInfo="+t;window.open(this.siteInfo.publicSiteInfo.baseApiUrl+n,"_blank"),this.$timeout(function(){i.$http.get("/api/DocumentLink/0").then(function(e){return i.viewPremiumInvoiceViewId=e.data.vid})},1250)},e.prototype.activatePremiumRenewal=function(){var e=this;this.shouldShowPaymentForm=!0,this.updateCheckoutDescription(),this.$timeout(function(){return e.initStripePayment()},250)},e.prototype.updateCheckoutDescription=function(){var e,t=moment(this.premiumPlanRenewDate).isBefore();this.isActivatingAnnual?(e=11*this.settings.premiumPlanCostDollars,this.checkoutDescription="You will be charged $"+e+" ",this.checkoutDescription+=t?" today and you will be charged annually on this date thereafter.":" on "+moment(this.premiumPlanRenewDate).format("dddd, MMMM Do YYYY")+" and you will be charged annually on that date thereafter."):(e=this.settings.premiumPlanCostDollars,this.checkoutDescription="You will be charged $"+this.settings.premiumPlanCostDollars+" ",this.checkoutDescription+=t?" today and you will be charged monthly on this date thereafter.":" on "+moment(this.premiumPlanRenewDate).format("dddd, MMMM Do YYYY")+" and you will be charged monthly on that date thereafter."),this.payButtonText=t?"Pay $"+e:"Schedule Payment"},e.prototype.createSubscription=function(e){var t=this;return fetch("/create-subscription",{method:"post",headers:{"Content-type":"application/json"},body:JSON.stringify({paymentMethodId:e})}).then(function(e){return e.json()}).then(function(e){if(e.error)throw e;return e}).then(function(e){return{paymentMethodId:e.paymentMethodId,priceId:e.priceId,subscription:e.subscription}}).catch(function(e){t.showStripeError(e)})},e.prototype.handlePaymentThatRequiresCustomerAction=function(e){var t=this,i=e.subscription,n=e.invoice,o=e.priceId,s=e.paymentMethodId,a=e.isRetry;if(i&&"active"===i.status)return{subscription:i,priceId:o,paymentMethodId:s};var r=n?n.payment_intent:i.latest_invoice.payment_intent;return"requires_action"===r.status||!0===a&&"requires_payment_method"===r.status?this.stripeApi.confirmCardPayment(r.client_secret,{payment_method:s}).then(function(e){if(e.error)throw e;if("succeeded"===e.paymentIntent.status)return{priceId:o,subscription:i,invoice:n,paymentMethodId:s}}).catch(function(e){t.showStripeError(e)}):{subscription:i,priceId:o,paymentMethodId:s}},e.prototype.handleRequiresPaymentMethod=function(e){var t=e.subscription,i=e.paymentMethodId,n=e.priceId;if("active"===t.status)return{subscription:t,priceId:n,paymentMethodId:i};if("requires_payment_method"===t.latest_invoice.payment_intent.status)throw localStorage.setItem("latestInvoiceId",t.latest_invoice.id),localStorage.setItem("latestInvoicePaymentIntentStatus",t.latest_invoice.payment_intent.status),{error:{message:"Your card was declined."}};return{subscription:t,priceId:n,paymentMethodId:i}},e.prototype.refreshMeteredUsage=function(){var l=this;this.isLoadingUsage=!0,this.$http.get("/api/Settings/MeteredFeaturesUsage").then(function(e){l.isLoadingUsage=!1,l.meteredUsage=e.data,l.meteredUsage.months=_.sortBy(l.meteredUsage.months,function(e){return e.year.toString()+"_"+(9<e.month?"":"0")+e.month}),l.emailUsageChartLabels=[];for(var t=[],i=[],n=0,o=0,s=0;s<e.data.months.length;++s){var a=e.data.months[s],r=moment([a.year,a.month-1,1]).format("MMMM");0===s||s===l.meteredUsage.months.length-1?l.emailUsageChartLabels.push(r+" "+a.year):l.emailUsageChartLabels.push(r),t.push(a.numEmailsSent),i.push(a.numGroupEmailsProcessed),n+=a.numEmailsSent,o+=a.numGroupEmailsProcessed}l.emailUsageChartData=[t],l.groupEmailChartData=[i],l.emailUsageAverageNumMonths=e.data.months.length,1<l.emailUsageAverageNumMonths&&(l.emailUsageAverageSent=Math.round(n/l.emailUsageAverageNumMonths),l.groupEmailAverage=Math.round(o/l.emailUsageAverageNumMonths))}),this.emailUsageChartOptions={scales:{yAxes:[{id:"y-axis-1",type:"linear",display:!0,position:"left",ticks:{suggestedMin:0,beginAtZero:!0}}]}}},e.prototype.refreshData=function(){var i=this;this.isLoading=!0,this.$http.get("/api/Settings").then(function(e){if(i.isLoading=!1,i.settings=e.data,i.isPremiumPlanActive=i.siteInfo.privateSiteInfo.isPremiumPlanActive,i.premiumPlanRenewDate=new Date,i.premiumPlanRenewDate=moment(i.settings.premiumPlanExpirationDate).add(1,"days").toDate(),i.settings.premiumPlanIsAutoRenewed)i.planExpirationColor="green",i.$http.get("/api/Settings/StripeBillingPortal").then(function(e){return i.stripePortalUrl=e.data.portalUrl});else{var t=moment(i.settings.premiumPlanExpirationDate).add(-2,"months");moment().isBefore(t)?i.planExpirationColor="green":i.planExpirationColor="red"}i.refreshMeteredUsage()})},e.prototype.goToEmailHistory=function(){return this.appCacheService.set("goToEmailHistory","true"),window.location.hash="#!/ManageResidents",!0},e.prototype.startPlaidAchConnection=function(){var i=this;this.isLoading=!0,this.$http.get("/api/Plaid/StripeLinkToken").then(function(e){if(i.isLoading=!1,e.data){var t={token:e.data,onSuccess:function(e,t){console.log("Plaid StripeLinkToken onSuccess",t),i.completePlaidAchConnection(e,t.account_id)},onLoad:function(){},onExit:function(e,t){console.log("update onExit.err",e,t)},onEvent:function(e,t){console.log("update onEvent.eventName",e,t)},receivedRedirectUri:null};Plaid.create(t).open()}else alert("Failed to start Plaid connection. Please contact support.")},function(e){i.isLoading=!1,alert("Failed to start Plaid connection: "+e.data.exceptionMessage)})},e.prototype.completePlaidAchConnection=function(e,t){var i=this;this.isLoading=!0;var n={accessToken:e,selectedAccountIds:[t]};this.$http.post("/api/Plaid/ProcessStripeAccessToken",n).then(function(e){i.isLoading=!1,i.checkoutDescription="Account successfully linked, reloading...",window.location.reload()},function(e){i.isLoading=!1,alert("Failed to link account: "+e.data.exceptionMessage)})},e.prototype.makeAchStripePayment=function(){var t=this;this.isLoading=!0;var e={shouldPayAnnually:this.isActivatingAnnual,payViaAch:!0};this.$http.put("/api/Settings/ActivatePremium",e).then(function(e){t.isLoading=!1,t.settings.premiumPlanIsAutoRenewed=!0,t.shouldShowPaymentForm=!1,t.refreshData()},function(e){t.isLoading=!1,alert("Failed to activate the premium plan. Refresh the page and try again or contact support if the problem persists: "+e.data.exceptionMessage)})},e.prototype.onPaymentTypeChange=function(){var e=this;"creditCard"===this.paymentType&&this.$timeout(function(){return e.initStripePayment()},250)},e.$inject=["$http","SiteInfo","appCacheService","$timeout","$scope"],e}();s.PremiumPlanSettingsController=e;var t=function(){};s.GroupMonthEmails=t}(Ally||(Ally={})),CA.angularApp.component("premiumPlanSettings",{templateUrl:"/ngApp/chtn/manager/settings/premium-plan-settings.html",controller:Ally.PremiumPlanSettingsController});var StripePayNeedsCustomer=function(){},MeteredFeaturesUsage=function(){};!function(e){var t=function(){function e(e,t,i){this.$http=e,this.siteInfo=t,this.$routeParams=i,this.shouldShowPremiumPlanSection=!0,this.selectedView=this.$routeParams.viewName||"SiteSettings",this.shouldShowPremiumPlanSection="condo"===AppConfig.appShortName||"hoa"===AppConfig.appShortName,this.shouldShowPremiumPlanSection||(this.selectedView="SiteSettings")}return e.prototype.$onInit=function(){},e.$inject=["$http","SiteInfo","$routeParams"],e}();e.SettingsParentController=t}(Ally||(Ally={})),CA.angularApp.component("settingsParent",{templateUrl:"/ngApp/chtn/manager/settings/settings-parent.html",controller:Ally.SettingsParentController});__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}}();!function(i){var e=function(){},s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t}(i.BaseSiteSettings=e);i.ChtnSiteSettings=s;var t=function(){function e(e,t,i,n,o){this.$http=e,this.siteInfo=t,this.$timeout=i,this.$scope=n,this.$rootScope=o,this.settings=new s,this.originalSettings=new s,this.isLoading=!1,this.showRightColumnSetting=!0,this.showLocalNewsSetting=!1,this.isPta=!1}return e.prototype.$onInit=function(){var e=this;this.frontEndVersion=appVer.toString(),this.defaultBGImage=$(document.documentElement).css("background-image"),this.showQaButton="president@mycondoally.com"===this.siteInfo.userInfo.emailAddress,this.loginImageUrl=this.siteInfo.publicSiteInfo.loginImageUrl,this.showRightColumnSetting=this.siteInfo.privateSiteInfo.creationDate<i.SiteInfoService.AlwaysDiscussDate,this.showLocalNewsSetting=!this.showRightColumnSetting,this.isPta="pta"===AppConfig.appShortName,this.$timeout(function(){return e.hookUpLoginImageUpload()},200),this.refreshData()},e.prototype.refreshData=function(){var t=this;this.isLoading=!0,this.$http.get("/api/Settings").then(function(e){t.isLoading=!1,t.settings=e.data,t.originalSettings=_.clone(e.data),t.welcomeRichEditorElem||t.$timeout(function(){i.RichTextHelper.initToolbarBootstrapBindings(),t.welcomeRichEditorElem=$("#welcome-rich-editor"),t.welcomeRichEditorElem.wysiwyg({fileUploadError:i.RichTextHelper.showFileUploadAlert}),i.HtmlUtil2.isValidString(t.settings.welcomeMessage)&&-1===t.settings.welcomeMessage.indexOf("<")&&(t.settings.welcomeMessage=t.settings.welcomeMessage.replace(/\n/g,"<br>")),t.welcomeRichEditorElem.html(t.settings.welcomeMessage)},100)})},e.prototype.removeLoginImage=function(){var t=this;analytics.track("clearLoginImage"),this.isLoading=!0,this.$http.get("/api/Settings/ClearLoginImage").then(function(){t.isLoading=!1,t.siteInfo.publicSiteInfo.loginImageUrl="",t.loginImageUrl=""},function(e){t.isLoading=!1,alert("Failed to remove loading image: "+e.data.exceptionMessage)})},e.prototype.saveAllSettings=function(){var t=this;analytics.track("editSettings"),this.settings.welcomeMessage=this.welcomeRichEditorElem.html(),this.isLoading=!0,this.$http.put("/api/Settings",this.settings).then(function(){t.isLoading=!1,t.siteInfo.privateSiteInfo.homeRightColumnType=t.settings.homeRightColumnType,t.siteInfo.privateSiteInfo.welcomeMessage=t.settings.welcomeMessage,t.siteInfo.privateSiteInfo.ptaUnitId=t.settings.ptaUnitId,t.settings.fullName!==t.originalSettings.fullName&&location.reload()},function(e){t.isLoading=!1,alert("Failed to save: "+e.data)})},e.prototype.onImageClick=function(e){var t=this;this.settings.bgImageFileName=e,this.$http.put("/api/Settings",{BGImageFileName:this.settings.bgImageFileName}).then(function(){$(".test-bg-image").removeClass("test-bg-image-selected"),t.isLoading=!1},function(e){t.isLoading=!1,alert("Failed to save: "+e.data)})},e.prototype.onImageHoverOver=function(e){},e.prototype.onImageHoverOut=function(){},e.prototype.onQaDeleteSite=function(){this.$http.get("/api/QA/DeleteThisAssociation").then(function(){location.reload()},function(e){alert("Failed to delete site: "+e.data.exceptionMessage)})},e.prototype.hookUpLoginImageUpload=function(){var i=this;$(function(){$("#JQLoginImageFileUploader").fileupload({autoUpload:!0,add:function(e,t){i.$scope.$apply(function(){i.isLoading=!0}),analytics.track("setLoginImage"),$("#FileUploadProgressContainer").show(),t.url="api/DocumentUpload/LoginImage",i.siteInfo.publicSiteInfo.baseApiUrl&&(t.url=i.siteInfo.publicSiteInfo.baseApiUrl+"DocumentUpload/LoginImage"),t.submit().done(function(e){i.$scope.$apply(function(){i.isLoading=!1,i.loginImageUrl=e.newUrl+"?cacheBreaker="+(new Date).getTime(),i.siteInfo.publicSiteInfo.loginImageUrl=i.loginImageUrl}),$("#FileUploadProgressContainer").hide()})},beforeSend:function(e){i.siteInfo.publicSiteInfo.baseApiUrl?e.setRequestHeader("Authorization","Bearer "+i.$rootScope.authToken):e.setRequestHeader("ApiAuthToken",i.$rootScope.authToken)},progressall:function(e,t){var i=Math.floor(100*t.loaded/t.total);$("#FileUploadProgressBar").css("width",i+"%"),100===i?$("#FileUploadProgressLabel").text("Finalizing Upload..."):$("#FileUploadProgressLabel").text(i+"%")}})})},e.prototype.forceRefresh=function(){window.location.reload(!0)},e.$inject=["$http","SiteInfo","$timeout","$scope","$rootScope"],e}();i.ChtnSettingsController=t}(Ally||(Ally={})),CA.angularApp.component("chtnSiteSettings",{templateUrl:"/ngApp/chtn/manager/settings/site-settings.html",controller:Ally.ChtnSettingsController}),function(e){var t=function(){function e(e,t){this.siteInfo=e,this.$routeParams=t,this.hideDocuments=!1,this.hideVendors=!1,this.showMaintenance=!1,this.showVendors=!0,this.faqMenuText="Info/FAQs","home"===AppConfig.appShortName&&(this.faqMenuText="Notes"),this.frontEndVersion=appVer.toString()}return e.prototype.$onInit=function(){this.hideDocuments=this.siteInfo.userInfo.isRenter&&!this.siteInfo.privateSiteInfo.rentersCanViewDocs,this.hideVendors="neighborhood"===AppConfig.appShortName||"block-club"===AppConfig.appShortName,this.showMaintenance="home"===AppConfig.appShortName||"condo"===AppConfig.appShortName||"hoa"===AppConfig.appShortName,this.showVendors="pta"!==AppConfig.appShortName,this.hideDocuments?this.selectedView="Info":this.selectedView="Docs",HtmlUtil.isValidString(this.$routeParams.viewName)&&(this.selectedView=this.$routeParams.viewName)},e.prototype.forceRefresh=function(){window.location.reload(!0)},e.$inject=["SiteInfo","$routeParams"],e}();e.AssociationInfoController=t}(Ally||(Ally={})),CA.condoAllyControllers.directive("contenteditable",["$sce",function(s){return{restrict:"A",require:"?ngModel",link:function(e,t,i,n){function o(){var e=t.html();i.stripBr&&"<br>"===e&&(e=""),n.$setViewValue(e)}n&&(n.$render=function(){t.html(s.getTrustedHtml(n.$viewValue||""))},t.on("blur keyup change",function(){e.$evalAsync(o)}),o())}}}]),CA.angularApp.filter("highlight",["$sce",function(i){return function(e,t){return e=e||"",t&&(e=e.replace(new RegExp("("+t+")","gi"),'<span class="fileSearchHighlight">$1</span>')),i.trustAsHtml(e)}}]),CA.angularApp.component("associationInfo",{templateUrl:"/ngApp/chtn/member/association-info.html",controller:Ally.AssociationInfoController}),function(i){var e=function(){function e(e,t,i,n,o,s,a){this.$http=e,this.$rootScope=t,this.siteInfo=i,this.$timeout=n,this.$scope=o,this.$routeParams=s,this.$sce=a,this.showDiscussionThreads=!1,this.showLocalNews=!1,this.testPay_ShouldShow=!1,this.testPay_isValid=!1,this.shouldShowOwnerFinanceTxn=!1}return e.prototype.$onInit=function(){var t=this;this.testPay_ShouldShow=!1,this.testPay_ShouldShow&&(this.testPay_ReturnUrl=window.location.href,this.testPay_IpnUrl=this.siteInfo.publicSiteInfo.baseUrl+"/api/PayPalIpn",this.testPay_UserFirst=this.siteInfo.userInfo.firstName,this.testPay_UserLast=this.siteInfo.userInfo.lastName,this.testPay_Description="Assessment for "+this.siteInfo.publicSiteInfo.fullName),this.welcomeMessage=this.siteInfo.privateSiteInfo.welcomeMessage,this.isWelcomeMessageHtml=this.welcomeMessage&&-1<this.welcomeMessage.indexOf("<"),this.isWelcomeMessageHtml&&(this.welcomeMessage=this.$sce.trustAsHtml(this.welcomeMessage),i.RichTextHelper.makeLinksOpenNewTab("welcome-message-panel")),this.canMakePayment=this.siteInfo.privateSiteInfo.isPaymentEnabled&&!this.siteInfo.userInfo.isRenter,this.shouldShowOwnerFinanceTxn=this.siteInfo.privateSiteInfo.shouldShowOwnerFinanceTxn&&!this.siteInfo.userInfo.isRenter,this.isFirstVisit=null===this.siteInfo.userInfo.lastLoginDateUtc,this.isSiteManager=this.siteInfo.userInfo.isSiteManager,this.showFirstVisitModal=this.isFirstVisit&&!this.$rootScope.hasClosedFirstVisitModal&&null===this.siteInfo.privateSiteInfo.siteLaunchedDateUtc,this.allyAppName=AppConfig.appName,this.homeRightColumnType=this.siteInfo.privateSiteInfo.homeRightColumnType,this.homeRightColumnType||""===this.homeRightColumnType||(this.homeRightColumnType="localnews"),this.siteInfo.privateSiteInfo.creationDate>i.SiteInfoService.AlwaysDiscussDate?this.showDiscussionThreads=!0:this.showDiscussionThreads=-1<this.homeRightColumnType.indexOf("chatwall"),this.showLocalNews=-1<this.homeRightColumnType.indexOf("localnews"),this.showDiscussionThreads&&this.$routeParams&&HtmlUtil.isNumericString(this.$routeParams.discussionThreadId)&&(this.autoOpenDiscussionThreadId=parseInt(this.$routeParams.discussionThreadId));HtmlUtil.getSubdomain(window.location.host);var e=this;this.$scope.$on("homeHasActivePolls",function(){return e.shouldShowAlertSection=!0}),this.$http.get("/api/Committee/MyCommittees",{cache:!0}).then(function(e){t.usersCommittees=e.data,t.usersCommittees&&(t.usersCommittees=_.sortBy(t.usersCommittees,function(e){return e.name.toLowerCase()}))}),"condo"!==AppConfig.appShortName&&"hoa"!==AppConfig.appShortName||this.$timeout(function(){return t.checkForSurveys()},250)},e.prototype.checkForSurveys=function(){var t=this;this.$http.get("/api/AllySurvey/AnySurvey").then(function(e){t.allySurvey=e.data},function(e){console.log("Failed to load ally survey",e.data.exceptionMessage)}),this.allySurvey=null},e.prototype.onTestPayAmtChange=function(){this.testPay_isValid=5<this.testPay_Amt&&this.testPay_Amt<5e3},e.prototype.hideFirstVisit=function(){this.$rootScope.hasClosedFirstVisitModal=!0,this.showFirstVisitModal=!1},e.$inject=["$http","$rootScope","SiteInfo","$timeout","$scope","$routeParams","$sce"],e}();i.ChtnHomeController=e}(Ally||(Ally={})),CA.angularApp.component("chtnHome",{templateUrl:"/ngApp/chtn/member/chtn-home.html",controller:Ally.ChtnHomeController}),function(e){var s=function(){},t=function(){function e(e,t,i,n,o){this.$scope=e,this.$timeout=t,this.$http=i,this.siteInfo=n,this.appCacheService=o,this.editingTip=new s,this.hoaHomes=[],this.tips=[],this.isLoading=!1}return e.prototype.$onInit=function(){this.isSiteManager=this.siteInfo.userInfo.isSiteManager;var e=void 0;if(this.siteInfo.privateSiteInfo.googleGpsPosition){e={bounds:new google.maps.Circle({center:this.siteInfo.privateSiteInfo.googleGpsPosition,radius:40234}).getBounds()}}var t=document.getElementById("edit-location-address-text-box");this.addressAutocomplete=new google.maps.places.Autocomplete(t,e);var i=this;google.maps.event.addListener(this.addressAutocomplete,"place_changed",function(){var e=i.addressAutocomplete.getPlace();i.editingTip.address=e.formatted_address}),this.retrieveHoaHomes();i=this;this.$timeout(function(){return i.getWalkScore()},1e3),MapCtrlMapMgr.Init(this.siteInfo,this.$scope,this)},e.prototype.refresh=function(){var n=this;this.isLoading=!0,this.$http.get("/api/WelcomeTip").then(function(e){n.tips=e.data,MapCtrlMapMgr.ClearAllMarkers(),"condo"===AppConfig.appShortName&&MapCtrlMapMgr.AddMarker(MapCtrlMapMgr._homeGpsPos.lat(),MapCtrlMapMgr._homeGpsPos.lng(),"Home",MapCtrlMapMgr.MarkerNumber_Home,null);for(var t=0;t<n.tips.length;++t){var i=n.tips[t];null!==i.gpsPos&&(i.markerIndex=MapCtrlMapMgr.AddMarker(i.gpsPos.lat,i.gpsPos.lon,i.name,i.markerNumber,null))}_.each(n.hoaHomes,function(t){if(t.fullAddress&&t.fullAddress.gpsPos){var e=MapCtrlMapMgr.MarkerNumber_Home,i=t.name;_.any(n.siteInfo.userInfo.usersUnits,function(e){return e.unitId===t.unitId})&&(e=MapCtrlMapMgr.MarkerNumber_MyHome,i="Your home: "+i),MapCtrlMapMgr.AddMarker(t.fullAddress.gpsPos.lat,t.fullAddress.gpsPos.lon,i,e,t.unitId)}}),MapCtrlMapMgr.OnMarkersReady(),n.isLoading=!1})},e.prototype.onEditTip=function(e){this.editingTip=jQuery.extend({},e),window.scrollTo(0,document.body.scrollHeight)},e.prototype.onMoveMarker=function(e){MapCtrlMapMgr.SetMarkerDraggable(e.markerIndex,!0)},e.prototype.onDeleteTip=function(e){var t=this;confirm("Are you sure you want to delete this item?")&&(this.isLoading=!0,this.$http.delete("/api/WelcomeTip/"+e.itemId).then(function(){t.isLoading=!1,t.refresh()}))},e.prototype.onSaveTip=function(){var t=this;if(null!==this.editingTip){var e=function(){t.isLoading=!1,t.editingTip=new s,t.refresh()},i=function(e){t.isLoading=!1,alert("Failed to save item: "+e.data.exceptionMessage)};this.isLoading=!0,this.editingTip.itemId?this.$http.put("/api/WelcomeTip",this.editingTip).then(e,i):this.$http.post("/api/WelcomeTip",this.editingTip).then(e,i)}},e.prototype.isLocationTip=function(e){return null!==e.gpsPos},e.prototype.isNotLocationTip=function(e){return null===e.gpsPos},e.prototype.getMarkerIconUrl=function(e){var t="/assets/images/MapMarkers/";return t+=1<=e&&e<=10?"green_"+e:-2===e?"MapMarker_Home":-3===e?"MapMarker_Hospital":-4===e?"MapMarker_PostOffice":"green_blank",t+=".png"},e.prototype.updateItemGpsLocation=function(t,e,i){var n={itemId:_.find(this.tips,function(e){return e.markerIndex===t}).itemId,newLat:e,newLon:i};this.isLoading=!0;var o=this;this.$http.put("/api/WelcomeTip/UpdateGpsLocation",n).then(function(){o.isLoading=!1})},e.prototype.getWalkScore=function(){var e=function(e){e&&e.data&&"Error"!==e.data?$("#WalkScorePanel").html(e.data):($("#WalkScorePanel").html("Failed to load Walk Score."),$("#WalkScorePanel").hide())};this.$http.get("/api/WelcomeTip/GetWalkScore").then(e,e)},e.prototype.retrieveHoaHomes=function(){var i=this;this.$http.get("/api/BuildingResidents/FullUnits").then(function(e){if(e.data)if("condo"===AppConfig.appShortName){var t=_.filter(e.data,function(e){return e.addressId&&!!e.fullAddress});0<(t=_.filter(t,function(e){return e.fullAddress.oneLiner!=i.siteInfo.privateSiteInfo.groupAddress.oneLiner})).length&&(i.hoaHomes=e.data)}else"hoa"===AppConfig.appShortName&&(i.hoaHomes=e.data);i.refresh()},function(){i.refresh()})},e.$inject=["$scope","$timeout","$http","SiteInfo","appCacheService"],e}();e.ChtnMapController=t}(Ally||(Ally={})),CA.angularApp.component("chtnMap",{templateUrl:"/ngApp/chtn/member/chtn-map.html",controller:Ally.ChtnMapController});var MapCtrlMapMgr=function(){function s(){}return s.Init=function(e,t,i){if(s.ngScope=t,s.mapCtrl=i,"undefined"!=typeof google){s._homeGpsPos=e.privateSiteInfo.googleGpsPosition,s._groupGpsBounds=e.privateSiteInfo.gpsBounds;var n={center:s._homeGpsPos,zoom:25,mapTypeId:google.maps.MapTypeId.ROADMAP};s._mainMap=new google.maps.Map(document.getElementById("map_canvas"),n),"condo"===AppConfig.appShortName&&s.AddMarker(s._homeGpsPos.lat(),s._homeGpsPos.lng(),"Home",s.MarkerNumber_Home,null),s.OnMapReady()}},s.OnMapReady=function(){s._isMapReady=!0,s._areMarkersReady&&s.OnMapAndMarkersReady()},s.OnMarkersReady=function(){s._areMarkersReady=!0,s._isMapReady&&s.OnMapAndMarkersReady()},s.OnMapAndMarkersReady=function(){for(var e=0;e<s._tempMarkers.length;++e){var t=s._tempMarkers[e],i=null;i=1<=t.markerNumber&&t.markerNumber<=10?"/assets/images/MapMarkers/green_"+t.markerNumber+".png":t.markerNumber===s.MarkerNumber_Home?"/assets/images/MapMarkers/MapMarker_Home.png":t.markerNumber===s.MarkerNumber_Hospital?"/assets/images/MapMarkers/MapMarker_Hospital.png":t.markerNumber===s.MarkerNumber_PostOffice?"/assets/images/MapMarkers/MapMarker_PostOffice.png":t.markerNumber===s.MarkerNumber_MyHome?"/assets/images/MapMarkers/MapMarker_MyHome.png":"/assets/images/MapMarkers/green_blank.png";var n=new google.maps.Marker({position:new google.maps.LatLng(t.lat,t.lon),map:s._mainMap,animation:google.maps.Animation.DROP,title:t.name,icon:i});n.markerIndex=e,google.maps.event.addListener(n,"dragend",function(){var e=this,t=e.getPosition();s.ngScope.$apply(function(){s.mapCtrl.updateItemGpsLocation(e.markerIndex,t.lat(),t.lng())})}),t.unitId&&(n.unitId=t.unitId,n.addListener("click",function(e){return function(){s.mapCtrl.appCacheService.set("scrollToUnitId",e.unitId.toString()),window.location.hash="#!/BuildingResidents"}}(n))),s._markers.push(n)}if(s._tempMarkers=[],s._groupGpsBounds){var o={paths:Ally.MapUtil.gpsBoundsToGooglePoly(s._groupGpsBounds),map:s._mainMap,strokeColor:"#0000FF",strokeOpacity:.5,strokeWeight:1,fillColor:"#0000FF",fillOpacity:.15,zIndex:-1};s._groupBoundsShape=new google.maps.Polygon(o)}s.ZoomMapToFitMarkers()},s.ClearAllMarkers=function(){for(var e=0;e<s._markers.length;e++)s._markers[e].setMap(null);s._markers=[]},s.SetMarkerDraggable=function(e,t){s._markers[e].setDraggable(t)},s.AddMarker=function(e,t,i,n,o){return s._tempMarkers.push({lat:e,lon:t,name:i,markerNumber:n,unitId:o}),s._tempMarkers.length-1},s.ZoomMapToFitMarkers=function(){for(var e=new google.maps.LatLngBounds,t=0;t<s._markers.length;++t)e.extend(s._markers[t].getPosition());if(s._groupBoundsShape)for(var i=s._groupBoundsShape.getPath(),n=0;n<i.getLength();++n)e.extend(i.getAt(n));s._mainMap.fitBounds(e)},s._mainMap=null,s._homeGpsPos=null,s._groupGpsBounds=null,s._groupBoundsShape=null,s._markers=[],s.MarkerNumber_Home=-2,s.MarkerNumber_MyHome=-5,s.MarkerNumber_Hospital=-3,s.MarkerNumber_PostOffice=-4,s._isMapReady=!1,s._areMarkersReady=!1,s._tempMarkers=[],s.ngScope=null,s.mapCtrl=null,s}();!function(i){var e=function(){function e(e,t){this.$http=e,this.appCacheService=t,this.isLoading=!1,this.loginInfo=new i.LoginInfo,this.shouldHideControls=!1}return e.prototype.$onInit=function(){this.loginInfo.emailAddress=this.appCacheService.getAndClear("forgotEmail")},e.prototype.onSubmitEmail=function(){var t=this;this.isLoading=!0,this.$http.post("/api/Login/Forgot",this.loginInfo).then(function(){t.shouldHideControls=!0,t.isLoading=!1,t.resultText="Please check your e-mail for updated login information.",t.resultTextColor="#00F"},function(e){t.isLoading=!1,t.resultText="Failed to process your request: "+e.data.exceptionMessage,t.resultTextColor="#F00"})},e.$inject=["$http","appCacheService"],e}();i.ForgotPasswordController=e}(Ally||(Ally={})),CA.angularApp.component("forgotPassword",{templateUrl:"/ngApp/chtn/member/forgot-password.html",controller:Ally.ForgotPasswordController}),function(a){var e=function(){function e(e,t,i){this.fellowResidents=e,this.siteInfo=t,this.appCacheService=i,this.isLoading=!0,this.emailLists=[],this.customEmailLists=[],this.unitPrefix="Unit ",this.groupEmailDomain="",this.allyAppName=AppConfig.appName,this.groupShortName=HtmlUtil.getSubdomain(),this.showMemberList="neighborhood"===AppConfig.appShortName||"block-club"===AppConfig.appShortName||"pta"===AppConfig.appShortName,this.groupEmailDomain="inmail."+AppConfig.baseTld,this.unitPrefix="condo"===AppConfig.appShortName?"Unit ":""}return e.prototype.$onInit=function(){var s=this;this.fellowResidents.getByUnitsAndResidents().then(function(e){(s.isLoading=!1,s.unitList=e.byUnit,s.allResidents=e.residents,s.committees=e.committees,!s.allResidents&&e.ptaMembers&&(s.allResidents=e.ptaMembers),s.allResidents=_.sortBy(s.allResidents,function(e){return e.lastName}),s.boardMembers=_.filter(s.allResidents,function(e){return 0!==e.boardPosition}),s.boardMessageRecipient=null,0<s.boardMembers.length)&&(_.some(s.boardMembers,function(e){return e.hasEmail})&&(s.boardMessageRecipient={fullName:"Entire Board",firstName:"everyone on the board",hasEmail:!0,userId:"af615460-d92f-4878-9dfa-d5e4a9b1f488"}));"neighborhood"!==AppConfig.appShortName&&"block-club"!==AppConfig.appShortName||(s.allResidents=_.filter(s.allResidents,function(e){return 0===e.boardPosition}));for(var t=0;t<s.boardMembers.length;++t)s.boardMembers[t].boardPositionName=_.find(a.FellowResidentsService.BoardPositionNames,function(e){return e.id===s.boardMembers[t].boardPosition}).name;var i=[1,64,16,2,4,8,32];s.boardMembers=_.sortBy(s.boardMembers,function(e){var t=_.indexOf(i,e.boardPosition);return-1===t&&(t=100),t});s.allOwners=_.reduce(s.unitList,function(e,t){return Array.prototype.push.apply(e,t.owners),e},[]),s.allOwners=_.map(_.groupBy(s.allOwners,function(e){return e.email}),function(e){return e[0]}),s.allOwnerEmails=_.reduce(s.allOwners,function(e,t){return HtmlUtil.isValidString(t.email)&&e.push(t.email),e},[]),s.unitList&&0<s.unitList.length&&(s.unitList=a.HtmlUtil2.smartSortStreetAddresses(s.unitList,"name")),s.committees&&(s.committees=_.sortBy(s.committees,function(e){return e.committeeName.toLowerCase()}));var n=s.appCacheService.getAndClear("scrollToUnitId");if(n){var o="unit-id-"+n;setTimeout(function(){document.getElementById(o).scrollIntoView(),$("#"+o).effect("pulsate",{times:3},2e3)},300)}setTimeout(function(){return s.loadGroupEmails()},500)},function(e){alert("Failed to retrieve group members. Please let tech support know via the contact form in the bottom right.")})},e.prototype.updateMemberFilter=function(){angular.lowercase(this.memberSearchTerm)},e.prototype.loadGroupEmails=function(){var t=this;this.hasMissingEmails=_.some(this.allResidents,function(e){return!e.hasEmail});this.fellowResidents.getAllGroupEmails().then(function(e){t.emailLists=e.standardGroups,t.customEmailLists=e.customGroups,setTimeout(function(){var e=new Clipboard(".clipboard-button");e.on("success",function(e){a.HtmlUtil2.showTooltip(e.trigger,"Copied!"),e.clearSelection()}),e.on("error",function(e){a.HtmlUtil2.showTooltip(e.trigger,"Auto-copy failed, press CTRL+C now")})},750)})},e.$inject=["fellowResidents","SiteInfo","appCacheService"],e}();a.GroupMembersController=e}(Ally||(Ally={})),CA.angularApp.component("groupMembers",{templateUrl:"/ngApp/chtn/member/group-members.html",controller:Ally.GroupMembersController}),function(e){var i=function(){},t=function(){function e(e,t){this.$http=e,this.siteInfo=t,this.sendInfo=new i,this.isLoading=!1,this.wasMessageSent=!1,this.onSendHelp=function(){if($("#help-form").validate(),$("#help-form").valid()){this.isLoading=!0;var e=this;this.$http.post("/api/Help",this.sendInfo).then(function(){e.isLoading=!1,e.sendInfo={},e.wasMessageSent=!0,e.resultStyle.color="#00F",e.sendResult="Your message has been sent. We'll do our best to get back to you within 24 hours."},function(){e.isLoading=!1,e.resultStyle.color="#F00",e.sendResult="Failed to send message."})}},this.resultStyle={"text-align":"center","font-size":"large","font-weight":"bold"}}return e.prototype.$onInit=function(){this.siteInfo.isLoggedIn&&(this.sendInfo.emailAddress=this.siteInfo.userInfo.emailAddress)},e.$inject=["$http","SiteInfo"],e}();e.HelpFormController=t}(Ally||(Ally={})),CA.angularApp.component("helpForm",{templateUrl:"/ngApp/chtn/member/help.html",controller:Ally.HelpFormController}),function(o){var e=function(){function c(e,t,i,n,o,s,a){this.$scope=e,this.$timeout=t,this.$http=i,this.$rootScope=n,this.$q=o,this.fellowResidents=s,this.siteInfo=a,this.showBadNotificationDateWarning=!1,this.isLoadingNews=!1,this.isLoadingLogbookForCalendar=!1,this.isLoadingPolls=!1,this.isLoadingCalendarEvents=!1,this.onlyRefreshCalendarEvents=!1,this.showExpandedCalendarEventModel=!1,this.currentTimeZoneAbbreviation="CT",this.localTimeZoneDiffersFromGroup=!1,this.onResidentClicked=function(e){if(!e.hasEmail)return alert("That user cannot be included because they do not have an e-mail address on file."),void(e.isAssociated=!1);_.contains(this.editEvent.associatedUserIds,e.userId)?this.editEvent.associatedUserIds=_.without(this.editEvent.associatedUserIds,e.userId):this.editEvent.associatedUserIds.push(e.userId)},this.clearViewEvent=function(){this.viewEvent=null}}return c.prototype.$onInit=function(){var t=this,e=moment(),i=moment.tz.guess();this.currentTimeZoneAbbreviation=e.tz(i).format("z"),this.siteInfo.privateSiteInfo.groupAddress&&this.siteInfo.privateSiteInfo.groupAddress.timeZoneIana&&(this.groupTimeZoneAbbreviation=e.tz(this.siteInfo.privateSiteInfo.groupAddress.timeZoneIana).format("z"),this.groupTimeZoneAbbreviation!=this.currentTimeZoneAbbreviation&&(this.localTimeZoneDiffersFromGroup=!0)),AppConfig.isChtnSite&&this.fellowResidents.getResidents().then(function(e){t.residents=e,t.residents=_.sortBy(t.residents,function(e){return e.lastName})});var o=this,n={height:600,editable:!1,header:{left:"prevYear prev next nextYear today",center:"title",right:"month listYear"},viewRender:function(e,t){$(t).css("cursor","pointer")},dayClick:function(e){if(o.$rootScope.isSiteManager){var t=moment(moment.utc(e).format(c.DateFormat)).toDate();o.$scope.$apply(function(){var e={date:t,dateOnly:t,associatedUserIds:[],notificationEmailDaysBefore:null};o.setEditEvent(e,!1)})}},eventClick:function(e){o.$scope.$apply(function(){e.calendarEventObject&&(o.$rootScope.isSiteManager?o.setEditEvent(e.calendarEventObject,!0):o.viewEvent=e.calendarEventObject)})},eventRender:function(e,t){$(t).qtip({style:{classes:"qtip-light qtip-shadow"},content:{text:e.fullDescription,title:e.toolTipTitle}})},eventSources:[{events:function(e,t,i,n){o.getAssociationEvents(e,t,i,n)}},{events:function(e,t,i,n){o.getCalendarEvents(e,t,i,n)}}]};$(document).ready(function(){$(".EditableEntry").editable("<%= Request.Url %>",{id:"EditEntryId",type:"textarea",cancel:"Cancel",submit:"Ok"}),$("#log-calendar").fullCalendar(n),$("#calendar-event-time").timepicker({scrollDefault:"10:00am"}),$(".fc-bg td.fc-today").append("<div class='today-note'>Today</div>")})},c.prototype.getAllEvents=function(e,t){var n=this,i=AppConfig.isChtnSite,o=e.format(c.DateFormat),s=t.format(c.DateFormat),a=this.$q.defer(),r=this.$q.defer(),l=this.$q.defer();a.resolve(),this.isLoadingLogbookForCalendar=!0;var d=this;return this.$http.get("/api/Logbook?startDate="+o+"&endDate="+s).then(function(e){var t=e.data;d.isLoadingLogbookForCalendar=!1,_.each(t,function(e){var t=e.text;10<t.length&&(t=t.substring(0,10)+"...");var i="Posted by: "+e.authorName+"<br><p>"+e.text+"</p>";d.calendarEvents.push({title:"Logbook: "+t,start:moment(e.postDate).format("YYYY-MM-DD"),toolTipTitle:"Logbook Entry Added",fullDescription:i})}),r.resolve()},function(){d.isLoadingLogbookForCalendar=!1,r.resolve()}),i?(this.isLoadingPolls=!0,this.$http.get("/api/Poll/DateRange?startDate="+o+"&endDate="+s).then(function(e){var t=e.data;n.isLoadingPolls=!1,_.each(t,function(e){var t=e.text;10<t.length&&(t=t.substring(0,10)+"...");var i="Posted by: "+e.authorName+"<br><p>"+e.text+"</p>";n.calendarEvents.push({title:"Poll: "+t,start:moment(e.postDate).format("YYYY-MM-DD"),toolTipTitle:"Poll Added",fullDescription:i})}),l.resolve()},function(){n.isLoadingPolls=!1,l.resolve()})):l.resolve(),this.$q.all([a.promise,r.promise,l.promise])},c.prototype.getAssociationEvents=function(e,t,i,n){if(this.onlyRefreshCalendarEvents)return this.onlyRefreshCalendarEvents=void 0,void n(this.calendarEvents);this.calendarEvents=[];var o=this;this.getAllEvents(e,t).then(function(){n(o.calendarEvents)})},c.prototype.getCalendarEvents=function(e,t,i,n){this.isLoadingCalendarEvents=!0;var o=e.format(c.DateFormat),s=t.format(c.DateFormat),a=this;this.$http.get("/api/CalendarEvent?startDate="+o+"&endDate="+s).then(function(e){var t=e.data,r=[];a.isLoadingCalendarEvents=!1,_.each(t,function(e){var t,i=moment.utc(e.eventDateUtc),n=i.format(c.TimeFormat)==c.NoTime;if(n)e.timeOnly="",e.dateOnly=new Date(i.year(),i.month(),i.date()),t=new Date(i.year(),i.month(),i.date());else{var o=moment.utc(e.eventDateUtc).local();e.timeOnly=o.format(c.TimeFormat),e.dateOnly=o.clone().startOf("day").toDate(),t=o.toDate()}var s=e.title;s&&10<s.length&&(s=s.substring(0,10)+"...");var a="Posted by: "+e.authorName+"<br><p>"+e.title+"</p>";r.push({title:s,start:t,toolTipTitle:"Event",fullDescription:a,calendarEventObject:e,allDay:n})}),n(r)},function(){a.isLoadingCalendarEvents=!1})},c.prototype.isUserAssociated=function(e){return!(!this.editEvent||!this.editEvent.associatedUserIds)&&_.contains(this.editEvent.associatedUserIds,e)},c.prototype.isDateInPast=function(e){var t=moment(e),i=moment();return t.isBefore(i,"day")||t.isSame(i,"day")},c.prototype.onShouldSendChange=function(){this.editEvent.shouldSendNotification&&this.isDateInPast(this.editEvent.dateOnly)?this.editEvent.shouldSendNotification=!1:this.editEvent.notificationEmailDaysBefore||(this.editEvent.notificationEmailDaysBefore=1)},c.prototype.onChangeEmailDaysBefore=function(){var e=moment(this.editEvent.dateOnly).subtract(this.editEvent.notificationEmailDaysBefore,"day"),t=moment();if(this.showBadNotificationDateWarning=e.isBefore(t,"day")||e.isSame(t,"day"),this.showBadNotificationDateWarning){this.maxDaysBack=moment(this.editEvent.dateOnly).diff(t,"day"),this.editEvent.notificationEmailDaysBefore=this.maxDaysBack;var i=this;this.$timeout(function(){i.showBadNotificationDateWarning=!1},1e4)}},c.prototype.expandCalendarEventModel=function(){this.showExpandedCalendarEventModel=!0},c.prototype.setEditEvent=function(e,t){var i=this;this.showExpandedCalendarEventModel=t||!1,this.editEvent=e,this.showBadNotificationDateWarning=!1,this.editEvent&&(this.residents&&_.each(this.residents,function(e){return e.isAssociated=i.isUserAssociated(e.userId)}),this.editEvent.shouldSendNotification=null!==this.editEvent.notificationEmailDaysBefore,setTimeout(function(){$("#calendar-event-title").focus()},10))},c.prototype.deleteCalendarEvent=function(e){var t=this;confirm("Are you sure you want to remove this event?")&&(this.isLoadingCalendarEvents=!0,this.$http.delete("/api/CalendarEvent?eventId="+e).then(function(){t.isLoadingCalendarEvents=!1,t.editEvent=null,t.onlyRefreshCalendarEvents=!0,$("#log-calendar").fullCalendar("refetchEvents")},function(){t.isLoadingCalendarEvents=!1,alert("Failed to delete the calendar event.")}))},c.prototype.getDaysBeforeValue=function(){var e=null;return null!==this.editEvent.notificationEmailDaysBefore&&void 0!==this.editEvent.notificationEmailDaysBefore&&("string"==typeof this.editEvent.notificationEmailDaysBefore?(e=parseInt(this.editEvent.notificationEmailDaysBefore),isNaN(e)&&(e=null)):"number"==typeof this.editEvent.notificationEmailDaysBefore&&(e=this.editEvent.notificationEmailDaysBefore)),null!==e&&e<0&&(e=null),e},c.prototype.saveCalendarEvent=function(){var i=this;if(o.HtmlUtil2.isValidString(this.editEvent.title)){if(this.editEvent.shouldSendNotification)if(null===this.getDaysBeforeValue())return void alert("Please enter a valid number for the 'days before' email send date");if(this.residents){var e=_.filter(this.residents,function(e){return e.isAssociated});this.editEvent.associatedUserIds=_.map(e,function(e){return e.userId})}var t,n="";"string"==typeof this.editEvent.timeOnly&&1<this.editEvent.timeOnly.length?(n=moment(this.editEvent.dateOnly).format(c.DateFormat)+" "+this.editEvent.timeOnly,this.editEvent.eventDateUtc=moment(n,c.DateFormat+" "+c.TimeFormat).utc().toDate()):(n=moment(this.editEvent.dateOnly).format(c.DateFormat)+" "+c.NoTime,this.editEvent.eventDateUtc=moment.utc(n,c.DateFormat+" "+c.TimeFormat).toDate()),this.editEvent.shouldSendNotification||(this.editEvent.notificationEmailDaysBefore=null),t=this.editEvent.eventId?this.$http.put:this.$http.post,analytics.track("addCalendarEvent"),this.isLoadingCalendarEvents=!0,t("/api/CalendarEvent",this.editEvent).then(function(){i.isLoadingCalendarEvents=!1,i.editEvent=null,i.onlyRefreshCalendarEvents=!0,$("#log-calendar").fullCalendar("refetchEvents")},function(e){i.isLoadingCalendarEvents=!1;var t=e.data.exceptionMessage?e.data.exceptionMessage:e.data;alert("Failed to save the calendar event: "+t)})}else alert("Please enter a title in the 'what' field")},c.$inject=["$scope","$timeout","$http","$rootScope","$q","fellowResidents","SiteInfo"],c.DateFormat="YYYY-MM-DD",c.TimeFormat="h:mma",c.NoTime="12:37am",c}();o.LogbookController=e}(Ally||(Ally={})),CA.angularApp.component("logbookPage",{templateUrl:"/ngApp/chtn/member/logbook.html",controller:Ally.LogbookController}),function(e){var a=function(){this.emailAddress="",this.password=""};e.LoginInfo=a;var t=function(){function e(e,t,i,n,o,s){this.$http=e,this.$rootScope=t,this.$location=i,this.appCacheService=n,this.siteInfo=o,this.xdLocalStorage=s,this.isDemoSite=!1,this.loginInfo=new a}return e.prototype.$onInit=function(){HtmlUtil.isLocalStorageAllowed()||(this.loginResult="You have cookies/local storage disabled. Condo Ally requires these features, please enable to continue. You may be in private browsing mode.");var e=navigator.userAgent.toLowerCase(),t=-1!=e.indexOf("msie")?parseInt(e.split("msie")[1]):0;if(0<t&&t<10&&(document.getElementById("bad-browser-panel").style.display="block"),this.isDemoSite="demosite"===HtmlUtil.getSubdomain(),"1"===HtmlUtil.GetQueryStringParameter("s")&&(this.isDemoSite=!1),this.loginImageUrl=this.siteInfo.publicSiteInfo.loginImageUrl,this.sectionStyle={position:"relative"},!this.isDemoSite){this.welcomeImageContainerStyle={"margin-bottom":"21px","max-width":"100%"};var i=window.localStorage.welcomeImage_width;i&&"0"!=i&&!HtmlUtil.isNullOrWhitespace(this.loginImageUrl)&&(this.welcomeImageContainerStyle.width=i+"px",this.welcomeImageContainerStyle.height=window.localStorage.welcomeImage_height+"px"),HtmlUtil.isNullOrWhitespace(this.loginImageUrl)?this.sectionStyle["max-width"]="500px":this.sectionStyle["max-width"]="760px",this.sectionStyle["margin-left"]="auto",this.sectionStyle["margin-right"]="auto"}"true"===this.appCacheService.getAndClear(AppCacheService.Key_WasLoggedIn403)?this.$rootScope.isSiteManager?this.loginResult="You are not authorized to perform that action. Please contact support.":this.loginResult="You are not authorized to perform that action. Please contact an admin.":"true"===this.appCacheService.getAndClear(AppCacheService.Key_WasLoggedIn401)&&(this.loginResult="Please login first."),setTimeout(function(){$("#login-email-textbox").focus()},200)},e.prototype.onWelcomeImageLoaded=function(e){var t=document.getElementById("welcome-image");window.localStorage.welcomeImage_width=t.naturalWidth,window.localStorage.welcomeImage_height=t.naturalHeight,this.welcomeImageContainerStyle.width=t.naturalWidth+"px",this.welcomeImageContainerStyle.height="auto"},e.prototype.onWelcomeImageError=function(){document.getElementById("welcome-image");console.log("Welcome image error"),window.localStorage.removeItem("welcomeImage_width"),window.localStorage.removeItem("welcomeImage_height")},e.prototype.onForgotPassword=function(){this.appCacheService.set("forgotEmail",this.loginInfo.emailAddress),this.$location.path("/ForgotPassword")},e.prototype.demoLogin=function(){this.loginInfo={emailAddress:"testuser",password:"demosite"},this.onLogin()},e.prototype.onLogin=function(){this.isLoading=!0;var n=this;this.$http.post("/api/Login",this.loginInfo).then(function(e){n.isLoading=!1;var t=e.data,i=n.appCacheService.getAndClear(AppCacheService.Key_AfterLoginRedirect);n.siteInfo.setAuthToken(t.authToken),n.siteInfo.handleSiteInfo(t.siteInfo,n.$rootScope),n.rememberMe?(window.localStorage.rememberMe_Email=n.loginInfo.emailAddress,window.localStorage.rememberMe_Password=btoa(n.loginInfo.password)):(window.localStorage.rememberMe_Email=null,window.localStorage.rememberMe_Password=null),t.siteInfo.userInfo.acceptedTermsDate||n.isDemoSite?(HtmlUtil.isValidString(i)||"/Login"===i||(i="/Home"),n.$location.path(i)):n.$location.path("/MyProfile")},function(e){n.isLoading=!1;var t=e.data.exceptionMessage?e.data.exceptionMessage:e.data;n.loginResult="Failed to log in: "+t})},e.$inject=["$http","$rootScope","$location","appCacheService","SiteInfo","xdLocalStorage"],e}();e.LoginController=t}(Ally||(Ally={})),CA.angularApp.component("loginPage",{templateUrl:"/ngApp/chtn/member/login.html",controller:Ally.LoginController});__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}}();!function(e){var t=function(){},i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t}(e.SimpleUserEntry=t),n=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}__extends(t,e)}(e.SimpleUserEntryWithTerms=i),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t}(t));e.PtaMember=n;var o=function(){function e(e,t,i,n,o,s){this.$rootScope=e,this.$http=t,this.$location=i,this.appCacheService=n,this.siteInfo=o,this.$scope=s,this.showPassword=!1,this.shouldShowPassword=!1,this.selectedProfileView="Primary",this.passwordComplexity="short"}return e.prototype.$onInit=function(){var i=this;this.isDemoSite="demosite"===HtmlUtil.getSubdomain(),this.siteInfo.privateSiteInfo&&(this.canHideContactInfo=this.siteInfo.privateSiteInfo.canHideContactInfo),this.retrieveProfileData();setTimeout(function(){$("#JQFileUploader").fileupload({add:function(e,t){t.url="api/DocumentUpload/ProfileImage?ApiAuthToken="+i.siteInfo.authToken,i.siteInfo.publicSiteInfo.baseApiUrl&&(t.url=i.siteInfo.publicSiteInfo.baseApiUrl+"DocumentUpload/ProfileImage"),i.$scope.$apply(function(){return i.isLoading=!0}),t.submit().done(function(e){i.$scope.$apply(function(){window.location.reload()})})},beforeSend:function(e){i.siteInfo.publicSiteInfo.baseApiUrl?e.setRequestHeader("Authorization","Bearer "+i.$rootScope.authToken):e.setRequestHeader("ApiAuthToken",i.$rootScope.authToken)},fail:function(e,t){i.$scope.$apply(function(){i.isLoading=!1,alert("Upload Failed: "+t.jqXHR.responseJSON.exceptionMessage)})}})},500)},e.prototype.saveProfilePhoto=function(e){var t=this;"upload"!==this.initialProfileImageType||confirm("Are you sure you want to change your profile image away from your uploaded photo? Your uploaded photo will be deleted.")?(this.isLoading=!0,this.$http.put("/api/MyProfile/ProfileImage?type="+e,null).then(function(){t.isLoading=!1,t.initialProfileImageType=t.profileImageType},function(e){t.isLoading=!1,alert("Failed to save: "+e.data.exceptionMessage)})):this.profileImageType=this.initialProfileImageType},e.prototype.onShowPassword=function(){document.getElementById("passwordTextBox").type=this.shouldShowPassword?"text":"password"},e.prototype.retrieveProfileData=function(){var t=this;this.isLoading=!0,this.$http.get("/api/MyProfile").then(function(e){t.isLoading=!1,t.profileInfo=e.data,t.initialProfileImageType="blank",t.profileInfo.avatarUrl&&-1===t.profileInfo.avatarUrl.indexOf("blank-headshot")?t.profileInfo.avatarUrl&&-1!==t.profileInfo.avatarUrl.indexOf("gravatar")?t.initialProfileImageType="gravatar":t.profileInfo.avatarUrl&&0<t.profileInfo.avatarUrl.length&&(t.initialProfileImageType="upload"):t.initialProfileImageType="blank","upload"!==t.initialProfileImageType&&(t.profileInfo.avatarUrl=null),t.profileImageType=t.initialProfileImageType,t.gravatarUrl="https://www.gravatar.com/avatar/"+md5((t.profileInfo.email||"").toLowerCase())+"?s=80&d=identicon",HtmlUtil.endsWith(t.profileInfo.email,"@condoally.com")&&(t.profileInfo.email=""),t.needsToAcceptTerms=null===t.profileInfo.acceptedTermsDate&&!t.isDemoSite,t.hasAcceptedTerms=!t.needsToAcceptTerms,t.$rootScope.hideMenu=t.needsToAcceptTerms,t.saveButtonStyle={width:"100px","font-size":"1em"}})},e.prototype.onSaveInfo=function(){var t=this;this.isLoading=!0,this.$http.put("/api/MyProfile",this.profileInfo).then(function(){t.resultMessage="Your changes have been saved.",t.$rootScope.hideMenu&&(t.$rootScope.hideMenu=!1,t.$location.path("/Home")),t.isLoading=!1},function(e){t.isLoading=!1,alert("Failed to save: "+e.data.exceptionMessage)})},e.prototype.onPasswordChange=function(){if(!this.profileInfo.password||this.profileInfo.password.length<6)this.passwordComplexity="short";else{var e=!!this.profileInfo.password.match(/[a-z]+/i),t=!!this.profileInfo.password.match(/[0-9]+/),i=!!this.profileInfo.password.match(/[^a-z0-9]+/i),n=12<=this.profileInfo.password.length&&e&&t&&i;this.passwordComplexity=n?"complex":"simple"}},e.$inject=["$rootScope","$http","$location","appCacheService","SiteInfo","$scope"],e}();e.MyProfileController=o}(Ally||(Ally={})),CA.angularApp.component("myProfile",{templateUrl:"/ngApp/chtn/member/my-profile.html",controller:Ally.MyProfileController}),function(e){var t=function(){function e(e,t,i,n){this.$scope=e,this.$http=t,this.$timeout=i,this.WizardHandler=n,this.unitNumberingType="Numbered",this.numUnits=3,this.placeWasSelected=!1,this.shouldCheckAddress=!1,this.shouldShowHoaMessage=!1,this.isLoading=!1,this.map=null,this.isLoadingMap=!1,this.hideWizard=!1,this.signUpInfo={buildings:[{units:[]}],signerUpInfo:{buildingIndex:0,boardPositionValue:"1"},recaptchaKey:""}}return e.prototype.$onInit=function(){var i=this,e=this;this.$timeout(function(){e.init()},500),this.$scope.$on("wizard:stepChanged",function(e,t){2===t.index&&i.$timeout(function(){return grecaptcha.render("recaptcha-check-elem")},50)})},e.prototype.onNumUnitsChanged=function(){if(this.numUnits){this.numUnits<1?this.numUnits=1:100<this.numUnits&&(this.numUnits=100);var e=this.numUnits-this.signUpInfo.buildings[0].units.length;if(this.signUpInfo.buildings[0].units.length=this.numUnits,0<e)for(var t=this.numUnits-e;t<this.numUnits;++t)this.signUpInfo.buildings[0].units[t]={name:this.getUnitName(t),residents:[{}]}}},e.prototype.onAssociationNameChanged=function(){this.signUpInfo&&this.signUpInfo.name?this.shouldShowHoaMessage=-1!==this.signUpInfo.name.toLowerCase().indexOf("hoa")||-1!==this.signUpInfo.name.toLowerCase().indexOf("home"):this.shouldShowHoaMessage=!1},e.prototype.addResident=function(e){e.residents||(e.residents=[]),e.residents.push({})},e.prototype.getUnitName=function(e){if("Numbered"===this.unitNumberingType)return(e+1).toString();if("Lettered"!==this.unitNumberingType)return"EW"===this.unitNumberingType||"NS"===this.unitNumberingType?e%2==0?(e/2+1).toString()+("EW"===this.unitNumberingType?"E":"N"):Math.ceil(e/2).toString()+("EW"===this.unitNumberingType?"W":"S"):(e+1).toString();var t="",i=Math.floor(e/26);0<i&&(t+=String.fromCharCode("A".charCodeAt(0)+(i-1)));var n=e%26;return t+=String.fromCharCode("A".charCodeAt(0)+n)},e.prototype.onNumberingTypeChange=function(){for(var e=0;e<this.signUpInfo.buildings[0].units.length;++e)this.signUpInfo.buildings[0].units[e]||(this.signUpInfo.buildings[0].units[e]={}),this.signUpInfo.buildings[0].units[e].name=this.getUnitName(e)},e.prototype.centerMap=function(e){e.viewport?this.map.fitBounds(e.viewport):(this.map.setCenter(e.location),this.map.setZoom(17)),this.mapMarker.setPosition(e.location),this.mapMarker.setVisible(!0)},e.prototype.setPlaceWasSelected=function(){this.placeWasSelected=!0,this.shouldCheckAddress=!1;var e=this;setTimeout(function(){e.placeWasSelected=!0},500)},e.prototype.init=function(){void 0!==window.analytics&&window.analytics.track("condoSignUpStarted",{category:"SignUp",label:"Started"});var e=document.getElementById("address-map");this.map=new google.maps.Map(e,{center:{lat:41.869638,lng:-87.657423},zoom:9});var t=document.getElementById("building-0-address-text-box");this.addressAutocomplete=new google.maps.places.Autocomplete(t),this.addressAutocomplete.bindTo("bounds",this.map),this.mapMarker=new google.maps.Marker({map:this.map,position:null,anchorPoint:new google.maps.Point(41.969638,-87.657423),icon:"/assets/images/MapMarkers/MapMarker_Home.png"});var i=this;this.addressAutocomplete.addListener("place_changed",function(){i.setPlaceWasSelected(),i.mapMarker.setVisible(!1);var e=i.addressAutocomplete.getPlace(),t=e.formatted_address;t.indexOf(", USA")===t.length-", USA".length&&(t=t.substring(0,t.length-", USA".length)),i.signUpInfo.buildings[0].streetAddress=t,HtmlUtil.isNullOrWhitespace(i.signUpInfo.name)&&i.$scope.$apply(function(){i.signUpInfo.name=e.name+" Condo Association"}),e.geometry&&(i.centerMap(e.geometry),$("#association-name-text-box").focus())}),i.onNumUnitsChanged()},e.prototype.checkAddress=function(){!this.placeWasSelected&&this.shouldCheckAddress&&(this.shouldCheckAddress=!1,this.refreshMapForBuildingAddress())},e.prototype.refreshMapForBuildingAddress=function(){this.isLoadingMap=!0;var o=this;HtmlUtil.geocodeAddress(this.signUpInfo.buildings[0].streetAddress,function(i,n){o.$scope.$apply(function(){if(o.isLoadingMap=!1,n==google.maps.GeocoderStatus.OK){var e=i[0].formatted_address;if(e.indexOf(", USA")===e.length-", USA".length&&(e=e.substring(0,e.length-", USA".length)),o.signUpInfo.buildings[0].streetAddress=e,o.centerMap(i[0].geometry),HtmlUtil.isNullOrWhitespace(o.signUpInfo.name)){var t=HtmlUtil.getStringUpToFirst(e,",");o.signUpInfo.name=t+" Condo Association"}}})})},e.prototype.addBuilding=function(){25<=this.signUpInfo.buildings.length+1?alert("We do not support more than 25 buildings."):this.signUpInfo.buildings.push({})},e.prototype.onFinishedWizard=function(){var i=this;this.signUpInfo.recaptchaKey=grecaptcha.getResponse(),HtmlUtil.isNullOrWhitespace(this.signUpInfo.recaptchaKey)?alert("Please complete the reCAPTCHA field"):(this.isLoading=!0,this.$http.post("/api/SignUpWizard",this.signUpInfo).then(function(e){i.isLoading=!1;var t=e.data;HtmlUtil.isNullOrWhitespace(t.errorMessage)?(void 0!==window.analytics&&window.analytics.track("condoSignUpComplete",{category:"SignUp",label:"Success"}),HtmlUtil.isNullOrWhitespace(t.createUrl)?(i.hideWizard=!0,i.resultMessage="Great work! We just sent you an e-mail with instructions on how access your new site."):window.location.href=t.createUrl):(alert("Failed to complete sign-up: "+t.errorMessage),i.WizardHandler.wizard().goTo(t.stepIndex),grecaptcha.reset())},function(e){i.isLoading=!1,alert("Failed to complete sign-up: "+e.data.exceptionMessage),grecaptcha.reset()}))},e.$inject=["$scope","$http","$timeout","WizardHandler"],e}();e.CondoSignUpWizardController=t}(Ally||(Ally={})),CA.angularApp.component("condoSignUpWizard",{templateUrl:"/ngApp/chtn/public/condo-sign-up-wizard.html",controller:Ally.CondoSignUpWizardController}),function(e){var t=function(){};e.DiscussionThread=t;var i=function(){function e(e,t){this.$http=e,this.$routeParams=t,this.isLoading=!1,this.activeView="loading"}return e.prototype.$onInit=function(){this.unsubscribeUser()},e.prototype.loadDiscussion=function(){var e=decodeURIComponent(this.$routeParams.idValue);this.isLoading=!0;var t=this;this.$http.get("/Discussion/"+e).then(function(e){t.isLoading=!1,t.discussion=e.data},function(e){t.isLoading=!1,t.errorMessage="Failed to find the discussion details. Please contact support to alert them to the issue."})},e.prototype.unsubscribeUser=function(){var e=decodeURIComponent(this.$routeParams.idValue);this.isLoading=!0,this.activeView="loading";var t=this;this.$http.put("/api/Discussion/Unsubscribe/"+e,null).then(function(e){t.isLoading=!1,t.activeView="unsubscribed",t.discussion=e.data},function(e){t.isLoading=!1,t.activeView="error",t.errorMessage="Failed to unsubscribe you from the discussion due to a server error."})},e.prototype.resubscribeUser=function(){var e=decodeURIComponent(this.$routeParams.idValue);this.isLoading=!0,this.activeView="loading";var t=this;this.$http.put("/api/Discussion/Resubscribe/"+e,null).then(function(e){t.isLoading=!1,t.activeView="resubscribed"},function(e){t.isLoading=!1,t.activeView="error",t.errorMessage="Failed to unsubscribe you from the discussion due to a server error."})},e.$inject=["$http","$routeParams"],e}();e.DiscussionManageController=i}(Ally||(Ally={})),CA.angularApp.component("discussionManage",{templateUrl:"/ngApp/chtn/public/discussion-manage.html",controller:Ally.DiscussionManageController}),function(e){var t=function(){function e(e,t){this.$http=e,this.$routeParams=t,this.isLoading=!1,this.showButtons=!0}return e.prototype.$onInit=function(){this.boardEmail="board."+HtmlUtil.getSubdomain()+"@inmail."+AppConfig.baseTld},e.prototype.reportAbuse=function(e){if("not-member"!==e||confirm("You should reach out to the board rather than contact technical support. Click 'OK' to still proceed with contacting technical support anyway.")){var t={abuseReason:e,idVal:decodeURIComponent(this.$routeParams.idValue),otherReasonText:this.otherReasonText};this.isLoading=!0;var i=this;this.$http.post("/api/EmailAbuse/v3",t).then(function(){i.isLoading=!1,i.showButtons=!1})}},e.$inject=["$http","$routeParams"],e}();e.EmailAbuseController=t}(Ally||(Ally={})),CA.angularApp.component("emailAbuse",{templateUrl:"/ngApp/chtn/public/email-abuse.html",controller:Ally.EmailAbuseController}),function(o){var e=function(){this.boardPositionValue=1};o.HoaSignerUpInfo=e;var t=function(){this.name="",this.streetAddress="",this.isResident=!0,this.signerUpInfo=new e,this.referralSource="",this.recaptchaKey=""};o.HoaSignUpInfo=t;var i=function(){function e(e,t,i,n){this.$scope=e,this.$http=t,this.$timeout=i,this.WizardHandler=n,this.placeWasSelected=!1,this.shouldCheckAddress=!1,this.isLoading=!1,this.shouldShowCondoMessage=!1,this.map=null,this.isLoadingMap=!1,this.hideWizard=!1,this.hoaPoly={vertices:[]},this.showMap=!1,this.didSignUpForHoaAlert=!1,this.signUpInfo=new o.HoaSignUpInfo}return e.prototype.$onInit=function(){var i=this;this.signUpInfo.referralSource=HtmlUtil.GetQueryStringParameter("utm_sourcecapterra"),HtmlUtil.isNullOrWhitespace(this.signUpInfo.referralSource)&&(this.signUpInfo.referralSource=null),this.$scope.$on("wizard:stepChanged",function(e,t){1===t.index?i.$timeout(function(){return i.showMap=!0},50):2===t.index?i.$timeout(function(){return grecaptcha.render("recaptcha-check-elem")},50):i.showMap=!1})},e.prototype.onHoaNameChanged=function(){if(this.signUpInfo&&this.signUpInfo.name){var e=-1!==this.signUpInfo.name.toLowerCase().indexOf("condo");e&&!this.shouldShowCondoMessage&&$("#suggestCondoMessageLabel").css("font-size","1.3em").css("margin","25px auto").fadeIn(200).fadeOut(200).fadeIn(200).fadeOut(200).fadeIn(200),this.shouldShowCondoMessage=e}else this.shouldShowCondoMessage=!1},e.prototype.centerMap=function(e){e.viewport?this.map.fitBounds(e.viewport):(this.map.setCenter(e.location),this.map.setZoom(17)),this.mapMarker.setPosition(e.location),this.mapMarker.setVisible(!0)},e.prototype.initMapStep=function(){void 0!==window.analytics&&window.analytics.track("condoSignUpStarted"),this.showMap=!0;var e=document.getElementById("association-address-text-box");if(e&&(this.addressAutocomplete=new google.maps.places.Autocomplete(e),this.addressAutocomplete.bindTo("bounds",this.map)),this.mapMarker=new google.maps.Marker({map:this.map,position:null,anchorPoint:new google.maps.Point(41.969638,-87.657423),icon:"/assets/images/MapMarkers/MapMarker_Home.png"}),this.addressAutocomplete){var i=this,t=function(){i.setPlaceWasSelected(),i.mapMarker.setVisible(!1);var e=i.addressAutocomplete.getPlace(),t=e.formatted_address;t.indexOf(", USA")===t.length-", USA".length&&(t=t.substring(0,t.length-", USA".length)),i.signUpInfo.streetAddress=t,e.geometry&&(i.setEditPolyForAddress(e.geometry.location),i.centerMap(e.geometry))};this.addressAutocomplete.addListener("place_changed",function(){i.$scope.$apply(t)})}},e.prototype.onMapEditorReady=function(e){this.map=e,this.initMapStep()},e.prototype.checkAddress=function(){!this.placeWasSelected&&this.shouldCheckAddress&&(this.shouldCheckAddress=!1,this.refreshMapForAddress())},e.prototype.setPlaceWasSelected=function(){this.placeWasSelected=!0,this.shouldCheckAddress=!1;var e=this;setTimeout(function(){e.placeWasSelected=!0},500)},e.prototype.setEditPolyForAddress=function(e){var t=.0014;this.hoaPoly={vertices:[{lat:e.lat()-.001,lon:e.lng()-t},{lat:e.lat()+.001,lon:e.lng()-t},{lat:e.lat()+.001,lon:e.lng()+t},{lat:e.lat()-.001,lon:e.lng()+t}]}},e.prototype.refreshMapForAddress=function(){this.isLoadingMap=!0;var n=this;HtmlUtil.geocodeAddress(this.signUpInfo.streetAddress,function(t,i){n.$scope.$apply(function(){if(n.isLoadingMap=!1,i==google.maps.GeocoderStatus.OK){var e=t[0].formatted_address;e.indexOf(", USA")===e.length-", USA".length&&(e=e.substring(0,e.length-", USA".length)),n.signUpInfo.streetAddress=e,t[0].geometry&&(n.setEditPolyForAddress(t[0].geometry.location),n.centerMap(t[0].geometry))}})})},e.prototype.onFinishedWizard=function(){var i=this;this.signUpInfo.recaptchaKey=grecaptcha.getResponse(),HtmlUtil.isNullOrWhitespace(this.signUpInfo.recaptchaKey)?alert("Please complete the reCAPTCHA field"):(this.isLoading=!0,this.signUpInfo.boundsGpsVertices=this.hoaPoly.vertices,this.$http.post("/api/SignUpWizard/Hoa",this.signUpInfo).then(function(e){i.isLoading=!1;var t=e.data;HtmlUtil.isNullOrWhitespace(t.errorMessage)?(void 0!==window.analytics&&window.analytics.track("condoSignUpComplete"),void 0!==window.goog_report_conversion&&window.goog_report_conversion(),i.signUpInfo.referralSource&&void 0!==window.capterra_trackingListener_v2&&window.capterra_trackingListener_v2(),HtmlUtil.isNullOrWhitespace(t.createUrl)?(i.hideWizard=!0,i.resultMessage="Great work! We just sent you an e-mail with instructions on how access your new site."):window.setTimeout(function(){return window.location.href=t.createUrl},50)):(alert("Failed to complete sign-up: "+t.errorMessage),i.WizardHandler.wizard().goTo(t.stepIndex),grecaptcha.reset())},function(e){i.isLoading=!1,alert("Failed to complete sign-up: "+e.data.exceptionMessage),grecaptcha.reset()}))},e.prototype.submitEmailForHoaNotify=function(){var t=this;HtmlUtil.isNullOrWhitespace(this.hoaAlertEmail)?alert("Please enter a valid e-mail address"):(this.isLoading=!0,this.$http.get("/api/PublicEmail/SignUpForHoaAllyAlert?email="+encodeURIComponent(this.hoaAlertEmail)+"&numHomes="+encodeURIComponent(this.hoaAlertNumHomes)).then(function(e){t.isLoading=!1,t.didSignUpForHoaAlert=!0},function(e){t.isLoading=!1,alert("Failed to submit: "+e.data.exceptionMessage)}))},e.$inject=["$scope","$http","$timeout","WizardHandler"],e}();o.HoaSignUpWizardController=i}(Ally||(Ally={})),CA.angularApp.component("hoaSignUpWizard",{templateUrl:"/ngApp/chtn/public/hoa-sign-up-wizard.html",controller:Ally.HoaSignUpWizardController}),function(e){var i=function(){},t=function(){function e(e,t){this.$http=e,this.siteInfo=t,this.isLoading=!1,this.signUpInfo=new i,this.resultIsError=!1}return e.prototype.$onInit=function(){setTimeout(function(){var e=document.getElementById("address-text-box");new google.maps.places.Autocomplete(e,void 0)},750)},e.prototype.onSubmitInfo=function(){if(HtmlUtil.isNullOrWhitespace(this.signUpInfo.emailAddress))alert("Please enter an e-mail address");else{this.isLoading=!0;var t=this;this.$http.post("/api/NeighborSignUp/SignUpNewUser",this.signUpInfo).then(function(e){t.isLoading=!1,t.resultIsError=!1,t.resultMessage="Your information has been successfully submitted. Look for a welcome email soon."},function(){t.isLoading=!1,t.resultIsError=!0,t.resultMessage="There was an error submitting your information. Please try again."})}},e.prototype.goBack=function(){this.resultMessage=null},e.$inject=["$http"],e}();e.NeighborSignUpController=t}(Ally||(Ally={})),CA.angularApp.component("neighborSignUp",{templateUrl:"/ngApp/chtn/public/neighbor-sign-up.html",controller:Ally.NeighborSignUpController}),function(o){var s=function(){this.fullName="",this.email="",this.address="",this.neighborhoodName="",this.notes=""},e=function(){function e(e,t,i,n){this.$scope=e,this.$http=t,this.$timeout=i,this.WizardHandler=n,this.placeWasSelected=!1,this.shouldCheckAddress=!1,this.isLoading=!1,this.map=null,this.isLoadingMap=!1,this.hideWizard=!1,this.hoaPoly={vertices:[]},this.showMap=!1,this.tempSignUpInfo=new s,this.signUpInfo=new o.HoaSignUpInfo}return e.prototype.$onInit=function(){var i=this;this.$scope.$on("wizard:stepChanged",function(e,t){1===t.index?i.$timeout(function(){return i.showMap=!0},50):i.showMap=!1}),setTimeout(function(){var e=document.getElementById("signUpAddress");e&&new google.maps.places.Autocomplete(e)},500)},e.prototype.onSubmitTempInfo=function(){this.isLoading=!0;var t=this;this.$http.post("/api/SignUpWizard/TempNeighborhood",this.tempSignUpInfo).then(function(){t.isLoading=!1,t.submitTempResult="Thank you for your submission. We'll be in touch shortly."},function(e){t.isLoading=!1,t.submitTempResult="Submission failed: "+e.data.exceptionMessage+". Feel free to refresh the page to try again or use the contact form at the bottom of the Community Ally home page."})},e.prototype.centerMap=function(e){e.viewport?this.map.fitBounds(e.viewport):(this.map.setCenter(e.location),this.map.setZoom(17)),this.mapMarker.setPosition(e.location),this.mapMarker.setVisible(!0)},e.prototype.initMapStep=function(){void 0!==window.analytics&&window.analytics.track("condoSignUpStarted"),this.showMap=!0;var e=document.getElementById("association-address-text-box");if(e&&(this.addressAutocomplete=new google.maps.places.Autocomplete(e),this.addressAutocomplete.bindTo("bounds",this.map)),this.mapMarker=new google.maps.Marker({map:this.map,position:null,anchorPoint:new google.maps.Point(41.969638,-87.657423),icon:"/assets/images/MapMarkers/MapMarker_Home.png"}),this.addressAutocomplete){var i=this,t=function(){i.setPlaceWasSelected(),i.mapMarker.setVisible(!1);var e=i.addressAutocomplete.getPlace(),t=e.formatted_address;t.indexOf(", USA")===t.length-", USA".length&&(t=t.substring(0,t.length-", USA".length)),i.signUpInfo.streetAddress=t,e.geometry&&(i.setEditPolyForAddress(e.geometry.location),i.centerMap(e.geometry))};this.addressAutocomplete.addListener("place_changed",function(){i.$scope.$apply(t)})}},e.prototype.onMapEditorReady=function(e){this.map=e,this.initMapStep()},e.prototype.checkAddress=function(){!this.placeWasSelected&&this.shouldCheckAddress&&(this.shouldCheckAddress=!1,this.refreshMapForAddress())},e.prototype.setPlaceWasSelected=function(){this.placeWasSelected=!0,this.shouldCheckAddress=!1;var e=this;setTimeout(function(){e.placeWasSelected=!0},500)},e.prototype.setEditPolyForAddress=function(e){var t=.0014;this.hoaPoly={vertices:[{lat:e.lat()-.001,lon:e.lng()-t},{lat:e.lat()+.001,lon:e.lng()-t},{lat:e.lat()+.001,lon:e.lng()+t},{lat:e.lat()-.001,lon:e.lng()+t}]}},e.prototype.refreshMapForAddress=function(){this.isLoadingMap=!0;var n=this;HtmlUtil.geocodeAddress(this.signUpInfo.streetAddress,function(t,i){n.$scope.$apply(function(){if(n.isLoadingMap=!1,i==google.maps.GeocoderStatus.OK){var e=t[0].formatted_address;e.indexOf(", USA")===e.length-", USA".length&&(e=e.substring(0,e.length-", USA".length)),n.signUpInfo.streetAddress=e,t[0].geometry&&(n.setEditPolyForAddress(t[0].geometry.location),n.centerMap(t[0].geometry))}})})},e.prototype.onFinishedWizard=function(){this.isLoading=!0,this.signUpInfo.boundsGpsVertices=this.hoaPoly.vertices;var i=this;this.$http.post("/api/SignUpWizard/Hoa",this.signUpInfo).then(function(e){i.isLoading=!1;var t=e.data;HtmlUtil.isNullOrWhitespace(t.errorMessage)?(void 0!==window.analytics&&window.analytics.track("condoSignUpComplete"),void 0!==window.goog_report_conversion&&window.goog_report_conversion(),HtmlUtil.isNullOrWhitespace(t.createUrl)?(i.hideWizard=!0,i.resultMessage="Great work! We just sent you an e-mail with instructions on how access your new site."):window.location.href=t.createUrl):(alert("Failed to complete sign-up: "+t.errorMessage),i.WizardHandler.wizard().goTo(t.stepIndex))},function(e){i.isLoading=!1,alert("Failed to complete sign-up: "+e.data.exceptionMessage)})},e.$inject=["$scope","$http","$timeout","WizardHandler"],e}();o.NeighborhoodSignUpWizardController=e}(Ally||(Ally={})),CA.angularApp.component("neighborhoodSignUpWizard",{templateUrl:"/ngApp/chtn/public/neighborhood-sign-up-wizard.html",controller:Ally.NeighborhoodSignUpWizardController}),function(e){var s=function(){},t=function(){function e(e,t,i,n,o){this.$http=e,this.$rootScope=t,this.siteInfo=i,this.$timeout=n,this.appCacheService=o,this.isLoading=!1,this.signUpInfo=new s,this.showInputForm=!0,this.showSchoolField=!1}return e.prototype.$onInit=function(){var e=this;this.groupName=this.siteInfo.publicSiteInfo.fullName,this.showSchoolField="pta"===AppConfig.appShortName,window.setTimeout(function(){return e.hookupAddressAutocomplete()},300),this.$timeout(function(){return grecaptcha.render("recaptcha-check-elem")},100)},e.prototype.hookupAddressAutocomplete=function(){var e=document.getElementById("member-home-address-text-box");this.addressAutocomplete=new google.maps.places.Autocomplete(e,void 0);var t=this;google.maps.event.addListener(this.addressAutocomplete,"place_changed",function(){var e=t.addressAutocomplete.getPlace();t.signUpInfo.streetAddress=e.formatted_address})},e.prototype.submitInfo=function(){var t=this;this.signUpInfo.recaptchaKey=grecaptcha.getResponse(),HtmlUtil.isNullOrWhitespace(this.signUpInfo.recaptchaKey)?this.errorMessage="Please complete the reCAPTCHA field":(this.isLoading=!0,this.errorMessage=null,this.$http.post("/api/PublicPendingUser",this.signUpInfo).then(function(e){t.isLoading=!1,t.showInputForm=!1},function(e){t.isLoading=!1,t.errorMessage="Failed to submit: "+e.data.exceptionMessage}))},e.$inject=["$http","$rootScope","SiteInfo","$timeout","appCacheService"],e}();e.PendingMemberSignUpController=t}(Ally||(Ally={})),CA.angularApp.component("pendingMemberSignUp",{templateUrl:"/ngApp/chtn/public/pending-member-sign-up.html",controller:Ally.PendingMemberSignUpController}),function(e){var t=function(){function e(e,t,i){this.siteInfo=e,this.fellowResidents=t,this.$routeParams=i,this.canManage=!1}return e.prototype.$onInit=function(){var t=this;this.canManage=this.siteInfo.userInfo.isAdmin||this.siteInfo.userInfo.isSiteManager,this.committee&&!this.canManage&&this.fellowResidents.isCommitteeMember(this.committee.committeeId,this.siteInfo.userInfo.userId).then(function(e){return t.canManage=e}),this.$routeParams&&HtmlUtil.isNumericString(this.$routeParams.discussionThreadId)&&(this.autoOpenDiscussionThreadId=parseInt(this.$routeParams.discussionThreadId))},e.$inject=["SiteInfo","fellowResidents","$routeParams"],e}();e.CommitteeHomeController=t}(Ally||(Ally={})),CA.angularApp.component("committeeHome",{bindings:{committee:"<"},templateUrl:"/ngApp/committee/committee-home.html",controller:Ally.CommitteeHomeController}),function(e){var t=function(){function e(e,t,i,n){this.$http=e,this.fellowResidents=t,this.$cacheFactory=i,this.siteInfo=n,this.isLoading=!1,this.canManage=!1}return e.prototype.$onInit=function(){this.populateAllMembers()},e.prototype.populateAllMembers=function(){var t=this;this.isLoading=!0,this.fellowResidents.getResidents().then(function(e){t.allGroupMembers=e,t.getMembers()})},e.prototype.setContactMember=function(){var t=this;this.isLoading=!0,this.$http.put("/api/Committee/"+this.committee.committeeId+"/SetContactMember?userId="+this.contactUser.userId,null).then(function(e){t.isLoading=!1,t.committee.contactMemberUserId=t.contactUser.userId,t.$cacheFactory.get("$http").remove("/api/Committee/"+t.committee.committeeId),t.fellowResidents.clearResidentCache()},function(e){t.isLoading=!1,alert("Failed to set contact member: "+e.data.exceptionMessage)})},e.prototype.getMembers=function(){var i=this;this.isLoading=!0,this.fellowResidents.getCommitteeMembers(this.committee.committeeId).then(function(e){i.isLoading=!1,i.members=e,i.members=_.sortBy(i.members,function(e){return(e.fullName||"").toLowerCase()});i.filteredGroupMembers=_.filter(i.allGroupMembers,function(e){return t=e,!_.some(i.members,function(e){return e.userId===t.userId});var t}),i.filteredGroupMembers=_.sortBy(i.filteredGroupMembers,function(e){return(e.fullName||"").toLowerCase()}),i.contactUser=_.find(i.members,function(e){return e.userId==i.committee.contactMemberUserId}),i.canManage=i.siteInfo.userInfo.isAdmin||i.siteInfo.userInfo.isSiteManager||_.any(i.members,function(e){return e.userId===i.siteInfo.userInfo.userId})},function(e){i.isLoading=!1,alert("Failed to retrieve committee members, please refresh the page to try again")})},e.prototype.addSelectedMember=function(){var t=this;this.userForAdd&&(this.isLoading=!0,this.$http.put("/api/Committee/"+this.committee.committeeId+"/AddMember?userId="+this.userForAdd.userId,null).then(function(e){t.isLoading=!1,t.getMembers()},function(e){t.isLoading=!1,alert("Failed to add member, please refresh the page to try again: "+e.data.exceptionMessage)}))},e.prototype.removeMember=function(e){var t=this;confirm("Are you sure you want to remove this person from this committee?")&&(this.isLoading=!0,this.$http.put("/api/Committee/"+this.committee.committeeId+"/RemoveMember?userId="+e.userId,null).then(function(e){t.isLoading=!1,t.getMembers()},function(e){t.isLoading=!1,alert("Failed to remove member, please refresh the page to try again: "+e.data.exceptionMessage)}))},e.$inject=["$http","fellowResidents","$cacheFactory","SiteInfo"],e}();e.CommitteeMembersController=t}(Ally||(Ally={})),CA.angularApp.component("committeeMembers",{bindings:{committee:"<"},templateUrl:"/ngApp/committee/committee-members.html",controller:Ally.CommitteeMembersController}),function(e){var t=function(){function e(e,t,i,n,o){this.$http=e,this.siteInfo=t,this.$routeParams=i,this.$cacheFactory=n,this.$rootScope=o,this.canManage=!1,this.initialView="Home",this.selectedView=null,this.isLoading=!1,this.committeeId=this.$routeParams.committeeId,this.initialView=this.$routeParams.viewName||"Home"}return e.prototype.$onInit=function(){this.canManage=this.siteInfo.userInfo.isAdmin||this.siteInfo.userInfo.isSiteManager,this.retrieveCommittee()},e.prototype.retrieveCommittee=function(){var t=this;this.isLoading=!0,this.$rootScope.dontHandle403=!0,this.$http.get("/api/Committee/"+this.committeeId,{cache:!0}).then(function(e){t.$rootScope.dontHandle403=!1,t.isLoading=!1,t.committee=e.data,t.selectedView=t.initialView},function(e){t.$rootScope.dontHandle403=!1,t.isLoading=!1,403===e.status?(alert("You are not authorized to view this private committee. You must be a member of the committee to view its contents. Reach out to a board member to inquire about joining the committiee."),window.location.href="/#!/Home"):alert("Failed to load committee: "+e.data.exceptionMessage)})},e.prototype.onUpdateCommitteeName=function(){var t=this;this.isLoading=!0;var e="/api/Committee/"+this.committeeId+"?newName="+this.committee.name;this.$http.put(e,null).then(function(){t.isLoading=!1,t.$cacheFactory.get("$http").remove("/api/Committee/"+t.committeeId)},function(e){t.isLoading=!1,alert("Failed to update the committee name: "+e.data.exceptionMessage)})},e.$inject=["$http","SiteInfo","$routeParams","$cacheFactory","$rootScope"],e}();e.CommitteeParentController=t}(Ally||(Ally={})),CA.angularApp.component("committeeParent",{templateUrl:"/ngApp/committee/committee-parent.html",controller:Ally.CommitteeParentController}),function(e){var t=function(){function e(e,t,i,n){this.$http=e,this.siteInfo=t,this.$timeout=i,this.$rootScope=n,this.isLoading=!1}return e.prototype.$onInit=function(){this.refreshPolls()},e.prototype.populatePollData=function(e){(this.polls=e)&&0<e.length&&this.$rootScope.$broadcast("homeHasActivePolls");for(var t=0;t<this.polls.length;++t){var i=this.polls[t];if(i.hasUsersUnitVoted&&i.canViewResults){var n=_.groupBy(i.responses,"answerId");for(var o in i.chartData=[],i.chartLabels=[],n)n.hasOwnProperty(o)&&(i.chartLabels.push(_.find(i.answers,function(e){return e.pollAnswerId==o}).answerText),i.chartData.push(n[o].length));i.responses&&i.responses.length<this.siteInfo.privateSiteInfo.numUnits&&(i.chartLabels.push("No Response"),i.chartData.push(this.siteInfo.privateSiteInfo.numUnits-i.responses.length))}}},e.prototype.refreshPolls=function(){this.isLoading=!0;var t=this;this.$http({method:"GET",url:"/api/Poll?getActive=1"}).then(function(e){t.isLoading=!1,t.$timeout(function(){t.populatePollData(e.data)},100)},function(){t.isLoading=!1})},e.prototype.onPollAnswer=function(e,t,i){this.isLoading=!0;var n="/api/Poll/PollResponse?pollId="+e.pollId+"&answerId="+(t?t.pollAnswerId:"")+"&writeInAnswer="+i,o=this;this.$http.put(n,null).then(function(e){o.polls=e.data,o.isLoading=!1,o.refreshPolls()},function(){o.isLoading=!1})},e.$inject=["$http","SiteInfo","$timeout","$rootScope"],e}();e.ActivePollsController=t}(Ally||(Ally={})),CA.angularApp.component("activePolls",{templateUrl:"/ngApp/common/active-polls.html",controller:Ally.ActivePollsController}),function(a){var e=function(){function e(e,t,i,n,o,s){this.$http=e,this.siteInfo=t,this.$rootScope=i,this.$sce=n,this.$timeout=o,this.$q=s,this.isLoading_Payment=!1,this.isLoadingDwolla=!1,this.showParagon=!1,this.showParagonCheckingSignUpModal=!1,this.showParagonCreditSignUpModal=!1,this.dwollaSignUpInfo={dateOfBirth:"",ssnLast4:"",ssnFull:"",streetAddress:new a.FullAddress},this.isWePayPaymentActive=!1,this.isDwollaEnabledOnGroup=!1,this.isDwollaReadyForPayment=!1,this.shouldShowDwollaAddAccountModal=!1,this.shouldShowDwollaModalClose=!1,this.hasComplexPassword=!1,this.didAgreeToDwollaTerms=!1,this.dwollaFeePercent=.5,this.dwollaMaxFee=5,this.dwollaDocUploadType="license",this.dwollaDocUploadFile=null,this.dwollaBalance=-1,this.isDwollaIavDone=!1,this.shouldShowMicroDepositModal=!1,this.dwollaMicroDepositAmount1String="0.01",this.dwollaMicroDepositAmount2String="0.01",this.shouldShowOwnerFinanceTxn=!1}return e.prototype.$onInit=function(){var t=this;this.showParagon=!1,this.paragonPaymentParams="&BillingAddress1="+encodeURIComponent("900 W Ainslie St")+"&BillingState=Illinois&BillingCity=Chicago&BillingZip=60640&FirstName="+encodeURIComponent(this.siteInfo.userInfo.firstName)+"&LastName="+encodeURIComponent(this.siteInfo.userInfo.lastName),this.paragonCheckingLast4=this.siteInfo.userInfo.paragonCheckingLast4,this.paragonCardLast4=this.siteInfo.userInfo.paragonCardLast4,this.isWePayPaymentActive=this.siteInfo.privateSiteInfo.isWePayPaymentActive;if(this.isDwollaEnabledOnGroup=this.siteInfo.privateSiteInfo.isDwollaPaymentActive,this.dwollaFeePercent=this.siteInfo.privateSiteInfo.isPremiumPlanActive?.5:1,this.dwollaMaxFee=this.siteInfo.privateSiteInfo.isPremiumPlanActive?5:10,this.shouldShowOwnerFinanceTxn=this.siteInfo.privateSiteInfo.shouldShowOwnerFinanceTxn,this.isDwollaUserAccountVerified=this.siteInfo.userInfo.isDwollaAccountVerified,this.isDwollaUserAccountVerified)this.dwollaUserStatus="verified",this.hasDwollaFundingSource=a.HtmlUtil2.isValidString(this.siteInfo.userInfo.dwollaFundingSourceName),this.hasDwollaFundingSource?(this.dwollaFundingSourceName=this.siteInfo.userInfo.dwollaFundingSourceName,this.dwollaFundingSourceIsVerified=this.siteInfo.userInfo.dwollaFundingSourceIsVerified,this.isDwollaReadyForPayment=this.isDwollaUserAccountVerified&&this.dwollaFundingSourceIsVerified&&this.siteInfo.privateSiteInfo.isDwollaPaymentActive,this.isDwollaReadyForPayment&&this.$timeout(function(){t.$http.get("/api/Dwolla/DwollaBalance").then(function(e){return t.dwollaBalance=e.data.balanceAmount})},1e3)):this.$http.get("/api/Dwolla/HasComplexPassword").then(function(e){return t.hasComplexPassword=e.data});else{this.dwollaUserStatus="checking",this.userFullName=this.siteInfo.userInfo.fullName,this.userEmail=this.siteInfo.userInfo.emailAddress;this.$timeout(function(){t.$http.get("/api/Dwolla/MyAccountStatus").then(function(e){t.dwollaUserStatus=e.data.status,t.dwollaSignUpInfo.streetAddress=e.data.streetAddress},function(e){t.dwollaUserStatus="error"})},500)}this.allyAppName=AppConfig.appName,this.isAutoPayActive=this.siteInfo.userInfo.isAutoPayActive,this.assessmentCreditCardFeeLabel=this.siteInfo.privateSiteInfo.payerPaysCCFee?"Service fee applies":"No service fee",this.assessmentAchFeeLabel=this.siteInfo.privateSiteInfo.payerPaysAchFee?"Service fee applies":"No service fee",this.payerPaysAchFee=this.siteInfo.privateSiteInfo.payerPaysAchFee,this.errorPayInfoText="Is the amount incorrect?",this.isWePaySetup=this.siteInfo.privateSiteInfo.isPaymentEnabled,this.hasAssessments=this.siteInfo.privateSiteInfo.hasAssessments,this.assessmentFrequency=this.siteInfo.privateSiteInfo.assessmentFrequency,!this.isAutoPayActive&&HtmlUtil.isNumericString(HtmlUtil.GetQueryStringParameter("preapproval_id"))&&(this.isAutoPayActive=!0),this.nextAutoPayText=this.siteInfo.userInfo.nextAutoPayText,null!=this.siteInfo.userInfo.usersUnits&&0<this.siteInfo.userInfo.usersUnits.length?this.assessmentAmount=this.siteInfo.userInfo.usersUnits[0].assessment:this.assessmentAmount=0,this.paymentInfo={paymentType:"other",amount:this.assessmentAmount,note:"",fundingType:null,paysFor:[]},this.onPaymentAmountChange();if(this.historicPayments=this.siteInfo.userInfo.recentPayments,this.historicPayments&&0<this.historicPayments.length)for(24<this.historicPayments.length&&(this.historicPayments=this.historicPayments.slice(0,24));this.historicPayments.length<24;)this.historicPayments.push({});null!=this.siteInfo.privateSiteInfo.assessmentFrequency&&null!=this.siteInfo.userInfo.usersUnits&&0<this.siteInfo.userInfo.usersUnits.length&&(this.paymentInfo.paymentType="periodic",this.siteInfo.privateSiteInfo.isPeriodicPaymentTrackingEnabled&&(this.knowsNextPayment=!0,this.errorPayInfoText="Is the amount or date incorrect?",this.nextPaymentText=this.getNextPaymentText([this.siteInfo.userInfo.usersUnits[0].nextAssessmentDue],this.siteInfo.privateSiteInfo.assessmentFrequency),this.updatePaymentText()))},e.prototype.showParagonSignUp=function(){var t=this;this.showParagonCheckingSignUpModal=!0,this.paragonSignUpInfo||(this.isLoading_Payment=!0,this.$http.get("/api/Paragon/SignUpPrefill").then(function(e){t.isLoading_Payment=!1,t.paragonSignUpInfo=e.data},function(e){t.isLoading_Payment=!1,t.paragonSignUpInfo=new ParagonPayerSignUpInfo}))},e.prototype.showParagonCreditSignUp=function(){var t=this;this.isLoading_Payment=!0,this.paragonCardTokenizedUrl=null,this.paragonCardTokenizationMessage="Connecting...",this.showParagonCreditSignUpModal=!0,this.$http.get("/api/Paragon/CardTokenizationKey").then(function(e){t.isLoading_Payment=!1,t.paragonCardTokenizedUrl=t.$sce.trustAsResourceUrl("https://stage.paragonsolutions.com/ws/hosted.aspx?Username=54cE7DU2p%2bBh7h9uwJWW8Q%3d%3d&Password=jYvmN41tt1lz%2bpiazUqQYK9Abl73Z%2bHoBG4vOZImo%2bYlKTbPeNPwOcMB0%2bmIS3%2bs&MerchantKey=1293&InvNum="+e.data),t.paragonCardTokenizationMessage=null},function(e){t.isLoading_Payment=!1,t.paragonCardTokenizationMessage="There was an error connecting to the server. Please close this window and try again. If this has happened more than once please contact support."})},e.prototype.hideParagonCreditSignUp=function(){this.showParagonCreditSignUpModal=!1,this.paragonCardTokenizedUrl&&window.location.reload()},e.prototype.submitParagonSignUp=function(){var t=this;this.isLoading_Payment=!0,this.paragonSignUpError=null,this.$http.post("/api/Paragon/CheckPaymentSignUp",this.paragonSignUpInfo).then(function(e){window.location.reload()},function(e){t.isLoading_Payment=!1,t.paragonSignUpError=e.data.exceptionMessage})},e.prototype.submitParagonPayment=function(e){var t=this;if(confirm("This will submit payment.")){this.paragonPaymentMessage=null;var i=new ParagonPaymentRequest;i.notes=this.paymentInfo.note,i.paymentAmount=this.paymentInfo.amount,i.paysFor=this.paymentInfo.paysFor,i.paySource=e,this.isLoading_Payment=!0,this.$http.post("/api/Paragon/MakePayment",i).then(function(e){t.isLoading_Payment=!1,t.paragonPaymentMessage="Payment Successfully Processed"},function(e){t.isLoading_Payment=!1,t.paragonPaymentMessage=e.data.exceptionMessage})}},e.prototype.unenrollParagonAccount=function(e){var t=this;this.isLoading_Payment=!0,this.$http.get("/api/Paragon/UnenrollPayment?paySource="+e).then(function(e){window.location.reload()},function(e){t.isLoading_Payment=!1,alert("Failed to un-enroll: "+e.data.exceptionMessage),t.paragonPaymentMessage=e.data.exceptionMessage})},e.prototype.makeWePayPayment=function(e){var i=this;this.isLoading_Payment=!0,this.paymentInfo.fundingType=e;var t=this.paymentInfo.amount;HtmlUtil.isValidString(t)&&"$"===t[0]&&(this.paymentInfo.amount=parseFloat(t.substr(1))),analytics.track("makePayment",{fundingType:e}),this.$http.post("/api/WePayPayment/MakeNewPayment",this.paymentInfo).then(function(e){var t=e.data;null!==t&&"string"==typeof t.checkoutUri&&0<t.checkoutUri.length?window.location.href=t.checkoutUri:(i.isLoading_Payment=!1,alert("Unable to initiate WePay checkout"))},function(e){i.isLoading_Payment=!1,e.data&&e.data.exceptionMessage&&alert(e.data.exceptionMessage)})},e.prototype.getMyRecentPayments=function(){var t=this;this.$http.get("/api/WePayPayment/MyRecentPayments").then(function(e){t.myRecentPayments=e.data},function(e){console.log("Failed to retrieve recent payments: "+e.data.exceptionMessage)})},e.prototype.onIncorrectPayDetails=function(){var e=this.assessmentAmount.toString();Math.round(this.assessmentAmount)!=this.assessmentAmount&&(e=this.assessmentAmount.toFixed(2));var t=e;this.knowsNextPayment&&HtmlUtil.isValidString(this.nextPaymentText)&&(t+="|"+this.nextPaymentText),this.$rootScope.$broadcast("prepAssessmentEmailToBoard",t)},e.prototype.updatePaymentText=function(){"periodic"===this.paymentInfo.paymentType&&this.siteInfo.privateSiteInfo.isPeriodicPaymentTrackingEnabled?HtmlUtil.isNullOrWhitespace(this.nextPaymentText)||(this.siteInfo.userInfo.usersUnits[0].includesLateFee?this.paymentInfo.note="Assessment payment with late fee for ":this.paymentInfo.note="Assessment payment for ",this.paymentInfo.note+=this.nextPaymentText):this.paymentInfo.note=""},e.prototype.onSelectPaymentType=function(e){this.paymentInfo.paymentType=e,this.paymentInfo.amount="periodic"==e?this.assessmentAmount:0,this.updatePaymentText(),this.onPaymentAmountChange()},e.prototype.getNextPaymentText=function(e,t){if(null==e)return"";e.constructor!==Array&&(e=[e]);for(var i="",n=FrequencyIdToInfo(t),o=0;o<e.length;++o){var s=e[o];if("month"===n.intervalName){i=["January","February","March","April","May","June","July","August","September","October","November","December"][s.period-1]}else if("quarter"===n.intervalName){i=["Q1","Q2","Q3","Q4"][s.period-1]}else if("half-year"===n.intervalName){i=["First Half","Second Half"][s.period-1]}i+=" "+s.year,this.paymentInfo.paysFor=[s]}return i},e.prototype.onSetupAutoPay=function(e){var i=this;this.isLoading_Payment=!0,this.$http.get("/api/WePayPayment/SetupAutoPay?fundingType="+e).then(function(e){var t=e.data;"string"==typeof t&&0<t.length?window.location.href=t:(i.isLoading_Payment=!1,alert("Unable to initiate WePay auto-pay setup"))},function(e){i.isLoading_Payment=!1,e.data&&e.data.exceptionMessage&&alert(e.data.exceptionMessage)})},e.prototype.onDisableAutoPay=function(){var t=this;confirm("Just to double check, this will disable your auto-payment. You need to make sure to manually make your regular payments to avoid any late fees your association may enforce.")&&(this.isLoading_Payment=!0,this.$http.get("/api/WePayPayment/DisableAutoPay").then(function(){t.isLoading_Payment=!1,t.isAutoPayActive=!1},function(e){t.isLoading_Payment=!1,e.data&&e.data.exceptionMessage&&alert(e.data.exceptionMessage)}))},e.prototype.dwollaSignUp=function(){var t=this;this.didAgreeToDwollaTerms?(this.isLoading_Payment=!0,this.$http.post("/api/Dwolla/CreatePayer",this.dwollaSignUpInfo).then(function(){window.location.reload()},function(e){t.isLoading_Payment=!1,e.data&&e.data.exceptionMessage&&alert(e.data.exceptionMessage)})):alert("Please agree to Dwolla's terms and privacy policy")},e.prototype.dwollaStartIAV=function(){var n=this;this.shouldShowDwollaAddAccountModal=!0,this.shouldShowDwollaModalClose=!1,this.isDwollaIavDone=!1,this.isLoadingDwolla=!0;this.$http.get("/api/Dwolla/UserIavToken").then(function(t){n.isLoadingDwolla=!1,window.setTimeout(function(){return e=t.data.iavToken,dwolla.configure(a.AppConfigInfo.dwollaEnvironmentName),void dwolla.iav.start(e,{container:"dwolla-iav-container",stylesheets:["https://fonts.googleapis.com/css?family=Lato&subset=latin,latin-ext"],microDeposits:!0,fallbackToMicroDeposits:!0},function(e,t){if(t&&t._links&&t._links["funding-source"]&&t._links["funding-source"].href){var i=t._links["funding-source"].href;n.$http.put("/api/Dwolla/SetUserFundingSourceUri",{fundingSourceUri:i}).then(function(e){n.isDwollaIavDone=!0},function(e){n.isLoadingDwolla=!1,n.shouldShowDwollaModalClose=!0,alert("Failed to complete sign-up")})}});var e},150)},function(e){n.isLoadingDwolla=!1,alert("Failed to start IAV: "+e.data.exceptionMessage)})},e.prototype.hideDwollaAddAccountModal=function(){this.shouldShowDwollaAddAccountModal=!1,this.isDwollaIavDone&&(this.isLoading_Payment=!0,window.location.reload())},e.prototype.submitDwollaPayment=function(){var t=this;this.dwollaPaymentMessage=null,this.isLoading_Payment=!0,this.$http.post("/api/Dwolla/MakePayment",this.paymentInfo).then(function(e){t.isLoading_Payment=!1,t.dwollaPaymentMessage="Payment Successfully Processed"},function(e){t.isLoading_Payment=!1,t.dwollaPaymentMessage="Payment failed: "+e.data.exceptionMessage})},e.prototype.unlinkDwollaFundingSource=function(){var t=this;confirm("Are you sure you want to disconnect the bank account? You will no longer be able to make payments.")&&(this.isLoading_Payment=!0,this.$http.put("/api/Dwolla/DisconnectUserFundingSource",null).then(function(e){window.location.reload()},function(e){t.isLoading_Payment=!1,alert("Failed to disconnect account"+e.data.exceptionMessage)}))},e.prototype.onPaymentAmountChange=function(){var e=Math.ceil(this.paymentInfo.amount*this.dwollaFeePercent)/100;e>this.dwollaMaxFee&&(e=this.dwollaMaxFee),this.dwollaFeeAmountString="$"+e.toFixed(2)},e.prototype.uploadDwollaDoc=function(){var t=this;this.isLoading_Payment=!0,this.dwollaDocUploadMessage=null;var e=new FormData;e.append("DocumentFile",this.dwollaDocUploadFile),e.append("DocumentType",this.dwollaDocUploadType);var i={headers:{"Content-Type":void 0}};this.$http.post("/api/Dwolla/UploadCustomerDocument",e,i).then(function(e){t.isLoading_Payment=!1,t.dwollaDocUploadFile=null,t.dwollaDocUploadMessage="Your document has been successfully uploaded. You will be notified when it is reviewed."},function(e){t.isLoading_Payment=!1,alert("Failed to upload document: "+e.data.exceptionMessage)})},e.prototype.onDwollaDocSelected=function(e){this.dwollaDocUploadFile=e?e.target.files[0]:null},e.prototype.withdrawDwollaBalance=function(){var t=this;this.isLoading_Payment=!0,this.dwollaBalanceMessage=null,this.$http.get("/api/Dwolla/WithdrawDwollaBalance").then(function(e){t.isLoading_Payment=!1,t.dwollaBalanceMessage="Balance withdraw successfully initiated. Expect the transfer to complete in 1-2 business days."},function(e){t.isLoading_Payment=!1,alert("Failed to initiate withdraw: "+e.data.exceptionMessage)})},e.prototype.submitDwollaMicroDepositAmounts=function(){var t=this;this.isLoading_Payment=!0;var e={amount1String:this.dwollaMicroDepositAmount1String,amount2String:this.dwollaMicroDepositAmount2String,isForGroup:!1};this.$http.post("/api/Dwolla/VerifyMicroDeposit",e).then(function(e){window.location.reload()},function(e){t.isLoading_Payment=!1,alert("Failed to verify: "+e.data.exceptionMessage)})},e.$inject=["$http","SiteInfo","$rootScope","$sce","$timeout","$q"],e}();a.AssessmentPaymentFormController=e}(Ally||(Ally={})),CA.angularApp.component("assessmentPaymentForm",{templateUrl:"/ngApp/common/assessment-payment-form.html",controller:Ally.AssessmentPaymentFormController});var CreateDwollaUser=function(){},ParagonPayerSignUpInfo=function(){this.billingAddress=new Ally.FullAddress,this.checkType="PERSONAL",this.accountType="CHECKING"},ParagonPaymentRequest=function(){};!function(e){var t=function(){function e(e,t,i){this.$http=e,this.siteInfo=t,this.$sce=i,this.isLoading=!1}return e.prototype.$onInit=function(){var t=this;this.isLoading=!0,this.$http.get("/api/CustomPage/View/SellPage").then(function(e){t.isLoading=!1,t.customPage=e.data,t.markupHtml=t.$sce.trustAsHtml(t.customPage.markupHtml)},function(e){t.isLoading=!1,alert("Failed to load page, try refreshing the page. If the problem persists, contact support: "+e.data.exceptionMessage)})},e.$inject=["$http","SiteInfo","$sce"],e}();e.CustomPageViewController=t}(Ally||(Ally={})),CA.angularApp.component("customPageView",{templateUrl:"/ngApp/common/custom-page-view.html",controller:Ally.CustomPageViewController}),function(e){var t=function(){function e(e,t,i){this.appCacheService=e,this.$scope=t,this.$timeout=i,this.filterPresetDateRange="last30days",this.shouldSuppressCustom=!1,this.thisYearLabel=(new Date).getFullYear().toString(),this.lastYearLabel=((new Date).getFullYear()-1).toString()}return e.prototype.$onInit=function(){var i=this;this.selectPresetDateRange(!0),this.$scope.$watch("$ctrl.startDate",function(e,t){e&&e!==t&&!i.shouldSuppressCustom&&(i.filterPresetDateRange="custom")}),this.$scope.$watch("$ctrl.endDate",function(e,t){e&&e!==t&&!i.shouldSuppressCustom&&(i.filterPresetDateRange="custom")})},e.prototype.selectPresetDateRange=function(e){var t=this;if(void 0===e&&(e=!1),"last30days"===this.filterPresetDateRange)this.startDate=moment().subtract(30,"days").toDate(),this.endDate=moment().toDate();else if("thisMonth"===this.filterPresetDateRange)this.startDate=moment().startOf("month").toDate(),this.endDate=moment().endOf("month").toDate();else if("lastMonth"===this.filterPresetDateRange){var i=moment().subtract(1,"months");this.startDate=i.startOf("month").toDate(),this.endDate=i.endOf("month").toDate()}else if("thisYear"===this.filterPresetDateRange)this.startDate=moment().startOf("year").toDate(),this.endDate=moment().endOf("year").toDate();else if("lastYear"===this.filterPresetDateRange){var n=moment().subtract(1,"years");this.startDate=n.startOf("year").toDate(),this.endDate=n.endOf("year").toDate()}else"oneYear"===this.filterPresetDateRange&&(this.startDate=moment().subtract(1,"years").toDate(),this.endDate=moment().toDate());this.shouldSuppressCustom=!0,window.setTimeout(function(){return t.shouldSuppressCustom=!1},25),!e&&this.onChange&&window.setTimeout(function(){return t.onChange()},50)},e.prototype.onInternalChange=function(){var e=this;if("string"==typeof this.startDate){if(10!==this.startDate.length)return;this.startDate=moment(this.startDate,"MM-DD-YYYY").toDate()}if("string"==typeof this.endDate){if(10!==this.endDate.length)return;this.endDate=moment(this.endDate,"MM-DD-YYYY").toDate()}this.$timeout(function(){e.onChange&&e.onChange()},10)},e.$inject=["appCacheService","$scope","$timeout"],e}();e.DateRangePickerController=t}(Ally||(Ally={})),CA.angularApp.component("dateRangePicker",{bindings:{startDate:"=",endDate:"=",onChange:"&"},templateUrl:"/ngApp/common/date-range-picker.html",controller:Ally.DateRangePickerController}),function(r){var e=function(){};r.DocumentTreeFile=e;var t=function(){};r.DocLinkInfo=t;var s=function(){function e(){}return e.prototype.getSubDirectoryByName=function(e){if(!this.subdirectories)return null;for(var t=0;t<this.subdirectories.length;++t)if(this.subdirectories[t].name===e)return this.subdirectories[t];return null},e}();r.DocumentDirectory=s;var i=function(){function l(e,t,i,n,o,s,a){var r=this;this.$http=e,this.$rootScope=t,this.$cacheFactory=i,this.$scope=n,this.siteInfo=o,this.fellowResidents=s,this.$location=a,this.isLoading=!1,this.filesSortDescend=!1,this.title="Documents",this.getDocsUri="/api/ManageDocuments",this.showPopUpWarning=!1,this.shouldShowSubdirectories=!0,this.docsHttpCache=this.$cacheFactory.get("docs-http-cache")||this.$cacheFactory("docs-http-cache"),this.fileSortType=window.localStorage[l.LocalStorageKey_SortType],this.fileSortType||(this.fileSortType="title"),this.filesSortDescend="true"===window.localStorage[l.LocalStorageKey_SortDirection],this.fileSearch={all:""},this.canManage=this.siteInfo.userInfo.isAdmin||this.siteInfo.userInfo.isSiteManager,this.committee&&!this.canManage&&this.fellowResidents.isCommitteeMember(this.committee.committeeId,this.siteInfo.userInfo.userId).then(function(e){return r.canManage=e})}return l.prototype.$onInit=function(){var s=this;this.apiAuthToken=this.$rootScope.authToken,this.Refresh();setTimeout(function(){$("#JQDocsFileUploader").fileupload({autoUpload:!0,add:function(e,t){if(52428800<t.files[0].size){var i=Math.round(t.files[0].size/1048576)+1;alert("The selected file is too large ("+i+"MB). The maximum file size allowed is 50MB.")}else{var n=s.getSelectedDirectoryPath();$("#FileUploadProgressContainer").show(),t.url="api/DocumentUpload?dirPath="+encodeURIComponent(n),s.siteInfo.publicSiteInfo.baseApiUrl&&(t.url=s.siteInfo.publicSiteInfo.baseApiUrl+"DocumentUpload?dirPath="+encodeURIComponent(n));var o=t.submit();o.done(function(e){s.docsHttpCache.removeAll(),$("#FileUploadProgressContainer").hide(),s.Refresh()}),o.error(function(e,t){alert("Upload failed: "+e.responseJSON.exceptionMessage)})}},beforeSend:function(e){s.siteInfo.publicSiteInfo.baseApiUrl?e.setRequestHeader("Authorization","Bearer "+s.apiAuthToken):e.setRequestHeader("ApiAuthToken",s.apiAuthToken)},progressall:function(e,t){var i=parseInt((t.loaded/t.total*100).toString(),10);$("#FileUploadProgressBar").css("width",i+"%"),100===i?$("#FileUploadProgressLabel").text("Finalizing Upload..."):$("#FileUploadProgressLabel").text(i+"%")},fail:function(e,t){$("#FileUploadProgressContainer").hide()}})},100),this.committee&&(this.title="Committee Documents")},l.prototype.getSelectedDirectoryPath=function(){return this.getDirectoryFullPath(this.selectedDirectory)},l.prototype.viewDoc=function(n,o){var s,a=this;(this.isLoading=!0,this.showPopUpWarning=!1,".rtf"===this.getDisplayExtension(n)&&(o=!0),o)||(!(s=window.open("","_blank"))||s.closed||void 0===s.closed?(alert("Looks like your browser may be blocking pop-ups which are required to view documents. Please see the right of the address bar or your browser settings to enable pop-ups for "+AppConfig.appName+"."),this.showPopUpWarning=!0):s.document.write("Loading document... (If the document cannot be viewed directly in your browser, it will be downloaded automatically)"));var e="/api/DocumentLink/"+n.docId;this.$http.get(e).then(function(e){a.isLoading=!1;var t=n.url+"?vid="+encodeURIComponent(e.data.vid);if(HtmlUtil.startsWith(t,"/api/")&&(t=t.substr("/api/".length)),t=a.siteInfo.publicSiteInfo.baseApiUrl+t,o){var i=document.createElement("a");i.setAttribute("type","hidden"),i.href=t+"&dl="+encodeURIComponent(n.fileName),i.download=n.fileName,document.body.appendChild(i),i.click(),i.remove()}else r.HtmlUtil2.isAndroid()?s.location.href="http://docs.google.com/gview?embedded=true&url="+encodeURIComponent(t):s.location.href=t},function(e){a.isLoading=!1,alert("Failed to open document: "+e.data.exceptionMessage)})},l.prototype.startZipGenDownload=function(){var t,i=this;t=function(){i.$http.get("/api/DocumentUpload/GetZipGenStatus?vid="+i.generatingZipId).then(function(e){0,0===e.data.totalNumFiles?i.generatingZipStatus="Still waiting...":i.generatingZipStatus=e.data.numFilesProcessed+" of "+e.data.totalNumFiles+" files processed",e.data.isReady?(i.generatingZipStatus="ready",i.downloadZipUrl=i.siteInfo.publicSiteInfo.baseApiUrl+"DocumentUpload/DownloadZipGen?vid="+i.generatingZipId):window.setTimeout(function(){return t()},750)},function(e){i.generatingZipStatus=null,alert("Zip file generation failed: "+e.data.exceptionMessage)})},this.generatingZipStatus="Starting...";var e="/api/DocumentUpload/StartFullZipGeneration";this.committee&&(e+="?committeeId="+this.committee.committeeId),this.$http.get(e).then(function(e){i.generatingZipId=e.data.statusId,i.generatingZipStatus="Waiting for update...",window.setTimeout(function(){return t()},1250)},function(e){i.generatingZipStatus=null,alert("Failed to start zip generation: "+e.data.exceptionMessage)})},l.prototype.getDirectoryFullPath=function(e){for(var t=e.name,i=e.parentDirectory;i;)t=i.name+"/"+t,i=i.parentDirectory;return this.committee&&(t=l.DirName_Committees+"/"+this.committee.committeeId+"/"+t),t},l.prototype.FindDirectoryByPath=function(e){if(this.documentTree){if(this.committee&&HtmlUtil.startsWith(e,l.DirName_Committees)){var t=(e=e.substr(l.DirName_Committees.length+1)).indexOf("/");-1!==t&&(e=e.substr(t+1))}for(var i=e.split("/"),n=this.documentTree,o=0;o<i.length&&(n=n.getSubDirectoryByName(i[o]));++o);return n}},l.prototype.updateFileFilter=function(){var t=angular.lowercase(this.fileSearch.all)||"";this.searchFileList=_.filter(this.fullSearchFileList,function(e){return-1!==angular.lowercase(e.localFilePath||"").indexOf(t)||-1!==angular.lowercase(e.uploadDateString||"").indexOf(t)||-1!==angular.lowercase(e.uploaderFullName||"").indexOf(t)}),setTimeout(function(){var e=document.getElementById("documents-area"),t=e.style.display;e.style.display="none";e.offsetHeight;e.style.display=t},50)},l.prototype.hookUpFileDragging=function(){var o=this;if(this.canManage){var s=this;setTimeout(function(){$(".droppable").droppable({drop:function(e,t){var i=o.getSelectedDirectoryPath();$(t.draggable).draggable("option","revert","false");var n=$(e.target).attr("data-folder-path").trim();o.$scope.$apply(function(){o.isLoading=!0;var e={relativeS3Path:o.selectedFile.relativeS3Path,action:"move",newFileName:"",sourceFolderPath:i,destinationFolderPath:n};o.selectedFile=null,o.$http.put("/api/ManageDocuments/MoveFile",e).then(function(){o.isLoading=!1,o.docsHttpCache.removeAll(),o.Refresh()},function(e){o.isLoading=!1;var t=e.exceptionMessage||e.message||e;alert("Failed to move file: "+t)})})},hoverClass:"Document_Folder_DropHover"}),$(".draggable").draggable({distance:10,revert:!0,helper:"clone",opacity:1,containment:"document",appendTo:"body",start:function(e,t){var i=$(e.target).attr("id").substring("File_".length),n=parseInt(i);s.$scope.$apply(function(){var e=s.selectedDirectory.files[n];s.selectedFile=e})}})},250)}},l.prototype.onDirectoryClicked=function(e){if(this.selectedDirectory===e?this.shouldShowSubdirectories=!this.shouldShowSubdirectories:this.shouldShowSubdirectories=!0,this.selectedDirectory=e,this.selectedFile=null,this.fileSearch.all=null,this.hookUpFileDragging(),this.SortFiles(),this.committee){var t=l.DirName_Committees+"/"+this.committee.committeeId+"/";this.$location.search("directory",e.fullDirectoryPath.substring(t.length))}else this.$location.search("directory",e.fullDirectoryPath)},l.prototype.createDirectory=function(){this.createUnderParentDirName=null,this.committee&&(this.createUnderParentDirName=l.DirName_Committees+"/"+this.committee.committeeId),this.shouldShowCreateFolderModal=!0,setTimeout(function(){return $("#CreateDirectoryNameTextBox").focus()},50)},l.prototype.CreateSubDirectory=function(){this.createUnderParentDirName=this.selectedDirectory.fullDirectoryPath,this.committee&&(this.createUnderParentDirName=l.DirName_Committees+"/"+this.committee.committeeId+"/"+this.createUnderParentDirName),this.shouldShowCreateFolderModal=!0,setTimeout(function(){return $("#CreateDirectoryNameTextBox").focus()},50)},l.prototype.SetFileSortType=function(e){this.fileSortType===e?this.filesSortDescend=!this.filesSortDescend:this.filesSortDescend=!1,this.fileSortType=e,window.localStorage[l.LocalStorageKey_SortType]=this.fileSortType,window.localStorage[l.LocalStorageKey_SortDirection]=this.filesSortDescend,this.SortFiles()},l.prototype.SortFiles=function(){this.selectedDirectory&&this.selectedDirectory.files&&("title"!==this.fileSortType&&"uploadDate"!==this.fileSortType||(this.selectedDirectory.files=_.sortBy(this.selectedDirectory.files,this.fileSortType)),this.filesSortDescend&&this.selectedDirectory.files.reverse())},l.prototype.onCreateDirectoryClicked=function(){var t=this;this.isLoading=!0;var e="/api/ManageDocuments/CreateDirectory?folderName="+encodeURIComponent(this.newDirectoryName);e+="&parentFolderPath=",this.createUnderParentDirName&&(e+=encodeURIComponent(this.createUnderParentDirName)),this.$http.put(e,null).then(function(){t.docsHttpCache.removeAll(),t.newDirectoryName="",t.Refresh(),t.shouldShowCreateFolderModal=!1},function(e){alert("Failed to create the folder: "+e.data.exceptionMessage),t.isLoading=!1})},l.prototype.onCancelAddDirectory=function(){this.shouldShowCreateFolderModal=!1,this.newDirectoryName=""},l.prototype.onFileClicked=function(e){this.selectedFile=e},l.prototype.RenameDocument=function(e){var t=this;if(e){var i=prompt("Enter the new name for the file",e.title);if(null!==i){64<i.length&&(i=i.substr(0,64)),this.isLoading=!0;var n={relativeS3Path:e.relativeS3Path,action:"rename",newTitle:i,sourceFolderPath:this.getSelectedDirectoryPath(),destinationFolderPath:""};this.$http.put("/api/ManageDocuments/RenameFile",n).then(function(){t.docsHttpCache.removeAll(),t.Refresh()},function(e){t.isLoading=!1,alert("Failed to rename: "+e.data.exceptionMessage),t.Refresh()})}}},l.prototype.DeleteDocument=function(e){var t=this;confirm("Are you sure you want to delete this file?")&&(this.isLoading=!0,this.$http.delete("/api/ManageDocuments?docPath="+e.relativeS3Path).then(function(){t.docsHttpCache.removeAll(),t.Refresh()},function(e){t.isLoading=!1,alert("Failed to delete file: "+e.data.exceptionMessage),t.Refresh()}))},l.prototype.RenameSelectedDirectory=function(){var t=this;if(this.selectedDirectory){var e=prompt("Enter the new name for the directory",this.selectedDirectory.name);if(null!==e){32<e.length&&(e=e.substr(0,32)),this.isLoading=!0;var i=encodeURIComponent(this.getSelectedDirectoryPath()),n=encodeURIComponent(e);this.$http.put("/api/ManageDocuments/RenameDirectory?directoryPath="+i+"&newDirectoryName="+n,null).then(function(){t.docsHttpCache.removeAll(),t.selectedDirectory.name=e,t.Refresh()},function(e){t.isLoading=!1,alert("Failed to rename directory: "+e.data.exceptionMessage)})}}},l.prototype.DeleteSelectedDirectory=function(){var t=this;if(this.selectedDirectory)if(0<this.selectedDirectory.files.length)alert("You can not delete a folder that contains files. Please delete or move all files from the folder.");else if(confirm("Are you sure you want to delete this folder?")){this.isLoading=!0;var e=this.getSelectedDirectoryPath();this.$http.delete("/api/ManageDocuments/DeleteDirectory?directoryPath="+encodeURIComponent(e)).then(function(){t.docsHttpCache.removeAll(),t.Refresh()},function(e){t.isLoading=!1,alert("Failed to delete the folder: "+e.data.exceptionMessage)})}},l.prototype.getFileIcon=function(e){if(!e)return"";var t=null;switch(e.split(".").pop().toLowerCase()){case"pdf":t="PdfIcon.png";break;case"doc":case"docx":t="WordIcon.png";break;case"xls":case"xlsx":t="ExcelIcon.png";break;case"ppt":case"pptx":t="PptxIcon.png";break;case"jpeg":case"jpe":case"jpg":case"png":case"bmp":t="ImageIcon.png";break;case"zip":t="ZipIcon.png";break;case"txt":t="TxtIcon.png";break;case"mp4":t="Mp4Icon.png";break;default:t="GenericFileIcon.png"}return"/assets/images/FileIcons/"+t},l.prototype.isGenericIcon=function(e){return"/assets/images/FileIcons/GenericFileIcon.png"===this.getFileIcon(e.fileName)},l.prototype.getDisplayExtension=function(e){return"."+e.fileName.split(".").pop().toLowerCase()},l.prototype.hookupParentDirs=function(t){var i=this;t.fullDirectoryPath=this.getDirectoryFullPath(t),t.getSubDirectoryByName=s.prototype.getSubDirectoryByName,t.subdirectories&&t.subdirectories.forEach(function(e){e.parentDirectory=t,e.directoryDepth=t.directoryDepth+1,i.hookupParentDirs(e)})},l.prototype.Refresh=function(){var t=this,o=null;this.selectedDirectory?o=this.getSelectedDirectoryPath():HtmlUtil.isNullOrWhitespace(this.$location.search().directory)||(o=this.committee?l.DirName_Committees+"/"+this.committee.committeeId+"/"+this.$location.search().directory:this.$location.search().directory),this.isLoading=!0,this.selectedDirectory=null,this.selectedFile=null,this.getDocsUri="/api/ManageDocuments",this.committee&&(this.getDocsUri+="/Committee/"+this.committee.committeeId),this.$http.get(this.getDocsUri,{cache:this.docsHttpCache}).then(function(e){t.isLoading=!1,t.documentTree=e.data,t.documentTree.getSubDirectoryByName=s.prototype.getSubDirectoryByName,t.documentTree.subdirectories.forEach(function(e){e.directoryDepth=0,t.hookupParentDirs(e)});var i=[],n=function(t){_.each(t.files,function(e){e.localFilePath=t.name+"/"+e.title,e.uploadDateString=moment(e.uploadDate).format("MMMM D, YYYY")}),Array.prototype.push.apply(i,t.files),_.each(t.subdirectories,n)};n(t.documentTree),t.fullSearchFileList=i,o&&(t.selectedDirectory=t.FindDirectoryByPath(o),t.SortFiles()),t.hookUpFileDragging()},function(e){t.isLoading=!1})},l.$inject=["$http","$rootScope","$cacheFactory","$scope","SiteInfo","fellowResidents","$location"],l.LocalStorageKey_SortType="DocsInfo_FileSortType",l.LocalStorageKey_SortDirection="DocsInfo_FileSortDirection",l.DirName_Committees="Committees_Root",l}();r.DocumentsController=i}(Ally||(Ally={})),CA.angularApp.component("documents",{bindings:{committee:"<"},templateUrl:"/ngApp/common/documents.html",controller:Ally.DocumentsController}),function(e){var s=function(){};e.InfoItem=s;var t=function(){function e(e,t,i,n,o){this.$http=e,this.$rootScope=t,this.siteInfo=i,this.$cacheFactory=n,this.fellowResidents=o,this.isBodyMissing=!1,this.canManage=!1,this.headerText="Information and Frequently Asked Questions (FAQs)",this.editingInfoItem=new s,"home"===AppConfig.appShortName&&(this.headerText="Home Notes")}return e.prototype.$onInit=function(){var t=this;this.hideDocuments=this.$rootScope.userInfo.isRenter&&!this.siteInfo.privateSiteInfo.rentersCanViewDocs,this.canManage=this.siteInfo.userInfo.isAdmin||this.siteInfo.userInfo.isSiteManager,this.committee&&!this.canManage&&this.fellowResidents.isCommitteeMember(this.committee.committeeId,this.siteInfo.userInfo.userId).then(function(e){return t.canManage=e}),this.faqsHttpCache=this.$cacheFactory.get("faqs-http-cache")||this.$cacheFactory("faqs-http-cache"),this.retrieveInfo(),window.setTimeout(function(){i.initToolbarBootstrapBindings(),$("#editor").wysiwyg({fileUploadError:i.showFileUploadAlert})},10)},e.prototype.retrieveInfo=function(){var t=this;this.isLoadingInfo=!0,this.getUri||(this.getUri="/api/InfoItem",this.committee&&(this.getUri="/api/InfoItem/Committee/"+this.committee.committeeId)),this.$http.get(this.getUri,{cache:this.faqsHttpCache}).then(function(e){t.isLoadingInfo=!1,t.infoItems=e.data,setTimeout(function(){for(var e=0;e<t.infoItems.length;++e)i.makeLinksOpenNewTab("info-item-body-"+e)},500)})},e.prototype.scrollToInfo=function(e){document.getElementById("info-item-title-"+e).scrollIntoView()},e.prototype.onStartEditInfoItem=function(e){this.editingInfoItem=jQuery.extend({},e),$("#editor").html(this.editingInfoItem.body),window.scrollTo(0,document.body.scrollHeight)},e.prototype.onSubmitItem=function(){var e=this;this.editingInfoItem.body=$("#editor").html(),this.isBodyMissing=HtmlUtil.isNullOrWhitespace(this.editingInfoItem.body);var t=$("#info-item-edit-form");if(t.validate(),t.valid()&&!this.isBodyMissing){this.committee&&(this.editingInfoItem.committeeId=this.committee.committeeId),this.isLoadingInfo=!0;var i=function(){e.isLoadingInfo=!1,$("#editor").html(""),e.editingInfoItem=new s,e.faqsHttpCache.removeAll(),e.retrieveInfo()};"number"==typeof this.editingInfoItem.infoItemId?this.$http.put("/api/InfoItem",this.editingInfoItem).then(i):this.$http.post("/api/InfoItem",this.editingInfoItem).then(i)}},e.prototype.onDeleteInfoItem=function(e){var t=this;confirm("Are you sure you want to delete this information?")&&(this.isLoadingInfo=!0,this.$http.delete("/api/InfoItem/"+e.infoItemId).then(function(){t.isLoadingInfo=!1,t.faqsHttpCache.removeAll(),t.retrieveInfo()}))},e.$inject=["$http","$rootScope","SiteInfo","$cacheFactory","fellowResidents"],e}();e.FAQsController=t;var i=function(){function e(){}return e.initToolbarBootstrapBindings=function(){var i=$("[title=Font]").siblings(".dropdown-menu");if($.each(["Serif","Sans","Arial","Arial Black","Courier","Courier New","Comic Sans MS","Helvetica","Impact","Lucida Grande","Lucida Sans","Tahoma","Times","Times New Roman","Verdana"],function(e,t){i.append($('<li><a data-edit="fontName '+t+'" style="font-family:\''+t+"'\">"+t+"</a></li>"))}),$("a[title]").tooltip({container:"body"}),$(".dropdown-menu input").click(function(){return!1}).change(function(){$(this).parent(".dropdown-menu").siblings(".dropdown-toggle").dropdown("toggle")}).keydown("esc",function(){this.value="",$(this).change()}),$("[data-role=magic-overlay]").each(function(){var e=$(this),t=$(e.data("target"));e.css("opacity",0).css("position","absolute").offset(t.offset()).width(t.outerWidth()).height(t.outerHeight())}),"onwebkitspeechchange"in document.createElement("input")){var e=$("#editor").offset();$("#voiceBtn").css("position","absolute").offset({top:e.top,left:e.left+$("#editor").innerWidth()-35})}else $("#voiceBtn").hide()},e.showFileUploadAlert=function(e,t){var i="";"unsupported-file-type"===e?i="Unsupported format "+t:console.log("error uploading file",e,t),$('<div class="alert"> <button type="button" class="close" data-dismiss="alert">&times;</button><strong>File upload error</strong> '+i+" </div>").prependTo("#alerts")},e.makeLinksOpenNewTab=function(e){window.setTimeout(function(){$("a","#"+e).each(function(e,t){t.href&&("#"===t.href[0]||-1<t.href.indexOf(AppConfig.baseTld))||$(t).attr("target","_blank")})},100)},e}();e.RichTextHelper=i}(Ally||(Ally={})),CA.angularApp.component("faqs",{bindings:{committee:"<?"},templateUrl:"/ngApp/common/FAQs.html",controller:Ally.FAQsController}),function(i){var e=function(){function e(e,t,i,n,o){this.$http=e,this.siteInfo=t,this.$timeout=i,this.$rootScope=n,this.uiGridConstants=o,this.shouldShowModal=!1,this.isLoading=!1,this.HistoryPageSize=50}return e.prototype.$onInit=function(){this.homeName=AppConfig.homeName||"Unit",this.transactionGridOptions={columnDefs:[{field:"transactionDate",displayName:"Date",width:70,type:"date",cellFilter:"date:'shortDate'",enableFiltering:!1},{field:"description",displayName:"Description",enableFiltering:!0,filter:{placeholder:"search"}},{field:"categoryDisplayName",editModelField:"financialCategoryId",displayName:"Category",width:170,editDropdownOptionsArray:[],enableFiltering:!0},{field:"unitGridLabel",editModelField:"associatedUnitId",displayName:this.homeName,width:120,enableFiltering:!0},{field:"amount",displayName:"Amount",width:120,type:"number",cellFilter:"currency",enableFiltering:!0,aggregationType:this.uiGridConstants.aggregationTypes.sum,footerCellTemplate:'<div class="ui-grid-cell-contents" >Total: {{col.getAggregationValue() | currency }}</div>'}],enableFiltering:!0,enableSorting:!0,showColumnFooter:!0,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableVerticalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableColumnMenus:!1,enablePaginationControls:!0,paginationPageSize:this.HistoryPageSize,paginationPageSizes:[this.HistoryPageSize],enableRowHeaderSelection:!1}},e.prototype.showModal=function(){this.shouldShowModal=!0,this.refreshEntries()},e.prototype.refreshEntries=function(){var n=this;this.isLoading=!0,this.$http.get("/api/OwnerLedger/MyTransactions").then(function(e){n.isLoading=!1,n.transactionGridOptions.data=e.data;var t=n.transactionGridOptions.data.map(function(e){return e.associatedUnitId}).filter(function(e,t,i){return i.indexOf(e)===t}),i=n.transactionGridOptions.columnDefs.find(function(e){return"unitGridLabel"===e.field});i&&(i.visible=1<t.length),n.transactionGridOptions.data.length<=n.HistoryPageSize&&(n.transactionGridOptions.enablePagination=!1,n.transactionGridOptions.enablePaginationControls=!1)},function(){n.isLoading=!1})},e.prototype.exportTransactionsCsv=function(){var e=[{headerText:"Date",fieldName:"transactionDate",dataMapper:function(e){return e?moment(e).format("YYYY-MM-DD"):""}},{headerText:"Description",fieldName:"description"},{headerText:"Category",fieldName:"categoryDisplayName"},{headerText:AppConfig.homeName,fieldName:"unitGridLabel"},{headerText:"Amount",fieldName:"amount"}],t=i.createCsvString(this.transactionGridOptions.data,e);i.HtmlUtil2.downloadCsv(t,"Owner-Transactions.csv")},e.$inject=["$http","SiteInfo","$timeout","$rootScope","uiGridConstants"],e}();i.ResidentTransactionsController=e}(Ally||(Ally={})),CA.angularApp.component("residentTransactions",{templateUrl:"/ngApp/common/financial/resident-transactions.html",controller:Ally.ResidentTransactionsController}),function(e){var t=function(){function e(e){this.$routeParams=e}return e.prototype.$onInit=function(){for(var e=(this.$routeParams.appName||"").toLowerCase(),t=[CondoAllyAppConfig,HomeAppConfig,HOAAppConfig,NeighborhoodAppConfig,BlockClubAppConfig],i=null,n=0;n<t.length;++n)if(t[n].appShortName.toLowerCase()===e){i=t[n].baseTld;break}i||(i="condoally.com"),i="myhoaally.org";var o="https://"+this.$routeParams.shortName+"."+i+"/";window.location.href=o},e.$inject=["$routeParams"],e}();e.GroupRedirectController=t}(Ally||(Ally={})),CA.angularApp.component("groupRedirect",{templateUrl:"/ngApp/common/group-redirect.html",controller:Ally.GroupRedirectController}),function(e){var n=function(){this.recipientType="board"},t=function(){function e(e,t,i,n,o){this.$http=e,this.fellowResidents=t,this.$rootScope=i,this.siteInfo=n,this.$scope=o,this.isLoadingEmail=!1,this.defaultMessageRecipient="board",this.showDiscussionEveryoneWarning=!1,this.showDiscussionLargeWarning=!1,this.showUseDiscussSuggestion=!1,this.showSendConfirmation=!1,this.showEmailForbidden=!1,this.showRestrictedGroupWarning=!1,this.defaultSubject="A message from your neighbor",this.memberLabel="resident",this.memberPageName="Residents",this.shouldShowSendAsBoard=!1}return e.prototype.$onInit=function(){var i=this;this.groupEmailDomain="inmail."+AppConfig.baseTld,this.messageObject=new n,this.showSendEmail=!0,this.committee?(this.messageObject.committeeId=this.committee.committeeId,this.defaultSubject="A message from a committee member"):(this.loadGroupEmails(),this.$scope.$on("prepAssessmentEmailToBoard",function(e,t){return i.prepBadAssessmentEmailForBoard(t)}),"pta"===AppConfig.appShortName?(this.defaultSubject="A message from a PTA member",this.memberLabel="member",this.memberPageName="Members"):this.defaultSubject="A message from your neighbor"),this.messageObject.subject=this.defaultSubject},e.prototype.loadGroupEmails=function(){this.isLoadingEmail=!0;var t=this;this.fellowResidents.getGroupEmailObject().then(function(e){t.isLoadingEmail=!1,t.availableEmailGroups=e.filter(function(e){return"Treasurer"!==e.recipientType}),0<t.availableEmailGroups.length&&(t.defaultMessageRecipient=t.availableEmailGroups[0].recipientType,t.messageObject.recipientType=t.defaultMessageRecipient,t.onSelectEmailGroup())})},e.prototype.prepBadAssessmentEmailForBoard=function(e){var t=e.split("|"),i=t[0],n=null;1<t.length&&(n=t[1]),this.messageObject.recipientType="board",this.messageObject.subject="Question About Assessment Amount",this.messageObject.message=n?"Hello Boardmembers,\n\nOur association's home page says my next payment of $"+i+" will cover "+n+", but I believe that is incorrect. My records indicate my next payment of $"+i+" should pay for [INSERT PROPER DATE HERE]. What do you need from me to resolve the issue?\n\n- "+this.siteInfo.userInfo.firstName:"Hello Boardmembers,\n\nOur association's home page says my assessment payment is $"+i+", but I believe that is incorrect. My records indicate my assessment payments should be $[INSERT PROPER AMOUNT HERE]. What do you need from me to resolve the issue?\n\n- "+this.siteInfo.userInfo.firstName,document.getElementById("send-email-panel").scrollIntoView()},e.prototype.onSendEmail=function(){var t=this;$("#message-form").validate(),$("#message-form").valid()&&(this.isLoadingEmail=!0,this.$rootScope.dontHandle403=!0,analytics.track("sendEmail",{recipientId:this.messageObject.recipientType}),this.$http.post("/api/Email/v2",this.messageObject).then(function(){t.$rootScope.dontHandle403=!1,t.isLoadingEmail=!1,t.messageObject=new n,t.messageObject.recipientType=t.defaultMessageRecipient,t.messageObject.subject=t.defaultSubject,t.committee&&(t.messageObject.committeeId=t.committee.committeeId),t.showSendConfirmation=!0,t.showSendEmail=!1},function(e){t.isLoadingEmail=!1,t.$rootScope.dontHandle403=!1,403===e.status?t.showEmailForbidden=!0:alert("Unable to send e-mail: "+e.data.exceptionMessage)}))},e.prototype.onSelectEmailGroup=function(){var t=this,e=HtmlUtil.getSubdomain(window.location.host).toLowerCase();this.groupEmailAddress=this.messageObject.recipientType+"."+e+"@inmail."+AppConfig.baseTld,this.showDiscussionEveryoneWarning=!1;var i=-1!==this.messageObject.recipientType.toLowerCase().indexOf("owners");!this.showDiscussionEveryoneWarning&&i&&30<this.siteInfo.privateSiteInfo.numUnits?this.showDiscussionLargeWarning=!0:this.showDiscussionLargeWarning=!1;var n=-1!==this.messageObject.recipientType.toLowerCase().indexOf("discussion"),o=-1!==this.messageObject.recipientType.toLowerCase().indexOf("board"),s=-1!==this.messageObject.recipientType.toLowerCase().indexOf("propertymanagers");this.showDiscussionEveryoneWarning=!1,this.showDiscussionLargeWarning=!1,this.showUseDiscussSuggestion=!n&&!o&&!s&&AppConfig.isChtnSite;var a=_.find(this.availableEmailGroups,function(e){return e.recipientType===t.messageObject.recipientType});this.showRestrictedGroupWarning=a.isRestrictedGroup,this.shouldShowSendAsBoard=this.siteInfo.userInfo.isSiteManager&&!o},e.$inject=["$http","fellowResidents","$rootScope","SiteInfo","$scope"],e}();e.GroupSendEmailController=t}(Ally||(Ally={})),CA.angularApp.component("groupSendEmail",{bindings:{committee:"<?"},templateUrl:"/ngApp/common/group-send-email.html",controller:Ally.GroupSendEmailController}),function(e){var t=function(){function e(e,t,i){this.$http=e,this.siteInfo=t,this.$timeout=i,this.isLoading=!1}return e.prototype.$onInit=function(){this.isLoading=!0;var e=this;this.$timeout(function(){return e.loadNewsStories()},200)},e.prototype.loadNewsStories=function(){var e,t;HtmlUtil.getSubdomain(window.location.host);this.isLoading=!0,t="US"===this.siteInfo.privateSiteInfo.country?(e="https://localnewsally.azurewebsites.net/api/LocalNews",{clientId:"1001A194-B686-4C45-80BC-ECC0BB4916B4",chicagoWard:this.siteInfo.privateSiteInfo.chicagoWard,zipCode:this.siteInfo.privateSiteInfo.zipCode,cityNeighborhood:this.siteInfo.privateSiteInfo.localNewsNeighborhoodQuery,city:this.siteInfo.privateSiteInfo.groupAddress.city,state2Char:this.siteInfo.privateSiteInfo.groupAddress.state}):(e="https://localnewsally.azurewebsites.net/api/LocalNews/International/MajorCity",{clientId:"1001A194-B686-4C45-80BC-ECC0BB4916B4",countryCode:this.siteInfo.privateSiteInfo.country,city:this.siteInfo.privateSiteInfo.groupAddress.city});var i=this;this.$http.get(e,{cache:!0,params:t}).then(function(e){i.isLoading=!1,i.localNewStories=e.data})},e.$inject=["$http","SiteInfo","$timeout"],e}();e.LocalNewsFeedController=t}(Ally||(Ally={})),CA.angularApp.component("localNewsFeed",{templateUrl:"/ngApp/common/local-news-feed.html",controller:Ally.LocalNewsFeedController});__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}}();function ServiceBankInfoCtrl(e){}function ServiceBusinessInfoCtrl(e){}function ServiceJobsCtrl(e){}!function(e){var t=function(){},i=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}__extends(t,e)}(t),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}__extends(t,e)}(t),function(){function e(e,t,i){var n=this;this.$http=e,this.siteInfo=t,this.$timeout=i,this.isLoading=!1,this.viewingResults=null,this.historyGridOptions={data:[],columnDefs:[{field:"sendDateUtc",displayName:"Sent",cellFilter:"date:'short'",type:"date"},{field:"numPaperLettersSent",displayName:"# Letters",type:"number",width:100},{field:"numEmailsSent",displayName:"# E-mails",type:"number",width:100},{field:"amountPaid",displayName:"Amount Paid",cellFilter:"currency",type:"number",width:110},{field:"sendingReason",displayName:"Reason",width:150},{field:"mailingResultObject",displayName:"",width:130,cellTemplate:'<div class="ui-grid-cell-contents"><span data-ng-click="grid.appScope.$ctrl.showMailingResults( row.entity )" class="text-link">View Results</span></div>'}],enableSorting:!0,enableHorizontalScrollbar:0,enableVerticalScrollbar:0,enableColumnMenus:!1,minRowsToShow:5,onRegisterApi:function(e){n.historyGridApi=e,HtmlUtil.uiGridFixScroll()}},this.resultsGridOptions={data:[],columnDefs:[{field:"mailingType",displayName:"Type",width:100},{field:"recipient",displayName:"Recipient",width:300,cellTemplate:'<div class="ui-grid-cell-contents"><span title="{{row.entity.recipient}}">{{ row.entity.recipientEmail || row.entity.recipientStreetAddress.oneLiner }}</span></div>'},{field:"didSuccessfullySend",displayName:"Successful",width:100,type:"boolean"},{field:"resultMessage",displayName:"Result Message",cellTemplate:'<div class="ui-grid-cell-contents"><span title="{{row.entity.resultMessage}}">{{row.entity.resultMessage}}</span></div>'}],enableSorting:!0,enableHorizontalScrollbar:0,enableVerticalScrollbar:0,enableColumnMenus:!1,minRowsToShow:5,onRegisterApi:function(e){HtmlUtil.uiGridFixScroll()}}}return e.prototype.$onInit=function(){this.refreshHistory()},e.prototype.showMailingResults=function(t){var i=this;this.$timeout(function(){_.forEach(t.mailingResultObject.emailResults,function(e){return e.mailingType="E-mail"}),_.forEach(t.mailingResultObject.paperMailResults,function(e){return e.mailingType="Paper Letter"});var e=[];e=e.concat(t.mailingResultObject.emailResults,t.mailingResultObject.paperMailResults),i.resultsGridOptions.data=e,i.resultsGridOptions.minRowsToShow=e.length,i.resultsGridOptions.virtualizationThreshold=e.length,i.resultsGridheight=(e.length+1)*i.resultsGridOptions.rowHeight,i.$timeout(function(){i.viewingResults=t.mailingResultObject},10)},0)},e.prototype.refreshHistory=function(){var t=this;this.isLoading=!0,this.$http.get("/api/Mailing/History").then(function(e){t.isLoading=!1,t.historyGridOptions.data=e.data,t.historyGridOptions.minRowsToShow=e.data.length,t.historyGridOptions.virtualizationThreshold=e.data.length},function(e){t.isLoading=!1,alert("Failed to load mailing history: "+e.data.exceptionMessage)})},e.$inject=["$http","SiteInfo","$timeout"],e}());e.MailingHistoryController=i}(Ally||(Ally={})),CA.angularApp.component("mailingHistory",{templateUrl:"/ngApp/common/mailing/mailing-history.html",controller:Ally.MailingHistoryController}),function(e){var t=function(){},i=function(){function e(e,t,i,n,o,s,a){var r=this;this.$http=e,this.siteInfo=t,this.fellowResidents=i,this.wizardHandler=n,this.$scope=o,this.$timeout=s,this.$location=a,this.isLoading=!1,this.selectedEntries=[],this.numEmailsToSend=0,this.numPaperLettersToSend=0,this.paperInvoiceDollars=2,this.isAdmin=!1,this.numInvalidMailingAddresses=0,this.numAddressesToBulkValidate=0;var l='<div class="ui-grid-cell-contents">$<input type="number" style="width: 90%;" data-ng-model="row.entity[col.field]" /></div>';this.homesGridOptions={data:[],columnDefs:[{field:"homeNames",displayName:AppConfig.homeName,width:210},{field:"ownerNames",displayName:"Owners"},{field:"amountDue",displayName:"Amount Due",width:120,cellTemplate:l},{field:"balanceForward",displayName:"Balance Forward",width:140,cellTemplate:l},{field:"lateFee",displayName:"Late Fee",width:120,cellTemplate:l},{field:"total",displayName:"Total",width:90,cellTemplate:'<div class="ui-grid-cell-contents">{{ row.entity.amountDue + (row.entity.balanceForward || 0) + (row.entity.lateFee || 0) | currency }}</div>'}],enableSorting:!0,enableHorizontalScrollbar:0,enableVerticalScrollbar:0,enableColumnMenus:!1,minRowsToShow:5,enableRowHeaderSelection:!0,multiSelect:!0,enableSelectAll:!0,onRegisterApi:function(t){r.gridApi=t;var i=function(){var e=t.selection.getSelectedRows();r.selectedEntries=e};t.selection.on.rowSelectionChanged(o,function(e){return i()}),t.selection.on.rowSelectionChangedBatch(o,function(e){return i()}),HtmlUtil.uiGridFixScroll()}}}return e.prototype.$onInit=function(){var n=this;this.authToken=this.siteInfo.authToken,this.isAdmin=this.siteInfo.userInfo.isAdmin,this.loadMailingInfo(),this.$scope.$on("wizard:stepChanged",function(e,t){n.activeStepIndex=t.index,1===n.activeStepIndex&&n.$timeout(function(){for(var e=0,t=n.selectedEntries;e<t.length;e++){var i=t[e];n.gridApi.selection.selectRow(i)}},250),2===n.activeStepIndex?window.setTimeout(function(){return document.getElementById("delivery-method-header").scrollIntoView(!0)},50):3===n.activeStepIndex&&(n.numEmailsToSend=_.filter(n.selectedEntries,function(e){return e.shouldSendEmail}).length,n.numPaperLettersToSend=_.filter(n.selectedEntries,function(e){return e.shouldSendPaperMail}).length)})},e.prototype.customizeNotes=function(e){e.overrideNotes=this.fullMailingInfo.notes||" "},e.prototype.uncustomizeNotes=function(e){e.overrideNotes=null},e.prototype.setAllDues=function(){var t=this;_.forEach(this.fullMailingInfo.mailingEntries,function(e){return e.amountDue=t.allDuesSetAmount})},e.prototype.getTotalDue=function(e){return e.amountDue-Math.abs(e.balanceForward||0)+(e.lateFee||0)},e.prototype.onShouldSendPaperMailChange=function(e){e.shouldSendPaperMail?this.testAddressRequiredFields(e):(e.isValidMailingAddress=e.validationMessage=null,this.numInvalidMailingAddresses=_.filter(this.selectedEntries,function(e){return!1===e.isValidMailingAddress}).length)},e.prototype.onAddressChanged=function(e){e.shouldSendPaperMail&&this.testAddressRequiredFields(e)},e.prototype.testAddressRequiredFields=function(t){var i=this;return t.isValidating=!0,t.isValidMailingAddress=null,t.validationMessage=null,this.$http.post("/api/Mailing/TestMailability",t.streetAddressObject).then(function(e){t.isValidating=!1,t.isValidMailingAddress=e.data.isValid,t.validationMessage=e.data.verificationMessage,i.numInvalidMailingAddresses=_.filter(i.selectedEntries,function(e){return!1===e.isValidMailingAddress}).length},function(e){t.isValidating=!1,t.isValidMailingAddress=!1,t.validatedAddress=null,t.validationMessage="Address validation failed: "+e.data.exceptionMessage})},e.prototype.validateAddress=function(t){t.isValidating=!0,t.isValidMailingAddress=null;var e="/api/Mailing/VerifyAddress?address="+encodeURIComponent(JSON.stringify(t.streetAddressObject));return this.$http.get(e).then(function(e){t.isValidating=!1,t.isValidMailingAddress=e.data.isValid,t.validationMessage=e.data.verificationMessage,t.isValidMailingAddress&&(t.validatedAddress=e.data.parsedStreetAddress.multiLiner)},function(e){t.isValidating=!1,t.isValidMailingAddress=!1,t.validatedAddress=null,t.validationMessage=e.data.exceptionMessage})},e.prototype.previewInvoice=function(n){var o=this,e=new t;e.invoiceTitleString=this.fullMailingInfo.invoiceTitleString,e.dueDateString=this.fullMailingInfo.dueDateString,e.duesLabel=this.fullMailingInfo.duesLabel,e.fromAddress=this.fullMailingInfo.fromStreetAddress,e.mailingInfo=n,e.notes=n.overrideNotes||this.fullMailingInfo.notes,this.isLoading=!0,n.wasPopUpBlocked=!1,this.$http.post("/api/Mailing/Preview/Invoice",e).then(function(e){o.isLoading=!1;var t=o.siteInfo.publicSiteInfo.baseApiUrl+"PublicMailing/Preview/Invoice/"+e.data.previewId,i=window.open(t,"_blank");n.wasPopUpBlocked=!i||i.closed||void 0===i.closed},function(e){o.isLoading=!1})},e.prototype.onFinishedWizard=function(){var t=this;if(0!==this.numPaperLettersToSend){var e=StripeCheckout.configure({key:StripeApiKey,image:"/assets/images/icons/Icon-144.png",locale:"auto",email:this.siteInfo.userInfo.emailAddress,token:function(e){t.fullMailingInfo.stripeToken=e.id,t.submitFullMailingAfterCharge()}});this.isLoading=!0,e.open({name:"Community Ally",description:"Mailing "+this.numPaperLettersToSend+" invoice"+(1===this.numPaperLettersToSend?"":"s"),zipCode:!0,amount:this.numPaperLettersToSend*this.paperInvoiceDollars*100}),window.addEventListener("popstate",function(){e.close()})}else 0===this.numEmailsToSend?alert("No e-mails or paper letters selected to send."):this.submitFullMailingAfterCharge()},e.prototype.submitFullMailingAfterCharge=function(){var i=this;this.isLoading=!0,this.$http.post("/api/Mailing/Send/Invoice",this.fullMailingInfo).then(function(e){i.isLoading=!1;var t="Your invoices have been successfully sent"+(e.data.hadErrors?", but there were errors":"")+". You can view the status in the history tab.";alert(t),i.$location.path("/Mailing/History")},function(e){i.isLoading=!1,alert("There was a problem sending your mailing, none were sent and you were not charged. Error: "+e.data.exceptionMessage)})},e.prototype.loadMailingInfo=function(){var t=this;this.isLoading=!0,this.$http.get("/api/Mailing/RecipientInfo").then(function(e){t.isLoading=!1,t.fullMailingInfo=e.data,t.homesGridOptions.data=e.data.mailingEntries,t.homesGridOptions.minRowsToShow=e.data.mailingEntries.length,t.homesGridOptions.virtualizationThreshold=e.data.mailingEntries.length,t.selectedEntries=_.clone(e.data.mailingEntries)})},e.prototype.scrollToFirstAddressError=function(){var e=_.find(this.selectedEntries,function(e){return!1===e.isValidMailingAddress});if(e){var t=_.indexOf(this.selectedEntries,e);if(-1!==t)document.getElementById("recipient-entry-"+t).scrollIntoView()}},e.prototype.toggleAllSending=function(e){var t=this;if(0!==this.selectedEntries.length)if("email"===e)for(var i=!this.selectedEntries[0].shouldSendEmail,n=0;n<this.selectedEntries.length;++n)HtmlUtil.isNullOrWhitespace(this.selectedEntries[n].emailAddresses)||!this.selectedEntries[n].amountDue?this.selectedEntries[n].shouldSendEmail=!1:this.selectedEntries[n].shouldSendEmail=i;else{for(i=!this.selectedEntries[0].shouldSendPaperMail,n=0;n<this.selectedEntries.length;++n)this.selectedEntries[n].streetAddressObject&&this.selectedEntries[n].amountDue?this.selectedEntries[n].shouldSendPaperMail=i:this.selectedEntries[n].shouldSendPaperMail=!1;if(i){if(i&&0<this.selectedEntries.length){var o=_.clone(this.selectedEntries);this.numAddressesToBulkValidate=o.length;var s=function(){t.testAddressRequiredFields(o[0]).then(function(){for(o.splice(0,1);0<o.length&&!o[0].amountDue;)o.splice(0,1);t.numAddressesToBulkValidate=o.length,0<o.length&&s()})};s()}}else _.each(this.selectedEntries,function(e){return e.isValidMailingAddress=e.validationMessage=null}),this.numInvalidMailingAddresses=0}},e.$inject=["$http","SiteInfo","fellowResidents","WizardHandler","$scope","$timeout","$location"],e}();e.MailingInvoiceController=i}(Ally||(Ally={})),CA.angularApp.component("mailingInvoice",{templateUrl:"/ngApp/common/mailing/mailing-invoice.html",controller:Ally.MailingInvoiceController}),function(e){var t=function(){function e(e,t,i,n,o){this.$http=e,this.siteInfo=t,this.$routeParams=i,this.$cacheFactory=n,this.$rootScope=o,this.selectedView=null,this.selectedView=this.$routeParams.viewName||"Invoice"}return e.prototype.$onInit=function(){},e.$inject=["$http","SiteInfo","$routeParams","$cacheFactory","$rootScope"],e}();e.MailingParentController=t}(Ally||(Ally={})),CA.angularApp.component("mailingParent",{templateUrl:"/ngApp/common/mailing/mailing-parent.html",controller:Ally.MailingParentController}),function(n){var t=function(){};n.MaintenanceProject=t;var o=function(){},e=function(){};n.VendorListItem=e;var i=function(){function s(e,t,i,n,o){this.$http=e,this.$rootScope=t,this.siteInfo=i,this.maintenanceService=n,this.fellowResidents=o,this.isSiteManager=!1,this.shouldShowEditEquipmentModal=!1,this.shouldShowManageEquipmentModal=!1,this.maintenanceEntries=[],this.assigneeOptions=[],this.entriesSortAscending=!0,this.equipmentTypeOptions=_.map(s.AutocompleteEquipmentTypeOptions,function(e){return e.text}),this.equipmentLocationOptions=_.map(s.AutocompleteLocationOptions,function(e){return e.text}),this.maintenanceTodoListId=i.privateSiteInfo.maintenanceTodoListId}return s.prototype.$onInit=function(){var t=this;this.equipmentGridOptions={data:[],columnDefs:[{field:"name",displayName:"Name",cellTemplate:'<div class="ui-grid-cell-contents"><span class="text-link" data-ng-if="grid.appScope.$ctrl.isSiteManager" data-ng-click="grid.appScope.$ctrl.editEquipment( row.entity )">{{ row.entity.name }}</span><span data-ng-if="!grid.appScope.$ctrl.isSiteManager">{{ row.entity.name }}</span></div>'},{field:"type",displayName:"Type",width:150},{field:"installDate",displayName:"Installed",width:90,cellFilter:"date:'shortDate'",type:"date"},{field:"initialCost",displayName:"Cost",width:90,cellFilter:"currency",type:"number"},{field:"addedDateUtc",displayName:"Added",width:90,cellFilter:"date:'shortDate'",type:"date"}],multiSelect:!1,enableSorting:!0,enableHorizontalScrollbar:0,enableVerticalScrollbar:1,enableFullRowSelection:!1,enableColumnMenus:!1,enableRowHeaderSelection:!1,onRegisterApi:function(e){HtmlUtil.uiGridFixScroll()}},this.isSiteManager=this.siteInfo.userInfo.isSiteManager,this.fellowResidents.getResidents().then(function(e){return t.assigneeOptions=_.clone(e)}),this.entriesSortField=window.localStorage[s.StorageKey_SortField],this.entriesSortField?this.entriesSortAscending="true"===window.localStorage[s.StorageKey_SortDir]:(this.entriesSortField="entryDate",this.entriesSortAscending=!0),this.loadEquipment().then(function(){return t.loadVendors()}).then(function(){return t.loadProjects()}).then(function(){return t.loadMaintenanceTodos()}).then(function(){return t.rebuildMaintenanceEntries()})},s.prototype.rebuildMaintenanceEntries=function(){var i=this;this.maintenanceEntries=[],_.forEach(this.projects,function(e){var t=new n.MaintenanceEntry;t.project=e,i.maintenanceEntries.push(t)}),_.forEach(this.maintenanceTodos.todoItems,function(e){var t=new n.MaintenanceEntry;t.todo=e,i.maintenanceEntries.push(t)}),this.sortEntries()},s.prototype.loadEquipment=function(){var i=this;return this.isLoading=!0,this.$http.get("/api/Maintenance/Equipment").then(function(e){i.isLoading=!1,i.equipmentOptions=e.data,i.equipmentGridOptions.data=JSON.parse(JSON.stringify(i.equipmentOptions));var t=new o;t.name="Add New...",t.equipmentId=s.EquipmentId_AddNew,i.equipmentOptions.push(t),_.forEach(i.equipmentOptions,function(e){e.typeTags=[{text:e.type}],e.locationTags=[{text:e.location}]}),i.editingProject&&i.editingProject.equipmentId===s.EquipmentId_AddNew&&0<i.equipmentOptions.length&&(i.editingProject.equipmentId=_.max(i.equipmentOptions,function(e){return e.equipmentId}).equipmentId)},function(e){i.isLoading=!1,alert("Failed to retrieve equipment: "+e.data.exceptionMessage)})},s.prototype.deleteEquipment=function(){var t=this;confirm("Are you sure you want to delete this equipment? This action cannot be undone.")&&(this.isLoading=!0,this.$http.delete("/api/Maintenance/Equipment/"+this.editingEquipment.equipmentId).then(function(){t.isLoading=!1,t.editingEquipment=null,t.shouldShowEditEquipmentModal=!1,t.loadEquipment().then(function(){return t.loadProjects()}).then(function(){return t.rebuildMaintenanceEntries()})},function(e){t.isLoading=!1,alert("Failed to delete the equipment: "+e.data.exceptionMessage)}))},s.prototype.loadVendors=function(){var t=this;return this.isLoading=!0,this.$http.get("/api/PreferredVendors/ListItems").then(function(e){t.isLoading=!1,t.vendorOptions=e.data},function(e){t.isLoading=!1,alert("Failed to retrieve vendors: "+e.data.exceptionMessage)})},s.prototype.onEquipmentSelectionChange=function(){this.editingProject.equipmentId===s.EquipmentId_AddNew&&this.openAddNewEquipment()},s.prototype.loadProjects=function(){var t=this;return this.isLoading=!0,this.maintenanceService.loadProjects().then(function(e){t.isLoading=!1,t.projects=e},function(e){t.isLoading=!1,alert("Failed to retrieve projects: "+e.exceptionMessage)})},s.prototype.loadMaintenanceTodos=function(){var t=this;return this.isLoading=!0,this.$http.get("/api/Todo/MaintenanceList").then(function(e){t.isLoading=!1,t.maintenanceTodos=e.data})},s.prototype.onProjectStartDateChange=function(){this.editingProject.endDate||(this.editingProject.endDate=this.editingProject.startDate)},s.prototype.openAddNewProject=function(){this.editingProject=new t,setTimeout(function(){return $("#project-title-text-box").focus()},100)},s.prototype.openAddNewEquipment=function(){this.shouldShowEditEquipmentModal=!0,this.editingEquipment=new o,setTimeout(function(){return $("#equipment-name-text-box").focus()},100)},s.prototype.saveProject=function(){var t=this;this.isLoading=!0,(this.editingProject.maintenanceProjectId?this.$http.put:this.$http.post)("/api/Maintenance/Project",this.editingProject).then(function(){t.isLoading=!1,t.editingProject=null,t.loadProjects().then(function(){return t.rebuildMaintenanceEntries()})},function(e){t.isLoading=!1,alert("Failed to save: "+e.data.exceptionMessage)})},s.prototype.onEntryTypeChange=function(e){"todo"===e?(this.editingTodo=new n.TodoItem,this.editingTodo.owningTodoListId=this.maintenanceTodoListId,this.selectedAssignee=[],this.editingProject&&(this.editingTodo.description=this.editingProject.title),this.editingProject=null,setTimeout(function(){return $("#edit-todo-name-text-box").focus()},50)):(this.editingProject=new t,this.editingTodo&&(this.editingProject.title=this.editingTodo.description),this.editingTodo=null,setTimeout(function(){return $("#project-title-text-box").focus()},50))},s.prototype.saveTodo=function(){var t=this;this.isLoading=!0,this.selectedAssignee&&0<this.selectedAssignee.length&&(this.editingTodo.assignedToUserId=this.selectedAssignee[0].userId),(this.editingTodo.todoItemId?this.$http.put:this.$http.post)("/api/Todo/Item",this.editingTodo).then(function(){t.isLoading=!1,t.editingTodo=null,t.selectedAssignee=[],t.loadMaintenanceTodos().then(function(){return t.rebuildMaintenanceEntries()})},function(e){t.isLoading=!1,alert("Failed to save: "+e.data.exceptionMessage)})},s.prototype.saveEquipment=function(){var t=this;this.isLoading=!0,this.editingEquipment.locationTags&&0<this.editingEquipment.locationTags.length?this.editingEquipment.location=this.editingEquipment.locationTags[0].text:this.editingEquipment.location=void 0,(this.editingEquipment.equipmentId?this.$http.put:this.$http.post)("/api/Maintenance/Equipment",this.editingEquipment).then(function(){t.isLoading=!1,t.shouldShowEditEquipmentModal=!1,t.loadEquipment()},function(e){t.isLoading=!1,alert("Failed to save: "+e.data.exceptionMessage)})},s.prototype.getEquipmentLocationAutocomplete=function(t){return HtmlUtil.isNullOrWhitespace(t)?s.AutocompleteLocationOptions:_.where(s.AutocompleteLocationOptions,function(e){return-1!==e.text.toLowerCase().indexOf(t.toLowerCase())})},s.prototype.getEquipmentTypeAutocomplete=function(t){return this.editingEquipment.typeTags&&0<this.editingEquipment.typeTags.length&&!HtmlUtil.isNullOrWhitespace(this.editingEquipment.typeTags[0].text)?[]:HtmlUtil.isNullOrWhitespace(t)?s.AutocompleteEquipmentTypeOptions:_.where(s.AutocompleteEquipmentTypeOptions,function(e){return-1!==e.text.toLowerCase().indexOf(t.toLowerCase())})},s.prototype.editEquipment=function(e){this.shouldShowEditEquipmentModal=!0,this.editingEquipment=_.clone(e),setTimeout(function(){return $("#equipment-name-text-box").focus()},100)},s.prototype.onEditEntry=function(e){var t=this;if(e.project)this.editProject(e.project);else{this.editingTodo=_.clone(e.todo);for(var i=0;i<this.assigneeOptions.length;++i)this.assigneeOptions[i].isSelectedAssignee=!1;var n=_.find(this.assigneeOptions,function(e){return e.userId===t.editingTodo.assignedToUserId});n?(n.isSelectedAssignee=!0,this.selectedAssignee=[n]):this.selectedAssignee=[],setTimeout(function(){return $("#edit-todo-name-text-box").focus()},100)}},s.prototype.onDeleteEntry=function(e){var t=this;confirm("Are you sure you want to delete this entry? This action cannot be undone.")&&(e.project?this.onDeleteProject(e.project):(this.isLoading=!0,this.$http.delete("/api/Todo/Item/"+e.todo.todoItemId).then(function(){t.isLoading=!1,t.loadMaintenanceTodos().then(function(){return t.rebuildMaintenanceEntries()})},function(e){t.isLoading=!1,alert("Failed to delete to-do: "+e.data.exceptionMessage)})))},s.prototype.editProject=function(e){this.editingProject=_.clone(e),setTimeout(function(){return $("#project-title-text-box").focus()},100)},s.prototype.onDeleteProject=function(e){var t=this;this.isLoading=!0,this.$http.delete("/api/Maintenance/Project/"+e.maintenanceProjectId).then(function(){t.isLoading=!1,t.loadProjects().then(function(){return t.rebuildMaintenanceEntries()})},function(e){t.isLoading=!1,alert("Failed to delete: "+e.data.exceptionMessage)})},s.prototype.exportMaintenanceCsv=function(){"undefined"!=typeof analytics&&analytics.track("exportMaintenanceCsv");var e=[{headerText:"Title",fieldName:"title"},{headerText:"Start Date",fieldName:"startDate",dataMapper:function(e){return e?moment(e).format("YYYY-MM-DD"):""}},{headerText:"End Date",fieldName:"endDate",dataMapper:function(e){return e?moment(e).format("YYYY-MM-DD"):""}},{headerText:"Description",fieldName:"descriptionText"},{headerText:"Cost",fieldName:"cost"},{headerText:"Vendor",fieldName:"vendorCompanyName"},{headerText:"Related Equipment",fieldName:"equipmentName"},{headerText:"Entered By",fieldName:"creatorFullName"},{headerText:"Status",fieldName:"status"},{headerText:"Assigned To",fieldName:"assignedTo"}],t=_.map(_.filter(this.maintenanceEntries,function(e){return!!e.project}),function(e){return e.project}),i=n.createCsvString(t,e);n.HtmlUtil2.downloadCsv(i,"Maintenance.csv")},s.prototype.sortEntries=function(){var t=this;console.log("Sort by "+this.entriesSortField+", dir "+this.entriesSortAscending),this.maintenanceEntries=_.sortBy(this.maintenanceEntries,function(e){return"status"===t.entriesSortField?e.project?e.project.status:"ZZZZZ":"startDate"===t.entriesSortField?e.project?e.project.startDate:new Date(1001,12,30):e.getCreatedDate()}),("status"===this.entriesSortField?this.entriesSortAscending:!this.entriesSortAscending)&&this.maintenanceEntries.reverse()},s.prototype.updateEntriesSort=function(e){e||(e="entryDate"),this.entriesSortField===e?this.entriesSortAscending=!this.entriesSortAscending:(this.entriesSortField=e,this.entriesSortAscending=!1),window.localStorage[s.StorageKey_SortField]=this.entriesSortField,window.localStorage[s.StorageKey_SortDir]=this.entriesSortAscending,this.sortEntries()},s.$inject=["$http","$rootScope","SiteInfo","maintenance","fellowResidents"],s.StorageKey_SortField="maintenance_entriesSortField",s.StorageKey_SortDir="maintenance_entriesSortAscending",s.EquipmentId_AddNew=-5,s.AutocompleteLocationOptions=[{text:"Attic"},{text:"Back Yard"},{text:"Basement"},{text:"Front Yard"},{text:"Inside"},{text:"Kitchen"},{text:"Outside"},{text:"Side of Building"},{text:"Structural"}],s.AutocompleteEquipmentTypeOptions=[{text:"Appliance"},{text:"Deck"},{text:"Driveway"},{text:"HVAC"},{text:"Patio"},{text:"Plumbing"},{text:"Roof"},{text:"Siding"},{text:"Structural"}],s}();n.MaintenanceController=i}(Ally||(Ally={})),CA.angularApp.component("maintenance",{bindings:{},templateUrl:"/ngApp/common/maintenance.html",controller:Ally.MaintenanceController}),function(e){var t=function(){function e(e,t,i){this.$http=e,this.$rootScope=t,this.siteInfo=i,this.isLoading=!1,this.upcomingWork=[],this.recentProjects=[]}return e.prototype.$onInit=function(){this.loadProjects()},e.prototype.loadProjects=function(){var t=this;return this.isLoading=!0,this.$http.get("/api/Maintenance/Projects").then(function(e){t.isLoading=!1,t.recentProjects=_.take(e.data,3)},function(e){t.isLoading=!1,alert("Failed to retrieve projects: "+e.data.exceptionMessage)})},e.$inject=["$http","$rootScope","SiteInfo"],e}();e.MaintenanceWidgetController=t}(Ally||(Ally={})),CA.angularApp.component("maintenanceWidget",{templateUrl:"/ngApp/common/maintenance-widget.html",controller:Ally.MaintenanceWidgetController}),function(e){var r=function(){};e.SplitAddress=r;var t=function(){};e.GpsPoint=t;var i=function(){};e.GpsPolygon=i;var n=function(){};e.FullAddress=n;var o=function(){function e(){}return e.parseAddressComponents=function(e){for(var t=new r,i="",n="",o=0,s=e;o<s.length;o++){var a=s[o];-1!==a.types.indexOf("street_number")?i=a.short_name:-1!==a.types.indexOf("route")?n=a.short_name:-1!==a.types.indexOf("locality")?t.city=a.short_name:-1!==a.types.indexOf("administrative_area_level_1")?t.state=a.short_name:-1!==a.types.indexOf("postal_code")?t.zip=a.short_name:-1!==a.types.indexOf("country")&&(t.country=a.short_name)}return t.street=i+" "+n,t},e.gpsBoundsToGooglePoly=function(e){return _.map(e.vertices,function(e){return new google.maps.LatLng(e.lat,e.lon)})},e}();e.MapUtil=o}(Ally||(Ally={})),function(e){var t=function(){function e(e,t,i){this.$http=e,this.siteInfo=t,this.$rootScope=i,this.isLoading=!1,this.returnUrl="https://localtest.mycondoally.com/#!/Home"}return e.prototype.$onInit=function(){var i=this;null!=this.siteInfo.userInfo.usersUnits&&0<this.siteInfo.userInfo.usersUnits.length?this.assessmentAmount=this.siteInfo.userInfo.usersUnits[0].assessment:this.assessmentAmount=0,this.errorPayInfoText="Is the amount incorrect?",this.paymentInfo={paymentType:"other",amount:this.assessmentAmount,note:"",fundingType:null,paysFor:null};if(this.recentPayments=this.siteInfo.userInfo.recentPayments,this.recentPayments&&0<this.recentPayments.length)for(6<this.recentPayments.length&&(this.recentPayments=this.recentPayments.slice(0,6));this.recentPayments.length<6;)this.recentPayments.push({});null!=this.siteInfo.privateSiteInfo.assessmentFrequency&&null!=this.siteInfo.userInfo.usersUnits&&0<this.siteInfo.userInfo.usersUnits.length&&(this.paymentInfo.paymentType="periodic",this.siteInfo.privateSiteInfo.isPeriodicPaymentTrackingEnabled&&(this.knowsNextPayment=!0,this.errorPayInfoText="Is the amount or date incorrect?",this.nextPaymentText=this.getNextPaymentText([this.siteInfo.userInfo.usersUnits[0].nextAssessmentDue],this.siteInfo.privateSiteInfo.assessmentFrequency),this.updatePaymentText())),setTimeout(function(){$("#btn_view_pay_history").click(function(){$("#pm_info").collapse("hide"),$("#payment_history").collapse("show")}),$("#btn_view_pay_info").click(function(){$("#payment_history").collapse("hide"),$("#pm_info").collapse("show")}),$(".hide").click(function(){$(this).parent().hide("")})},400),paypal.Button.render({env:"sandbox",commit:!0,style:{color:"gold",size:"medium"},client:{sandbox:null,production:"AW51-dH9dRrczrhVVf1kZyavtifN8z23Q0BTJwpWcTJQL6YoqGCTwOb0JfbCHTJIA_usIXAgrxwQ7osQ"},payment:function(e,t){return i.isLoading=!0,t.payment.create({payment:{transactions:[{amount:{total:i.paymentInfo.amount.toString(),currency:"USD"}}]}})},onAuthorize:function(e,t){return t.payment.execute().then(function(e){var t={PayPalCheckoutId:e.id,Memo:i.paymentInfo.note};i.isLoading=!0,i.$http.put("/api/OnlinePayment/SetMemo",t).then(function(e){i.isLoading=!1},function(e){i.isLoading=!1,alert("Failed to save: "+e.data.exceptionMessage)})})},onCancel:function(e,t){i.isLoading=!1},onError:function(e){i.isLoading=!1}},"#paypal-button")},e.prototype.onIncorrectPayDetails=function(){var e=this.assessmentAmount.toString();Math.round(this.assessmentAmount)!=this.assessmentAmount&&(e=this.assessmentAmount.toFixed(2));var t=e;this.knowsNextPayment&&HtmlUtil.isValidString(this.nextPaymentText)&&(t+="|"+this.nextPaymentText),this.$rootScope.$broadcast("prepAssessmentEmailToBoard",t)},e.prototype.getNextPaymentText=function(e,t){if(null==e)return"";e.constructor!==Array&&(e=[e]);for(var i="",n=FrequencyIdToInfo(t),o=0;o<e.length;++o){var s=e[o];if("month"===n.intervalName){i=["January","February","March","April","May","June","July","August","September","October","November","December"][s.period-1]}else if("quarter"===n.intervalName){i=["Q1","Q2","Q3","Q4"][s.period-1]}else if("half-year"===n.intervalName){i=["First Half","Second Half"][s.period-1]}i+=" "+s.year,this.paymentInfo.paysFor=[s]}return i},e.prototype.onSelectPaymentType=function(e){this.paymentInfo.paymentType=e,this.paymentInfo.amount="periodic"==e?this.assessmentAmount:0,this.updatePaymentText()},e.prototype.updatePaymentText=function(){"periodic"===this.paymentInfo.paymentType&&this.siteInfo.privateSiteInfo.isPeriodicPaymentTrackingEnabled?HtmlUtil.isNullOrWhitespace(this.nextPaymentText)||(this.siteInfo.userInfo.usersUnits[0].includesLateFee?this.paymentInfo.note="Assessment payment with late fee for ":this.paymentInfo.note="Assessment payment for ",this.paymentInfo.note+=this.nextPaymentText):this.paymentInfo.note=""},e.$inject=["$http","SiteInfo","$rootScope"],e}();e.PayPalPaymentFormController=t}(Ally||(Ally={})),CA.angularApp.component("paypalPaymentForm",{templateUrl:"/ngApp/common/paypal-payment-form.html",controller:Ally.PayPalPaymentFormController}),function(o){var e=function(){function e(e,t){this.$http=e,this.siteInfo=t,this.isLoading=!1,this.isSiteManager=!1,this.isInEditMode=!1}return e.prototype.$onInit=function(){var e=this;this.isSiteManager=this.siteInfo.userInfo.isSiteManager,this.isAddForm=null==this.vendorItem,this.isAddForm&&(this.isInEditMode=!0,this.vendorItem=new o.PreferredVendor,this.editVendorItem=new o.PreferredVendor,window.setTimeout(function(){return e.hookupAddressAutocomplete()},500))},e.prototype.hookupAddressAutocomplete=function(){"US"!==this.siteInfo.privateSiteInfo.country&&"CA"!==this.siteInfo.privateSiteInfo.country||$(".mask-phone").mask("(999) 999-9999? x999",{autoclear:!1});var e=void 0;if(this.siteInfo.privateSiteInfo.googleGpsPosition){e={bounds:new google.maps.Circle({center:this.siteInfo.privateSiteInfo.googleGpsPosition,radius:40234}).getBounds()}}var t=document.getElementById("vendor-"+(this.vendorItem.preferredVendorId||"")+"-address-text-box");this.addressAutocomplete=new google.maps.places.Autocomplete(t,e);var i=this;google.maps.event.addListener(this.addressAutocomplete,"place_changed",function(){var e=i.addressAutocomplete.getPlace();i.editVendorItem.fullAddress||(i.editVendorItem.fullAddress=new o.FullAddress),i.editVendorItem.fullAddress.oneLiner=e.formatted_address})},e.prototype.onSaveVendor=function(){var e=this;if(HtmlUtil.isNullOrWhitespace(this.editVendorItem.companyName))alert("Please enter a company name");else if(this.editVendorItem.servicesTagArray&&0!==this.editVendorItem.servicesTagArray.length){HtmlUtil.isNullOrWhitespace(this.editVendorItem.companyWeb)||0!==this.editVendorItem.companyWeb.indexOf("http")&&(this.editVendorItem.companyWeb="http://"+this.editVendorItem.companyWeb);var t=null==this.editVendorItem.preferredVendorId?this.$http.post:this.$http.put;this.isLoading=!0;var i="";_.each(this.editVendorItem.servicesTagArray,function(e){i+="|"+e.text}),i+="|",this.editVendorItem.servicesProvided=i;var n=this;t("/api/PreferredVendors",this.editVendorItem).success(function(){n.isLoading=!1,e.isAddForm?(n.editVendorItem=new o.PreferredVendor,n.onAddNewVendor&&n.onAddNewVendor()):n.isInEditMode=!1,n.onParentDataNeedsRefresh&&n.onParentDataNeedsRefresh()}).error(function(e){n.isLoading=!1,alert("Failed to save the vendor information: "+e.exceptionMessage)})}else alert("Please enter at least one service provided")},e.prototype.onCancelEdit=function(){this.isInEditMode=!1},e.prototype.onEditItem=function(){this.editVendorItem=JSON.parse(JSON.stringify(this.vendorItem)),this.isInEditMode=!0;var e=this;window.setTimeout(function(){e.hookupAddressAutocomplete()},500)},e.prototype.deleteItem=function(){if(confirm("Are you sure you want to remove this vendor?")){this.isLoading=!0;var t=this;this.$http.delete("/api/PreferredVendors/"+this.vendorItem.preferredVendorId).success(function(){t.isLoading=!1,t.onParentDataNeedsRefresh&&t.onParentDataNeedsRefresh()}).error(function(e){t.isLoading=!1,alert("Failed to delete the vendor: "+e.exceptionMessage)})}},e.prototype.getServiceAutocomplete=function(t){return _.where(e.AutocompleteServiceOptions,function(e){return-1!==e.text.toLowerCase().indexOf(t.toLowerCase())})},e.$inject=["$http","SiteInfo"],e.AutocompleteServiceOptions=[{text:"Additions & Remodels"},{text:"Appliances"},{text:"Cabinets & Countertops"},{text:"Cleaning"},{text:"Concrete & Masonry"},{text:"Deck, Porch, & Gazebo"},{text:"Drywall & Insulation"},{text:"Electrical"},{text:"Fencing"},{text:"Flooring"},{text:"Garages"},{text:"Gutters"},{text:"Handy Man"},{text:"HVAC"},{text:"Landscaping, Lawn Care & Sprinklers"},{text:"Painting & Staining"},{text:"Pest Control"},{text:"Plumbing"},{text:"Remodeling"},{text:"Roofing"},{text:"Siding"},{text:"Snow Removal"},{text:"Solar Electric, Heating & Cooling"},{text:"Swimming Pools"},{text:"Windows & Doors"}],e}();o.PreferredVendorItemController=e}(Ally||(Ally={})),CA.angularApp.component("preferredVendorItem",{bindings:{vendorItem:"=?",onParentDataNeedsRefresh:"&?",onAddNewVendor:"&?"},templateUrl:"/ngApp/common/preferred-vendor-item.html",controller:Ally.PreferredVendorItemController}),function(i){var n=function(){this.fullAddress=new i.FullAddress};i.PreferredVendor=n;var e=function(){function t(e,t){this.$http=e,this.siteInfo=t,this.allVendors=[],this.filteredVendors=[],this.editVendor=new n,this.isLoading=!1,this.isSiteManager=!1,this.usedServiceTags=[],this.filterTags=[],this.entriesSortAscending=!0}return t.prototype.$onInit=function(){this.isSiteManager=this.siteInfo.userInfo.isSiteManager,this.entriesSortField=window.localStorage[t.StorageKey_SortField],this.entriesSortField?this.entriesSortAscending="true"===window.localStorage[t.StorageKey_SortDir]:(this.entriesSortField="name",this.entriesSortAscending=!1),this.retrieveVendors()},t.prototype.retrieveVendors=function(){var i=this;this.isLoading=!0,this.$http.get("/api/PreferredVendors").success(function(e){i.isLoading=!1,i.allVendors=e,i.filteredVendors=e,i.sortEntries(),i.usedServiceTags=[],_.each(i.allVendors,function(t){t.servicesTagArray=[],_.each(t.servicesProvidedSplit,function(e){return t.servicesTagArray.push({text:e})}),i.usedServiceTags=i.usedServiceTags.concat(t.servicesProvidedSplit),t.addedDateUtc=moment.utc(t.addedDateUtc).toDate()}),i.usedServiceTags=_.uniq(i.usedServiceTags),i.usedServiceTags.sort()})},t.prototype.exportVendorCsv=function(){"undefined"!=typeof analytics&&analytics.track("exportResidentCsv");var e=[{headerText:"Company Name",fieldName:"companyName"},{headerText:"Company Phone",fieldName:"companyPhone"},{headerText:"Company Website",fieldName:"companyWeb"},{headerText:"Address",fieldName:"fullAddress",dataMapper:function(e){return e?e.oneLiner:""}},{headerText:"Contact Name",fieldName:"contactName"},{headerText:"Contact Phone",fieldName:"contactPhone"},{headerText:"Contact Email",fieldName:"contactEmail"},{headerText:"Services",fieldName:"servicesProvided",dataMapper:function(e){return HtmlUtil.isNullOrWhitespace(e)||(HtmlUtil.startsWith(e,"|")&&(e=e.substr(1)),HtmlUtil.endsWith(e,"|")&&(e=e.substr(0,e.length-1))),e}},{headerText:"Notes",fieldName:"notes"}],t=i.createCsvString(this.allVendors,e);i.HtmlUtil2.downloadCsv(t,"Vendors.csv")},t.prototype.onTagFilterToggle=function(e){var t=this.filterTags.indexOf(e);if(-1===t?this.filterTags.push(e):this.filterTags.splice(t,1),0===this.filterTags.length)this.filteredVendors=this.allVendors;else{this.filteredVendors=[];var i=this;_.each(this.allVendors,function(e){0<_.intersection(e.servicesProvidedSplit,i.filterTags).length&&i.filteredVendors.push(e)})}},t.prototype.onAddedNewVendor=function(){this.retrieveVendors()},t.prototype.sortEntries=function(){var t=this;this.filteredVendors=_.sortBy(this.filteredVendors,function(e){return"name"===t.entriesSortField?e.companyName.trim().toLocaleUpperCase():e.addedDateUtc}),this.entriesSortAscending&&this.filteredVendors.reverse()},t.prototype.updateEntriesSort=function(e){e||(e="entryDate"),this.entriesSortField===e?this.entriesSortAscending=!this.entriesSortAscending:(this.entriesSortField=e,this.entriesSortAscending=!1),window.localStorage[t.StorageKey_SortField]=this.entriesSortField,window.localStorage[t.StorageKey_SortDir]=this.entriesSortAscending,this.sortEntries()},t.$inject=["$http","SiteInfo"],t.StorageKey_SortField="vendors_entriesSortField",t.StorageKey_SortDir="vendors_entriesSortAscending",t}();i.PreferredVendorsController=e}(Ally||(Ally={})),CA.angularApp.component("preferredVendors",{templateUrl:"/ngApp/common/preferred-vendors.html",controller:Ally.PreferredVendorsController}),function(e){var t=function(){function e(e,t){this.$http=e,this.siteInfo=t}return e.prototype.$onInit=function(){this.shouldHideName=!!this.shouldHideName},e.prototype.onComponentChange=function(){this.onChange&&this.onChange()},e.$inject=["$http","SiteInfo"],e}();e.StreetAddressFormController=t}(Ally||(Ally={})),CA.angularApp.component("streetAddressForm",{bindings:{streetAddress:"=",onChange:"&",shouldHideName:"<"},templateUrl:"/ngApp/common/street-address-form.html",controller:Ally.StreetAddressFormController}),function(e){var t=function(){function e(e,t,i){this.$http=e,this.siteInfo=t,this.$cacheFactory=i,this.isSiteManager=!1,this.hideDocuments=!1,this.selectedView="docs"}return e.prototype.$onInit=function(){this.isSiteManager=this.siteInfo.userInfo.isSiteManager,this.hideDocuments=this.siteInfo.userInfo.isRenter&&!this.siteInfo.privateSiteInfo.rentersCanViewDocs,this.hideDocuments?this.selectedView="info":this.selectedView="docs"},e.$inject=["$http","SiteInfo","$cacheFactory"],e}();e.HoaInfoController=t}(Ally||(Ally={})),CA.angularApp.component("hoaInfo",{templateUrl:"/ngApp/hoa/member/HoaInfo.html",controller:Ally.HoaInfoController}),function(e){var t=function(){function e(e,t,i){this.$http=e,this.siteInfo=t,this.$cacheFactory=i,this.isSiteManager=!1}return e.prototype.$onInit=function(){this.isSiteManager=this.siteInfo.userInfo.isSiteManager},e.$inject=["$http","SiteInfo","$cacheFactory"],e}();e.HoaHomeController=t}(Ally||(Ally={})),CA.angularApp.component("hoaHome",{templateUrl:"/ngApp/hoa/member/Home.html",controller:Ally.HoaHomeController}),function(e){var t=function(){function e(e,t,i,n,o){this.$http=e,this.$rootScope=t,this.siteInfo=i,this.$timeout=n,this.appCacheService=o}return e.prototype.$onInit=function(){this.welcomeMessage=this.siteInfo.privateSiteInfo.welcomeMessage,this.isFirstVisit=null===this.siteInfo.userInfo.lastLoginDateUtc,this.isSiteManager=this.siteInfo.userInfo.isSiteManager,this.showFirstVisitModal=this.isFirstVisit&&!this.$rootScope.hasClosedFirstVisitModal&&null===this.siteInfo.privateSiteInfo.siteLaunchedDateUtc,this.homeRightColumnType=this.siteInfo.privateSiteInfo.homeRightColumnType,this.homeRightColumnType||(this.homeRightColumnType="localnews");HtmlUtil.getSubdomain(window.location.host);this.allyAppName=AppConfig.appName,this.messageObject={},null!==this.siteInfo.privateSiteInfo.assessmentFrequency&&null!==this.siteInfo.userInfo.usersUnits&&0<this.siteInfo.userInfo.usersUnits.length&&(this.paymentInfo.paymentType="periodic",this.siteInfo.privateSiteInfo.isPeriodicPaymentTrackingEnabled&&(this.knowsNextPayment=!0,this.errorPayInfoText="Is the amount or date incorrect?",this.nextPaymentText=this.getNextPaymentText([this.siteInfo.userInfo.usersUnits[0].nextAssessmentDue],this.siteInfo.privateSiteInfo.assessmentFrequency),this.updatePaymentText())),this.refreshData()},e.prototype.updatePaymentText=function(){"periodic"===this.paymentInfo.paymentType&&this.siteInfo.privateSiteInfo.isPeriodicPaymentTrackingEnabled?HtmlUtil.isNullOrWhitespace(this.nextPaymentText)||(this.siteInfo.userInfo.usersUnits[0].includesLateFee?this.paymentInfo.note="Assessment payment with late fee for ":this.paymentInfo.note="Assessment payment for ",this.paymentInfo.note+=this.nextPaymentText):this.paymentInfo.note=""},e.prototype.onSelectPaymentType=function(e){this.paymentInfo.paymentType=e,this.paymentInfo.amount="periodic"===e?this.siteInfo.userInfo.assessmentAmount:0,this.updatePaymentText()},e.prototype.getNextPaymentText=function(e,t){if(null===e)return"";e.constructor!==Array&&(e=[e]);for(var i="",n=FrequencyIdToInfo(t),o=0;o<e.length;++o){var s=e[o];if("month"===n.intervalName){i=["January","February","March","April","May","June","July","August","September","October","November","December"][s.period-1]}else if("quarter"===n.intervalName){i=["Q1","Q2","Q3","Q4"][s.period-1]}else if("half-year"===n.intervalName){i=["First Half","Second Half"][s.period-1]}i+=" "+s.year,this.paymentInfo.paysFor=[s]}return i},e.prototype.hideFirstVisit=function(){this.$rootScope.hasClosedFirstVisitModal=!0,this.showFirstVisitModal=!1},e.prototype.onIncorrectPayDetails=function(){this.messageObject.recipientType="board",this.knowsNextPayment?this.messageObject.message="Hello Board Members,\n\nOur association's home page says my next payment of $"+this.siteInfo.userInfo.assessmentAmount+" will cover "+this.nextPaymentText+", but I believe that is incorrect. My records indicate my next payment of $"+this.siteInfo.userInfo.assessmentAmount+" should pay for [INSERT PROPER DATE HERE]. What do you need from me to resolve the issue?\n\n- "+this.siteInfo.userInfo.firstName:this.messageObject.message="Hello Board Members,\n\nOur association's home page says my assessment payment is $"+this.siteInfo.userInfo.assessmentAmount+", but I believe that is incorrect. My records indicate my assessment payments should be $[INSERT PROPER AMOUNT HERE]. What do you need from me to resolve the issue?\n\n- "+this.siteInfo.userInfo.firstName,document.getElementById("send-email-panel").scrollIntoView()},e.prototype.refreshData=function(){HtmlUtil.getSubdomain(window.location.host);if(!1,"localnews"===this.homeRightColumnType){var e,t;this.isLoading_LocalNews=!0,t="US"===this.siteInfo.privateSiteInfo.country?(e="https://localnewsally.azurewebsites.net/api/LocalNews",{clientId:"1001A194-B686-4C45-80BC-ECC0BB4916B4",chicagoWard:this.siteInfo.privateSiteInfo.chicagoWard,zipCode:this.siteInfo.privateSiteInfo.zipCode,cityNeighborhood:this.siteInfo.privateSiteInfo.localNewsNeighborhoodQuery}):(e="https://localnewsally.azurewebsites.net/api/LocalNews/International/MajorCity",{clientId:"1001A194-B686-4C45-80BC-ECC0BB4916B4",countryCode:this.siteInfo.privateSiteInfo.country,city:this.siteInfo.privateSiteInfo.groupAddress.city});var i=this;this.$http.get(e,{cache:!0,params:t}).then(function(e){i.localNews=e.data,i.isLoading_LocalNews=!1})}},e.$inject=["$http","$rootScope","SiteInfo","$timeout","appCacheService"],e}();e.HomeGroupHomeController=t}(Ally||(Ally={})),CA.angularApp.component("homeGroupHome",{templateUrl:"/ngApp/home/home-group-home.html",controller:Ally.HomeGroupHomeController}),function(e){var t=function(){function e(e,t,i){this.$http=e,this.$rootScope=t,this.siteInfo=i,this.isLoading=!1,this.shouldShowWidget=!1}return e.prototype.$onInit=function(){this.retrieveInfo()},e.prototype.retrieveInfo=function(){var t=this;this.isLoading=!0,this.$http.get("/api/HomeValue/ZillowInfo").then(function(e){t.isLoading=!1,t.shouldShowWidget=!!e.data&&!!e.data.chartImageUri,t.shouldShowWidget&&(t.valueInfo=e.data)},function(e){t.isLoading=!1,t.shouldShowWidget=!1})},e.$inject=["$http","$rootScope","SiteInfo"],e}();e.HomeValueWidgetController=t}(Ally||(Ally={})),CA.angularApp.component("homeValueWidget",{templateUrl:"/ngApp/home/home-value-widget.html",controller:Ally.HomeValueWidgetController}),function(e){var t=function(){function e(e,t,i){this.$http=e,this.$rootScope=t,this.siteInfo=i,this.isLoading=!1,this.isAdmin=!1}return e.prototype.$onInit=function(){},e.$inject=["$http","$rootScope","SiteInfo"],e}();e.HomeUsersController=t}(Ally||(Ally={})),CA.angularApp.component("homeUsers",{templateUrl:"/ngApp/home/manager/home-users.html",controller:Ally.HomeUsersController}),function(n){var e=function(){},t=function(){};n.HomeInfo=t;var o=function(){this.signerUpInfo=new e,this.streetAddress="",this.homeInfo=new t},i=function(){function e(e,t,i){this.$http=e,this.$scope=t,this.WizardHandler=i,this.lotSizeUnit="Acres",this.lotSquareUnits=0,this.signUpInfo=new o,this.isLoadingHomeInfo=!1,this.didLoadHomeInfo=!1,this.isLoading=!1,this.hideWizard=!1,this.hasAlreadyCheckedForHomeInfo=!1}return e.prototype.$onInit=function(){var i=this;this.$scope.$on("wizard:stepChanged",function(e,t){1===t.index&&i.retrieveHomeInfoForAddress()});setTimeout(function(){i.initMap()},300)},e.prototype.retrieveHomeInfoForAddress=function(){var t=this;if(!HtmlUtil.isNullOrWhitespace(this.signUpInfo.streetAddress)&&!this.hasAlreadyCheckedForHomeInfo){this.hasAlreadyCheckedForHomeInfo=!0;var e="/api/HomeSignUp/HomeInfo?streetAddress="+encodeURIComponent(this.signUpInfo.streetAddress);this.$http.get(e,{cache:!0}).then(function(e){e.data&&(t.signUpInfo.homeInfo=e.data,t.didLoadHomeInfo=!0,t.processLotSizeHint(t.signUpInfo.homeInfo.lotSquareFeet))})}},e.prototype.processLotSizeHint=function(e){e&&(43560<e?(this.lotSizeUnit="Acres",this.lotSquareUnits=e/43560,this.lotSquareUnits=parseFloat((Math.round(4*this.lotSquareUnits)/4).toFixed(2))):(this.lotSizeUnit="SquareFeet",this.lotSquareUnits=e))},e.prototype.initMap=function(){var e=document.getElementById("address-map");this.map=new google.maps.Map(e,{center:{lat:41.869638,lng:-87.657423},zoom:9}),this.mapMarker=new google.maps.Marker({map:this.map,anchorPoint:new google.maps.Point(41.969638,-87.657423),icon:"/assets/images/MapMarkers/MapMarker_Home.png",position:null});var t=document.getElementById("home-address-text-box");this.addressAutocomplete=new google.maps.places.Autocomplete(t),this.addressAutocomplete.bindTo("bounds",this.map);var i=this;this.addressAutocomplete.addListener("place_changed",function(){i.mapMarker.setVisible(!1);var e=i.addressAutocomplete.getPlace(),t=e.formatted_address;t.indexOf(", USA")===t.length-", USA".length&&(t=t.substring(0,t.length-", USA".length)),i.signUpInfo.streetAddress=t,i.selectedSplitAddress=n.MapUtil.parseAddressComponents(e.address_components),e.geometry&&i.centerMap(e.geometry),$("#association-name-text-box").focus()})},e.prototype.goNextStep=function(){this.WizardHandler.wizard().next()},e.prototype.onFinishedWizard=function(){this.isLoading=!0;var i=this;this.$http.post("/api/HomeSignUp",this.signUpInfo).then(function(e){i.isLoading=!1;var t=e.data;HtmlUtil.isNullOrWhitespace(t.errorMessage)?HtmlUtil.isNullOrWhitespace(t.createUrl)?(i.hideWizard=!0,i.resultMessage="Great work! We just sent you an e-mail with instructions on how access your new site."):window.location.href=t.createUrl:(alert("Failed to complete sign-up: "+t.errorMessage),0<=t.stepIndex&&i.WizardHandler.wizard().goTo(t.stepIndex))},function(e){i.isLoading=!1;var t=e.data.exceptionMessage?e.data.exceptionMessage:e.data;alert("Failed to complete sign-up: "+t)})},e.prototype.onHomeAddressChanged=function(){var n=this;HtmlUtil.geocodeAddress(this.signUpInfo.streetAddress,function(t,i){n.$scope.$apply(function(){if(i==google.maps.GeocoderStatus.OK){var e=t[0].formatted_address;e.indexOf(", USA")===e.length-", USA".length&&(e=e.substring(0,e.length-", USA".length)),n.signUpInfo.streetAddress=e,n.centerMap(t[0].geometry)}})})},e.prototype.centerMap=function(e){e.viewport?this.map.fitBounds(e.viewport):(this.map.setCenter(e.location),this.map.setZoom(17)),this.mapMarker.setPosition(e.location),this.mapMarker.setVisible(!0)},e.prototype.prepopulateHomeInfo=function(){if(this.selectedSplitAddress){this.isLoadingHomeInfo=!0;var e="/api/PropertyResearch/HomeInfo?street="+encodeURIComponent(this.selectedSplitAddress.street)+"&city="+encodeURIComponent(this.selectedSplitAddress.city)+"&state="+this.selectedSplitAddress.state+"&zip="+this.selectedSplitAddress.zip,i=this;this.$http.get(e).then(function(e){i.isLoadingHomeInfo=!1;var t=e.data;t&&(i.didLoadHomeInfo=!0,i.signUpInfo.homeInfo=t,i.processLotSizeHint(t.lotSquareFeet))},function(){i.isLoadingHomeInfo=!1})}},e.$inject=["$http","$scope","WizardHandler"],e}();n.HomeSignUpController=i}(Ally||(Ally={})),CA.angularApp.component("homeSignUp",{templateUrl:"/ngApp/home/public/home-sign-up.html",controller:Ally.HomeSignUpController}),function(e){var t=function(){function e(e,t,i,n,o){this.$http=e,this.$rootScope=t,this.siteInfo=i,this.$timeout=n,this.appCacheService=o}return e.prototype.$onInit=function(){this.welcomeMessage=this.siteInfo.privateSiteInfo.welcomeMessage,this.isFirstVisit=null===this.siteInfo.userInfo.lastLoginDateUtc,this.isSiteManager=this.siteInfo.userInfo.isSiteManager,this.showFirstVisitModal=this.isFirstVisit&&!this.$rootScope.hasClosedFirstVisitModal&&null===this.siteInfo.privateSiteInfo.siteLaunchedDateUtc,this.homeRightColumnType=this.siteInfo.privateSiteInfo.homeRightColumnType,this.homeRightColumnType||(this.homeRightColumnType="localnews");HtmlUtil.getSubdomain(window.location.host);this.allyAppName=AppConfig.appName,this.messageObject={},null!==this.siteInfo.privateSiteInfo.assessmentFrequency&&null!==this.siteInfo.userInfo.usersUnits&&0<this.siteInfo.userInfo.usersUnits.length&&(this.paymentInfo.paymentType="periodic",this.siteInfo.privateSiteInfo.isPeriodicPaymentTrackingEnabled&&(this.knowsNextPayment=!0,this.errorPayInfoText="Is the amount or date incorrect?",this.nextPaymentText=this.getNextPaymentText([this.siteInfo.userInfo.usersUnits[0].nextAssessmentDue],this.siteInfo.privateSiteInfo.assessmentFrequency),this.updatePaymentText()))},e.prototype.updatePaymentText=function(){"periodic"===this.paymentInfo.paymentType&&this.siteInfo.privateSiteInfo.isPeriodicPaymentTrackingEnabled?HtmlUtil.isNullOrWhitespace(this.nextPaymentText)||(this.siteInfo.userInfo.usersUnits[0].includesLateFee?this.paymentInfo.note="Assessment payment with late fee for ":this.paymentInfo.note="Assessment payment for ",this.paymentInfo.note+=this.nextPaymentText):this.paymentInfo.note=""},e.prototype.onSelectPaymentType=function(e){this.paymentInfo.paymentType=e,this.paymentInfo.amount="periodic"===e?this.siteInfo.userInfo.assessmentAmount:0,this.updatePaymentText()},e.prototype.getNextPaymentText=function(e,t){if(null===e)return"";e.constructor!==Array&&(e=[e]);for(var i="",n=FrequencyIdToInfo(t),o=0;o<e.length;++o){var s=e[o];if("month"===n.intervalName){i=["January","February","March","April","May","June","July","August","September","October","November","December"][s.period-1]}else if("quarter"===n.intervalName){i=["Q1","Q2","Q3","Q4"][s.period-1]}else if("half-year"===n.intervalName){i=["First Half","Second Half"][s.period-1]}i+=" "+s.year,this.paymentInfo.paysFor=[s]}return i},e.prototype.hideFirstVisit=function(){this.$rootScope.hasClosedFirstVisitModal=!0,this.showFirstVisitModal=!1},e.prototype.onIncorrectPayDetails=function(){this.messageObject.recipientType="board",this.knowsNextPayment?this.messageObject.message="Hello Boardmembers,\n\nOur association's home page says my next payment of $"+this.siteInfo.userInfo.assessmentAmount+" will cover "+this.nextPaymentText+", but I believe that is incorrect. My records indicate my next payment of $"+this.siteInfo.userInfo.assessmentAmount+" should pay for [INSERT PROPER DATE HERE]. What do you need from me to resolve the issue?\n\n- "+this.siteInfo.userInfo.firstName:this.messageObject.message="Hello Boardmembers,\n\nOur association's home page says my assessment payment is $"+this.siteInfo.userInfo.assessmentAmount+", but I believe that is incorrect. My records indicate my assessment payments should be $[INSERT PROPER AMOUNT HERE]. What do you need from me to resolve the issue?\n\n- "+this.siteInfo.userInfo.firstName,document.getElementById("send-email-panel").scrollIntoView()},e.$inject=["$http","$rootScope","SiteInfo","$timeout","appCacheService"],e}();e.PtaGroupHomeController=t}(Ally||(Ally={})),CA.angularApp.component("ptaGroupHome",{templateUrl:"/ngApp/pta/pta-group-home.html",controller:Ally.PtaGroupHomeController}),ServiceBankInfoCtrl.$inject=["$http"],ServiceBusinessInfoCtrl.$inject=["$http"],ServiceJobsCtrl.$inject=["$http"];var AppCacheService=function(){function i(){}return i.prototype.set=function(e,t){window.sessionStorage[i.KeyPrefix+e]=t},i.prototype.get=function(e){return window.sessionStorage[i.KeyPrefix+e]},i.prototype.clear=function(e){window.sessionStorage[i.KeyPrefix+e]=void 0,delete window.sessionStorage[i.KeyPrefix+e]},i.prototype.getAndClear=function(e){var t;return t=this.get(e),this.clear(e),t},i.Key_WasLoggedIn403="wasLoggedIn403",i.Key_WasLoggedIn401="wasLoggedIn401",i.Key_AfterLoginRedirect="afterLoginRedirect",i.KeyPrefix="AppCacheService_",i}();angular.module("CondoAlly").service("appCacheService",[AppCacheService]),function(e){var t=function(){};function c(e){if(!e)return"";var t=e.toString();return HtmlUtil.isNullOrWhitespace(t)?"":((-1!==t.indexOf('"')||-1!==t.indexOf(",")||-1!==t.indexOf("\r")||-1!==t.indexOf("\n"))&&(t='"'+(t=t.replace('"','""'))+'"'),t)}e.CsvColumnDescriptor=t,e.ValueToCsvValue=c,e.createCsvString=function(e,t,i){void 0===i&&(i=!0);var n="";if(i)for(var o=0;o<t.length;++o)0<o&&(n+=","),n+=c(t[o].headerText);for(var s=0;s<e.length;++s){n+="\n";for(var a=e[s],r=0;r<t.length;++r){0<r&&(n+=",");var l=t[r],d=a[l.fieldName];l.dataMapper&&(d=l.dataMapper(d)),n+=c(d)}}return n}}(Ally||(Ally={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}}();!function(e){var t=function(){};e.GroupEmailInfo=t;var i=function(){};e.GroupEmailGroups=i;var n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t}(e.SimpleUserEntry);e.FellowChtnResident=n;var o=function(){};e.CommitteeListingInfo=o;var s=function(){};e.UnitListing=s;var a=function(){};e.FellowResidents=a;var r=function(){function e(e,t,i){this.$http=e,this.$q=t,this.$cacheFactory=i}return e.prototype.getResidents=function(){var t=this;return this.$http.get("/api/BuildingResidents",{cache:!0}).then(function(e){return e.data.residents},function(e){return t.$q.reject(e)})},e.prototype.getCommitteeMembers=function(e){return this.$http.get("/api/Committee/"+e+"/Members").then(function(e){return e.data},function(e){return this.$q.reject(e)})},e.prototype.isCommitteeMember=function(e,t){return this.$http.get("/api/Committee/"+e+"/IsMember",{cache:!0}).then(function(e){return e.data},function(e){return this.$q.reject(e)})},e.prototype.getByUnits=function(){var t=this;return this.$http.get("/api/BuildingResidents",{cache:!0}).then(function(e){return e.data.byUnit},function(e){return t.$q.reject(e)})},e.prototype.getByUnitsAndResidents=function(){var t=this;return this.$http.get("/api/BuildingResidents",{cache:!0}).then(function(e){return e.data},function(e){return t.$q.reject(e)})},e.prototype.getGroupEmailObject=function(){return this.$http.get("/api/BuildingResidents/EmailGroups",{cache:!0}).then(function(e){return e.data},function(e){return this.$q.reject(e)})},e.prototype.getAllGroupEmails=function(){return this.$http.get("/api/BuildingResidents/AllEmailGroups",{cache:!0}).then(function(e){return e.data},function(e){return this.$q.reject(e)})},e.prototype._setupGroupEmailObject=function(e,t){var i={};i={everyone:[],owners:[],renters:[],board:[],residentOwners:[],nonResidentOwners:[],residentOwnersAndRenters:[],propertyManagers:[],discussion:[]};for(var n=0;n<e.length;++n){var o=e[n],s=o.fullName+(o.hasEmail?"":"*");i.everyone.push(s);0!==o.boardPosition&&32!==o.boardPosition&&i.board.push(s),32===o.boardPosition&&i.propertyManagers.push(s),o.includeInDiscussionEmail&&i.discussion.push(s);for(var a=!1,r=!1,l=!1,d=0;d<o.homes.length;++d){var c=o.homes[d];if(!c.isRenter)a=!0,l=0<_.find(t,function(e){return e.unitId===c.unitId}).renters.length;c.isRenter&&(r=!0)}a&&(i.owners.push(s),l?i.nonResidentOwners.push(s):(i.residentOwners.push(s),i.residentOwnersAndRenters.push(s))),r&&(i.renters.push(s),i.residentOwnersAndRenters.push(s))}return 0===i.renters.length&&(i.residentOwners=[],i.residentOwnersAndRenters=[],i.nonResidentOwners=[]),i},e.prototype.sendMessage=function(e,t,i){var n={recipientUserId:e,messageBody:t,messageSubject:i};return this.$http.post("/api/BuildingResidents/SendMessage",n)},e.prototype.clearResidentCache=function(){this.$cacheFactory.get("$http").remove("/api/BuildingResidents"),this.$cacheFactory.get("$http").remove("/api/BuildingResidents/EmailGroups")},e.BoardPositionNames=[{id:0,name:"None"},{id:1,name:"President"},{id:2,name:"Treasurer"},{id:4,name:"Secretary"},{id:8,name:"Director/Member at Large"},{id:16,name:"Vice President"},{id:32,name:"Property Manager"},{id:64,name:"Secretary + Treasurer"}],e}();e.FellowResidentsService=r}(Ally||(Ally={})),angular.module("CondoAlly").service("fellowResidents",["$http","$q","$cacheFactory",Ally.FellowResidentsService]),CA.angularApp.directive("googleMapPolyEditor",["$http",function(e){return{scope:{editPolyVerts:"=",visiblePolys:"=",visiblePoints:"=",groupBoundsPoly:"=",mapCenter:"=",onMapEditorReady:"&",enableMapControls:"="},restrict:"E",replace:"true",templateUrl:"/ngApp/services/GoogleMapPolyEditorTemplate.html",link:function(r,e,t){r.mapInfo={center:{lat:39.5,lng:-98.35},zoom:4,disableDefaultUI:!r.enableMapControls,mapTypeId:google.maps.MapTypeId.HYBRID,events:{tilesloaded:function(e,t,i){google.maps.event.clearListeners(e,"tilesloaded")}}},r.googlePolyToGpsBounds=function(e){return e=_.map(e,function(e){return{lat:e.lat(),lon:e.lng()}})},r.centerMapOnPoly=function(e){if(e&&0!==e.length){var t=new google.maps.LatLngBounds;_.map(e,function(e){t.extend(e)}),r.mapInstance.fitBounds(t)}},r.setGroupBounds=function(e){if(e){var t={paths:Ally.MapUtil.gpsBoundsToGooglePoly(e),map:r.mapInstance,strokeColor:"#0000FF",strokeOpacity:.5,strokeWeight:1,fillColor:"#0000FF",fillOpacity:.15,zIndex:-1};r.activeShape&&r.activeShape.setMap(null),r.groupBoundsShape=new google.maps.Polygon(t)}else r.groupBoundsShape&&(r.groupBoundsShape.setMap(null),r.groupBoundsShape=null)},r.fitBoundsForPolys=function(){var t=new google.maps.LatLngBounds;(r.groupBoundsShape||r.currentVisiblePolys&&0!==r.currentVisiblePolys.length)&&(r.groupBoundsShape&&_.each(r.groupBoundsShape.getPath().getArray(),function(e){t.extend(e)}),_.each(r.currentVisiblePolys,function(e){_.each(e.getPath().getArray(),function(e){t.extend(e)})}),r.mapInstance.fitBounds(t))},r.fitBoundsForPoints=function(){if(r.currentVisiblePoints&&0!==r.currentVisiblePoints.length){var t=new google.maps.LatLngBounds;_.each(r.currentVisiblePoints,function(e){t.extend(e.position)}),r.mapInstance.fitBounds(t)}};var l=function(e){var t=function(e){return $("img[src$='"+e+"']")},i=this,n=t(i.btnDeleteImageUrl);if(0===n.length){var o=$("img[src$='http://maps.gstatic.com/mapfiles/undo_poly.png']");o.parent().css("height","21px !important"),o.parent().parent().append('<div style="overflow-x: hidden; overflow-y: hidden; position: absolute; width: 30px; height: 27px;top:21px;"><img src="'+i.btnDeleteImageUrl+'" class="deletePoly" style="height:auto; width:auto; position: absolute; left:0;"/></div>'),(n=t(i.btnDeleteImageUrl)).hover(function(){return $(this).css("left","-30px"),!1},function(){return $(this).css("left","0px"),!1}),n.mousedown(function(){return $(this).css("left","-60px"),!1})}i.btnDeleteClickHandler&&n.unbind("click",i.btnDeleteClickHandler),i.btnDeleteClickHandler=function(){return i.removeAt(e),!1},n.click(i.btnDeleteClickHandler)};r.currentVisiblePolys=[],r.currentVisiblePoints=[],r.onVisiblePolysChange=function(e){_.each(r.currentVisiblePolys,function(e){e.setMap(null)}),r.currentVisiblePolys=[],_.each(e,function(e){var t={paths:Ally.MapUtil.gpsBoundsToGooglePoly(e),clickable:"function"==typeof e.onClick,map:r.mapInstance,strokeColor:"#0000FF",strokeOpacity:.8,strokeWeight:2,fillColor:"#0000FF",fillOpacity:.35},i=new google.maps.Polygon(t);(i.polyInfo=e).mapShapeObject=i,r.currentVisiblePolys.push(i),t.clickable&&google.maps.event.addListener(i,"click",function(){i.polyInfo.onClick()})}),r.fitBoundsForPolys()},r.onVisiblePointsChange=function(e){_.each(r.currentVisiblePoints,function(e){e.setMap(null)}),r.currentVisiblePoints=[],_.each(e,function(e){var t=new google.maps.Marker({position:{lat:e.lat,lng:e.lon},map:r.mapInstance,title:e.fullAddress});t.pointSource=e,r.currentVisiblePoints.push(t),"function"==typeof e.onClick&&google.maps.event.addListener(t,"click",function(){t.pointSource.onClick()})}),r.fitBoundsForPoints()},r.onEditPolyChange=function(e){if(!e)return r.activeShape&&r.activeShape.setMap(null),void(r.activeShape=null);var t=_.map(e.vertices,function(e){return new google.maps.LatLng(e.lat,e.lon)});r.centerMapOnPoly(t);var i={paths:t,editable:!0,draggable:!0,clickable:!0,map:r.mapInstance,strokeColor:"#FF0000",strokeOpacity:.8,strokeWeight:2,fillColor:"#FF0000",fillOpacity:.35};r.activeShape&&r.activeShape.setMap(null),r.activeShape=new google.maps.Polygon(i);var n,o,s,a=function(){r.editPolyVerts.vertices=r.googlePolyToGpsBounds(r.activeShape.getPath().getArray())};return google.maps.event.addListener(r.activeShape.getPath(),"set_at",a),google.maps.event.addListener(r.activeShape.getPath(),"insert_at",a),n=r.activeShape,o="http://i.imgur.com/RUrKV.png",(s=n.getPath()).btnDeleteClickHandler={},s.btnDeleteImageUrl=o,google.maps.event.addListener(n.getPath(),"set_at",l),google.maps.event.addListener(n.getPath(),"insert_at",l),r.activeShape},r.$watch("editPolyVerts",function(e){r.onEditPolyChange(e)}),r.$watch("visiblePolys",function(e){r.onVisiblePolysChange(e)}),r.$watch("visiblePoints",function(e){r.onVisiblePointsChange(e)}),r.$watch("groupBoundsPoly",function(e){r.setGroupBounds(e)}),r.$watch("mapCenter",function(e){e&&(e=new google.maps.LatLng(e.lat,e.lon),r.mapInstance.setCenter(e))}),r.mapInstance=new google.maps.Map($(e).children(".google-map-canvas")[0],r.mapInfo),r.onMapEditorReady&&r.onMapEditorReady({mapInstance:r.mapInstance}),google.maps.event.addListener(r.mapInstance,"click",function(e){var t={lat:e.latLng.lat(),lon:e.latLng.lng()},i={lat:e.latLng.lat()+.01,lon:e.latLng.lng()+.01},n=[t,{lat:i.lat,lon:t.lon},i,{lat:t.lat,lon:i.lon}];r.editPolyVerts&&(r.editPolyVerts.vertices=n),r.onEditPolyChange(r.editPolyVerts)})}}}]),function(t){var e=function(){function e(e,t,i){this.$http=e,this.$rootScope=t,this.siteInfo=i,this.isLoading=!1,this.shouldShowAdminControls=!1,this.digestFrequency=null}return e.prototype.$onInit=function(){this.defaultDigestFrequency=this.siteInfo.userInfo.defaultDigestFrequency,this.shouldShowAdminControls=this.siteInfo.userInfo.isSiteManager,this.threadUrl=this.siteInfo.publicSiteInfo.baseUrl+"/#!/Home/DiscussionThread/"+this.thread.commentThreadId,this.retrieveComments()},e.prototype.onTextAreaKeyDown=function(e,t){e.keyCode?e.keyCode:e.which;13==e.keyCode&&(e.preventDefault(),"new"===t?this.submitNewComment():"edit"===t?this.submitCommentEdit():"reply"===t&&this.submitReplyComment())},e.prototype.onChangeDigestFrequency=function(){var t=this;this.isLoading=!0;var e="/api/CommentThread/"+this.thread.commentThreadId+"/DigestFrequency/"+this.commentsState.digestFrequency;this.$http.put(e,null).then(function(){t.isLoading=!1},function(e){t.isLoading=!1,alert("Failed to change: "+e.data.exceptionMessage)})},e.prototype.retrieveComments=function(){var i=this;this.isLoading=!0,this.$http.get("/api/CommentThread/"+this.thread.commentThreadId+"/Comments").then(function(e){i.isLoading=!1,i.commentsState=e.data;var t=function(e){e.isMyComment=e.authorUserId===i.$rootScope.userInfo.userId,e.replies&&_.each(e.replies,t)};_.forEach(i.commentsState.comments,t),i.commentsState.comments=_.sortBy(i.commentsState.comments,function(e){return e.postDateUtc}).reverse()},function(e){i.isLoading=!1})},e.prototype.startReplyToComment=function(e){this.replyToCommentId=e.commentId,this.replyCommentText="",setTimeout(function(){return $(".reply-to-textarea").focus()},150)},e.prototype.startEditComment=function(e){this.editCommentId=e.commentId,this.editCommentText=e.commentText},e.prototype.deleteComment=function(e){var t=this,i="Are you sure you want to delete this comment?";1===this.commentsState.comments.length&&(i="Since there is only one comment, if you delete this comment you'll delete the thread. Are you sure you want to delete this comment?"),confirm(i)&&(this.isLoading=!0,this.$http.delete("/api/CommentThread/"+this.thread.commentThreadId+"/"+e.commentId).then(function(){t.isLoading=!1,1===t.commentsState.comments.length?(t.$rootScope.$broadcast("refreshCommentThreadList"),t.closeModal(!1)):t.retrieveComments()},function(e){t.isLoading=!1,alert("Failed to post comment: "+e.data.exceptionMessage)}))},e.prototype.archiveThread=function(e){var t=this;void 0===e&&(e=!0),this.isLoading=!0;var i="/api/CommentThread/Archive/"+this.thread.commentThreadId;e||(i="/api/CommentThread/Unarchive/"+this.thread.commentThreadId),this.$http.put(i,null).then(function(){t.isLoading=!1,t.$rootScope.$broadcast("refreshCommentThreadList"),t.closeModal(!1)},function(e){t.isLoading=!1,alert("Failed to archive: "+e.data.exceptionMessage)})},e.prototype.submitCommentEdit=function(){var t=this,e={commentId:this.editCommentId,newCommentText:this.editCommentText};this.isLoading=!0,this.$http.put("/api/CommentThread/"+this.thread.commentThreadId+"/EditComment",e).then(function(){t.isLoading=!1,t.editCommentId=-1,t.editCommentText="",t.retrieveComments()},function(e){t.isLoading=!1,alert("Failed to edit comment: "+e.data.exceptionMessage)})},e.prototype.submitReplyComment=function(){var t=this,e={replyToCommentId:this.replyToCommentId,commentText:this.replyCommentText};this.isLoading=!0,this.$http.put("/api/CommentThread/"+this.thread.commentThreadId+"/AddComment",e).then(function(e){t.isLoading=!1,t.replyToCommentId=-1,t.replyCommentText="",t.retrieveComments()},function(e){t.isLoading=!1,alert("Failed to add comment: "+e.data.exceptionMessage)})},e.prototype.submitNewComment=function(){var t=this,e={commentText:this.newCommentText};this.isLoading=!0,this.$http.put("/api/CommentThread/"+this.thread.commentThreadId+"/AddComment",e).then(function(e){t.isLoading=!1,t.newCommentText="",t.retrieveComments()},function(e){t.isLoading=!1,alert("Failed to add comment: "+e.data.exceptionMessage)})},e.prototype.closeModal=function(e){this.onClosed&&this.onClosed()},e.prototype.copyThreadLink=function(e){return e.stopPropagation(),e.preventDefault(),t.HtmlUtil2.copyTextToClipboard(this.threadUrl)?t.HtmlUtil2.showTooltip(e.target,"Copied!"):t.HtmlUtil2.showTooltip(e.target,"Auto-copy failed, right-click and copy link address"),!1},e.$inject=["$http","$rootScope","SiteInfo"],e}();t.GroupCommentThreadViewController=e}(Ally||(Ally={})),CA.angularApp.component("groupCommentThreadView",{bindings:{thread:"<",onClosed:"&"},templateUrl:"/ngApp/services/group-comment-thread-view.html",controller:Ally.GroupCommentThreadViewController}),function(e){var t=function(){};e.CommentThread=t;var i=function(){function e(e,t,i,n,o,s){this.$http=e,this.$rootScope=t,this.siteInfo=i,this.$scope=n,this.fellowResidents=o,this.$timeout=s,this.isLoading=!1,this.viewingThread=null,this.showCreateNewModal=!1,this.showBoardOnly=!1,this.archivedThreads=null,this.canCreateThreads=!1,this.isDiscussionEmailEnabled=!0,this.isPremiumPlanActive=!1}return e.prototype.$onInit=function(){var i=this;this.isPremiumPlanActive=this.siteInfo.privateSiteInfo.isPremiumPlanActive,this.canCreateThreads=this.siteInfo.userInfo.isAdmin||this.siteInfo.userInfo.isSiteManager,this.canCreateThreads||(this.committeeId?this.fellowResidents.isCommitteeMember(this.committeeId,this.siteInfo.userInfo.userId).then(function(e){return i.canCreateThreads=e}):this.siteInfo.privateSiteInfo.whoCanCreateDiscussionThreads&&"everyone"!==this.siteInfo.privateSiteInfo.whoCanCreateDiscussionThreads?"board"===this.siteInfo.privateSiteInfo.whoCanCreateDiscussionThreads&&(this.canCreateThreads=this.siteInfo.userInfo.isSiteManager||0!==this.siteInfo.userInfo.boardPosition):this.canCreateThreads=!0),this.showBoardOnly=this.siteInfo.userInfo.isSiteManager||0!==this.siteInfo.userInfo.boardPosition,this.editComment={commentText:"",replyToCommentId:null},this.$scope.$on("refreshCommentThreadList",function(e,t){return i.refreshCommentThreads(!1)}),this.refreshCommentThreads(!1)},e.prototype.setDisplayCreateModal=function(e){this.showCreateNewModal=e,this.newThreadTitle="",this.newThreadBody="",this.newThreadIsBoardOnly=!1,this.newThreadIsReadOnly=!1,this.shouldSendNoticeForNewThread=!0,this.newThreadErrorMessage="",e&&setTimeout(function(){return $("#new-thread-title-text-box").focus()},100)},e.prototype.displayDiscussModal=function(e){this.viewingThread=e},e.prototype.hideDiscussModal=function(){this.viewingThread=null},e.prototype.onClickPin=function(e){var t=this;this.isLoading=!0,this.$http.put("/api/CommentThread/TogglePinned/"+e.commentThreadId,null).then(function(e){t.isLoading=!1,t.refreshCommentThreads()},function(e){t.isLoading=!1,alert("Failed to toggle: "+e.data.exceptionMessage)})},e.prototype.createNewThread=function(){var t=this;this.isLoading=!0,this.newThreadErrorMessage=null;var e={title:this.newThreadTitle,body:this.newThreadBody,isBoardOnly:this.newThreadIsBoardOnly,isReadOnly:this.newThreadIsReadOnly,shouldSendNotice:this.shouldSendNoticeForNewThread,committeeId:this.committeeId};this.$http.post("/api/CommentThread",e).then(function(e){t.isLoading=!1,t.showCreateNewModal=!1,t.refreshCommentThreads(!1)},function(e){t.isLoading=!1,t.newThreadErrorMessage=e.data.exceptionMessage})},e.prototype.refreshCommentThreads=function(i){var n=this;void 0===i&&(i=!1),this.isLoading=!0;var e="/api/CommentThread";i&&(e+="/Archived"),this.committeeId&&(e+="?committeeId="+this.committeeId),this.$http.get(e).then(function(e){if(n.isLoading=!1,e.data=_.sortBy(e.data,function(e){return e.pinnedDateUtc?e.pinnedDateUtc:moment(e.lastCommentDateUtc).subtract(100,"years").toDate()}).reverse(),i)n.archivedThreads=e.data;else if(n.commentThreads=e.data,n.archivedThreads=null,n.autoOpenThreadId){var t=_.find(n.commentThreads,function(e){return e.commentThreadId===n.autoOpenThreadId});t&&n.$timeout(function(){return n.displayDiscussModal(t)},125),n.autoOpenThreadId=null}},function(e){n.isLoading=!1})},e.$inject=["$http","$rootScope","SiteInfo","$scope","fellowResidents","$timeout"],e}();e.GroupCommentThreadsController=i}(Ally||(Ally={})),CA.angularApp.component("groupCommentThreads",{bindings:{committeeId:"<?",autoOpenThreadId:"<?"},templateUrl:"/ngApp/services/group-comment-threads.html",controller:Ally.GroupCommentThreadsController}),function(e){var t=function(){};e.Comment=t;var i=function(){function e(e,t){this.$http=e,this.$rootScope=t,this.isLoading=!1,this.showDiscussModal=!1}return e.prototype.$onInit=function(){this.isQaSite=!1,this.threadId||(this.threadId="Home"),this.editComment={threadId:this.threadId,commentText:"",replyToCommentId:null},this.refreshComments()},e.prototype.displayDiscussModal=function(){this.showDiscussModal=!0},e.prototype.hideDiscussModal=function(){this.showDiscussModal=!1},e.prototype.refreshComments=function(){var i=this;this.isLoading=!0,this.$http.get("/api/Comment?threadId="+this.threadId).then(function(e){i.isLoading=!1,i.commentList=e.data;var t=function(e){e.isMyComment=e.authorUserId===i.$rootScope.userInfo.userId,e.replies&&_.each(e.replies,t)};_.each(i.commentList,t)},function(e){i.isLoading=!1})},e.prototype.postComment=function(e){var t=this;this.isLoading=!0;var i=this.$http.post;"number"==typeof e.existingCommentId&&(i=this.$http.put),i("/api/Comment",e).then(function(){t.isLoading=!1,t.editComment={},t.showReplyBoxId=-1,t.refreshComments()},function(e){t.isLoading=!1,alert("Failed to post comment: "+e.data.exceptionMessage)})},e.prototype.onPostCommentClicked=function(){if(0!==this.editComment.commentText.length){var e={threadId:this.threadId,commentText:this.editComment.commentText,replyToCommentId:null,existingCommentId:this.editComment.existingCommentId};this.postComment(e)}},e.prototype.editMyComment=function(e){this.editComment={commentText:e.commentText,existingCommentId:e.commentId}},e.prototype.deleteMyComment=function(e){this.isLoading=!0,this.$http.delete("/api/Comment?commentId="+e.commentId).then(function(){this.isLoading=!1,this.refreshComments()},function(e){this.isLoading=!1;var t=e.data.exceptionMessage?e.data.exceptionMessage:e.data;alert("Failed to post comment: "+t)})},e.prototype.onPostReplyCommentClicked=function(){if(0!==this.editComment.replyText.length){var e={threadId:this.threadId,commentText:this.editComment.replyText,replyToCommentId:this.editComment.replyToCommentId};this.postComment(e)}},e.prototype.clickReplyToComment=function(e){this.showReplyBoxId=e,this.editComment={commentText:"",replyToCommentId:e}},e.$inject=["$http","$rootScope"],e}();e.GroupCommentsController=i}(Ally||(Ally={})),CA.angularApp.component("groupComments",{bindings:{threadId:"@?"},templateUrl:"/ngApp/services/group-comments.html",controller:Ally.GroupCommentsController}),function(e){var t=function(){function o(){}return o.convertStringsToDates=function(e){if($.isArray(e)&&o.convertDatesFromArray(e),o.isObject(e))for(var t in e){var i=e[t];if(o.isObject(i))o.convertStringsToDates(i);else if($.isArray(i))o.convertDatesFromArray(i);else if(o.isString(i)&&10<i.length&&o.dotNetTimeRegEx2.test(i)){var n=void 0;n=HtmlUtil.endsWith(t,"_UTC")||HtmlUtil.endsWith(t,"Utc")?o.serverUtcDateToLocal(i):new Date(i),e[t]=n}}},o.convertDatesFromArray=function(e){for(var t=0;t<e.length;t++){var i=e[t];o.isObject(i)?o.convertStringsToDates(i):o.isString(i)&&o.iso8601RegEx.test(i)&&(e[t]=new Date(i))}},o.isObject=function(e){return"[object Object]"===Object.prototype.toString.call(e)},o.isString=function(e){return"[object String]"===Object.prototype.toString.call(e)},o.isValidString=function(e){return!(!e||"string"!=typeof e)&&("null"!==e&&0<e.length)},o.serverUtcDateToLocal=function(e){return"string"!=typeof e?e:HtmlUtil.isNullOrWhitespace(e)?null:moment.utc(e).toDate()},o.showTooltip=function(e,t){$(e).qtip({style:{classes:"qtip-light qtip-shadow"},position:{my:"leftMiddle",at:"rightMiddle"},content:{text:t},events:{hide:function(e){$(e.originalEvent.currentTarget).qtip("destroy")}}}),$(e).qtip("show")},o.downloadCsv=function(e,t){o.downloadFile(e,t,"text/csv")},o.downloadXml=function(e,t){o.downloadFile(e,t,"text/xml")},o.downloadFile=function(e,t,i){if("undefined"!=typeof Blob){var n=document.createElement("a");document.body.appendChild(n),n.style.display="none";var o=new Blob([e],{type:i}),s=window.URL.createObjectURL(o);n.href=s,n.download=t,n.click(),window.URL.revokeObjectURL(s)}else{var a=encodeURI("data:"+i+";charset=utf-8,"+e),r=document.createElement("a");r.setAttribute("href",a),r.setAttribute("download",t),document.body.appendChild(r),r.click(),setTimeout(function(){document.body.removeChild(r)},500)}},o.startsWithNumber=function(e,t){if(void 0===t&&(t=!0),HtmlUtil.isNullOrWhitespace(e))return!1;t&&(e=e.trim());var i=e.search(/\s/);return-1===i&&(i=e.length),e=e.substring(0,i-1),HtmlUtil.isNumericString(e)},o.isAndroid=function(){return-1<navigator.userAgent.toLowerCase().indexOf("android")},o.copyTextToClipboard=function(e){var t=document.createElement("textarea");t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.width="2em",t.style.height="2em",t.style.padding="0",t.style.border="none",t.style.outline="none",t.style.boxShadow="none",t.style.background="transparent",t.value=e,document.body.appendChild(t),t.focus(),t.select();var i=!1;try{var n=document.execCommand("copy"),o=n?"successful":"unsuccessful";console.log("Copying text command was "+o),i=n}catch(e){console.log("Oops, unable to copy")}return document.body.removeChild(t),i},o.smartSortStreetAddresses=function(e,a){if(!e||0===e.length)return e;if(_.every(e,function(e){return HtmlUtil.isNumericString(e[a])}))return _.sortBy(e,function(e){return+e[a]});var t=e[0][a].substr(e[0][a].indexOf(" ")),i=_.every(e,function(e){return o.startsWithNumber(e[a])}),n=_.every(e,function(e){return HtmlUtil.endsWith(e[a],t)});if(i&&n)return _.sortBy(e,function(e){return parseInt(e[a].substr(0,e[a].indexOf(" ")))});if(i){var r=function(e){return e.substring(e.search(/\s/)+1)};return e.sort(function(e,t){return i=e[a],n=t[a],o=r(i),s=r(n),o!==s?o.localeCompare(s):parseInt(i.substr(0,i.search(/\s/)))-parseInt(n.substr(0,n.search(/\s/)));var i,n,o,s})}return _.sortBy(e,function(e){return e[a]})},o.iso8601RegEx=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$/,o.dotNetTimeRegEx2=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z?$/,o}();e.HtmlUtil2=t;var i=function(){};e.ExceptionResult=i}(Ally||(Ally={})),function(e){var t=function(){function e(){}return e.prototype.getTitle=function(){return this.project?this.project.title:this.todo.description},e.prototype.getTypeName=function(){return this.project?"Maintenance Record":"To-Do"},e.prototype.getAuthorName=function(){return this.project?this.project.creatorFullName:this.todo.addedByFullName},e.prototype.getCreatedDate=function(){return this.project?this.project.createDateUtc:this.todo.addedDateUtc},e}();e.MaintenanceEntry=t;var i=function(){function e(e,t,i){this.$http=e,this.$q=t,this.$cacheFactory=i}return e.prototype.loadProjects=function(){var t=this;return this.$http.get("/api/Maintenance/Projects").then(function(e){return e.data},function(e){return t.$q.reject(e.data)})},e}();e.MaintenanceService=i}(Ally||(Ally={})),angular.module("CondoAlly").service("maintenance",["$http","$q","$cacheFactory",Ally.MaintenanceService]),function(e){var t=function(){function e(e,t,i){this.$rootScope=e,this.fellowResidents=t,this.siteInfo=i,this.shouldShowSendModal=!1,this.shouldShowButtons=!1,this.isSending=!1,this.messageBody="",this.messageSubject="",this.sendResultIsError=!1,this.isPremiumPlanActive=!1,this.isSendingToSelf=!1,this.messageSubject=i.userInfo.fullName+" has sent you a message via your "+AppConfig.appName+" site"}return e.prototype.$onInit=function(){this.isPremiumPlanActive=this.siteInfo.privateSiteInfo.isPremiumPlanActive,this.isSendingToSelf=this.recipientInfo.userId===this.siteInfo.userInfo.userId},e.prototype.showSendModal=function(){this.shouldShowSendModal=!0,this.sendResultMessage="",this.shouldShowButtons=!0,this.isPremiumPlanActive&&setTimeout(function(){return document.getElementById("message-text-box").focus()},100)},e.prototype.hideModal=function(){this.shouldShowSendModal=!1,this.messageBody=""},e.prototype.sendMessage=function(){var t=this;this.shouldShowButtons=!1,this.isSending=!0,this.sendResultMessage="",this.fellowResidents.sendMessage(this.recipientInfo.userId,this.messageBody,this.messageSubject).then(function(e){t.isSending=!1,t.sendResultIsError=!1,t.messageBody="",t.sendResultMessage="Message sent successfully!"},function(e){t.shouldShowButtons=!0,t.isSending=!1,t.sendResultIsError=!0,t.sendResultMessage="Failed to send: "+e.data.exceptionMessage})},e.$inject=["$rootScope","fellowResidents","SiteInfo"],e}();e.SendMessageController=t}(Ally||(Ally={})),CA.angularApp.component("sendMessage",{bindings:{recipientInfo:"="},templateUrl:"/ngApp/services/send-message.html",controller:Ally.SendMessageController}),angular.module("CondoAlly").directive("ngEnter",function(){return function(t,e,i){e.bind("keydown keypress",function(e){13===e.which&&(t.$apply(function(){t.$eval(i.ngEnter,{event:e})}),e.preventDefault())})}}),angular.module("CondoAlly").directive("ngEscape",function(){return function(t,e,i){e.bind("keydown keypress",function(e){27===e.which&&(t.$apply(function(){t.$eval(i.ngEscape,{event:e})}),e.preventDefault())})}}),angular.module("CondoAlly").directive("imageonload",function(){return{restrict:"A",link:function(t,e,i){e.bind("load",function(e){i.imageonload&&t.$apply(i.imageonload)})}}}),angular.module("CondoAlly").directive("imageonerror",function(){return{restrict:"A",link:function(t,e,i){e.bind("error",function(e){i.imageonerror&&t.$apply(i.imageonerror)})}}}),angular.module("CondoAlly").directive("onFileChange",function(){return{restrict:"A",link:function(t,e,i){e.bind("change",function(e){t.$apply(function(){t.$eval(i.onFileChange,{$event:e})}),e.preventDefault()})}}}),CA.angularApp.filter("iif",function(){return function(e,t,i){return e?t:i}}),CA.angularApp.filter("tel",function(){return function(e){if(!e)return"";var t,i,n,o=e.toString().trim().replace(/^\+/,"");if(o.match(/[^0-9]/))return e;switch(o.length){case 7:t=1,i="",n=o;break;case 10:t=1,i=o.slice(0,3),n=o.slice(3);break;case 11:t=o[0],i=o.slice(1,4),n=o.slice(4);break;case 12:t=o.slice(0,3),i=o.slice(3,5),n=o.slice(5);break;default:return i="",e}return 1===t&&(t=""),n=n.slice(0,3)+"-"+n.slice(3),0<i.length&&(i="("+i+")"),(t+" "+i+" "+n).trim()}}),CA.angularApp.filter("filesize",function(){return function(e){return isNaN(e)&&(e=0),e<1024?e+" bytes":(e/=1024)<1024?e.toFixed(2)+" KB":(e/=1024)<1024?e.toFixed(2)+" MB":(e/=1024)<1024?e.toFixed(2)+" GB":(e/=1024).toFixed(2)+" TB"}});var Ally;__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}}();function ManageMembersCtrl(i,n,e,t,n){i.members=[],i.newMember={boardPosition:0,isRenter:!1},i.editUser=null,i.setEdit=function(e){if(i.sentWelcomeEmail=!1,null!==e){i.editUserForm.$setPristine();var t=jQuery.extend({},e);i.editUser=t,i.memberGridOptions.selectAll(!1),setTimeout("$( '#edit-user-first-text-box' ).focus();",100)}else i.editUser=null},i.onSendWelcome=function(){i.isSavingUser=!0,n.put("/api/Member/"+i.editUser.userId+"/SendWelcome").then(function(){i.isSavingUser=!1,i.sentWelcomeEmail=!0},function(){alert("Failed to send the welcome e-mail, please contact support if this problem persists."),i.isSavingUser=!1})};$resource("/api/Member",null,{update:{method:"PUT"}});var o={fields:["lastName"],directions:["asc"]},s=o;if(window.localStorage){var a=window.localStorage.getItem("memberSort");a&&(s=JSON.parse(a)),0===s.fields.length&&(s=o),t(function(){var e={fields:i.memberGridOptions.sortInfo.fields,directions:i.memberGridOptions.sortInfo.directions};window.localStorage.setItem("memberSort",JSON.stringify(e))},2e3)}i.memberGridOptions={data:"members",plugins:[new ngGridFlexibleHeightPlugin],columnDefs:[{field:"firstName",displayName:"First Name",cellClass:"resident-cell-first"},{field:"lastName",displayName:"Last Name",cellClass:"resident-cell-last"},{field:"email",displayName:"E-mail",cellClass:"resident-cell-email"},{field:"isSiteManager",displayName:"Admin",width:60,cellClass:"resident-cell-site-manager",cellTemplate:'<div style="text-align:center; padding-top: 8px;"><input type="checkbox" disabled="disabled" ng-checked="row.getProperty(col.field)"></div>'},{field:"phoneNumber",displayName:"Phone Number",width:150,cellClass:"resident-cell-phone",cellTemplate:'<div class="ngCellText" ng-class="col.colIndex()"><span ng-cell-text>{{ row.getProperty(col.field) | tel }}</span></div>'}],afterSelectionChange:function(e){e.selected&&i.setEdit(e.entity)},sortInfo:s,multiSelect:!1},i.refresh=function(){i.isLoading=!0,n.get("/api/Member/Watch").then(function(e){i.members=e.data,_.forEach(i.members,function(e){e.fullName=e.firstName+" "+e.lastName,"string"==typeof e.email&&-1!==e.email.indexOf("@condoally.com")&&(e.email="")}),i.isLoading=!1})},i.onSaveMember=function(){if(null!=i.editUser&&($("#editUserForm").validate(),$("#editUserForm").valid())){i.isSavingUser=!0;var e=function(){i.editUser=null,i.isSavingUser=!1,i.refresh()},t=e;i.editUser.userId?n.put("/api/Member",i.editUser).then(e,t):n.post("/api/Member",i.editUser).then(e,t)}},i.OnAdminSetPassword=function(){var e={userName:i.adminSetPass_Username,password:i.adminSetPass_Password};n.post("/api/AdminHelper/SetPassword",e).then(function(e){i.adminSetPass_ResultMessage=e.data},function(){})},i.onDeleteMember=function(){confirm("Are you sure you want to remove this person from your neighborhood watch group?")&&n.delete("/api/Member",{userId:i.editUser.userId,unitId:i.editUser.unitId}).then(function(){i.editUser=null,i.refresh()})},i.onSendAllWelcome=function(){i.isLoading=!0,n.put("/api/Member?userId&action=launchsite").then(function(){i.isLoading=!1,i.sentWelcomeEmail=!0,i.allEmailsSent=!0},function(){alert("Failed to send welcome e-mail, please contact support if this problem persists."),i.isLoading=!1})},i.refresh()}function WatchSettingsCtrl(e,t,i,n){var o=this;o.settings={},o.defaultBGImage=$(document.documentElement).css("background-image"),o.showQaButton="president@mycondoally.com"===t.userInfo.emailAddress;var s=i("/api/Settings",null,{update:{method:"PUT"}});o.refreshData=function(){o.isLoading=!0,o.settings=s.get(function(){o.isLoading=!1})},o.onSiteTitleChange=function(){o.isLoading=!0,s.update({siteTitle:o.settings.siteTitle},function(){location.reload(),o.isLoading=!1})},o.onWelcomeMessageUpdate=function(){o.isLoading=!0,s.update({welcomeMessage:o.settings.welcomeMessage},function(){n.privateSiteInfo.welcomeMessage=o.settings.welcomeMessage,o.isLoading=!1})},o.onImageClick=function(e){o.settings.bgImageFileName=e,SettingsJS._defaultBG=e,s.update({BGImageFileName:o.settings.bgImageFileName},function(){$(".test-bg-image").removeClass("test-bg-image-selected"),$("img[src='"+t.bgImagePath+e+"']").addClass("test-bg-image-selected"),o.isLoading=!1})},o.onImageHoverOver=function(e){$(document.documentElement).css("background-image","url("+t.bgImagePath+e+")")},o.onImageHoverOut=function(){"string"==typeof o.settings.bgImageFileName&&0<o.settings.bgImageFileName.length?$(document.documentElement).css("background-image","url("+t.bgImagePath+o.settings.bgImageFileName+")"):$(document.documentElement).css("background-image",o.defaultBGImage)},o.onQaDeleteSite=function(){e.get("/api/QA/DeleteThisAssociation").then(function(){location.reload()},function(e){alert("Failed to delete site: "+e.data.message)})},o.mapInstance=new google.maps.Map(document.getElementById("map-canvas"),o.mapInfo),o.refreshData()}function WatchCalendarCtrl(a,e,r,i,t){var l="YYYY-MM-DD",d="12:37am";a.today=new Date;var n={height:600,editable:!1,header:{left:"month agendaWeek",center:"title",right:"today prev,next"},viewRender:function(e,t){i.isSiteManager&&$(t).css("cursor","pointer")},dayClick:function(e){if(i.isSiteManager){var t=moment(moment.utc(e).format(l)).toDate();a.$apply(function(){a.setEditEvent({date:t,dateOnly:t,associatedUserIds:[]})})}},eventClick:function(e){a.$apply(function(){e.calendarEventObject&&a.setEditEvent(e.calendarEventObject,!0)})},eventRender:function(e,t){$(t).css("cursor","default"),$(t).qtip({style:{classes:"qtip-light qtip-shadow"},content:{text:e.fullDescription,title:e.toolTipTitle}})},eventSources:[{events:function(e,t,i,o){a.isLoadingCalendarEvents=!0;var n=e.format(l),s=t.format(l);r.get("/api/CalendarEvent?startDate="+n+"&endDate="+s).then(function(e){var n=[],t=e.data;a.isLoadingCalendarEvents=!1,_.each(t,function(e){e.timeOnly=moment.utc(e.date).format("h:mma"),e.dateOnly=e.date,e.timeOnly==d&&(e.timeOnly="");var t=e.title;17<t.length&&(t=t.substring(0,17)+"...");var i="Posted by: "+e.authorName+"<br><p>"+e.title+"</p>";n.push({title:t,start:e.date.substring(0,10),toolTipTitle:"Event",fullDescription:i,calendarEventObject:e})}),o(n)},function(){a.isLoadingCalendarEvents=!1})}}]};$(document).ready(function(){$(".EditableEntry").editable("<%= Request.Url %>",{id:"EditEntryId",type:"textarea",cancel:"Cancel",submit:"Ok"}),$("#log-calendar").fullCalendar(n)}),a.onResidentClicked=function(e){_.contains(a.editEvent.associatedUserIds,e)?a.editEvent.associatedUserIds=_.without(a.editEvent.associatedUserIds,e):a.editEvent.associatedUserIds.push(e)},a.isUserAssociated=function(e){return!(!a.editEvent||!a.editEvent.associatedUserIds)&&_.contains(a.editEvent.associatedUserIds,e)},a.expandCalendarEventModel=function(){a.showExpandedCalendarEventModel=!0},a.setEditEvent=function(e,t){a.showExpandedCalendarEventModel=t||!1,(a.editEvent=e)&&setTimeout(function(){$("#calendar-event-title").focus()},10)},a.deleteCalendarEvent=function(e){confirm("Are you sure you want to remove this calendar event?")&&(a.isLoadingCalendarEvents=!0,r.delete("/api/CalendarEvent?eventId="+e).then(function(){a.isLoadingCalendarEvents=!1,a.editEvent=null,a.onlyRefreshCalendarEvents=!0,$("#log-calendar").fullCalendar("refetchEvents")},function(){a.isLoadingCalendarEvents=!1,alert("Failed to delete the calendar event.")}))},a.saveCalendarEvent=function(){var e,t="";t="string"==typeof a.editEvent.timeOnly&&1<a.editEvent.timeOnly.length?moment.utc(a.editEvent.date).format(l)+" "+a.editEvent.timeOnly:moment.utc(a.editEvent.date).format(l)+" "+d,a.editEvent.date=moment.utc(t,l+" h:mma").toDate(),e=a.editEvent.eventId?r.put:r.post,a.isLoadingCalendarEvents=!0,e("/api/CalendarEvent",a.editEvent).then(function(){a.isLoadingCalendarEvents=!1,a.editEvent=null,a.onlyRefreshCalendarEvents=!0,$("#log-calendar").fullCalendar("refetchEvents")},function(){a.isLoadingCalendarEvents=!1})},a.onDeleteItem=function(e){confirm("Are you sure you want to delete this information?")&&(a.isLoading=!0,LogEntryResource.delete({logEntryId:e.logEntryId},function(){a.RetrieveItems()}))},$("#calendar-event-time").timepicker({scrollDefault:"10:00am"})}function WatchHomeCtrl(e,t,i){var n=this,o=t("/api/Watch/Home"),s=t("https://localnewsally.azurewebsites.net/api/LocalNews",null,{cache:!0});n.refreshData=function(){n.isLoading=!0,n.watchMembers=o.get(function(){n.isLoading=!1})},s.query({clientId:"1001A194-B686-4C45-80BC-ECC0BB4916B4",chicagoWard:i.publicSiteInfo.chicagoWard,zipCode:i.privateSiteInfo.zipCode,cityNeighborhood:i.publicSiteInfo.localNewsNeighborhoodQuery},function(e){n.localNews=e,n.isLoading_LocalNews=!1})}function WatchMembersCtrl(e,t,i){var o=this,n=t("/api/Watch/MemberList");o.refreshData=function(){o.isLoading=!0,o.memberList=n.query(function(){var e,i,n;o.isLoading=!1,o.housePolys=(e=o.memberList,i=[],n=[],_.each(e,function(t){t.houseGpsBounds&&(_.some(i,function(e){return e==t.addressId})||(i.push(t.addressId),n.push(t.houseGpsBounds)))}),n)})},o.mapCenter=i.privateSiteInfo.gpsPosition,o.groupBounds=i.publicSiteInfo.gpsBounds,o.refreshData()}!function(t){var e=function(){};t.UsersHome=e;var i=function(){};t.PayPeriod=i;var n=function(){};t.UserInfo=n;var o=function(){};t.PublicSiteInfo=o;var s=function(){};t.RecentPayment=s;var a=function(){},r=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t}(t.PrivateSiteInfo=a);t.ChtnPrivateSiteInfo=r;var l=function(){function e(){this.publicSiteInfo=new o,this.privateSiteInfo=new r,this.userInfo=new t.UserInfo,this.isLoggedIn=!1}return e.prototype.refreshSiteInfo=function(t,i,e){var n=this;this._rootScope=t;var o=e.defer();if(t.isLoadingSite=!0,"login"===HtmlUtil.getSubdomain())return t.isLoadingSite=!1,this.handleSiteInfo(null,t),o.resolve(),o.promise;var s=function(e){t.isLoadingSite=!1,n.handleSiteInfo(e,t),o.resolve(e)},a=function(){t.isLoadingSite=!1,o.reject()},r="https://0.webappapi.communityally.org/api/GroupSite";return i.get(r).then(function(t){t.data&&!t.data.userInfo?n.xdLocalStorage.getItem("allyApiAuthToken").then(function(e){e&&HtmlUtil.isValidString(e.value)?(n.setAuthToken(e.value),i.get(r).then(function(e){s(e.data)},a)):s(t.data)},function(){s(t.data)}):s(t.data)},a),o.promise},e.prototype.testIfIsNeutralPage=function(t){return!!HtmlUtil.startsWith(t,"#!/")&&(t="/"+t.substring("#!/".length),"object"==typeof _.find(AppConfig.menu,function(e){return e.path===t}))},e.prototype.handleSiteInfo=function(e,t){var i=HtmlUtil.getSubdomain(window.location.host);if(!this.authToken&&t.authToken&&this.setAuthToken(t.authToken),null===e||"null"===e||""===e){var n=null===i||"www"===i||"login"===i,o=this.testIfIsNeutralPage(window.location.hash);if(!n||!o)return void GlobalRedirect("https://login."+AppConfig.baseTld+"/#!/Login");(e={}).publicSiteInfo={bgImagePath:"",fullName:AppConfig.appName,siteLogo:"<span style='font-size: 22pt; color: #FFF;'>Welcome to "+AppConfig.appName+"</span>",baseApiUrl:"https://0.webappapi.communityally.org/api/"}}t.publicSiteInfo=e.publicSiteInfo,this.publicSiteInfo=e.publicSiteInfo;var s=e.privateSiteInfo;if(s||(s={}),this.privateSiteInfo=s,this.privateSiteInfo.gpsPosition&&"undefined"!=typeof google&&(this.privateSiteInfo.googleGpsPosition=new google.maps.LatLng(this.privateSiteInfo.gpsPosition.lat,this.privateSiteInfo.gpsPosition.lon)),document.title=this.publicSiteInfo.fullName,t.isPremiumPlanActive=this.privateSiteInfo.isPremiumPlanActive,t.isPremiumPlanTrial=moment().isBefore(moment(this.privateSiteInfo.creationDate).add(3,"months")),this.userInfo=e.userInfo,t.userInfo=e.userInfo,HtmlUtil.isLocalStorageAllowed()&&window.localStorage.setItem("siteInfo",angular.toJson(this.publicSiteInfo)),this.isLoggedIn=null!==t.userInfo&&void 0!==t.userInfo,t.isLoggedIn=this.isLoggedIn,HtmlUtil.isNullOrWhitespace(this.publicSiteInfo.bgImagePath)||$(document.documentElement).css("background-image","url("+t.bgImagePath+this.publicSiteInfo.bgImagePath+")"),this.isLoggedIn)"undefined"!=typeof $zopim&&$zopim(function(){$zopim.livechat.setName(t.userInfo.firstName+" "+t.userInfo.lastName),-1!==t.userInfo.emailAddress.indexOf("@")&&$zopim.livechat.setEmail(t.userInfo.emailAddress)}),t.isAdmin=t.userInfo.isAdmin,t.isSiteManager=t.userInfo.isSiteManager,"undefined"!=typeof analytics&&analytics.identify(t.userInfo.emailAddress,{name:t.userInfo.fullName});else{t.userInfo=null;var a="#!/Login";if(window.location.hash!=a&&!AppConfig.isPublicRoute(window.location.hash)){if(this.publicSiteInfo&&this.publicSiteInfo.baseUrl)return window.location.hash&&"#!/Home"!==window.location.hash&&(window.sessionStorage[AppCacheService.KeyPrefix+AppCacheService.Key_AfterLoginRedirect]=window.location.hash.substr(2),window.sessionStorage[AppCacheService.KeyPrefix+AppCacheService.Key_WasLoggedIn401]="true"),void(window.location.hash=a);GlobalRedirect("https://login."+AppConfig.baseTld+a)}}this.publicSiteInfo.baseUrl&&"login"===i&&(null!==i&&i===this.publicSiteInfo.shortName||!HtmlUtil.isNullOrWhitespace(OverrideBaseApiPath)||GlobalRedirect(this.publicSiteInfo.baseUrl+"/#!/Home"))},e.prototype.setAuthToken=function(e){window.localStorage&&window.localStorage.setItem("ApiAuthToken",e),this._rootScope.authToken=e,this.xdLocalStorage.setItem("allyApiAuthToken",e).then(function(e){}),this.authToken=e},e.AlwaysDiscussDate=new Date(2018,7,1),e}();t.SiteInfoService=l;var d=function(){function e(){}return e.loginInit=function(e,t,i,n,o){var s=e.defer();return c.siteInfo.xdLocalStorage=o,c.isSiteInfoLoaded?s.resolve(c.siteInfo):c.siteInfo.refreshSiteInfo(i,t,e).then(function(){c.isSiteInfoLoaded=!0,i.isSiteInfoLoaded=!0,i.siteTitle={text:i.publicSiteInfo.siteTitleText},i.publicSiteInfo.siteLogo&&(i.siteTitle.logoHtml=n.trustAsHtml(i.publicSiteInfo.siteLogo)),i.onUpdateSiteTitleText=function(){analytics.track("updateSiteTitle"),t.put("/api/Settings",{siteTitle:i.siteTitle.text})},s.resolve(c.siteInfo)}),s.promise},e}();t.SiteInfoHelper=d;var c=function(){function e(){}return e.prototype.$get=function(){return e.isSiteInfoLoaded||console.log("Not yet loaded!"),e.siteInfo},e.isSiteInfoLoaded=!1,e.siteInfo=new t.SiteInfoService,e}();t.SiteInfoProvider=c}(Ally||(Ally={})),angular.module("CondoAlly").provider("SiteInfo",Ally.SiteInfoProvider),function(a){var t=function(){};a.TodoItem=t;var e=function(){};a.TodoList=e;var i=function(){function e(e,t,i){this.$http=e,this.siteInfo=t,this.fellowResidents=i,this.todoLists=[],this.isLoading=!1,this.newListName="",this.isFixedList=!1,this.shouldExpandTodoItemModal=!1,this.canManage=!1}return e.prototype.$onInit=function(){var t=this;this.isFixedList=!!this.fixedTodoListId,this.isFixedList?this.loadFixedTodoList():this.loadAllTodoLists(),this.canManage=this.siteInfo.userInfo.isAdmin||this.siteInfo.userInfo.isSiteManager,this.committee&&!this.canManage&&this.fellowResidents.isCommitteeMember(this.committee.committeeId,this.siteInfo.userInfo.userId).then(function(e){return t.canManage=e})},e.prototype.loadFixedTodoList=function(){var t=this;this.isLoading=!0,this.$http.get("/api/Todo/List/"+this.fixedTodoListId).then(function(e){t.isLoading=!1,t.todoLists=[e.data]})},e.prototype.loadAllTodoLists=function(){var t=this;this.isLoading=!0;var e="/api/Todo";this.committee&&(e="/api/Todo/ListsForCommittee/"+this.committee.committeeId),this.$http.get(e).then(function(e){t.isLoading=!1,t.todoLists=e.data})},e.prototype.onAddList=function(){var t=this;this.isLoading=!0;var e="/api/Todo/newList?listName="+encodeURIComponent(this.newListName);this.committee&&(e+="&committeeId="+this.committee.committeeId),this.$http.post(e,null).then(function(){t.isLoading=!1,t.newListName="",t.loadAllTodoLists()},function(e){t.isLoading=!1,alert("Failed to create: "+e.data.exceptionMessage)})},e.prototype.onAddItem=function(e){var t=this;this.isLoading=!0;var i="/api/Todo/newItem/"+e+"?description="+encodeURIComponent(this.newItemDescription);this.$http.post(i,null).then(function(e){t.isLoading=!1,t.newItemDescription="",t.loadAllTodoLists()},function(e){t.isLoading=!1,alert("Failed to create: "+e.data.exceptionMessage)})},e.prototype.addNewItem=function(e){this.editTodoItem=new t,this.editTodoItem.owningTodoListId=e,this.committee&&(this.editTodoItem.owningTodoListId=e),this.shouldExpandTodoItemModal=!1,window.setTimeout(function(){return $("#edit-todo-name-text-box").focus()},100)},e.prototype.saveTodoItem=function(){var t=this;this.isLoading=!0;this.$http.post("/api/Todo/Item",this.editTodoItem).then(function(e){t.isLoading=!1,t.newItemDescription="",t.editTodoItem=null,t.loadAllTodoLists()},function(e){t.isLoading=!1,alert("Failed to create: "+e.data.exceptionMessage)})},e.prototype.onToggleComplete=function(e,t){var i=this;this.isLoading=!0,this.$http.put("/api/Todo/toggleComplete/"+e+"/"+t,null).then(function(e){i.isLoading=!1,i.loadAllTodoLists()},function(e){i.isLoading=!1,alert("Failed to toggle: "+e.data.exceptionMessage)})},e.prototype.deleteTodoItem=function(e){var t=this;this.isLoading=!0,this.$http.delete("/api/Todo/Item/"+e.todoItemId).then(function(e){t.isLoading=!1,t.loadAllTodoLists()},function(e){t.isLoading=!1,alert("Failed to delete: "+e.data.exceptionMessage)})},e.prototype.deleteTodoList=function(e){var t=this;0<e.todoItems.length&&!confirm("Are you sure you want to delete this list with active to-dos?")||(this.isLoading=!0,this.$http.delete("/api/Todo/List/"+e.todoListId).then(function(e){t.isLoading=!1,t.loadAllTodoLists()},function(e){t.isLoading=!1,alert("Failed to delete: "+e.data.exceptionMessage)}))},e.prototype.exportAllToCsv=function(){"undefined"!=typeof analytics&&analytics.track("exportTodoListCsv"),this.todoLists[0].todoItems[0].completedByFullName;for(var e=[{headerText:"List",fieldName:"owningTodoListName"},{headerText:"Description",fieldName:"description"},{headerText:"Due Date",fieldName:"dueDate",dataMapper:function(e){return e?moment(e).format("YYYY-MM-DD"):""}},{headerText:"Added On",fieldName:"addedDateUtc"},{headerText:"Added By",fieldName:"addedByFullName"},{headerText:"Completed On",fieldName:"completedDateUtc"},{headerText:"Completed By",fieldName:"completedByFullName"}],t="",i=0;i<this.todoLists.length;++i){for(var n=this.todoLists[i],o=0;o<n.todoItems.length;++o)n.todoItems[o].owningTodoListName=n.name;t+=a.createCsvString(n.todoItems,e,0===i)}var s="ToDos.csv";this.committee&&(s=this.committee.name.replace(/\W/g,"")+"_"+s),a.HtmlUtil2.downloadCsv(t,s)},e.$inject=["$http","SiteInfo","fellowResidents"],e}();a.TodoListCtrl=i}(Ally||(Ally={})),CA.angularApp.component("todoList",{bindings:{fixedTodoListId:"<?",committee:"<?"},templateUrl:"/ngApp/services/todo-list.html",controller:Ally.TodoListCtrl}),function(e){var t=function(){};(Ally||(Ally={})).ExceptionResult=t}(),ManageMembersCtrl.$inject=["$scope","$http","$rootScope","$interval","$http"],WatchSettingsCtrl.$inject=["$http","$rootScope","$resource","SiteInfo"],WatchCalendarCtrl.$inject=["$scope","$timeout","$http","$rootScope","$q"],WatchHomeCtrl.$inject=["$rootScope","$resource","SiteInfo"],WatchMembersCtrl.$inject=["$rootScope","$resource","SiteInfo"];