var __extends,Eco;(function(n){var t;(function(n){var t;(function(n){"use strict";var i=function(){function n(n,t,i,r,u,f,e){e.caseInsensitive(!0);n.config();i.setSiteKey(t.recaptchaPublicKey);i.setTheme("dark");u.interceptors.push(["$log","$q","ecCommonServices",function(n,t,i){function r(r){var u=i.formatErrorMessage(r),f=r.config?r.config.url:"";return n.error("ERROR "+r.status+": "+u+" ["+f+"]"),t.reject(r)}return{requestError:function(n){return r(n)},responseError:function(n){return r(n)}}}]);f.setPrefix("ecoPortal")}return n.$inject=["ecAuthServiceProvider","portalConfiguration","noCAPTCHAProvider","ecAppContext","$httpProvider","localStorageServiceProvider","$urlMatcherFactoryProvider"],n}(),t;n.EcAppHomeConfig=i;t=function(){function n(n,t,i,r,u,f,e,o,s,h){var l=this,c;this.$rootScope=n;u.toastr.options={closeButton:!1,debug:!1,positionClass:"toast-bottom-right",onclick:null,showDuration:300,hideDuration:1e3,timeOut:5e3,extendedTimeOut:1e3,showEasing:"swing",hideEasing:"linear",showMethod:"fadeIn",hideMethod:"fadeOut"};o.isLoggedIn()&&h.init(t,function(){o.logout()});n.unwrap=function(n){if(n&&n.then){var t=n;"$$v"in n||(t.$$v=undefined,t.then(function(n){t.$$v=n}));n=n.$$v}return n};n.$on("$stateChangeStart",function(t,i,r,u,f){n.busy.push(!0);angular.isFunction(n.stateChangeStartCallback)&&n.stateChangeStartCallback(t,i,r,u,f)});n.$on("$stateChangeSuccess",function(t,i,u,f){n.toStateName=i.name;n.fromStateName=f.name;s.setDocumentTitle(r.$current);setTimeout(function(){n.busy.pop()},100)});n.$on("$stateChangeError",function(){setTimeout(function(){n.busy.pop()},100)});n.safeApply=function(n){var t=l.$rootScope.$$phase;t==="$apply"||t==="$digest"?n&&typeof n=="function"&&n():l.$rootScope.$apply(n)};c=0;n.busy={};n.busy.push=function(i){i?c=1:c++;c===1&&setTimeout(function(){n.safeApply(function(){t.showBusy=!0})},10)};n.busy.pop=function(i){c--;(i||c<0)&&(c=0);c<1&&setTimeout(function(){n.safeApply(function(){t.showBusy=!1})},100)}}return n.$inject=["$rootScope","$scope","$log","$state","$window","$q","ecAppContext","ecAuthService","ecDocumentTitleService","ecIdleLogoutService","$urlRouter","$urlMatcherFactory"],n}();n.EcAppHomeController=t})(t=n.Main||(n.Main={}))})(t=n.Client||(n.Client={}))})(Eco||(Eco={}));angular.module("app",["ngAnimate","ngCookies","ngResource","ngSanitize","ngIdle","ngTable","ui.router","ui.bootstrap","LocalStorageModule","angularFileUpload","easypiechart","noCAPTCHA","ecAppConstants"]).config(Eco.Client.Main.EcAppHomeConfig).controller("ecMainAppController",Eco.Client.Main.EcAppHomeController),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.$state=n;this.parentWizardConfig&&this.parentWizardConfig.startPage!==this.$state.current.name&&this.$state.go(this.parentWizardConfig.startPage,{},{reload:!0,location:"replace"})}return Object.defineProperty(n.prototype,"currentPageNumber",{get:function(){var n=this.$state.current.name,t,i;if(!n.has(".p"))return 0;for(t=0,i=n.length-1;$.isNumeric(n[i]);)i-=1,t+=1;return n.last(t).toNumber()},enumerable:!0,configurable:!0}),n.prototype.canMoveNext=function(){return this.pageConfig?!!this.pageConfig.nextPage:!1},n.prototype.moveNext=function(){this.$state.go(this.pageConfig.nextPage,this.$state.params)},n.prototype.canMovePrev=function(){return this.pageConfig?!!this.pageConfig.prevPage:!1},n.prototype.movePrev=function(){this.$state.go(this.pageConfig.prevPage,this.$state.params)},Object.defineProperty(n.prototype,"parentData",{get:function(){return!this.$state||!this.$state.$current||!this.$state.$current.parent?undefined:this.$state.$current.parent.data},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"parentWizardConfig",{get:function(){return this.parentData?this.parentData.wizardConfig:undefined},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"wizardConfig",{get:function(){return this.$state.current.data.wizardConfig},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"pageConfig",{get:function(){return this.$state.current.data.pgCfg},enumerable:!0,configurable:!0}),n}();n.WizardControllerBase=t})(t=n.Controllers||(n.Controllers={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r,u){r===void 0&&(r={});u===void 0&&(u={});this.$resource=n;this.$q=t;var f={remove:{method:"DELETE",params:{oid:"@Oid"}},"delete":{method:"DELETE",params:{oid:"@Oid"}}};angular.extend(f,r);this.api=n("/api/"+i+"/:oid",u,f)}return n.prototype.create=function(){return new this.api},n.prototype.remove=function(n){return this.api.remove({oid:n})},n.prototype.delete=function(n){return this.api.remove({oid:n})},n.prototype.get=function(n){return this.api.get({oid:n})},n.prototype.query=function(){return this.api.query()},n.prototype.getOrCreate=function(n){if(n)return this.get(n).$promise;var t=this.$q.defer(),i=this.create();return t.resolve(i),t.promise},n}();n.ResourceServiceRestfulBase2=t})(t=n.Services||(n.Services={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={})),function(n){"use strict";var t,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d;(function(n){n[n.Search=0]="Search";n[n.FacilityDetail=1]="FacilityDetail";n[n.Programs=2]="Programs";n[n.Inspections=3]="Inspections";n[n.Violations=4]="Violations"})(t=n.PressAgentFunctionType||(n.PressAgentFunctionType={})),function(n){n[n.None=0]="None";n[n.fail=1]="fail";n[n.cancel=2]="cancel"}(i=n.ErrorCodes||(n.ErrorCodes={})),function(n){n[n.Important=0]="Important";n[n.Upcoming=1]="Upcoming";n[n.Information=2]="Information"}(r=n.DashboardTaskImportance||(n.DashboardTaskImportance={})),function(n){n[n.Default=0]="Default"}(u=n.CartStatus||(n.CartStatus={})),function(n){n[n.Important=10]="Important";n[n.Upcoming=20]="Upcoming";n[n.Information=30]="Information"}(f=n.DashboardItemStatusType||(n.DashboardItemStatusType={})),function(n){n[n.Linked=0]="Linked";n[n.Unlinked=1]="Unlinked"}(e=n.EnvisionConnectLinkStatuses||(n.EnvisionConnectLinkStatuses={})),function(n){n[n.None=0]="None";n[n.Mail=1]="Mail";n[n.Email=2]="Email"}(o=n.OwnerContactMethods||(n.OwnerContactMethods={})),function(n){n[n.SqlSearch=0]="SqlSearch";n[n.SqlProgram=1]="SqlProgram";n[n.SqlHeader=2]="SqlHeader";n[n.SqlInspection=3]="SqlInspection";n[n.SqlViolation=4]="SqlViolation";n[n.Unknown=-1]="Unknown"}(s=n.PressAgentSqlTypes||(n.PressAgentSqlTypes={})),function(n){n[n.HtmlSearch=0]="HtmlSearch";n[n.HtmlResult=1]="HtmlResult";n[n.HtmlProgram=2]="HtmlProgram";n[n.HtmlHeader=3]="HtmlHeader";n[n.HtmlInspection=4]="HtmlInspection";n[n.Unknown=-1]="Unknown"}(h=n.PressAgentHtmlTypes||(n.PressAgentHtmlTypes={})),function(n){n[n.Text=0]="Text";n[n.Html=1]="Html";n[n.Url=2]="Url";n[n.Binary=3]="Binary"}(c=n.LocalizationValueTypes||(n.LocalizationValueTypes={})),function(n){n[n.ServiceRequest=0]="ServiceRequest";n[n.ComplaintLog=1]="ComplaintLog";n[n.Onsite=2]="Onsite";n[n.TemporaryEvent=3]="TemporaryEvent";n[n.InvolvedParty=4]="InvolvedParty";n[n.Unknown=1e4]="Unknown"}(l=n.WorkflowEntityTypes||(n.WorkflowEntityTypes={})),function(n){n[n.Optional=0]="Optional";n[n.Fixed=1]="Fixed";n[n.Exclusive=2]="Exclusive"}(a=n.WorkflowPaymentOptions||(n.WorkflowPaymentOptions={})),function(n){n[n.None=0]="None";n[n.RequirePayment=1]="RequirePayment";n[n.AllowPaymentLater=2]="AllowPaymentLater";n[n.RequirePaymentLater=3]="RequirePaymentLater"}(v=n.WorkflowPaymentOptionTypes||(n.WorkflowPaymentOptionTypes={})),function(n){n[n.Generic=0]="Generic";n[n.WorkflowSuccess=1]="WorkflowSuccess";n[n.InvoiceMessage=2e3]="InvoiceMessage"}(y=n.HtmlContentTypes||(n.HtmlContentTypes={})),function(n){n[n.Created=0]="Created";n[n.Paid=10]="Paid";n[n.ConfirmedPaid=20]="ConfirmedPaid";n[n.Exported=30]="Exported";n[n.Canceled=99]="Canceled";n[n.Error=1e3]="Error"}(p=n.OrderStatus||(n.OrderStatus={})),function(n){n[n.None=0]="None";n[n.BeforeSubmit=1]="BeforeSubmit";n[n.AfterSubmit=2]="AfterSubmit";n[n.BeforeAndAfterSubmit=3]="BeforeAndAfterSubmit"}(w=n.ReviewPageOption||(n.ReviewPageOption={})),function(n){n[n.Unknown=0]="Unknown";n[n.Program=1]="Program";n[n.Complaint=2]="Complaint";n[n.RopCaseInformation=3]="RopCaseInformation";n[n.ServiceRequest=4]="ServiceRequest";n[n.Event=5]="Event";n[n.Facility=6]="Facility";n[n.WaterSystem=7]="WaterSystem";n[n.HazmatEmergencyResponsePlan=8]="HazmatEmergencyResponsePlan";n[n.UGTank=9]="UGTank";n[n.Onsite=10]="Onsite";n[n.OnsiteSubdivision=11]="OnsiteSubdivision";n[n.WaterWellPermit=12]="WaterWellPermit";n[n.VectorSite=13]="VectorSite";n[n.BackflowDevice=14]="BackflowDevice";n[n.TemporaryEvent=15]="TemporaryEvent";n[n.TemporaryEventBooth=16]="TemporaryEventBooth"}(b=n.RelatedProgramType||(n.RelatedProgramType={})),function(n){n[n.Active=0]="Active";n[n.Inactive=1]="Inactive";n[n.Unknown=2]="Unknown"}(k=n.FacilityStatus||(n.FacilityStatus={})),function(n){n[n.OK=0]="OK";n[n.Declined=1]="Declined";n[n.InvalidResponseHash=2]="InvalidResponseHash";n[n.InvalidResponseInfo=3]="InvalidResponseInfo";n[n.InvalidConfiguration=4]="InvalidConfiguration";n[n.Canceled=5]="Canceled"}(d=n.PaymentServiceResultType||(n.PaymentServiceResultType={}))}(Eco||(Eco={})),function(){"use strict"}(Eco||(Eco={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.$resource=n;this.api=n("/api/SupportCode",null,{getSupportCodes:{method:"GET",isArray:!0,cache:!0,url:"/api/supportcode/:supportCodeName/:code"},getEmployees:{method:"GET",isArray:!0,cache:!0,url:"/api/employee/:employeeId"}})}return n.prototype.getSupportCodes=function(n,t){return this.api.getSupportCodes({supportCodeName:n,code:t||""})},n.prototype.getEmployees=function(n){return this.api.getEmployees({employeeId:n||""})},n.$inject=["$resource"],n}();n.EcSupportCodeService=t})(t=n.DataService||(n.DataService={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").service("ecSupportCodeService",Eco.Shared.DataService.EcSupportCodeService),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(){this.require="ngModel";this.restrict="A";this.transclude=!1;this.replace=!1;this.link=function(n,t,i,r){t.datepicker({autoclose:!0,format:"mm/dd/yyyy",todayHighlight:!0,todayBtn:"linked",toggleActive:!1}).next().on("click",function(){$(this).prev().focus()});var f=t.data("datepicker"),u=!0;r.$render=function(){u&&r.$modelValue===r.$viewValue&&(f.setDate(r.$modelValue),u=!1)}}}return n.factory=function(){return function(){return new n}},n}();n.EcAceDatePickerDirective=t})(t=n.Directives||(n.Directives={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").directive("ecAceDatePicker",Eco.Client.Directives.EcAceDatePickerDirective.factory()),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t){var i=this;this.$scope=n;this.$timeout=t;this.change=function(){i.$timeout(function(){i.$scope.change()},0)};this.ngdisabled=function(){return i.$scope.ngdisabled()}}return n.$inject=["$scope","$timeout"],n}(),i,r;n.EcAceSwitchExController=t;i=function(){function n(){this.restrict="E";this.replace=!0;this.template=function(n,t){var i=t.name,r,u;!i&&t.model&&(i=t.model.split(".").last());var e=' name="'+i+'" id="'+i+'"',o=t.caption||"",s=t.label||"",f="";return(t.help&&(f=" <ec-help-badge>"+t.help+"<\/ec-help-badge>"),r="",t.change&&(r=' ng-change="vm.change()"'),u="",t.ngdisabled&&(u=' ng-disabled="vm.ngdisabled()"'),s)?'<h4 class="row">\n\t<span class="col-xs-9 '+t.captionClass+'" style="'+t.captionStyle+'">'+o+f+'<\/span>\n\t<span class="col-xs-3">\n\t\t<label class="pull-right inline">\n\t\t\t<label for="'+i+'">\n\t\t\t\t'+s+'\n\t\t\t\t<input type="checkbox"'+e+' class="ace ace-switch ace-switch-5" ng-model="model"'+r+u+' /><span class="lbl middle"><\/span>\n\t\t\t<\/label>\n\t\t<\/label>\n\t<\/span>\n<\/h4>':'<h4 class="row">\n<label class="col-xs-12 inline">\n\t<label for="'+i+'">\n\t\t'+o+f+'\n\t\t<input type="checkbox"'+e+' class="ace ace-switch ace-switch-5" ng-model="model"'+r+u+' /><span class="lbl middle"><\/span>\n\t<\/label>\n<\/label>\n<\/h4>'};this.scope={idname:"@",model:"=",change:"&",ngdisabled:"&"};this.controller=t;this.controllerAs="vm"}return n.factory=function(){return function(){return new n}},n}();n.EcAceSwitchExDirective=i;r=function(){function n(){this.restrict="E";this.replace=!0;this.template=function(n,t){var i="";return t.help&&(i=" <ec-help-badge>"+t.help+"<\/ec-help-badge>"),'<h4 class="row '+t.captionClass+'"">\n\t<span class="col-xs-5">'+t.caption+i+'<\/span>\n\t<span class="col-xs-7">\n\t\t<label class="pull-right inline">\n\t\t\t<label>\n\t\t\t\t'+t.disabledLabel+"\n\t\t\t<\/label>\n\t\t<\/label>\n\t<\/span>\n<\/h4>"}}return n.factory=function(){return function(){return new n}},n}();n.EcAceSwitchDisabledDirective=r})(t=n.Directives||(n.Directives={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").directive("ecAceSwitchEx",Eco.Shared.Directives.EcAceSwitchExDirective.factory()).directive("ecAceSwitchDisabled",Eco.Shared.Directives.EcAceSwitchDisabledDirective.factory()),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){var t=this;this.$timeout=n;this.restrict="A";this.link=function(n,i){n.$on("$viewContentLoaded",function(){i[0].autofocus=!0;t.$timeout(function(){i.focus()},1e3)})}}return n.factory=function(){var t=function(t){return new n(t)};return t.$inject=["$timeout"],t},n}();n.EcAutofocusDirective=t})(t=n.Directives||(n.Directives={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").directive("ecAutofocus",Eco.Shared.Directives.EcAutofocusDirective.factory());__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){var t=this;this.defaults=n;this.restrict="E";this.template=function(n,i){var r,u,f,e;i.icon&&(t.defaults.icon=i.icon);i.text&&(t.defaults.text=i.text);i.title&&(t.defaults.title=i.title);r=t.defaults.addlClass?t.defaults.addlClass:"";i.class&&(r=i.class+" "+r);u="";i.size&&(i.size==="sm"?(r+=" btn-xs",u=" bigger-110"):i.size==="xs"&&(r+=" btn-minier"));f=' ng-click="action()"';e=i.type||"button";i.uiSref?i.action||(f=""):i.action==="submit"&&(f="",e=i.type||"submit");t.defaults.text==="-NONE-"&&(u+=" icon-only");var s=t.defaults.title?' title="'+t.defaults.title+'"':"",o=t.defaults.icon==="-NONE-"?"":'<i class="ace-icon fa '+t.defaults.icon+u+'"><\/i>',h=t.defaults.text==="-NONE-"?"":t.defaults.text;return'<button type="'+e+'" class="btn '+r+'"'+f+s+">"+o+(o?"&nbsp;":"")+"<span>"+h+"<\/span><\/button>"}}return n}(),i;n.EcButtonDirectiveBase=t;i=function(n){function t(t){var i=n.call(this,t)||this;return i.replace=!0,i.scope={action:"&"},i}return __extends(t,n),t.factory=function(n,i,r,u){return function(){return new t({icon:n,text:i,title:r,addlClass:u})}},t}(t);n.EcButtonDirective=i})(t=n.Directives||(n.Directives={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").directive("ecButton",Eco.Shared.Directives.EcButtonDirective.factory("fa-ban","TEXT")).directive("ecButtonClose",Eco.Shared.Directives.EcButtonDirective.factory("fa-times","Close","","btn-primary")).directive("ecButtonOk",Eco.Shared.Directives.EcButtonDirective.factory("fa-check","OK","","btn-primary")).directive("ecButtonSave",Eco.Shared.Directives.EcButtonDirective.factory("fa-save","Save","","btn-primary")).directive("ecButtonCancel",Eco.Shared.Directives.EcButtonDirective.factory("fa-times","Cancel","","btn-primary")).directive("ecButtonBack",Eco.Shared.Directives.EcButtonDirective.factory("fa-chevron-left","Back","","btn-primary")).directive("ecButtonPrint",Eco.Shared.Directives.EcButtonDirective.factory("fa-print","Print","","btn-primary")).directive("ecButtonInfo",Eco.Shared.Directives.EcButtonDirective.factory("fa-info-circle","Details","","btn-primary")).directive("ecButtonView",Eco.Shared.Directives.EcButtonDirective.factory("fa-eye","View","","btn-primary")).directive("ecButtonSearch",Eco.Shared.Directives.EcButtonDirective.factory("fa-search","Search","","btn-primary")).directive("ecButtonReceipt",Eco.Shared.Directives.EcButtonDirective.factory("fa-file-text-o","Receipt","","btn-primary")).directive("ecButtonReset",Eco.Shared.Directives.EcButtonDirective.factory("fa-eraser","Reset","","btn-primary")).directive("ecButtonReview",Eco.Shared.Directives.EcButtonDirective.factory("fa-eye","Submittal","","btn-primary")).directive("ecButtonDelete",Eco.Shared.Directives.EcButtonDirective.factory("fa-trash-o","Delete","","btn-primary")).directive("ecButtonIgnore",Eco.Shared.Directives.EcButtonDirective.factory("fa-check","Dismiss","","btn-primary")).directive("ecButtonReinspect",Eco.Shared.Directives.EcButtonDirective.factory("fa-retweet","Reinspect","Request a reinspection","btn-primary")).directive("ecButtonResolve",Eco.Shared.Directives.EcButtonDirective.factory("fa-pencil-square-o","Resolve","Resolve this reinspection","btn-primary")).directive("ecButtonYes",Eco.Shared.Directives.EcButtonDirective.factory("fa-check","Yes","","btn-primary")).directive("ecButtonNo",Eco.Shared.Directives.EcButtonDirective.factory("fa-times","No","","btn-primary")),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(){this.restrict="A";this.require="ngModel";this.scope={otherModelValue:"=ecCompareTo"}}return n.prototype.link=function(n,t,i,r){r.$validators.compareTo=function(t){return t===n.otherModelValue};n.$watch("otherModelValue",function(){r.$validate()})},n}();n.CompareTo=t})(t=n.Directives||(n.Directives={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").directive("ecCompareTo",function(){return new Eco.Shared.Directives.CompareTo}),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(){this.restrict="A";this.require="ngModel";this.link=function(n,t,i,r){r.$parsers.push(function(n){return n===""||n===undefined?null:n})}}return n.factory=function(){return function(){return new n}},n}();n.EcEmptyToNullDirective=t})(t=n.Directives||(n.Directives={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").directive("ecEmptyToNull",Eco.Client.Directives.EcEmptyToNullDirective.factory()),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t){var i=this;this.$scope=n;this.commonServices=t;this.errors=undefined;n.$watch("error",function(n){if(!n){i.errors=undefined;return}var t=i.commonServices.formatErrorMessage(n);i.errors=t.split("\r\n")})}return n.$inject=["$scope","ecCommonServices"],n}(),i;n.EcErrorPanelController=t;i=function(){function n(){this.restrict="E";this.replace=!0;this.template='<div class="alert alert-danger alert-dismissible" style="margin: 0 20px 10px 20px;" role="alert" ng-show="vmerr.errors">\n\t<button type="button" ng-click="vmerr.errors = undefined" class="close" aria-label="Close"><span aria-hidden="true">&times;<\/span><\/button>\n\t<ul>\n\t\t<li ng-repeat="err in vmerr.errors">\n\t\t\t{{ err }}\n\t\t<\/li>\n\t<\/ul>\n<\/div>';this.scope={error:"="};this.controller=t;this.controllerAs="vmerr"}return n.factory=function(){return function(){return new n}},n}();n.EcErrorPanelDirective=i})(t=n.Directives||(n.Directives={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").directive("ecErrorPanel",Eco.Shared.Directives.EcErrorPanelDirective.factory()),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(){this.restrict="E";this.transclude=!0;this.replace=!0;this.require="^form";this.vm=null;this.template=function(n,t){var f=t.cancel?"cancel()":"vmCancel()",e=t.saveDisabled?"saveDisabled":"vmSaveDisabled()",o=!t.save&&n.closest("form[ng-submit]").length===1,u="",i,r;return t.save!=="HIDE"&&(i="button",r=t.save?' ng-click="save()"':' ng-click="vmSave()"',(o||t.save==="SUBMIT")&&(i="submit",r=""),u='<button ng-if="!saveHide" type="'+i+'" class="btn btn-primary"'+r+'\n ng-disabled="'+e+'"><i class="ace-icon fa fa-save"><\/i>{{ ::saveText || \'Save\' }}<\/button>'),'<div class="form-group">\n\t<hr class="thin" />\n\t<button type="button" class="btn btn-primary" ng-click="'+f+'"\n ng-disabled="cancelDisabled"><i class="ace-icon fa fa-times white"><\/i>{{ ::cancelText || \'Cancel\' }}<\/button>\n\t'+u+"\n\t<span ng-transclude><\/span>\n<\/div>"};this.link=function(n,t,i,r){var u=n.vm?n.vm:t.parent().controller();n.vmCancel=function(){u.cancel.apply(u,[r])};n.vmSave=function(){u.save.apply(u,[r])};n.vmSaveDisabled=function(){return r.$invalid||r.$pristine}};this.scope={cancel:"&",cancelText:"@",cancelDisabled:"=",save:"&",saveText:"@",saveDisabled:"=",saveHide:"=",vm:"="}}return n.factory=function(){return function(){return new n}},n}();n.EcFormButtonsDirective=t})(t=n.Directives||(n.Directives={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").directive("ecFormButtons",Eco.Shared.Directives.EcFormButtonsDirective.factory()),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(){this.restrict="E";this.replace=!0;this.template=function(n,t){var i=" badge-primary",r=n[0].innerText;return t.text&&(r=t.text),t.class&&t.class.indexOf("badge-")>=0&&(i=""),'<a class="badge'+i+'" style="cursor: default; vertical-align: middle; margin-left: 6px;"\n popover-append-to-body="true"\n popover-trigger="mouseenter" popover="'+r+'">?<\/a>'}}return n.factory=function(){return function(){return new n}},n}();n.EcHelpBadgeDirective=t})(t=n.Directives||(n.Directives={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").directive("ecHelpBadge",Eco.Shared.Directives.EcHelpBadgeDirective.factory()),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){var r=this;this.appContext=n;this.$timeout=i;this.htmlToDisplay="";this.showTransclude=!1;this.htmlContentOid?t.htmlContent.get(this.htmlContentOid).$promise.then(function(n){r.setHtml(n)}).catch(function(n){r.showError(n,r.htmlContentOid)}):this.htmlContentName?t.htmlContent.getByName(this.htmlContentName).$promise.then(function(n){r.setHtml(n)}).catch(function(n){r.showError(n,r.htmlContentName)}):this.showTransclude=!0}return n.prototype.setHtml=function(n){n&&n.Html?(this.htmlToDisplay=n.Html,n.Name.startsWith("Site Footer")&&this.$timeout(function(){var n=$("#pagefootercontent").height();$("#pagefooter").css("padding-top",15+n+"px")},200)):this.showTransclude=!0},n.prototype.showError=function(n,t){this.showTransclude=!0;this.appContext.isDebug&&(this.htmlToDisplay='\n<div style="background-color: #FF7777;">\n\t<br />\n\t&nbsp;&nbsp;-- DEBUG: Error for custom html area \''+t+"': "+n+" --\n\t<br />\n\t<br />\n<\/div>")},n.$inject=["ecAppContext","ecDataService","$timeout"],n}(),i;n.EcHtmlContentController=t;i=function(){function n(){this.transclude=!0;this.template='\n<div class="htmcontent" ng-cloak>\n\t<p ng-bind-html="$ctrl.htmlToDisplay | ecAsHtmlFilter"><\/p>\n\t<div ng-if="$ctrl.showTransclude" ng-transclude><\/div>\n<\/div>';this.controller=t;this.bindings={htmlContentOid:"@oid",htmlContentName:"@name"}}return n}();n.EcHtmlContentComponent=i})(t=n.Directives||(n.Directives={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").component("ecHtmlContent",new Eco.Shared.Directives.EcHtmlContentComponent),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){var t=this;this.defaults=n;this.restrict="E";this.replace=!0;this.template='<i class="ace-icon '+this.defaults.icon+'"'+(this.defaults.title?' title="-'+this.defaults.title+'-"':"")+"><\/i>";this.scope={round:"@"};this.compile=function(n,i){return function(n,r){r.parent().hasClass("timeline-info")?r.addClass("timeline-indicator btn no-hover "+t.defaults.btnColor):angular.isDefined(i.round)?r.addClass("ec-icon-round btn no-hover "+t.defaults.btnColor):t.defaults.color&&r.addClass(t.defaults.color)}}}return n.factory=function(t,i,r,u){return function(){return new n({icon:t,btnColor:i,color:r,title:u})}},n}();n.EcIconDirective=t})(t=n.Directives||(n.Directives={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").directive("ecIconComplaint",Eco.Shared.Directives.EcIconDirective.factory("fa fa-bell-o","clr-complaint-bg","clr-complaint","Complaint")).directive("ecIconComplaintlog",Eco.Shared.Directives.EcIconDirective.factory("fa fa-bell-o","clr-complaint-bg","clr-complaint","Complaint")).directive("ecIconFacility",Eco.Shared.Directives.EcIconDirective.factory("fa fa-building-o","clr-facility-bg","clr-facility","Facility")).directive("ecIconCorefacility",Eco.Shared.Directives.EcIconDirective.factory("fa fa-building-o","clr-facility-bg","clr-facility","Facility")).directive("ecIconInspection",Eco.Shared.Directives.EcIconDirective.factory("fa fa-cutlery","clr-inspection-bg","clr-inspection","Inspection")).directive("ecIconCoredaily",Eco.Shared.Directives.EcIconDirective.factory("fa fa-cutlery","clr-inspection-bg","clr-inspection","Inspection")).directive("ecIconInvoice",Eco.Shared.Directives.EcIconDirective.factory("fa fa-credit-card","clr-invoice-bg","clr-invoice","Invoice")).directive("ecIconPermit",Eco.Shared.Directives.EcIconDirective.factory("fa fa-file-powerpoint-o","clr-permit-bg","clr-permit","Permit")).directive("ecIconCorepermit",Eco.Shared.Directives.EcIconDirective.factory("fa fa-file-powerpoint-o","clr-permit-bg","clr-permit","Permit")).directive("ecIconServicerequest",Eco.Shared.Directives.EcIconDirective.factory("fa fa-exchange","clr-servicerequest-bg","clr-servicerequest","Service Request")).directive("ecIconViolation",Eco.Shared.Directives.EcIconDirective.factory("fa fa-exclamation-triangle","clr-violation-bg","clr-violation","Violation")).directive("ecIconInspectionviolation",Eco.Shared.Directives.EcIconDirective.factory("fa fa-exclamation-triangle","clr-violation-bg","clr-violation","Violation")).directive("ecIconOwner",Eco.Shared.Directives.EcIconDirective.factory("fa fa-user","clr-owner-bg","clr-owner","Owner")).directive("ecIconCoreowner",Eco.Shared.Directives.EcIconDirective.factory("fa fa-user","clr-owner-bg","clr-owner","Owner")).directive("ecIconUsers",Eco.Shared.Directives.EcIconDirective.factory("fa fa-users","clr-user-bg","clr-user","Users")).directive("ecIconRoles",Eco.Shared.Directives.EcIconDirective.factory("fa fa-key","clr-role-bg","clr-role","Roles")).directive("ecIconOverview",Eco.Shared.Directives.EcIconDirective.factory("fa fa-line-chart","clr-overview-bg","clr-overview","Overview")).directive("ecIconTasks",Eco.Shared.Directives.EcIconDirective.factory("fa fa-tasks","clr-tasks-bg","clr-tasks","Tasks")).directive("ecIconOk",Eco.Shared.Directives.EcIconDirective.factory("fa fa-check","btn-primary","success")).directive("ecIconAttachment",Eco.Shared.Directives.EcIconDirective.factory("fa fa-file-pdf-o","clr-servicerequest-bg","clr-servicerequest")),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(){this.restrict="E";this.replace=!0;this.template='<span class="red bolder" style="cursor: default" title="Input is required">&nbsp;*<\/span>'}return n.factory=function(){return function(){return new n}},n}();n.EcInputRequired=t})(t=n.Directives||(n.Directives={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").directive("ecInputRequired",Eco.Shared.Directives.EcInputRequired.factory()),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.ds=n}return n.$inject=["ecDataService"],n}(),i;n.EcLaunchPanelController=t;i=function(){function n(){this.restrict="E";this.replace=!0;this.template='\n<div>\n\t<style ng-repeat="activity in activities">\n\t\ta.btnColor{{ ::$index }} {\n\t\t\tborder-color: {{ ::activity.launchPanelColor }} !important;\n\t\t\tbackground-color: {{ ::activity.launchPanelColor }} !important;\n\t\t\tcolor: #fff !important;\n\t\t}\n\t<\/style>\n\t<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 pricing-box" ng-repeat="activity in activities">\n\t\t<div class="widget-box" ng-style="{ \'border-color\': activity.launchPanelColor }">\n\t\t\t<div class="widget-header" ng-style="{ \'border-color\': activity.launchPanelColor, \'background\': activity.launchPanelColor, \'color\': \'#fff\' }">\n\t\t\t\t<h5 class="widget-title bigger lighter">{{ ::activity.name }}<\/h5>\n\t\t\t<\/div>\n\n\t\t\t<div class="widget-body servicesMinHeight">\n\t\t\t\t<div class="widget-main">\n\t\t\t\t\t<div ng-bind-html="activity.launchPanelText|ecAsHtmlFilter"><\/div>\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\n\t\t\t<div>\n\t\t\t\t<a href="" ui-sref="{{ ::activity.stateName }}" class="btn btn-block btnColor{{ ::$index }}">\n\t\t\t\t\t<span>Start<\/span>\n\t\t\t\t\t<i class="ace-icon fa fa-arrow-right bigger-110"><\/i>\n\t\t\t\t<\/a>\n\t\t\t<\/div>\n\t\t<\/div>\n\t<\/div>\n<\/div>';this.scope={activities:"="};this.controller=t;this.controllerAs="vm"}return n.factory=function(){return function(){return new n}},n}();n.EcLaunchPanels=i})(t=n.Directives||(n.Directives={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").directive("ecLaunchPanels",Eco.Shared.Directives.EcLaunchPanels.factory()),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(){this.restrict="E";this.replace=!0;this.template=function(n,t){var i=t.icon.startsWith("fa-")||t.icon.startsWith("{{")?'<i class="ace-icon fa {{ ::icon }}"><\/i>':"<ec-icon-"+t.icon+"><\/ec-icon-"+t.icon+">",r=t.subtitle?'<small class="hidden-xs hidden-sm">\n\t<i ng-if="subtitle" class="ace-icon fa fa-angle-double-right"><\/i>\n\t{{ subtitle }}\n<\/small>':"";return'<div class="page-header">\n\t<h1>\n\t\t'+i+"\n\t\t{{ title }}\n\t\t"+r+"\n\t<\/h1>\n<\/div>"};this.scope={icon:"@",title:"@",subtitle:"@"}}return n.factory=function(){return function(){return new n}},n}();n.EcPageHeaderDirective=t})(t=n.Directives||(n.Directives={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").directive("ecPageHeader",Eco.Shared.Directives.EcPageHeaderDirective.factory()),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){var r=this;this.$log=n;this.$rootScope=t;this.$scope=i;this.params={totalItems:0,itemsPerPage:10};this.currentPage=0;this.marginStyle="20px 0";this.$rootScope.$on("ECPAGER",function(n,t){r.name&&r.name===t.name&&r!==t&&r.currentPage!==t.currentPage&&(r.currentPage=t.currentPage,r.doChangePage())})}return n.prototype.$onChanges=function(n){n.params&&n.params.currentValue&&(angular.extend(this.params,n.params.currentValue),this.currentPage=1,this.doChangePage());n.margin&&n.margin.currentValue&&(this.marginStyle=n.margin.currentValue)},n.prototype.changePage=function(n){n.number!==this.currentPage&&(this.currentPage=n.number,this.doChangePage())},n.prototype.doChangePage=function(){this.generatePagesArray();var n=(this.currentPage-1)*this.params.itemsPerPage,t={itemStart:n,itemEnd:n+this.params.itemsPerPage,pageNumber:this.currentPage,totalItems:this.params.totalItems,itemsPerPage:this.params.itemsPerPage};if(this.params.onPageChange)this.params.onPageChange(t);this.name&&this.$rootScope.$broadcast("ECPAGER",this)},n.prototype.generatePagesArray=function(){var e,u,f,r,t,i,n;if(e=11,i=[],t=Math.ceil(this.params.totalItems/this.params.itemsPerPage),t>1){for(i.push({type:"prev",number:Math.max(1,this.currentPage-1),isDisabled:this.currentPage<=1,isActive:!1}),i.push({type:"page",number:1,isDisabled:this.currentPage<=1,isActive:this.currentPage===1}),f=Math.round((e-5)/2),r=Math.max(2,this.currentPage-f),u=Math.min(t-1,this.currentPage+f*2-(this.currentPage-r)),r=Math.max(2,r-(f*2-(u-r))),n=r;n<=u;)n===r&&n!==2||n===u&&n!==t-1?i.push({type:"more",number:-1,isDisabled:!0,isActive:!1}):i.push({type:"page",number:n,isDisabled:this.currentPage===n,isActive:this.currentPage===n}),n++;i.push({type:"page",number:t,isDisabled:this.currentPage>=t,isActive:this.currentPage===t});i.push({type:"next",number:Math.min(t,this.currentPage+1),isDisabled:this.currentPage>=t,isActive:!1})}this.pages=i},n.$inject=["$log","$rootScope","$scope"],n}(),i;n.EcPagerController=t;i=function(){function n(){this.transclude=!1;this.template='<ul class="pagination" ng-style="{ margin: pager.marginStyle }" ng-cloak>\n\t<li ng-repeat="page in pager.pages" ng-class="{\'disabled\': page.isDisabled, \'active\': page.isActive}" ng-switch="page.type">\n\t\t<a ng-switch-when="prev" ng-click="pager.changePage(page)" href="" title="Go to previous page">&laquo;<\/a>\n\t\t<a ng-switch-when="first" ng-click="pager.changePage(page)" href="">\n\t\t\t<span ng-bind="page.number"/>\n\t\t<\/a>\n\t\t<a ng-switch-when="page" ng-click="pager.changePage(page)" href="">\n\t\t\t<span ng-bind="page.number"/>\n\t\t<\/a>\n\t\t<a ng-switch-when="more" ng-click="pager.changePage(page)" href="">&#8230;<\/a>\n\t\t<a ng-switch-when="last" ng-click="pager.changePage(page)" href="">\n\t\t\t<span ng-bind="page.number"/>\n\t\t<\/a>\n\t\t<a ng-switch-when="next" ng-click="pager.changePage(page)" href="" title="Go to next page">&raquo;<\/a>\n\t<\/li>\n<\/ul>';this.controller=t;this.controllerAs="pager";this.bindings={name:"@",params:"<",margin:"@"}}return n}();n.EcPagerComponent=i})(t=n.Directives||(n.Directives={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").component("ecPager",new Eco.Shared.Directives.EcPagerComponent),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(){this.restrict="E";this.replace=!0;this.template='<div class="search-input">\n\t<i class="ace-icon fa fa-search"><\/i>\n\t<input type="text" ng-model="model" ng-model-options="{ debounce: { \'default\': 500, \'blur\': 0 } }" placeholder="search ..." autocomplete="off" />\n\t<a ng-class="{ \'clear-button\': !model }" href ng-click="model=\'\'" onclick="this.blur()" title="Clear search"><i class="ace-icon fa fa-times-circle"><\/i><\/a>\n<\/div>';this.scope={model:"="}}return n.factory=function(){return function(){return new n}},n}();n.EcSearchInput=t})(t=n.Directives||(n.Directives={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").directive("ecSearchInput",Eco.Shared.Directives.EcSearchInput.factory()),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t){n.employees=[];t.getEmployees(null).$promise.then(function(t){n.employees=t})}return n.$inject=["$scope","ecSupportCodeService"],n}(),i;n.EcSelectEmployeeController=t;i=function(){function n(n){var i=this;this.options=n;this.restrict="E";this.template=function(n,t){var r="optional";return(t.required||t.hasOwnProperty("required")||t.ngRequired)&&(r="choose employee"),'<select class="form-control" ng-model="model" ng-options="'+i.options+"\" ec-empty-to-null>\n\t<option value=''>--"+r+"--<\/option>\n<\/select>"};this.replace=!0;this.scope={model:"="};this.controller=t}return n.factory=function(t){return function(){return new n(t)}},n.ByKey="emp.EmployeeId as emp.FirstName + ' ' + emp.LastName for emp in employees",n.ByObject="emp.FirstName + ' ' + emp.LastName for emp in employees track by emp.EmployeeId",n}();n.EcSelectEmployeeDirective=i})(t=n.Directives||(n.Directives={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").directive("ecSelectEmployee",Eco.Shared.Directives.EcSelectEmployeeDirective.factory(Eco.Shared.Directives.EcSelectEmployeeDirective.ByKey)).directive("ecSelectEmployeeObject",Eco.Shared.Directives.EcSelectEmployeeDirective.factory(Eco.Shared.Directives.EcSelectEmployeeDirective.ByObject)),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){var t=this;this.commonServices=n;this.restrict="E";this.replace=!0;this.template=function(n,t){var i=" badge-primary";return t.class&&t.class.indexOf("badge-")>=0&&(i=""),'<select class="form-control" ng-model="model" ng-options="en.key as en.value for en in items"><\/select>'};this.scope={model:"=","enum":"@"};this.link=function(n){n.items=t.commonServices.enumToKeyValuePairs(n.enum)}}return n.factory=function(){var t=function(t){return new n(t)};return t.$inject=["ecCommonServices"],t},n}();n.EcSelectEnumDirective=t})(t=n.Directives||(n.Directives={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").directive("ecSelectEnum",Eco.Shared.Directives.EcSelectEnumDirective.factory()),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t){n.supportCodes=[];n.label||(n.label="Value");t.getSupportCodes(n.ecSupportCodeName,null).$promise.then(function(t){n.supportCodes=t.findAll(function(n){return!n.IsInactive})})}return n.$inject=["$scope","ecSupportCodeService"],n}(),i=function(){function n(){this.restrict="E";this.transclude=!1;this.replace=!0;this.template=function(n,t){var i="optional";return(t.required||t.hasOwnProperty("required")||t.ngRequired)&&(i="choose "+(!t.label?"item":t.label.toLowerCase())),'<select class="form-control" ng-model="model" ng-options="sc.Code as sc.Code + \' - \' + sc.Description for sc in supportCodes" ec-empty-to-null>\n\t<option value="">--'+i+"--<\/option>\n<\/select>"};this.scope={model:"=",ecSupportCodeName:"@"};this.controller=t}return n.factory=function(){return function(){return new n}},n}();n.EcSupportCodeDirective=i})(t=n.Directives||(n.Directives={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").directive("ecSelectSupportCode",Eco.Shared.Directives.EcSupportCodeDirective.factory()),function(n){var t;(function(t){var i;(function(t){"use strict";var i=function(){function n(n,t,i){var r=this;this.$scope=n;this.$log=t;i.getSupportCodes(this.$scope.supportCodeName,null).$promise.then(function(n){r.supportCodes=n;var t=r.findSupportCode(r.$scope.supportCodeCode);r.$scope.isEditable?t?r.setCurrentItem(t):r.supportCode=r.$scope.supportCodeCode:r.setCurrentItem(t)})}return n.prototype.doFilter=function(n){return this.supportCodes.filter(function(t){return t.Code.startsWith(n,0,!1)||!!t.Description&&t.Description.toLowerCase().has(n.toLowerCase())})},n.prototype.findSupportCode=function(n){return n?this.supportCodes.find(function(t){return t.Code.toLowerCase()===n.toLowerCase()}):undefined},n.prototype.onChange=function(){if(this.$scope.isEditable){if(angular.isString(this.supportCode)){var n=this.findSupportCode(this.supportCode);n?this.setCurrentItem(n):(this.$scope.supportCodeCode=this.supportCode,this.$scope.foundCode=undefined)}}else this.$scope.supportCodeCode=undefined,this.$scope.foundCode=undefined},n.prototype.setCurrentItem=function(n){this.supportCode=n;this.$scope.supportCodeCode=n?n.Code:undefined;this.$scope.foundCode=n?n.Code:undefined},n.$inject=["$scope","$log","ecSupportCodeService"],n}(),r;t.EcSupportCodeTypeaheadController=i;r=function(){function t(){this.restrict="E";this.transclude=!1;this.replace=!0;this.link=function(n,t,i){n.isEditable=i.editable&&i.editable==="true";n.isRequired=!!i.hasOwnProperty("required");n.foundCode=undefined};this.template=function(n,t){var r="true",i;return t.notOnBody&&(r="false"),i="",t.hasOwnProperty("required")&&(i='required="required"'),'<div ng-class=\'{ "input-group": foundCode}\'>\n\t<input\n\t\tclass="form-control"\n\t\ttype="text"\n\t\tname="'+t.idName+'"\n\t\tid="'+t.idName+'"\n\t\tng-change="vm.onChange()"\n\t\tng-model="vm.supportCode"\n\t\tautocomplete="off"\n\t\ttypeahead-editable="'+t.editable+'"\n\t\ttypeahead-template-url="ecSupportCodeTypeahead.html"\n\t\ttypeahead-append-to-body="'+r+'"\n\t\ttypeahead-on-select="vm.setCurrentItem($item)"\n\t\ttypeahead="sc as sc.Description for sc in vm.doFilter($viewValue) | limitTo:8"\n\t\t'+i+'\n\t\tplaceholder="-type code or text to search for-"\n\t/>\n\t<span ng-show="foundCode" class="input-group-addon">{{ foundCode }}<\/span>\n<\/div>'};this.scope={supportCodeCode:"=",supportCodeName:"@",idName:"@"};this.controller=i;this.controllerAs="vm"}return t.factory=function(){return function(){return new n.Shared.Directives.EcSupportCodeTypeaheadDirective}},t}();t.EcSupportCodeTypeaheadDirective=r})(i=t.Directives||(t.Directives={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").directive("ecSupportCodeTypeahead",Eco.Shared.Directives.EcSupportCodeTypeaheadDirective.factory()).run(["$templateCache",function(n){n.put("ecSupportCodeTypeahead.html",'<a>\n\t<span bind-html-unsafe="match.model.Code | typeaheadHighlight:query"><\/span> -\n\t<span bind-html-unsafe="match.model.Description | typeaheadHighlight:query"><\/span>\n<\/a>')}]),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){var t=this;this.$scope=n;this.add=function(){t.$scope.addFn()};this.addShow=function(){return t.$scope.showFn()};this.addText=function(){return t.$scope.addText}}return n.$inject=["$scope"],n}(),i,r,u,f,e,o;n.EcTableButtonsController=t;i=function(){function n(n){var i=this;this.$parse=n;this.restrict="A";this.replace=!1;this.controller=t;this.link=function(n,t,r){var u,f;r.add&&(r.addShow||(n.addShow=!0),u=i.$parse(r.add),n.addFn=function(){u(n.$parent)});r.addShow&&(f=i.$parse(r.addShow),n.showFn=function(){return f(n.$parent)});r.addText&&(n.addText=r.addText)}}return n.factory=function(){var t=function(t){return new n(t)};return t.$inject=["$parse"],t},n}();n.EcTableButtonsDirective=i;r=function(){function n(){this.restrict="E";this.replace=!0;this.require="^ecTableButtons";this.template='\n<button type="button" ng-if="vm.addShow()" class="btn btn-mini btn-primary" ng-click="vm.add()">\n\t<i class="ace-icon fa fa-plus"><\/i>\n\t{{ ::vm.addText() || \'Add\' }}\n<\/button>';this.link=function(n,t,i,r){var u=t.parents("th");u.length>0&&u.first().addClass("text-align-right").css("padding-top","4px").css("padding-bottom","1px");n.vm=r}}return n.factory=function(){return function(){return new n}},n}();n.EcTableButtonsHeaderAddDirective=r;u=function(){function n(){this.restrict="E";this.replace=!0;this.template=function(n,t){var i=t.otherIcon||"fa-database";return'\n<span>\n\t<button type="button" ng-if="editShow" ng-click="edit()" class="btn btn-primary btn-xs" title="{{ ::editText || \'Edit\' }}">\n\t\t<i class="ace-icon icon-only fa fa-edit"><\/i>\n\t<\/button>\n\n\t<button type="button" ng-if="copyShow" ng-click="copy()" class="btn btn-primary btn-xs" title="{{ ::copyText || \'Copy\' }}">\n\t\t<i class="ace-icon icon-only fa fa-copy"><\/i>\n\t<\/button>\n\n\t<button type="button" ng-if="otherShow" ng-click="other()" class="btn btn-primary btn-xs" title="{{ ::otherText || \'Other\' }}">\n\t\t<i class="ace-icon icon-only fa '+i+'"><\/i>\n\t<\/button>\n\n\t<button type="button" ng-if="deleteShow" ng-click="delete()" class="btn btn-primary btn-xs"\n\t\tstyle="margin-left: 8px;"\n\t\tng-class="{ invisible: deleteHide }"\n\t\ttitle="{{ ::deleteText || \'Delete\' }}">\n\t\t<i class="ace-icon icon-only fa fa-trash-o"><\/i>\n\t<\/button>\n<\/span>'};this.scope={edit:"&",editText:"@",editShow:"=",copy:"&",copyText:"@",copyShow:"=",other:"&",otherText:"@",otherShow:"=",otherIcon:"@","delete":"&",deleteText:"@",deleteShow:"=",deleteHide:"="};this.compile=function(n,t){return t.edit&&!t.editShow&&(t.editShow="true"),t.copy&&!t.copyShow&&(t.copyShow="false"),t.other&&!t.otherShow&&(t.otherShow="false"),t.delete&&!t.deleteShow&&(t.deleteShow="true"),null}}return n.factory=function(){return function(){return new n}},n}();n.EcTableButtonsRowDirective=u;f=function(){function n(){this.template='\n<div ng-if="!$ctrl.hide">\n\t<button class="btn btn-mini btn-primary" ng-click="$ctrl.add()">\n\t\t<i class="ace-icon fa fa-plus"><\/i>\n\t\t{{ $ctrl.caption || \'Add\' }}\n\t<\/button>\n<\/div>';this.bindings={hide:"<",caption:"@",add:"&"}}return n}();n.EcTableButtonAddComponent=f;e=function(){function n(){this.template='\n<div class="btn-group dropdown" ng-if="!$ctrl.hide">\n\t<button class="btn btn-xs btn-primary" ng-click="$ctrl.add()">\n\t\t<i class="ace-icon fa fa-plus"><\/i>\n\t\t{{ $ctrl.caption || \'Add\' }}\n\t<\/button>\n\t<button data-toggle="dropdown" class="btn btn-xs btn-primary dropdown-toggle" aria-expanded="false">\n\t\t<i class="ace-icon fa fa-caret-down icon-only"><\/i>\n\t<\/button>\n\t<ul class="dropdown-menu dropdown-primary">\n\t\t<li><a href="" ng-click="$ctrl.add()">{{ $ctrl.addCaption || \'Add\' }}<\/a><\/li>\n\t\t<li><a href="" ng-click="$ctrl.import()">{{ $ctrl.importCaption || \'Import\' }}<\/a><\/li>\n\t<\/ul>\n<\/div>';this.bindings={hide:"<",caption:"@",add:"&","import":"&",addCaption:"<",importCaption:"<"}}return n}();n.EcTableButtonAddImportComponent=e;o=function(){function n(){this.template=["$element","$attrs",function(n,t){var i="";return t.canDelete&&(i=' ng-if="$ctrl.canDelete"'),'\n<div class="btn-group" ng-if="!$ctrl.hide">\n\t<button data-toggle="dropdown" class="btn btn-primary btn-xs dropdown-toggle">\n\t\t<i class="ace-icon icon-only fa fa-wrench"><\/i>{{ $ctrl.caption }}\n\t\t<i class="ace-icon fa fa-caret-down icon-on-right"><\/i>\n\t<\/button>\n\n\t<ul class="dropdown-menu dropdown-info dropdown-menu-right">\n\t\t'+(t.edit?'<li><a href="" ng-click="$ctrl.edit()">{{ $ctrl.editCaption || "Edit" }}<\/a><\/li>':"")+"\n\t\t"+(t.copy?'<li><a href="" ng-click="$ctrl.copy()">{{ $ctrl.copyCaption || "Copy" }}<\/a><\/li>':"")+"\n\t\t"+(t.view?'<li><a href="" ng-click="$ctrl.view()">{{ $ctrl.viewCaption || "View" }}<\/a><\/li>':"")+"\n\t\t"+(t.publish?'<li><a href="" ng-click="$ctrl.publish()">{{ $ctrl.publishCaption || "Publish" }}<\/a><\/li>':"")+"\n\t\t"+(t.export?'<li><a href="" ng-click="$ctrl.export()">{{ $ctrl.exportCaption || "Export" }}<\/a><\/li>':"")+"\n\t\t"+(t.other?'<li><a href="" ng-click="$ctrl.other()">{{ $ctrl.otherCaption || "Other" }}<\/a><\/li>':"")+"\n\t\t"+(t.delete?"<li"+i+' class="divider"><\/li>':"")+"\n\t\t"+(t.delete?"<li"+i+'><a href="" ng-click="$ctrl.delete()">{{ $ctrl.deleteCaption || "Delete" }}<\/a><\/li>':"")+"\n\t<\/ul>\n<\/div>"}];this.bindings={hide:"<",caption:"@",edit:"&",copy:"&",view:"&",publish:"&","export":"&",other:"&","delete":"&",editCaption:"<",copyCaption:"<",viewCaption:"<",publishCaption:"<",exportCaption:"<",otherCaption:"<",deleteCaption:"<",canDelete:"<"}}return n}();n.EcTableButtonToolsComponent=o})(t=n.Directives||(n.Directives={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").directive("ecTableButtons",Eco.Shared.Directives.EcTableButtonsDirective.factory()).directive("ecTableButtonsHeaderAdd",Eco.Shared.Directives.EcTableButtonsHeaderAddDirective.factory()).directive("ecTableButtonsRow",Eco.Shared.Directives.EcTableButtonsRowDirective.factory()).component("ecTableButtonAdd",new Eco.Shared.Directives.EcTableButtonAddComponent).component("ecTableButtonAddImport",new Eco.Shared.Directives.EcTableButtonAddImportComponent).component("ecTableButtonTools",new Eco.Shared.Directives.EcTableButtonToolsComponent).run(["$templateCache",function(n){n.put("ecTableButtonsHeaderAdd.html","<ec-table-buttons-header-add><\/ec-table-buttons-header-add>")}]),function(n){var t;(function(n){var t;(function(n){"use strict";function t(n){return function(t){return n.trustAsHtml(t)}}function s(){return function(n,t,i){return n&&n.length>t?angular.isDefined(i)&&i===!0?n.substr(0,t):n.substr(0,t-3)+"...":n}}function i(n){return function(val,enumType){var x;if(!angular.isNumber(val))return undefined;try{return x=eval("Eco."+enumType+"["+val+"]"),n.toWords(x)}catch(err){try{return x=eval(enumType+"["+val+"]"),n.toWords(x)}catch(err){return undefined}}}}function r(n){return function(t,i){return i&&!t?i:n("date")(t,"MMM dd, yyyy")}}function u(n){return function(t,i){return i&&!t?i:(t=t instanceof Date?new Date(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds()):new Date(t+"Z"),n("date")(t,"MMM dd, yyyy hh:mm a"))}}function f(n){return function(t,i){return i&&!t?i:(t=t instanceof Date?new Date(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds()):new Date(t+"Z"),n("date")(t,"hh:mm:ss a"))}}function e(n){return function(t,i){var r=i==="long"?"MMM dd, yyyy hh:mm a":"MM/dd/yyyy hh:mm a";return n("date")(t,r)}}function o(n){return function(t){return t?n.toWords(t.toString()):t}}t.$inject=["$sce"];n.EcAsHtmlFilter=t;n.EcTruncateFilter=s;i.$inject=["ecCommonServices"];n.EcEnum=i;r.$inject=["$filter"];n.EcDate=r;u.$inject=["$filter"];n.EcDateTimeUtc=u;f.$inject=["$filter"];n.EcTimeUtc=f;e.$inject=["$filter"];n.EcDateTimeServer=e;o.$inject=["ecCommonServices"];n.EcToWordsFilter=o})(t=n.Filters||(n.Filters={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").filter("ecAsHtmlFilter",Eco.Shared.Filters.EcAsHtmlFilter).filter("ecTruncateFilter",Eco.Shared.Filters.EcTruncateFilter).filter("ecEnumFormat",Eco.Shared.Filters.EcEnum).filter("ecDateFormat",Eco.Shared.Filters.EcDate).filter("ecDatetimeUtc",Eco.Shared.Filters.EcDateTimeUtc).filter("ecTimeUtc",Eco.Shared.Filters.EcTimeUtc).filter("ecDatetimeServer",Eco.Shared.Filters.EcDateTimeServer).filter("ecToWordsFilter",Eco.Shared.Filters.EcToWordsFilter),function(n){var t;(function(n){var t;(function(n){"use strict";function t(){return function(n){var t,r,u,i;if(!n)return"";if(t=n.toString().trim().replace(/^\+/,""),t.match(/[^0-9]/))return n;switch(t.length){case 10:r=1;u=t.slice(0,3);i=t.slice(3);break;case 11:r=t[0];u=t.slice(1,4);i=t.slice(4);break;case 12:r=t.slice(0,3);u=t.slice(3,5);i=t.slice(5);break;default:return n}return r===1&&(r=""),i=i.slice(0,3)+"-"+i.slice(3),(r+" ("+u+") "+i).trim()}}n.PhoneFilter=t})(t=n.Filters||(n.Filters={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").filter("ecPhoneFormat",Eco.Shared.Filters.PhoneFilter),function(n){var t;(function(n){var t;(function(n){"use strict";function t(){return function(n){return n&&n.toLowerCase()==="y"?"Yes":"No"}}function i(){return function(n){return n?"Yes":"No"}}n.DecadeBooleanFilter=t;n.TruthyYesNoFilter=i})(t=n.Filters||(n.Filters={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").filter("ecDecadeBooleanFormat",Eco.Shared.Filters.DecadeBooleanFilter).filter("ecYesNoFormat",Eco.Shared.Filters.TruthyYesNoFilter),function(n){var t;(function(n){var t;(function(n){"use strict";function t(){return function(n){return n?(n=n.trim(),n.match(/[^0-9]/))?n:n.length>5?n.slice(0,5)+"-"+n.slice(5):n:""}}n.ZipcodeFilter=t})(t=n.Filters||(n.Filters={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").filter("ecZipcodeFormat",Eco.Shared.Filters.ZipcodeFilter),function(n){var t;(function(n){var t;(function(n){"use strict";function t(){return function(n){var r=[],t,i;for(t in n)if(n.hasOwnProperty(t))for(i in n[t])n[t].hasOwnProperty(i)&&r.push(n[t][i]);return r}}n.flattenGroupedArrayFilter=t})(t=n.Filters||(n.Filters={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").filter("flattenGroupedArray",Eco.Shared.Filters.flattenGroupedArrayFilter),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(){this.getGroupedMenuItems=function(n){var t=[],r,i;return angular.forEach(n,function(n){!n.activity||t.push(n.activity)}),t=t.sortBy("name").sortBy("sort"),r=t.groupBy(function(n){return n.menuRole},function(n,t){t.sort=t[0].menuSort;t.title=t[0].menuRole;t.icon=t[0].menuIcon;t.resourceIdRole=t[0].resourceIdRole}),i=[],angular.forEach(r,function(n){i.push(n)}),i.sortBy("title").sortBy("sort")}}return n}();n.EcActivitiesService=t})(t=n.Services||(n.Services={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").service("ecActivitiesService",Eco.Shared.Services.EcActivitiesService),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r,u,f,e,o){var s=this;this.dialogTitle=n;this.relatedId=t;this.descriptionOptions=i;this.toastrService=r;this.portalConfiguration=u;this.$modalInstance=e;this.$timeout=o;this.canShowUploadProgress=!1;this.isValidFile=function(n){var t,i,r,u;try{if(t=s.portalConfiguration.attachmentMaxFileSizeBytes,n.size>t)return i=" bytes",t>=1073741824?(t=t/1073741824,i=" GB"):t>=1048576?(t=t/1048576,i=" MB"):t>=1024&&(t=t/1024,i=" KB"),s.toastrService.error("You may only upload files with a maximum size of "+t.format(1)+i,"File size"),!1;if(!n.name.toLowerCase().match(s.portalConfiguration.attachmentAllowedExtensionsRegEx))return s.toastrService.error("You may only upload files with these file extensions: "+s.portalConfiguration.attachmentAllowedExtensionsCsv.replace(/\./g," ").replace(/  /g," ").trim(),"File extension"),!1;if(s.uploader.queue&&(r=n,u=s.uploader.queue.some(function(n){return n.file.name===r.name&&n.file.lastModifiedDate.getTime()===r.lastModifiedDate.getTime()&&n.file.size===r.size?!0:!1}),u))return s.toastrService.error("Duplicate file.","Duplicate"),!1}catch(f){return!1}return!0};this.checkProgress=function(){s.uploader.isUploading?s.$timeout(s.checkProgress,500):s.$timeout(function(){s.$modalInstance.close(s.uploadQty)},500)};this.uploadQty=0;this.uploader=new f;this.uploader.filters.push({name:"isValidFile",fn:this.isValidFile});this.uploader.queueLimit=this.portalConfiguration.attachmentFileLimit}return n.prototype.canUpload=function(){return this.description&&this.uploader.queue.length>0&&!this.canShowUploadProgress},n.prototype.onClickUpload=function(){var n=this;this.canShowUploadProgress=!0;this.uploadQty=this.uploader.queue.length;angular.forEach(this.uploader.queue,function(t){t.url="api/attachmentItem";t.formData=[{relatedId:n.relatedId},{description:n.description}]});try{this.uploader.uploadAll();this.$timeout(this.checkProgress,500)}catch(t){this.toastrService.errorFormatted(t)}},n.$inject=["dialogTitle","relatedId","descriptionOptions","ecToastrService","portalConfiguration","FileUploader","$modalInstance","$timeout"],n}(),i;n.EcFileUploadDialogController=t;i=function(){function n(n,t){this.$modal=n;this.commonServices=t}return n.prototype.showUploadDialog=function(n,i,r,u,f){this.$modal.open({templateUrl:"/home/tmpl/shared/services/ecAttachmentUploadDialog",controller:t,controllerAs:"vm",size:"lg",backdrop:"static",windowClass:"modal-form",resolve:{dialogTitle:function(){return n},relatedId:function(){return i},descriptionOptions:function(){return r}}}).result.then(function(n){n&&n>0&&u(n)}).catch(function(n){f&&f(n)})},n.$inject=["$modal","ecCommonServices"],n}();n.EcAttachmentUploadService=i})(t=n.Services||(n.Services={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").service("ecAttachmentUploadService",Eco.Shared.Services.EcAttachmentUploadService),function(n){var t;(function(n){var t;(function(n){"use strict";var i,t;n.RIGHTS_ACL_DELIM="|";n.RIGHTS_ROOT_MENU_SUFFIX="XX";i=function(){function n(n){this.$httpProvider=n;this.interceptorCore.$inject=["$location","$window","$q","$log"];this.$get.$inject=["$resource","$q","$cookies","$location","$window","ecAppContext"]}return n.prototype.interceptorCore=function(n,t,i,r){return{responseError:function(n){var u=n.config?n.config.url:"";if(n.status===401)r.error("ERROR 401: XMLHttpRequest call failed autentication ["+u+"]"),t.location.href="/login?returnUrl="+encodeURIComponent(t.location.pathname+t.location.hash);else if(n.status===403)if(r.error("ERROR 403: XMLHttpRequest call failed authorization ["+u+"]"),u.indexOf("/api/")>=0)t.location.href="/error403.html";else return n.data="<p>ERROR 403: Template XMLHttpRequest call failed authorization<br /><br />["+u+"].<p>",n.status=200,n.statusText="OK",n;return i.reject(n)},response:function(n){if(n.data&&n.data.toString().indexOf("login-layout")>0){var i=n.config?n.config.url:"";r.error("ERROR 401: XMLHttpRequest call failed authentication ["+i+"]");i.indexOf("/api/")>=0?(t.location.href="/login?returnUrl="+encodeURIComponent(t.location.pathname+t.location.hash),n.data=undefined,n.status=401,n.statusText="Unauthorized"):n.data="<p>ERROR 401: Template XMLHttpRequest call failed authentication<br /><br />["+i+"].<p>"}return n}}},n.prototype.config=function(){this.$httpProvider.interceptors.push(this.interceptorCore)},n.prototype.$get=function(n,i,r,u,f,e){return new t(n,i,r,u,f,e)},n.$inject=["$httpProvider"],n}();n.TokenAuthProvider=i;t=function(){function t(n,t,i,r,u,f){this.$q=t;this.$cookies=i;this.$location=r;this.$window=u;this.routePrefix="/api/login/";this.isLoggingOut=!1;this.loggedInUser=f.loggedInUser;this.accountApi=n(this.routePrefix,{},{login:{method:"POST",url:this.routePrefix+"login"},logout:{method:"POST",url:this.routePrefix+"logout"},register:{method:"POST",url:this.routePrefix+"register"},confirmEmail:{method:"POST",url:this.routePrefix+"confirmEmail"},forgotPassword:{method:"POST",url:this.routePrefix+"forgotPassword"},resetPassword:{method:"POST",url:this.routePrefix+"resetPassword"},changePassword:{method:"POST",url:this.routePrefix+"changePassword"}})}return t.prototype.isAuthed=function(t,i){var u,r,f;if(this.loggedInUser.IsSA||!!!this.loggedInUser.Acl||!!!t.acl)return!0;for(r=1;r<t.acl.length;r++)if(f=t.acl[r].split(":"),f[0]===i){u=f[1];break}return!!u?this.loggedInUser.Acl.split(n.RIGHTS_ACL_DELIM).none(function(n){return n===u}):!0},t.prototype.getAllRights=function(t,i){var o=this,r=[],u="",f=0,e;return t.get().forEach(function(t){var i,e;if((!!!t.acl||t.acl[0]!=="y")&&(!t.activity||(u=t.activity.menuRole+" / "+t.activity.name,r.none(function(n){return n.path===t.activity.menuRole})&&r.push({path:""+t.activity.menuRole,token:t.activity.acl.substr(0,2)+n.RIGHTS_ROOT_MENU_SUFFIX,index:f++}),r.push({path:" ^"+u,token:t.activity.acl,index:f++})),!!t.acl))for(i=1;i<t.acl.length;i++)e=t.acl[i].split(":"),r.push({path:" ^^"+u+" / "+e[0],token:e[1],index:f++})}),e=(i||"").split(n.RIGHTS_ACL_DELIM),r.forEach(function(n){n.restricted=e.some(function(t){return t===n.token});i=o.updateAcl(r,n)}),r},t.prototype.updateAcl=function(t,i){return i.token.endsWith(n.RIGHTS_ROOT_MENU_SUFFIX)?t.findAll(function(n){return n.index>i.index&&n.token.startsWith(i.token.substr(0,2))}).forEach(function(n){n.disabled=i.restricted;i.restricted&&(n.restricted=!1)}):i.token.length===4&&t.findAll(function(n){return n.index>i.index&&n.token.startsWith(i.token.substr(0,4))}).forEach(function(n){n.disabled=i.restricted;i.restricted&&(n.restricted=!1)}),t.findAll(function(n){return n.restricted}).map(function(n){return n.token}).join(n.RIGHTS_ACL_DELIM)},t.prototype.redirectToLogin=function(n){this.$window.location.href="/login?returnUrl="+encodeURIComponent(n)},t.prototype.isLoggedIn=function(){return this.loggedInUser.IsAuthenticated},t.prototype.login=function(n,t){var r=this,i=this.$q.defer();return this.accountApi.login({returnUrl:t},n).$promise.then(function(n){n.Succeeded===!1?r.handleResponse(i,n):(r.$window.location.href=n.ReturnUrl,i.resolve("Success"))}).catch(function(n){r.handleErrorResponse(i,n)}),i.promise},t.prototype.logout=function(){var n=this,t;return this.isLoggingOut=!0,t=this.$q.defer(),this.accountApi.logout(null,null).$promise.then(function(){n.loggedInUser.IsAuthenticated=!1;n.$window.location.href="/";t.resolve("Success")}).catch(function(i){n.handleErrorResponse(t,i)}).finally(function(){n.isLoggingOut=!1}),t.promise},t.prototype.register=function(n){var i=this,t=this.$q.defer();return this.accountApi.register(null,n).$promise.then(function(n){i.handleResponse(t,n)}).catch(function(n){i.handleErrorResponse(t,n)}),t.promise},t.prototype.confirmEmail=function(n){var i=this,t=this.$q.defer();return this.accountApi.confirmEmail(null,n).$promise.then(function(n){i.handleResponse(t,n)}).catch(function(n){i.handleErrorResponse(t,n)}),t.promise},t.prototype.forgotPassword=function(n){var i=this,t=this.$q.defer();return this.accountApi.forgotPassword(null,n).$promise.then(function(n){i.handleResponse(t,n)},function(n){i.handleErrorResponse(t,n)}),t.promise},t.prototype.resetPassword=function(n){var i=this,t=this.$q.defer();return this.accountApi.resetPassword(null,n).$promise.then(function(n){i.handleResponse(t,n)}).catch(function(n){i.handleErrorResponse(t,n)}),t.promise},t.prototype.changePassword=function(n){var i=this,t=this.$q.defer();return this.accountApi.changePassword(null,n).$promise.then(function(n){i.handleResponse(t,n)}).catch(function(n){i.handleErrorResponse(t,n)}),t.promise},t.prototype.handleResponse=function(n,t){t.Succeeded?n.resolve("Success"):n.reject(t.Errors.join("<br />"))},t.prototype.handleErrorResponse=function(n,t){t.data&&(t.data.ExceptionMessage?n.reject(t.data.ExceptionMessage):t.data.error_description?n.reject(t.data.error_description):n.reject(t))},t}();n.TokenAuth=t})(t=n.Services||(n.Services={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").provider("ecAuthService",Eco.Shared.Services.TokenAuthProvider),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t){var i=this;this.$log=n;this.$rootScope=t;this.EXP_ENT_TYPE_WorkflowEco="WorkflowEco";this.EXP_ENT_TYPE_EmailTemplate="EmailTemplate";this.EXP_ENT_TYPE_HtmlContent="HtmlContent";this.EXP_ENT_TYPE_DynamicView="DynamicView";this.EXP_ENT_TYPE_PressAgent="PressAgent";this.EXP_ENT_TYPE_SqlStoredProcedure="SqlStoredProcedure";this.emptyGuid="00000000-0000-0000-0000-000000000000";this.formatErrorMessage=function(n){var t,r,e,o,s,u,h,f;if(!n)return undefined;if(t=undefined,angular.isString(n))t=n;else if(n.data)if(n.data.ExceptionMessage){for(t="",n.data.Message&&(i.$log.error(n.data.Message),t=n.data.Message+"\r\n"),r=n.data;r.InnerException;)t+=r.ExceptionMessage+"\r\n",r=r.InnerException;r.ExceptionType&&i.$log.error(r.ExceptionType);r.StackTrace&&i.$log.error(r.StackTrace);t+=r.ExceptionMessage+"\r\n";i.$log.error(t)}else{if(n.data.ModelState){e=[];for(o in n.data.ModelState)n.data.ModelState.hasOwnProperty(o)&&e.push(n.data.ModelState[o][0]);return e.join("\r\n")}if(n.data.Message)t=n.data.Message,i.$log.error(t);else if(angular.isString(n.data))if(n.data.indexOf("!DOCTYPE")>0){try{s=/<b> Exception Details: <\/b>(.*)<br><br>/;u=n.data.match(s);u&&(t=u[u.length-1])}catch(c){}if(!t)try{h=/<title>(.*)<\/title>/;f=n.data.match(h);f&&(t=f[f.length-1])}catch(c){}}else t=n.data}else n.message?t=n.message:n.Message&&(t=n.Message);return n.addlInfo&&(t=n.addlInfo+" ==> ["+t+"]"),t||"An error has occured."};this.busyShow=function(){i.$rootScope.busy.push()};this.busyHide=function(n){i.$rootScope.busy.pop(n)}}return n.prototype.enumToKeyValuePairs=function(enumName){var kvps=[],_enum=eval(enumName),e,i;for(e in _enum)i=Number(e),isNaN(i)||kvps.push({key:i,value:this.toWords(_enum[i])});return kvps},n.prototype.toWords=function(n){for(var t=n.replace("_"," ").trim().replace("."," ");/([a-z])([A-Z])/.test(t);)t=t.replace(/([a-z])([A-Z])/,function(n,t,i){return t+" "+i});return t.length===1?t.toUpperCase():t.length>1?t[0].toUpperCase()+t.substr(1):t},n.prototype.iconClassForFile=function(n){var t=["ace-icon fa"];if(!n.has(".")){t.push("fa-file-text-o");return}var i=n.substr(n.lastIndexOf(".")+1).toLowerCase();return i==="pdf"?t.push("fa-file-pdf-o"):["jpg","jpeg","png","tiff","gif","bmp","svg"].any(i)?t.push("fa-file-image-o"):["doc","docx"].any(i)?t.push("fa-file-word-o"):["xls","xlsx"].any(i)?t.push("fa-file-excel-o"):["ppt","pptx"].any(i)?t.push("fa-file-powerpoint-o"):["zip","tar","gz"].any(i)?t.push("fa-file-archive-o"):["wmv","mp4","mpg","mp2","mpeg","mpe","avi","mov","qt"].any(i)?t.push("fa-file-video-o"):["wav","aiff","wma","mp3"].any(i)?t.push("fa-file-audio-o"):t.push("fa-file-text-o"),t},n.$inject=["$log","$rootScope"],n}();n.EcCommonServices=t})(t=n.Services||(n.Services={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").service("ecCommonServices",Eco.Shared.Services.EcCommonServices),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t){this.$log=n;this.portalConfiguration=t}return n.prototype.setDocumentTitle=function(n){var r=n.parent,t=this.portalConfiguration.agencyName,i;try{if(this.specialState(t,n))return;n.activity?Array.isArray(n.activity)||(i=n.activity,t=i.menuRole+"/"+i.name+" - "+this.portalConfiguration.agencyName):r&&r.activity?Array.isArray(r.activity)||(i=r.activity,t=i.menuRole+"/"+i.name+" - "+this.portalConfiguration.agencyName):n.name.toLowerCase()==="home"&&(t=n.templateUrl.toString().toLowerCase().indexOf("/admin/")>=0?"Admin Home - "+t:"Home - "+t);this.doSetTitle(t)}catch(u){this.$log.error("ecDocumentTitleService.setDocumentTitle:"+u)}},n.prototype.specialState=function(n,t){if(t.name.toLowerCase().startsWith("workflowwizard"))return this.doSetTitle("Edit Workflow - "+n),!0},n.prototype.doSetTitle=function(n){setTimeout(function(){document.title=n},0)},n.$inject=["$log","portalConfiguration"],n}();n.EcDocumentTitleService=t})(t=n.Services||(n.Services={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").service("ecDocumentTitleService",Eco.Shared.Services.EcDocumentTitleService),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(){}return n.prototype.friendlyEntityName=function(n){return n?n==="ComplaintLog"?"Complaint":n==="ServiceRequest"?"Service Request":n==="Onsite"?"Septic System":"":""},n}();n.EcEntityNameService=t})(t=n.Services||(n.Services={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").service("ecEntityNameService",Eco.Shared.Services.EcEntityNameService),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){this.$rootScope=n;this.Idle=t;this.$modal=i;this.idleWarning=null;this.idleTimedout=null}return n.prototype.closeIdleModals=function(){this.idleWarning&&(this.idleWarning.close(),this.idleWarning=null);this.idleTimedout&&(this.idleTimedout.close(),this.idleTimedout=null)},n.prototype.init=function(n,t){var i=this;n.countdownMax=n.countdown=this.Idle.getTimeout();this.$rootScope.$on("IdleStart",function(){i.closeIdleModals();i.idleWarning=i.$modal.open({templateUrl:"inLayoutPage/idle/warning-dialog.html",scope:n,size:"sm"})});this.$rootScope.$on("IdleWarn",function(t,i){n.$evalAsync(function(){n.countdown=i})});this.$rootScope.$on("IdleEnd",function(){i.closeIdleModals()});this.$rootScope.$on("IdleTimeout",function(){i.closeIdleModals();t();i.idleTimedout=i.$modal.open({templateUrl:"inLayoutPage/idle/timedout-dialog.html",scope:n,size:"sm"})});this.Idle.watch()},n.$inject=["$rootScope","Idle","$modal"],n}();n.EcIdleLogoutService=t})(t=n.Services||(n.Services={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").config(["IdleProvider","portalConfiguration",function(n,t){(!t.idleLogoutSecs||isNaN(t.idleLogoutSecs)||t.idleLogoutSecs<60)&&(t.idleLogoutSecs=1200);n.idle(t.idleLogoutSecs);n.timeout(t.idleLogoutWarnSecs)}]).service("ecIdleLogoutService",Eco.Shared.Services.EcIdleLogoutService),function(n){var t;(function(n){var t;(function(n){"use strict";var t,i,r;(function(n){n[n.sm=0]="sm";n[n.md=1]="md";n[n.lg=2]="lg"})(t=n.ModalSizes||(n.ModalSizes={}));i=function(){function n(n,t,i){this.$scope=n;this.$modalInstance=t;this.doInput=i}return n.prototype.ok=function(){this.doInput?this.$modalInstance.close({value:this.$scope.value,ok:!0}):this.$modalInstance.close(!0)},n.prototype.cancel=function(){this.$modalInstance.dismiss("cancelled")},n.$inject=["$scope","$modalInstance","doInput"],n}();n.EcModalController=i;r=function(){function n(n,t){this.$modal=n;this.commonServices=t}return n.prototype.showOkToDelete=function(n){return n===void 0&&(n="record"),this.showOkCancel({title:"Delete?",message:"This action will delete the selected "+n+". Continue?",icon:"fa-warning text-danger"},!0)},n.prototype.showOkCancel=function(n,r,u){var f="cancel",e="ok",o,s;return r&&(f="no",e="yes"),n.modalSize?angular.isString(n.modalSize)&&(n.modalSize=t[n.modalSize]):n.modalSize=t.sm,n.icon=n.icon?"ace-icon fa "+n.icon:"ace-icon fa fa-info",o="<p>"+n.message+"<\/p>",u&&(o="<label>"+n.message+'<\/label>\n<input type="text" class="form-control" ng-model="value">'),s=this.$modal.open({template:'\n<div class="modal-header">\n\t<h3 class="modal-title">\n\t\t<i class="'+n.icon+'" style="margin-right:4px"><\/i>\n\t\t'+n.title+'\n\t<\/h3>\n<\/div>\n<div class="modal-body">\n\t<div class="form-group">\n\t\t'+o+'\n\t<\/div>\n<\/div>\n<div class="modal-footer text-left">\n\t<ec-button-'+f+' action="vm.cancel()"><\/ec-button-'+f+">\n\t<ec-button-"+e+' action="vm.ok()"><\/ec-button-'+e+">\n<\/div>",controller:i,controllerAs:"vm",size:t[n.modalSize],resolve:{doInput:function(){return!!u}}}),s.result},n.prototype.showErrorMessage=function(n){this.showMessage({title:"ERROR!",icon:"warn",message:this.commonServices.formatErrorMessage(n)})},n.prototype.showMessage=function(n,r){var u="ok",f;return r&&(u="yes"),n.modalSize?angular.isString(n.modalSize)&&(n.modalSize=t[n.modalSize]):n.modalSize=t.sm,n.icon||(n.icon="info"),n.icon==="success"||n.icon==="ok"?n.icon="fa fa-check-circle text-success":n.icon==="info"?n.icon="fa fa-info-circle text-info":n.icon==="danger"?n.icon="fa fa-times-circle text-danger":n.icon==="warn"||n.icon==="warning"?n.icon="fa fa-exclamation-triangle text-warning":n.icon==="ask"||n.icon==="question"?n.icon="fa fa-question-circle":n.icon.startsWith("fa-")?n.icon="fa "+n.icon:n.icon.startsWith("glyphicon-")&&(n.icon="glyphicon "+n.icon),n.icon="ace-icon bigger-240 "+n.icon,f=this.$modal.open({template:'\n<div class="modal-header">\n\t<div class="modal-title clearfix">\n\t\t<div class="row">\n\t\t\t<div class="col-xs-3" style="text-align: center;">\n\t\t\t\t<h4><i class="'+n.icon+'"><\/i><\/h4>\n\t\t\t<\/div>\n\t\t\t<div class="col-xs-9">\n\t\t\t\t<h3 style="margin-top: 10px;">'+n.title+'<\/h3>\n\t\t\t<\/div>\n\t\t<\/div>\n\t<\/div>\n<\/div>\n<div class="modal-body">\n\t<div class="form-group">\n\t\t<p>'+n.message+'<\/p>\n\t<\/div>\n<\/div>\n<div class="modal-footer">\n\t<ec-button-'+u+' action="vm.ok()"><\/ec-button-ok>\n<\/div>',controller:i,controllerAs:"vm",size:t[n.modalSize],resolve:{doInput:function(){return!1}}}),f.result},n.$inject=["$modal","ecCommonServices"],n}();n.EcModalService=r})(t=n.Services||(n.Services={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").service("ecModalService",Eco.Shared.Services.EcModalService),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t){this.$document=t;this.$window=n}return n.prototype.print=function(n,t){n=n||"ReviewPrint";var r=this.$window.document.getElementById(n),i=window.open(undefined,"Review");i.document.writeln("<html><head><title>Review<\/title>");i.document.write('<link rel="stylesheet" href="/Content/ace/ace.css" type="text/css" />');i.document.write('<link rel="stylesheet" href="/Content/ace/ace-fonts.css" type="text/css" />');i.document.write('<link rel="stylesheet" href="/Content/ace/bootstrap.min.css" type="text/css" />');i.document.write('<link rel="stylesheet" href="/Content/font-awesome.css" type="text/css" />');i.document.write("<style>.ng-hide { display: none !important; }<\/style>");i.document.write("<\/head><body>");i.document.write(r.innerHTML.replace(/dl-horizontal/g,""));i.document.write("<\/body>");i.document.write("<\/html>");i.document.close();i.focus();t&&window.setTimeout(function(){i.print();window.setTimeout(function(){i.close()},100)},150)},n.$inject=["$window","$document"],n}();n.EcPrintService=t})(t=n.Services||(n.Services={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").service("ecPrintService",Eco.Shared.Services.EcPrintService),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.commonServices=n}return n.prototype.success=function(n,t){toastr.success(n,angular.isDefined(t)?t:"Success")},n.prototype.info=function(n,t){toastr.info(n,angular.isDefined(t)?t:"Info")},n.prototype.error=function(n,t){toastr.error(n,angular.isDefined(t)?t:"Error")},n.prototype.saved=function(n){toastr.success(n,"Saved")},n.prototype.deleted=function(n){toastr.success(n,"Deleted")},n.prototype.cancelled=function(n){toastr.info(n,"Cancelled")},n.prototype.errorFormatted=function(n){var t=this.commonServices.formatErrorMessage(n);toastr.error(t,"Error")},n.$inject=["ecCommonServices"],n}();n.EcToastrService=t})(t=n.Services||(n.Services={}))})(t=n.Shared||(n.Shared={}))}(Eco||(Eco={}));angular.module("app").service("ecToastrService",Eco.Shared.Services.EcToastrService),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.$resource=n;this.api=this.$resource("/api/cart",null,{getOrder:{method:"GET",url:"/api/cart/order/:orderOid"},addInvoice:{method:"GET",url:"/api/cart/addInvoice/:invoiceOid"},removeItem:{method:"GET",url:"/api/cart/removeItem/:cartItemOid"},removeAllItems:{method:"GET",url:"/api/cart/removeAllItems"},sendReceiptEmailForOrder:{method:"GET",url:"/api/cart/sendReceiptEmailForOrder/:orderOid"}});this.init()}return n.prototype.init=function(){var n=this;return this.$cart=this.api.get(null),this.$cart.$promise.then(function(t){n.updateCart(t)}),this.$cart.$promise},n.prototype.updateCart=function(n){var t=this;n&&(this.Oid=n.Oid,this.Total=n.Total,this.Items=[],angular.forEach(n.Items,function(n){t.Items.push(n)}))},n.prototype.getOrder=function(n){return this.api.getOrder({orderOid:n}).$promise},n.prototype.addInvoice=function(n){var i=this,t=this.api.addInvoice({invoiceOid:n}).$promise;return t.then(function(n){i.updateCart(n)}),t},n.prototype.removeItem=function(n){var i=this,t=this.api.removeItem({cartItemOid:n.Oid}).$promise;return t.then(function(n){i.updateCart(n)}),t},n.prototype.removeAllItems=function(){var t=this,n;if(this.Items)return n=this.api.removeAllItems(null).$promise,n.then(function(n){t.updateCart(n)}),n},n.prototype.sendReceiptEmailForOrder=function(n){return this.api.sendReceiptEmailForOrder({orderOid:n}).$promise},n.prototype.isInCart=function(n){for(var t=0;t<this.Items.length;t++)if(this.Items[t].ItemOid===n)return!0;return!1},n.$inject=["$resource"],n}();n.EcCartService=t})(t=n.DataService||(n.DataService={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").service("ecCartService",Eco.Client.DataService.EcCartService),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.$resource=n;this.api=n("/api/coreFacility/:oid",null,{queryVM:{method:"GET",isArray:!1,url:"/api/facilityVM"},getVM:{method:"GET",isArray:!1,url:"/api/facilityVM/:oid"},removeLink:{method:"DELETE",url:"/api/coreFacility/:coreFacilityOid/removeLink/:securityUserOid"}})}return n.prototype.queryVM=function(){return this.api.queryVM()},n.prototype.getVM=function(n){return this.api.getVM({oid:n})},n.prototype.get=function(n){return this.api.get({oid:n})},n.prototype.removeLink=function(n,t){return this.api.removeLink({coreFacilityOid:n,securityUserOid:t}).$promise},n.$inject=["$resource"],n}();n.EcCoreFacilityService=t})(t=n.DataService||(n.DataService={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").service("ecCoreFacilityService",Eco.Client.DataService.EcCoreFacilityService),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.api=n("/api/coreowner/:oid",{oid:"@Oid"},{getOwnerPreferences:{method:"GET",isArray:!1,url:"/api/coreowner/:oid/preferences"},saveOwnerPreferences:{method:"POST",url:"/api/coreowner/preferences"},claim:{method:"GET",isArray:!1,url:"/api/coreowner/:accountNo/:invoiceNo"},createLinkFromEmail:{method:"GET",isArray:!1,url:"/api/coreowner/:coreOwnerOid/linkemail?userEmail=:userEmail"},removeLink:{method:"DELETE",url:"/api/coreowner/:coreOwnerOid/removeLink/:securityUserOid"},setAsPrimary:{method:"GET",isArray:!1,url:"/api/coreowner/primary/:linkOid"}})}return n.prototype.getOwners=function(){return this.api.query()},n.prototype.getOwnerPreferences=function(n){return this.api.getOwnerPreferences({oid:n})},n.prototype.saveOwnerPreferences=function(n){return this.api.saveOwnerPreferences(null,n).$promise},n.prototype.claim=function(n,t){return this.api.claim({accountNo:n,invoiceNo:t}).$promise},n.prototype.createLinkFromEmail=function(n,t){return this.api.createLinkFromEmail({coreOwnerOid:n,userEmail:t}).$promise},n.prototype.removeLink=function(n,t){return this.api.removeLink({coreOwnerOid:n,securityUserOid:t}).$promise},n.prototype.setAsPrimary=function(n){return this.api.setAsPrimary({linkOid:n}).$promise},n.$inject=["$resource"],n}();n.EcCoreOwnerService=t})(t=n.DataService||(n.DataService={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").service("ecCoreOwnerService",Eco.Client.DataService.EcCoreOwnerService),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t){this.$resource=n;this.$q=t;this.dashboardApi=this.$resource("/api/dashboard",null,{getTasks:{method:"GET",isArray:!1,cache:!1,url:"/api/dashboard/tasks"},ignoreTask:{method:"POST",url:"/api/dashboard/ignoreTask"}})}return n.prototype.ignoreTask=function(n,t){this.myCache&&this.myCache.InformationTasks.remove(function(t){return t.CurrentStateHash===n});return this.dashboardApi.ignoreTask({Hash:n,Importance:t}).$promise},n.prototype.getTasks=function(){var t=this,n=this.$q.defer(),i;return this.myCache?(n.resolve(this.myCache),n.promise):(i=this.dashboardApi.getTasks().$promise,i.then(function(i){i.ImportantTasks.forEach(function(n){angular.isString(n.AssociatedDataJson)&&(n.AssociatedData=JSON.parse(n.AssociatedDataJson),n.AssociatedDataJson=undefined)});i.UpcomingTasks.forEach(function(n){angular.isString(n.AssociatedDataJson)&&(n.AssociatedData=JSON.parse(n.AssociatedDataJson),n.AssociatedDataJson=undefined)});i.InformationTasks.forEach(function(n){angular.isString(n.AssociatedDataJson)&&(n.AssociatedData=JSON.parse(n.AssociatedDataJson),n.AssociatedDataJson=undefined)});t.myCache=i;n.resolve(t.myCache)}),n.promise)},n.prototype.clearCache=function(){this.myCache=undefined},n.$inject=["$resource","$q"],n}();n.EcDashboardService=t})(t=n.DataService||(n.DataService={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").service("ecDashboardService",Eco.Client.DataService.EcDashboardService),function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r,u,f,e,o,s,h,c){this.cart=n;this.coreFacility=t;this.coreOwner=i;this.dashboard=r;this.htmlContent=u;this.imageFile=f;this.invoice=e;this.onlinePayments=o;this.pressAgent=s;this.serviceRequest=h;this.submittal=c}return n.$inject=["ecCartService","ecCoreFacilityService","ecCoreOwnerService","ecDashboardService","ecHtmlContent","ecImageFileService","ecInvoiceService","ecOnlinePaymentsService","ecPressAgentService","ecServiceRequestService","ecSubmittalService"],n}();n.EcDataService=t})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").service("ecDataService",Eco.Client.EcDataService);__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(t){var i;(function(t){"use strict";var i=function(n){function t(t,i){return n.call(this,t,i,"htmlContent",{getByName:{method:"GET",url:"/api/htmlContent/name/:name"}})||this}return __extends(t,n),t.prototype.getByName=function(n){return this.api.getByName({name:n})},t.$inject=["$resource","$q"],t}(n.Shared.Services.ResourceServiceRestfulBase2);t.EcHtmlContentService=i})(i=t.DataService||(t.DataService={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").service("ecHtmlContent",Eco.Client.DataService.EcHtmlContentService),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.api=n("/api/ckeditorimages",{},{rename:{method:"GET",isArray:!1,url:"/api/ckeditorimages/rename"},fixupLogo:{method:"GET",isArray:!1,url:"/api/ckeditorimages/fixupLogo"}})}return n.prototype.query=function(){return this.api.query()},n.prototype.rename=function(n,t){return this.api.rename({fromName:n,toName:t})},n.prototype.delete=function(n){return this.api.delete({fileName:n}).$promise},n.prototype.fixupLogo=function(){return this.api.fixupLogo().$promise},n.$inject=["$resource"],n}();n.EcImageFileService=t})(t=n.DataService||(n.DataService={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").service("ecImageFileService",Eco.Client.DataService.EcImageFileService),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.api=n("/api/invoice/:oid")}return n.prototype.get=function(n){return this.api.get({oid:n})},n.$inject=["$resource"],n}();n.EcInvoiceService=t})(t=n.DataService||(n.DataService={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").service("ecInvoiceService",Eco.Client.DataService.EcInvoiceService),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.$resource=n;this.api=this.$resource("/api/onlinepayments",{},{getUnpaidInvoices:{method:"GET",isArray:!1,url:"/api/onlinepayments/openInvoices/:accountNo/:invoiceNo"}})}return n.prototype.getUnpaidInvoices=function(n,t){return this.api.getUnpaidInvoices({accountNo:n,invoiceNo:t})},n.$inject=["$resource"],n}();n.EcOnlinePaymentsService=t})(t=n.DataService||(n.DataService={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").service("ecOnlinePaymentsService",Eco.Client.DataService.EcOnlinePaymentsService),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.api=n("/api/pressAgentClient/",{},{searchFacilities:{isArray:!0,method:"POST",url:"/api/pressAgentClient/searchFacilities"},programs:{isArray:!0,method:"GET",url:"/api/pressAgentClient/programs"},facilityDetail:{isArray:!0,method:"GET",url:"/api/pressAgentClient/facilityDetail"},inspections:{isArray:!0,method:"GET",url:"/api/pressAgentClient/inspections"}})}return n.prototype.programs=function(n){return this.api.programs(n)},n.prototype.searchFacilities=function(n,t){return this.api.searchFacilities(n,t)},n.prototype.inspections=function(n){return this.api.inspections(n)},n.prototype.facilityDetail=function(n){return this.api.facilityDetail(n)},n.$inject=["$resource"],n}();n.EcPressAgentService=t})(t=n.DataService||(n.DataService={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").service("ecPressAgentService",Eco.Client.DataService.EcPressAgentService),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.$resource=n;this.api=n("/api/serviceRequest/:oid",null,{queryVM:{method:"GET",isArray:!0,url:"/api/serviceRequestVM"},getVM:{method:"GET",isArray:!1,url:"/api/serviceRequestVM/:oid"}})}return n.prototype.queryVM=function(n){return n&&this.srCache||(this.srCache=this.api.queryVM()),this.srCache},n.prototype.getVM=function(n){return this.api.getVM({oid:n})},n.$inject=["$resource"],n}();n.EcServiceRequestService=t})(t=n.DataService||(n.DataService={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").service("ecServiceRequestService",Eco.Client.DataService.EcServiceRequestService),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r,u){this.$rootScope=t;this.$state=i;this.$q=r;this.authService=u;this.api=n("/api/submittal/:oid",{},{create:{method:"GET",isArray:!1,url:"/api/submittal/create/:workflowOid"},cloneAsDraft:{method:"GET",isArray:!1,url:"/api/submittal/:submittalOid/clone"},sendEmailNotificationToUser:{method:"GET",isArray:!1,url:"/api/submittal/:submittalOid/sendEmailNotificationToUser"},submitSR:{method:"POST",url:"/api/servicerequest"},submitCO:{method:"POST",url:"/api/complaintlog"},getWorkflowPayments:{method:"GET",isArray:!0,url:"/api/submittal/workflowPayments/:workflowOid"}});this.routerStates=i.get().filter(function(n){return!!n.activity&&!!n.data&&!!n.data.wizardConfig})}return n.prototype.create=function(n,t,i){return this.api.create({workflowOid:n,facilityOid:t,accountsReceivableOid:i})},n.prototype.get=function(n){var t=this.api.get({oid:n});return t.$promise.then(function(n){n.WorkflowEntity=JSON.parse(n.SubmittedJson);n.SubmittedJson=undefined}),t},n.prototype.submit=function(n){var t,i=angular.copy(n),r;if(i.SubmittedJson=angular.toJson(n.WorkflowEntity),i.WorkflowEntity=undefined,n.RecordType==="SR")t=this.api.submitSR({Submittal:i,EntityJson:n.WorkflowEntity}).$promise;else if(n.RecordType==="CO")t=this.api.submitCO({Submittal:i,EntityJson:n.WorkflowEntity}).$promise;else return r=this.$q.defer(),r.reject("Unsupported submittal.RecordType!"),r.promise;return this.notify(t),t},n.prototype.sendEmailNotificationToUser=function(n){this.api.sendEmailNotificationToUser({submittalOid:n.Oid})},n.prototype.queryDrafts=function(){return!this.authService.isLoggedIn()||this.authService.isLoggingOut?undefined:this.api.query()},n.prototype.editDraftGo=function(n){var t=this;this.$rootScope.busy.push();this.get(n).$promise.then(function(n){if(n.WorkflowOid){var i=t.routerStates.find(function(t){return t.data.wizardConfig.workflowOid===n.WorkflowOid});i&&t.$state.go(i.name,{submittal:n},{reload:!0,inherit:!1})}}).finally(function(){t.$rootScope.busy.pop()})},n.prototype.cloneAsDraft=function(n){var t=this;return this.api.cloneAsDraft({submittalOid:n}).$promise.finally(function(){t.$rootScope.$broadcast("SUBMITTAL_UPDATE")})},n.prototype.saveDraft=function(n,t){var r,i,u;return!t&&n.IsDraft&&!this.authService.isLoggedIn()?(r=this.$q.defer(),r.resolve(),r.promise):(i=angular.copy(n),i.SubmittedJson=angular.toJson(i.WorkflowEntity),i.WorkflowEntity=undefined,u=this.api.save(i).$promise,this.notify(u),u)},n.prototype.deleteDraft=function(n){if(n&&n.Oid&&n.IsDraft){var t=this.api.delete({oid:n.Oid}).$promise;return this.notify(t),t}},n.prototype.getWorkflowPayments=function(n){return this.api.getWorkflowPayments({workflowOid:n})},n.prototype.notify=function(n){var t=this;n&&n.$promise&&(n=n.$promise);this.$q.when(n).then(function(){t.$rootScope.$broadcast("SUBMITTAL_UPDATE")})},n.$inject=["$resource","$rootScope","$state","$q","ecAuthService"],n}();n.EcSubmittalService=t})(t=n.DataService||(n.DataService={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").service("ecSubmittalService",Eco.Client.DataService.EcSubmittalService),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(){this.require="ngModel";this.restrict="A";this.transclude=!1;this.replace=!1;this.link=function(n,t,i,r){var u=new Date;u.setHours(0,0,0,0);t.datetimepicker({pickDate:!1,format:"hh:mm A",useSeconds:!1,pick12HourFormat:!0,useCurrent:!1,defaultDate:u}).next().on("click",function(){$(this).prev().focus()});t.on("dp.change",function(n){r&&r.$setViewValue(n.target.value)});t.on("dp.error",function(n){n.target.value="";r&&r.$setViewValue(n.target.value)})}}return n.factory=function(){return function(){return new n}},n}();n.EcAceTimePickerDirective=t})(t=n.Directives||(n.Directives={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").directive("ecAceTimePicker",Eco.Client.Directives.EcAceTimePickerDirective.factory()),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(){this.restrict="E";this.transclude=!1;this.replace=!0;this.templateUrl="/home/tmpl/client/directives/ecAttachmentList";this.scope={uploader:"=",description:"@",noactions:"="}}return n.factory=function(){return function(){return new n}},n}();n.EcAttachmentListDirective=t})(t=n.Directives||(n.Directives={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").directive("ecAttachmentList",Eco.Client.Directives.EcAttachmentListDirective.factory());__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(t){var i;(function(t){"use strict";var i=function(){function n(n,t,i,r){var u=this;this.$scope=n;this.$state=t;this.ds=i;this.modalService=r;this.setInCartStatus=function(){u.$scope.onlinePaymentInvoice&&(u.$scope.onlinePaymentInvoice.IsInCart=u.ds.cart.isInCart(u.$scope.onlinePaymentInvoice.InvoiceOid),u.$scope.onlinePaymentInvoice.IsInCart&&(u.$button.children("span").text("View in Cart"),u.$button.removeClass("btn-primary"),u.$button.addClass("btn-yellow")))};this.$scope.$watch("onlinePaymentInvoice",function(n){n&&u.setInCartStatus()});this.$scope.action=function(){u.addToCartClick()}}return n.prototype.viewReceipt=function(){this.$state.go("paymentReceipt",{orderOid:this.$scope.onlinePaymentInvoice.OrderOid})},n.prototype.addToCartClick=function(){var i=this,t;if(this.$scope.onlinePaymentInvoice){if(this.$scope.onlinePaymentInvoice.IsInCart){this.$state.go("viewcart");return}this.$scope.onlinePaymentInvoice.ShowAsUnknownState?(t=this.modalService.showOkCancel({title:"Notice!",message:n.TEXT.IncompleteMsg,icon:"fa-warning text-danger"},!0),t.then(function(){i.addItToCart()})):this.addItToCart()}},n.prototype.addItToCart=function(){var n=this;this.ds.cart.addInvoice(this.$scope.onlinePaymentInvoice.InvoiceOid).then(function(){n.$scope.onlinePaymentInvoice.IsInCart=!0;toastr.success("Invoice has been added to cart.","Shopping Cart");n.setInCartStatus()})},n.TEXT={IncompleteLbl:"Incomplete",IncompleteMsg:"The payment process was started for this invoice but may not have been submitted. If you believe that process has failed you can pay it again here, otherwise you can return here in 24 hours and see if it has processed.",ProcessingLbl:"Processing",ProcessingMsg:"This invoice has been paid online. It may take up to 24 hours to process.",PaidLbl:"Paid on"},n.$inject=["$scope","$state","ecDataService","ecModalService"],n}(),r;t.EcButtonAddToCartController=i;r=function(n){function t(t){var r=n.call(this,t)||this;return r.replace=!1,r.scope={onlinePaymentInvoice:"=",btnSize:"@size"},r.controller=i,r.controllerAs="vm",r.compile=function(n){return n.children().first().attr("ng-hide","(onlinePaymentInvoice.ShowAsPaid || onlinePaymentInvoice.ShowAsPending)"),n.append('<span ng-if="onlinePaymentInvoice.ShowAsUnknownState">&nbsp;\n\t<ec-help-badge class="badge-danger" text="'+i.TEXT.IncompleteMsg+'"><\/ec-help-badge>\n<\/span>'),n.append('<span ng-if="onlinePaymentInvoice.ShowAsPending">\n\t<span class="label label-warning arrowed arrowed-right">'+i.TEXT.ProcessingLbl+'<\/span>&nbsp;\n\t<ec-help-badge class="badge-warning" text="'+i.TEXT.ProcessingMsg+'"><\/ec-help-badge>\n<\/span>'),n.append('<a ng-if="onlinePaymentInvoice.ShowAsPaid && !onlinePaymentInvoice.ShowReceipt" href="">\n\t<span class="label label-success arrowed arrowed-right">'+i.TEXT.PaidLbl+"&nbsp;{{ ::onlinePaymentInvoice.PaidDate }}<\/span>\n<\/a>"),n.append('<a ng-if="onlinePaymentInvoice.ShowReceipt" href="" title="Click to view receipt" ng-click="vm.viewReceipt()">\n\t<span class="label label-success arrowed arrowed-right">'+i.TEXT.PaidLbl+"&nbsp;{{ ::onlinePaymentInvoice.PaidDate }}<\/span>\n<\/a>"),function(n,t,i,r){r.$button=t.children("button").first()}},r}return __extends(t,n),t.factory=function(){return function(){return new t({icon:"fa fa-shopping-cart",text:"Add to Cart",title:"Add this invoice to the shopping cart.",addlClass:"btn-primary"})}},t}(n.Shared.Directives.EcButtonDirectiveBase);t.EcButtonAddToCartDirective=r})(i=t.Directives||(t.Directives={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").directive("ecButtonAddtocart",Eco.Client.Directives.EcButtonAddToCartDirective.factory());__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(t){var i;(function(t){"use strict";var i=function(){function n(n){var t=this;this.$scope=n;this.$scope.action=function(){var n="/attachmentitem/"+t.$scope.entityType+"/"+t.$scope.itemid;window.open(n,"_blank")}}return n.$inject=["$scope"],n}(),r;t.EcButtonAttachmentController=i;r=function(n){function t(t){var r=n.call(this,t)||this;return r.replace=!1,r.scope={itemid:"="},r.controller=i,r.link=function(n){n.entityType=r.defaults.entityType},r}return __extends(t,n),t.factory=function(n,i,r,u,f){return function(){return new t({entityType:n,icon:i,text:r,title:u,addlClass:f})}},t}(n.Shared.Directives.EcButtonDirectiveBase);t.EcButtonAttachmentDirective=r})(i=t.Directives||(t.Directives={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").directive("ecButtonAttachmentPermit",Eco.Client.Directives.EcButtonAttachmentDirective.factory("Permit","fa-file-text-o","View Permit","View and print the permit.","btn-primary")).directive("ecButtonAttachmentInspection",Eco.Client.Directives.EcButtonAttachmentDirective.factory("Inspection","fa-file-text-o","View Inspection","View and print the inspection.","btn-primary")),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(){var n=this;this.INTEGER_REGEXP=/^[1-9]+[0-9]*$/;this.require="ngModel";this.link=function(t,i,r,u){u.$validators.integer=function(t,i){return u.$isEmpty(t)?!0:n.INTEGER_REGEXP.test(i)}}}return n.factory=function(){return function(){return new n}},n}();n.EcIntegerDirective=t})(t=n.Directives||(n.Directives={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").directive("ecInteger",Eco.Client.Directives.EcIntegerDirective.factory()),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){var r=this;this.$filter=n;this.$timeout=t;this.$log=i;this.restrict="A";this.require="ngModel";this.link=function(n,t,i,u){var f=!!i.required;t.on("blur",function(){r.$timeout(function(){t.val(r.$filter("ecPhoneFormat")(u.$viewValue))},10)});t.on("focus",function(){t.val(u.$modelValue||u.$viewValue);t.select()});u.$validators.badnumber=function(n,t){var i=n||t||"";return!f&&i.length===0||i.length===10};u.$parsers.push(function(n){var i=r.getDigitsOnly(n).substr(0,10);return t.val(i),u.$setViewValue(i),i});u.$formatters.push(function(n){return r.$filter("ecPhoneFormat")(n)})};this.getDigitsOnly=function(n){return(n||"").replace(/[^0-9]/g,"")}}return n.factory=function(){var t=function(t,i,r){return new n(t,i,r)};return t.$inject=["$filter","$timeout","$log"],t},n}();n.EcPhoneInputDirective=t})(t=n.Directives||(n.Directives={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").directive("ecPhoneInput",Eco.Client.Directives.EcPhoneInputDirective.factory()),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t){var i=this;this.$scope=n;this.supportCodeService=t;n.supportCode?this.getData():n.$watch("supportCode",function(n){n&&i.getData()})}return n.prototype.getData=function(){var n=this;this.$scope.supportCodeName.toLowerCase()==="employee"?this.supportCodeService.getEmployees(this.$scope.supportCode).$promise.then(function(t){n.$scope.label=!t||t.length<1?n.$scope.supportCode:t[0].FirstName+" "+t[0].LastName}):this.supportCodeService.getSupportCodes(this.$scope.supportCodeName,this.$scope.supportCode).$promise.then(function(t){n.$scope.label=!t||t.length<1?n.$scope.supportCode:t[0].Description===t[0].Code?t[0].Description:t[0].Description+" ("+t[0].Code+")"})},n.$inject=["$scope","ecSupportCodeService"],n}(),i;n.EcSupportCodeLabelController=t;i=function(){function n(){this.restrict="E";this.template="<span>{{label}}<\/span>";this.replace=!0;this.controller=t;this.scope={supportCode:"=ngModel",supportCodeName:"@"}}return n.factory=function(){return function(){return new n}},n}();n.EcSupportCodeLabelDirective=i})(t=n.Directives||(n.Directives={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").directive("ecSupportCodeLabel",Eco.Client.Directives.EcSupportCodeLabelDirective.factory()),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){var r=this;this.$filter=n;this.$timeout=t;this.$log=i;this.restrict="A";this.require="ngModel";this.link=function(n,t,i,u){var f=!!i.required;t.on("blur",function(){r.$timeout(function(){t.val(r.$filter("ecZipcodeFormat")(u.$viewValue))},10)});t.on("focus",function(){t.val(u.$modelValue||u.$viewValue);t.select()});u.$validators.badnumber=function(n,t){var i=n||t||"";return!f&&i.length===0||i.length>4&&/(^\d{5}(-\d{4})?$)|(^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$)/gi.test(i)};u.$parsers.push(function(n){var i=n;return t.val(i),u.$setViewValue(i),i});u.$formatters.push(function(n){return r.$filter("ecZipcodeFormat")(n)})}}return n.factory=function(){var t=function(t,i,r){return new n(t,i,r)};return t.$inject=["$filter","$timeout","$log"],t},n}();n.EcZipcodeInputDirective=t})(t=n.Directives||(n.Directives={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").directive("ecZipcodeInput",Eco.Client.Directives.EcZipcodeInputDirective.factory()),function(n){var t;(function(n){var t;(function(n){"use strict";var i=function(){function n(){this.require="form";this.restrict="E";this.link=function(n,t,i,r){r.submitForm=function(){t.submit()}}}return n.factory=function(){return function(){return new n}},n}(),t;n.FormDirective=i;t=function(){function n(n){var t=this;this.$timeout=n;this.restrict="A";this.link=function(n,i){t.$timeout(function(){i.submit()},0)}}return n.factory=function(){var t=function(t){return new n(t)};return t.$inject=["$timeout"],t},n}();n.AutoSubmitFormDirective=t})(t=n.Directives||(n.Directives={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").directive("form",Eco.Client.Directives.FormDirective.factory()).directive("autoSubmitForm",Eco.Client.Directives.AutoSubmitFormDirective.factory());__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){var r=this;this.$scope=n;this.$stateParams=t;this.$state=i;this.targetedOid=undefined;this.$scope.$on("expand",function(n,t){r.detailMode||(r.$scope.expanded=t.expand)});this.init()}return n.prototype.init=function(){this.$stateParams&&this.data&&this.data.Oid===this.$stateParams.entityOid&&(this.targetedOid=this.data.Oid,this.$scope.expanded=!0)},n.prototype.isTargetedCard=function(){return this.$scope&&this.data&&this.data.Oid===this.targetedOid},n.prototype.toggleExpanded=function(){this.detailMode||(this.$scope.expanded=!this.$scope.expanded)},n}(),i,r;n.EcCardViewBaseController=t;i=function(n){function t(t,i,r){return n.call(this,t,i,r)||this}return __extends(t,n),t.$inject=["$scope","$stateParams","$state"],t}(t);n.EcBasicCardCtrl=i;r=function(){function n(n,t){var i=this;this.tmplUrl=n;this.controller=t;this.templateUrl=function(n,t){return i.tmplUrl+"?isDetailMode="+t.detailMode};this.bindings={data:"<ecModel",detailMode:"<"};this.controllerAs="vm";this.templateUrl.$inject=["$element","$attrs"]}return n}();n.EcCardViewBaseComp=r})(t=n.Directives||(n.Directives={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r,u,f,e){var o=this,s;this.$scope=n;this.$rootScope=t;this.$state=i;this.$q=r;this.ds=f;this.authService=e;this.cart=f.cart;s=i.get().filter(function(n){return!!n.activity});this.menuItems=u.getGroupedMenuItems(s);this.drafts=this.ds.submittal.queryDrafts();this.$scope.hideLogo=!1;this.$rootScope.$on("SUBMITTAL_UPDATE",function(){o.ds.submittal.queryDrafts().$promise.then(function(n){o.drafts=n})})}return n.prototype.isMenuOpen=function(n){for(var t=0;t<n.length;t++)if(this.isMenuActive(n[t]))return!0;return!1},n.prototype.isMenuActive=function(n){if(n&&n.stateName){var t=n.stateName.split("(").first().split(".").first().toLocaleLowerCase(),i=this.$state.current.name.toLowerCase();return i===t||i===t+"s"||i.replace("y","ies")===t}return!1},n.prototype.logout=function(){var n=this,t;this.authService.isLoggingOut=!0;this.ds.submittal.triggerSave&&(t=this.ds.submittal.triggerSave());this.$q.when(t).then(function(){n.authService.logout().finally(function(){n.authService.isLoggingOut=!1})})},n.prototype.editDraft=function(n){this.ds.submittal.editDraftGo(n.Oid)},n.prototype.onMenuItemClick=function(n){if(n.length===1)this.onMenuSubItemClick(n[0])},n.prototype.onMenuSubItemClick=function(n){this.$state.go(n.stateName,null,{reload:!0,inherit:!1})},n.prototype.newInstanceId=function(){return this.$scope.data.instanceId},n.$inject=["$scope","$rootScope","$state","$q","ecActivitiesService","ecDataService","ecAuthService"],n}();n.EcActivitiesController=t})(t=n.Main||(n.Main={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("ecActivitiesController",Eco.Client.Main.EcActivitiesController),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r){t.otherwise(i.homePagePath);r&&r.forEach(function(t){t.templateUrl&&t.templateUrl.has("/services")&&(t.templateUrl+="?v="+Date.now().toString());t.templateUrl&&t.templateUrl.startsWith("/wfc/")&&t.templateUrl.has("/wiz/")&&(t.params={submittal:undefined,facilityOid:undefined,accountsReceivableOid:undefined});t.controller==="wfcRevCtrl"&&(t.resolve={$modalInstance:function(){return{}}});n.state(t)});n.state("submitSuccess",{url:"/submitSuccess/:workflowOid",templateUrl:function(n){return"/workflowClient/workflowSubmitSuccess/"+n.workflowOid},controller:"workflowSubmitSuccessController",controllerAs:"vm"});n.state("submittalReview",{url:"/submittalReview/:workflowOid/:submittalOid?:submitted&:doPayLater",templateUrl:function(n){return"/WorkflowClient/WorkflowReview/"+n.workflowOid},controller:"wfcRevCtrl",controllerAs:"vm",resolve:{$modalInstance:function(){return null}}});var u={url:"/review/:workflowOid/:submittalOid",onEnter:["$stateParams","$state","$modal",function(n,t,i){i.open({templateUrl:function(){return"/WorkflowClient/WorkflowReview/"+n.workflowOid+"/dialog"},controller:"wfcRevCtrl",controllerAs:"vm",size:"md",backdrop:"static"}).result.finally(function(){t.go("^")})}]};n.state("LinkedServiceRequests.Review",u);n.state("LinkedServiceRequest.Review",u);n.state("viewcart",{url:"/cart",templateUrl:"/home/tmpl/cart/cartView",controller:"cartViewController",controllerAs:"vm"});n.state("makepaymentFromCart",{url:"/paymentService/fromCart",templateUrl:function(){return"/paymentService/fromCart?"+Math.random()}});n.state("makePaymentFromSubmittal",{url:"/paymentService/fromSubmittal/:submittalOid",templateUrl:function(n){return"/paymentService/fromSubmittal/"+n.submittalOid}});n.state("paymentCanceled",{url:"/paymentService/paymentCanceled",templateUrl:"/paymentService/paymentCanceled",data:{title:"Payment Canceled"}});n.state("paymentFailed",{url:"/paymentService/paymentFailed",templateUrl:"/paymentService/paymentFailed",data:{title:"Payment Failed"}});n.state("paymentReceipt",{url:"/paymentService/paymentReceipt/:orderOid",templateUrl:"/paymentService/paymentReceipt",controller:"paymentReceiptController",controllerAs:"vm",data:{title:"Receipt"},resolve:{order:["ecDataService","$stateParams",function(n,t){return n.cart.getOrder(t.orderOid)}]}})}return n.$inject=["$stateProvider","$urlRouterProvider","portalConfiguration","dynamicRoutes"],n}();n.EcRouteConfig=t})(t=n.Main||(n.Main={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").config(Eco.Client.Main.EcRouteConfig),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.activities=n.get().filter(function(n){return n.activity&&n.activity.showLaunchPanel}).sortBy(function(n){return n.activity.name}).sortBy(function(n){return n.activity.sort}).sortBy(function(n){return n.activity.menuSort}).map(function(n){return n.activity})}return n.$inject=["$state"],n}();n.ServicesController=t})(t=n.Main||(n.Main={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("servicesController",Eco.Client.Main.ServicesController);__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(n){function t(t,i,r,u){var f=n.call(this,t,i,r)||this;return f.$window=u,f}return __extends(t,n),t.prototype.onClickViewAttachment=function(n){var t="/attachmentitem/submittal/"+n.Oid;this.$window.open(t,"_blank")},t.prototype.onClickDeleteAttachment=function(n){alert("Delete attachment "+n.Oid)},t.$inject=["$scope","$stateParams","$state","$window"],t}(n.EcCardViewBaseController),i;n.EcAttachmentCardCtrl=t;i=function(n){function i(){return n.call(this,"/AttachmentDefinition/ecAttachmentCard",t)||this}return __extends(i,n),i}(n.EcCardViewBaseComp);n.EcAttachmentCardComp=i})(t=n.Directives||(n.Directives={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").component("ecAttachmentCard",new Eco.Client.Directives.EcAttachmentCardComp),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){var r=this;this.$scope=n;this.$stateParams=t;this.$attrs=i;this.targetedOid=undefined;this.expanded=!1;this.$onInit=function(){r.expanded||(r.expanded=r.detailMode)};this.$stateParams&&this.data&&this.data.Oid===this.$stateParams.entityOid&&(this.targetedOid=this.data.Oid,this.expanded=!0);this.$scope.$on("expand",function(n,t){r.detailMode||(r.expanded=t.expand)})}return Object.defineProperty(n.prototype,"hasDetailLink",{get:function(){return!!this.$attrs.detailClick},enumerable:!0,configurable:!0}),n.prototype.isTargetedCard=function(){return this.data&&this.data.Oid===this.targetedOid},n.prototype.toggleExpanded=function(){this.detailMode||(this.expanded=!this.expanded)},n.$inject=["$scope","$stateParams","$attrs"],n}(),i;n.EcCardViewCtrl=t;i=function(){function n(){this.templateUrl=function(n,t){return"/CardViewComp/ecCardViewComp?entityType="+t.entityType+"&isDetailMode="+t.detailMode};this.transclude={titleSlot:"?itemTitle",titleDetailSlot:"?itemTitleDetail",infoSlot:"?itemInfo",toolSlot:"?tools"};this.bindings={data:"<ecModel",detailMode:"<",entityType:"@",detailOnClick:"&detailClick"};this.controller=t;this.controllerAs="vm";this.templateUrl.$inject=["$element","$attrs"]}return n}();n.EcCardViewComp=i})(t=n.Directives||(n.Directives={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").component("ecCardView",new Eco.Client.Directives.EcCardViewComp),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t){this.$scope=n;this.$attrs=t;this.expandedAll=!1}return n.prototype.toggleExpanded=function(){this.expanded=!this.expanded;!this.expanded&&this.expandedAll&&(this.expandedAll=!1)},n.prototype.expandAll=function(n){n&&n.stopPropagation();this.expandedAll=!this.expandedAll;this.expanded=this.expandedAll;this.$scope.$broadcast("expand",{expand:this.expandedAll})},n.$inject=["$scope","$attrs"],n}(),i;n.EcCardViewSectionCtrl=t;i=function(){function n(){this.templateUrl="/CardViewComp/ecCardViewSectionComp";this.transclude={titleSlot:"?sectionTitle",listSlot:"?itemList"};this.bindings={items:"<",expanded:"<"};this.controller=t;this.controllerAs="vm"}return n}();n.EcCardViewSectionComp=i})(t=n.Directives||(n.Directives={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").component("ecCardViewSection",new Eco.Client.Directives.EcCardViewSectionComp),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){var t=this;this.ds=n;this.handleError=function(n){t.error=n};this.cart=n.cart;this.cart.init().catch(this.handleError)}return n.prototype.removeItem=function(n){this.cart.removeItem(n).catch(this.handleError)},n.$inject=["ecDataService"],n}();n.EcCartViewController=t})(t=n.Cart||(n.Cart={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("cartViewController",Eco.Client.Cart.EcCartViewController);__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(t){function i(){return t.call(this,"/ComplaintLog/ecComplaintCard",n.EcBasicCardCtrl)||this}return __extends(i,t),i}(n.EcCardViewBaseComp);n.EcComplaintCardComp=t})(t=n.Directives||(n.Directives={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").component("ecComplaintCard",new Eco.Client.Directives.EcComplaintCardComp);__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(t){function i(){return t.call(this,"/CoreDaily/ecDailyCard",n.EcBasicCardCtrl)||this}return __extends(i,t),i}(n.EcCardViewBaseComp);n.EcDailyCardComp=t})(t=n.Directives||(n.Directives={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").component("ecDailyCard",new Eco.Client.Directives.EcDailyCardComp);__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(t){var i;(function(t){"use strict";var i=function(t){function i(i,r,u,f,e){var o=t.call(this,i,r,u)||this;return o.modalService=f,o.ds=e,o.workflows=u.get().filter(function(t){return!!t.activity&&t.activity.workflowOid&&!!t.data&&!!t.data.wizardConfig&&t.data.wizardConfig.workflowEntityType===n.WorkflowEntityTypes.ServiceRequest}).map(function(n){return n.activity}).sortBy("name").sortBy("sort"),o}return __extends(i,t),i.prototype.workflowOnClick=function(n,t){this.$state.go(n.stateName,{facilityOid:t.Oid},{reload:!0,inherit:!1})},i.prototype.removeUserLink=function(n){var t=this;this.modalService.showOkToDelete("User link").then(function(){t.ds.coreFacility.removeLink(t.data.Oid,n.Oid).then(function(){t.data.LinkedUsers.remove(n)}).catch(function(){toastr.error("Error removing owner/user link")})})},i.prototype.detailOnClick=function(){this.$state.go("LinkedFacility",{facilityOid:this.data.Oid})},i.$inject=["$scope","$stateParams","$state","ecModalService","ecDataService"],i}(t.EcCardViewBaseController),r;t.EcFacilityCardCtrl=i;r=function(n){function t(){return n.call(this,"/CoreFacility/ecFacilityCard",i)||this}return __extends(t,n),t}(t.EcCardViewBaseComp);t.EcFacilityCardComp=r})(i=t.Directives||(t.Directives={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").component("ecFacilityCard",new Eco.Client.Directives.EcFacilityCardComp),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){this.ds=i;this.expanded={permits:!1,invoices:!1,dailies:!1};n.busy.push();this.data=this.ds.coreFacility.getVM(t.facilityOid);this.data.$promise.then(function(){}).finally(function(){n.busy.pop()});this.expanded.permits=t&&!!t.entityType&&t.entityType.toLowerCase()==="permits";this.expanded.invoices=t&&!!t.entityType&&t.entityType.toLowerCase()==="invoices";this.expanded.dailies=t&&!!t.entityType&&t.entityType.toLowerCase()==="inspections"}return n.$inject=["$rootScope","$stateParams","ecDataService"],n}();n.EcFacilityDetailController=t})(t=n.CoreFacility||(n.CoreFacility={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("facilityDetailController",Eco.Client.CoreFacility.EcFacilityDetailController),function(n){var t;(function(n){var t;(function(n){"use strict";var t=15,i=function(){function n(n,i){var r=this;this.isLoading=!0;this.allItems=[];this.pagedItems=[];this.onPageChange=function(n){r.pagedItems.length=0;r.pagedItems.add(r.allItems.slice(n.itemStart,n.itemEnd))};n.busy.push();i.coreFacility.queryVM().$promise.then(function(n){r.allItems=n.Data;r.pagerParams={totalItems:n.TotalQty,itemsPerPage:t,onPageChange:r.onPageChange}}).finally(function(){n.busy.pop();r.isLoading=!1})}return n.$inject=["$rootScope","ecDataService"],n}();n.EcLinkedFacilitiesController=i})(t=n.CoreFacility||(n.CoreFacility={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("linkedFacilitiesController",Eco.Client.CoreFacility.EcLinkedFacilitiesController);__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(n){function t(t,i,r,u,f){var e=n.call(this,t,i,r)||this;return e.modalService=u,e.ds=f,e}return __extends(t,n),t.prototype.removeOwner=function(n){var t=this;this.modalService.showOkToDelete("owner link").then(function(){t.ds.coreOwner.removeLink(n).then(function(){t.ds.dashboard.clearCache();t.$state.go("LinkedOwners",{},{reload:!0,inherit:!1});toastr.info("Owner Removed")},function(){toastr.error("Error removing owner")})})},t.prototype.detailOnClick=function(){this.$state.go("OwnerPreferences",{ownerOid:this.data.Oid})},t.$inject=["$scope","$stateParams","$state","ecModalService","ecDataService"],t}(n.EcCardViewBaseController),i;n.EcOwnerCardCtrl=t;i=function(n){function i(){return n.call(this,"/CoreOwner/ecOwnerCard",t)||this}return __extends(i,n),i}(n.EcCardViewBaseComp);n.EcOwnerCardComp=i})(t=n.Directives||(n.Directives={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").component("ecOwnerCard",new Eco.Client.Directives.EcOwnerCardComp),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){t.busy.push();n.isLoading=!0;n.owners=i.coreOwner.getOwners();n.owners.$promise.finally(function(){t.busy.pop();n.isLoading=!1})}return n.$inject=["$scope","$rootScope","ecDataService"],n}();n.EcLinkedOwnersController=t})(t=n.CoreOwner||(n.CoreOwner={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("linkedOwnersController",Eco.Client.CoreOwner.EcLinkedOwnersController),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){this.$scope=n;this.$state=t;this.ds=i;this.model=undefined}return n.prototype.formatRecordId=function(n,t){return t=t.trim().toUpperCase(),!t.startsWith(n)&&t.length<9&&(t=n+t.padLeft(7,"0")),t},n.prototype.submit=function(n){var t=this;n.$valid&&(this.error=undefined,this.accountNo=this.formatRecordId("AR",this.accountNo),this.invoiceNo=this.formatRecordId("IN",this.invoiceNo),this.ds.coreOwner.claim(this.accountNo,this.invoiceNo).then(function(n){n.StatusMessage?t.error={message:n.StatusMessage}:(toastr.success("Successfully linked to "+n.OwnerName,"Link Owner"),t.accountNo=undefined,t.invoiceNo=undefined,t.ds.dashboard.clearCache(),t.$state.go("OwnerPreferences",{ownerOid:n.OwnerOid}))}).catch(function(n){t.error=n}))},n.$inject=["$scope","$state","ecDataService"],n}();n.OwnerClaimController=t})(t=n.OwnerClaim||(n.OwnerClaim={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("ownerClaimController",Eco.Client.OwnerClaim.OwnerClaimController),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r,u,f){this.$scope=n;this.$state=t;this.$stateParams=i;this.modalService=r;this.commonServices=u;this.ds=f;this.showAddUser=!1;this.userToAdd="";this.hideAddUser();this.allowEdit=!0;this.getOwnerInfo()}return n.prototype.getOwnerInfo=function(){var n=this;this.hideAddUser();this.commonServices.busyShow();this.data=this.ds.coreOwner.getOwnerPreferences(this.$stateParams.ownerOid);this.data.$promise.finally(function(){n.commonServices.busyHide()})},n.prototype.cancel=function(){this.$state.go("LinkedOwners")},n.prototype.save=function(n){this.hideAddUser();this.ds.coreOwner.saveOwnerPreferences(this.data.Preferences).then(function(){toastr.success("Saved changes");n.$setPristine()})},n.prototype.removeOwner=function(n){var t=this;this.hideAddUser();this.modalService.showOkToDelete("owner link").then(function(){t.ds.coreOwner.removeLink(t.data.OwnerOid,n).then(function(){t.getOwnerInfo()}).catch(function(){toastr.error("Error removing owner/user link")})})},n.prototype.setAsPrimary=function(n){var t=this;this.hideAddUser();this.ds.coreOwner.setAsPrimary(n).then(function(){t.getOwnerInfo()}).catch(function(){toastr.error("Error setting primary user")})},n.prototype.hideAddUser=function(){this.showAddUser=!1;this.userToAdd=""},n.prototype.addOwnerLink=function(){var n=this;if(this.data.LinkedUsers.some(function(t){return t.SecurityUser.Email.toLowerCase()===n.userToAdd.toLowerCase()})){toastr.error("That user is already linked");return}this.ds.coreOwner.createLinkFromEmail(this.data.OwnerOid,this.userToAdd).then(function(){n.getOwnerInfo()}).catch(function(t){var i=n.commonServices.formatErrorMessage(t);toastr.error(i)})},n.$inject=["$scope","$state","$stateParams","ecModalService","ecCommonServices","ecDataService"],n}();n.OwnerPreferencesController=t})(t=n.CoreOwner||(n.CoreOwner={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("ownerPreferencesController",Eco.Client.CoreOwner.OwnerPreferencesController);__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(t){function i(){return t.call(this,"/CorePermit/ecPermitCard",n.EcBasicCardCtrl)||this}return __extends(i,t),i}(n.EcCardViewBaseComp);n.EcPermitCardComp=t})(t=n.Directives||(n.Directives={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").component("ecPermitCard",new Eco.Client.Directives.EcPermitCardComp),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r){var f=this,u;this.$state=i;this.$timeout=r;this.tab=-1;u=n.$on("$stateChangeStart",function(n,t){f.switchState(t.name)});t.$on("$destroy",u);this.switchState(i.current.name)}return n.prototype.switchState=function(n){var t=this;switch(n){case"home.overview":this.tab=0;break;case"home.tasks":this.tab=1;break;case"home":this.$timeout(function(){t.$state.go("home.overview")},100)}},n.$inject=["$rootScope","$scope","$state","$timeout"],n}();n.EcDashboardMainController=t})(t=n.Dashboard||(n.Dashboard={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("ecDashboardMainController",Eco.Client.Dashboard.EcDashboardMainController),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){var r=this;this.$rootScope=n;this.ds=i;this.error=null;this.isBusy=!0;this.searchText="";this.sortBy="Color";this.sortRev=!0;this.facilities=[];this.getData=function(){r.error=null;r.isBusy=!0;r.$rootScope.busy.push();r.ds.dashboard.getTasks().then(r.processData).catch(r.doError).finally(r.doFinally)};this.doError=function(n){r.error=n};this.doFinally=function(){r.$rootScope.busy.pop();r.isBusy=!1;r.doResize()};this.processData=function(n){angular.forEach(n.ImportantTasks,function(n){var t=r.facilities.find(function(t){return t.Facility.Oid===n.Facility.Oid});t||(t={Facility:n.Facility,ImportantTasks:[],UpcomingTasks:[],InformationTasks:[]},r.facilities.push(t));t.ImportantTasks.push(n)});angular.forEach(n.UpcomingTasks,function(n){var t=r.facilities.find(function(t){return t.Facility.Oid===n.Facility.Oid});t||(t={Facility:n.Facility,ImportantTasks:[],UpcomingTasks:[],InformationTasks:[]},r.facilities.push(t));t.UpcomingTasks.push(n)});angular.forEach(n.InformationTasks,function(n){var t=r.facilities.find(function(t){return t.Facility.Oid===n.Facility.Oid});t||(t={Facility:n.Facility,ImportantTasks:[],UpcomingTasks:[],InformationTasks:[]},r.facilities.push(t));t.InformationTasks.push(n)});angular.forEach(r.facilities,function(n){n.Rating=n.ImportantTasks.length*100+n.UpcomingTasks.length*10+n.InformationTasks.length;n.CssColor=n.ImportantTasks.length>0?"danger":n.UpcomingTasks.length>0?"warning":"info"})};this.doResize=function(){if(r.widgetBox$){var n=$(".widget-box").offset().top,t=$(".footer")[0].offsetHeight;r.widgetBox$.find(".ec-max-scroll").css({maxHeight:$(window).innerHeight()-(n+t+50)})}};t.$on("$destroy",function(){$(window).off("resize",r.doResize)});this.getData()}return n.$inject=["$rootScope","$scope","ecDataService"],n}(),i;n.EcDashboardOverviewController=t;i=function(){function n(){this.restrict="E";this.replace=!0;this.templateUrl="/home/tmpl/dashboard/directives/ecDashboardOverview";this.controller=t;this.controllerAs="vm";this.link=function(n,t,i,r){r.widgetBox$=t;r.doResize();$(window).resize(r.doResize)}}return n.factory=function(){return function(){return new n}},n}();n.EcDashboardOverviewDirective=i})(t=n.Dashboard||(n.Dashboard={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").directive("ecDashboardOverview",Eco.Client.Dashboard.EcDashboardOverviewDirective.factory()),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(){}return n.prototype.getSearchParam=function(n){var t={facility:this.item.Facility.Name,oid:this.item.Facility.Oid};return n&&(t.type=n),JSON.stringify(t)},n}(),i;n.EcDashboardOverviewItemController=t;i=function(){function n(){this.restrict="E";this.replace=!0;this.templateUrl="/home/tmpl/dashboard/directives/ecDashboardOverviewItem";this.scope={item:"="};this.controller=t;this.controllerAs="vm";this.bindToController=!0}return n.factory=function(){return function(){return new n}},n}();n.EcDashboardOverviewItemDirective=i})(t=n.Dashboard||(n.Dashboard={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").directive("ecDashboardOverviewItem",Eco.Client.Dashboard.EcDashboardOverviewItemDirective.factory()),function(n){var t;(function(t){var i;(function(t){"use strict";var i=function(){function t(i,r){var u=this;this.modalService=i;this.ds=r;this.showView=!0;this.showPrint=!1;this.showAddToCart=!1;this.showResolve=!1;this.showReinspect=!1;this.showIgnore=!1;this.viewClick=function(){u.viewClickChild!=null?u.viewClickChild():u.modalService.showMessage({title:"TODO: View "+u.taskModel.TaskType,message:u.taskModel.ShortDescription,icon:"success"})};this.printClick=function(){var n="/print"+u.taskModel.TaskType.toLowerCase()+"/"+u.taskModel.AssociatedOid;window.open(n,"_new")};this.resolveClick=function(){u.modalService.showMessage({title:"TODO: Resolve "+u.taskModel.TaskType,message:u.taskModel.ShortDescription,icon:"warning"})};this.reinspectClick=function(){u.modalService.showMessage({title:"TODO: Request Reinspection",message:u.taskModel.ShortDescription,icon:"warning"})};this.ignoreClick=function(){var n=u.ds.dashboard.ignoreTask(u.taskModel.CurrentStateHash,u.taskModel.Importance);n.then(function(){u.taskModel.IsIgnored=!0})};this.isImportant=this.taskModel.Importance===n.DashboardTaskImportance.Important;this.isUpcoming=this.taskModel.Importance===n.DashboardTaskImportance.Upcoming;this.isInformation=this.taskModel.Importance===n.DashboardTaskImportance.Information;this.taskModel.TaskType===t.TYPE.invoice&&this.taskModel.AssociatedData&&this.taskModel.AssociatedData.OnlinePaymentInvoice.TotalDue>0&&(this.showAddToCart=!0,this.onlinePaymentInvoice=this.taskModel.AssociatedData.OnlinePaymentInvoice);this.showIgnore=this.isInformation}return t.TYPE={inspection:"INSPECTION",invoice:"INVOICE",permit:"PERMIT"},t.$inject=["ecModalService","ecDataService"],t}(),r;t.EcDashboardTaskItemController=i;r=function(){function n(){this.restrict="E";this.replace=!0;this.templateUrl="/home/tmpl/dashboard/directives/ecDashboardTaskItem";this.scope={taskModel:"="};this.controller=i;this.controllerAs="vm";this.bindToController=!0}return n.factory=function(){return function(){return new n}},n}();t.EcDashboardTaskItemDirective=r})(i=t.Dashboard||(t.Dashboard={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").directive("ecDashboardTaskItem",Eco.Client.Dashboard.EcDashboardTaskItemDirective.factory()),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r,u,f,e){var o=this;this.$scope=n;this.$anchorScroll=t;this.$state=i;this.$stateParams=r;this.$timeout=u;this.$filter=f;this.ds=e;this.error=null;this.isBusy=!0;this.tasks={};this.filtered={ImportantTasks:[],UpcomingTasks:[],InformationTasks:[]};this.getData=function(){o.error=null;o.isBusy=!0;o.ds.dashboard.getTasks().then(o.processData).catch(o.doError).finally(o.doFinally)};this.doError=function(n){o.error=n};this.doFinally=function(){o.isBusy=!1;o.doResize()};this.processData=function(n){o.tasks=n;o.getFilteredTasks();o.searchParams.type&&o.$timeout(function(){o.jumpTo(o.searchParams.type)},600)};this.getFilteredTasks=function(){o.filtered.ImportantTasks=o.tasks.ImportantTasks;o.filtered.UpcomingTasks=o.tasks.UpcomingTasks;o.filtered.InformationTasks=o.tasks.InformationTasks;o.searchText&&(o.filtered.ImportantTasks=o.$filter("filter")(o.filtered.ImportantTasks,o.searchText),o.filtered.UpcomingTasks=o.$filter("filter")(o.filtered.UpcomingTasks,o.searchText),o.filtered.InformationTasks=o.$filter("filter")(o.filtered.InformationTasks,o.searchText));o.searchParams&&o.searchParams.oid&&(o.filtered.ImportantTasks=o.$filter("filter")(o.filtered.ImportantTasks,function(n){return n.Facility.Oid===o.searchParams.oid}),o.filtered.UpcomingTasks=o.$filter("filter")(o.filtered.UpcomingTasks,function(n){return n.Facility.Oid===o.searchParams.oid}),o.filtered.InformationTasks=o.$filter("filter")(o.filtered.InformationTasks,function(n){return n.Facility.Oid===o.searchParams.oid}))};this.notIgnored=function(n){return!n.IsIgnored};this.jumpTo=function(n){o.$anchorScroll(n)};this.clearFilter=function(){o.searchParams={};o.isBusy=!0;o.$timeout(function(){o.$state.go("home.tasks",{search:null})},10)};this.doResize=function(){var n=$("#dashboardwidgetbox"),t,i;if(!n||n.length<1){$(window).off("resize",o.doResize);return}t=n.offset().top;i=$("#pagefooter")[0].offsetHeight;n.find(".ec-max-scroll").css({maxHeight:$(window).innerHeight()-(t+i+50)})};this.searchParams=r.search?JSON.parse(r.search):{};n.$watch("vm.searchText",function(n,t){n!==t&&o.getFilteredTasks()});n.$watch("vm.tasks",function(n,t){n&&n!==t&&o.getFilteredTasks()},!0);this.getData()}return n.$inject=["$scope","$anchorScroll","$state","$stateParams","$timeout","$filter","ecDataService"],n}(),i;n.EcDashboardTasksController=t;i=function(){function n(){this.restrict="E";this.replace=!0;this.templateUrl="/home/tmpl/dashboard/directives/ecDashboardTasks";this.controller=t;this.controllerAs="vm";this.link=function(n,t,i,r){$(window).resize(r.doResize)}}return n.factory=function(){return function(){return new n}},n}();n.EcDashboardTasksDirective=i})(t=n.Dashboard||(n.Dashboard={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").directive("ecDashboardTasks",Eco.Client.Dashboard.EcDashboardTasksDirective.factory()).animation(".animate-dashboard-item",["$animateCss",function(n){return{enter:function(t){var i=.4,r=t.height();return t.css("overflow","hidden"),setTimeout(function(){t.css("overflow","visible");t.height("auto")},i*1e3),n(t,{easing:"ease-in-out",from:{height:"0px",opacity:0},to:{height:r+"px",opacity:1},duration:i})},leave:function(t){var i=t.height();return t.css("overflow","hidden"),n(t,{easing:"ease-in-out",from:{height:i+"px",opacity:1},to:{height:"0px",opacity:0},duration:.4})}}}]),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){var t=this;this.$location=n;this.restrict="E";this.replace=!0;this.templateUrl=function(){return"/home/tmpl/dashboard/directives/ecDashboardTaskType"+t.taskType};this.scope=!1;this.require="^ecDashboardTaskItem";this.link=function(n,i,r,u){u.viewClickChild=function(){t.$location.path("/LinkedFacilities/"+u.taskModel.Facility.Oid+"/"+t.taskType.toLowerCase()+"s/"+u.taskModel.AssociatedOid)}}}return n.factory=function(t){var i=function(i){var r=new n(i);return r.taskType=t,r};return i.$inject=["$location"],i},n}();n.EcDashboardTaskTypeDirective=t})(t=n.Dashboard||(n.Dashboard={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").directive("ecDashboardTaskInspection",Eco.Client.Dashboard.EcDashboardTaskTypeDirective.factory("Inspection")).directive("ecDashboardTaskInvoice",Eco.Client.Dashboard.EcDashboardTaskTypeDirective.factory("Invoice")).directive("ecDashboardTaskPermit",Eco.Client.Dashboard.EcDashboardTaskTypeDirective.factory("Permit")),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r){var u=this;this.ds=n;this.toastrService=i;this.modalService=r;this.drafts=[];this.isLoading=!0;this.tableParams=new t({},{counts:[]});this.ds.submittal.queryDrafts().$promise.then(function(n){u.drafts.add(n.sortBy("LastTouched",!0))}).finally(function(){u.isLoading=!1})}return n.prototype.edit=function(n){this.ds.submittal.editDraftGo(n.Oid)},n.prototype.del=function(n){var t=this;this.modalService.showOkToDelete().then(function(){t.ds.submittal.deleteDraft(n).then(function(){t.drafts.remove(n);t.toastrService.deleted("Draft has been deleted")})})},n.$inject=["ecDataService","ngTableParams","ecToastrService","ecModalService"],n}();n.EcDraftListController=t})(t=n.Draft||(n.Draft={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("draftListController",Eco.Client.Draft.EcDraftListController);__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(t){function i(){return t.call(this,"/Invoice/ecInvoiceCard",n.EcBasicCardCtrl)||this}return __extends(i,t),i}(n.EcCardViewBaseComp);n.EcInvoiceCardComp=t})(t=n.Directives||(n.Directives={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").component("ecInvoiceCard",new Eco.Client.Directives.EcInvoiceCardComp),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r){var u=this;this.$window=t;this.ds=r;this.showMe=!1;n.busy.push();this.invoice=this.ds.invoice.get(i.invoiceOid);this.invoice.$promise.then(function(){u.showMe=!0}).finally(function(){n.busy.pop()})}return n.prototype.print=function(){this.$window.print()},Object.defineProperty(n.prototype,"invoiceMailingCityStateZip",{get:function(){if(!this.invoice||!this.invoice.Mailing)return"";var n=this.invoice.Mailing.City&&this.invoice.Mailing.State?",&nbsp;":"";return""+(this.invoice.Mailing.City||"")+n+(this.invoice.Mailing.State||"")+"&nbsp;&nbsp;"+(this.invoice.Mailing.PostalCode||"")},enumerable:!0,configurable:!0}),n.$inject=["$rootScope","$window","$stateParams","ecDataService"],n}();n.InvoiceViewController=t})(t=n.Invoice||(n.Invoice={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("invoiceViewController",Eco.Client.Invoice.InvoiceViewController),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(t,i,r,u,f){var e=this,o;this.$rootScope=t;this.$scope=i;this.$state=r;this.ds=u;this.localStorageService=f;this.model={AccountNo:undefined,InvoiceNo:undefined,OnlinePaymentInvoices:[]};this.handleError=function(t){e.error=t;e.localStorageService.remove(n.CACHE_KEY);e.showPage>0&&e.$state.go("^")};o=this.$rootScope.$on("$stateChangeSuccess",function(n,t,i){t.name.toLowerCase().startsWith("onlinepayment")&&e.goToPage(i)});i.$on("$destroy",o);this.ds.cart.$cart.$resolved?this.goToPage(this.$state.params):this.ds.cart.$cart.$promise.then(function(){e.goToPage(e.$state.params)})}return Object.defineProperty(n.prototype,"selectedQty",{get:function(){return this.model.OnlinePaymentInvoices.count(function(n){return n.IsInCart})},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"selectedTotalDue",{get:function(){return this.model.OnlinePaymentInvoices.sum(function(n){return n.IsInCart?n.TotalDue:0})},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isDiffAccountNo",{get:function(){return this.model.AccountNo&&this.ds.cart.Items.length>0&&this.localStorageService.get(n.PREV_ACCT_KEY)!==this.model.AccountNo},enumerable:!0,configurable:!0}),n.prototype.submit=function(n){n.$valid&&this.getInvoices(!1)},n.prototype.goToSearchPage=function(){this.$state.go("^")},n.prototype.goToCart=function(){this.$state.go("viewcart")},n.prototype.goToPage=function(n){this.showPage=n.AccountNo?1:0;this.showPage>0?(this.model.AccountNo=n.AccountNo,this.model.InvoiceNo=n.InvoiceNo,this.getInvoices(!0)):this.model.InvoiceNo=undefined},n.prototype.formatRecordId=function(n,t){return t=t.trim().toUpperCase(),!t.startsWith(n)&&t.length<9&&(t=n+t.padLeft(7,"0")),t},n.prototype.getInvoices=function(t){var i=this,r,u;if(this.error=undefined,this.model.AccountNo=this.formatRecordId("AR",this.model.AccountNo),this.model.InvoiceNo=this.formatRecordId("IN",this.model.InvoiceNo),this.isDiffAccountNo&&this.ds.cart.removeAllItems(),this.localStorageService.set(n.PREV_ACCT_KEY,this.model.AccountNo),t&&(r=this.localStorageService.get(n.CACHE_KEY),this.localStorageService.remove(n.CACHE_KEY),r&&r.AccountNo===this.model.AccountNo&&r.InvoiceNo===this.model.InvoiceNo)){this.model=r;this.fixupInvoiceInCartStatus();return}this.$rootScope.busy.push();u={AccountNo:this.model.AccountNo,InvoiceNo:this.model.InvoiceNo};this.ds.onlinePayments.getUnpaidInvoices(this.model.AccountNo,this.model.InvoiceNo).$promise.then(function(t){t.StatusMessage?i.handleError({message:t.StatusMessage}):(i.model=t,i.fixupInvoiceInCartStatus(),i.localStorageService.set(n.CACHE_KEY,i.model),i.showPage<1&&i.$state.go(".results",u))}).catch(this.handleError).finally(function(){i.$rootScope.busy.pop()})},n.prototype.fixupInvoiceInCartStatus=function(){var n=this;this.model.OnlinePaymentInvoices.forEach(function(t){t.IsInCart=n.ds.cart.isInCart(t.InvoiceOid)})},n.CACHE_KEY="OnlinePaymentsViewModel",n.PREV_ACCT_KEY="PrevAccountNo",n.$inject=["$rootScope","$scope","$state","ecDataService","localStorageService"],n}();n.EcOnlinePaymentsController=t})(t=n.OnlinePayments||(n.OnlinePayments={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("onlinePaymentsController",Eco.Client.OnlinePayments.EcOnlinePaymentsController),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r){this.$window=n;this.ecToaster=t;this.ds=i;this.order=r}return n.prototype.print=function(){this.$window.print()},n.prototype.sendEmail=function(){var n=this;this.ds.cart.sendReceiptEmailForOrder(this.order.OrderOid).then(function(){n.ecToaster.success("An email has been sent")}).catch(function(){n.ecToaster.error("Error sending email")})},n.$inject=["$window","ecToastrService","ecDataService","order"],n}();n.EcPaymentReceiptController=t})(t=n.Cart||(n.Cart={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("paymentReceiptController",Eco.Client.Cart.EcPaymentReceiptController),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){var u=this,r;this.$scope=n;this.$scope.activityIcon="fa-chevron-circle-right";this.$scope.header={subtitle:""};i.$current.parent&&i.$current.parent.activity&&i.$current.parent.activity.menuIcon?this.$scope.activityIcon=i.$current.parent.activity.menuIcon:i.$current.activity&&i.$current.activity.menuIcon&&(this.$scope.activityIcon=i.$current.activity.menuIcon);this.$scope.data={pressAgentOid:i.current.data.pressAgentOid,criteria:{},facilities:undefined,programs:undefined,noResults:!1};r=t.$on("$stateChangeStart",function(n,t,i,r){u.$scope.data.previousState=r});this.$scope.$on("$destroy",function(){r()})}return n.$inject=["$scope","$rootScope","$state"],n}();n.EcPressAgentController=t})(t=n.PressAgent||(n.PressAgent={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("pressAgentController",Eco.Client.PressAgent.EcPressAgentController),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r){var u=this;this.$scope=n;this.$state=t;this.$stateParams=i;this.ds=r;this.$scope.data||this.back();this.$scope.header.subtitle="Review the details below";this.$scope.percent=0;this.$scope.chartOptions={barColor:"rgba(255,255,255,0.95)",trackColor:"rgba(255,255,255,0.25)",scaleColor:!1,lineCap:"butt",lineWidth:2.9,animate:1e3,size:39};this.ds.pressAgent.facilityDetail({PressAgentOid:this.$scope.data.pressAgentOid,ProgramId:this.$stateParams.programId}).$promise.then(function(n){n.length>0&&(u.$scope.model=n[0],u.$scope.percent=u.$scope.model.LastScore)});this.$scope.busy.push();this.$scope.inspections=this.ds.pressAgent.inspections({PressAgentOid:this.$scope.data.pressAgentOid,ProgramId:this.$stateParams.programId});this.$scope.inspections.$promise.then(function(){u.$scope.currentInspection=u.currentInspection();u.$scope.recentViolations=u.recentViolations();u.$scope.busy.pop()});this.$scope.recentViolations=undefined}return n.prototype.currentInspection=function(){if(this.$scope.inspections&&this.$scope.inspections.length>0)return this.$scope.inspections[0]},n.prototype.recentViolations=function(){if(this.$scope.currentInspection)return this.$scope.currentInspection.violations.length},n.prototype.pie=function(){$(".easy-pie-chart.percentage").each(function(){var n=$(this).closest(".infobox"),t=$(this).data("color")||(n.hasClass("infobox-dark")?"rgba(255,255,255,0.95)":n.css("color")),i=t==="rgba(255,255,255,0.95)"?"rgba(255,255,255,0.25)":"#E2E2E2",r=parseInt($(this).data("size"),10)||50;$(this).easyPieChart({barColor:t,trackColor:i,scaleColor:!1,lineCap:"butt",lineWidth:parseInt("size / 10",10),animate:/msie\s*(8|7|6)/.test(navigator.userAgent.toLowerCase())?!1:1e3,size:r})})},n.prototype.back=function(){this.$state.go("^.Programs",this.$stateParams)},n.prototype.initGrid=function(){var n=this;this.$scope.gridOptions={onRegisterApi:function(t){n.$scope.gridApi=t},enableSorting:!0,data:this.$scope.inspections}},n.$inject=["$scope","$state","$stateParams","ecDataService"],n}();n.EcPressAgentDetailController=t})(t=n.PressAgent||(n.PressAgent={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("pressAgentDetailController",Eco.Client.PressAgent.EcPressAgentDetailController),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r){var u=this;this.$scope=n;this.$state=t;this.$stateParams=i;this.ds=r;this.$scope.data||this.back();this.$scope.header.subtitle="Facility Programs";this.$scope.data.programs?this.skipOnSingle():this.$stateParams.facilityId?(this.$scope.busy.push(),this.$scope.data.programs=this.ds.pressAgent.programs({PressAgentOid:this.$scope.data.pressAgentOid,FacilityId:this.$stateParams.facilityId}),this.$scope.data.programs.$promise.then(function(){u.$scope.busy.pop();u.skipOnSingle()})):this.back()}return n.prototype.isEmptyObject=function(n){for(var t in n)if(n.hasOwnProperty(t)&&n[t])return!1;return!0},n.prototype.skipOnSingle=function(){this.$scope.data.programs.length===1&&(this.$scope.data.previousState&&this.$scope.data.previousState.name.endsWith(".Detail")?this.back():this.details(this.$scope.data.programs[0]))},n.prototype.details=function(n){this.$state.go("^.Detail",angular.extend(this.$state.params,{programId:n.ProgramId}))},n.prototype.back=function(){this.$state.go("^.Results",this.$state.params)},n.$inject=["$scope","$state","$stateParams","ecDataService"],n}();n.EcPressAgentProgramsController=t})(t=n.PressAgent||(n.PressAgent={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("pressAgentProgramsController",Eco.Client.PressAgent.EcPressAgentProgramsController),function(n){var t;(function(n){var t;(function(n){"use strict";var t=15,i=function(){function n(n,i,r,u,f){var e=this;this.$scope=n;this.$state=i;this.$stateParams=r;this.commonServices=u;this.ds=f;this.pagedItems=[];this.onPageChange=function(n){e.pagedItems.length=0;e.pagedItems.add(e.$scope.data.facilities.slice(n.itemStart,n.itemEnd))};n.header.subtitle="Search results";this.$scope.data.facilities?this.pagerParams={totalItems:this.$scope.data.facilities.length,itemsPerPage:t,onPageChange:this.onPageChange}:this.isEmptyObject(this.$state.params)?this.back():(this.$scope.data.criteria=this.$state.params,this.commonServices.busyShow(),this.$scope.data.noResults=!1,this.$scope.data.facilities=[],f.pressAgent.searchFacilities({PressAgentOid:this.$scope.data.pressAgentOid},this.$state.params).$promise.then(function(n){n&&n.length!==0?(e.$scope.data.facilities=n,e.pagerParams={totalItems:e.$scope.data.facilities.length,itemsPerPage:t,onPageChange:e.onPageChange}):e.$scope.data.noResults=!0}).finally(function(){e.commonServices.busyHide()}))}return n.prototype.isEmptyObject=function(n){for(var t in n)if(n.hasOwnProperty(t)&&n[t])return!1;return!0},n.prototype.details=function(n){this.$scope.data.programs=undefined;this.$state.go("^.Programs",angular.extend(this.$state.params,{facilityId:n.FacilityId}))},n.prototype.back=function(){this.$state.go("^.Search",this.$state.params)},n.$inject=["$scope","$state","$stateParams","ecCommonServices","ecDataService"],n}();n.EcPressAgentResultsController=i})(t=n.PressAgent||(n.PressAgent={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("pressAgentResultsController",Eco.Client.PressAgent.EcPressAgentResultsController),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){this.$scope=n;this.$state=t;this.ds=i;this.$scope.header.subtitle="Fill in the fields below and press search when ready";setTimeout(function(){$(":first *:input[type!=hidden]:first","#frmSearch").focus()},50);this.$scope.model=this.$scope.data.criteria}return n.prototype.reset=function(){this.$scope.data.facilities=undefined;this.$scope.data.criteria={};this.$scope.model=this.$scope.data.criteria;this.$scope.frmSearch.$setPristine()},n.prototype.search=function(){this.$scope.data.facilities=undefined;this.$state.go("^.Results",this.$scope.model)},n.prototype.canReset=function(){return!0},n.prototype.canSearch=function(){return this.isEmptyObject(this.$scope.model)?!1:this.$scope.frmSearch.$valid?!0:void 0},n.prototype.isEmptyObject=function(n){for(var t in n)if(n.hasOwnProperty(t)&&n[t])return!1;return!0},n.$inject=["$scope","$state","ecDataService"],n}();n.EcPressAgentSearchController=t})(t=n.PressAgent||(n.PressAgent={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("pressAgentSearchController",Eco.Client.PressAgent.EcPressAgentSearchController);__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(n){function t(t,i,r,u,f){var e=n.call(this,t,i,r)||this;return e.ds=u,e.attachmentUploadService=f,e}return __extends(t,n),t.prototype.detailOnClick=function(){this.$state.go("LinkedServiceRequest",{serviceRequestOid:this.data.Oid})},t.prototype.onClickClone=function(n){var t=this;this.ds.submittal.cloneAsDraft(n.SubmittalOid).then(function(n){t.ds.submittal.editDraftGo(n.Oid)}).catch(function(n){console.error(n)})},t.prototype.onClickSubmitAttachments=function(n){var t=this;this.attachmentUploadService.showUploadDialog("Service Request Attachment Upload",n.RecordId,n.AttachmentDefinitions,function(){t.$state.go("LinkedServiceRequest",{serviceRequestOid:t.data.Oid},{reload:!0})})},t.$inject=["$scope","$stateParams","$state","ecDataService","ecAttachmentUploadService"],t}(n.EcCardViewBaseController),i;n.EcServiceRequestCardCtrl=t;i=function(n){function i(){return n.call(this,"/ServiceRequest/ecServiceRequestCard",t)||this}return __extends(i,n),i}(n.EcCardViewBaseComp);n.EcServiceRequestCardComp=i})(t=n.Directives||(n.Directives={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").component("ecServiceRequestCard",new Eco.Client.Directives.EcServiceRequestCardComp),function(n){var t;(function(n){var t;(function(n){"use strict";var t=15,i=function(){function n(n,t,i,r){var u=this;this.$rootScope=t;this.ds=i;this.portalConfiguration=r;this.searchText="";this.searchInternalStatus="A";this.isLoading=!0;this.allItems=[];this.filteredItems=[];this.pagedItems=[];this.onPageChange=function(n){u.pagedItems.length=0;u.pagedItems.add(u.filteredItems.slice(n.itemStart,n.itemEnd))};t.busy.push();i.serviceRequest.queryVM(t.fromStateName==="LinkedServiceRequest").$promise.then(function(n){u.allItems.add(n);u.doFilter()}).finally(function(){t.busy.pop();u.isLoading=!1});n.$watch("vm.searchText",function(n,t){(n||t)&&n!==t&&u.doFilter()});n.$watch("vm.searchInternalStatus",function(n,t){(n||t)&&n!==t&&u.doFilter()})}return n.prototype.doFilter=function(){var n=this,i=this.allItems.findAll(function(t){var i=!n.searchText||(t.CardTitle+t.CardInfo).toLowerCase().indexOf(n.searchText.toLowerCase())>=0;return i&&(i=n.searchInternalStatus==="A"?t.InternalStatus===n.searchInternalStatus||n.portalConfiguration.serviceRequestActiveStatusCodes.split(",").some(function(n){return n===t.StatusCode}):t.InternalStatus===n.searchInternalStatus&&n.portalConfiguration.serviceRequestActiveStatusCodes.split(",").none(function(n){return n===t.StatusCode})),i});this.pagedItems.length=0;this.filteredItems=i;this.pagerParams={totalItems:this.filteredItems.length,itemsPerPage:t,onPageChange:this.onPageChange}},n.$inject=["$scope","$rootScope","ecDataService","portalConfiguration"],n}();n.EcLinkedServiceRequestsController=i})(t=n.ServiceRequest||(n.ServiceRequest={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("linkedServiceRequestsController",Eco.Client.ServiceRequest.EcLinkedServiceRequestsController),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){var r=this;this.ds=i;this.expanded={invoices:!1,attachments:!1};n.busy.push();this.data=this.ds.serviceRequest.getVM(t.serviceRequestOid);this.data.$promise.then(function(n){r.data.ServiceRequest.AttachmentDefinitions=n.AttachmentDefinitions}).finally(function(){n.busy.pop()});this.expanded.invoices=t&&!!t.entityType&&t.entityType.toLowerCase()==="invoices";this.expanded.attachments=t&&!!t.entityType&&t.entityType.toLowerCase()==="attachments"}return n.$inject=["$rootScope","$stateParams","ecDataService"],n}();n.EcServiceRequestDetailController=t})(t=n.ServiceRequest||(n.ServiceRequest={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("serviceRequestDetailController",Eco.Client.ServiceRequest.EcServiceRequestDetailController);__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(t){function i(){return t.call(this,"/Violation/ecViolationCard",n.EcBasicCardCtrl)||this}return __extends(i,t),i}(n.EcCardViewBaseComp);n.EcViolationCardComp=t})(t=n.Directives||(n.Directives={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").component("ecViolationCard",new Eco.Client.Directives.EcViolationCardComp),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r,u,f,e){var o=this;this.$scope=n;this.$state=t;this.$filter=i;this.$log=r;this.portalConfiguration=u;this.$timeout=e;this.onAfterAddingFile=function(n){toastr.clear();o.clearFileInput(n.description);o.enableAttachments(n.description,n.fileCountMaximum+1)?o.$log.debug("added file "+n.file.name):(o.$scope.data.uploader.removeFromQueue(n),o.$log.debug(n.file.name+" was not added - too many files"),toastr.error(n.file.name+" was not added","Too many files",{closeButton:!0,positionClass:"toast-bottom-full-width",timeOut:1e4,extendedTimeOut:3e4,preventDuplicates:!0}))};this.$scope.data.uploader=n.data.uploader||new f;this.$scope.data.uploader.filters.push({name:"isValidFile",fn:function(n){return o.isValidFileForUpload(n)}});this.$scope.data.uploader.onAfterAddingFile=this.onAfterAddingFile;this.$scope.data.uploader.queueLimit=this.portalConfiguration.attachmentFileLimit;this.$scope.canMoveNext=function(){return!o.$state.current.data.workflowAttachments.some(function(n){if(n.fileCountMinimum>o.attachmentCount(n.description))return!0})}}return n.prototype.attachmentCount=function(n){var t=this.$scope.data.uploader.queue,i;return t.length===0?0:(i=this.$filter("filter")(t,{description:n}),i.length)},n.prototype.enableAttachments=function(n,t){return t>this.attachmentCount(n)},n.prototype.isValidFileForUpload=function(n){var i,t,r,u,f;this.$timeout.cancel(this.prevTimeout);i=!0;try{t=this.portalConfiguration.attachmentMaxFileSizeBytes;r=" bytes";n.size>t&&(i=!1,t>=1073741824?(t=t/1073741824,r=" GB"):t>=1048576?(t=t/1048576,r=" MB"):t>=1024&&(t=t/1024,r=" KB"),this.showFileAddError("File size","You may only upload files with a maximum size of "+t.format(1)+r));n.name.toLowerCase().match(this.portalConfiguration.attachmentAllowedExtensionsRegEx)||(i=!1,this.showFileAddError("File extension","You may only upload files with these file extensions: "+this.portalConfiguration.attachmentAllowedExtensionsCsv.replace(/\./g," ").replace(/  /g," ").trim()));this.$scope.data.uploader.queue&&(u=n,f=this.$scope.data.uploader.queue.some(function(n){return n.file.name===u.name&&n.file.lastModifiedDate.getTime()===u.lastModifiedDate.getTime()&&n.file.size===u.size?!0:!1}),f&&(i=!1,this.showFileAddError("Duplicate","Duplicate file."),this.clearFileInput("")))}catch(e){return!1}return i||(this.prevTimeout=this.$timeout(function(){i=!0},2500)),i},n.prototype.showFileAddError=function(n,t){toastr.error(t,n,{closeButton:!0,positionClass:"toast-bottom-full-width",timeOut:1e4,extendedTimeOut:3e4,preventDuplicates:!0})},n.prototype.clearFileInput=function(n){for(var t=$('[id$="'+n+'Uploader"]'),i=0;i<t.length;i++)t.wrap("<form>").closest("form").get(i).reset();t.unwrap()},n.$inject=["$scope","$state","$filter","$log","portalConfiguration","FileUploader","$timeout"],n}();n.WorkflowAttachmentController=t})(t=n.Workflow||(n.Workflow={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("wfcAtchCtrl",Eco.Client.Workflow.WorkflowAttachmentController),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(){}return n}();n.WorkflowClientPageController=t})(t=n.Workflow||(n.Workflow={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("wfcPgCtrl",Eco.Client.Workflow.WorkflowClientPageController),function(n){var t;(function(t){var i;(function(t){"use strict";var i=function(){function t(n,t,i){var r=this;this.$scope=n;this.$state=t;this.ds=i;this.submittal=this.$scope.$parent.wizardCtrl.submittal;this.ds.submittal.getWorkflowPayments(this.submittal.WorkflowOid).$promise.then(function(n){r.workflowPayments=n;r.syncPayments(r.submittal.WorkflowEntity._payments)});this.$scope.canMoveNext=function(){return r.totalSelectedAmt()>0}}return t.prototype.syncPayments=function(n){var i=this,r=!1,t;angular.forEach(this.workflowPayments,function(t){var u=n?n.find(function(n){return n.pe===t.Pe}):undefined;u?i.isExclusive(t)&&(r=!0):u={pe:t.Pe,description:t.Description,unitQty:i.isFixed(t)?1:0,amount:undefined};t.$pmt=u;t.$selected=u.unitQty>0;i.calcAmount(t)});r||(t=this.workflowPayments.find(function(n){return i.isExclusive(n)}),t&&(r=!0,t.$pmt.unitQty=1,t.$selected=!0,this.calcAmount(t)))},t.prototype.getPayments=function(){this.submittal.WorkflowEntity._payments=this.workflowPayments.findAll(function(n){return n.$selected}).map(function(n){return n.$pmt})},t.prototype.calcAmount=function(n){n.$selected?(n.$pmt.unitQty<=0&&(n.$pmt.unitQty=1),n.FinFee.IsUnitBasedCharges?(n.$pmt.amount=n.FinFee.FixedFeeAmt+(n.$pmt.unitQty-n.FinFee.BaseUnitLevel)*n.FinFee.UnitRate,!!n.FinFee.MaxBillableAmt&&n.FinFee.MaxBillableAmt>0&&n.$pmt.amount>n.FinFee.MaxBillableAmt&&(n.$pmt.amount=n.FinFee.MaxBillableAmt)):n.$pmt.amount=n.FinFee.FixedFeeAmt,n.$pmt.amount<=0&&(n.$pmt.amount=undefined)):n.$pmt.amount=undefined;this.getPayments()},t.prototype.isFixed=function(t){return t.PaymentOption===n.WorkflowPaymentOptions.Fixed},t.prototype.isExclusive=function(t){return t.PaymentOption===n.WorkflowPaymentOptions.Exclusive},t.prototype.setRadio=function(t){var i=this;angular.forEach(this.workflowPayments,function(r){r.PaymentOption===n.WorkflowPaymentOptions.Exclusive&&(r.$selected=r.Pe===t.Pe,i.calcAmount(r))})},t.prototype.totalSelectedAmt=function(){var n=0;return angular.forEach(this.workflowPayments,function(t){t.$selected&&t.$pmt.amount&&(n+=t.$pmt.amount)}),n},t.prototype.paymentAmountDisplay=function(n){return n.FinFee.AmountDisplay.replace("unit",n.UnitCaption||"unit")},t.$inject=["$scope","$state","ecDataService"],t}();t.WorkflowPaymentController=i})(i=t.Workflow||(t.Workflow={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("wfcPmtCtrl",Eco.Client.Workflow.WorkflowPaymentController),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){n.data=n.data||{};n.captcha.isCaptchaPage=!0;n.captcha.getCaptchaData=function(){return n.data.gRecaptchaResponse}}return n.$inject=["$scope"],n}();n.WorkflowReCaptchaController=t})(t=n.Workflow||(n.Workflow={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("wfcRecapCtrl",Eco.Client.Workflow.WorkflowReCaptchaController),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r,u,f,e,o){var s=this;this.$scope=n;this.$window=i;this.commonServices=u;this.ds=f;this.printService=e;this.$modalInstance=o;this.wasSubmitted=!1;this.doPayLater=!1;this.attachments=[];angular.isUndefined(t.submitted)||(this.wasSubmitted=t.submitted);this.$scope.newEntity?(this.submittal=this.$scope.wizardCtrl.submittal,this.init(t)):f.submittal.get(t.submittalOid).$promise.then(function(n){s.submittal=n;s.init(t)},function(n){r.error(n)})}return n.prototype.init=function(n){var t=this,i,r;this.attachments.length=0;this.doPayLater=this.submittal.DoPayLater==="true";n.doPayLater===null||angular.isUndefined(n.doPayLater)||(this.doPayLater=n.doPayLater);this.submittal.AttachmentsJson&&(i=JSON.parse(this.submittal.AttachmentsJson),r=i.groupBy(function(n){return n.description},function(n,i){i.forEach(function(n){n.iconClasses=t.iconClassForFile(n.fileName)})}),angular.forEach(r,function(n,i){t.attachments.push({description:i,files:n})}))},n.prototype.onPrint=function(n,t){n=n||"ReviewPrint";this.printService.print(n,t)},n.prototype.iconClassForFile=function(n){var t=this.commonServices.iconClassForFile(n);return t.push("bigger-110"),t},n.prototype.onClickViewAttachment=function(n){var t="/attachmentitem/submittal/relatedid/"+this.submittal.RecordId+"?description="+n.description+"&filename="+encodeURIComponent(n.fileName);this.$window.open(t,"_blank")},n.prototype.totalSelectedAmt=function(){var n=0;return this.submittal&&this.submittal.WorkflowEntity&&this.submittal.WorkflowEntity._payments&&angular.forEach(this.submittal.WorkflowEntity._payments,function(t){t.amount>0&&(n+=t.amount)}),n},n.prototype.onOk=function(){this.$modalInstance.dismiss()},n.prototype.onEmail=function(){this.ds.submittal.sendEmailNotificationToUser(this.submittal);console.debug(this.submittal.WorkflowEntity)},n.$inject=["$scope","$stateParams","$window","$log","ecCommonServices","ecDataService","ecPrintService","$modalInstance"],n}();n.WorkflowReviewController=t})(t=n.Workflow||(n.Workflow={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("wfcRevCtrl",Eco.Client.Workflow.WorkflowReviewController),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(){}return n}();n.WorkflowSubmitSuccessController=t})(t=n.Workflow||(n.Workflow={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("workflowSubmitSuccessController",Eco.Client.Workflow.WorkflowSubmitSuccessController);__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(t){var i;(function(t){"use strict";var i=function(t){function i(n,i,r,u,f,e,o,s,h){var c=t.call(this,n)||this,l;return c.$scope=i,c.$rootScope=r,c.$q=u,c.$log=f,c.appContext=e,c.ds=o,c.modalService=s,c.ecCommonServices=h,c.activityIcon="fa-chevron-circle-right",n.$current.parent&&n.$current.parent.activity&&n.$current.parent.activity.menuIcon?c.activityIcon=n.$current.parent.activity.menuIcon:n.$current.activity&&n.$current.activity.menuIcon&&(c.activityIcon=n.$current.activity.menuIcon),l=c.$scope.$on("$stateChangeStart",function(n,t,i,r){r.name.endsWith(".p1")&&r.name.startsWith(t.name)&&(n.preventDefault(),c.ecCommonServices.busyHide())}),i.$on("$destroy",l),c.$scope.wizardCtrl=c,c.$scope.data=c.$scope.data||{},c.$scope.captcha={isCaptchaPage:!1},c.submitButtonTitle=c.appContext.IsPreview?"Close":"Submit",c.params.submittal?(c.submittal=c.params.submittal,c.init()):(h.busyShow(),c.ds.submittal.create(c.wizardConfig.workflowOid,c.params.facilityOid,c.params.accountsReceivableOid).$promise.then(function(n){c.submittal=n;c.submittal.WorkflowEntity.ChangeRequest=JSON.parse(n.ChangeRequestUdfBoolJson);c.init()}).catch(function(n){return c.handleError("Error creating submittal",n)}).finally(function(){return h.busyHide()})),c}return __extends(i,t),i.prototype.init=function(){this.pristineEntity=angular.copy(this.submittal.WorkflowEntity);this.$scope.newEntity=this.submittal.WorkflowEntity;this.subscribeToEvents();this.isActive=!0;this.$state.current.name.has(".")||this.$state.go(this.wizardConfig.startPage)},Object.defineProperty(i.prototype,"params",{get:function(){return this.$state.params?this.$state.params:{submittal:undefined,facilityOid:undefined,accountsReceivableOid:undefined}},enumerable:!0,configurable:!0}),i.prototype.go=function(n){var t=this.$state.current.name.split(".")[0]+".p"+n;this.$state.go(t)},i.prototype.submit=function(){var t=this,i;this.isBusy=!0;this.$rootScope.busy.push();i=this.$q.defer();this.saveSubmit().then(function(){t.wizardConfig.submittSuccessRoute==="makePayment"?t.submittal.DoPayLater=="true"||t.wizardConfig.paymentOptionType===n.WorkflowPaymentOptionTypes.RequirePaymentLater?t.$state.go("submittalReview",{workflowOid:t.wizardConfig.workflowOid,submittalOid:t.submittal.Oid,submitted:!0,doPayLater:!0}).then(function(n){i.resolve(n)}).catch(function(n){i.reject(n)}):t.$state.go("makePaymentFromSubmittal",{submittalOid:t.submittal.Oid}).then(function(n){i.resolve(n)}).catch(function(n){i.reject(n)}):t.wizardConfig.submittSuccessRoute==="workflowReview"?t.$state.go("submittalReview",{workflowOid:t.wizardConfig.workflowOid,submittalOid:t.submittal.Oid,submitted:!0}).then(function(n){i.resolve(n)}).catch(function(n){i.reject(n)}):t.$state.go("submitSuccess",{workflowOid:t.wizardConfig.workflowOid}).then(function(n){i.resolve(n)}).catch(function(n){i.reject(n)})}).catch(function(n){i.reject(n)});i.promise.finally(function(){t.$rootScope.busy.pop()})},i.prototype.updateAttachments=function(){if(this.$scope.data.uploader&&this.$scope.data.uploader.queue){var n=this.$scope.data.uploader.queue.map(function(n){return{description:n.description,fileName:n.file.name}});this.submittal.AttachmentsJson=n.length>0?JSON.stringify(n):undefined}},i.prototype.canMoveNext=function(){return this.canMoveNextCurrentPage()?!this.isActive||this.isBusy?!1:this.$scope.frmMain&&this.$scope.frmMain.frmPage&&!this.$scope.frmMain.frmPage.$valid?!1:t.prototype.canMoveNext.call(this):!1},i.prototype.canMovePrev=function(){return!this.isActive||this.isBusy?!1:t.prototype.canMovePrev.call(this)},i.prototype.canPayNow=function(){return this.canFinish()&&!this.appContext.IsPreview},i.prototype.canFinish=function(){return this.pageConfig?this.canMoveNextCurrentPage()?!this.isActive||this.isBusy?!1:this.$scope.captcha.isCaptchaPage?!!this.$scope.captcha.getCaptchaData():this.$scope.frmMain&&(!this.$scope.frmMain.$valid||this.$scope.frmMain.frmPage&&!this.$scope.frmMain.frmPage.$valid)?!1:this.pageConfig.isEnd:!1:!1},i.prototype.hasChanges=function(){var n={qty:0};return this.compareObjs(this.$scope.newEntity,this.pristineEntity,[],n),n.qty>0},i.prototype.compareObjs=function(n,t,i,r){var u=this,f=this;angular.forEach(n,function(n,f){var s,o,e;if(n!==null&&f!="_payments")if(angular.isObject(n))s=angular.copy(i),s.push(f),u.compareObjs(n,t,s,r);else{o=angular.copy(i);o.push(f);e=undefined;try{e=u.getDescendantProp(t,o)}catch(h){}(n||e)&&n!==e&&(r.qty++,console.debug(i.length.toString()," - ",f,": ",n,"  -  ",o," = ",e))}},f)},i.prototype.getDescendantProp=function(n,t){while(t.length)n=n[t.shift()];return n},i.prototype.handleError=function(n,t){this.$log.error(n);this.$log.error(t);this.validationErrors=t;t.data&&t.data==="Invalid captcha result"&&this.$scope.captcha.reload()},i.prototype.saveSubmit=function(){var n=this,t=this.$q.defer();return this.appContext.IsPreview?(t.resolve(),window.close(),t.promise):(this.$scope.captcha.isCaptchaPage&&(this.$scope.newEntity.encodedResponse=this.$scope.captcha.getCaptchaData()),this.$scope.newEntity.UpdateAccountAddress=!1,this.updateAttachments(),this.ds.submittal.submit(this.submittal).then(function(i){if(n.submittal.RecordId=i.recordId,n.$scope.newEntity.RecordId=i.recordId,n.pristineEntity=n.$scope.newEntity,n.$scope.data.uploader){angular.forEach(n.$scope.data.uploader.queue,function(n){var t=window.location.hostname;n.url="//"+t+"/api/attachmentItem";n.formData=[{relatedId:i.recordId},{description:n.description},{facilityId:i.facilityId}]});n.$scope.canShowUploadProgress=!0;var u=function(){n.$scope.data.uploader.isUploading?setTimeout(u,1e3):setTimeout(function(){t.resolve(i.submittalOid)},2e3)};try{console.log(n.$scope.data.uploader);n.$scope.data.uploader.uploadAll();setTimeout(u,1e3)}catch(r){console.log(r);n.handleError("Attachment Upload Error.",r);n.$scope.canShowUploadProgress=!1;t.reject(r)}}else t.resolve(i.submittalOid)}).catch(function(i){console.log(i);n.handleError("Submittal Save Error.",i);t.reject(i)}),t.promise)},i.prototype.saveDraft=function(){var n=this,t=this.ds.submittal.saveDraft(this.submittal);return t.then(function(){n.pristineEntity=n.$scope.newEntity}).catch(function(t){t&&n.handleError("Draft Save Error.",t)}),t},i.prototype.isSiblingState=function(n,t,i,r){var u=1;return n.name.split(".")[0]===t.name.split(".")[0]?u=0:n.data&&t.data?i.submittalOid!==r.submittalOid?u=3:n.data.pgCfg&&t.data.wizardConfig?n.data.pgCfg.nextPage===t.name?u=0:n.data.pgCfg.prevPage===t.name&&(u=0):u=4:u=2,u===0},i.prototype.canMoveNextCurrentPage=function(){return this.$scope.$$childTail&&this.$scope.$$childTail.canMoveNext?this.$scope.$$childTail.canMoveNext():this.$scope.$$childHead&&this.$scope.$$childHead.canMoveNext?this.$scope.$$childHead.canMoveNext():!0},i.prototype.subscribeToEvents=function(){var n=this,t;this.ds.submittal.triggerSave=function(){return n.hasChanges()?n.saveDraft():undefined};t=!1;this.$rootScope.stateChangeStartCallback=function(i,r,u,f,e){if(t)return undefined;try{if(n.updateAttachments(),!n.isSiblingState(f,r,e,u)&&n.hasChanges()){i.preventDefault();var o=n.modalService.showOkCancel({title:"Leave Workflow?",message:"Would you like to leave the current workflow?",icon:"fa-warning text-danger"},!0);return o.then(function(){t=!0;n.saveDraft().then(function(){n.$state.go(r.name,u,{reload:!0})}).catch(function(){t=!1})}).catch(function(){t=!1;n.ecCommonServices.busyHide()}),o}}catch(s){n.$log.error(s)}};this.$scope.$on("$destroy",function(){n.ds.submittal.triggerSave=undefined;n.$rootScope.stateChangeStartCallback=undefined})},i.$inject=["$state","$scope","$rootScope","$q","$log","ecAppContext","ecDataService","ecModalService","ecCommonServices"],i}(n.Shared.Controllers.WizardControllerBase);t.WorkflowWizardController=i})(i=t.Workflow||(t.Workflow={}))})(t=n.Client||(n.Client={}))}(Eco||(Eco={}));angular.module("app").controller("serviceRequestCtrl",Eco.Client.Workflow.WorkflowWizardController).controller("complaintLogCtrl",Eco.Client.Workflow.WorkflowWizardController)