var ArrayExtensions,__assign,Energov,app,__extends,EnerGov;(function(n){var t;(function(n){var t;(function(n){var u=function(){function n(){}return n.ModuleName="Module",n.FilterModuleName="FilterModule",n.SearchTextName="SearchText",n.PageSizeName="PageSize",n.PageNumberName="PageNumber",n.SortingOrderName="SortingOrder",n.ExactMatchName="ExactMatch",n.ModuleKey="m",n.FilterModuleKey="fm",n.SearchTextKey="st",n.PageSizeKey="ps",n.PageNumberKey="pn",n.SortingOrderKey="o",n.ExactMatchKey="em",n}(),t,i,r;n.QueryStringConstant=u;t=function(){function n(){}return n.MyPermitsLabel="permit",n.MyPlansLabel="plan",n.MyLicensesLabel="license",n.MyRequestsLabel="request",n.MyInvoicesLabel="invoice",n.MyInspectionsLabel="inspection",n.MyRemainingInspectionsLabel="remaininginspection",n.MyExistingInspectionsLabel="existinginspection",n}();n.MyMenusConstants=t;i=function(){function n(){}return n.Last30Days=30,n.Last60Days=60,n.Last90Days=90,n}();n.EscrowAccountHistoryDateRangeConstants=i;r=function(){function n(){}return n.ShowMessageOfParcelHolds="ShowMessageOfParcelHolds",n}();n.SoftwarePackageSettings=r})(t=n.Constant||(n.Constant={}))})(t=n.Common||(n.Common={}))})(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){var t,i,r,u,f,e,o,s,h,c,l,a,v,y,p;(function(n){n[n.BothEstimationAndApplication=0]="BothEstimationAndApplication";n[n.EstimationOnly=1]="EstimationOnly";n[n.ApplicationOnly=2]="ApplicationOnly"})(t=n.CaseTypeUse||(n.CaseTypeUse={})),function(n){n[n.PERMITS=0]="PERMITS";n[n.PLANS=1]="PLANS";n[n.LICENSES=2]="LICENSES"}(i=n.ApplicationAssistantModules||(n.ApplicationAssistantModules={})),function(n){n[n.All=1]="All";n[n.Permit=2]="Permit";n[n.Plan=3]="Plan";n[n.Inspection=4]="Inspection";n[n.CodeCase=5]="CodeCase";n[n.Request=6]="Request";n[n.Business=7]="Business";n[n.BusinessLicense=8]="BusinessLicense";n[n.ProfessionalLicense=9]="ProfessionalLicense";n[n.License=10]="License";n[n.BusinessLicenseRenewal=11]="BusinessLicenseRenewal";n[n.ProfessionalLicenseRenewal=12]="ProfessionalLicenseRenewal";n[n.Application=13]="Application";n[n.Project=14]="Project";n[n.OperationalPermit=15]="OperationalPermit"}(r=n.FilterModule||(n.FilterModule={})),function(n){n[n.Permit=1]="Permit";n[n.Plan=2]="Plan";n[n.Project=3]="Project"}(u=n.AccountCaseModules||(n.AccountCaseModules={})),function(n){n[n.Debit=1]="Debit";n[n.Credit=2]="Credit"}(f=n.AccountAction||(n.AccountAction={})),function(n){n[n.UnpaidFees=3]="UnpaidFees";n[n.FailedInspections=4]="FailedInspections";n[n.FailedSubmittals=5]="FailedSubmittals";n[n.FailedEReviewFiles=6]="FailedEReviewFiles"}(e=n.AttentionReasonCode||(n.AttentionReasonCode={})),function(n){n[n.Active=1]="Active";n[n.Closed=2]="Closed";n[n.Hold=3]="Hold";n[n.Other=4]="Other"}(o=n.LicenseSystemStatus||(n.LicenseSystemStatus={})),function(n){n[n.Other=0]="Other";n[n.Applicant=1]="Applicant";n[n.Owner=2]="Owner";n[n.Contractor=3]="Contractor";n[n.OwnerOrBuilder=4]="OwnerOrBuilder"}(s=n.LandManagementContactSystemType||(n.LandManagementContactSystemType={})),function(n){n[n.Apply=0]="Apply";n[n.CreateTemplate=1]="CreateTemplate";n[n.UpdateTemplate=2]="UpdateTemplate";n[n.UseTemplate=3]="UseTemplate"}(h=n.MenuActionType||(n.MenuActionType={})),function(n){n[n.Permit=1]="Permit";n[n.Plan=2]="Plan";n[n.BusinessLicense=3]="BusinessLicense";n[n.ProfessionalLicense=4]="ProfessionalLicense";n[n.Registration=5]="Registration";n[n.Application=6]="Application"}(c=n.AgreementType||(n.AgreementType={})),function(n){n[n.PermitManagement=0]="PermitManagement";n[n.PlanManagement=1]="PlanManagement";n[n.InspectionManagement=2]="InspectionManagement";n[n.CodeManagement=3]="CodeManagement";n[n.ProjectManagement=4]="ProjectManagement";n[n.ApplicationManagement=5]="ApplicationManagement";n[n.RequestManagement=6]="RequestManagement";n[n.AssetManagement=7]="AssetManagement";n[n.BusinessLicenseManagement=8]="BusinessLicenseManagement";n[n.BusinessLicenseEntity=9]="BusinessLicenseEntity";n[n.IndividualLicense=10]="IndividualLicense";n[n.TaxRemittanceAccountEntity=11]="TaxRemittanceAccountEntity";n[n.RentalPropertyManagement=12]="RentalPropertyManagement";n[n.ObjectManagement=13]="ObjectManagement";n[n.ImpactManagement=14]="ImpactManagement";n[n.ContactManagement=15]="ContactManagement";n[n.PropertyManagement=16]="PropertyManagement"}(l=n.Module||(n.Module={})),function(n){n[n.GISFeature=0]="GISFeature";n[n.SpatialCollection=1]="SpatialCollection";n[n.Parcel=2]="Parcel";n[n.Address=3]="Address"}(a=n.ProfileType||(n.ProfileType={})),function(n){n[n.BusinessLicense=1]="BusinessLicense";n[n.RentalProperty=2]="RentalProperty";n[n.OperationalPermit=3]="OperationalPermit"}(v=n.BusinessLicenseTypeModule||(n.BusinessLicenseTypeModule={})),function(n){n[n.Business=1]="Business";n[n.Landlord=2]="Landlord";n[n.Site=3]="Site"}(y=n.BusinessLicenseCompanyTypeModule||(n.BusinessLicenseCompanyTypeModule={})),function(n){n[n.Permit=1]="Permit";n[n.Plan=2]="Plan";n[n.ProfessionalLicense=3]="ProfessionalLicense";n[n.BusinessLicense=4]="BusinessLicense";n[n.Application=5]="Application";n[n.OperationalPermit=6]="OperationalPermit"}(p=n.CategoryObject||(n.CategoryObject={}))})(t=n.CaseTypeUseEnums||(n.CaseTypeUseEnums={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){function t(n,t){return angular.forEach(t,function(t){switch(t.FieldName){case"StreetNumber":n.AddressLine1=t.FieldValue;break;case"StreetName":n.AddressLine2=t.FieldValue;break;case"StreetType":n.StreetType=t.FieldValue;break;case"City":n.City=t.FieldValue;break;case"State":n.State=t.FieldValue;break;case"PostalCode":n.PostalCode=t.FieldValue;break;case"County":n.County=t.FieldValue;break;case"CivicNumber":n.AddressLine1=t.FieldValue;break;case"Province":n.Province=t.FieldValue;break;case"Country":n.Country=t.FieldValue;break;case"UnitOrSuite":n.UnitOrSuite=t.FieldValue;break;case"PreDirection":n.PreDirection=t.FieldValue;break;case"PostDirection":n.PostDirection=t.FieldValue;break;case"AddressLine3":n.AddressLine3=t.FieldValue;break;case"ATTN":n.ATTN=t.FieldValue;break;case"CompSite":n.CompSite=t.FieldValue;break;case"GeneralDelivery":n.GeneralDelivery=t.FieldValue.toLowerCase()=="true"?!0:!1;break;case"POBox":n.POBox=t.FieldValue;break;case"RuralRoute":n.RuralRoute=t.FieldValue;break;case"Station":n.Station=t.FieldValue;break;case"GISAddressID":n.GisAddressId=t.FieldValue}}),n}n.mapArcGisAddressFieldToEnergovAddressField=t})(t=n.Helper||(n.Helper={}))})(t=n.Map||(n.Map={}))}(EnerGov||(EnerGov={})),function(n){var t=function(){function n(){}return n.contains=function(n,t){for(var i=0;i<n.length;i++)if(n[i]===t)return!0;return!1},n.remove=function(n,t){var i=n.indexOf(t);i>-1&&n.splice(i,1)},n.unique=function(t){for(var r=[],i=0;i<t.length;i++)n.contains(r,t[i])||r.push(t[i]);return r},n}();n.ArrayExtensions=t}(ArrayExtensions||(ArrayExtensions={})),function(n){var t;(function(n){var t;(function(n){"use strict";var f=function(){function n(){}return n}(),t,i,r,u;n.InspectionWeekendAndHoliday=f;t=function(){function n(){}return n}();n.InspectionCutOffTimeOption=t;i=function(){function n(){}return n}();n.InspectionLimitOption=i;r=function(){function n(){}return n}();n.ReInspectionLimitOption=r;u=function(){function n(){}return n.disableEnerGovNonWorkDay=function(n,t,i,r,u,f,e){var o=!1,s,c,h;return t==="day"&&(i.AllowRequestInspectionOnWeekendAndHoliday||(i.NonWorkdays.indexOf(n.getDay())!==-1&&(o=!0),i.Holidays.indexOf(n.toUTCString())!==-1&&(o=!0),$.each(i.Holidays,function(t,i){if(moment(n.toDateString()).isSame(i))return o=!0,!1})),f!=null&&f.IsReinspection&&f.NextReInspectionDay!=null&&moment(n.toDateString()).isBefore(f.NextReInspectionDay)&&(o=!0),r!==null&&r.UseInspectionCutOffTime&&r.InspectionCutOffTime!==null&&o==!1&&(s=moment(n),c=moment(r.InspectionCutOffTime).local(),s.dayOfYear()==c.dayOfYear()&&(h=moment(new Date),s.set("h",h.get("h")),s.set("m",h.get("m")),s.set("s",h.get("s")),s>c&&(o=!0))),o||e===null||moment(n).year()<=moment(e).year()&&moment(n).dayOfYear()<=moment(e).local().dayOfYear()&&(o=!0),$.each(u.LimitReachedDays,function(t,i){moment(n.toDateString()).isSame(i)&&(o=!0)})),o},n}();n.DatePickerHelper=u})(t=n.Helpers||(n.Helpers={}))})(t=n.Common||(n.Common={}))}(app||(app={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(){}return n.getType=function(n){var t;switch(typeof n){case"string":t="string";break;case"number":t="number";break;case"boolean":t="boolean";break;default:throw new Error("Type of value is not a valid return type");}return t},n.isNumber=function(n){return typeof n=="number"},n.isString=function(n){return typeof n=="string"},n.isBoolean=function(n){return typeof n=="string"},n.isStringValid=function(n){return n?!0:!1},n.isNumberValid=function(n){return n>0?!0:!1},n.isBooleanValid=function(n){return n==!0||n==!1?!0:!1},n}();n.PrimitiveDataTypeUtility=t})(t=n.Utility||(n.Utility={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n}return n.prototype.getInstructions=function(n,t){var i=this;this.http.get("/casetype/instructions/"+n.PackageCaseTypeId+"/"+n.PackageCaseClassId+"/",function(n){n.Success&&(i.caseTypeInstructions=n.Result,t(n.Result))})},n.prototype.getRenewalInstructions=function(n,t){var i=this;this.http.get("/casetype/renewalInstructions/"+n.PackageCaseTypeId+"/"+n.PackageCaseClassId+"/",function(n){n.Success&&(i.caseTypeInstructions=n.Result,t(n.Result))})},n.prototype.getUseApplicationInstruction=function(n,t){var i=this;this.http.get("/casetype/use-application-instruction/"+n.PackageCaseTypeId+"/"+n.PackageCaseClassId+"/",function(n){n.Success&&(i.useApplicationInstruction=n.Result,t(n.Result))})},n}();n.CaseTypeInstructionService=t})(t=n.Services||(n.Services={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/casetype/"}return n.prototype.getCaseTypeSuggestionsById=function(n,t){this.http.get(this.rootUrl+"suggestions/"+n.toString(),function(n){if(n.Success){var i=n.Result;t(i)}},!1)},n}();n.CaseTypeService=t})(t=n.Services||(n.Services={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/spatialsearch/";this.rootUrlParcels="/map/search/parcelownerinfo"}return n.prototype.searchByCriteria=function(n,t){this.http.post(this.rootUrl+"bufferredsearch",n,function(n){n.Success&&t(n)},!0)},n.prototype.searchByFilterCriteria=function(n,t){this.http.post(this.rootUrl+"extentsearch",n,function(n){n.Success&&t(n.Result)},!0)},n.prototype.searchByBufferModuleCriteria=function(n,t,i){var r={Criteria:n,Addresses:t};this.http.post(this.rootUrl+"bufferredmodulesearch",r,function(n){n.Success&&i(n.Result)},!0)},n.prototype.searchByShapeModuleCriteria=function(n,t){this.http.post(this.rootUrl+"shapemodulesearch",n,function(n){n.Success&&t(n.Result)},!0)},n.prototype.searchByFilterModuleCriteria=function(n,t){this.http.post(this.rootUrl+"extentmodulesearch",n,function(n){n.Success&&t(n.Result)},!0)},n.prototype.mapFiltersSetupData=function(n){this.http.get(this.rootUrl+"filtersetup",function(t){t.Success&&n(t.Result)},!0)},n.prototype.searchForParcelData=function(n,t,i){this.http.post(this.rootUrlParcels,t,function(n){n&&i(n)},!0)},n.prototype.projectPoint=function(n,t){this.http.post("/map/projection",n,function(n){n.Success&&t(n.Result)},!0)},n}();n.EnerGovMapService=t})(t=n.Services||(n.Services={}))})(t=n.Map||(n.Map={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n}return n.prototype.getUseCustomMappingsSoftwarePackageSetting=function(n){this.http.get("/tenantSettings/SoftwarePackageSettings",function(t){t.Success&&n(t.Result)},!1,{settingName:"UseCustomMappingsForPermitsTypesAndClasses"})},n.prototype.getHideApplybuttonInFeeEstimatorSoftwarePackageSetting=function(n){this.http.get("/tenantSettings/SoftwarePackageSettings",function(t){t.Success&&n(t.Result)},!1,{settingName:"HideApplybuttonInFeeEstimator"})},n.prototype.getAllowFeeEstimatorSoftwarePackageSetting=function(n){this.http.get("/tenantSettings/SoftwarePackageSettings",function(t){t.Success&&n(t.Result)},!1,{settingName:"AllowFeeEstimator"})},n.prototype.getDisplaySearchByDescriptionFieldSetting=function(n){this.http.get("/tenantSettings/display-search-by-description-field-settings",function(t){t.Success&&n(t.Result)},!1)},n.prototype.getSoftwareSetting=function(n,t,i){var r={softwarePackageName:n,settingName:t};return this.http.get("/tenantSettings/SoftwarePackageSettings",function(n){n.Success&&i(n.Result)},!1,r)},n.prototype.getUserSetting=function(n,t){return this.http.get("/tenantSettings/usersetting/"+n,function(n){n.Success&&t(n.Result)},!1)},n}();n.EnerGovSettingsService=t})(t=n.Services||(n.Services={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r){this.http=n;this.$q=t;this.$http=i;this.globalsService=r;this.url="";this.contactDataUrl="/energov/search/searchcontactcards";this.subrecordApplyInfo=null;this.contactCardInfoResult=null}return n.prototype.getSubrecordApplyData=function(n,t,i){var r=this;switch(t){case app.Common.SelfServiceModules.Permit:r.url="/energov/permits/subrecordapply/data/"+n;break;case app.Common.SelfServiceModules.Plan:r.url="/energov/plans/subrecordapply/data/"+n}this.http.get(r.url,function(n){n.Success&&i(n.Result)},!0)},n.prototype.addAction=function(n,t,i,r,u,f){var e="",o={CaseId:n,WFTemplateId:i,WFTemplateStepActionId:r,EntityWFStepId:u};switch(t){case app.Common.SelfServiceModules.Permit:e="/energov/permits/addaction/";break;case app.Common.SelfServiceModules.Plan:e="/energov/plans/addaction/"}return this.http.put(e,o,function(n){f(n.Result)})},n.prototype.getSubrecordContactsData=function(n,t){var i=this;this.$http.post(this.globalsService.webApiBaseUrl+i.contactDataUrl,n).then(function(n){var i=n.data?n.data.Result:null;t(i)},function(){t(null)})},n.prototype.resetSubrecordInfo=function(){this.subrecordApplyInfo=null},n.prototype.IsSubrecordApply=function(){return this.subrecordApplyInfo!==null&&this.subrecordApplyInfo.WorkflowActionId?!0:!1},n}();n.EnerGovSubrecordApplyService=t})(t=n.Services||(n.Services={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t){this.http=n;this.$q=t;this.rootUrl="/energov/entity/common/setup/";this.entityAttachmentDefer=null}return n.prototype.getEntityRecordSortSecondaryData=function(n){if(this.sortSecondaryData){n(this.sortSecondaryData);return}var t=this;this.http.get(this.rootUrl+"sort",function(i){i.Success&&(t.sortSecondaryData=i,n(i))},!0)},n.prototype.setEReviewPromise=function(n){this.entityAttachmentDefer=n},n}();n.EntitySecondaryDataService=t})(t=n.Services||(n.Services={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n}return n.prototype.getAgreementId=function(n,t,i){this.http.get("/tenantsettings/agreementId/"+n+"/"+t,function(n){n.Success&&i(n.Result)},!1)},n.prototype.saveSignatureAgreementMetaData=function(n,t){this.http.post("/tenantsettings/saveSignatureMetaData",n,function(n){n.Success&&t(n.Result)},!1)},n}();n.EntitySignatureMetaDataService=t})(t=n.Services||(n.Services={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=app.Common.SelfServiceModules,i=function(){function n(n,t,i,r,u,f,e,o){this.$q=n;this.entityHoldsService=t;this.entityConditionsService=i;this.entitySubmittalsService=r;this.entityEventsService=u;this.tabNavigatorService=f;this.$routeParams=e;this.$location=o;this.entityHoldsExistPromise=null;this.entityConditionsExistPromise=null;this.entitySubmittalsExistPromise=null;this.entityEventsExistPromise=null}return n.prototype.setEntityTabsVisibility=function(n,i,r){var u=this,e={PageNumber:1,PageSize:10,SortField:"",IsSortedInAscendingOrder:!0,ModuleId:i,EntityId:this.$routeParams.id},f;u.isTabsPromiseCompleted=!1;u.isEntityHoldsExist=!1;u.isEntityConditionsExist=!1;u.isEntitySubmittalsExist=!1;u.isEntityEventsExist=!1;u.showLocationsTab=!0;u.showContactsTab=!0;u.showInspectionsTab=!0;u.showFeesTab=!0;u.showSubRecordsTab=!0;u.showAttachmentsTab=!0;u.showMoreInfoTab=!0;u.showViolationsTab=!0;u.showCheckListsTab=!0;u.showPreviousTab=!0;u.showBusinessTypesTab=!0;u.showLinkedLicenseTab=!0;u.showCodeCasesTab=!0;u.showBusinessTab=!0;u.existinginspectionStatus=-1;u.remaininginspectionStatus=-1;u.optionalinspectionStatus=-1;u.inspectionErrorMessage="";u.inspectionHasData=!1;u.subRecordsErrorMessage="";u.feeHasErroMessage=!1;u.entityHoldsExistPromise=null;u.entityConditionsExistPromise=null;u.entitySubmittalsExistPromise=null;u.entityEventsExistPromise=null;f=!1;[t.Permit,t.Plan,t.BusinessLicense,t.OperationalPermit,t.ProfLicense,t.Code,t.Project,t.BusinessEntity].indexOf(i)>=0&&(u.entityHoldsExistPromise=u.entityHoldsService.searchHoldsForEntityTab(e,function(n){u.isEntityHoldsExist=n.TotalFound===0||n.StatusCode===app.Common.Services.HttpStatusCode.NoContent||n.StatusCode===app.Common.Services.HttpStatusCode.Forbidden?!1:!0;r!=app.Constants.TabConstants.Holds||u.isEntityHoldsExist||(f=!0)}));[t.Permit,t.Plan,t.Project].indexOf(i)>=0&&(u.entityConditionsExistPromise=u.entityConditionsService.isEntityConditionsExist(n,i,function(n){u.isEntityConditionsExist=n;r!=app.Constants.TabConstants.Conditions||u.isEntityConditionsExist||(f=!0)}));[t.Permit,t.Plan].indexOf(i)>=0&&(u.entitySubmittalsExistPromise=u.entitySubmittalsService.searchSubmittalsForEntityTab(e,function(n){u.isEntitySubmittalsExist=n.TotalFound===0||n.StatusCode===app.Common.Services.HttpStatusCode.NoContent||n.StatusCode===app.Common.Services.HttpStatusCode.Forbidden?!1:!0;r!=app.Constants.TabConstants.Reviews||u.isEntitySubmittalsExist||(f=!0)}));[t.Permit,t.Plan,t.Application].indexOf(i)>=0&&(u.entityEventsExistPromise=u.entityEventsService.searchEventForEntityTab(e,function(n){u.isEntityEventsExist=n.TotalFound===0||n.StatusCode===app.Common.Services.HttpStatusCode.NoContent||n.StatusCode===app.Common.Services.HttpStatusCode.Forbidden?!1:!0;r!=app.Constants.TabConstants.Meetings||u.isEntityEventsExist||(f=!0)}));u.$q.all([u.entityHoldsExistPromise,u.entityConditionsExistPromise,u.entitySubmittalsExistPromise,u.entityEventsExistPromise]).then(function(){u.isTabsPromiseCompleted=!0;r&&u.tabNavigatorService.selectTab(r,f)})},n.prototype.setInspectionTabsVisibility=function(n,i){var r=this;n.Success||n.ErrorMessage==""||r.inspectionErrorMessage!=""?n.Success&&!n.ErrorMessage&&r.inspectionErrorMessage&&(r.inspectionErrorMessage=""):r.inspectionErrorMessage=n.ErrorMessage;n.Success&&(r.inspectionHasData=!0);i==t.Code?(r.existinginspectionStatus!=-1&&r.remaininginspectionStatus!=-1&&r.existinginspectionStatus==app.Common.Services.HttpStatusCode.Forbidden&&r.remaininginspectionStatus==app.Common.Services.HttpStatusCode.Forbidden||r.existinginspectionStatus==app.Common.Services.HttpStatusCode.NoContent&&r.remaininginspectionStatus==app.Common.Services.HttpStatusCode.NoContent)&&(r.showInspectionsTab=!1,r.$routeParams.tab&&r.$routeParams.tab==app.Constants.TabConstants.Inspections?r.setAdditionalEntityTabsVisibility(r.$routeParams.tab,r.showInspectionsTab):r.setFirstTabOnHidingOtherTabs()):i==t.BusinessEntity?r.existinginspectionStatus!=-1&&(r.existinginspectionStatus==app.Common.Services.HttpStatusCode.Forbidden||r.existinginspectionStatus==app.Common.Services.HttpStatusCode.NoContent)&&(r.showInspectionsTab=!1,r.$routeParams.tab&&r.$routeParams.tab==app.Constants.TabConstants.Inspections?r.setAdditionalEntityTabsVisibility(r.$routeParams.tab,r.showInspectionsTab):r.setFirstTabOnHidingOtherTabs()):(r.existinginspectionStatus!=-1&&r.remaininginspectionStatus!=-1&&r.optionalinspectionStatus!=-1&&r.existinginspectionStatus==app.Common.Services.HttpStatusCode.Forbidden&&r.remaininginspectionStatus==app.Common.Services.HttpStatusCode.Forbidden&&r.optionalinspectionStatus==app.Common.Services.HttpStatusCode.Forbidden||r.existinginspectionStatus==app.Common.Services.HttpStatusCode.NoContent&&r.remaininginspectionStatus==app.Common.Services.HttpStatusCode.NoContent&&r.optionalinspectionStatus==app.Common.Services.HttpStatusCode.NoContent)&&(r.showInspectionsTab=!1,r.$routeParams.tab&&r.$routeParams.tab==app.Constants.TabConstants.Inspections?r.setAdditionalEntityTabsVisibility(r.$routeParams.tab,r.showInspectionsTab):r.setFirstTabOnHidingOtherTabs())},n.prototype.getSelectedTabForEntityTabs=function(){var n=this;return n.tabNavigatorService.getSelectedTabForEntityTabs()},n.prototype.setAdditionalEntityTabsVisibility=function(n,t){var i=this;i.tabNavigatorService.selectTab(n,!t);i.setFirstTabOnHidingOtherTabs()},n.prototype.setFirstTabOnHidingOtherTabs=function(){var i=this.tabNavigatorService.getSelectedTabForEntityTabs(),n=this.checkAvailableTab(),t=n.filter(function(n){return n==i})[0];(t==null||t==="")&&(this.tabNavigatorService.navigate(n[0]),this.tabNavigatorService.setFocusByTab(n[0]),this.tabNavigatorService.setTabRequestedByTab(n[0]))},n.prototype.checkAvailableTab=function(){var n=[],t;if(this.$routeParams.id){t=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id);switch(t){case app.Common.SelfServiceModules.Permit:case app.Common.SelfServiceModules.Plan:n.push(app.Constants.TabConstants.Summary);this.showLocationsTab&&n.push(app.Constants.TabConstants.Locations);this.showFeesTab&&n.push(app.Constants.TabConstants.Fees);this.isEntitySubmittalsExist&&n.push(app.Constants.TabConstants.Reviews);this.showInspectionsTab&&n.push(app.Constants.TabConstants.Inspections);n.push(app.Constants.TabConstants.Ereviews);this.showAttachmentsTab&&n.push(app.Constants.TabConstants.Attachments);this.showContactsTab&&n.push(app.Constants.TabConstants.Contacts);this.showSubRecordsTab&&n.push(app.Constants.TabConstants.Subrecords);this.isEntityHoldsExist&&n.push(app.Constants.TabConstants.Holds);this.isEntityEventsExist&&n.push(app.Constants.TabConstants.Meetings);this.showMoreInfoTab&&n.push(app.Constants.TabConstants.Moreinfo);this.isEntityConditionsExist&&n.push(app.Constants.TabConstants.Conditions);n.push(app.Constants.TabConstants.Comments);break;case app.Common.SelfServiceModules.Inspection:this.showLocationsTab&&n.push(app.Constants.TabConstants.Locations);this.showContactsTab&&n.push(app.Constants.TabConstants.Contacts);this.showCheckListsTab&&n.push(app.Constants.TabConstants.Checklists);this.showFeesTab&&n.push(app.Constants.TabConstants.Fees);this.showAttachmentsTab&&n.push(app.Constants.TabConstants.Attachments);this.showPreviousTab&&n.push(app.Constants.TabConstants.Previous);this.showMoreInfoTab&&n.push(app.Constants.TabConstants.Moreinfo);break;case app.Common.SelfServiceModules.Code:this.showLocationsTab&&n.push(app.Constants.TabConstants.Locations);this.showFeesTab&&n.push(app.Constants.TabConstants.Fees);this.showInspectionsTab&&n.push(app.Constants.TabConstants.Inspections);this.showAttachmentsTab&&n.push(app.Constants.TabConstants.Attachments);this.showContactsTab&&n.push(app.Constants.TabConstants.Contacts);this.isEntityHoldsExist&&n.push(app.Constants.TabConstants.Holds);this.showMoreInfoTab&&n.push(app.Constants.TabConstants.Moreinfo);this.showViolationsTab&&n.push(app.Constants.TabConstants.Violations);break;case app.Common.SelfServiceModules.Request:this.showLocationsTab&&n.push(app.Constants.TabConstants.Locations);this.showCodeCasesTab&&n.push(app.Constants.TabConstants.CodeCases);this.showAttachmentsTab&&n.push(app.Constants.TabConstants.Attachments);this.showContactsTab&&n.push(app.Constants.TabConstants.Contacts);this.showMoreInfoTab&&n.push(app.Constants.TabConstants.Moreinfo);break;case app.Common.SelfServiceModules.ProfLicense:this.showLocationsTab&&n.push(app.Constants.TabConstants.Locations);this.showFeesTab&&n.push(app.Constants.TabConstants.Fees);this.showInspectionsTab&&n.push(app.Constants.TabConstants.Inspections);this.showAttachmentsTab&&n.push(app.Constants.TabConstants.Attachments);this.showContactsTab&&n.push(app.Constants.TabConstants.Contacts);this.isEntityHoldsExist&&n.push(app.Constants.TabConstants.Holds);this.showMoreInfoTab&&n.push(app.Constants.TabConstants.Moreinfo);break;case app.Common.SelfServiceModules.BusinessEntity:this.showLocationsTab&&n.push(app.Constants.TabConstants.Locations);this.showInspectionsTab&&n.push(app.Constants.TabConstants.Inspections);this.showAttachmentsTab&&n.push(app.Constants.TabConstants.Attachments);this.showContactsTab&&n.push(app.Constants.TabConstants.Contacts);this.isEntityHoldsExist&&n.push(app.Constants.TabConstants.Holds);this.showBusinessTypesTab&&n.push(app.Constants.TabConstants.Businesstypes);this.showMoreInfoTab&&n.push(app.Constants.TabConstants.Moreinfo);this.showLinkedLicenseTab&&n.push(app.Constants.TabConstants.LinkedLicenses);break;case app.Common.SelfServiceModules.BusinessLicense:case app.Common.SelfServiceModules.OperationalPermit:this.showBusinessTab&&n.push(app.Constants.TabConstants.Business);this.showLocationsTab&&n.push(app.Constants.TabConstants.Locations);this.showFeesTab&&n.push(app.Constants.TabConstants.Fees);this.showInspectionsTab&&n.push(app.Constants.TabConstants.Inspections);this.showAttachmentsTab&&n.push(app.Constants.TabConstants.Attachments);this.showContactsTab&&n.push(app.Constants.TabConstants.Contacts);this.isEntityHoldsExist&&n.push(app.Constants.TabConstants.Holds);this.showBusinessTypesTab&&n.push(app.Constants.TabConstants.Businesstypes);this.showMoreInfoTab&&n.push(app.Constants.TabConstants.Moreinfo);break;case app.Common.SelfServiceModules.Application:this.showLocationsTab&&n.push(app.Constants.TabConstants.Locations);this.showContactsTab&&n.push(app.Constants.TabConstants.Contacts);this.showFeesTab&&n.push(app.Constants.TabConstants.Fees);this.showAttachmentsTab&&n.push(app.Constants.TabConstants.Attachments);this.isEntityEventsExist&&n.push(app.Constants.TabConstants.Meetings);this.showMoreInfoTab&&n.push(app.Constants.TabConstants.Moreinfo);break;case app.Common.SelfServiceModules.Project:n.push(app.Constants.TabConstants.Summary);this.showLocationsTab&&n.push(app.Constants.TabConstants.Locations);this.showFeesTab&&n.push(app.Constants.TabConstants.Fees);this.showAttachmentsTab&&n.push(app.Constants.TabConstants.Attachments);this.showContactsTab&&n.push(app.Constants.TabConstants.Contacts);this.isEntityHoldsExist&&n.push(app.Constants.TabConstants.Holds);this.showMoreInfoTab&&n.push(app.Constants.TabConstants.Moreinfo);this.isEntityConditionsExist&&n.push(app.Constants.TabConstants.Conditions)}return n}},n}();n.EntityTabsService=i})(t=n.Services||(n.Services={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n}return n.prototype.getIntent=function(n,t,i,r){this.http.post("/intents/criteria",{action:n,mimeType:t,category:i},function(n){n.Success&&r(n.Result)})},n}();n.IntentsService=t})(t=n.Services||(n.Services={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){var i;(function(t){var i=n.Common.Utility.PrimitiveDataTypeUtility,r=function(){function n(n,t,i,r,u){this.Name=n;this.Key=t;this.Value=i;this.DefaultValue=r;this.Index=u}return n.prototype.IsValid=function(){var n=!1,t=i.getType(this.DefaultValue);switch(t){case"string":i.isStringValid(this.Value)&&(n=!0);break;case"number":i.isNumberValid(this.Value)&&(n=!0);break;case"boolean":i.isBooleanValid(this.Value)&&(n=!0);break;default:throw new Error("Type of value is not a valid return type");}return n},n}(),u;t.QueryStringItem=r;u=function(){function n(){this.items=[];this.output="";this.query=""}return n.prototype.join=function(n,t){var i='"'+n+'": "'+t+'"',r=n+"="+t;this.output==""?(this.output=i,this.query=r):(this.output=this.output+", "+i,this.query=this.query+"&"+r)},n.prototype.generateQuery=function(){var n,i,t;if(this.isDefaultQuery()){this.output="";this.query="";return}for(n=0,i=this.items;n<i.length;n++)t=i[n],t.IsValid()&&this.join(t.Key,t.Value)},n.prototype.isDefaultQuery=function(){for(var t,i=!0,n=0,r=this.items;n<r.length;n++)if(t=r[n],t.Value!=t.DefaultValue){i=!1;break}return i},n.prototype.count=function(){return this.items.length},n.prototype.clear=function(){this.items=[]},n.prototype.getByKey=function(n){var t,i=this.items.filter(function(t){return t.Key==n});return i.length>0&&(t=i[0].Value),t},n.prototype.reset=function(){for(var i,n=0,t=this.items;n<t.length;n++)i=t[n],i.Value=i.DefaultValue},n.prototype.update=function(n){for(var u,f=function(n){t=e.items.filter(function(t){return t.Key==n[0]});t.length>0&&(t[0].Value=n[1])},e=this,t,i=0,r=n;i<r.length;i++)u=r[i],f(u)},n.prototype.add=function(n,t,i,u,f){f===void 0&&(f=0);var e=new r(n,t,i,u,f>0?f:this.items.length+1);this.items.push(e)},n.prototype.toString=function(){return this.output="",this.generateQuery(),"{"+this.output+"}"},n.prototype.toQuery=function(){return this.query="",this.generateQuery(),"?"+this.query},n.prototype.toObject=function(){return JSON.parse(this.toString())},n}();t.QueryStringService=u})(i=t.Services||(t.Services={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use scrict";var t=function(){function n(){}return n.prototype.GenerateString=function(){for(var n="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=0;i<5;i++)n+=t.charAt(Math.floor(Math.random()*t.length));return n},n}();n.RandomStringGeneratorService=t})(t=n.Services||(n.Services={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){var i=this,t;this.$q=n;t=this.$q.defer();this.setParentModel=function(n){i.parentModel=n;t.notify(i.parentModel)};this.observeParentModel=function(){return t.promise}}return n}();n.SelfserviceStateService=t})(t=n.Services||(n.Services={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t){this.http=n;this.settingsService=t;this.allowPayInvoiceNotLoggedIn=!1;this.allowPayInvoiceNotContact=!1;this.showPayNowButton=!1}return n.prototype.canShowPayNowButon=function(n,t,i){var r=this;r.settingsService.getAllowPayInvoiceNotLoggedInSetting(function(u){r.allowPayInvoiceNotLoggedIn=u.SettingValue==="true";r.settingsService.getAllowPayInvoiceNotContactSetting(function(u){r.allowPayInvoiceNotContact=u.SettingValue==="true";n&&(r.showPayNowButton=n.IsBillingContact||n.IsLoggedIn&&r.allowPayInvoiceNotContact||t&&r.allowPayInvoiceNotLoggedIn);i(r.showPayNowButton)})})},n}();n.SettingPolicyService=t})(t=n.Services||(n.Services={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r,u){this.http=n;this.$mdStepper=t;this.$mdComponentRegistry=i;this.$timeout=r;this.enerGovAttachmentCardsService=u;this.backToLocationStep=!1;this.backToContactsStep=!1;this.backToBusinessTypeStep=!1;this.backToApplicationTypeStep=!1;this.loading=!0;this.isNewMenuItem=!1;this.isResubmitProcess=!1;this.stepper={Name:"",Steps:[]};var f=this}return n.prototype.cleanStepper=function(){this.backToLocationStep=!1;this.backToContactsStep=!1;this.backToBusinessTypeStep=!1;this.backToApplicationTypeStep=!1},n.prototype.stepsSetup=function(n,t,i){var r=this;this.stepperReloadComplete=!1;this.$timeout(function(){r.stepperReloadComplete=!0});this.$mdComponentRegistry.when("apply-stepper").then(function(){r.steppers=r.$mdStepper("apply-stepper");r.steppers.steps=[];r.loading=!0;r.isLinear=!0;r.isVertical=!1;r.isMobileStepText=!0;r.isAlternative=!0;r.currentStepNumber=0;r.stepper.Name=n;r.stepper.Steps=_.sortBy(t,"Order");r.contactStep=_.findWhere(r.stepper.Steps,{Label:"Contacts"});r.locationStep=_.findWhere(r.stepper.Steps,{Label:"Locations"});r.businessTypeStep=_.findWhere(r.stepper.Steps,{Label:"Business Types"});r.applicationTypeStep=_.findWhere(r.stepper.Steps,{Label:"Type"});r.attachmentStep=_.findWhere(r.stepper.Steps,{Label:"Attachments"});r.stepper.Steps[0].ShowBackButton=!1;r.isNewMenuItem||r.isResubmitProcess?(r.cleanStepper(),r.isNewMenuItem=!1,r.isResubmitProcess=!1,r.currentType=i):(r.backToLocationStep&&(r.currentStepNumber=r.locationStep.Order,r.steppers.currentStep=r.currentStepNumber),r.backToContactsStep&&(r.currentStepNumber=r.contactStep.Order,r.steppers.currentStep=r.currentStepNumber),r.backToBusinessTypeStep&&(r.currentStepNumber=r.businessTypeStep.Order,r.steppers.currentStep=r.currentStepNumber),r.backToApplicationTypeStep&&(r.currentStepNumber=r.applicationTypeStep.Order,r.steppers.currentStep=r.currentStepNumber))})},n.prototype.setNewItemStepper=function(){this.isNewMenuItem=!0;this.stepper={Name:"",Steps:[]};this.applicationTypeStep=null},n.prototype.initializeSteps=function(){var n=this;this.$mdComponentRegistry.when("apply-stepper").then(function(){n.steppers=n.$mdStepper("apply-stepper");n.isNewMenuItem||n.isResubmitProcess?(n.currentStepNumber=0,n.steppers.currentStep=n.currentStepNumber,n.cleanStepper()):n.steppers.currentStep=n.currentStepNumber})},n.prototype.nextStep=function(){this.currentStepNumber++;this.checkForApplicationTypeStep();this.checkForLocationStep();this.checkForContactStep();this.checkForBusinessTypeStep();this.loading=!0;this.steppers.next();this.checkForAttachmentStep()},n.prototype.previousStep=function(){this.currentStepNumber--;this.checkForApplicationTypeStep();this.checkForLocationStep();this.checkForContactStep();this.checkForBusinessTypeStep();this.loading=!0;this.steppers.back();this.checkForAttachmentStep()},n.prototype.checkForAttachmentStep=function(){var n=this;this.attachmentStep&&this.currentStepNumber===this.attachmentStep.Order&&this.enerGovAttachmentCardsService.showDigEplanIFrame&&this.enerGovAttachmentCardsService.extReviewIntegrationTypeInfo&&this.enerGovAttachmentCardsService.extReviewIntegrationTypeInfo.DigEplanIFrameUrl&&this.$timeout(function(){var t=document.getElementById("DigEplan_iFrame1");t&&!t.src&&(t.src=n.enerGovAttachmentCardsService.extReviewIntegrationTypeInfo.DigEplanIFrameUrl)},0)},n.prototype.checkForLocationStep=function(){this.backToLocationStep=this.locationStep!=undefined&&this.currentStepNumber===this.locationStep.Order?!0:!1},n.prototype.checkForContactStep=function(){this.backToContactsStep=this.contactStep!=undefined&&this.currentStepNumber===this.contactStep.Order?!0:!1},n.prototype.checkForBusinessTypeStep=function(){this.backToBusinessTypeStep=this.businessTypeStep!=undefined&&this.currentStepNumber===this.businessTypeStep.Order?!0:!1},n.prototype.checkForApplicationTypeStep=function(){this.backToApplicationTypeStep=this.applicationTypeStep!=undefined&&this.currentStepNumber===this.applicationTypeStep.Order?!0:!1},n}();n.StepperService=t})(t=n.Services||(n.Services={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/search"}return n.prototype.searchByCriteria=function(n,t){this.http.post(this.rootUrl,n,function(n){n.Success&&t(n)},!1)},n}();n.TestSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.imageData={consentName:"",imageBlob:"",agreementIdentifierGuid:"",subject:""};this.isSignatureAddded=!1;this.isType=!1;this.signatureTypedName="";this.signatureAgreementText=""}return n.prototype.setImageMetadata=function(n,t){var i=JSON.stringify(n.imageBlob);this.http.post("/energov/signature/metadata/",n,function(n){t(n.Result)},!1)},n.prototype.cleanUp=function(){this.imageData={consentName:"",imageBlob:"",agreementIdentifierGuid:"",subject:""};this.isSignatureAddded=!1;this.isType=!1;this.signatureTypedName="";this.signatureAgreementText=""},n}();n.TylerSignaturePadService=t})(t=n.Services||(n.Services={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(){}return n.prototype.getUpdatedDateText=function(n,t,i,r){var u="";if(i)if(n){var o=r?n.ShowRequestedTime:n.ShowScheduledTime,f=r?n.RequestedAMText:n.ScheduledAMText,e=r?n.RequestedPMText:n.ScheduledPMText,s=r?n.IsMidnightRequestTime:n.IsMidnightScheduleTime;switch(o){case app.Constants.InspectionConstants.Yes:u=t?i?moment(i).format(app.Constants.GlobalConstants.DateFormatOnlyTimeForInspection)+" "+moment.tz(moment.tz.guess()).format("z")+" (Approximate)":"":i?moment(i).format(app.Constants.GlobalConstants.DateFormatOnlyTimeForInspection).toString():"";break;case app.Constants.InspectionConstants.No:u="";break;case app.Constants.InspectionConstants.YesOverrideMidnightTime:if(s)u=i?moment(i).format(app.Constants.GlobalConstants.DateFormatOnlyMeridian).toString()===app.Constants.InspectionConstants.AM?f:e:"";else{u=t?i?moment(i).format(app.Constants.GlobalConstants.DateFormatOnlyTimeForInspection)+" "+moment.tz(moment.tz.guess()).format("z")+" (Approximate)":"":i?moment(i).format(app.Constants.GlobalConstants.DateFormatOnlyTimeForInspection).toString():"";break}break;case app.Constants.InspectionConstants.NoShowStaticText:u=i?moment(i).format(app.Constants.GlobalConstants.DateFormatOnlyMeridian).toString()===app.Constants.InspectionConstants.AM?f:e:"";break;case app.Constants.InspectionConstants.UseDefault:case"":u=t?i?moment(i).format(app.Constants.GlobalConstants.DateFormatOnlyTimeForInspection)+" "+moment.tz(moment.tz.guess()).format("z")+" (Approximate)":"":i?moment(i).format(app.Constants.GlobalConstants.DateFormatOnlyTimeForInspection).toString():""}}else u=t?i?moment(i).format(app.Constants.GlobalConstants.DateFormatOnlyTimeForInspection)+" "+moment.tz(moment.tz.guess()).format("z")+" (Approximate)":"":i?moment(i).format(app.Constants.GlobalConstants.DateFormatOnlyTimeForInspection).toString():"";return u},n}();n.TylerTimeZoneFormatterService=t})(t=n.Services||(n.Services={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){"use strict";var i=t.Services.TestSearchService,r=t.Services.EntitySecondaryDataService,u=n.Map.Services.EnerGovMapService,f=t.Services.EnerGovSettingsService;angular.module("enerGov.Common",["app.Common.Services"]).service("testSearchService",["http",i]).service("entitySecondaryDataService",["http","$q",r]).service("enerGovMapService",["http",u]).service("enerGovSettingsService",["http",f]).service("randomStringGeneratorService",[n.Common.Services.RandomStringGeneratorService]).service("enerGovSubrecordApplyService",["http","$q","$http","globalsService",t.Services.EnerGovSubrecordApplyService]).service("stepperService",["http","$mdStepper","$mdComponentRegistry","$timeout","enerGovAttachmentCardsService",t.Services.StepperService]).service("selfServiceStateService",["$q",t.Services.SelfserviceStateService]).service("caseTypeInstructionService",["http",t.Services.CaseTypeInstructionService]).service("caseTypeService",["http",t.Services.CaseTypeService]).service("addFundToEscrowAccountService",["$q","$http","globalsService",app.ShoppingCart.Services.AddFundToEscrowAccountService]).service("settingPolicyService",["http","settingsService",t.Services.SettingPolicyService]).service("tylerSignaturePadService",["http",t.Services.TylerSignaturePadService]).service("entitySignatureMetaDataService",["http",t.Services.EntitySignatureMetaDataService]).service("queryStringService",[t.Services.QueryStringService]).service("tylerTimeZoneFormatterService",[t.Services.TylerTimeZoneFormatterService]).service("entityTabsService",["$q","enerGovEntityHoldSearchService","enerGovEntityConditionSearchService","enerGovEntitySubmittalSearchService","enerGovEntityEventSearchService","tabNavigatorService","$routeParams","$location",t.Services.EntityTabsService]).service("attachmentCommonCardService",["enerGovApplyPermitService","enerGovApplyPlanService","$location","enerGovAttachmentCardsService",app.Common.Services.AttachmentCommonCard.AttachmentCommonCardService]).service("intentsService",["http",t.Services.IntentsService])})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={}));__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){var t;(function(n){"use strict";var t=function(n){function t(t,i,r,u){var f=n.call(this,null)||this,h,e,o,s;return f.menuService=t,f.resourceService=i,f.location=r,f.$routeParams=u,f.categories=[],f.title="",f.allCategoryName="All",f.allCategoryId=-1,h=f,e=f.location.path(),e.search("permit")!==-1&&(f.title="permit"),e.search("plan")!==-1&&(f.title="plan"),e.search("license")!==-1&&(f.title="license"),u.menuId&&(f.menuItems=t.getMenuItemsByParentId(u.menuId),o=["AllCategoryName"],s=f,f.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Common.CommonResource",o,function(n){n.AllCategoryName&&(s.allCategoryName=n.AllCategoryName);f.getCategories()})),f}return __extends(t,n),t.prototype.getCategories=function(){var t,n;this.menuItems&&(t={CategoryID:this.allCategoryId,CategoryName:this.allCategoryName},this.categories.push(t),this.filterCategory=this.allCategoryId,n=this,angular.forEach(this.menuItems,function(t){var r=app.Core.Controllers.CoreController.findItemInArray(n.categories,"CategoryID",t.CategoryID),i;r===null&&t.CategoryID&&(i={CategoryID:t.CategoryID,CategoryName:t.CategoryName},n.categories.push(i))}))},t.prototype.setFilter=function(n){this.filterCategory!==n&&(this.filterCategory=n,window.scrollTo(0,0))},t.prototype.isActiveFilter=function(n){return this.filterCategory===n?!0:!1},t.prototype.isIncludedInFilter=function(n){return this.filterCategory===this.allCategoryId||this.filterCategory===n?!0:!1},t.prototype.getMenuItemLabel=function(n){return n.CategoryName!==""?n.CategoryName+" : "+n.Label:n.Label},t.prototype.getCategoryCount=function(n){return n===this.allCategoryId?this.menuItems.length:this.menuItems.filter(function(t){return t.CategoryID===n}).length},t.prototype.getNavigationUrl=function(n){var t="",i;if(n.Route&&n.Route!=="")try{i=JSON.parse(n.Route);t=i.NavigationUrl;t=t.replace(":menuId",n.MenuID.toString().trim());t=t.replace(":draftId","0")}catch(r){t=""}return t},t.prototype.navigate=function(n){var t=this.getNavigationUrl(n);this.menuService.setSelectedMenuItem(n);t!==""&&this.location.url("/"+t)},t}(app.Core.Controllers.CoreController);n.EnerGovApplyAllController=t})(t=n.Apply||(n.Apply={}))})(t=n.Controllers||(n.Controllers={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={}));__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){var i;(function(t){"use strict";var u=n.Common.CaseTypeUseEnums.CaseTypeUse,r=n.Common.CaseTypeUseEnums.MenuActionType,i=app.Common.SelfServiceModules,e=app.Common.CommonOptions,f=app.Common.SubContactTypeOptions,o=n.Common.CaseTypeUseEnums.BusinessLicenseCompanyTypeModule,s=function(t){function s(n,i,u,f,e,s,h,c,l,a,v,y,p,w,b,k,d,g,nt,tt,it,rt,ut,ft,et,ot,st){var ht,ct;return g===void 0&&(g=null),nt===void 0&&(nt=null),tt===void 0&&(tt=null),it===void 0&&(it=null),ut===void 0&&(ut=null),et===void 0&&(et=null),ht=t.call(this,null)||this,ht.$routeParams=n,ht.$location=i,ht.globalService=u,ht.menuService=f,ht.settingsService=e,ht.enerGovContactCardsService=s,ht.enerGovAddressCardsService=h,ht.enerGovAttachmentCardsService=c,ht.enerGovCustomFieldsService=l,ht.customFieldsService=a,ht.draftService=v,ht.secondaryDataService=y,ht.applyService=p,ht.enerGovSubrecordApplyService=w,ht.userService=b,ht.$q=k,ht.stepperService=d,ht.locationService=g,ht.eReviewsService=nt,ht.eReviewAttachmentCardsService=tt,ht.enerGovBusinessTypeCardsService=it,ht.caseTypeInstructionService=rt,ht.tylerSignaturePadService=ut,ht.enerGovTemplateService=ft,ht.entitySignatureMetaDataService=et,ht.$timeout=ot,ht.attachmentCommonCardService=st,ht.draftType="",ht.disableLocationsInTemplates=!1,ht.isSubRecordApply=!1,ht.isRenewalLicense=!1,ht.hideSaveDraft=!1,ht.draftId=0,ht.menuActionTypeValues=r,ht.isTemplate=!1,ht.applyStepNumber=1,ht.draftData=null,ht.isFeeEstimate=!1,ht.isTypePreviouslySelected=!1,ht.allowFeeEstimator=!1,ht.requiredAddressNotPresent=!1,ht.permitWithContactValidCertificate=!1,ht.isPermitApply=!1,ht.isBusLicApply=!1,ht.isProfLicRenewal=!0,ht.isBusLicRenewal=!0,ht.isCompanyTypeOnly=!1,ht.showLicenseHolder=!1,ht.selectedType=null,ht.previousType=null,ht.basicInstruction="",ht.agreementId="",ht.entitySignatureMetaDataCriteria=null,ht.globalEntityId="",ht.entityMetaDataId="",ht.modalTemplateName="",ht.processingSaveTemplate=!1,ht.isModalTemplateNameInit=!1,ht.isApplicationApply=!1,ht.isPermitContactsValidationSuccess=!0,ht.errorMessage="",ht.isOperationalPermitApply=!1,ht.BusinessLicenseCompanyTypeModule=o,ht.menusToRemove=[],ht.subMenusToRemove=[],ht.flowOptions={target:ht.globalService.baseUrl+"api/energov/attachments/uploadchunk",permanentErrors:["404","500","501"],maxChunkRetries:1,chunkRetryInterval:5e3,simultaneousUploads:4,chunkSize:1e6,testChunks:!1,generateUniqueIdentifier:function(n){return Math.floor((1+Math.random())*65536).toString(16)+"-"+n.size+"-"+n.name}},ht.attachmentChunking=!0,ht.hasCustomLayout=function(){return ht.customFieldsService&&ht.customFieldsService.customLayout?!0:!1},ct=ht,ct.draftId=parseInt(ct.$routeParams.draftId,10),ht.$location.path().toUpperCase().indexOf("OPERATIONALPERMIT")>-1?ht.setOperationalPermitFlag(!0):ht.$location.path().toUpperCase().indexOf("BUSINESSLICENSE")>-1&&ht.setOperationalPermitFlag(!1),ct.setMenuActionType(),ht.setAttachmentPageStatusForApplyType(ct.menuActionType),ht.settingsService.getSoftwareSetting("energov","ShowMapOnLocationSelection",function(n){ht.enerGovAddressCardsService.showMapOnLocationSelection=n&&n.SettingValue==="true"}),ht.settingsService.getSoftwareSetting("energov","AllowFeeEstimator",function(n){ht.allowFeeEstimator=n&&n.SettingValue==="true"}),ht.initiateApplyController(),ct.menuActionType==r.UpdateTemplate&&ct.getDisableLocationsInTemplatesSetting(),ht.applyService.model.ERFileSubmissionQueueID||(ht.applyService.model.ERFileSubmissionQueueID=ht.enerGovAttachmentCardsService.create_UUID()),ht}return __extends(s,t),s.prototype.handleInactiveMenuItems=function(){},s.prototype.getSelectedWorkClassSecondaryData=function(){return null},s.prototype.getSelectedBusinessSecondaryData=function(){return null},s.prototype.populateCustomFieldDataForBusiness=function(){return null},s.prototype.getTypeIdFromPackageData=function(){return null},s.prototype.getWorkClassIdFromPackageData=function(){return null},s.prototype.checkSquareAndValuationBox=function(){},s.prototype.initializeData=function(){},s.prototype.updateDraftPartialFromModel=function(n){return n},s.prototype.updateModelPartialFromFraft=function(){},s.prototype.updateBusinessLocationFromDraft=function(){},s.prototype.setStepperSteps=function(){},s.prototype.setContactCertificateTypes=function(){return null},s.prototype.validateContacts=function(){return null},s.prototype.calculateEstimateFees=function(){},Object.defineProperty(s.prototype,"useFileCategoryForResubmission",{get:function(){return app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2022.2.0.0")&&this.attachmentCommonCardService.useFileCategoryForResubmission},enumerable:!0,configurable:!0}),s.prototype.setupAddressRequired=function(){this.requiredAddressNotPresent=!1;this.enerGovAddressCardsService.addressRequired&&this.enerGovAddressCardsService.addressCards.length==0&&this.enerGovAddressCardsService.locationCards.length==0&&(this.requiredAddressNotPresent=!0)},s.prototype.showMoreInfo=function(n){return n.CustomFieldsLayoutId||n.OnlineCustomFieldLayoutID?!0:!1},s.prototype.addressRequiredOk=function(){this.stepperService.previousStep()},s.prototype.addressRequiredCancel=function(){this.applyService.selectedType=this.previousType;this.selectType()},s.prototype.backToStepOne=function(){this.applyStepNumber=1},s.prototype.backToStepTwo=function(){this.applyStepNumber=2},s.prototype.getApplyStep=function(){return this.applyStepNumber},s.prototype.checkValidation=function(){this.goToStepTwo()},s.prototype.goToStepTwo=function(){this.applyStepNumber=2},s.prototype.goToStepThree=function(){this.applyStepNumber=3},s.prototype.checkForGeoRuleAlerts=function(){this.enerGovAddressCardsService.isGeoRuleAlert==!0&&(this.enerGovAddressCardsService.showMessage=!0,this.enerGovAddressCardsService.showAlert=!0)},s.prototype.refreshPage=function(){window.location.reload()},s.prototype.createFileSubmissionQueue=function(n,t){var i=this,r=i.enerGovAttachmentCardsService.getSubmissionQueueInfo();r.ERFileSubmissionQueueID=i.applyService.model.ERFileSubmissionQueueID;i.eReviewsService.createFileSubmissionQueue(r).then(function(u){u.Success&&i.eReviewsService.updateFileSubmissionQueue(i.addAttachmentsInfoToQueue(r,n)).then(function(n){t(n.Success,r.ERFileSubmissionQueueID)})})},s.prototype.addAttachmentsInfoToQueue=function(n,t){var i=this;return t&&t.length&&t.forEach(function(t){var r=i.enerGovAttachmentCardsService.getSubmissionQueueFileInfo(t.ERProjectFileCategoryId,t.FileName);n.ERFileSubmissionQueueFiles.push(r)}),n.IsNew=!1,n},s.prototype.selectType=function(){var t=this,n,r,u,f;this.isSubRecordApply||this.isRenewalLicense||this.isBusLicApply||(this.enerGovContactCardsService.contactCards=[],this.enerGovContactCardsService.extendedContactCards=[]);this.previousType=this.selectedType;this.selectedType=this.applyService.selectedType;this.isApplicationApply||(this.selectedType&&this.selectedType.CaseTypeInfo?(this.applyService.showWorkClass=this.applyService.selectedType.CaseTypeInfo.PackageCaseClassId==null,this.eReviewsService!==null&&this.eReviewsService!==undefined&&(this.eReviewsService.isEReviewCaseType=this.selectedType.CaseTypeInfo.EReviewsEnabled,this.eReviewsService.isAllowFileUpload=this.selectedType.CaseTypeInfo.EReviewsEnabled)):this.applyService.showWorkClass=this.showWorkClassDefault);this.enerGovAttachmentCardsService.isServiceModelCleaned=!0;this.isFeeEstimate||(this.enerGovAddressCardsService.allowOnlyOneLocation=this.selectedType.CaseTypeInfo.AllowOnlyOneLocation,this.enerGovAddressCardsService.allowSpatialCollectionAsLocation=this.selectedType.CaseTypeInfo.AllowSpatialCollectionAsLocation);this.checkSquareAndValuationBox();this.isApplicationApply&&(this.categoryObjectName=i[this.selectedType.CategoryObjectID],n=this.applyService.selectedTypeItems.filter(function(n){return n.CaseTypeInfo.PackageCaseTypeId===t.selectedType.CaseTypeInfo.PackageCaseTypeId}),n!==null&&n.length>0&&(this.applyService.model.IsRequiredDescription=n[0].CaseTypeInfo.DescriptionRequired));this.applyService.showWorkClass&&this.applyService.selectedType&&this.applyService.selectedType.SubMenus&&this.applyService.selectedType.SubMenus.length>0&&!this.isApplicationApply&&(this.applyService.selectedWorkClass=this.applyService.selectedType.SubMenus[0]);this.enerGovContactCardsService.validationModule=this.applyService.model;this.selectWorkClass();r=this.getTypeId();u=this.getWorkClassId();this.enerGovAddressCardsService.TenantId=this.globalService.tenantId;this.enerGovAddressCardsService.CaseTypeId=r;this.enerGovAddressCardsService.WorkClassId=u;this.enerGovContactCardsService.caseTypeId=r;this.enerGovContactCardsService.caseTypeWorkClassId=u;this.enerGovAddressCardsService.isGeoRuleAlert=!1;this.enerGovAddressCardsService.showMessage=!1;this.enerGovAddressCardsService.showAlert=!1;this.isFeeEstimate||this.isApplicationApply||(this.enerGovAddressCardsService.addressCards.length!=0&&(this.enerGovAddressCardsService.GeoRuleLocations=[],this.enerGovAddressCardsService.GeoRuleResults=[],this.enerGovAddressCardsService.getGeoRuleResults()),this.enerGovAddressCardsService.locationCards.length!=0&&this.enerGovAddressCardsService.validateLocations());this.permitWithContactValidCertificate=!1;this.enerGovAttachmentCardsService.$attachmentFlow&&this.enerGovAttachmentCardsService.$attachmentFlow.cancel();this.eReviewAttachmentCardsService&&this.eReviewAttachmentCardsService.$flowEreview&&this.eReviewAttachmentCardsService.$flowEreview.cancel();this.eReviewAttachmentCardsService!==null&&this.eReviewAttachmentCardsService.clean();!this.isFeeEstimate&&this.applyService.selectedType.CaseTypeInfo.SignatureRequired&&this.agreementId==""&&this.entitySignatureMetaDataService.getAgreementId(this.applyService.selectedType.CaseTypeInfo.CaseTypeId,this.globalService.tenantId,function(n){t.agreementId=n.AgreementId;t.tylerSignaturePadService.signatureAgreementText=n.SignatureAgreement});this.eReviewsService.isEReviewCaseType?(f=this.$location.path().split("/")[1].toUpperCase(),f!==i[i.Permit].toUpperCase()&&f!==i[i.Plan].toUpperCase()&&(this.enerGovAttachmentCardsService.showDigEplanIFrame=!1)):this.enerGovAttachmentCardsService.showDigEplanIFrame=!1},s.prototype.selectWorkClass=function(){var u=this,i,f,r,n,t;if(this.isApplicationApply){if(this.isFeeEstimate||(i=this.applyService.secondaryData.Types.filter(function(n){return n.ApplicationTypeID==JSON.parse(u.selectedType.PackageData).ApplicationTypeID})[0],f=i.DefaultApplicationStatusID,this.checkContactsTypeRequired(i)),n=this.getSelectedWorkClassSecondaryData(),t=this.getSelectedBusinessSecondaryData(),this.setupAddress(n),!n)return;this.setCustomFieldLayout(n,t)}else{if(r=this.getWorkClassId(),r==null)return;if(n=this.getSelectedWorkClassSecondaryData(),t=this.getSelectedBusinessSecondaryData(),this.enerGovAttachmentCardsService.fileSetInfo=app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2017.5.0.12")&&this.selectedType.CaseTypeInfo.EReviewsEnabled&&n?n.FileSet?n.FileSet:null:null,!n)return;this.isFeeEstimate||(this.checkContactsTypeRequired(n),this.setupAddress(n),this.setupAttachments(n));this.setCustomFieldLayout(n,t)}},s.prototype.validateAttachments=function(n){var r=this,i=this,t=i.$q.defer(),u=app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2024.3.0.0");return u?n.Label=="Attachments"&&i.enerGovAttachmentCardsService.showDigEplanIFrame?this.eReviewsService.getCaseSubmissionStatus(this.eReviewsService.caseRequestInfo,function(n){n.Success==!0&&(r.eReviewsService.caseSubmissionStatusInfo=n.Result);t.resolve()}):t.resolve():t.resolve(),t.promise},s.prototype.processCustomFieldLayout=function(n,t){var r=this,u,f;r.isBusLicApply&&r.customFieldsService.customLayout!=null||(r.customFieldsService.setLayout(n,!0),r.populateCustomFieldsDataForSubrecordApply(n),r.enerGovCustomFieldsService.businessCustomFileds.length>0&&(u=this.$location.path().split("/")[1].toUpperCase(),(u===i[i.BusinessLicense].toUpperCase()||u===i[i.OperationalPermit].toUpperCase())&&r.populateCustomFieldDataForBusiness(n)),r.isRenewalLicense&&(r.setupLicenseRenewalRequiredFields(r.enerGovSubrecordApplyService.subrecordApplyInfo.LicenseRenewalRequiredFields),r.applyService.model.CustomLayout=n,r.applyService.model.CustomFieldLayoutID=t.OnlineCustomFieldLayoutID),r.enerGovSubrecordApplyService.resetSubrecordInfo(),parseInt(r.$routeParams.draftId,10)>0&&r.draftData!==null&&(u=this.$location.path().split("/")[1].toUpperCase(),(u===i[i.BusinessLicense].toUpperCase()||u===i[i.OperationalPermit].toUpperCase())&&n.CustomGroups.filter(function(n){return n.ModuleName!=null}).length>0?(f=u===i[i.BusinessLicense].toUpperCase()?i[i.BusinessLicense]:i[i.OperationalPermit],r.resumeDraftCustomFields(r.draftData.CustomFields,n,i[f]),r.resumeDraftCustomFields(r.draftData.BusinessCustomFields,n,i[i.BusinessEntity])):r.resumeDraftCustomFields(r.draftData.CustomFields,n)),r.applyService.feeEstimatorCustomFields!=null&&(r.resumeDraftCustomFields(r.applyService.feeEstimatorCustomFields,n),r.applyService.feeEstimatorCustomFields=null))},s.prototype.setCustomFieldLayout=function(n,t){var f=this,r,e,u,o;t===void 0&&(t=null);r=this;n&&(n.OnlineCustomFieldLayoutID||n.CustomFieldsLayoutId)?(e=n.OnlineCustomFieldLayoutID?n.OnlineCustomFieldLayoutID:n.CustomFieldsLayoutId,u=n.CustomFieldLayoutID?n.CustomFieldLayoutID:n.CustomFieldsLayoutId,r.enerGovCustomFieldsService.getCustomLayout(e,u,function(e){if(r.isSubRecordApply||r.isRenewalLicense)r.enerGovCustomFieldsService.getCustomLayout(u,u,function(t){angular.forEach(t.CustomGroups,function(i,u){angular.forEach(i.CustomFields,function(f,o){var s=!1;angular.forEach(e.CustomGroups,function(h,c){var l=h.CustomFields.filter(function(n){return n.FieldName===f.FieldName});if(l.length==0){if(e.CustomGroups.length!=c+1||s){t.CustomGroups.length==u+1&&i.CustomFields.length==o+1&&e.CustomGroups.length==c+1&&r.processCustomFieldLayout(e,n);return}f.HideField=!0;e.CustomGroups[0].CustomFields.push(f)}else s=!0;t.CustomGroups.length==u+1&&i.CustomFields.length==o+1&&e.CustomGroups.length==c+1&&r.processCustomFieldLayout(e,n)})})})});else if(t&&(t.OnlineCustomFieldLayoutID||t.CustomFieldLayoutID)){var o=t.OnlineCustomFieldLayoutID?t.OnlineCustomFieldLayoutID:t.CustomFieldLayoutID;r.enerGovCustomFieldsService.getCustomLayout(o,t.CustomFieldLayoutID,function(t){r.customFieldsService.additionalCustomLayout=t;t.CustomGroups=t.CustomGroups.map(function(n){return n.ModuleName=i[i.BusinessEntity],n});e.CustomGroups=e.CustomGroups.map(function(n){return n.ModuleName=r.isOperationalPermitApply?i[i.OperationalPermit]:i[i.BusinessLicense],n});e.CustomGroups=t.CustomGroups.concat(e.CustomGroups);f.processCustomFieldLayout(e,n)})}else f.processCustomFieldLayout(e,n)})):t&&(t.OnlineCustomFieldLayoutID||t.CustomFieldLayoutID)?(o=t.OnlineCustomFieldLayoutID?t.OnlineCustomFieldLayoutID:t.CustomFieldLayoutID,r.enerGovCustomFieldsService.getCustomLayout(o,t.CustomFieldLayoutID,function(t){r.customFieldsService.additionalCustomLayout=t;t.CustomGroups=t.CustomGroups.map(function(n){return n.ModuleName=i[i.BusinessEntity],n});f.processCustomFieldLayout(t,n)})):(r.customFieldsService.setLayout(null),r.isRenewalLicense||r.enerGovSubrecordApplyService.resetSubrecordInfo())},s.prototype.setAvailableContactTypes=function(n){for(var i,t=0;t<n.ContactTypeList.length;t++)i=n.ContactTypeList[t],this.contactType={ContactTypeId:n.ContactTypeList[t].LandManagementContactTypeID,Name:n.ContactTypeList[t].Name,IsRequired:n.ContactTypeList[t].IsRequired,GroupId:n.ContactTypeList[t].ContactTypeGroup,LandManagementContactSystemTypeID:i.LandManagementContactSystemTypeID,isFilled:!1,IsDefaultOnlineContactType:i.IsDefaultOnlineContactType,IsValidateLic:i.IsValidateLic,IsValidateBLLicense:i.IsValidateBLLicense,IsValidateILLicense:i.IsValidateILLicense,RequiredValidLic:i.RequiredValidLic},this.enerGovContactCardsService.availableContactTypes.push(this.contactType)},s.prototype.checkContactsTypeRequired=function(n){(this.enerGovContactCardsService.availableContactTypes=[],n&&(this.setAvailableContactTypes(n),this.setContactCertificateTypes(n)),this.setContactCardsFilled(),this.enerGovContactCardsService.setContactTypePlaceHolder(),this.isBusLicApply&&this.$routeParams.id!=="0")||(!this.$routeParams.draftId||parseInt(this.$routeParams.draftId,10)<=0||this.draftService.isDraftResumed)&&this.enerGovContactCardsService.setDefaultContactType(function(){},!this.isRenewalLicense)},s.prototype.createTemplate=function(n){var t=this,i=t.getDisableLocationsInTemplatesSetting();t.$q.all([i]).then(function(){t.processingSaveTemplate=!1;t.enerGovTemplateService.cleanUpErrorMessage();t.showTemplateSaveModalDialog(n)})},s.prototype.showTemplateSaveModalDialog=function(){this.isModalTemplateNameInit=!0;$("#TemplateSaveModal").modal("show");$("#TemplateSaveModal").on("shown.bs.modal",function(){$("#templateName").focus()});$("#TemplateSaveModal").on("hidden.bs.modal",function(n){$(n.target).removeData("bs.modal")})},s.prototype.saveTemplateModalCancelClick=function(){$("#TemplateSaveModal").modal("hide");$("div:not(.ng-hide) #button-createTemplate").focus();this.modalTemplateName=""},s.prototype.saveTemplateOkClick=function(){var n=this;n.modalTemplateName!==""&&n.modalTemplateName!==undefined&&(n.processingSaveTemplate=!0,n.saveTemplate(!0,n.modalTemplateName))},s.prototype.updateTemplate=function(){var n=this;this.saveTemplate(!1,n.enerGovTemplateService.templateName)},s.prototype.templateNameChanged=function(){var n=this;n.enerGovTemplateService.isError=!1;n.enerGovTemplateService.errorMessage="";n.isModalTemplateNameInit=!1},s.prototype.saveTemplate=function(n,t){var f=this,i=this,u=i.getDraftOrTemplateContent(),e,o;u.Attachments=null;u.EReviews=null;u.ERProjects=i.applyService.model.ERProjects;i.disableLocationsInTemplates&&(u.Addresses=[]);e={DraftId:i.menuActionType==r.UpdateTemplate&&parseInt(i.$routeParams.draftId,10)>0?parseInt(i.$routeParams.draftId,10):0,DraftData:angular.toJson(u),DraftType:i.getDraftTypeName(),DashboardType:i.applyService.selectedType.Label,PackageName:"EnerGov",PartialRoute:i.getPartialRouteForDraftOrTemplate(),LastUpdateOn:moment(new Date).utc().toDate(),IsNew:!(i.menuActionType==r.UpdateTemplate&&parseInt(i.$routeParams.draftId,10)>0),IsDeleted:!1};o={Draft:e,CanApply:!0,IsDeleted:!1,IsNew:e.IsNew,TemplateName:t};i.enerGovTemplateService.saveTemplate(o,function(i){i!=null&&(f.updateTemplateInMemory(t,i),f.showTemplateSaveSuccessDialog(),n&&$("#TemplateSaveModal").modal("hide"));f.processingSaveTemplate=!1;i==null&&f.$timeout(function(){$("#templateName").focus()},300)})},s.prototype.showTemplateSaveSuccessDialog=function(){$("#TemplateSaveSuccessfulDialogModal").modal("show");$("#TemplateSaveSuccessfulDialogModal").on("shown.bs.modal",function(){$("#templateSaveSuccessMessageText").focus()});$("#TemplateSaveSuccessfulDialogModal").on("hidden.bs.modal",function(n){$(n.target).removeData("bs.modal")})},s.prototype.templateSaveSuccessfulOkClick=function(){this.hidePopup("#TemplateSaveSuccessfulDialogModal");this.navigatePageOnSaveTemplateSuccess(this.enerGovTemplateService.templateId)},s.prototype.navigateToMyTemplatePage=function(){this.hidePopup("#TemplateSaveSuccessfulDialogModal");this.$location.url("savedWork?tab=mytemplates")},s.prototype.hidePopup=function(n){$(n).modal("hide");$("body").removeClass("modal-open");$(".modal-backdrop").remove()},s.prototype.saveDraft=function(){var u=this,n=this,t,i;n.enerGovAttachmentCardsService.showProgressBarDialog(!0);t=n.getDraftOrTemplateContent();t.Attachments=null;t.EReviews=null;n.enerGovAttachmentCardsService.isERProjectSaveSupported()||(n.enerGovAttachmentCardsService.ereviewFlowOptions.headers.UploadFolder="");t.ERProjects=n.applyService.model.ERProjects;i={DraftId:n.menuActionType==r.Apply&&parseInt(n.$routeParams.draftId,10)>0?parseInt(n.$routeParams.draftId,10):0,DraftData:angular.toJson(t),DraftType:n.getDraftTypeName(),DashboardType:n.applyService.selectedType.Label,PackageName:"EnerGov",PartialRoute:n.getPartialRouteForDraftOrTemplate(),LastUpdateOn:moment(new Date).utc().toDate(),IsNew:!(n.menuActionType==r.Apply&&parseInt(n.$routeParams.draftId,10)>0),IsDeleted:!1};n.draftService.saveDraft(i,function(n){u.navigatePageOnSaveDraftSuccess(n)})},s.prototype.getDraftTypeName=function(){return this.draftType===app.Constants.DraftType.Application?i[this.applyService.selectedType.CategoryObjectID]:this.draftType},s.prototype.getPartialRouteForDraftOrTemplate=function(){var t=this,i,n;return this.$location.url().indexOf("?")>=0?(i=t.$location.url().split("?")[0],n=i.substring(0,i.lastIndexOf("/")),n.substring(1,n.lastIndexOf("/")+1)+"?"+t.$location.url().split("?")[1]):(n=t.$location.path().substring(0,t.$location.path().lastIndexOf("/")),n.substring(1,n.lastIndexOf("/")+1))},s.prototype.navigatePageReplaceActionTypeId=function(n){var t=this,u;if(this.$location.url().indexOf("?")>=0){var i=t.$location.url().split("?")[0],f=t.$location.url().split("?")[1],r=i.substring(0,i.lastIndexOf("/")),e=r.substring(1,r.lastIndexOf("/")+1)+n+"?"+f;t.$location.path(e).replace()}else u=t.$location.path().substring(1,t.$location.path().lastIndexOf("/")+1)+n,t.$location.path(u).replace()},s.prototype.navigatePageOnSaveDraftSuccess=function(n){var t=this,i,f;if(this.$location.url().indexOf("?")>=0){var u=t.$location.url().split("?")[0],e=t.$location.url().split("?")[1],i=u.substring(0,u.lastIndexOf("/"));t.$location.url(i.substring(1,i.lastIndexOf("/")+1)+n+"/"+r.Apply.toString()+"?"+e)}else i=t.$location.path().substring(0,t.$location.path().lastIndexOf("/")),f=i.substring(1,i.lastIndexOf("/")+1)+n+"/"+r.Apply.toString(),t.$location.url(f)},s.prototype.navigatePageOnSaveTemplateSuccess=function(n){var t=this,i,f;if(this.$location.url().indexOf("?")>=0){var u=t.$location.url().split("?")[0],e=t.$location.url().split("?")[1],i=u.substring(0,u.lastIndexOf("/"));t.$location.url(i.substring(1,i.lastIndexOf("/")+1)+n+"/"+r.UpdateTemplate.toString()+"?"+e)}else i=t.$location.path().substring(0,t.$location.path().lastIndexOf("/")),f=i.substring(1,i.lastIndexOf("/")+1)+n+"/"+r.UpdateTemplate.toString(),t.$location.url(f)},s.prototype.getDraftOrTemplateContent=function(){var n=this,t={TypeId:n.getTypeId(),WorkClassId:n.getWorkClassId(),TypeMenuId:n.applyService.selectedType.MenuID,WorkClassMenuId:null,Description:"",ValuationValue:null,SquareFeet:null,Addresses:n.enerGovAddressCardsService.addressCards,Contacts:n.enerGovContactCardsService.contactCards,CustomFieldLayoutId:"",CustomFields:[],Attachments:[],EReviews:[],ERProjects:[],ObjectID:n.applyService.model.ObjectID,ActionRowVersion:n.applyService.model.ActionRowVersion,ObjectStatusID:n.applyService.model.ObjectStatusID,IsWorkflowActionPersistent:n.applyService.model.IsWorkflowActionPersistent,IsWorkflowActionOptional:n.applyService.model.IsWorkflowActionOptional,WorkflowTemplateId:n.applyService.model.WorkflowTemplateId,WorkflowTemplateActionId:n.applyService.model.WorkflowTemplateActionId,WfActionData:n.applyService.model.WfActionData,ParentEntityId:n.applyService.model.ParentEntityId,IsSubPermitFromPermit:n.applyService.model.IsSubPermitFromPermit,IsSubPermitFromPlan:n.applyService.model.IsSubPermitFromPlan,IsSubPlanFromPermit:n.applyService.model.IsSubPlanFromPermit,IsSubPlanFromPlan:n.applyService.model.IsSubPlanFromPlan,CompanyType:n.applyService.model.CompanyType,CompanyName:n.applyService.model.CompanyName,BusinessDescription:n.applyService.model.BusinessDescription,DBAName:n.applyService.model.DBAName,Location:n.applyService.model.Location,BusinessTypes:n.applyService.model.BusinessTypes,BusinessCustomFieldsLayoutID:n.applyService.model.BusinessCustomFieldsLayoutID,BusinessCustomFields:[],GlobalEntityExtensionId:"",TIN:"",TaxID:"",Projects:n.applyService.model.Projects,EstimatedReceipts:null},i;return n.applyService.showWorkClass&&(t.WorkClassMenuId=n.applyService.selectedWorkClass.MenuID),i=n.updateDraftPartialFromModel(t),i!==null&&(t=i),t.Addresses=n.enerGovAddressCardsService.addressCards,t.Contacts=n.enerGovContactCardsService.contactCards,n.customFieldsService.customLayout!==null&&(t.CustomFieldLayoutId=n.customFieldsService.customLayout.PackageId,angular.forEach(n.customFieldsService.customLayout.CustomGroups,function(i){angular.forEach(i.CustomFields,function(i){i.Value!==null&&t.CustomFields.push(n.getCustomFieldEntry(i))})})),n.customFieldsService.additionalCustomLayout!==undefined&&n.customFieldsService.additionalCustomLayout!==null&&(t.BusinessCustomFieldsLayoutID=n.customFieldsService.additionalCustomLayout.PackageId,angular.forEach(n.customFieldsService.additionalCustomLayout.CustomGroups,function(i){angular.forEach(i.CustomFields,function(i){i.Value!==null&&t.BusinessCustomFields.push(n.getCustomFieldEntry(i))})})),t},s.prototype.getCustomFieldEntry=function(n){return{CustomGroupId:n.CustomGroupId,CustomFieldId:n.CustomFieldId,Value:n.Value,CustomFieldTableRows:n.CustomFieldTableRows,Id:n.Id,SortOrder:n.SortOrder,FieldName:n.FieldName,CustomPickListItems:n.CustomPickListItems,PickListItems:n.PickListItems,IsPickList:n.IsPickList,FieldTypeId:n.FieldTypeId,PackageId:n.PackageId,CustomFieldTableColumnRefItems:n.CustomFieldTableColumnRefItems,CustomFieldTableCellType:n.CustomFieldTableCellType,IsTable:n.IsTable,IsFooter:n.IsFooter,Label:n.Label,IsRequired:n.IsRequired,IsReadOnly:n.IsReadOnly,IsSupportedType:n.IsSupportedType,DefaultValue:n.DefaultValue,typeData:n.typeData,DefaultTableRows:n.DefaultTableRows}},s.prototype.resumeDraft=function(){var u=this,n=this,t,r,i;n.draftId>0&&(t=app.Core.Controllers.CoreController.findItemInArray(n.applyService.selectedTypeItems,"MenuID",n.draftData.TypeMenuId),n.applyService.selectedType=t,n.applyService.showWorkClass&&(r=app.Core.Controllers.CoreController.findItemInArray(t.SubMenus,"MenuID",n.draftData.WorkClassMenuId),n.applyService.selectedWorkClass=r),n.selectType(),n.updateBusinessLocationFromDraft(n.draftData),n.draftService.isDraftResumed=!0,n.enerGovAddressCardsService.addressCards=n.draftData.Addresses,n.enerGovAddressCardsService.addressCards.forEach(function(t){if(t.IsParcel)t.IsParcel&&!n.enerGovAddressCardsService.addressCards.some(function(n){return!n.IsParcel&&n.ParcelNumber==t.ParcelNumber})&&n.enerGovAddressCardsService.prepareLocationCards(t,n.enerGovAddressCardsService.addressCards);else{n.enerGovAddressCardsService.prepareLocationCards(t,n.enerGovAddressCardsService.addressCards);var i=n.enerGovAddressCardsService.addressCards.filter(function(n){return n.IsParcel&&n.ParcelNumber==t.ParcelNumber});i.length>0&&n.enerGovAddressCardsService.prepareLocationCards(i[0],n.enerGovAddressCardsService.addressCards)}}),this.isFeeEstimate||(this.setupAddressRequired(),this.enerGovAddressCardsService.addressCards.length>0&&(this.enerGovAddressCardsService.GeoRuleLocations=[],this.enerGovAddressCardsService.GeoRuleResults=[],this.enerGovAddressCardsService.getHoldsForParcel(null).then(function(){u.enerGovAddressCardsService.getGeoRuleResults()})),this.enerGovAddressCardsService.locationCards.length!=0&&this.enerGovAddressCardsService.validateLocations()),n.applyService.model.ERProjects=n.draftData.ERProjects,n.applyService.model.ERProjects&&n.applyService.model.ERProjects.length>0?(n.applyService.model.ERProjects.forEach(function(t){t.ERProjectID&&(t.ERProjectID=n.enerGovAttachmentCardsService.create_UUID())}),n.enerGovAttachmentCardsService.ereviewFlowOptions.headers.UploadFolder=n.applyService.model.ERProjects[0].ERProjectID):n.draftType==="Permit"?n.applyService.getNewPermit(n.draftData.TypeId,n.draftData.WorkClassId,function(t){n.fillUpErProjectOnResumeDraft(t.ERProjects)}):n.draftType==="Plan"&&n.applyService.getNewPlan(n.draftData.TypeId,n.draftData.WorkClassId,function(t){n.fillUpErProjectOnResumeDraft(t.ERProjects)}),angular.forEach(n.enerGovAttachmentCardsService.fileAttachments,function(t){var i=!0;angular.forEach(n.enerGovAttachmentCardsService.requiredFileCards,function(n){i&&t.fileType===n.Name&&!n.isFilled&&(n.isFilled=!0,i=!1)})}),n.enerGovContactCardsService.setDefaultContactType(function(){},!1),n.enerGovContactCardsService.returnToUrl=n.$location.path().toUpperCase(),i=[],n.draftData.Contacts.forEach(function(t){var r=n.enerGovContactCardsService.availableContactTypes.filter(function(n){return n.ContactTypeId==t.ContactTypeId})[0],u=n.enerGovContactCardsService.addContact(t,!0,r);i.push(u)}),n.$q.all(i).then(function(){angular.forEach(n.enerGovContactCardsService.availableContactTypes,function(t){t.IsRequired&&!t.isFilled&&angular.forEach(n.enerGovContactCardsService.contactCards,function(n){n.ContactTypeId===t.ContactTypeId&&(t.isFilled=!0)});t.isFilled&&n.enerGovContactCardsService.contactGroupExists(t.GroupId)})}))},s.prototype.fillUpErProjectOnResumeDraft=function(n){var t=this;t.applyService.model.ERProjects=n;n&&n.length&&(t.enerGovAttachmentCardsService.ereviewFlowOptions.headers.UploadFolder=n[0].ERProjectID)},s.prototype.resumeDraftCustomFields=function(n,t,i){i===void 0&&(i="");angular.forEach(n,function(n){n.Value!==null&&$.each(t.CustomGroups,function(t,r){if(i!==""&&r.ModuleName!==i)return!0;$.each(r.CustomFields,function(t,i){if(i.CustomFieldId===n.CustomFieldId&&i.FieldTypeId===n.FieldTypeId&&i.Label===n.Label)return i.Value=n.Value,i.CustomFieldTableRows=n.CustomFieldTableRows,i.CustomPickListItems=n.CustomPickListItems,i.IsTable&&(i.tableData.rows=i.CustomFieldTableRows),i.typeData.elementType==="select"&&i.CustomPickListItems.filter(function(t){return t.PackageId==n.Value})[0]&&(i.ShowValueComboBox=i.CustomPickListItems.filter(function(t){return t.PackageId==n.Value})[0].Value),!1})})})},s.prototype.isResumeDraft=function(){var n=this;return parseInt(n.$routeParams.draftId,10)>0&&!n.enerGovAddressCardsService.returnFromAddAddress&&!n.enerGovContactCardsService.returnFromAddContact&&!n.isReturnFromAddBusinessType()},s.prototype.checktoResumeDraft=function(){this.isResumeDraft()&&this.resumeDraft();this.enerGovContactCardsService.returnFromAddContact&&sessionStorage.setItem("tyler.css.setFocusId","contactCardsId");this.enerGovAddressCardsService.returnFromAddAddress&&sessionStorage.setItem("tyler.css.setFocusId","addressCardsId");this.enerGovContactCardsService.returnFromAddContact=!1;this.enerGovAddressCardsService.returnFromAddAddress=!1;this.enerGovBusinessTypeCardsService&&(this.enerGovBusinessTypeCardsService.returnFromAddBusinessType=!1)},s.prototype.cleanUp=function(){this.applyService.setDefaultStates();this.enerGovAttachmentCardsService.clean();this.eReviewAttachmentCardsService&&this.eReviewAttachmentCardsService.clean();this.eReviewsService&&this.eReviewsService.cleanUp();this.enerGovContactCardsService.cleanUp();this.enerGovAddressCardsService.cleanUp();this.tylerSignaturePadService.cleanUp();this.draftService.isDraftResumed=!1;this.enerGovTemplateService.cleanUp();this.customFieldsService.setLayout(null);this.enerGovBusinessTypeCardsService&&(this.enerGovBusinessTypeCardsService.businessTypeCards=[])},s.prototype.populateDataWithoutCustomFieldsForSubrecordApply=function(){var n=this,t;n.enerGovSubrecordApplyService.subrecordApplyInfo!==null&&(n.isSubRecordApply=!0,n.applyService.model.Description=n.enerGovSubrecordApplyService.subrecordApplyInfo.Description,n.applyService.model.SquareFeet=n.enerGovSubrecordApplyService.subrecordApplyInfo.SquareFeet,n.applyService.model.ValuationValue=n.enerGovSubrecordApplyService.subrecordApplyInfo.Value,n.applyService.model.Holds=n.enerGovSubrecordApplyService.subrecordApplyInfo.Holds?n.enerGovSubrecordApplyService.subrecordApplyInfo.Holds:[],angular.forEach(n.enerGovSubrecordApplyService.subrecordApplyInfo.Addresses,function(t){t.IsParcel=!1;n.enerGovAddressCardsService.addAddress(t,!0)}),n.enerGovSubrecordApplyService.contactCardInfoResult!=null&&n.enerGovSubrecordApplyService.contactCardInfoResult.ContactResults!==null&&(n.enerGovContactCardsService.returnToUrl=this.$location.path().toUpperCase(),angular.forEach(n.enerGovSubrecordApplyService.contactCardInfoResult.ContactResults,function(t){n.enerGovContactCardsService.addContact(t,!0)})),angular.forEach(n.enerGovSubrecordApplyService.subrecordApplyInfo.Parcels,function(t){var i=n.enerGovAddressCardsService.createBlankAddress();i.ParcelNumber=t.ParcelNumber;i.Range=t.Range;i.Section=t.Section;i.Township=t.Township;i.IsParcel=!0;n.enerGovAddressCardsService.addAddress(i)}),n.applyService.model.ObjectID=n.enerGovSubrecordApplyService.subrecordApplyInfo.WorkflowActionId,n.applyService.model.ObjectStatusID=n.enerGovSubrecordApplyService.subrecordApplyInfo.WorkflowStatusId,n.applyService.model.ActionRowVersion=n.enerGovSubrecordApplyService.subrecordApplyInfo.VersionNumber,n.applyService.model.IsSubPermitFromPermit=n.enerGovSubrecordApplyService.subrecordApplyInfo.IsSubPermitFromPermit,n.applyService.model.IsSubPermitFromPlan=n.enerGovSubrecordApplyService.subrecordApplyInfo.IsSubPermitFromPlan,n.applyService.model.IsSubPlanFromPermit=n.enerGovSubrecordApplyService.subrecordApplyInfo.IsSubPlanFromPermit,n.applyService.model.IsSubPlanFromPlan=n.enerGovSubrecordApplyService.subrecordApplyInfo.IsSubPlanFromPlan,n.applyService.model.IsWorkflowActionPersistent=n.enerGovSubrecordApplyService.subrecordApplyInfo.IsWorkflowActionPersistent,n.applyService.model.IsWorkflowActionOptional=n.enerGovSubrecordApplyService.subrecordApplyInfo.IsWorkflowActionOptional,n.applyService.model.WorkflowTemplateId=n.enerGovSubrecordApplyService.subrecordApplyInfo.WorkflowTemplateId,n.applyService.model.WorkflowTemplateActionId=n.enerGovSubrecordApplyService.subrecordApplyInfo.WorkflowTemplateActionId,n.applyService.model.WfActionData=n.enerGovSubrecordApplyService.subrecordApplyInfo.WfActionData,n.applyService.model.ParentEntityId=n.enerGovSubrecordApplyService.subrecordApplyInfo.ParentEntityId,n.enerGovSubrecordApplyService.subrecordApplyInfo.Project!=null&&(n.enerGovSubrecordApplyService.subrecordApplyInfo.Project.IsNew=!0,t=[n.enerGovSubrecordApplyService.subrecordApplyInfo.Project],n.applyService.model.Projects=t),n.enerGovAddressCardsService.getHoldsForParcel(null).then(function(){n.enerGovAddressCardsService.getGeoRuleResults()}))},s.prototype.setContactCardsFilled=function(){var n=this;this.enerGovContactCardsService.contactCards.forEach(function(t){n.enerGovContactCardsService.setContactTypeFilled(t)})},s.prototype.populateRenewalDataWithoutCustomFields=function(){var n=this;n.enerGovSubrecordApplyService.subrecordApplyInfo!==null&&(n.isRenewalLicense=!0,n.applyService.model.Description=n.enerGovSubrecordApplyService.subrecordApplyInfo.Description,angular.forEach(n.enerGovSubrecordApplyService.subrecordApplyInfo.Addresses,function(t){t.IsParcel=!1;n.enerGovAddressCardsService.addAddress(t,!0)}),n.enerGovSubrecordApplyService.contactCardInfoResult!=null&&n.enerGovSubrecordApplyService.contactCardInfoResult.ContactResults!==null&&(n.enerGovContactCardsService.returnToUrl=this.$location.path().toUpperCase(),angular.forEach(n.enerGovSubrecordApplyService.contactCardInfoResult.ContactResults,function(t){n.enerGovContactCardsService.addContact(t,!0)}),this.setContactCardsFilled()),angular.forEach(n.enerGovSubrecordApplyService.subrecordApplyInfo.Parcels,function(t){var i=n.enerGovAddressCardsService.createBlankAddress();i.ParcelNumber=t.ParcelNumber;i.Range=t.Range;i.Section=t.Section;i.Township=t.Township;i.IsParcel=!0;n.enerGovAddressCardsService.addAddress(i)}),n.setupAddressRequired())},s.prototype.setupLicenseRenewalRequiredFields=function(n){this.customFieldsService.setupLicenseRenewalRequiredFields(n);this.setStepperSteps()},s.prototype.populateCustomFieldsDataForSubrecordApply=function(n){var t=this;t.enerGovSubrecordApplyService.subrecordApplyInfo!==null&&angular.forEach(n.CustomGroups,function(n){angular.forEach(n.CustomFields,function(n){if($.each(t.enerGovSubrecordApplyService.subrecordApplyInfo.CustomFields,function(i,r){if(r.FieldName==n.FieldName){if(n.Value=r.Value,n.typeData.elementType==="many"&&(n.CustomPickListItems=t.updateCustomFieldPickList(n.CustomPickListItems,r.PickListItems)),n.typeData.elementType==="select"){n.ShowValueComboBox=n.Value;var u=n.CustomPickListItems.filter(function(t){return t.Value===n.Value})[0];u&&(n.Value=u.PackageId)}return n.IsTable&&(n.CustomFieldTableRows=r.CustomFieldTableRows,t.customFieldsService.formatDateForExistingRows(n),n.tableData.rows=n.CustomFieldTableRows),!1}}),n.IsTable){var i=t.processParentTableCustomFields(n);i&&(i.CustomFieldTableRows.forEach(function(n,t){n.IsValidRow=!0;n.RowID=t+1}),n.CustomFieldTableRows=i.CustomFieldTableRows,t.customFieldsService.formatDateForExistingRows(n),n.tableData.rows=n.CustomFieldTableRows)}})})},s.prototype.updateCustomFieldPickList=function(n,t){return angular.forEach(t,function(t){var i=n.filter(function(n){return n.Value===t.Value})[0];i!==undefined&&i!==null&&(i.IsSelected=t.IsMultiSelected)}),n},s.prototype.getMenuItem=function(){var n=this;if(n.isRenewalLicense){var t=this.$location.path().split("/")[1].toUpperCase(),r=n.$routeParams.typeId,u=n.$routeParams.classId,s=n.menuService.getApplyMenu().SubMenus.filter(function(n){return n.Details==="LICENSES"})[0],o=s.SubMenus.filter(function(n){return n.CaseTypeInfo.PackageCaseClassId===u&&n.CaseTypeInfo.PackageCaseTypeId===r}),h=t===i[i.BusinessLicense].toUpperCase()?4:t===i[i.OperationalPermit].toUpperCase()?6:t===i[i.ProfLicense].toUpperCase()?3:0,c=t===i[i.BusinessLicense].toUpperCase()?"Business License":t===i[i.OperationalPermit].toUpperCase()?"Operational Permit":t===i[i.ProfLicense].toUpperCase()?"Professional License":"";return{Label:"",SubMenus:null,MenuID:-1,Details:"",IsMenu:!1,Route:"",Element:"",PackageData:'{"LicenseTypeID": "'+r+'", "LicenseWorkClassID": "'+u+'"}',IsCustom:!1,DisplaySequence:0,ParentMenuID:0,CategoryID:h,CategoryName:c,Description:"",CaseTypeInfo:{CaseTypeId:0,PackageCaseTypeId:r,PackageCaseClassId:u,CaseTypeUse:0,EReviewsEnabled:!1,ShowTinId:!1,ShowTaxId:!1,ShowSuccessPage:!1,SuccessMessage:"",DescriptionRequired:!1,SquareFootageRequired:!1,ValuationRequired:!1,SignatureRequired:!1,SignatureAgreement:"",AllowOnlyOneLocation:!1,AllowSpatialCollectionAsLocation:!1,HideFeesCard:!1,CaseTypeIconUrl:"",AutoIncludeParentContactDuringApplication:e.UseDefault,AutomaticallyInclude:f.UseDefault,AllowRemovingOf:f.UseDefault,CaseTypeTags:[],HideLocationStep:!1,UseApplicationInstructions:o.length>0?o[0].CaseTypeInfo.UseApplicationInstructions:!0},levelNo:"",Link:"",Target:0,Count:0,IsHidden:!1}}return n.enerGovSubrecordApplyService.subrecordApplyInfo===null&&n.applyService.model.ObjectID===""?n.menuService.getMenuById(parseInt(n.$routeParams.menuId,10)):n.menuService.getMenuById(parseInt(n.$routeParams.menuId,10),!0)},s.prototype.showNextButton=function(n){if(n.ShowNextButton&&n.Label!==undefined)return!0},s.prototype.isApplyInTemplateMode=function(){return this.menuActionType==r.CreateTemplate||this.menuActionType==r.UpdateTemplate},s.prototype.showCreateTemplateButton=function(){var n=this;return!n.isRenewalLicense&&!n.isSubRecordApply&&!n.isFeeEstimate&&(n.applyService.model.ObjectID==undefined||n.applyService.model.ObjectID=="")&&n.menuActionType==n.menuActionTypeValues.Apply&&!n.isCompanyTypeOnly},s.prototype.uploadAttachments=function(n){var t=this;t.enerGovAttachmentCardsService.showProgressBarDialog();t.enerGovAttachmentCardsService.uploadFileAttachments(function(i){t.applyService.model.Attachments=i;t.eReviewsService&&t.eReviewsService.ereviewsSecondaryData&&t.eReviewsService.isEnerGovEReviewEnable&&t.eReviewsService.isEReviewCaseType&&t.enerGovAttachmentCardsService.ereviewAttachments.length>0?(t.useFileCategoryForResubmission&&(t.enerGovAttachmentCardsService.ereviewFlowOptions.headers.UploadFolder=t.applyService.model.ERFileSubmissionQueueID),t.enerGovAttachmentCardsService.uploadEReviewAttachments(function(i){t.enerGovAttachmentCardsService.uploadedEReviewAttachments=i;n()})):n()})},s.prototype.goToNextStep=function(n,t){var r=this,i=this;if(i.isApplyInTemplateMode()){i.stepperService.nextStep();return}if(!n.$valid){t.Label==="More Info"&&angular.forEach(n.$error,function(n){angular.forEach(n,function(n){angular.forEach(n.$error,function(n){angular.forEach(n,function(n){n.$setTouched()})})})});return}i.validateContactsPromise=i.validateContacts(t);i.validateAttachmentsPromise=i.validateAttachments(t);i.$q.all([i.validateContactsPromise,i.validateAttachmentsPromise]).then(function(){if(i.isFeeEstimate&&(r.isTypePreviouslySelected=!0),t.Label!="Contacts"||!i.isPermitApply||i.isPermitContactsValidationSuccess)if(t.Label=="Attachments"&&i.enerGovAttachmentCardsService.isERProjectSaveSupported())if(i.enerGovAttachmentCardsService.showDigEplanIFrame)if(i.eReviewsService.caseSubmissionStatusInfo)if(i.enerGovAttachmentCardsService.currentCaseSubmissionFileList=i.eReviewsService.caseSubmissionStatusInfo.Files,i.eReviewsService.caseSubmissionStatusInfo.ReadyToSubmit)i.stepperService.nextStep();else{i.attachmentCommonCardService.openCaseSubmissionStatusPopup("File(s) Not Ready To Submit",i.eReviewsService.caseSubmissionStatusInfo.Files);return}else{alert("File(s) status could not be determined.");return}else i.uploadAttachments(function(){i.stepperService.nextStep()});else{if(i.isRenewalLicense&&i.stepperService.stepper.Steps.length==3&&t.Label==="Type"&&i.allowFeeEstimator)i.calculateEstimateFees();else if(t.Label==="More Info"&&i.allowFeeEstimator)i.calculateEstimateFees();else if(!i.isFeeEstimate&&i.applyService.selectedType.CaseTypeInfo.SignatureRequired&&t.Label==="Signature"&&(!i.tylerSignaturePadService.isSignatureAddded||!i.tylerSignaturePadService.imageData.consentName))return;i.stepperService.nextStep()}})},s.prototype.disableNextButton=function(n){if(this.isApplyInTemplateMode())return!1;switch(n.Label){case"Locations":return this.enerGovAddressCardsService.processingGeoRule||this.enerGovAddressCardsService.isOneLocationRuleFail||this.enerGovAddressCardsService.isSpatialCollectionValidationFail||this.enerGovAddressCardsService.processingParcelHolds||this.enerGovAddressCardsService.parcelHoldInfos.filter(function(n){return n.IsBlock}).length>0;case"Contacts":return this.enerGovContactCardsService.isInvalidDefaultContact||this.enerGovContactCardsService.isContactValidationIsProgress||this.enerGovContactCardsService.validationFailureContactName!==""||this.enerGovContactCardsService.permitContactCertificationErrorMessage!=""||this.enerGovContactCardsService.contactHoldInfos.filter(function(n){return n.IsBlock}).length>0;case"More Info":return this.customFieldsService.isInvalidRowPresent()||this.customFieldsService.hasInvalidTable()?!0:!1;case"Type":return this.enerGovAddressCardsService.processingGeoRule||this.enerGovAddressCardsService.isGeoRuleBlock||this.requiredAddressNotPresent?!0:!1;case"Signature":return this.tylerSignaturePadService.isSignatureAddded&&this.tylerSignaturePadService.imageData.consentName?!1:!0;case"Attachments":return!1;default:return!1}},s.prototype.updateTemplateInMemory=function(n,t){var i=this;i.enerGovTemplateService.templateName=n;i.enerGovTemplateService.templateId=t},s.prototype.getTemplateDataById=function(n){var t=this,i=t.$q.defer();return t.enerGovTemplateService.getTemplateById(n,function(r){r?(t.draftData=angular.fromJson(r.Draft.DraftData),t.updateModelPartialFromFraft(t.draftData),t.updateTemplateInMemory(r.TemplateName,n)):t.$location.path("/dashboard");i.resolve()}),i.promise},s.prototype.getDraftDataById=function(n){var t=this,i=t.$q.defer();return t.draftService.getDraftById(n,function(n){n?(t.draftData=angular.fromJson(n.DraftData),t.updateModelPartialFromFraft(t.draftData)):t.$location.path("/dashboard");i.resolve()}),i.promise},s.prototype.applyCaseType=function(){var n=this,t,i;n.setupAddress=function(t){n.enerGovAddressCardsService.addressRequired=t.IsCAPAddressRequired||!1;n.setupAddressRequired();n.enerGovAddressCardsService.locationAddressType==null&&n.enerGovAddressCardsService.getSecondaryDataAndSetAddressType()};n.setupAttachments=function(t){n.enerGovAttachmentCardsService.attachmentsFileTypes=t.RequireFileTypeList;n.enerGovAttachmentCardsService.setRequiredFiles()};n.enerGovContactCardsService.returnFromAddContact||n.enerGovAddressCardsService.returnFromAddAddress||n.isReturnFromAddBusinessType()||(n.cleanUp(),n.stepperService.setNewItemStepper());n.isResumeDraft()?n.menuActionType==r.Apply?(t=n.getDraftDataById(n.draftId),this.$q.all([t]).then(function(){n.getMenuAndSecondaryData()})):(n.menuActionType==r.UpdateTemplate||n.menuActionType==r.UseTemplate)&&(i=n.getTemplateDataById(n.draftId),this.$q.all([i]).then(function(){n.getMenuAndSecondaryData()})):n.getMenuAndSecondaryData()},s.prototype.isReturnFromAddBusinessType=function(){var n=this,t=n.$location.path().split("/")[1].toUpperCase();return(t===i[i.BusinessLicense].toUpperCase()||t===i[i.OperationalPermit].toUpperCase())&&n.enerGovBusinessTypeCardsService!==null&&n.enerGovBusinessTypeCardsService.returnFromAddBusinessType},s.prototype.getMenuAndSecondaryData=function(){var n=this,t=n.getMenuItem(),r;(t===undefined||t===null)&&n.$location.path("/dashboard");n.isReturnFromAddBusinessType()||(n.applyService.selectedType=t);(n.enerGovSubrecordApplyService.subrecordApplyInfo||n.applyService.model.ObjectID&&n.applyService.model.ObjectID!=="")&&!n.isRenewalLicense&&(n.isSubRecordApply=!0);t==null||n.isRenewalLicense||(r=n.enerGovSubrecordApplyService.subrecordApplyInfo===null&&n.applyService.model.ObjectID===""?n.menuService.getMenuItemsByParentId(t.ParentMenuID):n.menuService.getMenuItemsByParentId(t.ParentMenuID,!0),n.applyService.selectedTypeItems=r.filter(function(n){return n.CaseTypeInfo!==undefined&&n.CaseTypeInfo!==null&&n.CaseTypeInfo.CaseTypeUse!==u.EstimationOnly}),this.categoryObjectName=i[t.CategoryObjectID]);n.enerGovContactCardsService.returnFromAddContact||n.enerGovAddressCardsService.returnFromAddAddress||this.settingsService.getUseCustomMappingsSoftwarePackageSetting(function(t){n.showWorkClassDefault=t&&t.SettingValue==="false";n.applyService.showWorkClass=n.showWorkClassDefault;n.applyService.showWorkClass=n.applyService.selectedType&&n.applyService.selectedType.CaseTypeInfo?n.applyService.selectedType.CaseTypeInfo.PackageCaseClassId==null:n.showWorkClassDefault;n.isRenewalLicense||n.populateDataWithoutCustomFieldsForSubrecordApply()});n.applyService.secondaryData===null?(n.getSecondaryDataPromise=n.getSecondaryData(),n.$q.all([n.getSecondaryDataPromise]).then(function(){})):n.checktoResumeDraft();n.getStepInstructions()},s.prototype.getSecondaryData=function(){var n=this,t=n.$q.defer();return n.secondaryDataService.getSecondaryData(n.applyService.selectedType.CaseTypeInfo.PackageCaseTypeId,function(i){n.applyService.secondaryData=i;n.handleInactiveMenuItems();n.applyService.selectedType&&n.menusToRemove.indexOf(n.applyService.selectedType.MenuID)>=0&&(n.applyService.selectedType=null);parseInt(n.$routeParams.draftId,10)===0&&n.selectType();n.isRenewalLicense&&n.initializeData();n.checktoResumeDraft();n.setStepperSteps();t.resolve()}),t.promise},s.prototype.checkForFeeEstimate=function(){var n=this.$location.path();(n=="/estimate/permit"||n=="/estimate/plan")&&(this.isFeeEstimate=!0,this.applyService.model.ValuationValue=null,this.applyService.model.SquareFeet=null,this.caseType=n=="/estimate/permit"?app.Common.SelfServiceModules[app.Common.SelfServiceModules.Permit].toLowerCase():app.Common.SelfServiceModules[app.Common.SelfServiceModules.Plan].toLowerCase())},s.prototype.checkForRenewal=function(){this.$location.path().indexOf("renew")!==-1&&(this.isRenewalLicense=!0,this.hideSaveDraft=!0)},s.prototype.getTypeId=function(n){n===void 0&&(n=null);var t=this;return(!n&&t.applyService&&(n=t.applyService.selectedType),!n)?null:n.CaseTypeInfo&&n.CaseTypeInfo.PackageCaseTypeId?n.CaseTypeInfo.PackageCaseTypeId:n.PackageData!=null&&n.PackageData!==""?t.getTypeIdFromPackageData(n.PackageData):null},s.prototype.getWorkClassId=function(n){n===void 0&&(n=null);var t=this;return(!n&&t.applyService&&(n=t.applyService.showWorkClass?t.applyService.selectedWorkClass:t.applyService.selectedType),!n)?null:n.PackageData!=null&&n.PackageData!==""?t.getWorkClassIdFromPackageData(n.PackageData):n.CaseTypeInfo&&n.CaseTypeInfo.PackageCaseClassId?n.CaseTypeInfo.PackageCaseClassId:null},s.prototype.setAttachmentPageStatusForApplyType=function(){var n=this;n.enerGovAttachmentCardsService.hideAttachmentForTemplate=n.isCreateOrUpdateTemplate()?!0:!1},s.prototype.isCreateOrUpdateTemplate=function(){var n=this;return n.menuActionType==r.CreateTemplate||n.menuActionType==r.UpdateTemplate},s.prototype.isFreshApplyOrUseTemplate=function(){var n=this;return n.menuActionType==r.Apply||n.menuActionType==r.UseTemplate},s.prototype.setMenuActionType=function(){var n=this;n.menuActionType=parseInt(n.$routeParams.actionTypeId,10);n.menuActionType||(n.menuActionType=r.Apply);(n.enerGovAddressCardsService.returnFromAddAddress||n.enerGovContactCardsService.returnFromAddContact||n.isReturnFromAddBusinessType())&&n.enerGovTemplateService.menuActionTypeInternal!=n.menuActionType&&n.menuActionType==r.Apply&&(n.menuActionType=n.enerGovTemplateService.menuActionTypeInternal);n.enerGovTemplateService.menuActionTypeInternal=n.menuActionType},s.prototype.getDisableLocationsInTemplatesSetting=function(){var n=this,t=n.$q.defer();return n.settingsService.getSoftwareSetting("energov","DisableLocationsInTemplates",function(i){n.disableLocationsInTemplates=i&&i.SettingValue==="true"?!0:!1;t.resolve()}),t.promise},s.prototype.setOperationalPermitFlag=function(n){this.isOperationalPermitApply=n;this.secondaryDataService.isOperationalPermit=n},s.prototype.initiateApplyController=function(){var t=this,n=this;n.checkForFeeEstimate();n.flowOptions.headers={UploadProvider:"attachment",tenantId:this.globalService.tenantId,"Tyler-TenantUrl":this.globalService.tenantUrl,"Tyler-Tenant-Culture":this.globalService.culture};n.filterMenuItem=function(t){return t&&n.menusToRemove.indexOf(t.MenuID)<0};n.filterSubMenuItem=function(t){return t&&n.subMenusToRemove.indexOf(t.MenuID)<0};this.isFeeEstimate?n.estimateFee():(this.checkForRenewal(),n.applyCaseType(),this.userService.getUser(function(n){t.globalEntityId=n.OtherData}),this.applyService.selectedType!=null&&this.applyService.selectedType.CaseTypeInfo.SignatureRequired&&this.agreementId==""&&this.entitySignatureMetaDataService.getAgreementId(this.applyService.selectedType.CaseTypeInfo.CaseTypeId,this.globalService.tenantId,function(n){t.agreementId=n.AgreementId;t.tylerSignaturePadService.signatureAgreementText=n.SignatureAgreement}));n.setSubContactSettings()},s.prototype.setSubContactSettings=function(){var n=this;n.applyService.selectedType&&n.applyService.selectedType.CaseTypeInfo&&(n.enerGovContactCardsService.autoIncludeParentContactDuringApplication=n.applyService.selectedType.CaseTypeInfo.AutoIncludeParentContactDuringApplication,n.enerGovContactCardsService.automaticallyInclude=n.applyService.selectedType.CaseTypeInfo.AutomaticallyInclude,n.enerGovContactCardsService.allowRemovingOf=n.applyService.selectedType.CaseTypeInfo.AllowRemovingOf)},s.prototype.estimateFee=function(){var t=this,n=this;this.cleanUp();this.menuService.getCaseTypeMenu(this.caseType,function(i){n.applyService.selectedTypeItems=i.Menus.filter(function(n){return n.CaseTypeInfo!==null&&n.CaseTypeInfo.CaseTypeUse!==u.ApplicationOnly});n.applyService.secondaryData===null?t.secondaryDataService.getSecondaryData("",function(t){n.applyService.secondaryData=t;n.handleInactiveMenuItems();n.applyService.selectedType=n.applyService.selectedTypeItems[0];n.applyService.selectedType&&n.menusToRemove.indexOf(n.applyService.selectedType.MenuID)>=0&&(n.applyService.selectedType=null);n.selectType();n.setStepperSteps()}):(n.handleInactiveMenuItems(),n.applyService.selectedType=n.applyService.selectedTypeItems[0],n.applyService.selectedType&&n.menusToRemove.indexOf(n.applyService.selectedType.MenuID)>=0&&(n.applyService.selectedType=null),n.selectType(),n.setStepperSteps())});n.userService.isUserLoggedIn||this.settingsService.getHideApplybuttonInFeeEstimatorSoftwarePackageSetting(function(t){n.hideApplybuttonInFeeEstimator=t&&t.SettingValue==="true"})},s.prototype.getStepInstructions=function(){var n=this,t=n.getTypeId(),i=n.getWorkClassId();n.enerGovAddressCardsService.TenantId=n.globalService.tenantId;n.enerGovAddressCardsService.CaseTypeId=t;n.enerGovAddressCardsService.WorkClassId=i;n.enerGovContactCardsService.caseTypeId=t;n.enerGovContactCardsService.caseTypeWorkClassId=i;n.caseTypeInstructionService.getUseApplicationInstruction({PackageCaseClassId:i,PackageCaseTypeId:t},function(){n.applyService.selectedType.CaseTypeInfo.UseApplicationInstructions=n.caseTypeInstructionService.useApplicationInstruction;n.isRenewalLicense&&!n.applyService.selectedType.CaseTypeInfo.UseApplicationInstructions?n.caseTypeInstructionService.getRenewalInstructions({PackageCaseClassId:i,PackageCaseTypeId:t},function(){n.basicInstruction=n.caseTypeInstructionService.caseTypeInstructions.BasicInfoInstructions;n.enerGovAddressCardsService.addressInstruction=n.caseTypeInstructionService.caseTypeInstructions.LocationInstructions;n.enerGovContactCardsService.contactInstruction=n.caseTypeInstructionService.caseTypeInstructions.ContactInstructions;n.enerGovAttachmentCardsService.attachmentInstruction=n.caseTypeInstructionService.caseTypeInstructions.AttachmentInstructions}):n.caseTypeInstructionService.getInstructions({PackageCaseClassId:i,PackageCaseTypeId:t},function(){n.basicInstruction=n.caseTypeInstructionService.caseTypeInstructions.BasicInfoInstructions;n.enerGovAddressCardsService.addressInstruction=n.caseTypeInstructionService.caseTypeInstructions.LocationInstructions;n.enerGovContactCardsService.contactInstruction=n.caseTypeInstructionService.caseTypeInstructions.ContactInstructions;n.enerGovAttachmentCardsService.attachmentInstruction=n.caseTypeInstructionService.caseTypeInstructions.AttachmentInstructions})})},s.prototype.eReviewsFileUploadCallback=function(n,t,i){var r=this,u=r.enerGovAttachmentCardsService.updateEReviewProjectModel(n,t.ERProjects[0]);u.ERProjectFiles.length>0&&r.eReviewsService.resubmitEReview(u,function(){r.afterSaveRedirection(i,t)})},s.prototype.saveSignatureToEnergov=function(n,t,i){var u=this,r=this,f;this.tylerSignaturePadService.isSignatureAddded?(r.agreementType=n,r.tylerSignaturePadService.imageData.caseId=t.Result.EntityId.toString(),f=r.userService.getUser(function(n){r.tylerSignaturePadService.imageData.cssUserGuid=n.UserId.toString();r.tylerSignaturePadService.imageData.subject=n.FirstName+" "+n.LastName+" ,"+n.Company;r.tylerSignaturePadService.imageData.agreementIdentifierGuid=r.agreementId;u.tylerSignaturePadService.setImageMetadata(u.tylerSignaturePadService.imageData,function(n){r.saveSignatureMetaDataSelfService(t.Result,n,function(){r.tylerSignaturePadService.cleanUp();i()})})})):i()},s.prototype.saveSignatureMetaDataSelfService=function(n,t,i){var r=this,u={AgreementId:this.agreementId,AgreementType:this.agreementType,Author:this.tylerSignaturePadService.imageData.consentName,Image:this.tylerSignaturePadService.imageData.imageBlob,MetaData:"",RecordId:n.EntityId.toString(),TenantId:this.globalService.tenantId,UserId:this.globalEntityId,IsFileUploaded:t};this.entitySignatureMetaDataService.saveSignatureAgreementMetaData(u,function(){r.entityMetaDataId=n;i()})},s.prototype.afterSaveRedirection=function(t,i){var u=this,f=parseInt(u.$routeParams.draftId,10),e;if(f&&u.menuActionType==r.Apply&&u.draftService.deleteDraftById(f),e=u.applyService.selectedType.CaseTypeInfo.ShowSuccessPage,u.cleanUp(),u.errorMessage&&(u.hidePopup("#showApplyError"),u.errorMessage=""),e)switch(t){case n.Common.CaseTypeUseEnums.FilterModule.Permit:u.$location.path("/permit/apply/"+u.$routeParams.menuId+"/success/"+i.permitId);break;case n.Common.CaseTypeUseEnums.FilterModule.Plan:u.$location.path("/plan/apply/"+u.$routeParams.menuId+"/success/"+i.PlanId);break;case n.Common.CaseTypeUseEnums.FilterModule.ProfessionalLicense:u.$location.path("/profLicense/apply/"+u.$routeParams.menuId+"/success/"+i.ProfessionalLicenseId);break;case n.Common.CaseTypeUseEnums.FilterModule.BusinessLicense:u.$location.path("/businessLicense/apply/"+u.$routeParams.menuId+"/success/"+i.BusinessLicenseId);break;case n.Common.CaseTypeUseEnums.FilterModule.Application:u.$location.path("/application/apply/"+u.$routeParams.menuId+"/success/"+i.ApplicationID);break;case n.Common.CaseTypeUseEnums.FilterModule.OperationalPermit:u.$location.path("/operationalPermit/apply/"+u.$routeParams.menuId+"/success/"+i.BusinessLicenseId)}else switch(t){case n.Common.CaseTypeUseEnums.FilterModule.Permit:u.$location.path("/permit/"+i.permitId).search("success",!0);break;case n.Common.CaseTypeUseEnums.FilterModule.Plan:u.$location.path("/plan/"+i.PlanId).search("success",!0);break;case n.Common.CaseTypeUseEnums.FilterModule.ProfessionalLicense:u.$location.path("/profLicense/"+i.ProfessionalLicenseId).search("success",!0);break;case n.Common.CaseTypeUseEnums.FilterModule.BusinessLicense:u.$location.path("/businessLicense/"+i.BusinessLicenseId).search("success",!0);break;case n.Common.CaseTypeUseEnums.FilterModule.Application:u.$location.path("/application/"+i.ApplicationID).search("success",!0);break;case n.Common.CaseTypeUseEnums.FilterModule.OperationalPermit:u.$location.path("/operationalPermit/"+i.BusinessLicenseId).search("success",!0)}},s.prototype.closeProgressBarDialog=function(){var n=this,t=this.$location.path().split("/")[1].toUpperCase(),r=!1;n.enerGovAttachmentCardsService.fileUploadService.fileProgressList.forEach(function(i){var u,f;i.UploadErrorMessage&&(u=n.enerGovAttachmentCardsService.fileAttachments.filter(function(n){return n.name==i.FileName}),u&&u.length>0?(n.enerGovAttachmentCardsService.removeFlowAttachmentCard(u[0],n.isRenewalLicense,t),r=!0):(f=n.enerGovAttachmentCardsService.ereviewAttachments.filter(function(n){return n.name==i.FileName}),f&&f.length>0&&(n.enerGovAttachmentCardsService.removeFlowAttachmentCard(f[0],!1,t),r=!0)))});t===i[i.Permit].toUpperCase()&&(n.applyService.permitSaveInProgress=!1);t===i[i.Plan].toUpperCase()&&(n.applyService.planSaveInProgress=!1);r&&n.stepperService.stepper.Steps.length==n.stepperService.currentStepNumber+1&&n.stepperService.previousStep();angular.element("#AttachmentUploadProgressModal").modal("hide")},s.prototype.processParentTableCustomFields=function(n){var i=this,r=i.enerGovCustomFieldsService.customFields,u=r.CustomGroups.map(function(n){return n.CustomFields}),f=[].concat.apply([],u),t=f.filter(function(t){return t.FieldName===n.FieldName});return t&&t.length?t[0]:null},s}(app.Core.Controllers.CoreController);t.EnerGovApplyController=s})(i=t.Apply||(t.Apply={}))})(i=t.Controllers||(t.Controllers={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={}));__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=app.Core.Controllers.CoreController,r=app.Common.SelfServiceModules,u=function(t){function u(i,u,f,e,o,s,h,c,l,a,v){var y,d,b;v===void 0&&(v=null);y=t.call(this,null)||this;y.$routeParams=i;y.userService=u;y.$location=f;y.globalService=e;y.enerGovAttachmentCardsService=o;y.$q=s;y.$scope=h;y.eReviewsService=c;y.fileUploadService=l;y.$timeout=a;y.enerGovAttachmentsSearchService=v;y.notSupportedFiles=[];y.duplicateFiles=[];y.isEreviewApiAvailable=!1;y.isPlanOrPermitModule=!1;y.categoryOnlyOneCanSelected="";y.categorylist=[];y.displaySize=function(n){return n>1048576?(Math.round(n*100/1048576)/100).toString()+" MB":(Math.round(n*100/1024)/100).toString()+" KB"};y.fileSize=function(n,t){var i=null;if(n.size?i=n.size:n.file.size!==null&&(i=n.file.size),i===undefined){n.hideSize=!0;return}return n.hideSize=!1,n.tooBig=i>t?!0:null,y.displaySize(i)};y.flowFileSize=function(n){var t=null;if(n.size>=0?t=n.size:n.file.size!==null&&(t=n.file.size),t===undefined||t===null){n.hideSize=!0;return}return n.hideSize=!1,y.displaySize(t)};var p=y,k=y.$routeParams.id,w=f.path();return(y.moduleName=y.$location.path().split("/")[1].toUpperCase(),y.isFromApply=w.indexOf("apply")>-1,y.isFromResubmit=w.indexOf("resubmitAttachment")>-1,y.$timeout(function(){if(p.enerGovAttachmentCardsService.$ereviewFlow.files.length<p.enerGovAttachmentCardsService.$files.length){var t=function(n,t){return n.name===t.name},i=function(n,t,i){return n.filter(function(n){return!t.some(function(t){return i(n,t)})})},r=i(p.enerGovAttachmentCardsService.$files,p.enerGovAttachmentCardsService.$ereviewFlow.files,t);r.forEach(function(t){p.enerGovAttachmentCardsService.selectedFileType&&p.enerGovAttachmentCardsService.selectedFileType.AttachmentType==n.Attachment.Models.AttachmentType.EReview?p.enerGovAttachmentCardsService.$ereviewFlow.addFile(t.file):p.enerGovAttachmentCardsService.$attachmentFlow.addFile(t.file)})}}),!p.enerGovAttachmentCardsService.isServiceModelCleaned&&k==null)?y:(w.indexOf("renew")>-1&&(y.isRenewal=!0),k==null||y.isRenewal||parseInt(y.$routeParams.draftId,10)>0||(d=y.moduleName==r[r.BusinessLicense].toUpperCase()||y.moduleName==r[r.OperationalPermit].toUpperCase(),y.isFromApply&&d||y.isFromResubmit||p.enerGovAttachmentCardsService.clean()),app.Common.Helpers.VersionSupport(y.globalService.enerGovAPIVersion,"2017.5.0.12")&&(p.isEreviewApiAvailable=!0),b=f.path().split("/"),p.isPlanOrPermitModule=b.indexOf("plan")>0||b.indexOf("permit")>0,y.isFromResubmit||(p.enerGovAttachmentCardsService.filesDropDown=[],p.eReviewsService.getEnergovApplySubmitForReviewRuleSetting(function(){}),p.eReviewsService.isEnerGovEReviewEnable=!1,p.isEreviewApiAvailable&&p.isPlanOrPermitModule&&(p.isEreviewsEnabledPromise=p.eReviewsService.getEnerGovEReviewEnableSetting(function(){}),p.$routeParams.id!=null&&(p.eReviewsService.isEReviewCaseTypeDefer=p.$q.defer(),p.eReviewsService.isEReviewCaseTypePromise=p.eReviewsService.isEReviewCaseTypeDefer.promise)),p.getCAPFileTypesPromise=p.getCAPFileTypes(),p.fetchAllAttachments()),y)}return __extends(u,t),u.prototype.getExistingEReviewProject=function(){return null},u.prototype.getExistingAttachments=function(){return null},u.prototype.getCAPFileTypes=function(){return null},u.prototype.getEReviewFileSet=function(){return null},u.prototype.getFileSet=function(){return null},u.prototype.callbackDependencies=function(){},u.prototype.getEreviewFileCategories=function(n){var t=this,i=this;if(n)return this.eReviewsService.setup(function(){t.eReviewsService.ereviewsSecondaryData!==null&&t.eReviewsService.ereviewsSecondaryData.ERProjectFileCategories.length>0&&(i.categorylist=t.eReviewsService.ereviewsSecondaryData.ERProjectFileCategories)})},u.prototype.getAllowedFileTypes=function(){var t=this,i=t.$q.defer();return t.enerGovAttachmentCardsService.getSoftwarePackageSettings(function(i){i!=null&&(t.fileTypesAllowed=i.SettingValue,t.$q.when(i.SettingValue).then(function(){t.enerGovAttachmentCardsService.getFileTypes(function(i){i!=null&&(t.enerGovAttachmentCardsService.attachmentAllowedFileTypes=t.enerGovAttachmentCardsService.fileTypeConversionToStdExtension(t.fileTypesAllowed,i,", "),t.enerGovAttachmentCardsService.requiredFileCards.map(function(i){i.AttachmentType===n.Attachment.Models.AttachmentType.Attachment&&(i.AllowedFileTypes=t.enerGovAttachmentCardsService.attachmentAllowedFileTypes)}),t.fillFileTypesForAttachment())})}))}),i.resolve(),i.promise},u.prototype.removeFlowAttachmentCard=function(n){this.enerGovAttachmentCardsService.$files=this.enerGovAttachmentCardsService.$files.filter(function(t){return t.name!==n.name});this.enerGovAttachmentCardsService.removeFlowAttachmentCard(n,this.isRenewal,this.moduleName)},u.prototype.isDuplicateAttachment=function(n){var t=this,i;return t.enerGovAttachmentCardsService.ereviewAttachments.filter(function(n){return n.attachment===undefined||n.attachment===null}).filter(function(t){return t.name.toLowerCase()===n.toLowerCase()}).length>0||t.enerGovAttachmentCardsService.fileAttachments.filter(function(t){return t.name.toLowerCase()===n.toLowerCase()}).length>0?!0:t.enerGovAttachmentCardsService.ereviewAttachments.filter(function(n){return n.attachment!==undefined&&n.attachment!==null}).length>0?(i=!1,angular.forEach(t.enerGovAttachmentCardsService.ereviewAttachments,function(t){if(!i){var r=t.name.substring(0,t.name.lastIndexOf(".")),u=t.name.substring(t.name.lastIndexOf(".")),f=r.substring(0,r.lastIndexOf("_v"))+u;i=f.toLowerCase()===n.toLowerCase()}}),i):!1},u.prototype.validateType=function(){this.enerGovAttachmentCardsService.selectedFileType&&this.enerGovAttachmentCardsService.selectedFileType!=null&&this.enerGovAttachmentCardsService.selectedFileType.Id==="0"&&(angular.element("#fileTypeSelect").addClass("border-dropdown"),angular.element("#fileTypeSelect").removeAttr("aria-label"),angular.element("#fileTypeSelect").attr("aria-label",this.enerGovAttachmentCardsService.defaultFileTypeName.toString()),angular.element("#fileTypeSelect").focus())},u.prototype.addAdditionalAttachment=function(t,r,u,f,e){var o=this,l,y,g,nt,p,s,it,w,a,h,b,tt,k,d,c,v;if(!e){if(!f&&o.enerGovAttachmentCardsService.selectedFileType&&o.enerGovAttachmentCardsService.selectedFileType!=null&&o.enerGovAttachmentCardsService.selectedFileType.Id==="0"){o.validateType();return}if(t.length!==0){for(o.duplicateFiles=[],o.notSupportedFiles=[],o.categoryOnlyOneCanSelected="",y=r.target||r.srcElement,y&&y.parentElement.querySelector("span[flow-btn]")&&(l=y.parentElement.querySelector("span[flow-btn]").getAttribute("data-filerefid")),(l===undefined||l===null||l==="")&&(l=r.currentTarget.getAttribute("data-filerefid")),o.enerGovAttachmentCardsService.fileSetInfo!==null&&(g=f?o.enerGovAttachmentCardsService.requiredFileCards.filter(function(n){return n.AttachmentReqFileRefID===l&&n.isFilled!==!0})[0].ERProjectFileCategoryId:o.enerGovAttachmentCardsService.selectedFileType.Id,nt=o.enerGovAttachmentCardsService.fileSetInfo.FileSetFileCategories.filter(function(n){return n.FileCategoryId===g})[0].NumberOfFilesAllowed,t.length>nt&&(t.splice(nt),o.categoryOnlyOneCanSelected=o.enerGovAttachmentCardsService.fileSetInfo.FileSetFileCategories.filter(function(n){return n.FileCategoryId===g})[0].FileCategoryName)),p=0;p<t.length;p++){if(s=t[p],o.isDuplicateAttachment(s.name)){o.duplicateFiles.push(s.name);continue}if(f||o.enerGovAttachmentCardsService.selectedFileType==null||o.enerGovAttachmentCardsService.selectedFileType.AttachmentType!=n.Attachment.Models.AttachmentType.EReview){if(f||o.enerGovAttachmentCardsService.selectedFileType==null||o.enerGovAttachmentCardsService.selectedFileType.AttachmentType==n.Attachment.Models.AttachmentType.Attachment)if(b=o.enerGovAttachmentCardsService.requiredFileCards.filter(function(n){return n.AttachmentReqFileRefID===l&&n.isFilled!==!0}),b!=null&&b.length>0&&(h=b[0]),tt=h?h.Name:o.enerGovAttachmentCardsService.selectedFileType?o.enerGovAttachmentCardsService.selectedFileType.Name:o.enerGovAttachmentCardsService.attachmentFileType,k=h?h.AllowedFileTypes:o.enerGovAttachmentCardsService.attachmentAllowedFileTypes,k.match(s.getType())&&i.isNotNullEmptyUndefined(s.getType())||k.match(s.getExtension())&&i.isNotNullEmptyUndefined(s.getExtension())||k.indexOf(".*")>-1&&i.isNotNullEmptyUndefined(s.getExtension())){if(d=h?h.AttachmentType:o.enerGovAttachmentCardsService.selectedFileType?o.enerGovAttachmentCardsService.selectedFileType.AttachmentType:n.Attachment.Models.AttachmentType.Attachment,d===n.Attachment.Models.AttachmentType.Attachment?(c={name:s.name,fileType:tt,size:s.size,file:s,attachment:null,ereviewProjectFile:null,type:d,ERProjectFileCategoryId:null,cssFileName:s.name,isNewlyUploaded:!0},o.enerGovAttachmentCardsService.fileAttachments.push(c),o.uploadNewCardForNonCategory(c),o.enerGovAttachmentCardsService.$attachmentFlow.addFile(s.file)):(c={name:s.name,fileType:tt,size:s.size,file:s,attachment:null,ereviewProjectFile:null,type:d,ERProjectFileCategoryId:h.ERProjectFileCategoryId,cssFileName:s.name,isNewlyUploaded:!0},o.enerGovAttachmentCardsService.ereviewAttachments.push(c),o.uploadNewCardForNonCategory(c),o.enerGovAttachmentCardsService.$ereviewFlow.addFile(s.file)),h)h.isFilled=!0;else if(o.enerGovAttachmentCardsService.selectedFileType)for(v=0;v<o.enerGovAttachmentCardsService.requiredFileCards.length;v++)if(o.enerGovAttachmentCardsService.selectedFileType.Name==o.enerGovAttachmentCardsService.requiredFileCards[v].Name&&!o.enerGovAttachmentCardsService.requiredFileCards[v].isFilled){o.enerGovAttachmentCardsService.requiredFileCards[v].isFilled=!0;break}}else this.notSupportedFiles.push(s.name)}else if(it=o.eReviewsService.ereviewsSecondaryData.ERProjectFileCategories.filter(function(n){return n.Name===o.enerGovAttachmentCardsService.selectedFileType.Name})[0].AllowedFileTypes,w=o.enerGovAttachmentCardsService.getFilteredFileTypes(o.enerGovAttachmentCardsService.allowedFileTypes.SettingValue,it),w.match(s.getType())&&i.isNotNullEmptyUndefined(s.getType())||w.match(s.getExtension())&&i.isNotNullEmptyUndefined(s.getExtension())||w.indexOf(".*")>-1&&i.isNotNullEmptyUndefined(s.getExtension())){if(c={name:s.name,fileType:o.enerGovAttachmentCardsService.selectedFileType.Name,size:s.size,file:s,attachment:null,ereviewProjectFile:null,type:n.Attachment.Models.AttachmentType.EReview,ERProjectFileCategoryId:o.enerGovAttachmentCardsService.selectedFileType.Id,cssFileName:s.name,isNewlyUploaded:!0},o.enerGovAttachmentCardsService.ereviewAttachments.push(c),o.uploadNewCardForNonCategory(c),o.enerGovAttachmentCardsService.fileSetInfo!==null)for(a=0;a<o.enerGovAttachmentCardsService.requiredFileCards.length;a++)if(o.enerGovAttachmentCardsService.selectedFileType.Name==o.enerGovAttachmentCardsService.requiredFileCards[a].Name&&!o.enerGovAttachmentCardsService.requiredFileCards[a].isFilled){o.enerGovAttachmentCardsService.requiredFileCards[a].isFilled=!0;break}o.enerGovAttachmentCardsService.$ereviewFlow.addFile(s.file)}else o.notSupportedFiles.push(s.name)}o.enerGovAttachmentCardsService.updateFilesDropDownIfFileSet();o.enerGovAttachmentCardsService.getCombinedCardsForExistingFiles();u.files=[];o.setAttachmentAlertFocus(l);t.forEach(function(n){o.enerGovAttachmentCardsService.$files.push(n)})}}},u.prototype.setAttachmentAlertFocus=function(n){var i=this,t=null;i.categoryOnlyOneCanSelected!=""?t=angular.element("#FileSetCategoryFileCountLimitPanel"):i.duplicateFiles.length>0?t=angular.element("#DuplicateFileAlertPanel"):i.notSupportedFiles.length>0?t=angular.element("#AttachmentAlertPanel"):n&&(t=angular.element(n));t&&this.$timeout(function(){t.focus()},300)},u.prototype.newlyAddedFileExists=function(n){var t=!1;return angular.forEach(n,function(n){n.file&&(t=!0)}),t},u.prototype.fillFileTypesForAttachment=function(){var t=this;t.enerGovAttachmentCardsService.fileSetInfo!==null||t.eReviewsService.disallowAttachmentAfterApplication||(angular.forEach(t.enerGovAttachmentCardsService.attachmentsFileTypes,function(i){t.enerGovAttachmentCardsService.filesDropDown.push({Name:i.Name,Id:i.AttachmentGroupID,AttachmentType:n.Attachment.Models.AttachmentType.Attachment,AllowedFileTypes:t.enerGovAttachmentCardsService.attachmentAllowedFileTypes,ERProjectFileCategoryDescription:null})}),t.enerGovAttachmentCardsService.setSelectedFileType())},u.prototype.fillFileTypesForEReview=function(){var t=this;(t.enerGovAttachmentCardsService.fileSetInfo&&(t.enerGovAttachmentCardsService.filesDropDown=[]),t.eReviewsService.isAllowFileUpload&&t.eReviewsService.isEReviewCaseType)&&(t.enerGovAttachmentCardsService.fileSetInfo===null?angular.forEach(t.categorylist,function(i){var r=i.AllowedFileTypes;i.AllowedFileTypes.indexOf(".*")>-1&&(r=t.enerGovAttachmentCardsService.allowedFileTypes.SettingValue);t.enerGovAttachmentCardsService.filesDropDown.push({Name:i.Name,Id:i.ERProjectFileCategoryId,AttachmentType:n.Attachment.Models.AttachmentType.EReview,AllowedFileTypes:r,ERProjectFileCategoryDescription:i.Description})}):(t.enerGovAttachmentCardsService.filesDropDown=[],angular.forEach(t.enerGovAttachmentCardsService.fileSetInfo.FileSetFileCategories,function(i){var r=t.enerGovAttachmentCardsService.getFilteredFileTypes(t.enerGovAttachmentCardsService.allowedFileTypes.SettingValue,i.AllowedFileTypes);t.enerGovAttachmentCardsService.filesDropDown.push({Name:i.FileCategoryName,Id:i.FileCategoryId,AttachmentType:n.Attachment.Models.AttachmentType.EReview,AllowedFileTypes:r,ERProjectFileCategoryDescription:i.FileCategoryDescription})}),t.enerGovAttachmentCardsService.updateFilesDropDownIfFileSet(),t.enerGovAttachmentCardsService.setRequiredFiles()),angular.forEach(t.enerGovAttachmentCardsService.cards,function(n){n.AllowedFileTypes=t.enerGovAttachmentCardsService.allowedFileTypes.SettingValue;n.ereviewProjectFile&&n.ereviewProjectFile.FileCategoryXRefList[0]&&(n.AllowedFileTypes=t.enerGovAttachmentCardsService.getFilteredFileTypes(t.enerGovAttachmentCardsService.allowedFileTypes.SettingValue,n.ereviewProjectFile.FileCategoryXRefList[0].AllowedFileTypes))}))},u.prototype.modalPopupLastElementKeyDown=function(n,t){var i=this;t.stopPropagation();t.shiftKey||t.keyCode!==9||(t.preventDefault(),i.setNewFocus("#"+n,0))},u.prototype.modalPopupFirstElementKeyDown=function(n,t){var i=this;t.stopPropagation();t.shiftKey&&t.keyCode===9&&(t.preventDefault(),i.setNewFocus("#"+n,0))},u.prototype.showUploadInstructions=function(n,t){var i=this;t.stopPropagation();t.preventDefault();i.focusedElement=t.target.id;i.fileCategoryName=n.Name;i.uploadInstruction=n.ERProjectFileCategoryDescription;angular.element("#uploadInstructionPopup").modal("show");i.setNewFocus("#popup-title-uploadInstruction",300)},u.prototype.modalClose=function(){var n=this,t="#"+n.focusedElement;n.setNewFocus(t,300)},u.prototype.fetchAllAttachments=function(n){var t=this,i=t.$q.defer();return t.getExistingAttachmentsPromise=t.getExistingAttachments(),t.$q.all([t.isEreviewsEnabledPromise,t.getExistingAttachmentsPromise,t.getCAPFileTypesPromise,t.eReviewsService.isEReviewCaseTypePromise]).then(function(){t.userService.isUserLoggedIn&&(t.getAllowedFileTypesPromise=t.getAllowedFileTypes());t.eReviewsService.isEnerGovEReviewEnable&&t.eReviewsService.isEReviewCaseType&&(t.getExistingEReviewProjectPromise=t.getExistingEReviewProject(t.eReviewsService.isEnerGovEReviewEnable),t.getFileCategoriesPromise=t.getEreviewFileCategories(t.eReviewsService.isEnerGovEReviewEnable),t.getFileSetInfoPromise=t.userService.isUserLoggedIn?t.getFileSet():null);t.$q.all([t.getExistingEReviewProjectPromise,t.getFileCategoriesPromise,t.getFileSetInfoPromise,t.getAllowedFileTypesPromise]).then(function(){var r=t.enerGovAttachmentCardsService.erProject;t.enerGovAttachmentCardsService.setCaseRequestInfo(r).then(function(){t.enerGovAttachmentCardsService.setExtReviewIntegrationTypeInfo(t.eReviewsService.caseRequestInfo,t.eReviewsService.isEReviewCaseType,null).then(function(){t.enerGovAttachmentCardsService.setFileSubmissionStatusInfo().then(function(){t.callbackDependencies(n);t.fillFileTypesForEReview();t.enerGovAttachmentCardsService.setSelectedFileType();t.enerGovAttachmentCardsService.isServiceModelCleaned=!1;i.resolve()})})})})}),i.promise},u.prototype.setNewFocus=function(n,t){var r=this,i=angular.element(n);i&&r.$timeout(function(){i.focus()},t)},u.prototype.stopPropagation=function(n){n.stopPropagation()},u.prototype.uploadNewCardForNonCategory=function(t){if(app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2022.3.0.0")){var i={};t.type===n.Attachment.Models.AttachmentType.Attachment&&(i.AttachmentId="attachment");i.FileName=t.name;i.FileSize=t.size;i.CategoryName=t.fileType;i.file=t.file;this.enerGovAttachmentCardsService.nonCategoryCards.push(i)}},u}(app.Core.Controllers.CoreController);t.EnerGovAttachmentBaseController=u})(i=t.Controllers||(t.Controllers={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={}));__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){var t;(function(n){"use strict";var t=function(n){function t(){return n!==null&&n.apply(this,arguments)||this}return __extends(t,n),t.prototype.getSelectedWorkClassSecondaryData=function(){return null},t}(app.Core.Controllers.CoreController);n.EnerGovApplyController=t})(t=n.View||(n.View={}))})(t=n.Controllers||(n.Controllers={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){var i;(function(t){"use strict";var r=app.Common.HoldType,i=app.Common.SelfServiceModules,f=function(){function t(n,t,i,r,u,f,e,o,s,h){var c=this;this.http=n;this.enerGovAddressService=t;this.localStorageService=i;this.$location=r;this.$http=u;this.$q=f;this.globalService=e;this.$timeout=o;this.mapApplySerivce=s;this.enerGovEntityHoldSearchService=h;this.addressCards=[];this.locationCards=[];this.returnToUrl="";this.returnFromAddAddress=!1;this.isSelfServiceMailingAddressTypeAvailable=!1;this.GeoRuleLocations=[];this.GeoRuleResults=[];this.showMessage=!1;this.showAlert=!1;this.isGeoRuleAlert=!1;this.isGeoRuleBlock=!1;this.processingGeoRule=!1;this.processingParcelHolds=!1;this.addressInstruction="";this.isOneLocationRuleFail=!1;this.allowOnlyOneLocation=!1;this.showMapOnLocationSelection=!1;this.isSpatialCollectionValidationFail=!1;this.allowSpatialCollectionAsLocation=!1;this.userAddresses=[];this.parcelHoldInfos=[];this.copyParcelHolds=[];this.isSoftwareSettingLoaded=!1;this.showMessageOfParcelHolds=!1;(r.url()==="/permit/apply/address"||r.url()==="/plan/apply/address")&&(this.returnToUrl==null||this.returnToUrl==="")&&(this.$q.defer().resolve(),r.url("/home/dashboard"));t.getTenantSetting(function(n){n.SettingValue!==null&&(c.AllowPermitManualAddressEntryTypes=n.SettingValue)},"EnerGov","AllowPermitManualAddressEntryTypes");t.getTenantSetting(function(n){n.SettingValue!==null&&(c.AllowPlanManualAddressEntryTypes=n.SettingValue)},"EnerGov","AllowPlanManualAddressEntryTypes");t.getTenantSetting(function(n){n.SettingValue!==null&&(c.AllowBusinessLicenseManualAddressEntryTypes=n.SettingValue)},"EnerGov","AllowBusinessLicenseManualAddressEntryTypes");t.getTenantSetting(function(n){n.SettingValue!==null&&(c.AllowProfessionalLicenseManualAddressEntryTypes=n.SettingValue)},"EnerGov","AllowProfessionalLicenseManualAddressEntryTypes");t.getTenantSetting(function(n){n.SettingValue!==null&&(c.AllowApplicationManualAddressEntryTypes=n.SettingValue)},"EnerGov","AllowApplicationManualAddressEntryTypes")}return t.prototype.setUserAddressFields=function(n,t,i){this.isNewUserAddress=n;this.selectedAddress=t;this.userAddresses=i},t.prototype.setAddress=function(n){this.selectedAddress=n},t.prototype.buildLocationCardFromMap=function(n){var i=this,t=[];this.selectedAddressType=this.locationAddressType;angular.forEach(n,function(n){angular.forEach(n.Addresses,function(r){var u=i.mapAddressFieldsToAddress(r.AddressFields,n.ParcelNumber);u.FormattedAddressString=r.Address;t.push(u)});t.push(i.mapParcelToAddress(n))});t.length>0&&angular.forEach(t,function(n){i.addAddress(n)})},t.prototype.translateLocationCardFromMap=function(n){var i=this,t=[];return angular.forEach(n,function(n){angular.forEach(n.Addresses,function(r){var u=i.mapAddressFieldsToAddress(r.AddressFields,n.ParcelNumber);u.FormattedAddressString=r.Address;t.push(u)});t.push(i.mapParcelToAddress(n))}),t},t.prototype.mapAddressFieldsToAddress=function(t,i){var r=this.createBlankAddress();return r.Associated=i,n.Map.Helper.mapArcGisAddressFieldToEnergovAddressField(r,t)},t.prototype.mapParcelToAddress=function(t){var i=this.createBlankAddress();return i.IsParcel=!0,i.ParcelNumber=t.ParcelNumber,i.Associated=t.ParcelNumber,i.Range=t.Range,i.Section=t.Section,i.Township=t.Township,t.Addresses&&t.Addresses.length>0&&(i=n.Map.Helper.mapArcGisAddressFieldToEnergovAddressField(i,t.Addresses[0].AddressFields)),i},t.prototype.getFullAddress=function(n){return n.AddressLine1+" "+n.AddressLine2+" "+n.AddressLine3+" "+n.City+", "+n.State+" "+n.PostalCode+" "+n.County+" "+n.Country},t.prototype.addSpatialCollection=function(n){var t={Address:undefined,Parcel:undefined,IsSpatialCollection:!1,Geometry:undefined};t.IsSpatialCollection=!0;t.Geometry=n.geometry;this.locationCards.push(t)},t.prototype.addAddress=function(n,t){var i=this.duplicateLocation(n),r,u;i==null?(n.IsNew=!0,n.IsParcel||t||(n.AddressType=this.isSelfServiceMailingAddressTypeAvailable?this.selectedAddressType.MailingAddressTypeName:this.selectedAddressType.Name),this.addressCards.push(n),r=$.grep(this.addressCards,function(n){return!n.IsParcel}),r.length!==1||n.IsParcel||(n.Main=!0),u=$.grep(this.addressCards,function(n){return n.IsParcel}),u.length===1&&n.IsParcel&&(n.Main=!0),this.prepareLocationCards(n,this.addressCards)):(n.Main=i.Main,this.prepareLocationCards(i,this.addressCards))},t.prototype.prepareLocationCards=function(n,t){var r=this,u={Address:undefined,Parcel:undefined,IsSpatialCollection:!1,Geometry:undefined},e=!0,i,f;n.IsParcel===!1?u.Address=n:(i=n,f=t.filter(function(n){return n.IsParcel===!1&&(n.Associated===i.Associated||n.ParcelNumber===i.ParcelNumber)}),f!==null&&f.length>0?f.forEach(function(n){var t=r.locationCards.filter(function(t){return r.isAddress(t)&&(!r.isNullOrEmpty(t.Address.Associated)&&t.Address.Associated===n.Associated||!r.isNullOrEmpty(t.Address.ParcelNumber)&&t.Address.ParcelNumber===n.ParcelNumber)});t.length>0?(t.forEach(function(n,r){t[r].Parcel=i;t[r].Address.ParcelNumber=i.ParcelNumber}),n.ParcelNumber=i.ParcelNumber,e=!1):u.Parcel=i}):u.Parcel=i);e&&this.locationCards.push(u)},t.prototype.isNullOrEmpty=function(n){return n!==null&&n!==undefined&&n!==""?!1:!0},t.prototype.isAddress=function(n){return n.Address!==undefined&&n.Parcel===undefined?!0:!1},t.prototype.duplicateLocation=function(n){var t=this.addressCards.filter(function(t){return n.IsParcel&&t.IsParcel&&n.ParcelNumber==t.ParcelNumber});return t.length>0?t[0]:null},t.prototype.addLocations=function(n){var i=this,r=this,t;angular.forEach(n,function(n){r.addAddress(n)});t=this.getHoldsForParcel(null);this.$q.all([t]).then(function(){i.getGeoRuleResults()})},t.prototype.getHoldsForParcel=function(n){var t=this,i=this.$q.defer(),r=this.$location.path().split("/")[1].toUpperCase();return this.processingParcelHolds=!0,n==null?(angular.forEach(this.addressCards,function(n){t.setParcelHoldDataByModuleName(n,r)}),this.$timeout(function(){i.resolve(t.parcelHoldInfos);t.processingParcelHolds=!1},1e3)):(this.setParcelHoldDataByModuleName(n,r),this.$timeout(function(){i.resolve(t.parcelHoldInfos);t.processingParcelHolds=!1},1e3)),i.promise},t.prototype.setParcelHoldDataByModuleName=function(n,t){var r=this,u;n.IsParcel&&(u={ParcelNumber:n.ParcelNumber},this.enerGovEntityHoldSearchService.getParcelHolds(u,function(u){angular.forEach(u,function(u){switch(t){case i[i.Permit].toUpperCase():r.setParcelHoldData(n,u,u.HoldSetupInfo.PermitNew);break;case i[i.Plan].toUpperCase():r.setParcelHoldData(n,u,u.HoldSetupInfo.PlanNew);break;case i[i.BusinessLicense].toUpperCase():case i[i.OperationalPermit].toUpperCase():r.setParcelHoldData(n,u,u.HoldSetupInfo.BNEWLICENSE);break;case i[i.ProfLicense].toUpperCase():r.setParcelHoldData(n,u,u.HoldSetupInfo.EntProLicRenewal||u.HoldSetupInfo.PLRENEW)}})}))},t.prototype.setParcelHoldData=function(n,t,i){var o=this.parcelHoldInfos.filter(function(i){return i.ParcelNumber==n.ParcelNumber&&t.HoldTypeID==r.StopActionAndAlert&&i.IsBlock&&i.EntityHoldId==t.ParentHoldID}),f,e,u;o.length==0&&t.HoldTypeID==r.StopActionAndAlert&&i?t.HoldSetupInfo.ParcelEnforceMainParcelOnly?n.Main?(this.parcelHoldInfos.push({ParcelNumber:n.ParcelNumber,IsBlock:i,AlertMessage:t.AlertMessage,EntityHoldId:t.ParentHoldID,IsMain:n.Main,EnforceMainParcelOnly:t.HoldSetupInfo.ParcelEnforceMainParcelOnly}),u=this.copyParcelHolds.filter(function(i){return i.OriginNumber==n.ParcelNumber&&i.ParentHoldID==t.ParentHoldID&&i.Origin==t.Origin})[0],u&&this.copyParcelHolds.splice(this.copyParcelHolds.indexOf(u),1)):this.copyParcelHolds.filter(function(i){return i.OriginNumber==n.ParcelNumber&&t.ParentHoldID==i.ParentHoldID&&i.Origin==t.Origin}).length==0&&(t.IsNew=!0,this.copyParcelHolds.push(t)):(f=this.parcelHoldInfos.some(function(t){return t.ParcelNumber===n.ParcelNumber}),f&&t.HoldTypeID!==r.StopActionAndAlert||this.parcelHoldInfos.push({ParcelNumber:n.ParcelNumber,IsBlock:i,AlertMessage:t.AlertMessage,EntityHoldId:t.ParentHoldID,IsMain:n.Main,EnforceMainParcelOnly:t.HoldSetupInfo.ParcelEnforceMainParcelOnly})):t.HoldTypeID==r.StopActionAndAlert&&this.copyParcelHolds.filter(function(i){return i.OriginNumber==n.ParcelNumber&&t.ParentHoldID==i.ParentHoldID&&i.Origin==t.Origin}).length==0&&(t.IsNew=!0,this.copyParcelHolds.push(t));e=this.parcelHoldInfos.filter(function(i){return i.ParcelNumber==n.ParcelNumber&&t.HoldTypeID==r.AlertMessageOnly&&i.EntityHoldId==t.ParentHoldID});e.length==0&&t.HoldTypeID==r.AlertMessageOnly&&i?t.HoldSetupInfo.ParcelEnforceMainParcelOnly?n.Main?(this.parcelHoldInfos.push({ParcelNumber:n.ParcelNumber,IsBlock:!1,AlertMessage:t.AlertMessage,EntityHoldId:t.ParentHoldID,IsMain:n.Main,EnforceMainParcelOnly:t.HoldSetupInfo.ParcelEnforceMainParcelOnly}),u=this.copyParcelHolds.filter(function(i){return i.OriginNumber==n.ParcelNumber&&i.ParentHoldID==t.ParentHoldID&&i.Origin==t.Origin})[0],u?this.copyParcelHolds.splice(this.copyParcelHolds.indexOf(u),1):(t.IsNew=!0,this.copyParcelHolds.push(t))):this.copyParcelHolds.filter(function(i){return i.OriginNumber==n.ParcelNumber&&t.ParentHoldID==i.ParentHoldID&&i.Origin==t.Origin}).length==0&&(t.IsNew=!0,this.copyParcelHolds.push(t)):(this.parcelHoldInfos.push({ParcelNumber:n.ParcelNumber,IsBlock:!1,AlertMessage:t.AlertMessage,EntityHoldId:t.ParentHoldID,IsMain:n.Main,EnforceMainParcelOnly:t.HoldSetupInfo.ParcelEnforceMainParcelOnly}),this.copyParcelHolds.filter(function(i){return i.OriginNumber==n.ParcelNumber&&t.ParentHoldID==i.ParentHoldID&&i.Origin==t.Origin}).length==0&&(t.IsNew=!0,this.copyParcelHolds.push(t))):t.HoldTypeID==r.AlertMessageOnly&&this.copyParcelHolds.filter(function(i){return i.OriginNumber==n.ParcelNumber&&t.ParentHoldID==i.ParentHoldID&&i.Origin==t.Origin}).length==0&&(t.IsNew=!0,this.copyParcelHolds.push(t))},t.prototype.getGeoRuleResults=function(n){var t=this;n||(n=this.GeoRuleLocations);this.GeoRuleLocations.length==0&&(angular.forEach(this.addressCards,function(n){if(n.IsParcel){var i=t.GeoRuleLocations.length===0?0:t.GeoRuleLocations.map(function(n){return n.LocationId}).sort()[t.GeoRuleLocations.length-1],r={LocationId:i+1,Value:n.ParcelNumber,IsMain:n.Main};t.setGeoRuleForParcelWithoutBlockHold(n,r)}}),n=this.GeoRuleLocations);this.processGeorules(n).then(function(n){t.GeoRuleResults=[];angular.forEach(n,function(n){t.GeoRuleResults.push(n)})}).then(function(){t.setGeoRuleFlags(t.GeoRuleResults)})},t.prototype.setGeoRuleForParcelWithoutBlockHold=function(n,t){(this.parcelHoldInfos.length==0||this.parcelHoldInfos.filter(function(t){return t.ParcelNumber==n.ParcelNumber&&t.IsBlock}).length==0)&&this.GeoRuleLocations.filter(function(t){return t.Value==n.ParcelNumber}).length==0&&this.GeoRuleLocations.push(t)},t.prototype.processGeorules=function(n){this.processingGeoRule=!0;var t=this.$q.defer(),i={tenantId:this.TenantId,packageCasteTypeId:this.CaseTypeId,workClassId:this.WorkClassId?this.WorkClassId:"N/A",Locations:n},r=this.globalService.webApiBaseUrl;return this.$http.post(r+"/georules/process",i).then(function(n){t.resolve(n.data.Result)},function(n){t.reject(n.data)}),t.promise},t.prototype.validateLocations=function(){if(this.isOneLocationRuleFail=!1,this.isSpatialCollectionValidationFail=!1,this.allowOnlyOneLocation&&this.locationCards.length>1){var n=[],t=[],i=this.locationCards.filter(function(n){return n.IsSpatialCollection===!0});this.addressCards.forEach(function(i){i.IsParcel?t.push(i):n.push(i)});n.length>1&&t.length>1?this.isOneLocationRuleFail=!0:i.length>1&&(this.isOneLocationRuleFail=!0)}!this.allowSpatialCollectionAsLocation&&this.locationCards.some(function(n){return n.IsSpatialCollection===!0})&&(this.isSpatialCollectionValidationFail=!0)},t.prototype.setGeoRuleFlags=function(n){var t=this;this.isGeoRuleAlert=!1;this.isGeoRuleBlock=!1;this.showAlert=!1;angular.forEach(n,function(n){n.IsBlock&&!t.isGeoRuleBlock?t.isGeoRuleBlock=!0:n.IsAlert&&!t.isGeoRuleAlert&&(t.isGeoRuleAlert=!0);t.showAlert=!0});this.processingGeoRule=!1},t.prototype.removeLastAddress=function(){this.addressCards.splice(this.addressCards.length-1,1);this.locationCards.splice(this.locationCards.length-1,1)},t.prototype.removeParcelHolds=function(n){for(var i,t=this.parcelHoldInfos.length-1;t>=0;t--)this.parcelHoldInfos[t].ParcelNumber===n.Parcel.ParcelNumber&&this.parcelHoldInfos.splice(t,1);for(i=this.copyParcelHolds.length-1;i>=0;i--)this.copyParcelHolds[i].OriginNumber===n.Parcel.ParcelNumber&&this.copyParcelHolds.splice(i,1)},t.prototype.removeAddress=function(n){var t=this,u=this.locationCards.indexOf(this.locationCards.filter(function(t){return t===n})[0]),i,r;this.locationCards.splice(u,1);i=this.locationCards.filter(function(t){return t.Parcel!==undefined&&n.Parcel!==undefined&&t.Parcel.ParcelNumber===n.Parcel.ParcelNumber}).length;n.Address&&!n.Parcel?this.addressCards.splice(this.addressCards.indexOf(n.Address),1):!n.Address&&n.Parcel?i===0&&(this.addressCards.splice(this.addressCards.indexOf(n.Parcel),1),this.removeParcelHolds(n)):n.Address&&n.Parcel&&(this.addressCards.splice(this.addressCards.indexOf(n.Address),1),i===0&&(this.addressCards.splice(this.addressCards.indexOf(n.Parcel),1),this.removeParcelHolds(n)));angular.forEach(this.GeoRuleLocations,function(r){var f,u;if(i===0&&n.Parcel&&r.Value===n.Parcel.ParcelNumber)for(f=t.GeoRuleLocations.filter(function(n){return n.Value===r.Value&&n.LocationId===r.LocationId})[0],t.GeoRuleLocations.splice(t.GeoRuleLocations.indexOf(f),1),u=t.GeoRuleResults.length-1;u>=0;u--)t.GeoRuleResults[u].LocationId===r.LocationId&&t.GeoRuleResults.splice(u,1)});this.setGeoRuleFlags(this.GeoRuleResults);this.selectedAddressType=this.locationAddressType;this.selectNextMain(n);r=angular.element("#addressCardsId");r&&r.focus()},t.prototype.selectNextMain=function(n){var i=this,t;if(this.addressCards.length>=1){if(n.Address&&n.Address.Main&&!this.addressCards.some(function(n){return!n.IsParcel&&n.Main===!0}))for(t=0;t<this.addressCards.length;t++)if(!this.addressCards[t].IsParcel){this.addressCards[t].Main=!0;break}if(n.Parcel&&n.Parcel.Main&&!this.addressCards.some(function(n){return n.IsParcel&&n.Main===!0}))for(t=0;t<this.addressCards.length;t++)if(this.addressCards[t].IsParcel){this.addressCards[t].Main=!0;this.getHoldsForParcel(this.addressCards[t]).then(function(){i.checkGeoRulesForMainAddress(i.addressCards[t])});break}}},t.prototype.checkGeoRulesForMainAddress=function(n){var t=this,i,r;this.parcelHoldInfos.length>0&&this.parcelHoldInfos.filter(function(t){return t.ParcelNumber==n.ParcelNumber&&t.IsBlock}).length>0&&this.GeoRuleLocations.length>0&&this.GeoRuleLocations.filter(function(t){return t.Value==n.ParcelNumber}).length>0&&angular.forEach(this.GeoRuleLocations,function(n){t.GeoRuleLocations.splice(t.GeoRuleLocations.indexOf(n),1)});i=this.GeoRuleLocations.length===0?0:this.GeoRuleLocations.map(function(n){return n.LocationId}).sort()[this.GeoRuleLocations.length-1];r={LocationId:i+1,Value:n.ParcelNumber,IsMain:n.Main};this.setGeoRuleForParcelWithoutBlockHold(n,r);this.getGeoRuleResults()},t.prototype.createBlankAddress=function(){return{ParentAddressID:"",ParentID:"",MailingAddressID:"",CountryType:0,AddressType:"",Main:!1,AddressLine1:"",AddressLine2:"",AddressLine3:"",City:"",State:"",County:"",Country:"",PostalCode:"",PreDirection:"",PostDirection:"",StreetType:"",ParcelID:"",ParcelNumber:"",ParcelAddressID:"",RowVersion:0,LastChangedOn:null,LastChangedBy:"",AddressDisplay:"",UnitOrSuite:"",Province:"",POBox:"",CompSite:"",RuralRoute:"",Station:"",ATTN:"",AddressSystemType:"",GeneralDelivery:!1,Section:"",Range:"",Township:"",IsParcel:!1,IsNew:!1,IsDeleted:!1,ClientId:"",Associated:"",GisAddressId:"",FormattedAddressString:""}},t.prototype.cleanUp=function(){this.isGeoRuleAlert=!1;this.showMessage=!1;this.showAlert=!1;this.isOneLocationRuleFail=!1;this.isSpatialCollectionValidationFail=!1;this.isBusinessAddressCopied=!1;this.addressCards=[];this.locationCards=[];this.GeoRuleLocations=[];this.GeoRuleResults=[];this.setGeoRuleFlags([]);this.allowNonUSAddresses=undefined;this.defaultCountryTypeId=undefined;this.parcelHoldInfos=[];this.copyParcelHolds=[];this.processingParcelHolds=!1},t.prototype.getSecondaryDataAndSetAddressType=function(){var n=this;this.enerGovAddressService.getSecondaryData(function(t){var i,f,r,e,u,o,s;for(n.enerGovAddressService.secondaryData=t,t.SelfServiceMailingAddressTypeList!==undefined&&t.SelfServiceMailingAddressTypeList!==null?(n.isSelfServiceMailingAddressTypeAvailable=!0,i=t.SelfServiceMailingAddressTypeList,n.locationAddressType=i.filter(function(n){return n.SystemActionName=="Location"})[0]):(i=t.MailingAddressTypes,n.locationAddressType=i.filter(function(n){return n.Name=="Location"})[0]),f=0,r=0;r<i.length;r++)if(i[r].IsDefault){f=r;break}for(n.selectedAddressType=i[f],e=n.localStorageService.get("mapLocation","sessionStorage"),e&&(n.mapApplySerivce.mapLocations=e,n.localStorageService.remove("mapLocation","sessionStorage")),n.buildLocationCardFromMap(n.mapApplySerivce.mapLocations),u=0,o=n.mapApplySerivce.mapSPCollections;u<o.length;u++)s=o[u],n.addSpatialCollection(s);n.mapApplySerivce.resetMapApplyData()})},t}(),u;t.EnerGovAddressCardsService=f;u=function(){function n(){}return n.mapAddressFieldsToAddress=function(n,t){return angular.forEach(t,function(t){switch(t.FieldName){case"StreetNumber":n.AddressLine1=t.FieldValue;break;case"StreetName":n.AddressLine2=t.FieldValue;break;case"StreetType":n.StreetType=t.FieldValue;break;case"City":n.City=t.FieldValue;break;case"State":n.State=t.FieldValue;break;case"PostalCode":n.PostalCode=t.FieldValue;break;case"County":n.County=t.FieldValue;break;case"CivicNumber":n.AddressLine1=t.FieldValue;break;case"Province":n.Province=t.FieldValue;break;case"Country":n.Country=t.FieldValue;break;case"UnitOrSuite":n.UnitOrSuite=t.FieldValue;break;case"PreDirection":n.PreDirection=t.FieldValue;break;case"PostDirection":n.PostDirection=t.FieldValue}}),n},n}();t.AddressHelper=u})(i=t.Services||(t.Services={}))})(t=n.Address||(n.Address={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r){this.http=n;this.$http=t;this.globalService=i;this.$q=r}return n.prototype.getSecondaryData=function(n){this.secondaryData?n(this.secondaryData):this.$http.get(this.globalService.webApiBaseUrl+"/energov/address/setup").then(function(t){var i=t.data?t.data.Result:null;n(i)},function(){n(null)})},n.prototype.getTenantSetting=function(n,t,i){var r={softwarePackageName:t,settingName:i};this.http.get("/tenantSettings/SoftwarePackageSettings",function(t){t.Success&&n(t.Result)},!1,r)},n.prototype.arcGisAddressSearch=function(n){return this.http.postNoCallback("/arcgis/search/address",n,!0)},n.prototype.setSimpleUserAddress=function(n){var t=[n.AddressLine1,n.PreDirection,n.AddressLine2,n.StreetType,n.PostDirection,n.UnitOrSuite].filter(Boolean).join(" ");n.AddressLine1=t.length>100?t.substring(0,99):t;n.PreDirection="";n.AddressLine2="";n.StreetType="";n.PostDirection="";n.County=""},n.prototype.patchAddressRelatedInfo=function(n,t){var i=this;i.http.post("/energov/address/patch/parcel",n,function(n){n.Success&&t(n.Result)},!0)},n}();n.EnerGovAddressService=t})(t=n.Services||(n.Services={}))})(t=n.Address||(n.Address={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t){this.http=n;this.eventService=t;this.rootUrl="/arcgis/search/parcel";this.showAssociatedParcels=!1;this.associatedParcelList=[];this.parcels=[]}return n.prototype.searchByCriteria=function(n,t){var i=this;i.http.post(i.rootUrl,n,function(n){n.Success&&(angular.forEach(n.Result,function(n){for(var t=0;t<i.parcels.length;t++)if(n.ParcelNumber===i.parcels[t].ParcelNumber){n.Selected=!0;break}}),t(n))},!0)},n.prototype.searchAssociateParcelsByCriteria=function(n,t){var i=this,r=this;r.http.post("/arcgis/search/associate/parcel",n,function(n){n.Success&&(i.associatedParcelList=n.Result,i.eventService.boradcast("associatedParcelList",i.associatedParcelList),i.eventService.boradcast("showAssociatedParcels",!0),t(n))},!0)},n}();n.EnerGovArcGisParcelSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Address||(n.Address={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/arcgis/search/associate/address"}return n.prototype.searchByCriteria=function(n,t){var i=this;i.http.post(i.rootUrl,n,function(n){n.Success&&t(n)},!0)},n}();n.EnerGovAssociatedAddressSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Address||(n.Address={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n}return n.prototype.searchByCriteria=function(n,t){this.rootUrl="/energov/address/search";this.http.post(this.rootUrl,n,function(n){t(n)},!0)},n.prototype.searchMainAddressByCriteria=function(n,t){this.rootUrl="/energov/address/main/search";this.http.post(this.rootUrl,n,function(n){t(n.Result)},!0)},n}();n.EnerGovEntityAddressSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Address||(n.Address={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/address/"}return n.prototype.getEntityLocationByCriteria=function(n,t){var i=this.rootUrl+"locationData";this.http.post(i,n,function(n){t(n)},null)},n}();n.EnerGovEntityLocationsService=t})(t=n.Services||(n.Services={}))})(t=n.Address||(n.Address={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n}return n.prototype.searchByCriteria=function(n,t){this.rootUrl="/energov/address/parcelData";this.http.post(this.rootUrl,n,function(n){t(n)},!0)},n}();n.EnerGovEntityParcelSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Address||(n.Address={}))}(EnerGov||(EnerGov={}));__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){"use strict";var i=app.Common.SelfServiceModules,r=n.Common.Constant.SoftwarePackageSettings,u=function(n){function t(t,i,r,u,f,e,o,s,h){var c=n.call(this,null)||this,l;return c.$scope=t,c.$routeParams=i,c.$location=r,c.enerGovAddressCardsService=u,c.enerGovAddressService=f,c.tenantSettingService=e,c.$q=o,c.mapService=s,c.mapApplyService=h,c.allowOnlyOneLocation=!1,c.allowSpatialCollectionAsLocation=!1,c.showManualEntry=!1,c.selectedTab=2,c.updateLocationCard=function(n){c.enerGovAddressCardsService.locationCards.forEach(function(t){t.Parcel!==undefined&&t.Parcel!==null&&t.Parcel.ParcelNumber===n.ParcelNumber&&(t.Parcel.Main=n.Main,n.Main&&c.enerGovAddressCardsService.getHoldsForParcel(n).then(function(){c.enerGovAddressCardsService.checkGeoRulesForMainAddress(n)}))})},l=c,c.allowOnlyOneLocation=u.allowOnlyOneLocation,c.allowSpatialCollectionAsLocation=u.allowSpatialCollectionAsLocation,(u.returnToUrl==null||u.returnToUrl==="")&&(r.url()==="/permit/apply/address"||r.url()==="/plan/apply/address"||r.url()==="/permit/apply/addressmap"||r.url()==="/operationalPermit/apply/addressmap"||r.url()==="/plan/apply/addressmap"||r.url()==="/profLicense/apply/addressmap"||r.url()==="/businessLicense/apply/addressmap")&&(c.$q.defer().resolve(),r.url("/home/dashboard")),$("#addressTypesDropDown").click(function(n){n.stopPropagation()}),l.handleAddressRequired=function(){c.firstAddress=c.enerGovAddressCardsService.addressCards&&c.enerGovAddressCardsService.addressCards.length>0?"haveAddress":undefined},l.showAddressRequired=function(){return l.enerGovAddressCardsService.addressRequired&&(!l.enerGovAddressCardsService.addressCards||l.enerGovAddressCardsService.addressCards.length===0)&&(!l.enerGovAddressCardsService.locationCards||l.enerGovAddressCardsService.locationCards.length===0)?!0:!1},l.enerGovAddressCardsService.validateLocations(),l.backtoApplyLink=function(){c.enerGovAddressCardsService.returnFromAddAddress=!0;r.url(c.enerGovAddressCardsService.returnToUrl)},l.enerGovAddressCardsService.isSoftwareSettingLoaded||l.getSoftwarePackageSetting(),c}return __extends(t,n),t.prototype.processEvent=function(n){var c=this,t=this,r,e,o,s,u,i,f,h;if(n!==null&&n!=undefined){if(r=n.result.filter(function(n){return n.geometry}),e=r&&r.length>0,n.result&&!e)n.result.length===1&&n.result[0].address===""?(o=[{Addresses:[],ParcelNumber:n.result[0].parcel,Range:n.result[0].range,Section:n.result[0].section,Township:n.result[0].township}],s=t.enerGovAddressCardsService.translateLocationCardFromMap(o),s.forEach(function(n){t.addAddress(n)}),t.enerGovAddressCardsService.returnFromAddAddress=!0,t.enerGovAddressCardsService.getHoldsForParcel(null).then(function(){t.enerGovAddressCardsService.getGeoRuleResults()}),t.$location.url(this.enerGovAddressCardsService.returnToUrl)):this.mapService.getCssFormatLocations(n.result.map(function(n){return{Parcel:n.parcel,Range:n.range,Section:n.section,Township:n.township,Address:n.address?n.address:null,Attributes:n.attributes}}),function(n){var i=t.enerGovAddressCardsService.translateLocationCardFromMap(n);i.forEach(function(n){t.addAddress(n)});t.enerGovAddressCardsService.returnFromAddAddress=!0;t.enerGovAddressCardsService.getHoldsForParcel(null).then(function(){t.enerGovAddressCardsService.getGeoRuleResults()});t.$location.url(c.enerGovAddressCardsService.returnToUrl)});else{for(u=n.result.map(function(n){return{geometry:n.geometry}}),t.mapApplyService.mapSPCollections=u,i=0,f=u;i<f.length;i++)h=f[i],this.enerGovAddressCardsService.addSpatialCollection(h);t.mapApplyService.mapSPCollections=[];t.enerGovAddressCardsService.returnFromAddAddress=!0;t.$location.url(this.enerGovAddressCardsService.returnToUrl)}this.$scope.$apply()}},t.prototype.checkManualEntry=function(){var n=this;this.$q.when(this.enerGovAddressCardsService.selectedAddressType).then(function(){n.MailingAddressTypeName=n.enerGovAddressCardsService.selectedAddressType.SystemActionName;n.$location.path().toUpperCase().indexOf("OPERATIONALPERMIT")>-1?n.MatchWithManualAddresses=n.enerGovAddressCardsService.AllowBusinessLicenseManualAddressEntryTypes:n.$location.path().toUpperCase().indexOf("PERMIT")>-1?n.MatchWithManualAddresses=n.enerGovAddressCardsService.AllowPermitManualAddressEntryTypes:n.$location.path().toUpperCase().indexOf("PLAN")>-1?n.MatchWithManualAddresses=n.enerGovAddressCardsService.AllowPlanManualAddressEntryTypes:n.$location.path().toUpperCase().indexOf("BUSINESSLICENSE")>-1?n.MatchWithManualAddresses=n.enerGovAddressCardsService.AllowBusinessLicenseManualAddressEntryTypes:n.$location.path().toUpperCase().indexOf("PROFLICENSE")>-1?n.MatchWithManualAddresses=n.enerGovAddressCardsService.AllowProfessionalLicenseManualAddressEntryTypes:n.$location.path().toUpperCase().indexOf("APPLICATION")>-1&&(n.MatchWithManualAddresses=n.enerGovAddressCardsService.AllowApplicationManualAddressEntryTypes);n.MatchWithManualAddresses.match(n.MailingAddressTypeName)?n.showManualEntry=!0:(n.showManualEntry=!1,n.selectedTab=2)})},t.prototype.setMainAddress=function(n){var t=this,i=!1,r=!1,u=this.enerGovAddressCardsService.addressCards.filter(function(n){return!n.IsParcel}).length,f=this.enerGovAddressCardsService.addressCards.filter(function(n){return n.IsParcel===!0}).length;this.enerGovAddressCardsService.addressCards.forEach(function(e){e.IsParcel||n.IsParcel||e==n?e.IsParcel&&n.IsParcel&&e.ParcelNumber!=n.ParcelNumber&&(e.Main=!1,angular.forEach(t.enerGovAddressCardsService.parcelHoldInfos,function(n){e.ParcelNumber==n.ParcelNumber&&n.EnforceMainParcelOnly&&t.enerGovAddressCardsService.parcelHoldInfos.splice(t.enerGovAddressCardsService.parcelHoldInfos.indexOf(n),1)}),t.enerGovAddressCardsService.parcelHoldInfos.filter(function(t){return t.ParcelNumber==n.ParcelNumber}).length==0&&t.enerGovAddressCardsService.getHoldsForParcel(n).then(function(){var i=t.enerGovAddressCardsService.GeoRuleLocations.length===0?0:t.enerGovAddressCardsService.GeoRuleLocations.map(function(n){return n.LocationId}).sort()[t.enerGovAddressCardsService.GeoRuleLocations.length-1],r={LocationId:i+1,Value:n.ParcelNumber,IsMain:n.Main};t.enerGovAddressCardsService.setGeoRuleForParcelWithoutBlockHold(e,r)}),t.updateLocationCard(e)):e.Main=!1;e.IsParcel||n.IsParcel||e!==n?e.IsParcel&&n.IsParcel&&e.ParcelNumber===n.ParcelNumber&&(e.Main=n.Main,t.updateLocationCard(e)):e.Main=n.Main;(n.Main||n.IsParcel||e.IsParcel||i||e===n)&&(u!==1||e.IsParcel)||(e.Main=!0,i=!0);(!n.Main&&n.IsParcel&&e.IsParcel&&!r&&e.ParcelNumber!=n.ParcelNumber||f===1&&e.IsParcel)&&(e.Main=!0,r=!0,t.updateLocationCard(e))})},t.prototype.addAddressLocation=function(){this.enerGovAddressCardsService.returnToUrl=this.$location.url();this.enerGovAddressCardsService.showMapOnLocationSelection?this.$location.path().toUpperCase().indexOf("OPERATIONALPERMIT")>-1?this.$location.url("/operationalPermit/apply/addressmap"):this.$location.path().toUpperCase().indexOf("PERMIT")>-1?this.$location.url("/permit/apply/addressmap"):this.$location.path().toUpperCase().indexOf("PLAN")>-1?this.$location.url("/plan/apply/addressmap"):this.$location.path().toUpperCase().indexOf("BUSINESSLICENSE/APPLY")>-1?this.$location.url("/businessLicense/apply/addressmap"):this.$location.path().toUpperCase().indexOf("PROFLICENSE/APPLY")>-1?this.$location.url("/profLicense/apply/addressmap"):this.$location.path().toUpperCase().indexOf("APPLICATION/APPLY")>-1&&this.$location.url("/application/apply/addressmap"):(this.$location.path().toUpperCase().indexOf("PERMIT")>-1&&this.$location.url("/permit/apply/address"),this.$location.path().toUpperCase().indexOf("PLAN")>-1&&this.$location.url("/plan/apply/address"),this.$location.path().toUpperCase().indexOf("BUSINESSLICENSE/APPLY")>-1&&this.$location.url("/businessLicense/apply/address"),this.$location.path().toUpperCase().indexOf("PROFLICENSE/APPLY")>-1&&this.$location.url("/profLicense/apply/address"),this.$location.path().toUpperCase().indexOf("APPLICATION/APPLY")>-1&&this.$location.url("/application/apply/address"));this.$location.path().toUpperCase().indexOf("BUSINESSLICENSE/RENEW")>-1&&this.$location.url("/businessLicense/renew/address");this.$location.path().toUpperCase().indexOf("PROFLICENSE/RENEW")>-1&&this.$location.url("/profLicense/renew/address")},t.prototype.addAddress=function(n){this.enerGovAddressCardsService.addAddress(n);this.enerGovAddressCardsService.selectedAddressType=this.enerGovAddressCardsService.locationAddressType;this.handleAddressRequired()},t.prototype.removeAddress=function(n){this.enerGovAddressCardsService.removeAddress(n);this.handleAddressRequired();this.enerGovAddressCardsService.validateLocations()},t.prototype.setMain=function(n,t,i){var r,u;i.type==="keypress"&&i.which===13&&(i.preventDefault(),i.stopPropagation());n.Main=!0;t?(r=$.grep(this.enerGovAddressCardsService.addressCards,function(n){return!n.IsParcel}),angular.forEach(r,function(t){(t.AddressLine1!==n.AddressLine1||t.AddressLine2!==n.AddressLine2||t.StreetType!==n.StreetType||t.City!==n.City||t.PostalCode!==n.PostalCode||t.PreDirection!==n.PreDirection||t.PostDirection!==n.PostDirection)&&(t.Main=!1)})):(u=$.grep(this.enerGovAddressCardsService.addressCards,function(n){return n.IsParcel}),angular.forEach(u,function(t){t.ParcelNumber!==n.ParcelNumber&&(t.Main=!1)}))},t.prototype.getModuleName=function(){var n=this.$location.path().split("/")[1].toUpperCase();switch(n){case i[i.Permit].toUpperCase():return"permit";case i[i.Plan].toUpperCase():return"plan";case i[i.BusinessLicense].toUpperCase():return"business license";case i[i.OperationalPermit].toUpperCase():return"operational permit";case i[i.ProfLicense].toUpperCase():return"professional license";default:return""}},t.prototype.getSoftwarePackageSetting=function(){var n=this;n.tenantSettingService.getSoftwarePackageSetting(r.ShowMessageOfParcelHolds,function(t){n.enerGovAddressCardsService.showMessageOfParcelHolds=t&&t.SettingValue==="true";n.enerGovAddressCardsService.isSoftwareSettingLoaded=!0})},t.prototype.setAddressTooltip=function(n){var i=n.currentTarget.id,t=document.getElementById(i);t.title||(t.title=t.innerText.replace(/\r?\n|\r/g," "))},t}(app.Core.Controllers.CoreController);t.EnerGovAddressCardsController=u})(t=n.Address||(n.Address={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=app.Common.Helpers.VersionSupport,i=app.Common.Helpers.ModuleHelper,r=function(n){function r(i,r,u,f,e,o,s,h,c,l){var a=n.call(this,null)||this,v;return a.$scope=i,a.$routeParams=r,a.$location=u,a.globalService=f,a.$q=e,a.enerGovAddressCardsService=o,a.enerGovAddressService=s,a.userService=h,a.tenantSettingService=c,a.tenantService=l,a.defaultlabellist={},a.defaultPlaceholderList={},a.isMyUserAddress=!1,a.useSimpleUserAddress=!0,a.isReadOnlyAddress=!1,v=a,v.fillDefaultLableValues(),v.getDefaultPlaceholderValues(),v.model={ParentAddressID:"",ParentID:"",MailingAddressID:"",CountryType:0,AddressType:"",Main:!1,AddressLine1:"",AddressLine2:"",AddressLine3:"",City:"",State:"",County:"",Country:"",PostalCode:"",PreDirection:"",PostDirection:"",StreetType:"",ParcelID:"",ParcelNumber:"",ParcelAddressID:"",RowVersion:0,LastChangedOn:new Date,LastChangedBy:"",AddressDisplay:"",UnitOrSuite:"",Province:"",POBox:"",CompSite:"",RuralRoute:"",Station:"",ATTN:"",GeneralDelivery:!1,IsNew:!0,IsDeleted:!1,ClientId:"",AddressSystemType:"",Section:"",Range:"",Township:"",IsParcel:!1,Associated:"",GisAddressId:"",FormattedAddressString:""},(u.url()==="/permit/apply/address"||u.url()==="/plan/apply/address")&&(o.returnToUrl==null||o.returnToUrl==="")&&u.url("/home/dashboard"),u.url()==="/manageMyUser/address/update"&&(v.model=o.selectedAddress,v.isMyUserAddress=!0),u.url()==="/manageMyUser/address/add"&&(v.isMyUserAddress=!0),v.isEnerGovApiAvailable=t(a.globalService.enerGovAPIVersion,"2019.0.3.0")?!0:!1,v.getSecondaryData(),a}return __extends(r,n),r.prototype.arcgisAddressSearch=function(n){var t={Address:n,PageNumber:1,PageSize:5};return this.enerGovAddressService.arcGisAddressSearch(t).then(function(n){return n})},r.prototype.applySearchResult=function(n){var t=this,i;t.model={ParentAddressID:"",ParentID:"",MailingAddressID:"",CountryType:0,AddressType:"",Main:!1,AddressLine1:"",AddressLine2:"",AddressLine3:"",City:"",State:"",County:"",Country:"",PostalCode:"",PreDirection:"",PostDirection:"",StreetType:"",ParcelID:"",ParcelNumber:"",ParcelAddressID:"",RowVersion:0,LastChangedOn:null,LastChangedBy:"",AddressDisplay:"",UnitOrSuite:"",Province:"",POBox:"",CompSite:"",RuralRoute:"",Station:"",ATTN:"",AddressSystemType:"",GeneralDelivery:!1,Section:"",Range:"",Township:"",IsParcel:!1,IsNew:!1,IsDeleted:!1,ClientId:"",Associated:"",GisAddressId:"",FormattedAddressString:""};angular.forEach(n.AddressFields,function(n){switch(n.FieldName){case"StreetNumber":t.model.AddressLine1=n.FieldValue;break;case"StreetName":t.model.AddressLine2=n.FieldValue;break;case"StreetType":t.model.StreetType=n.FieldValue;break;case"City":t.model.City=n.FieldValue;break;case"State":t.model.State=n.FieldValue;break;case"PostalCode":t.model.PostalCode=n.FieldValue;break;case"County":t.model.County=n.FieldValue;break;case"CivicNumber":t.model.AddressLine1=n.FieldValue;break;case"Province":t.model.Province=n.FieldValue;break;case"Country":t.model.Country=n.FieldValue;break;case"UnitOrSuite":t.model.UnitOrSuite=n.FieldValue;break;case"PreDirection":t.model.PreDirection=n.FieldValue;break;case"PostDirection":t.model.PostDirection=n.FieldValue}});this.setSimpleAddressModel();i=this.getCountryTypeInfo(t.model.Country);this.countryType!=null&&i!=null&&this.countryType.CountryTypeId!==i.CountryTypeId&&(this.countryType=i)},r.prototype.getCountryTypeInfo=function(n){var t,i;if(n==="United States"?n="US":n==="International"?n="International":n==="Canada"&&(n="Canada"),this.enerGovAddressService.secondaryData!=null&&this.enerGovAddressService.secondaryData.CountryTypes!=null)for(t=0;t<this.enerGovAddressService.secondaryData.CountryTypes.length;t++)if(i=this.enerGovAddressService.secondaryData.CountryTypes[t],i.Name===n)return i;return null},r.prototype.clearAddressField=function(){this.model.City="";this.model.County="";this.model.AddressLine1="";this.model.AddressLine2="";this.model.ATTN="";this.model.State="";this.model.Province="";this.model.PostalCode="";this.model.Country="";this.fullAddress="";this.model.PreDirection="";this.model.PostDirection="";this.model.CountryType=this.countryType.CountryTypeId;this.setSimpleAddressModel()},r.prototype.getSecondaryData=function(){var n=this,t=this;t.enerGovAddressService.getSecondaryData(function(i){var r,u;t.secondaryData=i;r=t.SetTenantUserAddressSetting();u=t.getBusinessModuleSetting();t.$q.all([r,u]).then(function(){var i,r;n.model.CountryType=n.enerGovAddressCardsService.defaultCountryTypeId;n.isSimpleUserAddressApplicable()&&n.secondaryData&&n.secondaryData.States.some(function(n){return n.Name==""&&n.StateAbbreviationId==""})&&(i=n.secondaryData.States.filter(function(n){return n.Name==""&&n.StateAbbreviationId==""}),i&&i.length>0&&(r=n.secondaryData.States.indexOf(i[0]),n.secondaryData.States.splice(r,1)));t.setSimpleAddressModel();t.setSelectedCountryType();t.setLableValue()})})},r.prototype.setSelectedCountryType=function(){var i=this,t,n;if(this.isMyUserAddress)this.secondaryData&&this.secondaryData.CountryTypes&&(t=this.secondaryData.CountryTypes.filter(function(n){return n.CountryTypeId===i.model.CountryType}),this.countryType=t.length>0?t[0]:this.secondaryData.CountryTypes.filter(function(n){return n.CountryTypeId===+app.Constants.UserAddressCountryType.US})[0]);else if(this.enerGovAddressService.secondaryData&&this.enerGovAddressService.secondaryData.CountryTypes)for(n=0;n<this.enerGovAddressService.secondaryData.CountryTypes.length;n++)this.model&&this.enerGovAddressService.secondaryData.CountryTypes[n].CountryTypeId===this.model.CountryType&&(this.countryType=this.enerGovAddressService.secondaryData.CountryTypes[n])},r.prototype.fillDefaultLableValues=function(){var n,t=this;t.defaultlabellist=(n={},n.parcelnumber={value:"Parcel Number",isHide:!1},n.unitorsuite={value:"Unit Or Suite",isHide:!1},n.addressline1={value:"Address Line 1",isHide:!1},n.addressline2={value:"Address Line 2",isHide:!1},n["apartment;addressline3"]={value:"Address Line 3",isHide:!1},n.city={value:"City",isHide:!1},n["zip;postalcode"]={value:"Postal Code",isHide:!1},n.county={value:"County",isHide:!1},n.state={value:"State",isHide:!1},n.addresstype={value:"Address Type",isHide:!1},n.predirection={value:"Pre Direction",isHide:!1},n.postdirection={value:"Post Direction",isHide:!1},n.country={value:"Country",isHide:!1},n.main={value:"Main",isHide:!1},n.mailingaddressstreettypeid={value:"Street Type",isHide:!1},n.simpleaddressline1={value:"Address",isHide:!1},n)},r.prototype.setLableValue=function(){var n=this;angular.forEach(n.secondaryData.AddressLayoutSetupList,function(t){n.defaultlabellist[t.KeyBindingPropertyName.toLowerCase()]&&(n.defaultlabellist[t.KeyBindingPropertyName.toLowerCase()].isHide=t.IsHide,t.NewLabel&&t.NewLabel!==""&&(n.defaultlabellist[t.KeyBindingPropertyName.toLowerCase()].value=t.NewLabel))})},r.prototype.getAddressLine1Label=function(){return this.secondaryData&&this.isSimpleUserAddressApplicable()?this.defaultlabellist.simpleaddressline1.value:this.defaultlabellist.addressline1.value},r.prototype.getPlaceholder=function(n){return this.isSimpleUserAddressApplicable()?this.defaultPlaceholderList[n]:" "},r.prototype.isSimpleUserAddressApplicable=function(){return this.useSimpleUserAddress&&this.isMyUserAddress},r.prototype.showCountryType=function(){return this.isMyUserAddress?!this.useSimpleUserAddress:this.enerGovAddressCardsService.allowNonUSAddresses},r.prototype.getDefaultPlaceholderValues=function(){var n,t=this;t.defaultPlaceholderList=(n={},n.unitorsuite="Apartment, suite, unit, floor, (optional)",n.addressline1="Street address, P.O. box. (required)",n.state="Select a state",n)},r.prototype.addAddress=function(){var n=this;this.setModelFromSimpleAddress();this.model.CountryType=this.countryType.CountryTypeId;this.countryType.Name=="Canada"&&(this.model.Country=this.countryType.Name);this.enerGovAddressCardsService.addAddress(this.model);this.globalService.isRunningUnitTest||(this.enerGovAddressCardsService.returnFromAddAddress=!0,this.delayInvoke(function(){n.$location.url(n.enerGovAddressCardsService.returnToUrl)}));this.enerGovAddressCardsService.selectedAddressType=this.enerGovAddressCardsService.locationAddressType},r.prototype.SetTenantUserAddressSetting=function(){var t=this,n=this.$q.defer();if(this.isMyUserAddress)this.tenantSettingService.getTenantUserSetting("UseSimpleUserAddress",function(i){return i?(t.useSimpleUserAddress=i.toLowerCase()==="true",n.resolve(),n.promise):n.promise});else return this.useSimpleUserAddress=!1,n.resolve(),n.promise;return n.promise},r.prototype.getBusinessModuleSetting=function(){var n=this,t=this.$q.defer(),r;return this.isMyUserAddress?(this.enerGovAddressCardsService.defaultCountryTypeId=this.model.CountryType,t.resolve()):this.enerGovAddressCardsService.allowNonUSAddresses===undefined||this.enerGovAddressCardsService.defaultCountryTypeId===undefined?(r=i.getSelfServiceApplyModuleId(this.$location),this.tenantSettingService.getBusinessModuleSettingByModuleId(r,function(i){i&&(n.enerGovAddressCardsService.allowNonUSAddresses=i.AllowNonUSAddresses?i.AllowNonUSAddresses.valueOf():!1,i.DefaultCountryTypeId&&n.enerGovAddressCardsService.allowNonUSAddresses?n.tenantService.getTenantSecondaryData(function(r){if(r){var u=r.CountryTypes.filter(function(n){return n.CountryTypeId==i.DefaultCountryTypeId})[0].Abbreviation,f=n.secondaryData.CountryTypes.filter(function(n){return n.Name.toLowerCase()==u.toLowerCase()})[0];n.enerGovAddressCardsService.defaultCountryTypeId=f.CountryTypeId;t.resolve()}}):(n.enerGovAddressCardsService.defaultCountryTypeId=n.model.CountryType,t.resolve()))})):t.resolve(),t.promise},r.prototype.saveAddress=function(){var n=this,t,i;this.setModelFromSimpleAddress();this.model.CountryType=this.countryType.CountryTypeId;this.countryType.Name=="Canada"&&(this.model.Country=this.countryType.Name);this.enerGovAddressCardsService.isNewUserAddress&&(this.enerGovAddressCardsService.userAddresses||(this.enerGovAddressCardsService.userAddresses=[]),this.enerGovAddressCardsService.userAddresses.push(this.model));this.model.AddressType!=this.userService.selectedAddressType.Name&&(this.model.AddressType=this.userService.selectedAddressType.Name);t=this.enerGovAddressCardsService.isNewUserAddress&&this.enerGovAddressCardsService.userAddresses.length==1;(this.model.Main||t)&&(i=this.model,this.userService.user.Address=i,this.userService.user.Address.FullAddress=this.enerGovAddressCardsService.getFullAddress(this.model));this.userService.saveMyUserAddresses(this.userService.user,function(){n.userService.getUserDetails(function(t){n.userService.user=t;n.$location.url(n.userService.returnUserAddressUrl)})})},r.prototype.setModelFromSimpleAddress=function(){var n=this;n.isSimpleUserAddressApplicable()&&n.simpleAddress&&n.countryType.CountryTypeId==app.Constants.UserAddressCountryType.US&&(n.model=n.simpleAddress)},r.prototype.setSimpleAddressModel=function(){var n=this;n.isSimpleUserAddressApplicable()&&n.model&&(n.model.CountryType==app.Constants.UserAddressCountryType.US&&n.enerGovAddressService.setSimpleUserAddress(n.model),n.simpleAddress=n.model)},r}(app.Core.Controllers.CoreController);n.EnerGovAddressManualApplyController=r})(t=n.Address||(n.Address={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f,e){var o=n.call(this,t,i,r,u,null,!1)||this,s;return o.enerGovArcGisParcelSearchService=u,o.enerGovAddressCardsService=f,o.eventService=e,o.searchAddressCriteria=null,o.disableAddParcels=null,s=o,s.enerGovArcGisParcelSearchService.parcels=[],o}return __extends(t,n),t.prototype.searchParcels=function(){if($("#parcelSearchBox").val().trim().length!=0){this.parcelList=null;this.enerGovArcGisParcelSearchService.parcels=[];this.disableAddParcels=!1;var n={PageSize:this.searchCriteria.PageSize,PageNumber:1,ParcelNumber:$("#parcelSearchBox").val().trim()};this.searchCriteria=n;this.search(n,app.Events.SearchEvents.SearchCompleted)}},t.prototype.addOrRemoveParcel=function(n){if(n.Selected)this.enerGovArcGisParcelSearchService.parcels.push(n);else{var t=this.enerGovArcGisParcelSearchService.parcels.indexOf(n);this.enerGovArcGisParcelSearchService.parcels.splice(t,1)}},t.prototype.addSelectedParcels=function(){var n=this,t={PageNumber:1,PageSize:1,ParcelNumber:n.enerGovArcGisParcelSearchService.parcels[0].ParcelNumber,ReturnAll:!1};n.searchAddressCriteria=t;n.parcelList=this.enerGovArcGisParcelSearchService.parcels;n.parcelList.forEach(function(n){n.Associated=n.ParcelNumber});n.disableAddParcels=!0;n.eventService.on("disableAddParcel",function(t,i){n.disableAddParcels=i[0];n.parcelList=null})},t}(app.Common.Controllers.PagedSearchController);n.EnerGovArcGisParcelSearchController=t})(t=n.Address||(n.Address={}))}(EnerGov||(EnerGov={}));__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){"use strict";var i=function(t){function i(n,i,r,u,f,e,o){var s=t.call(this,n,i,r,u,null,!1)||this;return s.enerGovAssociatedAddressSearchService=u,s.eventService=f,s.enerGovAddressCardsService=e,s.enerGovEntityParcelSearchService=o,s.showAssociatedAddresses=!1,s.disableAddParcel=!1,s.disableAssociateAddressClick=!1,s.searchingAssociatedAddresses=!1,s.associatedParcelList=null,s.addressess=[],s.useRelationalLiveLink=!1,s.ParcelAddressArray=[],s}return __extends(i,t),i.prototype.cancel=function(){this.showAssociatedAddresses=!1;this.disableAddParcel=!1;this.eventService.boradcast("disableAddParcel",this.disableAddParcel)},i.prototype.addOrRemoveParcel=function(n){if(n.Selected)this.enerGovEntityParcelSearchService.parcels.push(n);else{var t=this.enerGovEntityParcelSearchService.parcels.indexOf(n);this.enerGovEntityParcelSearchService.parcels.splice(t,1)}},i.prototype.addOrRemoveAddress=function(n){var t,i,r,u;this.ParcelAddressArray[this.currentParcelId]===undefined&&(this.ParcelAddressArray[this.currentParcelId]=[]);n.Selected?(this.ParcelAddressArray[this.currentParcelId].push(n.Address),this.addressess.push(n)):(t=this.ParcelAddressArray[this.currentParcelId].filter(function(t){return t==n.Address}),i=this.ParcelAddressArray[this.currentParcelId].indexOf(t[0]),this.ParcelAddressArray[this.currentParcelId].splice(i,1),r=this.addressess.filter(function(t){return t.Address==n.Address}),u=this.addressess.indexOf(r[0]),this.addressess.splice(u,1))},i.prototype.addSelected=function(){var t=this,t=this,r="",u="",i;angular.forEach(t.addressess,function(i){var f=t.createNewLocationCard();f.Associated=i.Associated;f.FormattedAddressString=i.Address;n.Map.Helper.mapArcGisAddressFieldToEnergovAddressField(f,i.AddressFields);angular.forEach(i.AddressFields,function(n){switch(n.FieldName){case"RelationshipColumn":t.useRelationalLiveLink=!0;r=n.FieldValue;break;case"GISAddressID":u=n.FieldValue}});t.enerGovAddressCardsService.addAddress(f)});i=[];angular.forEach(t.enerGovEntityParcelSearchService.parcels,function(n){var r=t.createNewLocationCard();r.IsParcel=!0;r.ParcelNumber=n.ParcelNumber;r.Section=n.Section;r.Range=n.Range;r.Township=n.Township;r.Associated=n.ParcelNumber;i.push(r)});t.enerGovAddressCardsService.addLocations(i);t.enerGovAddressCardsService.returnFromAddAddress=!0;t.enerGovAddressCardsService.selectedAddressType=this.enerGovAddressCardsService.locationAddressType;t.$location.url(t.enerGovAddressCardsService.returnToUrl)},i.prototype.setSearchCriteria=function(n){this.disableAssociateAddressClick=!0;var t={PageSize:this.searchCriteria.PageSize,PageNumber:1,ParcelNumber:n};this.currentParcelId=n;this.searchCriteria=t;this.search(t,app.Events.SearchEvents.SearchCompleted)},i.prototype.search=function(n,t){var r=this,i=this;this.showAssociatedAddresses=!1;i.searchEvent=app.Events.SearchEvents.SearchStart;this.enerGovAssociatedAddressSearchService.searchByCriteria(n,function(n){i.searchResult=n.Result;var u=i.searchResult.length;angular.forEach(i.searchResult,function(n){n.Associated=i.currentParcelId});angular.forEach(i.ParcelAddressArray[r.currentParcelId],function(n){for(var t=0;t<u;t++)if(n===i.searchResult[t].Address){i.searchResult[t].Selected=!0;break}});i.totalFound=n.TotalFound;i.totalPages=n.PageCount;i.currentPage=i.searchCriteria.PageNumber;t===app.Events.SearchEvents.SearchCompleted&&(i.searchEvent=app.Events.SearchEvents.SearchCompleted);t===app.Events.SearchEvents.PageLoadCompleted&&(i.searchEvent=app.Events.SearchEvents.PageLoadCompleted);t===app.Events.SearchEvents.SortCompleted&&(i.searchEvent=app.Events.SearchEvents.SortCompleted);r.showAssociatedAddresses=!0;r.disableAssociateAddressClick=!1})},i.prototype.addSelectedParcels=function(){var n=this;angular.forEach(n.enerGovEntityParcelSearchService.parcels,function(t){var i=n.createNewLocationCard();i.IsParcel=!0;i.ParcelNumber=t.ParcelNumber;i.Section=t.Section;i.Range=t.Range;i.Township=t.Township;n.enerGovAddressCardsService.addAddress(i);n.enerGovAddressCardsService.returnFromAddAddress=!0;n.$location.path(n.enerGovAddressCardsService.returnToUrl)})},i.prototype.createNewLocationCard=function(){return{ParentAddressID:"",ParentID:"",MailingAddressID:"",CountryType:0,AddressType:"",Main:!1,AddressLine1:"",AddressLine2:"",AddressLine3:"",City:"",State:"",County:"",Country:"",PostalCode:"",PreDirection:"",PostDirection:"",StreetType:"",ParcelID:"",ParcelNumber:"",ParcelAddressID:"",RowVersion:0,LastChangedOn:null,LastChangedBy:"",AddressDisplay:"",UnitOrSuite:"",Province:"",POBox:"",CompSite:"",RuralRoute:"",Station:"",ATTN:"",AddressSystemType:"",GeneralDelivery:!1,Section:"",Range:"",Township:"",IsParcel:!1,IsNew:!1,IsDeleted:!1,ClientId:"",Associated:"",GisAddressId:"",FormattedAddressString:""}},i.prototype.searchAssociatedAddresses=function(n){var t=this,i;n!==undefined&&(t.showAssociatedAddresses=!1,t.searchingAssociatedAddresses=!0,i={PageSize:this.searchCriteria.PageSize,PageNumber:1,ParcelNumber:n[0].ParcelNumber},t.currentParcelId=n[0].ParcelNumber,t.associatedParcelList=n,t.searchCriteria=i,t.search(i,app.Events.SearchEvents.SearchCompleted),t.searchingAssociatedAddresses=!1,t.showAssociatedAddresses=!0)},i}(app.Common.Controllers.PagedSearchController);t.EnerGovAssociatedAddressSearchController=i})(t=n.Address||(n.Address={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f){var e=n.call(this,t,i,r,u,null,!1)||this,o=e,s=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(i,t.id),h=window.location.href.indexOf("permit")>-1?"permit":"plan";return e.criteria={PageNumber:1,PageSize:r.pageSizeList[0].Value,SortField:e.sortField,IsSortedInAscendingOrder:!0,ModuleId:s,EntityId:t.id},window.entityRecordsSortSecondaryData===null||typeof entityRecordsSortSecondaryData=="undefined"?f.getEntityRecordSortSecondaryData(function(n){o.sortList=n.Result.EntityAddressSearchSortList;o.sortField=n.Result.EntityAddressSearchSortList[0].Value;window.entityRecordsSortSecondaryData=n.Result}):(o.sortList=window.entityRecordsSortSecondaryData.EntityAddressSearchSortList,o.sortField=window.entityRecordsSortSecondaryData.EntityAddressSearchSortList[0].Value),n.call(this,t,i,r,u,e.criteria)||this}return __extends(t,n),t}(app.Common.Controllers.PagedSearchController);n.EnerGovEntityAddressSearchController=t})(t=n.Address||(n.Address={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f,e,o,s){var h=n.call(this,null)||this,c,l;return h.$routeParams=t,h.$location=i,h.$modal=r,h.globalService=u,h.enerGovEntityLocationsService=f,h.entitySecondaryDataService=e,h.entityTabsService=o,h.resourceService=s,h.viewItem=null,h.isLocationListEmpty=!1,h.locationCards=[],h.sortList=[],h.errorMessage="",c=h,l=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(i,t.id),h.criteria={PageNumber:1,PageSize:u.pageSizeList[0].Value,SortField:null,IsSortedInAscendingOrder:!0,ModuleId:l,EntityId:t.id},h.entitySecondaryDataService.getEntityRecordSortSecondaryData(function(n){h.sortList=n.Result.EntityLocationSortList;h.sortProperty=n.Result.EntityLocationSortList[0].Value;h.enerGovEntityLocationsService.getEntityLocationByCriteria(h.criteria,function(n){n.Success?(h.locationCards=n.Result,h.isLocationListEmpty=h.locationCards===null||h.locationCards.length===0,h.sortLocations()):n.StatusCode===app.Common.Services.HttpStatusCode.Forbidden?c.entityTabsService.showLocationsTab=!1:n.StatusCode===app.Common.Services.HttpStatusCode.NoContent?c.$routeParams.tab&&c.$routeParams.tab==app.Constants.TabConstants.Locations?(c.entityTabsService.setAdditionalEntityTabsVisibility(c.$routeParams.tab,c.entityTabsService.showLocationsTab),h.resourceService.getSpecificKeyValues("SelfService.Resources.SelfService",["LocationNotLoadedErrorMessage"],function(n){h.errorMessage=n.LocationNotLoadedErrorMessage})):c.entityTabsService.setFirstTabOnHidingOtherTabs():h.errorMessage=n.ErrorMessage})}),h}return __extends(t,n),t.prototype.sortLocations=function(){if(this.locationCards!==null)switch(this.sortProperty){case"MAIN":this.locationCards=this.locationCards.sort(function(n,t){return n.Address!==null&&n.Address.Main?t.Address!==null&&t.Address.Main?0:-1:t.Address!==null&&t.Address.Main?1:n.Parcel!==null&&n.Parcel.Main?t.Parcel!==null&&t.Parcel.Main?0:-1:t.Parcel!==null&&t.Parcel.Main?1:0});break;case"ADDRESS":this.locationCards=this.locationCards.sort(function(n,t){return n.Address!==null&&t.Address!==null?n.Address.AddressLine1.localeCompare(t.Address.AddressLine1):n.Address===null?1:-1});break;case"PARCEL.PARCELNUMBER":this.locationCards=this.locationCards.sort(function(n,t){return n.Parcel!==null&&t.Parcel!==null?n.Parcel.ParcelNumber.localeCompare(t.Parcel.ParcelNumber):n.Parcel===null?1:-1});break;case"TYPE":this.locationCards=this.locationCards.sort(function(n,t){return n.Address!==null&&t.Address!==null?n.Address.AddressType.localeCompare(t.Address.AddressType):n.Address===null?1:-1})}},t.prototype.showAdditionalInfo=function(n){this.viewItem=n;angular.element("#ParcelAdditionalInfo").modal("show")},t.prototype.closeAdditionalInfo=function(){angular.element("#ParcelAdditionalInfo").modal("hide")},t}(app.Core.Controllers.CoreController);n.EnerGovEntityLocationsController=t})(t=n.Address||(n.Address={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f){var e=n.call(this,t,i,r,u,null,!1)||this,o=e,s=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(i,t.id);return e.criteria={PageNumber:1,PageSize:r.pageSizeList[0].Value,SortField:e.sortField,IsSortedInAscendingOrder:!0,ModuleId:s,EntityId:t.id},window.entityRecordsSortSecondaryData===null||typeof entityRecordsSortSecondaryData=="undefined"?f.getEntityRecordSortSecondaryData(function(n){o.sortList=n.Result.EntityParcelSearchSortList;o.sortField=n.Result.EntityParcelSearchSortList[0].Value;window.entityRecordsSortSecondaryData=n.Result}):(o.sortList=window.entityRecordsSortSecondaryData.EntityParcelSearchSortList,o.sortField=window.entityRecordsSortSecondaryData.EntityParcelSearchSortList[0].Value),n.call(this,t,i,r,u,e.criteria)||this}return __extends(t,n),t}(app.Common.Controllers.PagedSearchController);n.EnerGovEntityParcelSearchController=t})(t=n.Address||(n.Address={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){"use strict";var i=n.Address.Services.EnerGovAddressCardsService,r=n.Address.Services.EnerGovAddressService,u=n.Address.EnerGovAddressCardsController,f=n.Address.EnerGovAddressManualApplyController,e=n.Address.EnerGovEntityAddressSearchController,o=n.Address.EnerGovEntityLocationsController,s=n.Address.Services.EnerGovEntityLocationsService,h=n.Address.Services.EnerGovEntityAddressSearchService,c=n.Address.Services.EnerGovEntityParcelSearchService,l=n.Address.Services.EnerGovAssociatedAddressSearchService;angular.module("enerGov.Address",["app.globalsModule","app.Common.Services","enerGov.Common","ui.bootstrap.typeahead","app.Common.Services.TenantSettingsService"]).service("enerGovAddressCardsService",["http","enerGovAddressService","localStorageService","$location","$http","$q","globalsService","$timeout","mapApplyService","enerGovEntityHoldSearchService",i]).service("enerGovEntityAddressSearchService",["http","userService",h]).service("enerGovEntityLocationsService",["http","userService",s]).service("enerGovEntityParcelSearchService",["http","userService",c]).service("enerGovAddressService",["http","$http","globalsService","$q",r]).service("enerGovAssociatedAddressSearchService",["http",l]).service("enerGovArcGisParcelSearchService",["http","eventService",n.Address.Services.EnerGovArcGisParcelSearchService]).controller("enerGovAddressCardsController",["$scope","$routeParams","$location","enerGovAddressCardsService","enerGovAddressService","tenantSettingService","$q","mapService","mapApplyService",u]).controller("enerGovAddressManualApplyController",["$scope","$routeParams","$location","globalsService","$q","enerGovAddressCardsService","enerGovAddressService","userService","tenantSettingService","tenantService",f]).controller("enerGovEntityAddressSearchController",["$routeParams","$location","globalsService","enerGovEntityAddressSearchService","entitySecondaryDataService","$window","$sce",e]).controller("enerGovEntityLocationsController",["$routeParams","$location","$modal","globalsService","enerGovEntityLocationsService","entitySecondaryDataService","entityTabsService","resourceService","$window","$sce",o]).controller("enerGovEntityParcelSearchController",["$routeParams","$location","globalsService","enerGovEntityParcelSearchService","entitySecondaryDataService","$window","$sce",t.EnerGovEntityParcelSearchController]).controller("enerGovArcGisParcelSearchController",["$routeParams","$location","globalsService","enerGovArcGisParcelSearchService","enerGovAddressCardsService","eventService",n.Address.EnerGovArcGisParcelSearchController]).controller("enerGovAssociatedAddressSearchController",["$routeParams","$location","globalsService","enerGovAssociatedAddressSearchService","eventService","enerGovAddressCardsService","enerGovArcGisParcelSearchService",t.EnerGovAssociatedAddressSearchController])})(t=n.Address||(n.Address={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.estimatedFees=[];this.showWorkClass=!1;this.showSquareFeet=!1;this.showValuation=!1;this.permitSaveInProgress=!1;this.rootUrl="/energov/permits/";var t=this;t.setDefaultStates()}return n.prototype.totalEstimatedFee=function(){var n=0;return angular.forEach(this.estimatedFees,function(t){n=n+t.ComputedAmount}),n},n.prototype.getNewPermit=function(n,t,i){var r={PermitTypeID:n,PermitWorkClassID:t};this.http.post(this.rootUrl+"new",r,function(n){i(n.Result)})},n.prototype.savePermit=function(n,t){this.http.post(this.rootUrl+"save",n,function(n){t(n)})},n.prototype.createInvoice=function(n,t){this.http.post(this.rootUrl+"create-invoice",n,function(n){t(n)})},n.prototype.getPermitEstimateFees=function(n,t){var i=this;this.estimatedFees=[];this.http.post(this.rootUrl+"estimatedfees",n,function(n){n.Success&&(i.estimatedFees=n.Result,t(n.Result))})},n.prototype.setDefaultStates=function(){this.model={permitId:"",PermitTypeID:"",PermitWorkClassID:"",PermitNumber:"",InternetApplicationTypeId:0,Description:"",ValuationValue:null,SquareFeet:null,Addresses:[],GISFeatures:[],Contacts:[],Attachments:[],Parcels:[],CustomFields:[],CustomFieldLayoutID:"",CustomLayout:null,IsRequiredDescription:!1,IsRequiredSquareFeet:!1,IsRequiredValuation:!1,IsWorkflowActionPersistent:!1,IsWorkflowActionOptional:!1,WorkflowTemplateId:"",WorkflowTemplateActionId:"",WfActionData:null,ParentEntityId:"",ObjectID:"",ActionRowVersion:0,ObjectStatusID:0,IsSubPermitFromPermit:!1,IsSubPermitFromPlan:!1,IsNew:!0,IsDeleted:!1,ClientId:"",ERProjects:[],Projects:null,FeeTemplateId:"",IsApplyOnline:!0,EntityId:null,IsRenewal:!1,ModuleId:null,Holds:[],ERFileSubmissionQueueID:""};this.secondaryData=null;this.selectedType=null;this.selectedWorkClass=null;this.selectedTypeItems=[];this.showMoreInfoStep=!0;this.permitSaveInProgress=!1},n}();n.EnerGovApplyPermitService=t})(t=n.Services||(n.Services={}))})(t=n.Permit||(n.Permit={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r){this.http=n;this.menuService=t;this.entityTabsService=i;this.$routeParams=r;this.rootUrl="/energov/entity/permits/search/search"}return n.prototype.searchByCriteria=function(n,t){var i=this;this.http.post(this.rootUrl,n,function(n){n&&n.Success&&n.Result?(n.Result.map(function(n){return n.ModuleName=n.ModuleId==app.Common.SelfServiceModules.Permit?"permit":"plan",n}),i.entityTabsService.showSubRecordsTab=!0,i.entityTabsService.subRecordsHasData=!0,i.$routeParams.tab&&i.$routeParams.tab==app.Constants.TabConstants.Subrecords&&i.entityTabsService.getSelectedTabForEntityTabs()!=app.Constants.TabConstants.Subrecords?i.entityTabsService.setAdditionalEntityTabsVisibility(i.$routeParams.tab,i.entityTabsService.showSubRecordsTab):i.entityTabsService.setFirstTabOnHidingOtherTabs()):(n.StatusCode===app.Common.Services.HttpStatusCode.NoContent||n.StatusCode===app.Common.Services.HttpStatusCode.Forbidden?i.entityTabsService.showSubRecordsTab=!1:n.StatusCode===app.Common.Services.HttpStatusCode.PreconditionFailed&&(i.entityTabsService.showSubRecordsTab=!0),i.entityTabsService.subRecordsErrorMessage==""&&n.ErrorMessage!=""&&(i.entityTabsService.subRecordsErrorMessage=n.ErrorMessage),i.$routeParams.tab&&i.$routeParams.tab==app.Constants.TabConstants.Subrecords?i.entityTabsService.setAdditionalEntityTabsVisibility(i.$routeParams.tab,i.entityTabsService.showSubRecordsTab):i.entityTabsService.setFirstTabOnHidingOtherTabs());t(n)},!1)},n}();n.EnerGovEntitySubPermitSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Permit||(n.Permit={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/permits/search/"}return n.prototype.getSecondaryData=function(n){this.http.get(this.rootUrl+"setup",function(t){t.Success&&n(t.Result)},!1)},n.prototype.getCriteria=function(n){this.http.get(this.rootUrl+"criteria",function(t){t.Success&&n(t.Result)},!1)},n.prototype.search=function(n,t){this.http.post(this.rootUrl,n,function(n){n.Success&&t(n)},null)},n}();n.EnerGovPermitSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Permit||(n.Permit={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){var i;(function(t){"use strict";var i=function(){function t(n,t){this.http=n;this.userService=t;this.rootUrl="/energov/permits/"}return t.prototype.getById=function(n,t){var i;i="/energov/permits/"+n;this.http.get(i,function(n){n.Success&&t(n.Result)},!1)},t.prototype.getPermitStatus=function(n){var t;t=this.rootUrl+"permit/status";this.http.get(t,function(t){t.Success?n(t.Result):n(null)},!1)},t.prototype.getPermit=function(n,t){var i;i="/energov/permits/permit/"+n;this.http.get(i,function(n){n.Success&&t(n.Result)},!1)},t.prototype.getPermitDetail=function(t,i){var r,u;r="/energov/permits/permitdetail";u={EntityId:t,ModuleId:n.Search.Controllers.AuthorizationModules.Permit};this.http.post(r,u,function(n){i(n.Result)},!1)},t.prototype.getSecondaryData=function(n,t){var i=this;this.http.get(this.rootUrl+"setup/"+n,function(n){n.Success&&(i.permitSecondaryData=n.Result,t(n.Result))},!1)},t.prototype.getContactTypeData=function(n,t,i){this.http.get(this.rootUrl+"setup/contact/"+n+"/"+t,function(n){n.Success&&i(n.Result)},!1)},t.prototype.getSoftwarePackageSettings=function(n){this.http.get("/tenantSettings/SoftwarePackageSettings",function(t){t.Success&&n(t.Result)},!1,{settingName:"UseCustomMappingsForPermitsTypesAndClasses"})},Object.defineProperty(t.prototype,"secondaryData",{get:function(){return this.permitSecondaryData},enumerable:!0,configurable:!0}),t.prototype.checkUserAssociatedWithPermit=function(n,t){var i=this.rootUrl+"/user-permit-contact-association/"+n;this.http.get(i,function(n){t(n.Result)},!1)},t}();t.EnerGovPermitService=i})(i=t.Services||(t.Services={}))})(t=n.Permit||(n.Permit={}))}(EnerGov||(EnerGov={}));__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)}}();__assign=this&&this.__assign||function(){return __assign=Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i<u;i++){t=arguments[i];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},__assign.apply(this,arguments)},function(n){var t;(function(n){"use strict";var t=function(n){function t(t,i,r,u,f,e){var o=n.call(this,t,i,r,u,null,!1)||this;return o.enerGovEntitySubPermitSearchService=u,o.entitySecondaryDataService=f,o.entityTabsService=e,o}return __extends(t,n),t.prototype.init=function(){var n=this,i=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(n.$location,n.$routeParams.id),t={PageNumber:1,PageSize:n.globalService.pageSizeList[0].Value,SortField:"",IsSortedInAscendingOrder:!0,ModuleId:app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(n.$location,n.$routeParams.id),EntityId:n.$routeParams.id};n.entitySecondaryDataService.getEntityRecordSortSecondaryData(function(t){n.sortList=t.Result.EntityExistingSubPermitSearchSortList;n.sortField=t.Result.EntityExistingSubPermitSearchSortList[0].Value});this.search(t,app.Events.SearchEvents.SearchCompleted)},t.prototype.search=function(n,t){this.criteria=__assign({IsExistingSubRecord:!0,CaseTypeWorkClassList:null,OptionalSubRecordsCaseTypeWorkClassList:null},n);var i=this;i.searchResult=[];i.totalFound=0;i.totalPages=0;i.currentPage=0;i.searchEvent=app.Events.SearchEvents.SearchStart;this.searchService.searchByCriteria(this.criteria,function(n){n.Success?(i.searchResult=n.Result,i.totalFound=n.TotalFound,i.totalPages=n.PageCount,i.currentPage=i.searchCriteria.PageNumber):(n.StatusCode==app.Common.Services.HttpStatusCode.PreconditionFailed||n.StatusCode==app.Common.Services.HttpStatusCode.NoContent||n.StatusCode==app.Common.Services.HttpStatusCode.Forbidden)&&(i.errorMessage=n.ErrorMessage);t===app.Events.SearchEvents.SearchCompleted&&(i.searchEvent=app.Events.SearchEvents.SearchCompleted);t===app.Events.SearchEvents.PageLoadCompleted&&(i.searchEvent=app.Events.SearchEvents.PageLoadCompleted);t===app.Events.SearchEvents.SortCompleted&&(i.searchEvent=app.Events.SearchEvents.SortCompleted);i.searchResult!==undefined&&i.searchResult.length===0&&i.searchCriteria.PageNumber!==1&&(i.searchCriteria.PageNumber=i.searchCriteria.PageNumber-1,i.search(i.searchCriteria,t))})},t}(app.Common.Controllers.PagedSearchController);n.EnerGovEntityExistingSubPermitSearchController=t})(t=n.Permit||(n.Permit={}))}(EnerGov||(EnerGov={}));__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){"use strict";var i=n.Common.CaseTypeUseEnums.MenuActionType,r=function(n){function t(t,r,u,f,e,o,s,h,c,l,a,v){var y=n.call(this,t,r,u,f,null,!1)||this;return y.enerGovEntitySubPermitSearchService=f,y.entitySecondaryDataService=e,y.enerGovSubrecordApplyService=o,y.locationService=s,y.enerGovPermitService=h,y.resourceService=c,y.userService=l,y.$q=a,y.entityTabsService=v,y.isSubPermitBusy=!0,y.resumeDraft=function(n,t){n.indexOf("?")>=0?y.$location.url(n.split("?")[0]+t+"/"+i.Apply.toString()+"?"+n.split("?")[1]):y.$location.url(n+t+"/"+i.Apply.toString())},y}return __extends(t,n),t.prototype.init=function(){var t=this,n=this;n.moduleId=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(n.$location,n.$routeParams.id);this.criteria={PageNumber:1,PageSize:n.globalService.pageSizeList[0].Value,SortField:"",IsSortedInAscendingOrder:!0,ModuleId:n.moduleId,EntityId:n.$routeParams.id,IsExistingSubRecord:!1,CaseTypeWorkClassList:null,OptionalSubRecordsCaseTypeWorkClassList:null};this.search(this.criteria,app.Events.SearchEvents.SearchCompleted);this.entitySecondaryDataService.entityAttachmentDefer.promise.then(function(){t.isSubPermitBusy=!1})},t.prototype.setErrorMessageForSubRecordsTab=function(){var n=this;return n.entityTabsService.subRecordsErrorMessage!=""&&(n.errorMessage=n.entityTabsService.subRecordsErrorMessage),n.errorMessage},t.prototype.apply=function(n){var r=this,t=this;if(t.enerGovSubrecordApplyService.resetSubrecordInfo(),n.MenuId!=null)if(n.LoadingParentInfo=!0,n.ModuleId==app.Common.SelfServiceModules.Permit)switch(t.moduleId){case app.Common.SelfServiceModules.Permit:t.enerGovSubrecordApplyService.getSubrecordApplyData(t.$routeParams.id,app.Common.SelfServiceModules.Permit,function(u){var f,e;t.enerGovSubrecordApplyService.subrecordApplyInfo=u;t.enerGovSubrecordApplyService.subrecordApplyInfo.Holds=u.Holds;t.enerGovSubrecordApplyService.subrecordApplyInfo.WorkflowActionId=n.WorkflowActionId;t.enerGovSubrecordApplyService.subrecordApplyInfo.WorkflowStatusId=n.WorkflowStatusId;t.enerGovSubrecordApplyService.subrecordApplyInfo.VersionNumber=n.VersionNumber;t.enerGovSubrecordApplyService.subrecordApplyInfo.IsWorkflowActionPersistent=n.IsWorkflowActionPersistent;t.enerGovSubrecordApplyService.subrecordApplyInfo.IsWorkflowActionOptional=n.IsWorkflowActionOptional;t.enerGovSubrecordApplyService.subrecordApplyInfo.WorkflowTemplateId=n.WorkflowTemplateId;t.enerGovSubrecordApplyService.subrecordApplyInfo.WorkflowTemplateActionId=n.WorkflowTemplateActionId;t.enerGovSubrecordApplyService.subrecordApplyInfo.ParentEntityId=t.$routeParams.id;t.enerGovSubrecordApplyService.subrecordApplyInfo.IsSubPermitFromPermit=!0;t.enerGovSubrecordApplyService.subrecordApplyInfo.WfActionData={WfActionId:n.WorkflowActionId,WfActionStatusId:0,ActionRowVersion:n.WorkflowActionRowVersion,WfStepId:n.EntityWFStepId,WfStepStatusId:n.EntityWFStepStatusId,StepRowVersion:n.EntityWFStepRowVersion};f=[];angular.forEach(t.enerGovSubrecordApplyService.subrecordApplyInfo.Contacts,function(n){f.push(n.GlobalEntityID)});f.length>0?(e={CaseId:t.$routeParams.id,CaseModule:t.moduleId,ContactTypeIds:[]},t.enerGovSubrecordApplyService.getSubrecordContactsData(e,function(u){r.$q.when(u).then(function(){u.ContactResults.length>0?(t.enerGovSubrecordApplyService.contactCardInfoResult=u,t.$location.url("/permit/apply/"+n.MenuId+"/0/"+i.Apply.toString())):t.$location.url("/permit/apply/"+n.MenuId+"/0/"+i.Apply.toString())})})):t.$location.url("/permit/apply/"+n.MenuId+"/0/"+i.Apply.toString())});break;case app.Common.SelfServiceModules.Plan:t.enerGovSubrecordApplyService.getSubrecordApplyData(t.$routeParams.id,app.Common.SelfServiceModules.Plan,function(u){var f,e;t.enerGovSubrecordApplyService.subrecordApplyInfo=u;t.enerGovSubrecordApplyService.subrecordApplyInfo.Holds=u.Holds;t.enerGovSubrecordApplyService.subrecordApplyInfo.WorkflowActionId=n.WorkflowActionId;t.enerGovSubrecordApplyService.subrecordApplyInfo.WorkflowStatusId=n.WorkflowStatusId;t.enerGovSubrecordApplyService.subrecordApplyInfo.VersionNumber=n.VersionNumber;t.enerGovSubrecordApplyService.subrecordApplyInfo.IsWorkflowActionPersistent=n.IsWorkflowActionPersistent;t.enerGovSubrecordApplyService.subrecordApplyInfo.IsWorkflowActionOptional=n.IsWorkflowActionOptional;t.enerGovSubrecordApplyService.subrecordApplyInfo.WorkflowTemplateId=n.WorkflowTemplateId;t.enerGovSubrecordApplyService.subrecordApplyInfo.WorkflowTemplateActionId=n.WorkflowTemplateActionId;t.enerGovSubrecordApplyService.subrecordApplyInfo.ParentEntityId=t.$routeParams.id;t.enerGovSubrecordApplyService.subrecordApplyInfo.IsSubPermitFromPlan=!0;t.enerGovSubrecordApplyService.subrecordApplyInfo.WfActionData={WfActionId:n.WorkflowActionId,WfActionStatusId:0,ActionRowVersion:n.WorkflowActionRowVersion,WfStepId:n.EntityWFStepId,WfStepStatusId:n.EntityWFStepStatusId,StepRowVersion:n.EntityWFStepRowVersion};f=[];angular.forEach(t.enerGovSubrecordApplyService.subrecordApplyInfo.Contacts,function(n){f.push(n.GlobalEntityID)});f.length>0?(e={CaseId:t.$routeParams.id,CaseModule:t.moduleId,ContactTypeIds:[]},t.enerGovSubrecordApplyService.getSubrecordContactsData(e,function(u){r.$q.when(u).then(function(){u.ContactResults.length>0?(t.enerGovSubrecordApplyService.contactCardInfoResult=u,t.$location.url("/permit/apply/"+n.MenuId+"/0/"+i.Apply.toString())):t.$location.url("/permit/apply/"+n.MenuId+"/0/"+i.Apply.toString())})})):t.$location.url("/permit/apply/"+n.MenuId+"/0/"+i.Apply.toString())})}else switch(t.moduleId){case app.Common.SelfServiceModules.Permit:t.enerGovSubrecordApplyService.getSubrecordApplyData(t.$routeParams.id,app.Common.SelfServiceModules.Permit,function(u){var f,e;t.enerGovSubrecordApplyService.subrecordApplyInfo=u;t.enerGovSubrecordApplyService.subrecordApplyInfo.Holds=u.Holds;t.enerGovSubrecordApplyService.subrecordApplyInfo.WorkflowActionId=n.WorkflowActionId;t.enerGovSubrecordApplyService.subrecordApplyInfo.WorkflowStatusId=n.WorkflowStatusId;t.enerGovSubrecordApplyService.subrecordApplyInfo.VersionNumber=n.VersionNumber;t.enerGovSubrecordApplyService.subrecordApplyInfo.IsWorkflowActionPersistent=n.IsWorkflowActionPersistent;t.enerGovSubrecordApplyService.subrecordApplyInfo.IsWorkflowActionOptional=n.IsWorkflowActionOptional;t.enerGovSubrecordApplyService.subrecordApplyInfo.WorkflowTemplateId=n.WorkflowTemplateId;t.enerGovSubrecordApplyService.subrecordApplyInfo.WorkflowTemplateActionId=n.WorkflowTemplateActionId;t.enerGovSubrecordApplyService.subrecordApplyInfo.ParentEntityId=t.$routeParams.id;t.enerGovSubrecordApplyService.subrecordApplyInfo.IsSubPlanFromPermit=!0;t.enerGovSubrecordApplyService.subrecordApplyInfo.WfActionData={WfActionId:n.WorkflowActionId,WfActionStatusId:0,ActionRowVersion:n.WorkflowActionRowVersion,WfStepId:n.EntityWFStepId,WfStepStatusId:n.EntityWFStepStatusId,StepRowVersion:n.EntityWFStepRowVersion};f=[];angular.forEach(t.enerGovSubrecordApplyService.subrecordApplyInfo.Contacts,function(n){f.push(n.GlobalEntityID)});f.length>0?(e={CaseId:t.$routeParams.id,CaseModule:t.moduleId,ContactTypeIds:[]},t.enerGovSubrecordApplyService.getSubrecordContactsData(e,function(u){r.$q.when(u).then(function(){u.ContactResults.length>0?(t.enerGovSubrecordApplyService.contactCardInfoResult=u,t.$location.url("/plan/apply/"+n.MenuId+"/0/"+i.Apply.toString())):t.$location.url("/plan/apply/"+n.MenuId+"/0/"+i.Apply.toString())})})):t.$location.url("/plan/apply/"+n.MenuId+"/0/"+i.Apply.toString())});break;case app.Common.SelfServiceModules.Plan:t.enerGovSubrecordApplyService.getSubrecordApplyData(t.$routeParams.id,app.Common.SelfServiceModules.Plan,function(u){var f,e;t.enerGovSubrecordApplyService.subrecordApplyInfo=u;t.enerGovSubrecordApplyService.subrecordApplyInfo.Holds=u.Holds;t.enerGovSubrecordApplyService.subrecordApplyInfo.WorkflowActionId=n.WorkflowActionId;t.enerGovSubrecordApplyService.subrecordApplyInfo.WorkflowStatusId=n.WorkflowStatusId;t.enerGovSubrecordApplyService.subrecordApplyInfo.VersionNumber=n.VersionNumber;t.enerGovSubrecordApplyService.subrecordApplyInfo.IsWorkflowActionPersistent=n.IsWorkflowActionPersistent;t.enerGovSubrecordApplyService.subrecordApplyInfo.IsWorkflowActionOptional=n.IsWorkflowActionOptional;t.enerGovSubrecordApplyService.subrecordApplyInfo.WorkflowTemplateId=n.WorkflowTemplateId;t.enerGovSubrecordApplyService.subrecordApplyInfo.WorkflowTemplateActionId=n.WorkflowTemplateActionId;t.enerGovSubrecordApplyService.subrecordApplyInfo.ParentEntityId=t.$routeParams.id;t.enerGovSubrecordApplyService.subrecordApplyInfo.IsSubPlanFromPlan=!0;t.enerGovSubrecordApplyService.subrecordApplyInfo.WfActionData={WfActionId:n.WorkflowActionId,WfActionStatusId:0,ActionRowVersion:n.WorkflowActionRowVersion,WfStepId:n.EntityWFStepId,WfStepStatusId:n.EntityWFStepStatusId,StepRowVersion:n.EntityWFStepRowVersion};f=[];angular.forEach(t.enerGovSubrecordApplyService.subrecordApplyInfo.Contacts,function(n){f.push(n.GlobalEntityID)});f.length>0?(e={CaseId:t.$routeParams.id,CaseModule:t.moduleId,ContactTypeIds:[]},t.enerGovSubrecordApplyService.getSubrecordContactsData(e,function(u){r.$q.when(u).then(function(){u.ContactResults.length>0?(t.enerGovSubrecordApplyService.contactCardInfoResult=u,t.$location.url("/plan/apply/"+n.MenuId+"/0/"+i.Apply.toString())):t.$location.url("/plan/apply/"+n.MenuId+"/0/"+i.Apply.toString())})})):t.$location.url("/plan/apply/"+n.MenuId+"/0/"+i.Apply.toString())})}},t}(app.Common.Controllers.PagedSearchController);t.EnerGovEntityRemainingSubPermitSearchController=r})(t=n.Permit||(n.Permit={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f){var e=n.call(this,null)||this,o;return e.$routeParams=t,e.$location=i,e.globalService=r,e.enerGovAddressCardsService=u,e.enerGovAddressService=f,o=e,o.backtoApplyLink=function(){e.enerGovAddressCardsService.returnFromAddAddress=!0;i.path(e.enerGovAddressCardsService.returnToUrl)},e}return __extends(t,n),t}(app.Core.Controllers.CoreController);n.EnerGovPermitAddressController=t})(t=n.Permit||(n.Permit={}))}(EnerGov||(EnerGov={}));__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){"use strict";var i=app.Common.Helpers.VersionSupport,u=n.Common.CaseTypeUseEnums.MenuActionType,f=n.Common.CaseTypeUseEnums.Module,e=n.Common.CaseTypeUseEnums.ProfileType,r=app.Common.SelfServiceModules,o=function(t){function o(i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d,g,nt,tt,it,rt,ut,ft,et,ot,st,ht,ct){var lt=t.call(this,i,r,u,f,e,o,s,h,c,l,a,v,y,b,d,p,tt,k,it,rt,null,ut,ft,et,ot,st,ht)||this,at,vt,pt,wt,yt,bt,kt;if(lt.$routeParams=i,lt.$location=r,lt.globalService=u,lt.menuService=f,lt.settingsService=e,lt.enerGovContactCardsService=o,lt.enerGovAddressCardsService=s,lt.enerGovAttachmentCardsService=h,lt.enerGovCustomFieldsService=c,lt.customFieldsService=l,lt.draftService=a,lt.enerGovPermitService=v,lt.enerGovApplyModuleService=y,lt.$q=p,lt.$filter=w,lt.enerGovSubrecordApplyService=b,lt.locationService=k,lt.userService=d,lt.scope=g,lt.mapApplyService=nt,lt.stepperService=tt,lt.eReviewsService=it,lt.eReviewAttachmentCardsService=rt,lt.caseTypeInstructionService=ut,lt.tylerSignaturePadService=ft,lt.enerGovTemplateService=et,lt.entitySignatureMetaDataService=ot,lt.$timeout=st,lt.attachmentCommonCardService=ht,lt.$sce=ct,lt.caseTypeUseEstimationOnly=n.Common.CaseTypeUseEnums.CaseTypeUse.EstimationOnly,lt.draftType=app.Constants.DraftType.Permit,at=lt,at.isPermitApply=!0,lt.stepperService.module=app.Common.SelfServiceModules.Permit,lt.enerGovAttachmentCardsService.hideActionColumnOnSummary=!0,at.scope.$watchCollection("vm.enerGovAttachmentCardsService.ereviewAttachments",at.attachmentCommonCardService.loadDataForCards),at.scope.$watchCollection("vm.attachmentCommonCardService.useFileCategoryForResubmission",function(){return at.attachmentCommonCardService.loadDataForCards(at.enerGovAttachmentCardsService.ereviewAttachments,null)}),lt.enerGovAddressCardsService.locationAddressType==null&&lt.userService.isUserLoggedIn)lt.enerGovAddressCardsService.getSecondaryDataAndSetAddressType();else if(lt.enerGovAddressCardsService.locationAddressType){if(nt.mapLocations.length>0&&s.buildLocationCardFromMap(nt.mapLocations),nt.mapSPCollections.length>0)for(vt=0,pt=nt.mapSPCollections;vt<pt.length;vt++)wt=pt[vt],lt.enerGovAddressCardsService.addSpatialCollection(wt);nt.resetMapApplyData()}return yt=new Date,lt.enerGovApplyModuleService.model.ApplicationDate=lt.isFeeEstimate?w("date")(Date.now(),app.Constants.GlobalConstants.DateFormatForSearch):new Date(w("date")(Date.now(),app.Constants.GlobalConstants.DateFormatForSearch)),lt.minDate=new Date(yt.getFullYear(),yt.getMonth(),yt.getDate()),lt.enerGovApplyModuleService.feeEstimator!=null&&(lt.enerGovApplyModuleService.model=lt.enerGovApplyModuleService.feeEstimator,lt.enerGovApplyModuleService.feeEstimator=null),at.isResumeDraft()||at.isFeeEstimate||at.enerGovApplyModuleService.model.ERProjects&&at.enerGovApplyModuleService.model.ERProjects.length!=0||(bt=lt.getTypeId(),kt=lt.getWorkClassId(),lt.enerGovApplyModuleService.getNewPermit(bt,kt,function(n){at.enerGovApplyModuleService.selectedType.CaseTypeInfo.EReviewsEnabled&&(at.enerGovApplyModuleService.model.ERProjects=n.ERProjects,at.eReviewsService.caseRequestInfo={Module:n.ModuleId,SubModule:0,CaseTypeId:n.PermitTypeID,WorkClassId:n.PermitWorkClassID,ERProjectId:n.ERProjects[0].ERProjectID,IsApply:!0},at.enerGovAttachmentCardsService.setExtReviewIntegrationTypeInfo(at.eReviewsService.caseRequestInfo,!0,at.$sce),at.enerGovAttachmentCardsService.ereviewFlowOptions.headers.UploadFolder=at.applyService.model.ERProjects[0].ERProjectID)})),lt}return __extends(o,t),Object.defineProperty(o.prototype,"fileProgressListCount",{get:function(){return this.enerGovAttachmentCardsService.fileProgressList?this.enerGovAttachmentCardsService.fileProgressList.length:0},enumerable:!0,configurable:!0}),o.prototype.openShowFilesModalOnSummary=function(n,t){this.attachmentCommonCardService.openShowFilesModal(n,t)},o.prototype.handleInactiveMenuItems=function(){var i=this.enerGovApplyModuleService.selectedTypeItems,n=this.enerGovApplyModuleService.secondaryData.PermitTypes,t=this;angular.forEach(i,function(i){for(var u,e=t.getTypeId(i),o=t.getWorkClassId(i),f=!1,r=0;r<n.length;r++)if(e===n[r].PermitTypeID)if(t.enerGovApplyModuleService.showWorkClass){f=!0;angular.forEach(i.SubMenus,function(i){for(var e=t.getWorkClassId(i),f=!1,u=0;u<n[r].WorkClassTemplates.length;u++)if(e===n[r].WorkClassTemplates[u].PermitWorkClassID){f=!0;break}f||t.subMenusToRemove.push(i.MenuID)});break}else for(u=0;u<n[r].WorkClassTemplates.length;u++)if(o===n[r].WorkClassTemplates[u].PermitWorkClassID){f=!0;break}f||t.menusToRemove.push(i.MenuID)})},o.prototype.setContactCertificateTypes=function(n){var t=this;n&&n.CertificationTypeList&&(this.enerGovContactCardsService.requireAllCertType=n.RequireAllCertType,this.enerGovContactCardsService.validateCertificationsForAllContacts=n.ValidateCertificationsForAllContacts,this.enerGovContactCardsService.certificationTypeIdList=[],n.CertificationTypeList.forEach(function(n){t.enerGovContactCardsService.certificationTypeIdList.push(n.SimpleLicenseCertTypeID)}))},o.prototype.getSelectedWorkClassSecondaryData=function(){var e=null,u,f,t,i,r,n;if(this.enerGovApplyModuleService==null||!this.enerGovApplyModuleService.secondaryData||this.enerGovApplyModuleService.selectedType==null||(u=this.getTypeId(),f=this.getWorkClassId(),u==null||f==null))return null;for(t=0;t<this.enerGovApplyModuleService.secondaryData.PermitTypes.length;t++)if(this.enerGovApplyModuleService.secondaryData.PermitTypes[t].PermitTypeID===u){for(i=0;i<this.enerGovApplyModuleService.secondaryData.PermitTypes[t].WorkClassTemplates.length;i++)if(this.enerGovApplyModuleService.secondaryData.PermitTypes[t].WorkClassTemplates[i].PermitWorkClassID===f){for(r=0;r<this.enerGovApplyModuleService.secondaryData.PermitTypes[t].WorkClassTemplates[i].ContactTypeList.length;r++){n=this.enerGovApplyModuleService.secondaryData.PermitTypes[t].WorkClassTemplates[i].ContactTypeList[r];this.contactType={ContactTypeId:n.LandManagementContactTypeID,Name:n.Name,IsRequired:n.IsRequired,GroupId:n.ContactTypeGroup,LandManagementContactSystemTypeID:n.LandManagementContactSystemTypeID,isFilled:!1,IsDefaultOnlineContactType:n.IsDefaultOnlineContactType,IsValidateLic:n.IsValidateLic,IsValidateBLLicense:n.IsValidateBLLicense,IsValidateILLicense:n.IsValidateILLicense,RequiredValidLic:!1};break}e=this.enerGovApplyModuleService.secondaryData.PermitTypes[t].WorkClassTemplates[i];break}break}return e},o.prototype.calculateEstimateFees=function(){var n,t;i(this.globalService.enerGovAPIVersion,"2016.3.0.151")==!0&&(n=this,n.enerGovApplyModuleService.model.PermitTypeID=n.getTypeId(),n.enerGovApplyModuleService.model.PermitWorkClassID=n.getWorkClassId(),t=n.getSelectedWorkClassSecondaryData(),t!=null&&(n.enerGovApplyModuleService.model.InternetApplicationTypeId=t.InternetApplyTypeID),n.enerGovApplyModuleService.model.FeeTemplateId=t.FeeTemplateID,n.enerGovApplyModuleService.model.CustomLayout=n.customFieldsService.customLayout,n.enerGovApplyModuleService.getPermitEstimateFees(n.enerGovApplyModuleService.model,function(){}))},o.prototype.getTypeIdFromPackageData=function(n){var t=JSON.parse(n);return t.PermitTypeID?t.PermitTypeID:null},o.prototype.getWorkClassIdFromPackageData=function(n){var t=JSON.parse(n);return t.PermitWorkClassID?t.PermitWorkClassID:null},o.prototype.checkSquareAndValuationBox=function(){var i,r,n,t;(this.enerGovApplyModuleService&&this.enerGovApplyModuleService.model&&(this.enerGovApplyModuleService.model.IsRequiredSquareFeet=!1,this.enerGovApplyModuleService.model.IsRequiredValuation=!1,this.enerGovApplyModuleService.model.IsRequiredDescription=!1,this.enerGovApplyModuleService.showSquareFeet=!1,this.enerGovApplyModuleService.showValuation=!1),this.enerGovApplyModuleService.selectedType!=null)&&(i=this.getTypeId(),r=this.getWorkClassId(),i!=null)&&(n=this.enerGovApplyModuleService.selectedTypeItems.filter(function(n){return n.CaseTypeInfo.PackageCaseTypeId===i&&n.CaseTypeInfo.PackageCaseClassId===r}),n!==null&&n.length>0&&(this.enerGovApplyModuleService.model.IsRequiredSquareFeet=n[0].CaseTypeInfo.SquareFootageRequired,this.enerGovApplyModuleService.model.IsRequiredValuation=n[0].CaseTypeInfo.ValuationRequired,this.enerGovApplyModuleService.model.IsRequiredDescription=n[0].CaseTypeInfo.DescriptionRequired),t=this.enerGovApplyModuleService.secondaryData.PermitTypes.filter(function(n){return n.PermitTypeID===i}),t!==null&&t.length>0&&(this.enerGovApplyModuleService.showSquareFeet=t[0].SquareFeet,this.enerGovApplyModuleService.showValuation=t[0].Valuation))},o.prototype.updateDraftPartialFromModel=function(n){return n.Description=this.enerGovApplyModuleService.model.Description,n.ValuationValue=this.enerGovApplyModuleService.model.ValuationValue,n.SquareFeet=this.enerGovApplyModuleService.model.SquareFeet,n},o.prototype.updateModelPartialFromFraft=function(n){var t=this;this.enerGovApplyModuleService.model.Description=n.Description;this.enerGovApplyModuleService.model.ValuationValue=n.ValuationValue;this.enerGovApplyModuleService.model.SquareFeet=n.SquareFeet;this.enerGovApplyModuleService.model.ObjectID=n.ObjectID;this.enerGovApplyModuleService.model.ActionRowVersion=n.ActionRowVersion;this.enerGovApplyModuleService.model.ObjectStatusID=n.ObjectStatusID;this.enerGovApplyModuleService.model.IsSubPermitFromPermit=n.IsSubPermitFromPermit;this.enerGovApplyModuleService.model.IsSubPermitFromPlan=n.IsSubPermitFromPlan;this.enerGovApplyModuleService.model.IsWorkflowActionPersistent=n.IsWorkflowActionPersistent;this.enerGovApplyModuleService.model.IsWorkflowActionOptional=n.IsWorkflowActionOptional;this.enerGovApplyModuleService.model.WorkflowTemplateId=n.WorkflowTemplateId;this.enerGovApplyModuleService.model.WorkflowTemplateActionId=n.WorkflowTemplateActionId;this.enerGovApplyModuleService.model.WfActionData=n.WfActionData;this.enerGovApplyModuleService.model.ParentEntityId=n.ParentEntityId;this.enerGovApplyModuleService.model.Projects=n.Projects;(n.IsSubPermitFromPermit||n.IsSubPermitFromPlan)&&(this.isSubRecordApply=!0,i(this.globalService.enerGovAPIVersion,"2021.2.0.0")?n.IsSubPermitFromPermit?this.enerGovSubrecordApplyService.getSubrecordApplyData(this.enerGovApplyModuleService.model.ParentEntityId,r.Permit,function(n){t.enerGovApplyModuleService.model.Holds=n.Holds}):this.enerGovSubrecordApplyService.getSubrecordApplyData(this.enerGovApplyModuleService.model.ParentEntityId,r.Plan,function(n){t.enerGovApplyModuleService.model.Holds=n.Holds}):this.enerGovApplyModuleService.model.Holds=[])},o.prototype.validateContacts=function(n){var t=this,i=t.$q.defer();return t.isPermitContactsValidationSuccess=!0,n.Label=="Contacts"&&t.isPermitApply?(t.enerGovContactCardsService.showPermitContactCertificationAlert=!1,t.enerGovContactCardsService.permitContactCertificationErrorMessage="",t.enerGovContactCardsService.validatePermitContacts(t.enerGovContactCardsService.validationModule,function(n){var r,u;if(n.Result!=null&&n.Result.length>0&&n.Success==!0){for(t.isPermitContactsValidationSuccess=!1,t.enerGovContactCardsService.showPermitContactCertificationAlert=!0,r="<p>"+n.Result[0].ErrorMessage,u=1;u<n.Result.length;u++)r+="<br/>"+n.Result[u].ErrorMessage;r+="<\/p>";t.enerGovContactCardsService.permitContactCertificationErrorMessage=r;i.resolve()}else i.resolve()})):i.resolve(),i.promise},o.prototype.saveFeeEstimator=function(){var n=this;n.enerGovApplyModuleService.feeEstimator={permitId:"",PermitTypeID:"",PermitWorkClassID:"",PermitNumber:"",InternetApplicationTypeId:0,Description:"",ValuationValue:null,SquareFeet:null,Addresses:[],GISFeatures:[],Contacts:[],Attachments:[],Parcels:[],CustomFields:[],CustomFieldLayoutID:"",CustomLayout:null,IsRequiredDescription:!1,IsRequiredSquareFeet:!1,IsRequiredValuation:!1,ObjectID:"",ActionRowVersion:0,ObjectStatusID:0,IsSubPermitFromPermit:!1,IsSubPermitFromPlan:!1,IsWorkflowActionPersistent:!1,IsWorkflowActionOptional:!1,WorkflowTemplateId:"",WorkflowTemplateActionId:"",WfActionData:null,ParentEntityId:"",IsNew:!0,IsDeleted:!1,ClientId:"",ERProjects:[],Projects:null,FeeTemplateId:"",EntityId:null,IsApplyOnline:!0,ModuleId:0,IsRenewal:!1,Holds:[],ERFileSubmissionQueueID:""};n.enerGovApplyModuleService.feeEstimatorCustomFields=[];n.enerGovApplyModuleService.feeEstimator.ValuationValue=n.enerGovApplyModuleService.model.ValuationValue;n.enerGovApplyModuleService.feeEstimator.SquareFeet=n.enerGovApplyModuleService.model.SquareFeet;n.customFieldsService.customLayout!==null&&(n.enerGovApplyModuleService.feeEstimator.CustomFieldLayoutID=n.customFieldsService.customLayout.PackageId,angular.forEach(n.customFieldsService.customLayout.CustomGroups,function(t){angular.forEach(t.CustomFields,function(t){t.Value!==null&&n.enerGovApplyModuleService.feeEstimatorCustomFields.push({CustomGroupId:t.CustomGroupId,CustomFieldId:t.CustomFieldId,Value:t.Value,CustomFieldTableRows:t.CustomFieldTableRows,Id:t.Id,SortOrder:t.SortOrder,FieldName:t.FieldName,CustomPickListItems:t.CustomPickListItems,PickListItems:t.PickListItems,IsPickList:t.IsPickList,FieldTypeId:t.FieldTypeId,PackageId:t.PackageId,CustomFieldTableColumnRefItems:t.CustomFieldTableColumnRefItems,CustomFieldTableCellType:t.CustomFieldTableCellType,IsTable:t.IsTable,IsFooter:t.IsFooter,Label:t.Label,IsRequired:t.IsRequired,IsReadOnly:t.IsReadOnly,IsSupportedType:t.IsSupportedType,DefaultValue:t.DefaultValue,typeData:t.typeData,DefaultTableRows:t.DefaultTableRows})})}));n.locationService.path("/permit/apply/"+n.enerGovApplyModuleService.selectedType.MenuID+"/0/"+u.Apply.toString());n.scope.$apply()},o.prototype.saveModule=function(){var u=this,n=this,t,r;n.enerGovApplyModuleService.permitSaveInProgress=!0;n.enerGovApplyModuleService.model.IsValid=n.permitWithContactValidCertificate;(n.enerGovApplyModuleService.model.IsWorkflowActionPersistent||n.enerGovApplyModuleService.model.IsWorkflowActionOptional)&&(r=n.enerGovApplyModuleService.model.IsSubPermitFromPermit?app.Common.SelfServiceModules.Permit:app.Common.SelfServiceModules.Plan,t=n.enerGovSubrecordApplyService.addAction(n.enerGovApplyModuleService.model.ParentEntityId,r,n.enerGovApplyModuleService.model.WorkflowTemplateId,n.enerGovApplyModuleService.model.WorkflowTemplateActionId,n.enerGovApplyModuleService.model.WfActionData.WfStepId,function(t){n.enerGovApplyModuleService.model.ObjectID=t;n.enerGovApplyModuleService.model.ObjectStatusID=0;n.enerGovApplyModuleService.model.WfActionData.WfActionId=t;n.enerGovApplyModuleService.model.WfActionData.ActionRowVersion=1}));n.$q.all([t]).then(function(){var o,t,r;n.enerGovApplyModuleService.model.Contacts=n.enerGovContactCardsService.saveContacts();n.enerGovApplyModuleService.model.Addresses=[];n.enerGovApplyModuleService.model.Addresses=$.grep(n.enerGovAddressCardsService.addressCards,function(n){return!n.IsParcel});n.enerGovApplyModuleService.model.Parcels=[];o=$.grep(n.enerGovAddressCardsService.addressCards,function(n){return n.IsParcel});angular.forEach(o,function(t){var i={ParentParcelID:"",ParcelID:"",ParentID:"",ParcelNumber:t.ParcelNumber,Section:t.Section,Range:t.Range,Township:t.Township,Main:t.Main,IsNew:!0,IsDeleted:!1,ClientId:""};n.enerGovApplyModuleService.model.Parcels.push(i)});t=n.enerGovAddressCardsService.locationCards.filter(function(n){return n.IsSpatialCollection});t.length>0&&(n.enerGovApplyModuleService.model.GISFeatures=t.map(function(n){return{ParentID:"",FeatureLayer:n.Geometry.type,AttributeField:"NAME",KeyValue:"",GISHistory_Module:f.PermitManagement,GISHistory_SpatialType:e.SpatialCollection,GeoJson:JSON.stringify(n.Geometry),IsNew:!0,IsDeleted:!1,ClientId:null}}));n.enerGovApplyModuleService.model.PermitTypeID=n.getTypeId();n.enerGovApplyModuleService.model.PermitWorkClassID=n.getWorkClassId();r=n.getSelectedWorkClassSecondaryData();r!=null&&(n.enerGovApplyModuleService.model.InternetApplicationTypeId=r.InternetApplyTypeID);n.enerGovApplyModuleService.model.Holds=[];(n.enerGovAddressCardsService.copyParcelHolds||n.enerGovContactCardsService.copyContactHolds)&&i(u.globalService.enerGovAPIVersion,"2021.2.0.0")&&(n.enerGovAddressCardsService.copyParcelHolds.length>0&&angular.forEach(n.enerGovAddressCardsService.copyParcelHolds,function(t){n.enerGovApplyModuleService.model.Holds.push(t)}),n.enerGovContactCardsService.copyContactHolds.length>0&&angular.forEach(n.enerGovContactCardsService.copyContactHolds,function(t){n.enerGovApplyModuleService.model.Holds.push(t)}));n.enerGovApplyModuleService.model.CustomLayout=n.customFieldsService.customLayout;n.enerGovAttachmentCardsService.showProgressBarDialog();n.enerGovAttachmentCardsService.uploadFileAttachments(function(t){if(n.enerGovApplyModuleService.model.Attachments=t,n.enerGovApplyModuleService.model.ERProjects&&n.enerGovApplyModuleService.model.ERProjects.length>0){var i=n.enerGovAttachmentCardsService.updateEReviewProjectModel(n.enerGovAttachmentCardsService.uploadedEReviewAttachments,n.enerGovApplyModuleService.model.ERProjects[0]);n.useFileCategoryForResubmission&&(i.EProjectFiles=[]);n.enerGovApplyModuleService.model.ERProjects=[i]}n.useFileCategoryForResubmission?n.createFileSubmissionQueue(n.enerGovAttachmentCardsService.uploadedEReviewAttachments,function(t,i){t&&(n.enerGovApplyModuleService.model.ERFileSubmissionQueueID=i,n.savePermitInfo())}):(n.enerGovApplyModuleService.model.ERFileSubmissionQueueID="",n.savePermitInfo())})})},o.prototype.savePermitInfo=function(){var n=this;n.enerGovApplyModuleService.savePermit(n.enerGovApplyModuleService.model,function(t){if(t.Success){var i=t.Result;n.createPermitInvoice(i);t.ErrorMessage&&(n.errorMessage=t.ErrorMessage,$("#showApplyError").modal("show"))}else n.enerGovAttachmentCardsService.closeProgressBarDialog()})},o.prototype.createPermitInvoice=function(t){var i=this;this.enerGovApplyModuleService.permitSaveInProgress=!1;this.enerGovApplyModuleService.createInvoice(t,function(t){i.saveSignatureToEnergov(n.Common.CaseTypeUseEnums.AgreementType.Permit,t,function(){!i.enerGovAttachmentCardsService.isERProjectSaveSupported()&&i.eReviewsService.ereviewsSecondaryData&&i.eReviewsService.isEnerGovEReviewEnable&&i.eReviewsService.isEReviewCaseType&&i.enerGovAttachmentCardsService.ereviewAttachments.length>0?(i.enerGovAttachmentCardsService.ereviewFlowOptions.headers.UploadFolder=t.Result.ERProjects[0].UploadFolder,i.enerGovAttachmentCardsService.uploadEReviewAttachments(function(r){i.eReviewsFileUploadCallback(r,t.Result,n.Common.CaseTypeUseEnums.FilterModule.Permit)})):i.afterSaveRedirection(n.Common.CaseTypeUseEnums.FilterModule.Permit,t.Result)})})},o.prototype.setStepperSteps=function(){this.stepperService.module=app.Common.SelfServiceModules.Permit;var t=this.globalService.baseUrl+this.globalService.tenantUrl+"/energovapply/page?v="+this.globalService.version+"&id=",i=0,n=[];this.isFeeEstimate||this.disableLocationsInTemplates||(this.enerGovAddressCardsService.addressRequired||!this.selectedType.CaseTypeInfo.HideLocationStep)&&n.push({Label:"Locations",Order:i++,ViewUrl:t+"location",ShowBackButton:!1,ShowNextButton:!0});n.push({Label:"Type",Order:i++,ViewUrl:t+"permittype",ShowBackButton:this.enerGovAddressCardsService.addressRequired||this.selectedType&&!this.selectedType.CaseTypeInfo.HideLocationStep?!this.disableLocationsInTemplates:!1,ShowNextButton:!0});this.isFeeEstimate||n.push({Label:"Contacts",Order:i++,ViewUrl:t+"contacts",ShowBackButton:!0,ShowNextButton:!0});n.push({Label:"More Info",Order:i++,ViewUrl:t+"customfield",ShowBackButton:!0,ShowNextButton:!0});this.isFeeEstimate||n.push({Label:"Attachments",Order:i++,ViewUrl:t+"attachmentfiles",ShowBackButton:!0,ShowNextButton:!0});!this.isFeeEstimate&&this.selectedType.CaseTypeInfo.SignatureRequired&&this.isFreshApplyOrUseTemplate()?(n.push({Label:"Signature",Order:i++,ViewUrl:t+"signature",ShowBackButton:!0,ShowNextButton:!0}),n.push({Label:this.menuActionType==this.menuActionTypeValues.UpdateTemplate?"Review and Save":"Review and Submit",Order:i++,ViewUrl:t+"summary",ShowBackButton:!0,ShowNextButton:!1})):n.push({Label:this.menuActionType==this.menuActionTypeValues.UpdateTemplate?"Review and Save":"Review and Submit",Order:i++,ViewUrl:t+"summary",ShowBackButton:!0,ShowNextButton:!1});this.stepperService.stepsSetup("Permit",n,this.enerGovApplyModuleService.selectedType)},o}(n.Common.Controllers.Apply.EnerGovApplyController);t.EnerGovPermitApplyController=o})(t=n.Permit||(n.Permit={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t){var i=n.call(this,null)||this,r;return i.permitSearchService=t,i.setup=function(){i.permitSearchService.getCriteria(function(n){i.model=n;i.blankCriteria=angular.copy(n)});i.permitSearchService.getSecondaryData(function(n){i.secondaryData=n})},i.clear=function(){i.model=angular.copy(i.blankCriteria);i.selectedType=undefined},r=i,i.setup(),i}return __extends(t,n),t.prototype.search=function(){var n=this;this.selectedType&&(n.model.PMPermitTypeId=this.selectedType.PermitTypeId);this.permitSearchService.search(n.model,function(t){n.searchResults=t.Result;n.totalPages=t.PageCount;n.totalFound=t.TotalFound})},t}(app.Core.Controllers.CoreController);n.EnerGovPermitSearchController=t})(t=n.Permit||(n.Permit={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=app.Common.Helpers.VersionSupport,i=app.Constants.PermitTabs,r=function(n){function r(r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d,g,nt){var it=n.call(this,null)||this,tt,rt;return it.$routeParams=r,it.$location=u,it.globalService=f,it.enerGovPermitService=e,it.eventService=o,it.userService=s,it.enerGovCustomFieldsService=h,it.customFieldsService=c,it.enerGovMyInvoiceSearchService=l,it.cartService=a,it.enerGovSettingsService=v,it.energovReportService=y,it.eReviewsService=p,it.pageTitleService=w,it.tabNavigatorService=b,it.selfServiceStateService=k,it.entityTabsService=d,it.tenantService=g,it.enerGovEntityHoldSearchService=nt,it.userLoggedIn=!1,it.pendingAddCartItems=[],it.applyStatus=!1,it.contactTypeList=[],it.allowNonCaseContactsToRequestInspections=!1,it.attachmentChunking=!0,it.showPayNow=!1,it.invoicesPending=[],it.isCollapsed=!1,it.permitTabs=i,it.isTenantUsesTylerPayments=function(){var n=it;it.tenantService.isTylerPaymentsUsed(function(t){n.isTylerPaymentsUsed=t})},tt=it,tt.isTenantUsesTylerPayments(),tt.eReviewsService.cleanUp(),tt.tabNavigatorService.cleanUp(),tt.customFieldsService.setLayout(null),tt.applyStatus=tt.$location.search().success,rt=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(it.$location,it.$routeParams.id),it.tabNavigatorService.getShowPublicCommentsTabSetting(function(){}),it.entityTabsService.setEntityTabsVisibility(it.$routeParams.id,rt,tt.$routeParams.tab),it.enerGovPermitService.getPermitDetail(it.$routeParams.id,function(n){(tt.model=n,tt.model!=null)&&(tt.model.HoldExist?it.enerGovEntityHoldSearchService.getCaseHolds(tt.model.PermitId,rt,function(t){tt.model.EntityHolds=t;tt.selfServiceStateService.setParentModel(n)}):tt.selfServiceStateService.setParentModel(n),tt.eReviewsService.isEReviewCaseType=n.IsEReviewCaseType,tt.eReviewsService.isEReviewCaseTypeDefer&&tt.eReviewsService.isEReviewCaseTypeDefer.resolve(),tt.eReviewsService.disallowAttachmentAfterApplication=n.DisallowAttachmentAfterApplication,tt.pageTitleService.setPageTitle(tt.model.PermitNumber),tt.model.PermitId!==null&&tt.model.PermitId!==""&&it.energovReportService.getReportName("Permit",tt.model.PermitTypeId,tt.model.PermitWorkClassId,function(n){tt.reportName=n}),tt.model.IsLoggedIn&&tt.model.HasAuthorizedContact&&tt.model.AllowPayNow&&tt.model.UnPaidInvoicedFees?tt.isTylerPaymentsUsed||tt.cartService.getPendingInvoices(tt.model.UnpaidInvoiceIds,function(n){tt.invoicesPending=n;tt.showPayNow=n.length>0&&n.length==tt.model.UnpaidInvoiceIds.length?!1:!0}):tt.showPayNow=!0,tt.model.LayoutId!==null&&tt.model.LayoutId!==""&&tt.model.PermitId!==null&&tt.model.PermitId!==""?tt.enerGovCustomFieldsService.getCustomLayoutWithData(tt.model.LayoutId,tt.model.OnlineLayoutId,tt.model.PermitId,rt,function(n){n.Success?n.Result!=null?tt.customFieldsService.setLayout(n.Result):tt.errorMessage=n.ErrorMessage:(n.StatusCode===app.Common.Services.HttpStatusCode.PreconditionFailed||n.StatusCode===app.Common.Services.HttpStatusCode.NoContent||n.StatusCode===app.Common.Services.HttpStatusCode.Forbidden)&&(tt.errorMessage=n.ErrorMessage)}):(tt.entityTabsService.showMoreInfoTab=!1,tt.$routeParams.tab&&tt.$routeParams.tab==app.Constants.TabConstants.Moreinfo?tt.entityTabsService.setAdditionalEntityTabsVisibility(tt.$routeParams.tab,tt.entityTabsService.showMoreInfoTab):tt.entityTabsService.setFirstTabOnHidingOtherTabs()),tt.model.PermitId===""?(alert("Unable to load the selected permit. Please contact your municipality about the permit you were attempting to view. Returning to home."),it.$location.path("/dashboard")):(tt.getSecondaryData(tt.model.PermitTypeId,tt.model.PermitWorkClassId),tt.getContactTypeData(tt.model.PermitTypeWorkClassId,tt.model.PermitWorkClassId)))}),s.listenToLoginStatusChange(function(n){tt.userLoggedIn=n}),tt.userLoggedIn=s.isUserLoggedIn,tt.enerGovSettingsService.getSoftwareSetting("energov","AllowNonCaseContactsToRequestInspections",function(n){tt.allowNonCaseContactsToRequestInspections=n.SettingValue==="true"?!0:!1}),t(it.globalService.enerGovAPIVersion,"2016.3.0.212")||(tt.attachmentChunking=!1),$("#label-PermitDetail-Description").attr("class","col-lg-10 col-md-9 col-sm-9 col-xs-12 entity-detail-description-multiline"),it}return __extends(r,n),r.prototype.collapsePanel=function(){this.isCollapsed=!this.isCollapsed},r.prototype.printPermit=function(){var n=this.globalService.webApiBaseUrl+"/energov/report/single?value="+this.model.PermitId+"&reportName="+this.reportName+"&tenantId="+this.globalService.tenantId;window.open(n,"_new")},r.prototype.payNow=function(){var i=this,n=this,t;this.model.UnpaidInvoiceIds!=null&&this.model.UnpaidInvoiceIds.length>0&&(t=_.difference(this.model.UnpaidInvoiceIds,this.invoicesPending),this.enerGovMyInvoiceSearchService.getDetailInvoices(t,!1,function(t){t!=null&&t.length>0&&(angular.forEach(t,function(t){var i={ItemName:t.InvoiceDescription,Due:t.InvoiceDueDate,Invoice:t.InvoiceNumber,InvoiceId:t.InvoiceId,BillingContact:t.BillingContact,ContactAddresses:t.ContactAddresses==null||t.ContactAddresses.length==0?[]:t.ContactAddresses,HomePhone:t.HomePhone,BusinessPhone:t.BusinessPhone,OtherPhone:t.OtherPhone,MobilePhone:t.MobilePhone,InvoiceEntityList:t.InvoiceEntities,InvoiceFees:t.InvoiceFees==null||t.InvoiceFees.length==0?[]:t.InvoiceFees},r={CartItemId:-1,CartDirectiveName:"energov-cart",CartData:angular.toJson(i),CartDataId:t.InvoiceId,UserId:-1,TenantId:-1,SoftwarePackageId:-1,SoftwarePackageName:"",Amount:t.TotalDue,IsNew:!0,IsDeleted:!1};n.pendingAddCartItems.push(r)}),n.cartService.addCartItems(i.pendingAddCartItems,function(t){t&&(n.cartService.didCallGetTotalItem=!1,n.cartService.updateTotalNumOfItems(),n.cartService.didCallGetTotalItem=!0,n.$location.url("/mycart"))}))}))},r.prototype.isIEVersion=function(){var n=document.documentMode;return n>=11?!0:!1},Object.defineProperty(r.prototype,"showResubmitBadge",{get:function(){return t(this.globalService.enerGovAPIVersion,"2022.3.0.0")?this.model&&this.model.HasAuthorizedContact&&this.eReviewsService.hasFilesThatNeedsResubmission:this.model&&this.model.EReviewEnable&&this.model.IsEReviewCaseType&&this.model.HasAuthorizedContact&&this.eReviewsService.isAllowedFileRevisionUploadPresent},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"showAttentionBadge",{get:function(){return t(this.globalService.enerGovAPIVersion,"2022.3.0.0")?this.model&&this.model.HasAuthorizedContact&&this.eReviewsService.hasFilesThatNeedsAttention:this.model&&this.model.EReviewEnable&&this.model.IsEReviewCaseType&&this.model.HasAuthorizedContact&&this.eReviewsService.isFileNeedsAttention},enumerable:!0,configurable:!0}),r.prototype.getSelectedWorkClassSecondaryData=function(n,t){if(n==null||t==null)return null;var i=this.secondaryData.PermitTypes.filter(function(t){return t.PermitTypeID===n});return i.length?i[0].WorkClassTemplates.filter(function(n){return n.PermitWorkClassID===t})[0]:null},r.prototype.getSecondaryData=function(n,t){var i=this;this.enerGovPermitService.getSecondaryData(n,function(r){i.secondaryData=r;i.workClassTemplate=i.getSelectedWorkClassSecondaryData(n,t)})},r.prototype.getContactTypeData=function(n,t){var i=this;this.enerGovPermitService.getContactTypeData(n,t,function(n){i.contactTypeList=n})},r}(app.Core.Controllers.CoreController);n.EnerGovPermitViewController=r})(t=n.Permit||(n.Permit={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){"use strict";var i=t.Services.EnerGovPermitService,r=t.Services.EnerGovPermitSearchService,u=t.Services.EnerGovEntitySubPermitSearchService,f=t.Services.EnerGovApplyPermitService;angular.module("enerGov.Permit",["app.globalsModule","app.Common.Services","app.CustomFields","app.Draft","enerGov.Attachment","enerGov.Template"]).service("enerGovPermitService",["http","userService",i]).service("enerGovPermitSearchService",["http",r]).service("enerGovEntitySubPermitSearchService",["http","menuService","entityTabsService","$routeParams",u]).service("enerGovApplyPermitService",["http",f]).controller("enerGovPermitViewController",["$routeParams","$location","globalsService","enerGovPermitService","eventService","userService","enerGovCustomFieldsService","customFieldsService","enerGovMyInvoiceSearchService",app.Constants.ServiceConstant.CartService,"enerGovSettingsService","enerGovReportService","eReviewsService","pageTitleService","tabNavigatorService","selfServiceStateService","entityTabsService","tenantService","enerGovEntityHoldSearchService",t.EnerGovPermitViewController]).controller("enerGovPermitSearchController",["enerGovPermitSearchService",t.EnerGovPermitSearchController]).controller("enerGovEntityExistingSubPermitSearchController",["$routeParams","$location","globalsService","enerGovEntitySubPermitSearchService","entitySecondaryDataService","entityTabsService",t.EnerGovEntityExistingSubPermitSearchController]).controller("enerGovEntityRemainingSubPermitSearchController",["$routeParams","$location","globalsService","enerGovEntitySubPermitSearchService","entitySecondaryDataService","enerGovSubrecordApplyService","locationService","enerGovPermitService","resourceService","userService","$q","entityTabsService",t.EnerGovEntityRemainingSubPermitSearchController]).controller("enerGovPermitApplyController",["$routeParams","$location","globalsService","menuService","enerGovSettingsService","enerGovContactCardsService","enerGovAddressCardsService","enerGovAttachmentCardsService","enerGovCustomFieldsService","customFieldsService","draftService","enerGovPermitService","enerGovApplyPermitService","$q","$filter","enerGovSubrecordApplyService","locationService","userService","$scope","mapApplyService","stepperService","eReviewsService","eReviewAttachmentCardsService","caseTypeInstructionService","tylerSignaturePadService","enerGovTemplateService","entitySignatureMetaDataService","$timeout","attachmentCommonCardService","$sce",t.EnerGovPermitApplyController]).controller("enerGovApplyAllController",["menuService","resourceService","$location","$routeParams",n.Common.Controllers.Apply.EnerGovApplyAllController])})(t=n.Permit||(n.Permit={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.estimatedFees=[];this.showWorkClass=!1;this.showSquareFeet=!1;this.showValuation=!1;this.planSaveInProgress=!1;this.rootUrl="/energov/plans/";var t=this;t.setDefaultStates()}return n.prototype.totalEstimatedFee=function(){var n=0;return angular.forEach(this.estimatedFees,function(t){n=n+t.ComputedAmount}),n},n.prototype.getPlanEstimateFees=function(n,t){var i=this;this.estimatedFees=[];this.http.post(this.rootUrl+"estimatedfees",n,function(n){n.Success&&(i.estimatedFees=n.Result,t(n.Result))})},n.prototype.getNewPlan=function(n,t,i){var r={PlanTypeID:n,PlanWorkClassID:t};this.http.post(this.rootUrl+"new",r,function(n){i(n.Result)})},n.prototype.savePlan=function(n,t){this.http.post(this.rootUrl+"save",n,function(n){t(n)})},n.prototype.createInvoice=function(n,t){this.http.post(this.rootUrl+"create-invoice",n,function(n){t(n)})},n.prototype.setDefaultStates=function(){this.model={PlanId:"",PlanTypeID:"",PlanWorkClassID:"",PlanNumber:"",InternetApplicationTypeId:0,Description:"",ValuationValue:null,SquareFeet:null,Addresses:[],Contacts:[],Attachments:[],Parcels:[],CustomFields:[],CustomFieldLayoutID:"",CustomLayout:null,IsRequiredDescription:!1,IsRequiredSquareFeet:!1,IsRequiredValuation:!1,IsWorkflowActionPersistent:!1,IsWorkflowActionOptional:!1,WorkflowTemplateId:"",WorkflowTemplateActionId:"",WfActionData:null,ParentEntityId:"",ObjectID:"",ActionRowVersion:0,ObjectStatusID:0,IsSubPlanFromPermit:!1,IsSubPlanFromPlan:!1,IsNew:!0,IsDeleted:!1,ClientId:"",ERProjects:[],Projects:null,FeeTemplateId:"",IsApplyOnline:!1,EntityId:null,GISFeatures:[],ModuleId:0,IsRenewal:!1,Holds:[],ERFileSubmissionQueueID:""};this.secondaryData=null;this.selectedType=null;this.selectedWorkClass=null;this.selectedTypeItems=[];this.showMoreInfoStep=!0;this.planSaveInProgress=!1},n}();n.EnerGovApplyPlanService=t})(t=n.Services||(n.Services={}))})(t=n.Plan||(n.Plan={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t){this.http=n;this.userService=t;this.rootUrl="/energov/plans/"}return n.prototype.getSecondaryData=function(n,t){var i=this;this.http.get(this.rootUrl+"setup/"+n,function(n){n.Success&&(i.planSecondaryData=n.Result,t(n.Result))},!1)},Object.defineProperty(n.prototype,"secondaryData",{get:function(){return this.planSecondaryData},enumerable:!0,configurable:!0}),n}();n.EnerGovPlanSecondaryDataService=t})(t=n.Services||(n.Services={}))})(t=n.Plan||(n.Plan={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t){this.http=n;this.userService=t;this.rootUrl="/energov/plans/"}return n.prototype.getById=function(n,t){this.http.get(this.rootUrl+n,function(n){t(n.Result)},!1)},n.prototype.getPlanStatus=function(n){var t;t=this.rootUrl+"plan/status";this.http.get(t,function(t){t.Success?n(t.Result):n(null)},!1)},n.prototype.getSecondaryData=function(n,t){this.http.get(this.rootUrl+"setup/"+n,function(n){n.Success&&t(n.Result)},!1)},n.prototype.getContactTypeData=function(n,t,i){this.http.get(this.rootUrl+"setup/contact/"+n+"/"+t,function(n){n.Success&&i(n.Result)},!1)},n.prototype.checkUserAssociatedWithPlan=function(n,t){var i=this.rootUrl+"/user-plan-contact-association/"+n;this.http.get(i,function(n){t(n.Result)},!1)},n}();n.EnerGovPlanService=t})(t=n.Services||(n.Services={}))})(t=n.Plan||(n.Plan={}))}(EnerGov||(EnerGov={}));__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){"use strict";var i=app.Common.Helpers.VersionSupport,u=n.Common.CaseTypeUseEnums.MenuActionType,f=n.Common.CaseTypeUseEnums.Module,e=n.Common.CaseTypeUseEnums.ProfileType,r=app.Common.SelfServiceModules,o=function(t){function o(i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d,g,nt,tt,it,rt,ut,ft,et,ot,st,ht,ct){var lt=t.call(this,i,r,u,f,e,o,s,h,c,l,a,v,y,w,k,d,tt,b,it,rt,null,ut,ft,et,ot,st,ht)||this,at,vt,yt,pt,wt,bt;if(lt.$routeParams=i,lt.$location=r,lt.globalService=u,lt.menuService=f,lt.settingsService=e,lt.enerGovContactCardsService=o,lt.enerGovAddressCardsService=s,lt.enerGovAttachmentCardsService=h,lt.enerGovCustomFieldsService=c,lt.customFieldsService=l,lt.draftService=a,lt.enerGovPlanSecondaryDataService=v,lt.enerGovApplyModuleService=y,lt.$filter=p,lt.enerGovSubrecordApplyService=w,lt.locationService=b,lt.userService=k,lt.$q=d,lt.scope=g,lt.mapApplySerivce=nt,lt.stepperService=tt,lt.eReviewsService=it,lt.eReviewAttachmentCardsService=rt,lt.caseTypeInstructionService=ut,lt.tylerSignaturePadService=ft,lt.enerGovTemplateService=et,lt.entitySignatureMetaDataService=ot,lt.$timeout=st,lt.attachmentCommonCardService=ht,lt.$sce=ct,lt.caseTypeUseEstimationOnly=n.Common.CaseTypeUseEnums.CaseTypeUse.EstimationOnly,lt.draftType=app.Constants.DraftType.Plan,lt.stepperService.module=app.Common.SelfServiceModules.Plan,lt.enerGovAttachmentCardsService.hideActionColumnOnSummary=!0,lt.scope.$watchCollection("vm.enerGovAttachmentCardsService.ereviewAttachments",lt.attachmentCommonCardService.loadDataForCards),lt.scope.$watchCollection("vm.attachmentCommonCardService.useFileCategoryForResubmission",function(){return lt.attachmentCommonCardService.loadDataForCards(lt.enerGovAttachmentCardsService.ereviewAttachments,null)}),at=new Date,lt.enerGovApplyModuleService.model.ApplicationDate=lt.isFeeEstimate?p("date")(Date.now(),app.Constants.GlobalConstants.DateFormatForSearch):new Date(p("date")(Date.now(),app.Constants.GlobalConstants.DateFormatForSearch)),lt.minDate=new Date(at.getFullYear(),at.getMonth(),at.getDate()),lt.enerGovAddressCardsService.locationAddressType==null&&lt.userService.isUserLoggedIn)lt.enerGovAddressCardsService.getSecondaryDataAndSetAddressType();else if(lt.enerGovAddressCardsService.locationAddressType){if(nt.mapLocations.length>0&&s.buildLocationCardFromMap(nt.mapLocations),nt.mapSPCollections.length>0)for(vt=0,yt=nt.mapSPCollections;vt<yt.length;vt++)pt=yt[vt],lt.enerGovAddressCardsService.addSpatialCollection(pt);nt.resetMapApplyData()}return lt.enerGovApplyModuleService.feeEstimator!=null&&(lt.enerGovApplyModuleService.model=lt.enerGovApplyModuleService.feeEstimator,lt.enerGovApplyModuleService.feeEstimator=null),lt.isResumeDraft()||lt.isFeeEstimate||lt.enerGovApplyModuleService.model.ERProjects&&lt.enerGovApplyModuleService.model.ERProjects.length!=0||(wt=lt.getTypeId(),bt=lt.getWorkClassId(),lt.enerGovApplyModuleService.getNewPlan(wt,bt,function(n){lt.enerGovApplyModuleService.selectedType.CaseTypeInfo.EReviewsEnabled&&(lt.enerGovApplyModuleService.model.ERProjects=n.ERProjects,lt.enerGovAttachmentCardsService.ereviewFlowOptions.headers.UploadFolder=lt.applyService.model.ERProjects[0].ERProjectID,lt.eReviewsService.caseRequestInfo={Module:n.ModuleId,SubModule:0,CaseTypeId:n.PlanTypeID,WorkClassId:n.PlanWorkClassID,ERProjectId:n.ERProjects[0].ERProjectID,IsApply:!0},lt.enerGovAttachmentCardsService.setExtReviewIntegrationTypeInfo(lt.eReviewsService.caseRequestInfo,!0,lt.$sce))})),lt}return __extends(o,t),Object.defineProperty(o.prototype,"fileProgressListCount",{get:function(){return this.enerGovAttachmentCardsService.fileProgressList?this.enerGovAttachmentCardsService.fileProgressList.length:0},enumerable:!0,configurable:!0}),o.prototype.openShowFilesModalOnSummary=function(n,t){this.attachmentCommonCardService.openShowFilesModal(n,t)},o.prototype.handleInactiveMenuItems=function(){var i=this.enerGovApplyModuleService.selectedTypeItems,n=this.enerGovApplyModuleService.secondaryData.PlanTypes,t=this;angular.forEach(i,function(i){for(var u,e=t.getTypeId(i),o=t.getWorkClassId(i),f=!1,r=0;r<n.length;r++)if(e===n[r].PlanTypeID)if(t.enerGovApplyModuleService.showWorkClass){f=!0;angular.forEach(i.SubMenus,function(i){for(var e=t.getWorkClassId(i),f=!1,u=0;u<n[r].WorkClassTemplates.length;u++)if(e===n[r].WorkClassTemplates[u].PlanWorkClassID){f=!0;break}f||t.subMenusToRemove.push(i.MenuID)});break}else for(u=0;u<n[r].WorkClassTemplates.length;u++)if(o===n[r].WorkClassTemplates[u].PlanWorkClassID){f=!0;break}f||t.menusToRemove.push(i.MenuID)})},o.prototype.getSelectedWorkClassSecondaryData=function(){var e=null,u,f,n,t,r,i;if(this.enerGovApplyModuleService==null||!this.enerGovApplyModuleService.secondaryData||this.enerGovApplyModuleService.selectedType==null||(u=this.getTypeId(),f=this.getWorkClassId(),u==null||f==null))return null;for(n=0;n<this.enerGovApplyModuleService.secondaryData.PlanTypes.length;n++)if(this.enerGovApplyModuleService.secondaryData.PlanTypes[n].PlanTypeID===u){for(t=0;t<this.enerGovApplyModuleService.secondaryData.PlanTypes[n].WorkClassTemplates.length;t++)if(this.enerGovApplyModuleService.secondaryData.PlanTypes[n].WorkClassTemplates[t].PlanWorkClassID===f){for(r=0;r<this.enerGovApplyModuleService.secondaryData.PlanTypes[n].WorkClassTemplates[t].ContactTypeList.length;r++){i=this.enerGovApplyModuleService.secondaryData.PlanTypes[n].WorkClassTemplates[t].ContactTypeList[r];this.contactType={ContactTypeId:i.LandManagementContactTypeID,Name:i.Name,IsRequired:i.ContactTypeGroup>0?!0:i.IsRequired,GroupId:i.ContactTypeGroup,LandManagementContactSystemTypeID:i.LandManagementContactSystemTypeID,isFilled:!1,IsDefaultOnlineContactType:!1,IsValidateLic:!1,IsValidateBLLicense:!1,IsValidateILLicense:!1,RequiredValidLic:!1};break}e=this.enerGovApplyModuleService.secondaryData.PlanTypes[n].WorkClassTemplates[t];break}break}return e},o.prototype.calculateEstimateFees=function(){var n,t;i(this.globalService.enerGovAPIVersion,"2016.3.0.151")==!0&&(n=this,n.enerGovApplyModuleService.model.PlanTypeID=n.getTypeId(),n.enerGovApplyModuleService.model.PlanWorkClassID=n.getWorkClassId(),t=n.getSelectedWorkClassSecondaryData(),t!=null&&(n.enerGovApplyModuleService.model.InternetApplicationTypeId=t.InternetApplyTypeID),n.enerGovApplyModuleService.model.FeeTemplateId=t.FeeTemplateID,n.enerGovApplyModuleService.model.CustomLayout=n.customFieldsService.customLayout,n.enerGovApplyModuleService.getPlanEstimateFees(n.enerGovApplyModuleService.model,function(){}))},o.prototype.getTypeIdFromPackageData=function(n){var t=JSON.parse(n);return t.PlanTypeID?t.PlanTypeID:null},o.prototype.getWorkClassIdFromPackageData=function(n){var t=JSON.parse(n);return t.PlanWorkClassID?t.PlanWorkClassID:null},o.prototype.checkSquareAndValuationBox=function(){var i,r,n,t;(this.enerGovApplyModuleService&&this.enerGovApplyModuleService.model&&(this.enerGovApplyModuleService.model.IsRequiredSquareFeet=!1,this.enerGovApplyModuleService.model.IsRequiredValuation=!1,this.enerGovApplyModuleService.model.IsRequiredDescription=!1,this.enerGovApplyModuleService.showSquareFeet=!1,this.enerGovApplyModuleService.showValuation=!1),this.enerGovApplyModuleService!=null&&this.enerGovApplyModuleService.selectedType!=null)&&(i=this.getTypeId(),i!=null)&&(r=this.getWorkClassId(),n=this.enerGovApplyModuleService.selectedTypeItems.filter(function(n){return n.CaseTypeInfo.PackageCaseTypeId===i&&n.CaseTypeInfo.PackageCaseClassId===r}),n!==null&&n.length>0&&(this.enerGovApplyModuleService.model.IsRequiredSquareFeet=n[0].CaseTypeInfo.SquareFootageRequired,this.enerGovApplyModuleService.model.IsRequiredValuation=n[0].CaseTypeInfo.ValuationRequired,this.enerGovApplyModuleService.model.IsRequiredDescription=n[0].CaseTypeInfo.DescriptionRequired),t=this.enerGovApplyModuleService.secondaryData.PlanTypes.filter(function(n){return n.PlanTypeID===i}),t!==null&&t.length>0&&(this.enerGovApplyModuleService.showSquareFeet=t[0].SquareFeet,this.enerGovApplyModuleService.showValuation=t[0].Valuation))},o.prototype.updateDraftPartialFromModel=function(n){return n.Description=this.enerGovApplyModuleService.model.Description,n.ValuationValue=this.enerGovApplyModuleService.model.ValuationValue,n.SquareFeet=this.enerGovApplyModuleService.model.SquareFeet,n},o.prototype.updateModelPartialFromFraft=function(n){var t=this;this.enerGovApplyModuleService.model.Description=n.Description;this.enerGovApplyModuleService.model.ValuationValue=n.ValuationValue;this.enerGovApplyModuleService.model.SquareFeet=n.SquareFeet;this.enerGovApplyModuleService.model.ObjectID=n.ObjectID;this.enerGovApplyModuleService.model.ActionRowVersion=n.ActionRowVersion;this.enerGovApplyModuleService.model.ObjectStatusID=n.ObjectStatusID;this.enerGovApplyModuleService.model.IsSubPlanFromPermit=n.IsSubPlanFromPermit;this.enerGovApplyModuleService.model.IsSubPlanFromPlan=n.IsSubPlanFromPlan;this.enerGovApplyModuleService.model.WfActionData=n.WfActionData;this.enerGovApplyModuleService.model.IsWorkflowActionPersistent=n.IsWorkflowActionPersistent;this.enerGovApplyModuleService.model.IsWorkflowActionOptional=n.IsWorkflowActionOptional;this.enerGovApplyModuleService.model.WorkflowTemplateId=n.WorkflowTemplateId;this.enerGovApplyModuleService.model.WorkflowTemplateActionId=n.WorkflowTemplateActionId;this.enerGovApplyModuleService.model.ParentEntityId=n.ParentEntityId;this.enerGovApplyModuleService.model.Projects=n.Projects;(n.IsSubPlanFromPermit||n.IsSubPlanFromPlan)&&(this.isSubRecordApply=!0,i(this.globalService.enerGovAPIVersion,"2021.2.0.0")?n.IsSubPlanFromPermit?this.enerGovSubrecordApplyService.getSubrecordApplyData(this.enerGovApplyModuleService.model.ParentEntityId,r.Permit,function(n){t.enerGovApplyModuleService.model.Holds=n.Holds}):this.enerGovSubrecordApplyService.getSubrecordApplyData(this.enerGovApplyModuleService.model.ParentEntityId,r.Plan,function(n){t.enerGovApplyModuleService.model.Holds=n.Holds}):this.enerGovApplyModuleService.model.Holds=[])},o.prototype.saveFeeEstimator=function(){var n=this;n.enerGovApplyModuleService.feeEstimator={PlanId:"",PlanTypeID:"",PlanWorkClassID:"",PlanNumber:"",InternetApplicationTypeId:0,Description:"",ValuationValue:null,SquareFeet:null,Addresses:[],Contacts:[],Attachments:[],Parcels:[],CustomFields:[],CustomFieldLayoutID:"",CustomLayout:null,IsRequiredDescription:!1,IsRequiredSquareFeet:!1,IsRequiredValuation:!1,ObjectID:"",ActionRowVersion:0,ObjectStatusID:0,IsSubPlanFromPermit:!1,IsSubPlanFromPlan:!1,IsWorkflowActionPersistent:!1,IsWorkflowActionOptional:!1,WorkflowTemplateId:"",WorkflowTemplateActionId:"",WfActionData:null,ParentEntityId:"",IsNew:!0,IsDeleted:!1,ClientId:"",ERProjects:[],Projects:null,FeeTemplateId:"",IsApplyOnline:!1,EntityId:null,GISFeatures:[],ModuleId:0,IsRenewal:!1,Holds:[],ERFileSubmissionQueueID:""};n.enerGovApplyModuleService.feeEstimatorCustomFields=[];n.enerGovApplyModuleService.feeEstimator.ValuationValue=n.enerGovApplyModuleService.model.ValuationValue;n.enerGovApplyModuleService.feeEstimator.SquareFeet=n.enerGovApplyModuleService.model.SquareFeet;n.customFieldsService.customLayout!==null&&(n.enerGovApplyModuleService.feeEstimator.CustomFieldLayoutID=n.customFieldsService.customLayout.PackageId,angular.forEach(n.customFieldsService.customLayout.CustomGroups,function(t){angular.forEach(t.CustomFields,function(t){t.Value!==null&&n.enerGovApplyModuleService.feeEstimatorCustomFields.push({CustomGroupId:t.CustomGroupId,CustomFieldId:t.CustomFieldId,Value:t.Value,CustomFieldTableRows:t.CustomFieldTableRows,Id:t.Id,SortOrder:t.SortOrder,FieldName:t.FieldName,CustomPickListItems:t.CustomPickListItems,PickListItems:t.PickListItems,IsPickList:t.IsPickList,FieldTypeId:t.FieldTypeId,PackageId:t.PackageId,CustomFieldTableColumnRefItems:t.CustomFieldTableColumnRefItems,CustomFieldTableCellType:t.CustomFieldTableCellType,IsTable:t.IsTable,IsFooter:t.IsFooter,Label:t.Label,IsRequired:t.IsRequired,IsReadOnly:t.IsReadOnly,IsSupportedType:t.IsSupportedType,DefaultValue:t.DefaultValue,typeData:t.typeData,DefaultTableRows:t.DefaultTableRows})})}));n.locationService.path("/plan/apply/"+n.enerGovApplyModuleService.selectedType.MenuID+"/0/"+u.Apply.toString());n.scope.$apply()},o.prototype.saveModule=function(){var n=this,t,i;n.enerGovApplyModuleService.planSaveInProgress=!0;(n.enerGovApplyModuleService.model.IsWorkflowActionPersistent||n.enerGovApplyModuleService.model.IsWorkflowActionOptional)&&(i=n.enerGovApplyModuleService.model.IsSubPlanFromPermit?app.Common.SelfServiceModules.Permit:app.Common.SelfServiceModules.Plan,t=n.enerGovSubrecordApplyService.addAction(n.enerGovApplyModuleService.model.ParentEntityId,i,n.enerGovApplyModuleService.model.WorkflowTemplateId,n.enerGovApplyModuleService.model.WorkflowTemplateActionId,n.enerGovApplyModuleService.model.WfActionData.WfStepId,function(t){n.enerGovApplyModuleService.model.ObjectID=t;n.enerGovApplyModuleService.model.ObjectStatusID=0;n.enerGovApplyModuleService.model.WfActionData.WfActionId=t;n.enerGovApplyModuleService.model.WfActionData.ActionRowVersion=1}));n.$q.all([t]).then(function(){var r,t,i;n.enerGovApplyModuleService.model.Contacts=n.enerGovContactCardsService.saveContacts();n.enerGovApplyModuleService.model.Addresses=[];n.enerGovApplyModuleService.model.Addresses=$.grep(n.enerGovAddressCardsService.addressCards,function(n){return!n.IsParcel});n.enerGovApplyModuleService.model.Parcels=[];r=$.grep(n.enerGovAddressCardsService.addressCards,function(n){return n.IsParcel});angular.forEach(r,function(t){var i={ParentParcelID:"",ParcelID:"",ParentID:"",ParcelNumber:t.ParcelNumber,Section:t.Section,Range:t.Range,Township:t.Township,Main:t.Main,IsNew:!0,IsDeleted:!1,ClientId:""};n.enerGovApplyModuleService.model.Parcels.push(i)});t=n.enerGovAddressCardsService.locationCards.filter(function(n){return n.IsSpatialCollection});t.length>0&&(n.enerGovApplyModuleService.model.GISFeatures=t.map(function(n){return{ParentID:"",FeatureLayer:n.Geometry.type,AttributeField:"NAME",KeyValue:"",GISHistory_Module:f.PlanManagement,GISHistory_SpatialType:e.SpatialCollection,GeoJson:JSON.stringify(n.Geometry),IsNew:!0,IsDeleted:!1,ClientId:null}}));n.enerGovApplyModuleService.model.PlanTypeID=n.getTypeId();n.enerGovApplyModuleService.model.PlanWorkClassID=n.getWorkClassId();i=n.getSelectedWorkClassSecondaryData();i!=null&&(n.enerGovApplyModuleService.model.InternetApplicationTypeId=i.InternetApplyTypeID);n.enerGovApplyModuleService.model.Holds=[];(n.enerGovAddressCardsService.copyParcelHolds||n.enerGovContactCardsService.copyContactHolds)&&(n.enerGovAddressCardsService.copyParcelHolds.length>0&&angular.forEach(n.enerGovAddressCardsService.copyParcelHolds,function(t){n.enerGovApplyModuleService.model.Holds.push(t)}),n.enerGovContactCardsService.copyContactHolds.length>0&&angular.forEach(n.enerGovContactCardsService.copyContactHolds,function(t){n.enerGovApplyModuleService.model.Holds.push(t)}));n.enerGovApplyModuleService.model.CustomLayout=n.customFieldsService.customLayout;n.enerGovAttachmentCardsService.showProgressBarDialog();n.enerGovAttachmentCardsService.uploadFileAttachments(function(t){if(n.enerGovApplyModuleService.model.Attachments=t,n.enerGovApplyModuleService.model.ERProjects&&n.enerGovApplyModuleService.model.ERProjects.length>0){var i=n.enerGovAttachmentCardsService.updateEReviewProjectModel(n.enerGovAttachmentCardsService.uploadedEReviewAttachments,n.enerGovApplyModuleService.model.ERProjects[0]);n.useFileCategoryForResubmission&&(i.EProjectFiles=[]);n.enerGovApplyModuleService.model.ERProjects=[i]}n.useFileCategoryForResubmission?n.createFileSubmissionQueue(n.enerGovAttachmentCardsService.uploadedEReviewAttachments,function(t,i){t&&(n.enerGovApplyModuleService.model.ERFileSubmissionQueueID=i,n.savePlanInfo())}):(n.enerGovApplyModuleService.model.ERFileSubmissionQueueID="",n.savePlanInfo())})})},o.prototype.savePlanInfo=function(){var n=this;n.enerGovApplyModuleService.savePlan(n.enerGovApplyModuleService.model,function(t){if(t.Success){var i=t.Result;n.createPlanInvoice(i);t.ErrorMessage&&(n.errorMessage=t.ErrorMessage,$("#showApplyError").modal("show"))}else n.enerGovAttachmentCardsService.closeProgressBarDialog()})},o.prototype.createPlanInvoice=function(t){var i=this;this.enerGovApplyModuleService.planSaveInProgress=!1;this.enerGovApplyModuleService.createInvoice(t,function(t){i.saveSignatureToEnergov(n.Common.CaseTypeUseEnums.AgreementType.Plan,t,function(){!i.enerGovAttachmentCardsService.isERProjectSaveSupported()&&i.eReviewsService.ereviewsSecondaryData&&i.eReviewsService.isEnerGovEReviewEnable&&i.eReviewsService.isEReviewCaseType&&i.enerGovAttachmentCardsService.ereviewAttachments.length>0?(i.enerGovAttachmentCardsService.ereviewFlowOptions.headers.UploadFolder=t.Result.ERProjects[0].UploadFolder,i.enerGovAttachmentCardsService.uploadEReviewAttachments(function(r){i.eReviewsFileUploadCallback(r,t.Result,n.Common.CaseTypeUseEnums.FilterModule.Plan)})):i.afterSaveRedirection(n.Common.CaseTypeUseEnums.FilterModule.Plan,t.Result)})})},o.prototype.setStepperSteps=function(){this.stepperService.module=app.Common.SelfServiceModules.Plan;var t=this.globalService.baseUrl+this.globalService.tenantUrl+"/energovapply/page?v="+this.globalService.version+"&id=",i=0,n=[];this.isFeeEstimate||this.disableLocationsInTemplates||(this.enerGovAddressCardsService.addressRequired||!this.selectedType.CaseTypeInfo.HideLocationStep)&&n.push({Label:"Locations",Order:i++,ViewUrl:t+"location",ShowBackButton:!1,ShowNextButton:!0});n.push({Label:"Type",Order:i++,ViewUrl:t+"plantype",ShowBackButton:this.enerGovAddressCardsService.addressRequired||this.selectedType&&!this.selectedType.CaseTypeInfo.HideLocationStep?!this.disableLocationsInTemplates:!1,ShowNextButton:!0});this.isFeeEstimate||n.push({Label:"Contacts",Order:i++,ViewUrl:t+"contacts",ShowBackButton:!0,ShowNextButton:!0});n.push({Label:"More Info",Order:i++,ViewUrl:t+"customfield",ShowBackButton:!0,ShowNextButton:!0});this.isFeeEstimate||n.push({Label:"Attachments",Order:i++,ViewUrl:t+"attachmentfiles",ShowBackButton:!0,ShowNextButton:!0});!this.isFeeEstimate&&this.selectedType.CaseTypeInfo.SignatureRequired&&this.isFreshApplyOrUseTemplate()?(n.push({Label:"Signature",Order:i++,ViewUrl:t+"signature",ShowBackButton:!0,ShowNextButton:!0}),n.push({Label:this.menuActionType==this.menuActionTypeValues.UpdateTemplate?"Review and Save":"Review and Submit",Order:i++,ViewUrl:t+"summary",ShowBackButton:!0,ShowNextButton:!1})):n.push({Label:this.menuActionType==this.menuActionTypeValues.UpdateTemplate?"Review and Save":"Review and Submit",Order:i++,ViewUrl:t+"summary",ShowBackButton:!0,ShowNextButton:!1});this.stepperService.stepsSetup("Plan",n,this.enerGovApplyModuleService.selectedType)},o}(n.Common.Controllers.Apply.EnerGovApplyController);t.EnerGovPlanApplyController=o})(t=n.Plan||(n.Plan={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=app.Common.Helpers.VersionSupport,i=app.Constants.PlanTabs,r=function(n){function r(r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d,g,nt){var it=n.call(this,null)||this,tt,rt;return it.$routeParams=r,it.$location=u,it.globalService=f,it.enerGovPlanService=e,it.eventService=o,it.userService=s,it.enerGovCustomFieldsService=h,it.customFieldsService=c,it.enerGovMyInvoiceSearchService=l,it.cartService=a,it.enerGovSettingsService=v,it.energovReportService=y,it.eReviewsService=p,it.pageTitleService=w,it.tabNavigatorService=b,it.selfServiceStateService=k,it.entityTabsService=d,it.tenantService=g,it.enerGovEntityHoldSearchService=nt,it.userLoggedIn=!1,it.pendingAddCartItems=[],it.applyStatus=!1,it.contactTypeList=[],it.attachmentChunking=!0,it.showPayNow=!1,it.invoicesPending=[],it.isCollapsed=!1,it.planTabs=i,it.isTenantUsesTylerPayments=function(){var n=it;it.tenantService.isTylerPaymentsUsed(function(t){n.isTylerPaymentsUsed=t})},tt=it,tt.isTenantUsesTylerPayments(),tt.eReviewsService.cleanUp(),tt.tabNavigatorService.cleanUp(),tt.customFieldsService.setLayout(null),tt.applyStatus=tt.$location.search().success,rt=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(it.$location,it.$routeParams.id),it.tabNavigatorService.getShowPublicCommentsTabSetting(function(){}),it.entityTabsService.setEntityTabsVisibility(it.$routeParams.id,rt,tt.$routeParams.tab),it.enerGovPlanService.getById(it.$routeParams.id,function(n){(tt.model=n,tt.model!=null)&&(tt.model.HoldExist?it.enerGovEntityHoldSearchService.getCaseHolds(tt.model.PlanId,rt,function(t){tt.model.EntityHolds=t;tt.selfServiceStateService.setParentModel(n)}):tt.selfServiceStateService.setParentModel(n),tt.eReviewsService.isEReviewCaseType=n.IsEReviewCaseType,tt.eReviewsService.isEReviewCaseTypeDefer&&tt.eReviewsService.isEReviewCaseTypeDefer.resolve(),tt.eReviewsService.disallowAttachmentAfterApplication=n.DisallowAttachmentAfterApplication,w.setPageTitle(tt.model.PlanNumber),tt.model.PlanId!==null&&tt.model.PlanId!==""&&it.energovReportService.getReportName("Plan",tt.model.PlanTypeId,tt.model.PlanWorkClassId,function(n){tt.reportName=n}),tt.model.IsLoggedIn&&tt.model.HasAuthorizedContact&&tt.model.AllowPayNow&&tt.model.UnPaidFees?tt.isTylerPaymentsUsed||tt.cartService.getPendingInvoices(tt.model.UnpaidInvoiceIds,function(n){tt.invoicesPending=n;tt.showPayNow=n.length>0&&n.length==tt.model.UnpaidInvoiceIds.length?!1:!0}):tt.showPayNow=!0,tt.model.LayoutId!==null&&tt.model.LayoutId!==""&&tt.model.PlanId!==null&&tt.model.PlanId!==""?tt.enerGovCustomFieldsService.getCustomLayoutWithData(tt.model.LayoutId,tt.model.OnlineLayoutId,tt.model.PlanId,rt,function(n){n.Success?n.Result!=null?tt.customFieldsService.setLayout(n.Result):tt.errorMessage=n.ErrorMessage:(n.StatusCode===app.Common.Services.HttpStatusCode.PreconditionFailed||n.StatusCode===app.Common.Services.HttpStatusCode.NoContent||n.StatusCode===app.Common.Services.HttpStatusCode.Forbidden)&&(tt.errorMessage=n.ErrorMessage)}):(tt.entityTabsService.showMoreInfoTab=!1,tt.$routeParams.tab&&tt.$routeParams.tab==app.Constants.TabConstants.Moreinfo?tt.entityTabsService.setAdditionalEntityTabsVisibility(tt.$routeParams.tab,tt.entityTabsService.showMoreInfoTab):tt.entityTabsService.setFirstTabOnHidingOtherTabs()),tt.model.PlanId===""?(alert("Unable to load the selected plan. Please contact your municipality about the plan you were attempting to view. Returning to home."),tt.$location.path("/dashboard")):(tt.getSecondaryData(tt.model.PlanTypeId,tt.model.PlanWorkClassId),tt.getContactTypeData(tt.model.PlanTypeWorkClassId,tt.model.PlanWorkClassId)))}),s.listenToLoginStatusChange(function(n){tt.userLoggedIn=n}),tt.userLoggedIn=s.isUserLoggedIn,t(it.globalService.enerGovAPIVersion,"2016.3.0.212")||(tt.attachmentChunking=!1),$("#label-PlanDetail-Description").attr("class","col-lg-10 col-md-9 col-sm-9 col-xs-12 entity-detail-description-multiline"),it}return __extends(r,n),r.prototype.collapsePanel=function(){this.isCollapsed=!this.isCollapsed},r.prototype.isIEVersion=function(){var n=document.documentMode;return n>=11?!0:!1},r.prototype.printPlan=function(){var n=this.globalService.webApiBaseUrl+"/energov/report/single?value="+this.model.PlanId+"&reportName="+this.reportName+"&tenantId="+this.globalService.tenantId;window.open(n,"_new")},r.prototype.payNow=function(){var i=this,n=this,t;this.model.UnpaidInvoiceIds!=null&&this.model.UnpaidInvoiceIds.length>0&&(t=_.difference(this.model.UnpaidInvoiceIds,this.invoicesPending),this.enerGovMyInvoiceSearchService.getDetailInvoices(t,!1,function(t){t!=null&&t.length>0&&(angular.forEach(t,function(t){var i={ItemName:t.InvoiceDescription,Due:t.InvoiceDueDate,Invoice:t.InvoiceNumber,InvoiceId:t.InvoiceId,BillingContact:t.BillingContact,ContactAddresses:t.ContactAddresses==null||t.ContactAddresses.length==0?[]:t.ContactAddresses,HomePhone:t.HomePhone,BusinessPhone:t.BusinessPhone,OtherPhone:t.OtherPhone,MobilePhone:t.MobilePhone,InvoiceEntityList:t.InvoiceEntities,InvoiceFees:t.InvoiceFees==null||t.InvoiceFees.length==0?[]:t.InvoiceFees},r={CartItemId:-1,CartDirectiveName:"energov-cart",CartData:angular.toJson(i),CartDataId:t.InvoiceId,UserId:-1,TenantId:-1,SoftwarePackageId:-1,SoftwarePackageName:"",Amount:t.TotalDue,IsNew:!0,IsDeleted:!1};n.pendingAddCartItems.push(r)}),n.cartService.addCartItems(i.pendingAddCartItems,function(t){t&&(n.cartService.didCallGetTotalItem=!1,n.cartService.updateTotalNumOfItems(),n.cartService.didCallGetTotalItem=!0,n.$location.url("/mycart"))}))}))},Object.defineProperty(r.prototype,"showResubmitBadge",{get:function(){return t(this.globalService.enerGovAPIVersion,"2022.3.0.0")?this.model.HasAuthorizedContact&&this.eReviewsService.hasFilesThatNeedsResubmission:this.model.EReviewEnable&&this.model.IsEReviewCaseType&&this.model.HasAuthorizedContact&&this.eReviewsService.isAllowedFileRevisionUploadPresent},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"showAttentionBadge",{get:function(){return t(this.globalService.enerGovAPIVersion,"2022.3.0.0")?this.model.HasAuthorizedContact&&this.eReviewsService.hasFilesThatNeedsAttention:this.model.EReviewEnable&&this.model.IsEReviewCaseType&&this.model.HasAuthorizedContact&&this.eReviewsService.isFileNeedsAttention},enumerable:!0,configurable:!0}),r.prototype.getSelectedWorkClassSecondaryData=function(n,t){if(n==null||t==null)return null;var i=this.secondaryData.PlanTypes.filter(function(t){return t.PlanTypeID===n});return i[0].WorkClassTemplates.filter(function(n){return n.PlanWorkClassID===t})[0]},r.prototype.getSecondaryData=function(n,t){var i=this;this.enerGovPlanService.getSecondaryData(n,function(r){i.secondaryData=r;i.workClassTemplate=i.getSelectedWorkClassSecondaryData(n,t)})},r.prototype.getContactTypeData=function(n,t){var i=this;this.enerGovPlanService.getContactTypeData(n,t,function(n){i.contactTypeList=n})},r}(app.Core.Controllers.CoreController);n.EnerGovPlanViewController=r})(t=n.Plan||(n.Plan={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){"use strict";var t=n.Services.EnerGovPlanService,i=n.Services.EnerGovPlanSecondaryDataService,r=n.Services.EnerGovApplyPlanService;angular.module("enerGov.Plan",["app.globalsModule","app.Common.Services","enerGov.Template"]).service("enerGovPlanService",["http","userService",t]).service("enerGovPlanSecondaryDataService",["http",i]).service("enerGovApplyPlanService",["http",r]).controller("enerGovPlanViewController",["$routeParams","$location","globalsService","enerGovPlanService","eventService","userService","enerGovCustomFieldsService","customFieldsService","enerGovMyInvoiceSearchService",app.Constants.ServiceConstant.CartService,"enerGovSettingsService","enerGovReportService","eReviewsService","pageTitleService","tabNavigatorService","selfServiceStateService","entityTabsService","tenantService","enerGovEntityHoldSearchService",n.EnerGovPlanViewController]).controller("enerGovPlanApplyController",["$routeParams","$location","globalsService","menuService","enerGovSettingsService","enerGovContactCardsService","enerGovAddressCardsService","enerGovAttachmentCardsService","enerGovCustomFieldsService","customFieldsService","draftService","enerGovPlanSecondaryDataService","enerGovApplyPlanService","$filter","enerGovSubrecordApplyService","locationService","userService","$q","$scope","mapApplyService","stepperService","eReviewsService","eReviewAttachmentCardsService","caseTypeInstructionService","tylerSignaturePadService","enerGovTemplateService","entitySignatureMetaDataService","$timeout","attachmentCommonCardService","$sce",n.EnerGovPlanApplyController])})(t=n.Plan||(n.Plan={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=app.Common.Helpers.VersionSupport,i=function(){function n(n,t,i,r){this.http=n;this.globalsService=t;this.entityTabsService=i;this.$routeParams=r;this.codecaseViewTabNumber=0;this.rootUrl="/energov/codecases/";this.secondaryData=null}return n.prototype.searchByCriteria=function(n,t){var i=this;this.http.post(this.rootUrl+"entity/search",n,function(n){n.Success||(n.StatusCode===app.Common.Services.HttpStatusCode.NoContent||n.StatusCode===app.Common.Services.HttpStatusCode.Forbidden?i.entityTabsService.showCodeCasesTab=!1:n.StatusCode===app.Common.Services.HttpStatusCode.PreconditionFailed&&(i.entityTabsService.showCodeCasesTab=!0),i.$routeParams.tab&&i.$routeParams.tab==app.Constants.TabConstants.CodeCases?i.entityTabsService.setAdditionalEntityTabsVisibility(i.$routeParams.tab,i.entityTabsService.showCodeCasesTab):i.entityTabsService.setFirstTabOnHidingOtherTabs());t(n)},null)},n.prototype.getById=function(n,t){this.http.get(this.rootUrl+n,function(n){t(n.Result)},!1)},n.prototype.getCodeCaseStatus=function(n){var t;t=this.rootUrl+"codecase/status";this.http.get(t,function(t){t.Success?n(t.Result):n(null)},!1)},n.prototype.getSecondaryData=function(n){var i=this;this.globalsService.enerGovAPIVersion&&t(this.globalsService.enerGovAPIVersion,"2019.2.0.0")?this.secondaryData?n(this.secondaryData):this.http.get(this.rootUrl+"search/setup",function(t){i.secondaryData=t.Result;n(t.Result)},!1):n(null)},n}();n.EnerGovCodeCaseService=i})(t=n.Services||(n.Services={}))})(t=n.CodeCase||(n.CodeCase={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f,e,o,s){var c=n.call(this,null)||this,h,l;return c.$routeParams=t,c.$location=i,c.enerGovCodeCaseService=r,c.enerGovCustomFieldsService=u,c.customFieldsService=f,c.pageTitleService=e,c.tabNavigatorService=o,c.entityTabsService=s,c.userLoggedIn=!1,h=c,l=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(c.$location,c.$routeParams.id),h.tabNavigatorService.cleanUp(),c.entityTabsService.setEntityTabsVisibility(c.$routeParams.id,l,h.$routeParams.tab),c.enerGovCodeCaseService.getById(c.$routeParams.id,function(n){(h.model=n,h.model!=null)&&(h.pageTitleService.setPageTitle(h.model.CaseNumber),h.model.LayoutId!==null&&h.model.LayoutId!==""&&h.model.CodeCaseId!==null&&h.model.CodeCaseId!==""?h.enerGovCustomFieldsService.getCustomLayoutWithData(h.model.LayoutId,h.model.OnlineLayoutId,h.model.CodeCaseId,l,function(n){n.Success?n.Result!=null?h.customFieldsService.setLayout(n.Result):h.errorMessage=n.ErrorMessage:(n.StatusCode===app.Common.Services.HttpStatusCode.PreconditionFailed||n.StatusCode===app.Common.Services.HttpStatusCode.NoContent||n.StatusCode===app.Common.Services.HttpStatusCode.Forbidden)&&(h.errorMessage=n.ErrorMessage)}):(h.entityTabsService.showMoreInfoTab=!1,h.$routeParams.tab&&h.$routeParams.tab==app.Constants.TabConstants.Moreinfo&&h.entityTabsService.setAdditionalEntityTabsVisibility(h.$routeParams.tab,h.entityTabsService.showMoreInfoTab),h.entityTabsService.setFirstTabOnHidingOtherTabs()),h.model.CodeCaseId===""&&(alert("Unable to load the selected code case. Please contact your municipality about the case you were attempting to view. Returning to home."),c.$location.path("/dashboard")))}),c}return __extends(t,n),t}(app.Core.Controllers.CoreController);n.EnerGovCodeCaseViewController=t})(t=n.CodeCase||(n.CodeCase={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f){var e=n.call(this,t,i,r,u,null,!1)||this,o=e,s=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(i,t.id);return e.criteria={PageNumber:1,PageSize:r.pageSizeList[0].Value,SortField:e.sortField,IsSortedInAscendingOrder:!0,ModuleId:s,EntityId:t.id},window.entityRecordsSortSecondaryData===null||typeof entityRecordsSortSecondaryData=="undefined"?f.getEntityRecordSortSecondaryData(function(n){o.sortList=n.Result.EntityCodeCasesSearchSortList;o.sortField=n.Result.EntityCodeCasesSearchSortList[0].Value;window.entityRecordsSortSecondaryData=n.Result}):(o.sortList=window.entityRecordsSortSecondaryData.EntityCodeCasesSearchSortList,o.sortField=window.entityRecordsSortSecondaryData.EntityCodeCasesSearchSortList[0].Value),n.call(this,t,i,r,u,e.criteria)||this}return __extends(t,n),t}(app.Common.Controllers.PagedSearchController);n.EnerGovEntityCodeCaseSearchController=t})(t=n.CodeCase||(n.CodeCase={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){"use strict";angular.module("enerGov.CodeCase",["app.globalsModule","app.Common.Services","app.CustomFields","app.Draft"]).service("enerGovCodeCaseService",["http","globalsService","entityTabsService","$routeParams",n.Services.EnerGovCodeCaseService]).controller("EnerGovCodeCaseViewController",["$routeParams","$location","enerGovCodeCaseService","enerGovCustomFieldsService","customFieldsService","pageTitleService","tabNavigatorService","entityTabsService",n.EnerGovCodeCaseViewController]).controller("enerGovEntityCodeCaseSearchController",["$routeParams","$location","globalsService","enerGovCodeCaseService","entitySecondaryDataService",n.EnerGovEntityCodeCaseSearchController])})(t=n.CodeCase||(n.CodeCase={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){var i;(function(t){"use strict";var f=app.Common.CommonOptions,r=app.Common.SubContactTypeOptions,u=app.Common.HoldType,i=app.Common.SelfServiceModules,e=function(){function t(n,t,i,u,e,o,s,h,c,l){var a=this,v;this.userService=n;this.contactLicenseService=t;this.enerGovEntityHoldSearchService=i;this.certificationService=u;this.http=e;this.$q=o;this.$location=s;this.globalsService=h;this.$timeout=c;this.resourceService=l;this.contactCards=[];this.extendedContactCards=[];this.returnFromAddContact=!1;this.availableContactTypes=[];this.contacts=[];this.contactHoldInfos=[];this.copyContactHolds=[];this.isInvalidDefaultContact=!1;this.validationFailureDefaultContactName="";this.isContactValidationIsProgress=!1;this.isCertificationEnabled=null;this.showContactValidationAlert=!1;this.showPermitContactCertificationAlert=!1;this.permitContactCertificationErrorMessage="";this.validationFailureContactName="";this.showInvalidProfessionalLicenseAlert=!1;this.LicenseFailureContactName="";v=this;l.getSpecificKeyValues("SelfService.EnerGov.Resources.Common.CommonResource",["SelectType_Option"],function(n){v.defaultContactTypeName=n.SelectType_Option});this.addMe=function(n){var i=v.generateContactCardInfo(a.user,n,!1,!1,!0,!0),u,e,t;for(v.user.ParentContacts&&v.user.ParentContacts.length>0&&v.autoIncludeParentContactDuringApplication&&v.autoIncludeParentContactDuringApplication==f.Yes?((v.automaticallyInclude==r.Both||v.automaticallyInclude==r.Applicant)&&(v.allowRemovingOf==r.Applicant&&(i.IsRemovable=!0),v.addContact(i,!1,n)),(v.automaticallyInclude==r.Both||v.automaticallyInclude==r.Parent)&&(u=!1,v.allowRemovingOf==r.Parent&&(u=!0),v.user.ParentContacts.forEach(function(t){var i=v.generateContactCardInfo(t,n,!0,u);v.addContact(i,!1,n)}))):v.addContact(i,!1,n),e=function(){var i=v.availableContactTypes[t],u,r;i.ContactTypeId===n.ContactTypeId&&(i.isFilled=!0,i.GroupId!==0&&(u=v.availableContactTypes.filter(function(n){return n.IsRequired===!0&&n.IsDefaultOnlineContactType!==!0&&n!==i}),v.isContactGroupFilled(u,i.GroupId)&&v.contactGroupRemove(i.GroupId),r=v.availableContactTypes.filter(function(t){return t.GroupId===n.GroupId&&i.ContactTypeId!==n.ContactTypeId})[0],r&&(r.isFilled=!0)))},t=0;t<v.availableContactTypes.length;t++)e()};this.addContact=function(n,t,i,r){var u=a.$q.defer(),f,e,o;return r!==undefined&&r!==null&&r!==""&&(n.AccountType=r,a.extendedContactCards.push(n)),f=i===undefined||i===null?a.selectedContactType:i,a.selectedContactType=f,e=a.prepareAddContact(n,t),o=a.processContactHolds(n),a.$q.all([e,o]).then(function(){a.showContactValidationAlert||a.setContactTypeFilled(n);a.selectedContactType=a.availableContactTypes[0];u.resolve();v.returnFromAddContact===!0&&v.$location.url(v.returnToUrl)}),u.promise};this.removeCopiedContact=function(n){for(var i,t=0;t<a.contactCards.length;t++)n.ContactTypeId==a.contactCards[t].ContactTypeId&&n.ContactTypeName==a.contactCards[t].ContactTypeName&&n.FirstName==a.contactCards[t].FirstName&&n.LastName==a.contactCards[t].LastName&&n.Email==a.contactCards[t].Email&&n.CompanyName==a.contactCards[t].CompanyName&&(i=a.contactCards.indexOf(a.contactCards[t]));if(i>=0){for(t=0;t<a.availableContactTypes.length;t++)n.ContactTypeId==a.availableContactTypes[t].ContactTypeId&&n.ContactTypeName==a.availableContactTypes[t].Name&&(a.availableContactTypes[t].isFilled=!1);a.contactCards.splice(i,1)}};this.removeContact=function(n){var f=a.contactCards.indexOf(n),r,i,e,u,t;if(a.showPermitContactCertificationAlert=!1,a.permitContactCertificationErrorMessage="",f>=0){for(a.contactCards.splice(f,1),a.contactHoldInfos.length>0&&(r=a.contactHoldInfos.filter(function(t){return t.GlobalEntityId==n.EntityId&&t.IsRemovable&&!(a.contactCards.filter(function(t){return t.EntityId==n.EntityId}).length>0)}),r.length>0&&angular.forEach(r,function(n){a.contactHoldInfos.splice(a.contactHoldInfos.indexOf(n),1)})),i=a.copyContactHolds.length-1;i>=0;i--)a.copyContactHolds[i].Origin===n.EntityId&&a.copyContactHolds.splice(i,1);for(e=function(){var i=!0,r,f;n.ContactTypeId==a.availableContactTypes[t].ContactTypeId&&n.ContactTypeName==a.availableContactTypes[t].Name&&(a.availableContactTypes[t].GroupId!==0&&a.availableContactTypes[t].IsRequired===!0&&(a.setContactTypePlaceHolder(),u=a.availableContactTypes.filter(function(t){return t.ContactTypeId==n.ContactTypeId})[0],a.selectedContactType&&a.selectedContactType.ContactTypeId=="0"&&u&&(a.selectedContactType=u),a.markContactFilledForGroup(!1),r=a.availableContactTypes[t].GroupId,f=a.availableContactTypes.filter(function(n){return n.GroupId===r}),a.contactCards.forEach(function(n){f.forEach(function(r){var u=v.availableContactTypes.filter(function(n){return n.IsRequired===!0&&n.IsDefaultOnlineContactType!==!0&&n!==a.availableContactTypes[t]});if(r.ContactTypeId===n.ContactTypeId&&a.isContactGroupFilled(u,a.availableContactTypes[t].GroupId)){i=!1;return}})}),i&&a.contactGroupAdd(a.availableContactTypes[t].GroupId)),!a.availableContactTypes[t].IsRequired&&a.availableContactTypes[t].IsDefaultOnlineContactType&&(a.selectedContactType=a.availableContactTypes[t],a.removeClass()))},t=0;t<a.availableContactTypes.length;t++)e()}for(t=0;t<a.availableContactTypes.length;t++)_.findWhere(a.contactCards,{ContactTypeId:a.availableContactTypes[t].ContactTypeId})||(a.availableContactTypes[t].isFilled=!1)};this.createNewContact=function(n,t){var e=[],i=_.filter(a.contactCards,function(n){return n.EntityId===null||n.EntityId===""}),s,r,h,f,u,c;t&&i.push(t);s=function(n){return function(t){t.data.Success&&(n.EntityId=t.data.Result.GlobalEntityID)}};for(r in i)h=i[r].Email!==""?6:i[r].HomePhone!==""?2:i[r].MobilePhone!==""?3:1,f={GlobalEntityID:"",GlobalEntityName:i[r].CompanyName,ContactID:"",EMail:i[r].Email,FirstName:i[r].FirstName,LastName:i[r].LastName,MiddleName:i[r].MiddleName,BusinessPhone:i[r].BusinessPhone,HomePhone:i[r].HomePhone,MobilePhone:i[r].MobilePhone,PrefComm:h,IsActive:!1,IsNew:!0,IsDeleted:!1,ClientId:"",IsCompany:!1,IsContact:!0,Certifications:i[r].Certifications},u=n!==undefined&&n!==null&&n!==""?n:a.checkContactAccountType(i[r]),u!==undefined&&u!==null&&u!==""?(f.IsCompany=u=="1"||u=="3",f.IsContact=u=="2"||u=="3"):i[r].CompanyName!==""&&(f.IsCompany=!0,f.IsContact=!1),c=a.http.post("/energov/globalentities",f,function(){}).then(s(i[r])),e.push(c);return o.all(e)};this.saveContacts=function(){var r,i,t,n,u;for(a.contacts=[],r=!1,i=null,t=0;t<a.contactCards.length;t++){if(a.contactCards[t].IsBilling){r=!0;break}i===null&&a.contactCards[t].IsMe&&(i=t)}for(r||i==null?r||a.contactCards.length>0&&(a.contactCards[0].IsBilling=!0):a.contactCards[i].IsBilling=!0,n=0;n<a.contactCards.length;n++)u={ParentContactID:"",ParentID:"",ContactTypeID:a.contactCards[n].ContactTypeId,GlobalEntityID:a.contactCards[n].EntityId,GlobalEntityName:"",FirstName:a.contactCards[n].FirstName,LastName:a.contactCards[n].LastName,IsBilling:a.contactCards[n].IsBilling,EmailTo:a.contactCards[n].Email,IsPendingConfirmation:!1,IsNew:!0,IsDeleted:!1,ClientId:""},a.contacts.push(u);return a.validationFailureContactName="",a.showContactValidationAlert=!1,a.contacts}}return t.prototype.getUser=function(){var n=this;this.userService.isUserLoggedIn&&this.userService.getUser(function(t){n.user=t})},t.prototype.updatePermit=function(n,t){this.showContactValidationAlert=!1;this.http.post("/energov/permits/contact",n,function(n){n.Success&&t(n)})},t.prototype.validatePermitContact=function(n,t){var i=this;i.isContactValidationIsProgress=!0;i.$timeout(function(){i.http.post("/energov/permits/validateContact",n,function(n){n.Success&&(i.isContactValidationIsProgress=!1,t(n))},!1)})},t.prototype.validatePermitContacts=function(n,t){var i=this,r;i.isContactValidationIsProgress=!0;i.validationModule.PermitTypeID=this.caseTypeId;i.validationModule.PermitWorkClassID=this.caseTypeWorkClassId;i.validationModule.Contacts=i.saveContacts();r=i.validationModule.Contacts.map(function(n){return n.GlobalEntityID});i.$timeout(function(){i.certificationService.checkAndUpdateContactsCertificatesByEntityIds(r,function(){i.http.post("/energov/permits/validate-permit-contacts",n,function(n){n.Success&&(i.isContactValidationIsProgress=!1,t(n))},!1)})})},t.prototype.validateBusinessLicenseContact=function(n,t){var r=this,i=this;i.isContactValidationIsProgress=!0;i.$timeout(function(){r.http.post("/energov/licenses/businesslicenses/validateContact",n,function(n){n.Success&&(i.isContactValidationIsProgress=!1,t(n))},!1)})},t.prototype.updatePlan=function(n,t){this.http.post("/energov/plans/contact",n,function(n){n.Success&&t(n)})},t.prototype.updateProject=function(n,t){this.http.put("/energov/projects/contact",n,function(n){n.Success&&t(n)})},t.prototype.contactGroupExists=function(n){var t=ArrayExtensions.ArrayExtensions.contains(this.uniqueGroupIds,n);return t&&this.contactGroupRemove(n),t},t.prototype.contactGroupRemove=function(n){return ArrayExtensions.ArrayExtensions.remove(this.uniqueGroupIds,n)},t.prototype.contactGroupAdd=function(n){var t=ArrayExtensions.ArrayExtensions.contains(this.uniqueGroupIds,n);n==0||t||this.uniqueGroupIds.push(n)},t.prototype.setDefaultContactType=function(t,i){var h=this,r,e,f,u,s,c,o;if(i===void 0&&(i=!0),r=this,e=this.$q.defer(),!r.availableContactTypes||r.availableContactTypes.length<=0)return e.resolve(),e.promise;for(f=[],u=0;u<r.availableContactTypes.length;u++)r.availableContactTypes[u].IsDefaultOnlineContactType&&f.push(r.availableContactTypes[u]);if(f.length==0)for(console.log("setDefaultContactType: no available contact type with 'APPLICANT' system  type."),u=0;u<r.availableContactTypes.length;u++)if(r.availableContactTypes[u].LandManagementContactSystemTypeID===n.Common.CaseTypeUseEnums.LandManagementContactSystemType.Applicant){f.push(r.availableContactTypes[u]);break}if(f.length>0)for(u=0;u<f.length;u++)s=r.availableContactTypes.filter(function(n){return n.IsRequired===!0&&n.IsDefaultOnlineContactType!==!0&&n!==f[u]}),o=s.map(function(n){return n.GroupId}),r.uniqueGroupIds=ArrayExtensions.ArrayExtensions.unique(o),f[u]&&r.isContactGroupFilled(s,f[u].GroupId)&&r.contactGroupRemove(f[u].GroupId),r.contactGroupRemove(0);else c=r.availableContactTypes.filter(function(n){return n.IsRequired===!0&&n.IsDefaultOnlineContactType!==!0}),o=c.map(function(n){return n.GroupId}),r.uniqueGroupIds=ArrayExtensions.ArrayExtensions.unique(o),r.contactGroupRemove(0);if(this.contactCards.length>0&&this.contactCards.forEach(function(n){var t=n;r.selectedContactType=r.availableContactTypes.filter(function(n){return n.ContactTypeId==t.ContactTypeId})[0];r.selectedContactType!==undefined&&r.selectedContactType.IsRequired===!0&&r.selectedContactType.GroupId!==0&&(r.canSelectContactType=!1,r.removeContact(n),r.prepareAddContact(t,!1))}),i){if(f.length==0)return e.resolve(),e.promise;this.user?(this.addApplicantContactType(f),e.resolve()):r.userService.getUser(function(n){h.user=n;h.addApplicantContactType(f);e.resolve()})}return e.promise},t.prototype.addApplicantContactType=function(n){for(var t=0;t<n.length;t++)this.addMe(n[t])},t.prototype.generateContactCardInfo=function(n,t,i,r,u,f){u===void 0&&(u=!1);f===void 0&&(f=!1);var e=n.Address!=null,o={ParentAddressID:"",ParentID:"",ParcelID:"",ParcelNumber:"",ParcelAddressID:"",RowVersion:0,LastChangedBy:"",MailingAddressID:e?n.Address.MailingAddressID:"",CountryType:e?n.Address.CountryType:null,AddressType:e?n.Address.AddressType:"",Main:e?n.Address.Main:null,AddressLine1:e?n.Address.AddressLine1:"",AddressLine2:e?n.Address.AddressLine2:"",AddressLine3:e?n.Address.AddressLine3:"",City:e?n.Address.City:"",State:e?n.Address.State:"",County:e?n.Address.County:"",Country:e?n.Address.Country:"",PostalCode:e?n.Address.PostalCode:"",PreDirection:e?n.Address.PreDirection:"",PostDirection:e?n.Address.PostDirection:"",StreetType:e?n.Address.StreetType:"",AddressDisplay:e?n.Address.FullAddress:"",UnitOrSuite:e?n.Address.UnitOrSuite:"",Province:e?n.Address.Province:"",POBox:e?n.Address.POBox:"",CompSite:e?n.Address.CompSite:"",RuralRoute:e?n.Address.RuralRoute:"",Station:e?n.Address.Station:"",ATTN:"",GeneralDelivery:!1,Section:"",Range:"",Township:"",IsParcel:!1,IsNew:!1,IsDeleted:!1,ClientId:"",AddressSystemType:"",Associated:"",GisAddressId:"",FormattedAddressString:""};return{EntityId:n.OtherData,CompanyName:n.Company,FirstName:n.FirstName,MiddleName:n.MiddleName,LastName:n.LastName,Address:o,Email:n.Email,IsActive:!0,IsMe:u,ContactTypeId:t.ContactTypeId,ContactTypeName:t.Name,IsBilling:f,FullName:null,IsApplicant:!0,HomePhone:null,MobilePhone:null,BusinessPhone:null,IsLicenseValid:!0,ContactNumber:"",IsFavorite:!1,AccountType:null,IsContact:n.IsContact,IsCompany:n.IsCompany,IsParentContact:i,IsRemovable:r,Certifications:[]}},t.prototype.setContactTypePlaceHolder=function(){var n,t;this.availableContactTypes.length>0&&(this.availableContactTypes=this.availableContactTypes.filter(function(n){return n.ContactTypeId!="0"}),n=this.availableContactTypes.filter(function(n){return n.IsDefaultOnlineContactType===!0}),n.length>0?this.selectedContactType=n[0]:(t={ContactTypeId:"0",Name:this.defaultContactTypeName,IsRequired:!1,GroupId:0,isFilled:!1,LandManagementContactSystemTypeID:0,IsDefaultOnlineContactType:!1,IsValidateLic:!1,IsValidateBLLicense:!1,IsValidateILLicense:!1,RequiredValidLic:!1},this.availableContactTypes.unshift(t),this.selectedContactType=this.availableContactTypes[0]))},t.prototype.removeClass=function(){angular.element("#contactTypeSelect").removeClass("border-dropdown");this.availableContactTypes=this.availableContactTypes.filter(function(n){return n.ContactTypeId!="0"})},t.prototype.isContactGroupFilled=function(n,t){var i=n.filter(function(n){return n.GroupId===t&&n.isFilled});return i.length>0},t.prototype.updateCertificates=function(n,t){var i=this,r=this;this.certificationService.checkAndUpdateContactCertificates(n,function(n){n.Success&&(i.updatedCertificates=n.Result,t())})},t.prototype.markContactFilledForGroup=function(n){var i=this,r=this.availableContactTypes.filter(function(n){return n.ContactTypeId===i.selectedContactType.ContactTypeId&&n.GroupId!==0}).map(function(n){return n.GroupId}),t=this;this.availableContactTypes.forEach(function(u){var f,e;ArrayExtensions.ArrayExtensions.contains(r,u.GroupId)&&u.IsRequired===!0?(f=t.availableContactTypes.some(function(n){return n.GroupId===u.GroupId&&n.IsRequired===!0&&n.isFilled===!0}),f&&(u.isFilled=n),u.isFilled===!0&&t.contactGroupRemove(u.GroupId)):i.selectedContactType.ContactTypeId===u.ContactTypeId&&u.IsRequired===!0&&(e=t.contactCards.some(function(n){return n.ContactTypeId===u.ContactTypeId}),e||(u.isFilled=n))})},t.prototype.processContactHolds=function(n){var t=this,u=this.$location.path().split("/")[1].toUpperCase(),r=this.$q.defer();return n.EntityId?this.enerGovEntityHoldSearchService.getEntityContactHolds(n.EntityId,function(f){r.resolve();angular.forEach(f.Result,function(r){switch(u){case i[i.Permit].toUpperCase():t.setContactHoldData(n,r,r.HoldSetupInfo.EntOnlinePermitApplicant||r.HoldSetupInfo.PermitNew);break;case i[i.Plan].toUpperCase():t.setContactHoldData(n,r,r.HoldSetupInfo.EntOnlinePlanApplicant||r.HoldSetupInfo.PlanNew);break;case i[i.BusinessLicense].toUpperCase():case i[i.OperationalPermit].toUpperCase():t.setContactHoldData(n,r,r.HoldSetupInfo.EntBusinessLicRenewal||r.HoldSetupInfo.BNEWLICENSE);break;case i[i.ProfLicense].toUpperCase():t.setContactHoldData(n,r,r.HoldSetupInfo.EntProLicRenewal||r.HoldSetupInfo.PLRENEW)}})}):r.resolve(),r.promise},t.prototype.setContactHoldData=function(n,t,i){var f=this.contactHoldInfos.filter(function(n){return n.GlobalEntityId==t.Origin&&t.HoldTypeID==u.StopActionAndAlert&&n.IsBlock&&n.EntityHoldId==t.ParentHoldID}),r;f.length==0&&t.HoldTypeID==u.StopActionAndAlert&&(this.contactHoldInfos.push({GlobalEntityId:n.EntityId,IsAlert:!1,IsBlock:i,AlertMessage:t.AlertMessage,IsRemovable:n.IsRemovable!==undefined?n.IsRemovable:!0,ContactTypeId:n.ContactTypeId,ContactOrCompanyName:n.IsContact?n.FirstName+" "+n.LastName:n.CompanyName,EntityHoldId:t.ParentHoldID}),this.copyContactHolds.filter(function(n){return n.Origin==t.Origin&&t.ParentHoldID==n.ParentHoldID}).length==0&&(t.IsNew=!0,this.copyContactHolds.push(t)));r=this.contactHoldInfos.filter(function(n){return n.GlobalEntityId==t.Origin&&t.HoldTypeID==u.AlertMessageOnly&&n.EntityHoldId==t.ParentHoldID});r.length==0&&t.HoldTypeID==u.AlertMessageOnly&&(this.contactHoldInfos.push({GlobalEntityId:n.EntityId,IsAlert:!0,IsBlock:!1,AlertMessage:t.AlertMessage,IsRemovable:n.IsRemovable!==undefined?n.IsRemovable:!0,ContactTypeId:n.ContactTypeId,ContactOrCompanyName:n.IsContact?n.FirstName+" "+n.LastName:n.CompanyName,EntityHoldId:t.ParentHoldID}),this.copyContactHolds.filter(function(n){return n.Origin==t.Origin&&t.ParentHoldID==n.ParentHoldID}).length==0&&(t.IsNew=!0,this.copyContactHolds.push(t)))},t.prototype.validateContact=function(n,t){var i=this,r,u,e,f;return t===void 0&&(t=!1),r=this.$q.defer(),n.EntityId&&this.selectedContactType&&(this.selectedContactType.IsValidateLic||this.selectedContactType.IsValidateBLLicense||this.selectedContactType.IsValidateILLicense||this.selectedContactType.RequiredValidLic)?this.validationModule!=undefined&&this.validationModule!=null&&(u=angular.copy(this.validationModule),e={ParentContactID:"",ParentID:"",ContactTypeID:n.ContactTypeId,GlobalEntityID:n.EntityId,GlobalEntityName:"",FirstName:n.FirstName,LastName:n.LastName,IsBilling:n.IsBilling,EmailTo:n.Email,IsPendingConfirmation:!1,IsNew:!0,IsDeleted:!1,ClientId:""},u.Contacts.push(e),this.$location.path().toUpperCase().indexOf("CONTACT")===-1&&(this.returnToUrl=this.$location.path()),this.returnToUrl.toUpperCase().indexOf("PERMIT")>-1?(this.showPermitContactCertificationAlert=!1,this.permitContactCertificationErrorMessage="",r.resolve()):this.returnToUrl.toUpperCase().indexOf("BUSINESSLICENSE")>-1?(u.LicenseTypeId=this.caseTypeId,u.LicenseClassId=this.caseTypeWorkClassId,f=u.Location,this.showContactValidationAlert=!1,f&&f.ExtLocationID&&(u.Location=f.ExtLocationID),this.validateBusinessLicenseContact(u,function(u){u.Result!=null&&u.Result.length>0&&u.Success==!0?(t?(i.isInvalidDefaultContact=!0,i.validationFailureDefaultContactName=n.IsCompany&&n.CompanyName!=""?n.CompanyName+" Company ":n.FullName):(i.validationFailureContactName=i.validationFailureContactName!=""?i.validationFailureContactName.concat(", ",n.IsCompany&&n.CompanyName!=""?n.CompanyName+" Company ":n.FullName):n.IsCompany&&n.CompanyName!=""?n.CompanyName+" Company ":n.FullName,i.showContactValidationAlert=!0,i.removeContact(n)),r.resolve()):r.resolve()})):(this.returnToUrl.toUpperCase().indexOf("PLAN")>-1||this.returnToUrl.toUpperCase().indexOf("APPLICATION")>-1||this.returnToUrl.toUpperCase().indexOf("PROFLICENSE")>-1)&&r.resolve()):r.resolve(),r.promise},t.prototype.prepareAddContact=function(n,t){var f=this,s=this.contactCards.indexOf(n,-1),e=this,u=this.$q.defer(),o,i,r;return n.FullName||(n.FullName=e.userService.createFullName(n.LastName,n.FirstName,n.MiddleName)),n.IsBilling||(n.IsBilling=!1),n.IsApplicant||(n.IsApplicant=!1),n.IsMe?(this.contactCards.length<1?this.contactCards.push(n):(this.removeCopiedContact(n),this.contactCards.push(n)),this.returnToUrl=this.$location.path().toUpperCase(),r=this.validateContact(n,!0),this.$q.all([r]).then(function(){u.resolve()})):s<0&&(!this.selectedContactType||t||n.ContactTypeId||(n.ContactTypeId=this.selectedContactType.ContactTypeId,n.ContactTypeName=this.selectedContactType.Name),this.canSelectContactType!=!1||t||(this.selectedContactType.isFilled=!0),o=this.availableContactTypes.filter(function(n){return n.GroupId===f.selectedContactType.GroupId&&n.GroupId!==0&&n.IsRequired==!0}),this.selectedContactType===undefined||t||(this.selectedContactType.GroupId!==0&&o.length!=1?this.markContactFilledForGroup(!0):(i=this.availableContactTypes.filter(function(n){return n.ContactTypeId==f.selectedContactType.ContactTypeId&&n.GroupId!==0})[0],i!==undefined&&i.IsRequired===!0&&(e.contactGroupRemove(i.GroupId),this.availableContactTypes.forEach(function(n){n.GroupId===i.GroupId&&n.IsRequired===!0&&(n.isFilled=!0)})))),this.canSelectContactType!=!0||t||this.selectedContactType.IsRequired&&!this.selectedContactType.isFilled&&(this.selectedContactType.isFilled=!0),this.user&&n.EntityId===this.user.OtherData&&(n.IsMe=!0),this.contactCards.push(n),r=this.validateContact(n),this.$q.all([r]).then(function(){u.resolve()})),u.promise},t.prototype.setContactTypeFilled=function(n){var t=this.availableContactTypes.filter(function(t){return t.ContactTypeId===n.ContactTypeId&&t.Name===n.ContactTypeName});t&&t.length>0&&(t[0].isFilled=!0)},t.prototype.checkContactAccountType=function(n){for(var i="",t=0;t<this.extendedContactCards.length;t++)if(n.ContactTypeId==this.extendedContactCards[t].ContactTypeId&&n.ContactTypeName==this.extendedContactCards[t].ContactTypeName&&n.FirstName==this.extendedContactCards[t].FirstName&&n.LastName==this.extendedContactCards[t].LastName&&n.Email==this.extendedContactCards[t].Email&&n.CompanyName==this.extendedContactCards[t].CompanyName){i=this.extendedContactCards[t].AccountType;break}return i},t.prototype.cleanUp=function(){this.availableContactTypes=[];this.isInvalidDefaultContact=!1;this.contactCards=[];this.extendedContactCards=[];this.contactHoldInfos=[];this.isBusinessContactCopied=!1;this.getUser();this.showContactValidationAlert=!1;this.validationFailureContactName="";this.validationFailureDefaultContactName="";this.isContactValidationIsProgress=!1;this.certificationTypeIdList=[];this.validateCertificationsForAllContacts=!1;this.requireAllCertType=!1;this.showPermitContactCertificationAlert=!1;this.permitContactCertificationErrorMessage=""},t}();t.EnerGovContactCardsService=e})(i=t.Services||(t.Services={}))})(t=n.Contact||(n.Contact={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(n){this.http=n;this.rootUrl="/energov/contacts/license/permit/validation"}return n.prototype.validateLicense=function(n,t,i,r,u){var f="/"+n+"/"+t+"/"+i+"/"+r;return this.http.get(this.rootUrl+f,function(n){n.Success&&u(n)},!0)},n}();n.EnergovContactLicenseService=t})(t=n.Services||(n.Services={}))})(t=n.Contact||(n.Contact={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){this.http=n;this.entityTabsService=t;this.$routeParams=i;this.rootUrl="/energov/entity/contacts/search/search"}return n.prototype.searchByCriteria=function(n,t){var i=this;this.http.post(this.rootUrl,n,function(n){i.entityContacts=n.Result;(n.StatusCode===app.Common.Services.HttpStatusCode.NoContent||n.StatusCode===app.Common.Services.HttpStatusCode.Forbidden)&&(i.entityTabsService.showContactsTab=!1,i.$routeParams.tab&&i.$routeParams.tab==app.Constants.TabConstants.Contacts?i.entityTabsService.setAdditionalEntityTabsVisibility(i.$routeParams.tab,i.entityTabsService.showContactsTab):i.entityTabsService.setFirstTabOnHidingOtherTabs());t(n)},!0)},n.prototype.removeEntityContact=function(n){var t=this.entityContacts.indexOf(n);t!==-1&&this.entityContacts.splice(t,1)},n}();n.EnerGovEntityContactSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Contact||(n.Contact={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/entity/contacts/search/contactcertificates"}return n.prototype.searchByCriteria=function(n,t){this.http.post(this.rootUrl,n,function(n){t(n)},!0)},n}();n.EnerGovViewMyCertificatesSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Contact||(n.Contact={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=app.Common.AccountTypeEnums.AccountType,i=function(n){function i(i,r,u,f,e,o,s){var h=n.call(this,null)||this,c;if(h.$location=i,h.contactCardsService=r,h.settingsService=u,h.certificationService=f,h.$routeParams=e,h.$q=o,h.$scope=s,h.accountTypes=[],c=h,h.remainingCertificationTypeIdList=r.certificationTypeIdList,h.contactCardsService.isCertificationEnabled==null){var l=!1,a=!1,v=h.settingsService.getUserSetting("ManageCertificatesOnline",function(n){l=n&&n.toLowerCase()==="true"}),y=h.certificationService.getEnerGovIsLicenseIntegratedSetting(function(n){a=n});h.$q.all([v,y]).then(function(){h.contactCardsService.isCertificationEnabled=a&&l})}return c.model={ContactTypeId:"",GlobalEntityId:"",GlobalEntityName:"",FirstName:"",LastName:"",Email:"",MobilePhone:"",BusinessPhone:"",HomePhone:"",AccountType:t.Individual.toString(),Certifications:[]},h}return __extends(i,n),i.prototype.fillCertificate=function(n){this.model.Certifications.push(n);this.remainingCertificationTypeIdList=this.remainingCertificationTypeIdList.filter(function(t){return n.CertificationTypeId!=t})},i.prototype.removeCertification=function(n){var t=this,i=this.model.Certifications.filter(function(t){return t.CertificationTypeId==n.CertificationTypeId}).length;this.model.Certifications.splice(this.model.Certifications.indexOf(n),1);t.contactCardsService.certificationTypeIdList.some(function(t){return t==n.CertificationTypeId})&&i==1&&this.remainingCertificationTypeIdList.push(n.CertificationTypeId)},i.prototype.addManualContact=function(){var n=this,i=this,t;i.isSubmitClicked=!0;t={EntityId:null,CompanyName:this.model.GlobalEntityName,FirstName:this.model.FirstName,MiddleName:null,LastName:this.model.LastName,FullName:this.model.FirstName+" "+this.model.LastName,HomePhone:this.model.HomePhone,MobilePhone:this.model.MobilePhone,BusinessPhone:this.model.BusinessPhone,Address:null,Email:this.model.Email,IsActive:!1,IsMe:!1,ContactTypeId:null,ContactTypeName:null,IsLicenseValid:!0,ContactNumber:"",IsFavorite:!1,IsContact:!0,IsCompany:!1,Certifications:this.model.Certifications};this.contactCardsService.selectedContactType===null?(this.isSelectedContextTypeNull=!0,this.$scope.$apply()):(this.contactCardsService.validationFailureContactName="",this.contactCardsService.showContactValidationAlert=!1,this.contactCardsService.createNewContact(this.model.AccountType,t).then(function(){var i=n.contactCardsService.addContact(t,!1,null,n.model.AccountType);n.$q.all([i]).then(function(){var i,u,r;n.$routeParams.id!==null&&n.$routeParams.id!==undefined?n.contactCardsService.showContactValidationAlert?(n.contactCardsService.validationFailureContactName=t.FullName,n.utilities.showMessage(t.FullName+" "+n.utilities.getResourceMessage("ContactLicenseInvalidAlertMessage")),n.contactCardsService.returnFromAddContact=!0,n.delayInvoke(function(){n.$location.url(n.contactCardsService.returnToUrl)})):(n.caseNumber=n.$routeParams.id,i=_.findWhere(n.contactCardsService.contactCards,{FirstName:t.FirstName,LastName:t.LastName}),i&&(u={EntityId:n.caseNumber,ParentContactId:"",GlobalEntityId:i.EntityId,ContactTypeId:i.ContactTypeId,GlobalEntityName:i.CompanyName,FirstName:i.FirstName,LastName:i.LastName,IsNew:!0,IsDeleted:!1,ClientId:"",Certifications:i.Certifications},n.$location.path().toUpperCase().indexOf("PERMIT")>-1&&(r=n,n.contactCardsService.updatePermit(u,function(n){n!=null&&r.$location.url(r.contactCardsService.returnToUrl)})),n.$location.path().toUpperCase().indexOf("PLAN")>-1&&(r=n,n.contactCardsService.updatePlan(u,function(n){n!=null&&r.$location.url(r.contactCardsService.returnToUrl)}))),n.contactCardsService.contactCards=[]):(n.contactCardsService.returnFromAddContact=!0,n.delayInvoke(function(){n.$location.url(n.contactCardsService.returnToUrl)}))})}))},i}(app.Core.Controllers.CoreController);n.EnerGovAddContactManuallyController=i})(t=n.Contact||(n.Contact={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f,e,o,s){var h=n.call(this,i,r,u,e)||this;return h.contactCardsService=f,h.favoriteContactService=e,h.eventService=o,h.scope=s,h.isSelectedContextTypeNull=!1,h}return __extends(t,n),t.prototype.init=function(){var n=this;n.initializeSearchCriteria();n.search(n.searchCriteria,app.Events.SearchEvents.SearchCompleted);n.scope.$on("FavoriteContactAddedRemoved",function(){n.search(n.searchCriteria,app.Events.SearchEvents.SearchCompleted)})},t.prototype.initializeSearchCriteria=function(){this.criteria={IsSortedInAscendingOrder:!0,PageNumber:1,PageSize:10,SortField:"ContactNumber",ModuleId:0,EntityId:null};this.searchCriteria=this.criteria},t.prototype.addContact=function(n){this.contactCardsService.selectedContactType===null?this.isSelectedContextTypeNull=!0:this.eventService.boradcast("FavoriteContactAdded",n)},t}(app.Common.Controllers.PagedGenericSearchController);n.EnerGovAddFavoriteContactController=t})(t=n.Contact||(n.Contact={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u){var f=n.call(this,null)||this,e;return f.$scope=t,f.$routeParams=i,f.$location=r,f.contactCardsService=u,f.isApplication=!0,e=f,e.canSelectContactType=u.canSelectContactType,(r.url()==="/permit/apply/contact"||r.url()==="/plan/apply/contact")&&(u.returnToUrl==null||u.returnToUrl==="")&&r.url("/home/dashboard"),i.id!==null&&i.id!==undefined&&(e.isApplication=!1),e.$location.path().toUpperCase().indexOf("APPLY")>-1&&e.$location.path().toUpperCase().indexOf("APPLY/CONTACT")<0&&e.contactCardsService.setContactTypePlaceHolder(),$("#contactTypesDropDown").click(function(n){n.stopPropagation()}),e.contactCards=function(){return f.contactCardsService.contactCards},e.addContact=function(n){f.contactCardsService.addContact(n,!1)},e.removeContact=function(n){f.contactCardsService.removeContact(n);var t=angular.element("#contactCardsId");t&&t.focus()},e.toAddContact=function(){if(f.contactCardsService.selectedContactType&&f.contactCardsService.selectedContactType.ContactTypeId==="0"){angular.element("#contactTypeSelect").addClass("border-dropdown");angular.element("#contactTypeSelect").removeAttr("aria-label");angular.element("#contactTypeSelect").attr("aria-label",f.contactCardsService.defaultContactTypeName.toString());angular.element("#contactTypeSelect").focus();return}e.contactCardsService.canSelectContactType=!0;f.contactCardsService.returnToUrl=r.url();e.setLocationUrl()},e.toAddRequiredContact=function(n){e.contactCardsService.canSelectContactType=!1;e.contactCardsService.selectedContactType=n;f.contactCardsService.returnToUrl=r.url();e.setLocationUrl()},e.setLocationUrl=function(){f.$location.path().toUpperCase().indexOf("OPERATIONALPERMIT")>-1?f.$location.url("/operationalPermit/apply/contact"):f.$location.path().toUpperCase().indexOf("PERMIT")>-1?f.$location.url("/permit/apply/contact"):f.$location.path().toUpperCase().indexOf("PLAN")>-1?f.$location.url("/plan/apply/contact"):f.$location.path().toUpperCase().indexOf("BUSINESSLICENSE/APPLY")>-1?f.$location.url("/businessLicense/apply/contact"):f.$location.path().toUpperCase().indexOf("BUSINESSLICENSE/RENEW")>-1?f.$location.url("/businessLicense/renew/contact"):f.$location.path().toUpperCase().indexOf("PROFLICENSE/RENEW")>-1?f.$location.url("/profLicense/renew/contact"):f.$location.path().toUpperCase().indexOf("PROFLICENSE/APPLY")>-1?f.$location.url("/profLicense/apply/contact"):f.$location.path().toUpperCase().indexOf("APPLICATION/APPLY")>-1&&f.$location.url("/application/apply/contact")},e.returnToUrl=function(){f.contactCardsService.returnFromAddContact=!0;r.url(f.contactCardsService.returnToUrl)},e.checkCondition=function(n){var t=!1;return n.GroupId===0&&(t=!0),n.IsRequired&&!n.isFilled&&t},e.checkGroupCondition=function(n){var t=!1;return n.GroupId!==0&&(t=!0),n.IsRequired&&!n.isFilled&&t},e.filledContactGroupIdCondition=function(n){var t=e.contactCardsService.availableContactTypes.filter(function(t){return t.GroupId===n});return t.every(function(n){return n.isFilled!==!0})},f}return __extends(t,n),t}(app.Core.Controllers.CoreController);n.EnerGovContactCardsController=t})(t=n.Contact||(n.Contact={}))}(EnerGov||(EnerGov={}));__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){"use strict";var i,t;(function(n){n[n.Global=0]="Global";n[n.Permit=1]="Permit";n[n.Plan=2]="Plan";n[n.Code=3]="Code";n[n.Request=4]="Request";n[n.Application=6]="Application";n[n.Inspection=7]="Inspection";n[n.BusinessLicense=8]="BusinessLicense";n[n.BusinessEntity=9]="BusinessEntity";n[n.Cashier=10]="Cashier";n[n.ProfLicense=11]="ProfLicense";n[n.TaxRemittance=12]="TaxRemittance"})(i=n.AuthorizationModules||(n.AuthorizationModules={}));t=function(n){function t(t,i,r,u,f,e,o,s,h){var c=n.call(this,i,r,u,f,null,!1)||this,l,a;return c.$scope=t,c.$routeParams=i,c.$location=r,c.enerGovEntityContactSearchService=f,c.contactCardsService=o,c.$modal=s,c.$timeout=h,c.processing=!1,c.processed=!1,c.contactDeletedText="- ",c.removeError=!1,c.toAddContact=function(){if(c.contactCardsService.isCertificationEnabled=null,c.contactCardsService.requireAllCertType=!1,c.contactCardsService.validateCertificationsForAllContacts=!1,c.contactCardsService.certificationTypeIdList=[],c.contactCardsService.canSelectContactType=!0,c.contactCardsService.canAddManualContact=!0,c.parent.model!==null&&c.parent.model!==undefined)if(c.$location.path().toUpperCase().indexOf("PERMIT")>-1){if(c.contactCardsService.caseTypeId=c.parent.model.PermitTypeId,c.contactCardsService.caseTypeWorkClassId=c.parent.model.PermitWorkClassId,c.parent&&c.parent.workClassTemplate){var n=c.parent.workClassTemplate;n&&n.CertificationTypeList&&(c.contactCardsService.requireAllCertType=n.RequireAllCertType,c.contactCardsService.validateCertificationsForAllContacts=n.ValidateCertificationsForAllContacts,c.contactCardsService.certificationTypeIdList=[],n.CertificationTypeList.forEach(function(n){c.contactCardsService.certificationTypeIdList.push(n.SimpleLicenseCertTypeID)}))}}else c.$location.path().toUpperCase().indexOf("BUSINESSLICENSE")>-1&&(c.contactCardsService.caseTypeId=c.parent.model.LicenseTypeId,c.contactCardsService.caseTypeWorkClassId=c.parent.model.LicenseClassId);c.checkContactsTypeRequired(c.parent.contactTypeList);c.contactCardsService.returnToUrl=c.$location.url();c.setLocationUrl()},c.setLocationUrl=function(){c.$location.path().toUpperCase().indexOf("PERMIT")>-1&&c.$location.url("/permit/{0}/contact".replace("{0}",c.caseNumber));c.$location.path().toUpperCase().indexOf("PLAN")>-1&&c.$location.url("/plan/{0}/contact".replace("{0}",c.caseNumber));c.$location.path().toUpperCase().indexOf("PROJECT")>-1&&c.$location.url("/project/{0}/contact".replace("{0}",c.caseNumber))},l=c,a=t.$parent,c.parent=a.vm,e.getEntityRecordSortSecondaryData(function(n){(l.searchCriteria.ModuleId===app.Common.SelfServiceModules.BusinessEntity||l.searchCriteria.ModuleId===app.Common.SelfServiceModules.Code||l.searchCriteria.ModuleId===app.Common.SelfServiceModules.Request)&&n.Result.EntityContactSearchSortList.forEach(function(t){(l.searchCriteria.ModuleId===app.Common.SelfServiceModules.BusinessEntity||l.searchCriteria.ModuleId===app.Common.SelfServiceModules.Request)&&t.Value==="ISBILLING"?n.Result.EntityContactSearchSortList.splice(n.Result.EntityContactSearchSortList.indexOf(t),1):l.searchCriteria.ModuleId===app.Common.SelfServiceModules.Code&&t.Value==="TITLE"&&n.Result.EntityContactSearchSortList.splice(n.Result.EntityContactSearchSortList.indexOf(t),1)});l.sortList=n.Result.EntityContactSearchSortList;l.sortField=n.Result.EntityContactSearchSortList[0].Value}),c.$routeParams.id!=null&&(c.caseNumber=c.$routeParams.id),c.search(c.searchCriteria,app.Events.SearchEvents.SearchCompleted),l.isUpdateContactSupported=c.$location.path().toUpperCase().indexOf("PROJECT")>-1?app.Common.Helpers.VersionSupport(c.globalService.enerGovAPIVersion,"2021.3.1.0"):!0,c}return __extends(t,n),t.prototype.getGroupId=function(n){if(this.parent.workClassTemplate&&this.parent.workClassTemplate.ContactTypeList){for(var t=0;t<this.parent.workClassTemplate.ContactTypeList.length;t++)if(n.ContactTypeId===this.parent.workClassTemplate.ContactTypeList[t].LandManagementContactTypeID)return this.parent.workClassTemplate.ContactTypeList[t].ContactTypeGroup}else return-1},t.prototype.canRemoveContact=function(n){var i,r,t,u;if(this.parent.workClassTemplate&&this.parent.workClassTemplate.ContactTypeList)for(i=0;i<this.parent.workClassTemplate.ContactTypeList.length;i++)if(n.ContactTypeId===this.parent.workClassTemplate.ContactTypeList[i].LandManagementContactTypeID&&(!this.parent.workClassTemplate.ContactTypeList[i].IsRequired||this.enerGovEntityContactSearchService.entityContacts.filter(function(t){return t.ContactTypeId===n.ContactTypeId}).length>1))return!0;if(r=this.getGroupId(n),r===0){for(t=0;t<this.enerGovEntityContactSearchService.entityContacts.length;t++)if(this.enerGovEntityContactSearchService.entityContacts[t].GlobalEntityId!==n.GlobalEntityId&&this.enerGovEntityContactSearchService.entityContacts[t].ContactTypeId===n.ContactTypeId)return!0}else for(t=0;t<this.enerGovEntityContactSearchService.entityContacts.length;t++)if(u=this.getGroupId(this.enerGovEntityContactSearchService.entityContacts[t]),r===u&&this.enerGovEntityContactSearchService.entityContacts[t].GlobalEntityId!==n.GlobalEntityId)return!0;return!1},t.prototype.showUnlinkConfirmation=function(n){var t=this;t.contactDeletedText=n.FirstName+" "+n.LastName;n.GlobalEntityName&&(t.contactDeletedText+=n.FirstName&&n.LastName?", "+n.GlobalEntityName:n.GlobalEntityName);this.modalInstance=this.$modal.open({templateUrl:"removeContact.html",controller:["$scope",function(i){i.contactDeletedText=t.contactDeletedText;i.onOk=function(){t.unlinkContact(n);angular.element("#btn_"+n.ContactId).focus();t.cancel();i.isOpen=!1};i.onCancel=function(){t.cancel();i.isOpen=!1;angular.element("#btn_"+n.ContactId).focus()}}]});setTimeout(function(){angular.element("#removeContact").focus()},2e3)},t.prototype.unlinkContact=function(n){var t=this,r=!0,i;r=this.canRemoveContact(n);r?(i={EntityId:this.caseNumber,ParentContactId:n.ContactId,GlobalEntityId:"",ContactTypeId:"",GlobalEntityName:n.GlobalEntityName,FirstName:n.FirstName,LastName:n.LastName,IsNew:!1,IsDeleted:!0,ClientId:"",IsLicenseValid:!0,Certifications:[]},this.$location.path().toUpperCase().indexOf("PERMIT")>-1&&this.contactCardsService.updatePermit(i,function(n){n!=null&&t.search(t.searchCriteria,app.Events.SearchEvents.SearchCompleted)}),this.$location.path().toUpperCase().indexOf("PLAN")>-1&&this.contactCardsService.updatePlan(i,function(n){n!=null&&t.search(t.searchCriteria,app.Events.SearchEvents.SearchCompleted)}),this.$location.path().toUpperCase().indexOf("PROJECT")>-1&&this.contactCardsService.updateProject(i,function(n){n!=null&&t.search(t.searchCriteria,app.Events.SearchEvents.SearchCompleted)})):(this.removeErrorContactType=n.ContactTypeName,this.removeError=!0,this.$timeout(function(){$("#removeContactErrorMessage").focus()}))},t.prototype.cancel=function(){this.modalInstance.dismiss("cancel")},t.prototype.checkContactsTypeRequired=function(n){var i,t;if(this.contactCardsService.availableContactTypes=[],n){for(i=0;i<n.length;i++)t=n[i],this.contactCardsService.availableContactTypes.push({ContactTypeId:t.LandManagementContactTypeID,Name:t.Name,IsRequired:t.IsRequired,GroupId:t.ContactTypeGroup,isFilled:!1,LandManagementContactSystemTypeID:t.LandManagementContactSystemTypeID,IsDefaultOnlineContactType:t.IsDefaultOnlineContactType,IsValidateLic:t.IsValidateLic,IsValidateBLLicense:t.IsValidateBLLicense,IsValidateILLicense:t.IsValidateILLicense,RequiredValidLic:t.RequiredValidLic});this.contactCardsService.availableContactTypes.length>0&&(this.contactCardsService.selectedContactType=this.contactCardsService.availableContactTypes[0])}},t}(app.Common.Controllers.PagedSearchController);n.EnerGovEntityContactSearchController=t})(t=n.Contact||(n.Contact={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f,e,o,s,h){var l=n.call(this,t,i,r,u,null,!1)||this,c;l.enerGovViewMyCertificatesSearchService=u;l.certificationService=e;l.enerGovSettingsService=o;l.userService=s;l.$q=h;l.isCertificationEnabled=!1;l.Certifications=[];l.showSpinner=!1;c=l;c.Certifications=[];c.showSpinner=!1;var a=!1,v=!1,y=c.enerGovSettingsService.getUserSetting("ManageCertificatesOnline",function(n){a=n&&n.toLowerCase()==="true"}),p=c.certificationService.getEnerGovIsLicenseIntegratedSetting(function(n){v=n});return c.$q.all([y,p]).then(function(){c.isCertificationEnabled=v&&a}),f.getEntityRecordSortSecondaryData(function(n){c.sortList=n.Result.ViewMyCertificatesSearchSortList;c.sortField=n.Result.ViewMyCertificatesSearchSortList[0].Value;var t={PageNumber:1,SortField:c.sortField,IsSortedInAscendingOrder:!0,PageSize:c.globalService.pageSizeList[0].Value,EntityId:"",ModuleId:0};c.searchCriteria=t;c.search(t,app.Events.SearchEvents.SearchCompleted)}),l}return __extends(t,n),t.prototype.fillCertificate=function(n){var t=this;t.Certifications.push(n);t.showSpinner=!0;t.userService.saveGlobalEntityCertifications(t.Certifications,function(n){n&&(t.search(t.searchCriteria,app.Events.SearchEvents.SearchCompleted),t.Certifications=[],t.showSpinner=!1)})},t}(app.Common.Controllers.PagedSearchController);n.EnerGovViewMyCertificatesController=t})(t=n.Contact||(n.Contact={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){"use strict";var t=n.Services.EnerGovEntityContactSearchService,i=n.Services.EnerGovContactCardsService,r=n.EnerGovEntityContactSearchController;angular.module("enerGov.Contact",["app.Services.Utilities","app.globalsModule","app.Common.Services","enerGov.Common","ui.bootstrap.modal","app.Users","app.Certification"]).service("enerGovEntityContactSearchService",["http","entityTabsService","$routeParams",t]).service("energovContactLicenseService",["http",n.Services.EnergovContactLicenseService]).service("enerGovContactCardsService",["userService","energovContactLicenseService","enerGovEntityHoldSearchService","certificationService","http","$q","$location","globalsService","$timeout","resourceService",i]).service("enerGovViewMyCertificatesSearchService",["http",n.Services.EnerGovViewMyCertificatesSearchService]).controller("enerGovContactCardsController",["$scope","$routeParams","$location","enerGovContactCardsService",n.EnerGovContactCardsController]).controller("enerGovAddContactManuallyController",["$location","enerGovContactCardsService","enerGovSettingsService","certificationService","$routeParams","$q","$scope",n.EnerGovAddContactManuallyController]).controller("enerGovEntityContactSearchController",["$scope","$routeParams","$location","globalsService","enerGovEntityContactSearchService","entitySecondaryDataService","enerGovContactCardsService","$modal","$timeout",r]).controller("enerGovAddFavoriteContactController",["http","$routeParams","$location","globalsService","enerGovContactCardsService","favoriteContactService","eventService","$scope",n.EnerGovAddFavoriteContactController]).controller("enerGovViewMyCertificatesController",["$routeParams","$location","globalsService","enerGovViewMyCertificatesSearchService","entitySecondaryDataService","certificationService","enerGovSettingsService","userService","$q",n.EnerGovViewMyCertificatesController])})(t=n.Contact||(n.Contact={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){var r=this,u;this.http=n;this.entityTabsService=t;this.$routeParams=i;u=this;u.getCheckListById=function(n,t){r.http.get(r.rootUrl+"/"+t,function(t){t.Success&&n(t.Result)},!1)}}return n.prototype.searchByCriteria=function(n,t){var i=this;this.rootUrl="/energov/entity/checklist/search";this.http.post(this.rootUrl,n,function(n){n.Success||(n.StatusCode===app.Common.Services.HttpStatusCode.NoContent||n.StatusCode===app.Common.Services.HttpStatusCode.Forbidden?i.entityTabsService.showCheckListsTab=!1:n.StatusCode===app.Common.Services.HttpStatusCode.PreconditionFailed&&(i.entityTabsService.showCheckListsTab=!0),i.$routeParams.tab&&i.$routeParams.tab==app.Constants.TabConstants.Checklists?i.entityTabsService.setAdditionalEntityTabsVisibility(i.$routeParams.tab,i.entityTabsService.showCheckListsTab):i.entityTabsService.setFirstTabOnHidingOtherTabs());t(n)},!0)},n}();n.EnerGovEntityCheckListSearchService=t})(t=n.Services||(n.Services={}))})(t=n.CheckList||(n.CheckList={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f){var e=n.call(this,t,i,r,u,null,!1)||this,o=e;return window.entityRecordsSortSecondaryData===null||typeof entityRecordsSortSecondaryData=="undefined"?f.getEntityRecordSortSecondaryData(function(n){o.sortList=n.Result.EntityCheckListSearchSortList;o.sortField=n.Result.EntityCheckListSearchSortList[0].Value;o.searchCriteria.SortField=n.Result.EntityCheckListSearchSortList[0].Value;e.search(e.searchCriteria,app.Events.SearchEvents.SearchCompleted);window.entityRecordsSortSecondaryData=n.Result}):(o.sortList=window.entityRecordsSortSecondaryData.EntityCheckListSearchSortList,o.sortField=window.entityRecordsSortSecondaryData.EntityCheckListSearchSortList[0].Value,o.searchCriteria.SortField=window.entityRecordsSortSecondaryData.EntityCheckListSearchSortList[0].Value,e.search(e.searchCriteria,app.Events.SearchEvents.SearchCompleted)),e}return __extends(t,n),t}(app.Common.Controllers.PagedSearchController);n.EnerGovEntityCheckListSearchController=t})(t=n.CheckList||(n.CheckList={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){"use strict";var i=t.Services.EnerGovEntityCheckListSearchService,r=n.CheckList.EnerGovEntityCheckListSearchController;angular.module("enerGov.CheckList",["app.globalsModule","app.Common.Services","enerGov.Common"]).service("enerGovEntityCheckListSearchService",["http","entityTabsService","$routeParams",i]).controller("enerGovEntityCheckListSearchController",["$routeParams","$location","globalsService","enerGovEntityCheckListSearchService","entitySecondaryDataService",r])})(t=n.CheckList||(n.CheckList={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/entity/holds/"}return n.prototype.searchByCriteria=function(n,t){this.http.post(this.rootUrl+"search",n,function(n){t(n)},!0)},n.prototype.searchHoldsForEntityTab=function(n,t){return this.http.post(this.rootUrl+"/search",n,function(n){t(n)},!1)},n.prototype.getEntityContactHolds=function(n,t){this.http.get(this.rootUrl+"contactholds/"+n,function(n){t(n)},!1)},n.prototype.isEntityHoldsExist=function(n,t,i){return this.http.get(this.rootUrl+("isEntityHoldsExist/"+n+"/"+t),function(n){i(n.Result)},!1)},n.prototype.getCaseHolds=function(n,t,i){return this.http.get(this.rootUrl+(n+"/"+t),function(n){i(n.Result)},!1)},n.prototype.getParcelHolds=function(n,t){return this.http.post(this.rootUrl+"parcelholds/",n,function(n){t(n.Result)},!1)},n}();n.EnerGovEntityHoldSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Hold||(n.Hold={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f){var e=n.call(this,t,i,r,u,null,!1)||this;return e.entitySecondaryDataService=f,e}return __extends(t,n),t.prototype.init=function(){var n=this,t=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id);this.criteria={PageNumber:1,PageSize:this.globalService.pageSizeList[0].Value,SortField:"",IsSortedInAscendingOrder:!0,ModuleId:t,EntityId:this.$routeParams.id};this.entitySecondaryDataService.sortSecondaryData===null||typeof this.entitySecondaryDataService.sortSecondaryData=="undefined"?this.entitySecondaryDataService.getEntityRecordSortSecondaryData(function(t){n.sortList=t.Result.EntityHoldSearchSortList;n.sortField=t.Result.EntityHoldSearchSortList[0].Value}):(n.sortList=this.entitySecondaryDataService.sortSecondaryData.Result.EntityHoldSearchSortList,n.sortField=this.entitySecondaryDataService.sortSecondaryData.Result.EntityHoldSearchSortList[0].Value);this.search(this.criteria,app.Events.SearchEvents.SearchCompleted)},t}(app.Common.Controllers.PagedSearchController);n.EnerGovEntityHoldSearchController=t})(t=n.Hold||(n.Hold={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){angular.module("enerGov.Hold",["app.globalsModule","app.Common.Services","enerGov.Common"]).service("enerGovEntityHoldSearchService",["http",n.Services.EnerGovEntityHoldSearchService]).controller("enerGovEntityHoldSearchController",["$routeParams","$location","globalsService","enerGovEntityHoldSearchService","entitySecondaryDataService",n.EnerGovEntityHoldSearchController])})(t=n.Hold||(n.Hold={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/entity/notes/search"}return n.prototype.searchByCriteria=function(n,t){this.http.post(this.rootUrl,n,function(n){t(n)},!0)},n}();n.EnerGovEntityNoteSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Note||(n.Note={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f){var e=n.call(this,t,i,r,u)||this,o=e,s=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(i,t.id);return e.criteria={PageNumber:1,PageSize:r.pageSizeList[0].Value,SortField:"",IsSortedInAscendingOrder:!0,ModuleId:s,EntityId:t.id},f.getEntityRecordSortSecondaryData(function(n){o.sortList=n.Result.EntityNoteSearchSortList;o.sortField=n.Result.EntityNoteSearchSortList[0].Value}),e}return __extends(t,n),t}(app.Common.Controllers.PagedSearchController);n.EnerGovEntityNoteSearchController=t})(t=n.Note||(n.Note={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(){"use strict";var t=n.Note.Services.EnerGovEntityNoteSearchService,i=n.Note.EnerGovEntityNoteSearchController;angular.module("enerGov.Note",["app.globalsModule","app.Common.Services","enerGov.Common"]).service("enerGovEntityNoteSearchService",["http",t]).controller("enerGovEntityNoteSearchController",["$routeParams","$location","globalsService","enerGovEntityNoteSearchService","entitySecondaryDataService",i])})(t=n.Note||(n.Note={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){this.http=n;this.entityTabsService=t;this.$routeParams=i;this.rootUrl="/energov/entity/violations/search"}return n.prototype.searchByCriteria=function(n,t){var i=this;this.http.post(this.rootUrl,n,function(n){n.Success||(n.StatusCode===app.Common.Services.HttpStatusCode.PreconditionFailed?i.entityTabsService.showViolationsTab=!0:(n.StatusCode===app.Common.Services.HttpStatusCode.NoContent||n.StatusCode===app.Common.Services.HttpStatusCode.Forbidden)&&(i.entityTabsService.showViolationsTab=!1),i.$routeParams.tab&&i.$routeParams.tab==app.Constants.TabConstants.Violations?i.entityTabsService.setAdditionalEntityTabsVisibility(i.$routeParams.tab,i.entityTabsService.showViolationsTab):i.entityTabsService.setFirstTabOnHidingOtherTabs());t(n)},!0)},n}();n.EnerGovEntityViolationSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Violation||(n.Violation={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f){var e=n.call(this,t,i,r,u)||this,o=e,s=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(i,t.id);return e.criteria={PageNumber:1,PageSize:r.pageSizeList[0].Value,SortField:"",IsSortedInAscendingOrder:!0,ModuleId:s,EntityId:t.id},f.getEntityRecordSortSecondaryData(function(n){o.sortList=n.Result.EntityViolationSearchSortList;o.sortField=n.Result.EntityViolationSearchSortList[0].Value}),e}return __extends(t,n),t}(app.Common.Controllers.PagedSearchController);n.EnerGovEntityViolationSearchController=t})(t=n.Violation||(n.Violation={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(){"use strict";var t=n.Violation.Services.EnerGovEntityViolationSearchService,i=n.Violation.EnerGovEntityViolationSearchController;angular.module("enerGov.Violation",["app.globalsModule","app.Common.Services","enerGov.Common"]).service("enerGovEntityViolationSearchService",["http","entityTabsService","$routeParams",t]).controller("enerGovEntityViolationSearchController",["$routeParams","$location","globalsService","enerGovEntityViolationSearchService","entitySecondaryDataService",i])})(t=n.Violation||(n.Violation={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(){}return n.getInspectionSearchCriteria=function(n,t,i,r,u){u===void 0&&(u=!1);var f=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(t,i.id);return{PageNumber:1,PageSize:n.pageSizeList[0].Value,SortField:"",IsSortedInAscendingOrder:!0,ModuleId:f,EntityId:i.id,IsExistingInspection:r,IsOptionalInspection:u,IsFailed:t.path().indexOf("attentionSummary")!==-1}},n}();n.EntityInspectionSearchHelper=t})(t=n.Helpers||(n.Helpers={}))})(t=n.Inspection||(n.Inspection={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=app.Common.HoldType,i=app.Common.SelfServiceModules,r=function(){function n(n,t,i,r,u,f,e){this.http=n;this.userService=t;this.eventService=i;this.resourceService=r;this.$routeParams=u;this.entityTabsService=f;this.$timeout=e;this.isExistingInspectionsDataPresent=!1;this.entityRemainingInspections=[];this.entityOptionalInspections=[];this.processRemainingInspections=function(n){var t=this;angular.forEach(n,function(n){var r=$.grep(t.entityRemainingInspections,function(t){return t.WorkflowActionId===n.WorkflowActionId}),i;r.length>0&&(n.CanRequestInspection&&n.IsAllowRequestInspectionByPriority?n.Checked=!0:(i=$.grep(t.entityRemainingInspections,function(t){return t.WorkflowActionId!==n.WorkflowActionId}),t.entityRemainingInspections=i))})};this.processOptionalInspections=function(n){var t=this;angular.forEach(n,function(n){var r=$.grep(t.entityOptionalInspections,function(t){return t.WorkflowStepId===n.WorkflowStepId&&t.ActionId===n.ActionId}),i;r.length>0&&(n.CanRequestInspection?n.Checked=!0:(i=$.grep(t.entityOptionalInspections,function(t){return t.WorkflowStepId!==n.WorkflowStepId||t.ActionId!==n.ActionId}),t.entityOptionalInspections=i))})};this.getHoldMessageErrorResource=function(){var n=this;n.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Hold.HoldResource",["PermitHoldErrorMessage","PlanHoldErrorMessage","BusinessLicenseHoldErrorMessage"],function(t){n.permitHoldErrorMessage=t.PermitHoldErrorMessage;n.planHoldErrorMessage=t.PlanHoldErrorMessage;n.licenseHoldErrorMessage=t.BusinessLicenseHoldErrorMessage})};var o=this;this.getUser();this.getHoldMessageErrorResource();this.eventService.on("userInfo",function(n,t){t[0]||(o.entityRemainingInspections=[])})}return n.prototype.getHoldMessageForInspection=function(n,r){if(n&&n.length>0)switch(r.ModuleId){case i.Permit:if(n.filter(function(n){return n.HoldTypeID==t.StopActionAndAlert&&(n.HoldSetupInfo.PermitInspection||n.HoldSetupInfo.EntOnlineInspectionRequest)}).length>0)return n.filter(function(n){return n.HoldTypeID==t.StopActionAndAlert&&(n.HoldSetupInfo.PermitInspection||n.HoldSetupInfo.EntOnlineInspectionRequest)&&n.AlertMessage!==""}).length>0?n.filter(function(n){return n.HoldTypeID==t.StopActionAndAlert&&(n.HoldSetupInfo.PermitInspection||n.HoldSetupInfo.EntOnlineInspectionRequest)&&n.AlertMessage!==""})[0].AlertMessage:this.permitHoldErrorMessage;break;case i.Plan:if(n.filter(function(n){return n.HoldTypeID==t.StopActionAndAlert&&(n.HoldSetupInfo.PlanInspection||n.HoldSetupInfo.EntOnlineInspectionRequest)}).length>0)return n.filter(function(n){return n.HoldTypeID==t.StopActionAndAlert&&(n.HoldSetupInfo.PlanInspection||n.HoldSetupInfo.EntOnlineInspectionRequest)&&n.AlertMessage!=""}).length>0?n.filter(function(n){return n.HoldTypeID==t.StopActionAndAlert&&(n.HoldSetupInfo.PlanInspection||n.HoldSetupInfo.EntOnlineInspectionRequest)&&n.AlertMessage!==""})[0].AlertMessage:this.planHoldErrorMessage;break;case i.BusinessLicense:if(n.filter(function(n){return n.HoldTypeID==t.StopActionAndAlert&&n.HoldSetupInfo.EntOnlineInspectionRequest}).length>0)return n.filter(function(n){return n.HoldTypeID==t.StopActionAndAlert&&n.HoldSetupInfo.EntOnlineInspectionRequest&&n.AlertMessage!==""}).length>0?n.filter(function(n){return n.HoldTypeID==t.StopActionAndAlert&&n.HoldSetupInfo.EntOnlineInspectionRequest&&n.AlertMessage!==""})[0].AlertMessage:this.licenseHoldErrorMessage}},n.prototype.searchByCriteria=function(n,t){var r=this,i;this.rootUrl="/energov/entity/inspections/search/search";i=this;i.$timeout(function(){r.http.post(r.rootUrl,n,function(u){u.Success?(n.IsOptionalInspection?(i.processOptionalInspections(u.Result),i.entityTabsService.optionalinspectionStatus=u.StatusCode):n.IsExistingInspection?n.IsExistingInspection&&(u.Result&&u.Result!==null&&u.Result.length>0&&(r.isExistingInspectionsDataPresent=!0),i.entityTabsService.existinginspectionStatus=u.StatusCode):(i.processRemainingInspections(u.Result),i.entityTabsService.remaininginspectionStatus=u.StatusCode),i.entityTabsService.setInspectionTabsVisibility(u,n.ModuleId)):(n.IsOptionalInspection?i.entityTabsService.optionalinspectionStatus=u.StatusCode:n.IsExistingInspection?n.IsExistingInspection&&(i.entityTabsService.existinginspectionStatus=u.StatusCode):i.entityTabsService.remaininginspectionStatus=u.StatusCode,i.entityTabsService.setInspectionTabsVisibility(u,n.ModuleId));t(u)},!1)},1e3)},n.prototype.searchInspectionByCriteria=function(n,t){this.rootUrl="/energov/entity/inspections/search/unauth";var i=this;this.http.post(this.rootUrl,n,function(n){t(n)},!1)},n.prototype.getUser=function(){var n=this;this.userService.isUserLoggedIn&&this.userService.getUser(function(t){n.user=t})},n}();n.EnerGovEntityInspectionSearchService=r})(t=n.Services||(n.Services={}))})(t=n.Inspection||(n.Inspection={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r,u,f){this.http=n;this.$q=t;this.$http=i;this.enerGovInspectionService=r;this.entityTabsService=u;this.$routeParams=f;var e=this}return n.prototype.searchByCriteria=function(n,t){var i=this;this.rootUrl="/energov/entity/previousInspections/search";n.parentId=this.enerGovInspectionService.parentId;this.http.post(this.rootUrl,n,function(n){n.Success||(n.StatusCode===app.Common.Services.HttpStatusCode.NoContent||n.StatusCode===app.Common.Services.HttpStatusCode.Forbidden?i.entityTabsService.showPreviousTab=!1:n.StatusCode===app.Common.Services.HttpStatusCode.PreconditionFailed&&(i.entityTabsService.showPreviousTab=!0),i.$routeParams.tab&&i.$routeParams.tab==app.Constants.TabConstants.Previous?i.entityTabsService.setAdditionalEntityTabsVisibility(i.$routeParams.tab,i.entityTabsService.showPreviousTab):i.entityTabsService.setFirstTabOnHidingOtherTabs());t(n)},!0)},n}();n.EnerGovEntityPreviousInspectionsService=t})(t=n.Services||(n.Services={}))})(t=n.Inspection||(n.Inspection={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t){var i=this,r;this.http=n;this.resourceService=t;this.rootUrl="/energov/inspections/";this.inspectionTypesSelectedVersion2=[];this.inspectionLimitsVersion2=[];this.limitAvailbilityRequestVersion2=null;this.limitAvailbilityRequestsVersion2=null;this.inspectionLimitResultsVersion2=null;this.availabilityMessage="";this.showAlert=!1;this.resourceIsSuccess="";this.resourceIsEmpty="";this.resourceAlertStart="";this.resourceAlertEnd="";r=this;r.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Inspection.InspectionResource",["InspectionLimit_isEmpty","InspectionLimit_isSuccess","InspectionLimit_AlertStart","InspectionLimit_AlertEnd"],function(n){i.resourceIsEmpty=n.InspectionLimit_isEmpty;i.resourceIsSuccess=n.InspectionLimit_isSuccess;i.resourceAlertStart=n.InspectionLimit_AlertStart;i.resourceAlertEnd=n.InspectionLimit_AlertEnd})}return n.prototype.getInspectionLimitsVersion2=function(n,t){return this.http.post(this.rootUrl+"check-availability",n,function(n){n.Success&&t(n)},!1)},n.prototype.cleanup=function(){this.inspectionLimitResultsVersion2=null;this.limitAvailbilityRequestsVersion2=[];this.availabilityMessage="";this.showAlert=!1},n.prototype.checkAvailability=function(n){var t=this,u=!0,r=!0,i,f;if(this.cleanup(),n.length>0){for(i=0;i<n.length;i++)!n[i].IsSuccess&&n[i].RequestedDate&&(u=!1,f=moment(n[i].RequestedDate).format("MM-DD-YYYY"),this.limitAvailbilityRequestVersion2={inspectionTypeId:n[i].InspectionTypeId,inspectionType:n[i].InspectionType,checkDate:f},this.limitAvailbilityRequestsVersion2.push(this.limitAvailbilityRequestVersion2));u?this.availabilityMessage=this.resourceIsEmpty:this.getInspectionLimitsVersion2(this.limitAvailbilityRequestsVersion2,function(n){var i,u;for(t.inspectionLimitResultsVersion2=n.Result,i=0;i<t.inspectionLimitResultsVersion2.length;i++)if(!t.inspectionLimitResultsVersion2[i].IsSuccess){r=!1;break}if(!r)for(i=0;i<t.inspectionLimitResultsVersion2.length;i++)u=_.uniq(t.inspectionLimitResultsVersion2[i].InspectionTypeNames,function(n){return n}),t.inspectionLimitResultsVersion2[i].InspectionTypeNames=u;r?t.availabilityMessage=t.resourceIsSuccess:t.showAlert=!0})}},n}();n.EnerGovInspectionsCheckAvailabilityService=t})(t=n.Services||(n.Services={}))})(t=n.Inspection||(n.Inspection={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=app.Common.Helpers.VersionSupport,i=function(){function n(n,t,i,r,u){var f=this;this.http=n;this.timeout=t;this.$q=i;this.$http=r;this.globalsService=u;this.rootUrl="/energov/inspections/";this.inspectionViewTabNumber=0;this.processing=!1;this.processed=!1;this.inspectionSettings=null;this.reinspectionWaitTimes=[];this.secondaryData=null;this.disableEnerGovNonWorkDay=function(n,t,i){for(var r,f,e=Date.UTC(n.getFullYear(),n.getMonth(),n.getDate()),u=0;u<i.length;u++)if(r=new Date(i[u].toString()),f=Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()),e==f)return!1;return!0};this.cancelInspection=function(n,t,i){$("#cancelInspectionModal").modal("show");f.inspectionId=n;f.moduleId=t;f.entityId=i;f.processed=!1;f.processing=!1;$("#cancelInspectionModal").on("hidden.bs.modal",function(n){$(n.target).removeData("bs.modal")})};this.submitCancelInspection=function(){var n=f;n.processing=!0;n.inspectionInfo={InspectionId:f.inspectionId,ModuleId:f.moduleId,EntityId:f.entityId};f.inspectionCancellation(n.inspectionInfo,function(t){n.processing=!1;n.processed=!0;t.Result||$("#cancelInspectionModal").modal("hide")})}}return n.prototype.getById=function(n,t){return this.http.get(this.rootUrl+"getById/"+n,function(n){t(n.Result)},!1)},n.prototype.createDatePickerSetting=function(n,t){var u=this,i=this.inspectionSettings.MaxRequestDateString,r;return t.Dates.length&&(r=t.Dates[t.Dates.length-1],i=this.getDateAsString(r)),{datePickerOptions:{formatYear:"yyyy",startingDay:0,showWeeks:!1,maxDate:i},disableEnerGovNonWorkDay:function(n,i){return u.disableEnerGovNonWorkDay(n,i,t.Dates)}}},n.prototype.getDateAsString=function(n){var t=new Date(n.toString());return(t.getMonth()+1).toString()+"/"+t.getDate().toString()+"/"+t.getFullYear()},n.prototype.getInspectionStatus=function(n){var t;t=this.rootUrl+"inspection/status";this.http.get(t,function(t){t.Success?n(t.Result):n(null)},!1)},n.prototype.getInspectionTypeById=function(n,t){var i=this;return this.http.get(this.rootUrl+"inspectionType/"+n,function(n){n.Success&&t(n.Result)},!0)},n.prototype.getInspectionCustomField=function(n,t){this.http.get(this.rootUrl+"customfields/"+n,function(n){t(n.Result)},!0)},n.prototype.getSecondaryData=function(n){var i=this;this.globalsService.enerGovAPIVersion&&t(this.globalsService.enerGovAPIVersion,"2019.2.0.0")?this.secondaryData?n(this.secondaryData):this.http.get(this.rootUrl+"search/setup",function(t){t.Success&&(i.secondaryData=t.Result,n(t.Result))},!1):n(null)},n.prototype.rescheduleInspectionClick=function(){$("#rescheduleInspection").modal("show");$("#RequestDate")[0].focus()},n.prototype.inspectionCancellation=function(n,t){this.http.post(this.rootUrl+"cancel",n,function(n){t(n)},!0)},n.prototype.requestInspections=function(n,t){this.http.post(this.rootUrl+"schedule",n,function(n){t(n)},!1)},n.prototype.rescheduleInspection=function(n,t,i,r){var u={InspectionId:n,RequestDate:t,AmOrPm:i};this.http.post(this.rootUrl+"reschedule",u,function(n){r(n)},!1)},n.prototype.searchByCriteria=function(n,t){var i=this;i.http.post(i.rootUrl+"todaysinspections/",n,function(n){n.Success&&t(n)},!0)},n.prototype.getInspectionSettings=function(n){var t=this;t.inspectionSettings==null?this.http.get(this.rootUrl+"settings",function(i){i.Success&&(t.inspectionSettings=i.Result,n(i.Result))},!1):n(t.inspectionSettings)},n.prototype.getAvailableScheduleDates=function(n,t,i,r){var f=new Date,u=f.getFullYear(),e=f.getMonth(),o=f.getDate(),c=moment(new Date(u,e,o)).format("YYYY-MM-DD"),s="",h;t==null?(t=new Date,u=t.getFullYear()+1):(t=new Date(t.toString()),u=t.getFullYear());e=t.getMonth();o=t.getDate();s=moment(new Date(u,e,o)).format("YYYY-MM-DD");h={inspectionTypeId:n,StartDate:c,EndDate:s,UserId:null,LinkId:i};this.http.post(this.rootUrl+"available-schedule-dates",h,function(n){n.Success&&r(n.Result)},!0)},n}();n.EnerGovInspectionService=i})(t=n.Services||(n.Services={}))})(t=n.Inspection||(n.Inspection={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/inspections/";this.remainingInspections=[];this.isSelectAll=!1;this.http=n;var t=this;this.searchByCriteria=function(n,i){t.http.post(t.rootUrl+"myremaininginspections/",n,function(n){if(n.Success){var r=!0,u=!1;angular.forEach(n.Result,function(n){for(var i=0;i<t.remainingInspections.length;i++)if(n.WorkflowActionId===t.remainingInspections[i].WorkflowActionId){n.Selected=!0;break}n.CanRequestInspection&&!n.ActiveHolds&&n.Issued&&(t.inspectionSettings.InspectionAlwaysAllowRequest||!n.UnPaidFees)&&n.Selected===!1&&(r=!1);n.CanRequestInspection&&!n.ActiveHolds&&n.Issued&&(t.inspectionSettings.InspectionAlwaysAllowRequest||!n.UnPaidFees)&&(u=!0)});(n.Result===null||n.Result.length===0||u===!1)&&(r=!1);t.isSelectAll=r;i(n)}},!0)}}return n}();n.EnerGovMyRemainingInspectionsService=t})(t=n.Services||(n.Services={}))})(t=n.Inspection||(n.Inspection={}))}(EnerGov||(EnerGov={}));__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){"use strict";var i=function(t){function i(i,r,u,f,e,o,s,h){var c=t.call(this,i,r,u,e,n.Inspection.Helpers.EntityInspectionSearchHelper.getInspectionSearchCriteria(u,r,i,!0))||this,l;return c.$rootScope=f,c.enerGovEntityInspectionSearchService=e,c.enerGovInspectionService=s,c.entityTabsService=h,c.processing=!1,c.processed=!1,c.cancelInspection=function(n){c.enerGovInspectionService.cancelInspection(n,c.moduleId,c.entityId)},c.submitCancelInspection=function(){c.enerGovInspectionService.submitCancelInspection()},c.reloadGrid=function(){$("#cancelInspectionModal").modal("hide");c.search(c.searchCriteria,app.Events.SearchEvents.PageLoadCompleted);c.$rootScope.$broadcast(app.Events.GridEvents[app.Events.GridEvents.Reload])},c.rescheduleInspection=function(n){var t=c;t.enerGovInspectionService.getAvailableScheduleDates(n.InspectionTypeId,t.enerGovInspectionService.inspectionSettings.MaxRequestDate,n.EntityId,function(i){t.enerGovEntityInspectionSearchService.rescheduleInspectionDatePickerSetting=t.enerGovInspectionService.createDatePickerSetting(n,i);t.enerGovEntityInspectionSearchService.rescheduleInspectionDatePickerSetting.InspectionId=n.InspectionId;t.enerGovInspectionService.rescheduleInspectionClick()})},l=c,c.tenantName=c.globalService.tenantUrl,c.moduleId=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(c.$location,c.$routeParams.id),c.entityId=c.$routeParams.id,l.enerGovInspectionService.getInspectionSettings(function(){}),window.entityRecordsSortSecondaryData===null||typeof entityRecordsSortSecondaryData=="undefined"?o.getEntityRecordSortSecondaryData(function(n){l.sortList=n.Result.EntityExistingInspectionSearchSortList;l.sortField=n.Result.EntityExistingInspectionSearchSortList[0].Value;window.entityRecordsSortSecondaryData=n.Result}):(l.sortList=window.entityRecordsSortSecondaryData.EntityExistingInspectionSearchSortList,l.sortField=window.entityRecordsSortSecondaryData.EntityExistingInspectionSearchSortList[0].Value),c}return __extends(i,t),i}(app.Common.Controllers.PagedSearchController);t.EnerGovEntityExistingInspectionSearchController=i})(t=n.Inspection||(n.Inspection={}))}(EnerGov||(EnerGov={}));__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){"use strict";var i=function(t){function i(i,r,u,f,e,o,s,h,c,l){var a=t.call(this,i,r,f,o,n.Inspection.Helpers.EntityInspectionSearchHelper.getInspectionSearchCriteria(f,r,i,!1,!0))||this,v;return a.$window=u,a.$rootScope=e,a.enerGovEntityInspectionSearchService=o,a.entityTabsService=h,a.settingsService=c,a.intentsService=l,a.holdMessage="",a.useNewRequestInspections=!1,a.parentEntityValidation=function(){var t=$("#optionalInspectionSection").scope().$parent,n=t.vm.model;return(a.holdMessage=a.enerGovEntityInspectionSearchService.getHoldMessageForInspection(n.EntityHolds,a.searchCriteria),typeof n!="undefined"&&a.searchCriteria.ModuleId===app.Common.SelfServiceModules.Permit)?n.HoldExistOnInspection||n.UnPaidFees||!n.Issued:typeof n!="undefined"&&a.searchCriteria.ModuleId===app.Common.SelfServiceModules.Plan?n.HoldExistOnInspection||n.UnPaidFees:typeof n!="undefined"&&(a.searchCriteria.ModuleId===app.Common.SelfServiceModules.BusinessLicense||a.searchCriteria.ModuleId===app.Common.SelfServiceModules.ProfLicense)?n.HoldExistOnInspection||n.UnPaidFees||!n.Issued:typeof n!="undefined"&&a.allowInspectionRequest(a.searchCriteria.ModuleId)?n.HoldExist||n.UnPaidFees:!0},a.disableRequestButton=function(){return a.allowInspectionRequest(a.searchCriteria.ModuleId)?a.enerGovEntityInspectionSearchService.entityOptionalInspections.length==0||a.parentEntityValidation():!0},a.addOrRemoveInspection=function(n,t){if(t)this.allowInspectionRequest(this.searchCriteria.ModuleId)&&this.enerGovEntityInspectionSearchService.entityOptionalInspections.push(n);else if(this.allowInspectionRequest(this.searchCriteria.ModuleId)){var i=this.enerGovEntityInspectionSearchService.entityOptionalInspections.indexOf(n);this.enerGovEntityInspectionSearchService.entityOptionalInspections.splice(i,1)}},a.findInspection=function(n,t){return n.filter(function(n){return n.moduleId===t})[0]},a.requestInspections=function(){var n=this;if(this.useNewRequestInspections)this.intentsService.getIntent("View","RequestInspections","Default",function(t){var o=t.URI,i=[],r={moduleId:n.searchCriteria.ModuleId,optionalWorkFlowActionIds:[],entityId:n.searchCriteria.EntityId},f,e,u;n.enerGovEntityInspectionSearchService.entityOptionalInspections.forEach(function(n){r.optionalWorkFlowActionIds.push(n.ActionId)});f=n.settingsService.getRequestInspections();f?(e=JSON.parse(f),e.length===0?i.push(r):(u=n.findInspection(e,n.searchCriteria.ModuleId),u?(u.optionalWorkFlowActionIds=r.optionalWorkFlowActionIds.filter(function(n,t,i){return i.indexOf(n)===t}),i.push(u)):i.push(r))):i.push(r);n.settingsService.storeRequestInspections(i);n.$window.open(o,"_blank")});else switch(this.searchCriteria.ModuleId){case app.Common.SelfServiceModules.Permit:this.$location.path("/permit/request/inspections/"+this.$routeParams.id+"/true");break;case app.Common.SelfServiceModules.Plan:this.$location.path("/plan/request/inspections/"+this.$routeParams.id+"/true");break;case app.Common.SelfServiceModules.BusinessLicense:this.$location.path("/businessLicense/request/inspections/"+this.$routeParams.id+"/true");break;case app.Common.SelfServiceModules.ProfLicense:this.$location.path("/profLicense/request/inspections/"+this.$routeParams.id+"/true");break;case app.Common.SelfServiceModules.OperationalPermit:this.$location.path("/operationalPermit/request/inspections/"+this.$routeParams.id+"/true")}},a.allowInspectionRequest=function(){return this.searchCriteria.ModuleId===app.Common.SelfServiceModules.Permit||this.searchCriteria.ModuleId===app.Common.SelfServiceModules.Plan||this.searchCriteria.ModuleId===app.Common.SelfServiceModules.BusinessLicense||this.searchCriteria.ModuleId===app.Common.SelfServiceModules.ProfLicense?!0:!1},v=a,v.settingsService.getSoftwarePackageSetting("UseUpdatedInspectionRequests",function(n){v.useNewRequestInspections=n&&n.SettingValue==="true"}),window.entityRecordsSortSecondaryData===null||typeof entityRecordsSortSecondaryData=="undefined"?s.getEntityRecordSortSecondaryData(function(n){v.sortList=n.Result.EntityOptionalInspectionSearchSortList;v.sortField=n.Result.EntityOptionalInspectionSearchSortList[0].Value;window.entityRecordsSortSecondaryData=n.Result}):(v.sortList=window.entityRecordsSortSecondaryData.EntityOptionalInspectionSearchSortList,v.sortField=window.entityRecordsSortSecondaryData.EntityOptionalInspectionSearchSortList[0].Value),v.$rootScope.$on(app.Events.GridEvents[app.Events.GridEvents.Reload],function(){v.search(v.searchCriteria,app.Events.SearchEvents.PageLoadCompleted)}),a}return __extends(i,t),i}(app.Common.Controllers.PagedSearchController);t.EnerGovEntityOptionalInspectionSearchController=i})(t=n.Inspection||(n.Inspection={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f,e,o){var s=n.call(this,t,i,r,u,null,!1)||this,h,c;return s.enerGovEntityPreviousInspectionsService=u,s.enerGovInspectionService=e,s.$q=o,h=s,s.tenantName=s.globalService.tenantUrl,window.entityRecordsSortSecondaryData===null||typeof entityRecordsSortSecondaryData=="undefined"?f.getEntityRecordSortSecondaryData(function(n){h.sortList=n.Result.EntityPreviousInspectionsSortList;h.sortField=n.Result.EntityPreviousInspectionsSortList[0].Value;window.entityRecordsSortSecondaryData=n.Result}):(h.sortList=window.entityRecordsSortSecondaryData.EntityPreviousInspectionsSortList,h.sortField=window.entityRecordsSortSecondaryData.EntityPreviousInspectionsSortList[0].Value),c=s.enerGovInspectionService.getById(s.$routeParams.id,function(n){s.inspectionModel=n}),s.$q.when(c).then(function(){s.pvCriteria=s.getPreviousInspectionsCriteria();s.pvCriteria.SortField=s.sortField;s.pvCriteria.EntityId!==null&&s.pvCriteria.EntityId!==""&&s.pvCriteria.EntityId!==undefined&&h.inspectionModel&&(s.pvCriteria.parentId=s.inspectionModel.LinkId,s.search(s.pvCriteria,app.Events.SearchEvents.SearchCompleted))}),s}return __extends(t,n),t.prototype.getPreviousInspectionsCriteria=function(){return{EntityId:this.$routeParams.id,IsSortedInAscendingOrder:!0,ModuleId:7,PageNumber:1,PageSize:10,parentId:this.parentId,SortField:""}},t}(app.Common.Controllers.PagedSearchController);n.EnerGovEntityPreviousInspectionsController=t})(t=n.Inspection||(n.Inspection={}))}(EnerGov||(EnerGov={}));__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){"use strict";var i=function(t){function i(i,r,u,f,e,o,s,h,c,l){var a=t.call(this,i,r,f,o,n.Inspection.Helpers.EntityInspectionSearchHelper.getInspectionSearchCriteria(f,r,i,!1))||this,v;return a.$window=u,a.$rootScope=e,a.enerGovEntityInspectionSearchService=o,a.entityTabsService=h,a.settingsService=c,a.intentsService=l,a.holdMessage="",a.useNewRequestInspections=!1,a.parentEntityValidation=function(){var n=$("#optionalInspectionSection").scope().$parent;return(a.parent=n.vm.model,a.holdMessage=a.enerGovEntityInspectionSearchService.getHoldMessageForInspection(a.parent.EntityHolds,a.searchCriteria),typeof a.parent!="undefined"&&a.searchCriteria.ModuleId===app.Common.SelfServiceModules.Permit)?a.parent.HoldExistOnInspection||a.parent.UnPaidFees||!a.parent.Issued:typeof a.parent!="undefined"&&a.searchCriteria.ModuleId===app.Common.SelfServiceModules.Plan?a.parent.HoldExistOnInspection||a.parent.UnPaidFees:typeof a.parent!="undefined"&&(a.searchCriteria.ModuleId===app.Common.SelfServiceModules.BusinessLicense||a.searchCriteria.ModuleId===app.Common.SelfServiceModules.ProfLicense||a.searchCriteria.ModuleId==app.Common.SelfServiceModules.OperationalPermit)?a.parent.HoldExistOnInspection||a.parent.UnPaidFees||!a.parent.Issued:typeof a.parent!="undefined"&&a.allowInspectionRequest()?a.parent.HoldExist||a.parent.UnPaidFees:!0},a.disableRequestButton=function(){return a.allowInspectionRequest()?a.enerGovEntityInspectionSearchService.entityRemainingInspections.length==0||a.parentEntityValidation():!0},a.hideRequestButton=function(){return a.allowInspectionRequest()?!1:!0},a.addOrRemoveInspection=function(n,t){if(t)this.allowInspectionRequest()&&this.enerGovEntityInspectionSearchService.entityRemainingInspections.push(n);else if(this.allowInspectionRequest()){var i=this.enerGovEntityInspectionSearchService.entityRemainingInspections.indexOf(n);this.enerGovEntityInspectionSearchService.entityRemainingInspections.splice(i,1)}},a.allowInspectionRequest=function(){return this.searchCriteria.ModuleId===app.Common.SelfServiceModules.Permit||this.searchCriteria.ModuleId===app.Common.SelfServiceModules.Plan||this.searchCriteria.ModuleId===app.Common.SelfServiceModules.BusinessLicense||this.searchCriteria.ModuleId===app.Common.SelfServiceModules.ProfLicense||this.searchCriteria.ModuleId===app.Common.SelfServiceModules.OperationalPermit?!0:!1},a.findInspection=function(n,t){return n.filter(function(n){return n.moduleId===t})[0]},a.requestInspections=function(){var n=this;if(this.useNewRequestInspections)this.intentsService.getIntent("View","RequestInspections","Default",function(t){var o=t.URI,i=[],r={moduleId:n.searchCriteria.ModuleId,entityId:n.searchCriteria.EntityId,workflowActionIds:[]},f,e,u;n.enerGovEntityInspectionSearchService.entityRemainingInspections.forEach(function(n){r.workflowActionIds.push(n.WorkflowActionId)});f=n.settingsService.getRequestInspections();f?(e=JSON.parse(f),e.length===0?i.push(r):(u=n.findInspection(e,n.searchCriteria.ModuleId),u?(u.workflowActionIds=r.workflowActionIds.filter(function(n,t,i){return i.indexOf(n)===t}),i.push(u)):i.push(r))):i.push(r);n.settingsService.storeRequestInspections(i);n.$window.open(o,"_blank")});else switch(this.searchCriteria.ModuleId){case app.Common.SelfServiceModules.Permit:this.$location.path("/permit/request/inspections/"+this.$routeParams.id+"/false");break;case app.Common.SelfServiceModules.Plan:this.$location.path("/plan/request/inspections/"+this.$routeParams.id+"/false");break;case app.Common.SelfServiceModules.BusinessLicense:this.$location.path("/businessLicense/request/inspections/"+this.$routeParams.id+"/false");break;case app.Common.SelfServiceModules.ProfLicense:this.$location.path("/profLicense/request/inspections/"+this.$routeParams.id+"/false");break;case app.Common.SelfServiceModules.OperationalPermit:this.$location.path("/operationalPermit/request/inspections/"+this.$routeParams.id+"/false")}},v=a,v.settingsService.getSoftwarePackageSetting("UseUpdatedInspectionRequests",function(n){v.useNewRequestInspections=n&&n.SettingValue==="true"}),window.entityRecordsSortSecondaryData===null||typeof entityRecordsSortSecondaryData=="undefined"?s.getEntityRecordSortSecondaryData(function(n){v.sortList=n.Result.EntityRemainingInspectionSearchSortList;v.sortField=n.Result.EntityRemainingInspectionSearchSortList[0].Value;window.entityRecordsSortSecondaryData=n.Result}):(v.sortList=window.entityRecordsSortSecondaryData.EntityRemainingInspectionSearchSortList,v.sortField=window.entityRecordsSortSecondaryData.EntityRemainingInspectionSearchSortList[0].Value),v.$rootScope.$on(app.Events.GridEvents[app.Events.GridEvents.Reload],function(){v.search(v.searchCriteria,app.Events.SearchEvents.PageLoadCompleted)}),a}return __extends(i,t),i}(app.Common.Controllers.PagedSearchController);t.EnerGovEntityRemainingInspectionSearchController=i})(t=n.Inspection||(n.Inspection={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){"use strict";var t=app.Common.HoldType,i=app.Common.SelfServiceModules,u=function(){function n(n,t,i,r,u,f,e,o,s,h,c,l){var a,v,y;this.$routeParams=n;this.$location=t;this.localStorageService=i;this.enerGovEntityInspectionSearchService=r;this.enerGovInspectionService=u;this.inspectionsCheckAvailabilityService=f;this.resourceService=e;this.$q=o;this.enerGovCustomFieldsService=s;this.customFieldsService=h;this.enerGovEntityHoldSearchService=c;this.globalsService=l;this.storageKey="requestInspections";this.inspections=[];this.allowMultipleRequest=!1;this.requireContactInfo=!1;this.allowRequestInspectionOnWeekendAndHoliday=!1;this.isSameDate=!1;this.isSameContact=!1;this.amPmDllList=[];this.reinspectionWaitTimes=[];this.requestAllCount=0;this.isRequestAll=!1;this.isRequestAllButtonVisible=!0;this.useAMPMForInspection=!1;this.dateFormat="";this.defaultYesOption=app.Common.CommonOptions.Yes;this.inspectionTypesSelected={inspectionTypeIds:[],checkDate:null};this.getModuleName=function(){return this.$location.path().split("/")[1].toUpperCase()};this.backToList=function(){window.history.back()};this.removeInspection=function(n){var t=this.getModuleName();(t==="PERMIT"||t==="PLAN"||t==="BUSINESSLICENSE"||t==="PROFLICENSE")&&(this.inspections=this.$routeParams.isOptionalInspections==="true"?$.grep(this.inspections,function(t){return t.WorkflowStepId!==n.WorkflowStepId||t.ActionId!==n.ActionId}):$.grep(this.inspections,function(t){return t.WorkflowActionId!==n.WorkflowActionId}),this.removeItemFromInspectionList(n))};this.processExecutionResult=function(n){var i=this,t=i.findInspections(i.inspections,n)[0];t.IsSuccess=n.IsSuccess;t.IsBusy=!1;t.ErrorMessage=n.ErrorMessage;$("#"+t.WorkflowActionId+" :input").removeAttr("disabled");n.IsSuccess&&i.removeItemFromInspectionList(t)};this.findInspections=function(n,t){return this.$routeParams.isOptionalInspections==="true"?$.grep(n,function(n){return n.WorkflowStepId===t.WorkflowStepId&&n.ActionId===t.ActionId}):$.grep(n,function(n){return n.WorkflowActionId===t.WorkflowActionId})};this.removeItemFromInspectionList=function(n){this.$routeParams.isOptionalInspections==="true"?this.enerGovEntityInspectionSearchService.entityOptionalInspections=$.grep(this.enerGovEntityInspectionSearchService.entityOptionalInspections,function(t){return t.WorkflowStepId!==n.WorkflowStepId||t.ActionId!==n.ActionId}):this.enerGovEntityInspectionSearchService.entityRemainingInspections=$.grep(this.enerGovEntityInspectionSearchService.entityRemainingInspections,function(t){return t.WorkflowActionId!==n.WorkflowActionId})};this.requestSingleInspection=function(n){var i=this,r,u,f,t;$("#"+n.WorkflowActionId+" :input").attr("disabled","true");$("button[data-entity-id='"+n.EntityId+"']").attr("disabled","true");n.RequestedDate!==null&&(r=moment(n.RequestedDate).format(app.Constants.GlobalConstants.DateFormat),n.RequestedDate=r);u=[];n.IsBusy=!1;n.ErrorMessage="";n.IsSuccess=!1;this.inspectionTypesSelected={inspectionTypeIds:[],checkDate:null};f={inspectionTypeIds:[],checkDate:n.RequestedDate};this.inspectionTypesSelected.checkDate=n.RequestedDate;this.inspectionTypesSelected.inspectionTypeIds.push(n.InspectionTypeId);t=new Date(n.RequestedDate.toString());t.setDate(t.getDate()+1);this.enerGovInspectionService.getAvailableScheduleDates(n.InspectionTypeId,t,n.EntityId,function(t){var r=!i.enerGovInspectionService.disableEnerGovNonWorkDay(new Date(n.RequestedDate.toString()),"",t.Dates);i.processSingleInspection(n,r)})};this.requestMultipleInspections=function(){if(this.requestAllCount=0,this.inspections.length>0){for(var n=0;n<this.inspections.length;n++)$("#"+this.inspections[n].WorkflowActionId+" :input").attr("disabled","true"),$("button[data-entity-id='"+this.inspections[n].EntityId+"']").attr("disabled","true");this.requestSingleInspection(this.inspections[this.requestAllCount]);this.isRequestAll=!0;this.isRequestAllButtonVisible=!0}};this.setSameDate=function(n){var i=this,t;this.isSameDate&&n.RequestedDate!==null&&(t=window.moment(n.RequestedDate).format(app.Constants.GlobalConstants.DateFormat),angular.forEach(this.inspections,function(r){n.RequestedDate&&(r.RequestedDate=t,i.enerGovInspectionService.inspectionSettings.UseAMPMForInspection&&(r.RequestedAMOrPM=n.RequestedAMOrPM))}))};this.setSameContact=function(n){this.isSameContact&&angular.forEach(this.inspections,function(t){n.FieldContactName!==null&&n.FieldContactName!==""&&(t.FieldContactName=n.FieldContactName);n.FieldContactPhone!==null&&n.FieldContactPhone!==""&&(t.FieldContactPhone=n.FieldContactPhone)})};this.showRequestAllButton=function(n){return this.checkItems(n)&&this.allowMultipleRequest&&!n.IsBusy&&this.isRequestAllButtonVisible&&!n.PreventInspectionWithHold};this.showCheckBoxes=function(n){return this.checkItems(n)};this.checkItems=function(n){var t,i=$.grep(this.inspections,function(n){return n.IsSuccess===!1});return angular.forEach(i,function(i,r){i.WorkflowActionId===n.WorkflowActionId&&(t=r)}),t===0&&i.length>1};this.fillAMPMDropdown=function(){var n=this;n.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Inspection.InspectionResource",["RequestInspection_PMText","RequestInspection_AMText"],function(t){n.amPmDllList=[{Id:1,Name:t.RequestInspection_AMText},{Id:2,Name:t.RequestInspection_PMText}]})};this.showCheckAvailabilityButton=function(){var n=$.grep(this.inspections,function(n){return n.IsSuccess===!1});return!(n.length>0)};a=this;v=a.getModuleName();a.inspections=[];a.fillAMPMDropdown();a.dateFormat=app.Constants.GlobalConstants.DateFormat;y=new Date;a.minDate=new Date(y.getFullYear(),y.getMonth(),y.getDate());a.inspectionsCheckAvailabilityService.cleanup();a.enerGovInspectionService.getInspectionSettings(function(){});this.user=this.enerGovEntityInspectionSearchService.user;(v==="PERMIT"||v==="PLAN"||v==="BUSINESSLICENSE"||v==="PROFLICENSE")&&(a.$routeParams.id!==undefined?a.$routeParams.isOptionalInspections==="true"?a.enerGovEntityInspectionSearchService.entityOptionalInspections.length>0&&(a.enerGovEntityInspectionSearchService.entityOptionalInspections=$.grep(a.enerGovEntityInspectionSearchService.entityOptionalInspections,function(n){return n.EntityId===a.$routeParams.id}),a.processInspectionModels(a.enerGovEntityInspectionSearchService.entityOptionalInspections)):a.enerGovEntityInspectionSearchService.entityRemainingInspections.length>0&&(a.enerGovEntityInspectionSearchService.entityRemainingInspections=$.grep(a.enerGovEntityInspectionSearchService.entityRemainingInspections,function(n){return n.EntityId===a.$routeParams.id}),a.processInspectionModels(a.enerGovEntityInspectionSearchService.entityRemainingInspections)):a.processInspectionModels(a.enerGovEntityInspectionSearchService.entityRemainingInspections))}return n.prototype.getLocalStorageKey=function(n){return n?this.getModuleName().toLowerCase()+".service."+this.storageKey:this.getModuleName().toLowerCase()+"."+this.storageKey},n.prototype.checkAvailability=function(){this.inspectionsCheckAvailabilityService.checkAvailability(this.inspections)},n.prototype.processInspectionModels=function(n){var u=this,r=this,e=r.getInspectionTypeById(""),f;n.length>0&&(r.allowMultipleRequest=r.enerGovInspectionService.inspectionSettings.AllowMultipleScheduleRequest,r.requireContactInfo=r.enerGovInspectionService.inspectionSettings.RequireContactInfo);f=n.map(function(n){return n.EntityId});r.uniqueEntityIds=ArrayExtensions.ArrayExtensions.unique(f);n.forEach(function(f,o){var s=r.AddCommonInspectionProperties(f);s.ShowCustomFieldProcessing=!0;r.inspections.push(s);r.enerGovInspectionService.getAvailableScheduleDates(f.InspectionTypeId,r.enerGovInspectionService.inspectionSettings.MaxRequestDate,f.EntityId,function(h){var c=r.getInspectionTypeById(f.InspectionTypeId),l=r.checkForHoldOnEntity(f.EntityId,f.ModuleId,r.uniqueEntityIds);r.uniqueEntityIds.filter(function(n){return n==f.EntityId})[0]&&r.uniqueEntityIds.splice(r.uniqueEntityIds.indexOf(f.EntityId,1));r.$q.all([e,c,l]).then(function(e){var c,l,a,v;if(e[2]&&e[2].length>0){c=e[2];switch(f.ModuleId){case i.Permit:c.filter(function(n){return n.HoldTypeID==t.StopActionAndAlert&&(n.HoldSetupInfo.PermitInspection||n.HoldSetupInfo.EntOnlineInspectionRequest)}).length>0&&(c.filter(function(n){return n.HoldTypeID==t.StopActionAndAlert&&(n.HoldSetupInfo.PermitInspection||n.HoldSetupInfo.EntOnlineInspectionRequest)&&n.AlertMessage!==""}).length>0?(l=c.filter(function(n){return n.HoldTypeID==t.StopActionAndAlert&&(n.HoldSetupInfo.PermitInspection||n.HoldSetupInfo.EntOnlineInspectionRequest)&&n.AlertMessage!==""})[0],l&&(f.PreventInspectionWithHold=s.PreventInspectionWithHold=!0,f.HoldMessage=s.HoldMessage=l.AlertMessage)):(f.PreventInspectionWithHold=s.PreventInspectionWithHold=!0,f.HoldMessage=s.HoldMessage=u.enerGovEntityInspectionSearchService.permitHoldErrorMessage));break;case i.Plan:c.filter(function(n){return n.HoldTypeID==t.StopActionAndAlert&&(n.HoldSetupInfo.PlanInspection||n.HoldSetupInfo.EntOnlineInspectionRequest)}).length>0&&(c.filter(function(n){return n.HoldTypeID==t.StopActionAndAlert&&(n.HoldSetupInfo.PlanInspection||n.HoldSetupInfo.EntOnlineInspectionRequest)&&n.AlertMessage!==""}).length>0?(l=c.filter(function(n){return n.HoldTypeID==t.StopActionAndAlert&&(n.HoldSetupInfo.PlanInspection||n.HoldSetupInfo.EntOnlineInspectionRequest)&&n.AlertMessage!==""})[0],l&&(f.PreventInspectionWithHold=s.PreventInspectionWithHold=!0,f.HoldMessage=s.HoldMessage=l.AlertMessage)):(f.PreventInspectionWithHold=s.PreventInspectionWithHold=!0,f.HoldMessage=s.HoldMessage=u.enerGovEntityInspectionSearchService.planHoldErrorMessage));break;case i.BusinessLicense:c.filter(function(n){return n.HoldTypeID==t.StopActionAndAlert&&n.HoldSetupInfo.EntOnlineInspectionRequest}).length>0&&(c.filter(function(n){return n.HoldTypeID==t.StopActionAndAlert&&n.HoldSetupInfo.EntOnlineInspectionRequest&&n.AlertMessage!==""}).length>0?(l=c.filter(function(n){return n.HoldTypeID==t.StopActionAndAlert&&n.HoldSetupInfo.EntOnlineInspectionRequest&&n.AlertMessage!==""})[0],l&&(f.PreventInspectionWithHold=s.PreventInspectionWithHold=!0,f.HoldMessage=s.HoldMessage=l.AlertMessage)):(f.PreventInspectionWithHold=s.PreventInspectionWithHold=!0,f.HoldMessage=s.HoldMessage=u.enerGovEntityInspectionSearchService.licenseHoldErrorMessage))}}else a=n.filter(function(n){return n.EntityId==f.EntityId&&n.PreventInspectionWithHold})[0],a&&(f.PreventInspectionWithHold=s.PreventInspectionWithHold=!0,f.HoldMessage=s.HoldMessage=a.HoldMessage);s.InspectionTypeSettings=r.mapInspectionTypeSettings(e[0],e[1]);v=r.setCustomFieldData(f,h,s.InspectionTypeSettings.ShowCustomFieldsDuringRequest,o);r.setLoggedInContact(f,s.InspectionTypeSettings);r.$q.all([v]).then(function(n){r.createCalendarForInspectionType(n[0],s,h)})})})})},n.prototype.getInspectionTypeById=function(n){var t=this,i=t.$q.defer();return t.enerGovInspectionService.getInspectionTypeById(n,function(n){return i.resolve(n)}),i.promise},n.prototype.checkForHoldOnEntity=function(n,t,i){var r=this,u=r.$q.defer();if(i.filter(function(t){return t==n})[0])r.enerGovEntityHoldSearchService.getCaseHolds(n,t,function(n){return u.resolve(n)});else return null;return u.promise},n.prototype.mapInspectionTypeSettings=function(n,t){return(n||(n={},n.ShowCustomFieldsDuringRequest=app.Common.CommonOptions.No,n.ShowRequestInstructions=app.Common.CommonOptions.No,n.IncludeRequesterAsContact=app.Common.CommonOptions.No,n.DefaultLicenseContactType=null,n.DefaultPermitPlanContactType=null),!t)?n:(t.InternalNoteLabel||(t.InternalNoteLabel=n.InternalNoteLabel),t.ShowCustomFieldsDuringRequest==app.Common.CommonOptions.UseDefault&&(t.ShowCustomFieldsDuringRequest=n.ShowCustomFieldsDuringRequest),t.ShowRequestInstructions==app.Common.CommonOptions.UseDefault&&(t.ShowRequestInstructions=n.ShowRequestInstructions,t.RequestInstructions=n.RequestInstructions),t.IncludeRequesterAsContact!=null&&t.IncludeRequesterAsContact==app.Common.CommonOptions.UseDefault&&(t.IncludeRequesterAsContact=n.IncludeRequesterAsContact,t.DefaultPermitPlanContactType=n.DefaultPermitPlanContactType,t.DefaultLicenseContactType=n.DefaultLicenseContactType),t)},n.prototype.setCustomFieldData=function(n,t,i,r){var u=this,f=u.$q.defer();return i==app.Common.CommonOptions.Yes&&n.CustomFieldLayoutId&&n.OnlineCustomFieldLayoutId?u.enerGovCustomFieldsService.getCustomLayout(n.OnlineCustomFieldLayoutId,n.CustomFieldLayoutId,function(t){n.CustomLayout=u.customFieldsService.setLayout(t,r);f.resolve(n)}):f.resolve(n),f.promise},n.prototype.setLoggedInContact=function(n,t){var r=this,i;if(t.IncludeRequesterAsContact!=null&&t.IncludeRequesterAsContact==app.Common.CommonOptions.Yes){i=null;n.Contacts=[];switch(n.ModuleId){case app.Common.SelfServiceModules.Permit:case app.Common.SelfServiceModules.Plan:t.DefaultPermitPlanContactType&&(i={ParentContactID:"",ParentID:"",ContactTypeID:t.DefaultPermitPlanContactType,GlobalEntityID:this.user.OtherData,GlobalEntityName:this.user.Company,FirstName:this.user.FirstName,LastName:this.user.LastName,IsBilling:!1,EmailTo:this.user.Email,IsPendingConfirmation:!1,IsNew:!0,IsDeleted:!1,ClientId:""});break;case app.Common.SelfServiceModules.BusinessLicense:case app.Common.SelfServiceModules.ProfLicense:t.DefaultLicenseContactType&&(i={ParentContactID:"",ParentID:"",ContactTypeID:t.DefaultLicenseContactType,GlobalEntityID:this.user.OtherData,GlobalEntityName:this.user.Company,FirstName:this.user.FirstName,LastName:this.user.LastName,IsBilling:!1,EmailTo:this.user.Email,IsPendingConfirmation:!1,IsNew:!0,IsDeleted:!1,ClientId:""})}i&&n.Contacts.push(i)}},n.prototype.AddCommonInspectionProperties=function(n){var t=this;return{ModuleId:n.ModuleId,EntityId:n.EntityId,WorkflowStepId:n.WorkflowStepId,WorkflowActionId:n.WorkflowActionId,ActionId:n.ActionId,IsCAPOptionalInspection:n.IsCAPOptionalInspection,EntityNumber:n.EntityNumber,EntityType:n.EntityType,InspectionType:n.InspectionType,Address:n.Address,RequestedDate:null,Comments:"",FieldContactName:"",FieldContactPhone:"",IsSuccess:!1,ErrorMessage:"",IsBusy:!1,DateController:new r,DatePickerSetting:null,EntityTypeId:n.EntityTypeId,EntityClass:n.EntityClass,EntityClassId:n.EntityClassId,InspectionTypeId:n.InspectionTypeId,RequestedAMOrPM:n.RequestedAMOrPM,ParentInspectionNumber:n.ParentInspectionNumber,CustomFieldLayout:n.CustomFieldLayout,CustomFields:n.CustomFields,CustomLayout:n.CustomLayout,ShowCustomFieldProcessing:!1,InspectionTypeSettings:null,Contacts:null,PreventInspectionWithHold:!1,HoldMessage:""}},n.prototype.createCalendarForInspectionType=function(n,t,i){var r=this,u,f;t.DatePickerSetting=r.enerGovInspectionService.createDatePickerSetting(n,i);t.CustomFields=n.CustomFields;t.CustomLayout=n.CustomLayout;t.ShowCustomFieldProcessing=!1;t.Contacts=n.Contacts;u=r.inspections.filter(function(t){return t.WorkflowActionId==n.WorkflowActionId&&t.WorkflowStepId==n.WorkflowStepId})[0];u&&(f=r.inspections.indexOf(u),f>-1&&(r.inspections[f]=t))},n.prototype.processSingleInspection=function(n,t){var i=this;t?this.enerGovInspectionService.requestInspections(n,function(t){t.Success?($("button[data-entity-id='"+n.EntityId+"']").not(".lock").removeAttr("disabled"),i.processExecutionResult(t.Result),i.isRequestAll&&i.checkRequestAll()):(n.IsBusy=!1,n.ErrorMessage=t.ErrorMessage,n.IsSuccess=!1,$("#"+n.WorkflowActionId+" :input").attr("disabled","false"),$("button[data-entity-id='"+n.EntityId+"']").not(".lock").removeAttr("disabled"),i.isRequestAll&&i.checkRequestAll())}):(n.IsBusy=!1,n.ErrorMessage="Inspection limit has been reached for this date.",n.IsSuccess=!1,$("#"+n.WorkflowActionId+" :input").attr("disabled","false"),$("button[data-entity-id='"+n.EntityId+"']").not(".lock").removeAttr("disabled"),this.isRequestAll&&this.checkRequestAll())},n.prototype.checkRequestAll=function(){this.requestAllCount++;this.requestAllCount<this.inspections.length?this.requestSingleInspection(this.inspections[this.requestAllCount]):this.isRequestAll=!1},n.prototype.disableRequestAllButton=function(){for(var i,n=0,t=this.inspections;n<t.length;n++)if(i=t[n],this.hasInvalidTable(i)||i.PreventInspectionWithHold)return!0;return!1},n.prototype.returnFormattedDate=function(n){return moment(n).format(this.dateFormat)},n.prototype.hasInvalidTable=function(n){return n.InspectionTypeSettings!=null&&n.InspectionTypeSettings.ShowCustomFieldsDuringRequest!==this.defaultYesOption||!n.CustomLayout?!1:this.customFieldsService.isInvalidRowPresent(n.CustomLayout)||this.customFieldsService.hasInvalidTable(n.CustomLayout)},n}(),r;n.EnerGovEntityRequestInspectionController=u;r=function(){function n(){this.data={opened:!1};var n=this;n.open=function(t){t.preventDefault();t.stopPropagation();n.data.opened=!0}}return n}();n.RequestDateController=r})(t=n.Inspection||(n.Inspection={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t=function(){function t(t,i,r,u){this.enerGovInspectionService=t;this.enerGovEntityInspectionSearchService=i;this.resourceService=r;this.$window=u;this.minDate=new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate());this.DateController=new n.RequestDateController;this.amPmDllList=[];this.RequestedAMOrPM=0;this.IsRequestedToReschedule=!1;this.showErrorMessage=!1;this.showAlreadyScheduledErrorMessage=!1;this.fillAMPMDropdown=function(){var n=this;n.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Inspection.InspectionResource",["RequestInspection_PMText","RequestInspection_AMText"],function(t){n.amPmDllList=[{Id:1,Name:t.RequestInspection_AMText},{Id:2,Name:t.RequestInspection_PMText}]})};this.datePickerSetting=this.enerGovEntityInspectionSearchService.rescheduleInspectionDatePickerSetting;this.fillAMPMDropdown();this.geInspectionSettings();$("#Cancelclick").on("keydown",function(n){n.shiftKey||$("this:focus")&&n.which===9&&(n.preventDefault(),$("#RequestDate")[0].focus())});$("#RequestDate").on("keydown",function(n){n.shiftKey&&n.which===9&&n.preventDefault()});$("#Cancelclick").on("click",function(){$("#button-RescheduleInspection")[0].focus()})}return t.prototype.cancelClick=function(){$("#rescheduleInspection.modal.fade.in").modal("hide");this.enerGovEntityInspectionSearchService.rescheduleInspectionDatePickerSetting=undefined;this.requestDate=null},t.prototype.rescheduleOkClick=function(){var n=this;n.IsRequestedToReschedule=!0;n.showErrorMessage=!1;n.showAlreadyScheduledErrorMessage=!1;this.enerGovInspectionService.rescheduleInspection(this.enerGovEntityInspectionSearchService.rescheduleInspectionDatePickerSetting.InspectionId,this.requestDate,this.RequestedAMOrPM,function(t){t.Result===!0?($("#rescheduleInspection.modal.fade.in").modal("hide"),n.enerGovEntityInspectionSearchService.rescheduleInspectionDatePickerSetting=undefined,n.requestDate=null,n.$window.location.reload()):t.ErrorMessage==="rescheduled"?n.showAlreadyScheduledErrorMessage=!0:n.showErrorMessage=!0;n.IsRequestedToReschedule=!1})},t.prototype.geInspectionSettings=function(){var n=this;n.enerGovInspectionService.getInspectionSettings(function(){})},t}();n.EnerGovEntityRescheduleInspectionController=t})(t=n.Inspection||(n.Inspection={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=app.Common.SelfServiceModules,i=function(n){function i(i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b){var k=n.call(this,null)||this,d,g,nt;k.$routeParams=i;k.$location=r;k.$window=u;k.globalService=f;k.enerGovInspectionService=e;k.eventService=o;k.userService=s;k.enerGovCustomFieldsService=h;k.customFieldsService=c;k.entityPreviousInspectionsService=l;k.$q=a;k.enerGovReportService=v;k.pageTitleService=y;k.tabNavigatorService=p;k.enerGovEntityInspectionService=w;k.entityTabsService=b;k.userLoggedIn=!1;k.applyStatus=!1;k.layoutSet=!1;k.disableLink=!1;k.canShowComment=!1;k.canShowPrintButton=!1;k.cancelInspection=function(n){k.enerGovInspectionService.cancelInspection(n,k.parentModuleId,k.entityId)};k.submitCancelInspection=function(){k.enerGovInspectionService.submitCancelInspection()};k.redirectBack=function(){$("#cancelInspectionModal").modal("hide");k.$window.setTimeout(function(){history.back()},500)};k.rescheduleInspection=function(n){var i=k,r=0,u;n.LinkTypeName.toLowerCase()==="permit"?r=t.Permit:n.LinkTypeName.toLowerCase()==="plan"?r=t.Plan:n.LinkTypeName.toLowerCase()==="proflicense"?r=t.ProfLicense:n.LinkTypeName.toLowerCase()==="businesslicense"&&(r=t.BusinessLicense);u={PageNumber:1,PageSize:100,SortField:"",IsSortedInAscendingOrder:!0,ModuleId:r,EntityId:n.LinkId,IsExistingInspection:!0,IsOptionalInspection:!1,IsFailed:!1,SpecificInspectionId:n.InspectionId};k.enerGovEntityInspectionService.searchInspectionByCriteria(u,function(t){var u=t.Result,r=u.filter(function(t){return t.InspectionId==n.InspectionId})[0];r&&i.enerGovInspectionService.getAvailableScheduleDates(r.InspectionTypeId,i.enerGovInspectionService.inspectionSettings.MaxRequestDate,n.LinkId,function(t){i.enerGovEntityInspectionService.rescheduleInspectionDatePickerSetting=i.enerGovInspectionService.createDatePickerSetting(n,t);i.enerGovEntityInspectionService.rescheduleInspectionDatePickerSetting.InspectionId=n.InspectionId;i.enerGovInspectionService.rescheduleInspectionClick()})})};d=k;d.customFieldsService.setLayout(null);d.tabNavigatorService.cleanUp();g=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(d.$location,d.$routeParams.id);d.entityTabsService.setEntityTabsVisibility(d.$routeParams.id,g,d.$routeParams.tab);d.applyStatus=d.$location.search().success;d.enerGovInspectionService.getInspectionSettings(function(){});nt=k.enerGovInspectionService.getById(k.$routeParams.id,function(n){var i,r;if(d.model=n,d.canShowComment=d.model.ShowInspectionCommentAsAlert==app.Common.CommonOptions.Yes&&d.model.Comment&&d.model.ShowCommentsForInspectionRequestedAfter&&d.model.RequestDate&&d.model.ShowCommentsForInspectionRequestedAfter<d.model.RequestDate,d.inspectionTypeTimeSettingModel={ShowRequestedTime:n.ShowRequestedTime,ShowScheduledTime:n.ShowScheduledTime,RequestedAMText:n.RequestedAMText,RequestedPMText:n.RequestedPMText,ScheduledAMText:n.ScheduledAMText,ScheduledPMText:n.ScheduledPMText,IsMidnightRequestTime:n.IsMidnightRequestTime,IsMidnightScheduleTime:n.IsMidnightScheduleTime},d.model==null){d.$location.path("/home").search({});return}d.pageTitleService.setPageTitle(d.model.InspectionNumber);switch(d.model.LinkTypeName){case"Plan":k.parentModuleId=t.Plan;k.parentModulePath="plan";k.linkLabel=k.getResourceLabel("Global_Plan_Label");break;case"Permit":k.parentModuleId=t.Permit;k.parentModulePath="permit";k.linkLabel=k.getResourceLabel("Global_Permit_Label");break;case"Code Case":k.parentModuleId=t.Code;k.parentModulePath="code";k.linkLabel=k.getResourceLabel("Global_CodeCase_Label");break;case"Business License":k.parentModuleId=t.BusinessLicense;k.parentModulePath="businessLicense";k.linkLabel=k.getResourceLabel("Global_License_Label");break;case"Professional License":k.parentModuleId=t.ProfLicense;k.parentModulePath="profLicense";k.linkLabel=k.getResourceLabel("Global_License_Label");break;case"Request":k.parentModuleId=t.Request;k.parentModulePath="request";k.linkLabel=k.getResourceLabel("Global_Request_Label");break;case"Fire Occupancy":k.disableLink=!0;k.linkLabel=k.getResourceLabel("Global_Fire_Occupancy_Label");break;case"Business":k.parentModuleId=t.BusinessEntity;k.parentModulePath="business";k.linkLabel=k.getResourceLabel("Global_Business_Label");break;case"Rental Property":k.parentModuleId=t.BusinessLicense;k.parentModulePath="businessLicense";k.linkLabel=k.getResourceLabel("Global_Rental_Property_Label");break;case"Landlord License":k.disableLink=!0;k.linkLabel=k.getResourceLabel("Global_Landlord_License_Label");break;case"Operational Permit":k.parentModuleId=t.BusinessLicense;k.parentModulePath="businessLicense";k.linkLabel=k.getResourceLabel("Global_Operational_Permit_Label")}k.entityId=d.model.LinkId;k.enerGovInspectionService.parentId=d.model.LinkId;d.model.IsLoggedIn=s.isUserLoggedIn;(d.model.InspectionId===""||d.model.InspectionId==null)&&(alert("Unable to load the selected inspection. Please contact your municipality about the inspection you were attempting to view. Returning to home."),k.$location.path("/dashboard"));i=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(k.$location,k.$routeParams.id);d.$routeParams.tab&&d.tabNavigatorService.selectTab(d.$routeParams.tab);d.model.CustomFieldLayoutId===null||d.model.CustomFieldLayoutId===""||d.model.InspectionId===null||d.model.InspectionId===""||d.layoutSet?(d.entityTabsService.showMoreInfoTab=!1,d.$routeParams.tab&&d.$routeParams.tab==app.Constants.TabConstants.Moreinfo?d.entityTabsService.setAdditionalEntityTabsVisibility(d.$routeParams.tab,d.entityTabsService.showMoreInfoTab):d.entityTabsService.setFirstTabOnHidingOtherTabs()):d.enerGovCustomFieldsService.getCustomLayoutWithData(d.model.CustomFieldLayoutId,d.model.OnlineCustomFieldLayoutId,d.model.InspectionId,i,function(n){n.Success?n.Result!=null?(d.customFieldsService.setLayout(n.Result),d.layoutSet=!0):d.errorMessage=n.ErrorMessage:(n.StatusCode===app.Common.Services.HttpStatusCode.PreconditionFailed||n.StatusCode===app.Common.Services.HttpStatusCode.NoContent||n.StatusCode===app.Common.Services.HttpStatusCode.Forbidden)&&(d.errorMessage=n.ErrorMessage)});d.model.InspectionId!==null&&d.model.InspectionId!==""&&(r=d.model.InspectionTypeModuleId===app.Common.CaseTypeEnums.InspectionTypeModule.HealthInspection?"HealthInspection":"Inspection",k.enerGovReportService.getInspectionReportName(r,d.model.InspectionTypeId,function(n){d.reportName=n;d.canShowPrintButton=d.model.ShowPrint&&d.reportName&&d.reportName!==""}))});s.listenToLoginStatusChange(function(n){d.userLoggedIn=n});d.userLoggedIn=s.isUserLoggedIn;d.eventService.on("$locationChangeSuccess",function(n,t,i){d.enerGovInspectionService.inspectionViewTabNumber=i.indexOf("request/inspections")>-1?1:0});return k}return __extends(i,n),i.prototype.printInspection=function(){var n=this.globalService.webApiBaseUrl+"/energov/report/single?value="+this.model.InspectionId+"&reportName="+this.reportName+"&tenantId="+this.globalService.tenantId;window.open(n,"_new")},i.prototype.isIEVersion=function(){var n=document.documentMode;return n>=11?!0:!1},i.prototype.getResourceLabel=function(n){if(this.globalService.clientSiteResources)return this.globalService.clientSiteResources.filter(function(t){return t.Key==n})[0].Value},i}(app.Core.Controllers.CoreController);n.EnerGovInspectionViewController=i})(t=n.Inspection||(n.Inspection={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f,e,o,s,h,c,l,a,v){var y=n.call(this,t,r,u,e)||this;return y.$scope=i,y.$rootScope=f,y.myRemainingInspectionService=e,y.inspectionSearchService=o,y.entitySecondaryDataService=s,y.commonService=h,y.enerGovInspectionService=c,y.enerGovViewMyEntityCriteriaService=l,y.resourceService=a,y.enerGovMyEntityTelerikService=v,y.inspectionInfo=[],y.filename="",y.options="",y.includeParentRecords=!1,y.showHeader=!1,y.expandStatus=!1,y.requestInspection=function(){for(var i,n=y,t=0;t<n.myRemainingInspectionService.remainingInspections.length;t++)n.tempRemainingInspections=n.myRemainingInspectionService.remainingInspections[t],i=new Date,n.tempInspectionInfo={ModuleId:n.tempRemainingInspections.ModuleId,EntityId:n.tempRemainingInspections.EntityId,EntityNumber:n.tempRemainingInspections.EntityNumber,EntityType:n.tempRemainingInspections.EntityType,Address:n.tempRemainingInspections.Address,InspectionId:n.tempRemainingInspections.InspectionId,InspectionType:n.tempRemainingInspections.InspectionType,InspectionTypeDescription:n.tempRemainingInspections.InspectionTypeDescription,InspectionStatus:"",RequestedDate:i,ScheduledStartDate:i,PrimaryInspector:"",IsReinspectionDisplayText:n.tempRemainingInspections.IsReinspectionDisplayText,CanCancelInspection:!1,CanRequestInspection:n.tempRemainingInspections.CanRequestInspection,WorkflowStepId:n.tempRemainingInspections.WorkflowStepId,ActionId:"",IsCAPOptionalInspection:!1,WorkflowActionId:n.tempRemainingInspections.WorkflowActionId,RequestInspectionErrorMessage:n.tempRemainingInspections.RequestInspectionErrorMessage,IsLoggedIn:n.tempRemainingInspections.IsLoggedIn,Checked:n.tempRemainingInspections.Selected,EntityTypeId:n.tempRemainingInspections.EntityTypeId,EntityClass:n.tempRemainingInspections.EntityClass,EntityClassId:n.tempRemainingInspections.EntityClassId,InspectionNumber:"",ParentInspectionNumber:"",Reinspection:"",LinkType:"",CaseTypeIds:[],InspectionTypeId:n.tempRemainingInspections.InspectionTypeId,RequestedAMOrPM:1,ShowRescheduleButton:!1,ParentInspectionStatus:"",PrimaryInspectorEmail:"",CustomFieldLayout:null,CustomFields:null,CustomLayout:null,CustomFieldLayoutId:n.tempRemainingInspections.CustomFieldLayoutId,OnlineCustomFieldLayoutId:n.tempRemainingInspections.OnlineCustomFieldLayoutId,IsCancelledFlag:!1,IsCompletedFlag:!1,IsFailureFlag:!1,IsSuccessFlag:!1,LicenseSystemStatusName:"",LicenseSystemStatusId:0,IsPreventRequestInspection:!1,Contacts:null,PreventInspectionWithHold:!1,HoldMessage:"",StatusName:""},n.inspectionInfo.push(n.tempInspectionInfo);n.inspectionSearchService.entityRemainingInspections=n.inspectionInfo;n.inspectionInfo=[];switch(n.tempRemainingInspections.ModuleId){case app.Common.SelfServiceModules.Permit:n.$location.path("/permit/request/inspections");break;case app.Common.SelfServiceModules.Plan:n.$location.path("/plan/request/inspections");break;case app.Common.SelfServiceModules.BusinessLicense:n.$location.path("/businessLicense/request/inspections");break;case app.Common.SelfServiceModules.ProfLicense:n.$location.path("/profLicense/request/inspections")}},y.disableRequestButton=function(){return y.myRemainingInspectionService.remainingInspections.length===0?!0:!1},y.disableRequestCheck=function(n){return n.CanRequestInspection&&!n.ActiveHolds&&n.Issued&&(y.enerGovInspectionService.inspectionSettings.InspectionAlwaysAllowRequest||!n.UnPaidFees)?!1:!0},y.inspectionSearchService.entityRemainingInspections=[],y.myRemainingInspectionService.remainingInspections=[],y}return __extends(t,n),t.prototype.permitDetail=function(n,t){switch(t){case app.Common.SelfServiceModules.Permit:this.$location.path("/permit/"+n);break;case app.Common.SelfServiceModules.Plan:this.$location.path("/plan/"+n);break;case app.Common.SelfServiceModules.BusinessLicense:this.$location.path("/businessLicense/"+n);break;case app.Common.SelfServiceModules.ProfLicense:this.$location.path("/profLicense/"+n);break;case app.Common.SelfServiceModules.OperationalPermit:this.$location.path("/operationalPermit/"+n)}},t.prototype.setExpandStatus=function(){this.expandStatus=!this.expandStatus},t.prototype.selectAllOrNone=function(){var n=this;angular.forEach(this.searchResult,function(t){t.CanRequestInspection&&!t.ActiveHolds&&t.Issued&&(n.enerGovInspectionService.inspectionSettings.InspectionAlwaysAllowRequest||!t.UnPaidFees)&&(t.Selected=n.myRemainingInspectionService.isSelectAll,n.changeSelectStatus(t,n.myRemainingInspectionService.isSelectAll))})},t.prototype.searchByCriteria=function(){this.criteria.PageNumber=1;this.sortField=this.criteria.Keyword?this.sortList[0].Value:this.sortList[1].Value;this.searchCriteria.SortField=this.sortField;this.search(this.criteria,app.Events.SearchEvents.SortCompleted)},t.prototype.changeSelectStatus=function(n,t){var f,u,e,i,r;if(t){for(f=!0,u=0;u<this.myRemainingInspectionService.remainingInspections.length;u++)if(this.myRemainingInspectionService.remainingInspections[u].WorkflowActionId===n.WorkflowActionId){f=!1;break}for(f&&this.myRemainingInspectionService.remainingInspections.push(n),e=!0,i=0;i<this.searchResult.length;i++)if(this.searchResult[i].CanRequestInspection&&!this.searchResult[i].ActiveHolds&&this.searchResult[i].Issued&&!this.searchResult[i].UnPaidFees&&!this.searchResult[i].Selected){e=!1;break}e&&(this.myRemainingInspectionService.isSelectAll=!0)}else{for(r=0;r<this.myRemainingInspectionService.remainingInspections.length;r++)if(this.myRemainingInspectionService.remainingInspections[r].WorkflowActionId===n.WorkflowActionId){this.myRemainingInspectionService.remainingInspections.splice(r,1);break}this.myRemainingInspectionService.isSelectAll=!1}},t.prototype.fileNameOkClick=function(){var n=this,t;n.filename!==""&&n.filename!==undefined&&($("#FilenameModal.modal.fade.in").modal("hide"),$("div:not(.ng-hide) #button-Export").focus(),t=angular.copy(n.searchCriteria),t.PageNumber=1,t.PageSize=n.caseLimitForExport,t.SortField=n.sortField,n.options==="default"?n.searchForExport(t,app.Events.SearchEvents.SearchCompleted,function(){n.commonService.downloadData(n.searchResultForExcel,n.filename,"requestinspections");n.filename=""}):(n.commonService.downloadData(n.searchResult,n.filename,"requestinspections"),n.filename=""))},t.prototype.fileNameCancelClick=function(){$("#FilenameModal.modal.fade.in").modal("hide");$("div:not(.ng-hide) #button-Export").focus()},t.prototype.onChange=function(n){var t=n.sender.$angular_scope.vm,i,r;t.myRemainingInspectionService.remainingInspections=[];t.$scope.$applyAsync();i=n.sender.select();r=n.sender;i.each(function(n,i){var u=r.dataItem(i),f=t.myRemainingInspectionService.remainingInspections.filter(function(n){return n.WorkflowActionId===u.WorkflowActionId}).length<=0;f&&t.myRemainingInspectionService.remainingInspections.push(u)})},t.prototype.createCaseLink=function(){var n="";return function(t){switch(t.ModuleId){case app.Common.SelfServiceModules.Permit:n="<a class='k-grid-anchor' data-ng-href='#/permit/"+t.EntityId+"'>"+t.EntityNumber+"<\/a>";break;case app.Common.SelfServiceModules.Plan:n="<a class='k-grid-anchor' data-ng-href='#/plan/"+t.EntityId+"'>"+t.EntityNumber+"<\/a>";break;case app.Common.SelfServiceModules.BusinessLicense:n="<a class='k-grid-anchor' data-ng-href='#/businessLicense/"+t.EntityId+"'>"+t.EntityNumber+"<\/a>";break;case app.Common.SelfServiceModules.ProfLicense:n="<a class='k-grid-anchor' data-ng-href='#/profLicense/"+t.EntityId+"'>"+t.EntityNumber+"<\/a>"}return n}},t.prototype.init=function(){var t=this,n=this;n.showHeader=n.$location.path()!=="/myWork";n.mainGridOptions=n.enerGovMyEntityTelerikService.getTelerikGridOptions();n.mainGridOptions.change=n.onChange;n.mainGridOptions.persistSelection=!0;n.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Inspection.InspectionResource",["RemainingInspections_CaseNumber","RemainingInspections_Address","RemainingInspections_PermitType","RemainingInspections_InspectionType","RemainingInspections_RequestInspectionButton"],function(i){t.caseNumberLabel=i.RemainingInspections_CaseNumber;t.addressLabel=i.RemainingInspections_Address;t.typeLabel=i.RemainingInspections_PermitType;t.inspectionTypeLabel=i.RemainingInspections_InspectionType;t.requestInspectionButtonLabel=i.RemainingInspections_RequestInspectionButton;var r=n.mainGridOptions.toolbar;r.push({template:'<button id="button-RequestInspection-Bottom" class="k-button k-btn-primary" data-ng-click="vm.requestInspection()" ng-disabled="vm.disableRequestButton()">'+t.requestInspectionButtonLabel+"<\/button>"});n.mainGridOptions.columns=n.getTelerikGridColumns();n.enerGovViewMyEntityCriteriaService.getViewMyRemainingInspectionsDetailCriteria(function(t){n.criteria=t;n.myRemainingInspectionService.inspectionSettings=n.enerGovViewMyEntityCriteriaService.myRemainingInspectionService.inspectionSettings;n.$scope.$watch("vm.$scope.$parent.vm.includeParentRecords",function(t){n.myRemainingInspectionService.remainingInspections=[];n.searchAndFillGrid(t)})})},!0)},t.prototype.searchAndFillGrid=function(n){var t=this;t.isLoading=!0;t.criteria.IncludeParentRecords=n;t.criteria.PageSize=t.enerGovMyEntityTelerikService.telerikGridPageSize;t.criteria.PageNumber=t.enerGovMyEntityTelerikService.telerikGridPageNumber;t.searchCriteria=t.criteria;t.search(t.criteria,app.Events.SearchEvents.SearchCompleted,function(){var n=t.searchResult;t.mainGridOptions.dataSource=t.getDataSource(n);t.isLoading=!1})},t.prototype.getDataSource=function(n){return new kendo.data.DataSource({transport:{read:function(t){t.success(n)}},pageSize:20,schema:{model:{id:"WorkflowActionId",fields:{EntityNumber:{type:"string"},Address:{type:"string"},EntityType:{type:"string"},InspectionType:{type:"string"}}}}})},t.prototype.getTelerikGridColumns=function(){var n=this;return[{selectable:!0,width:"32px",locked:!0},{field:"EntityNumber",title:this.caseNumberLabel,width:"200px",filterable:{multi:!0,search:!0},attributes:{id:"entity-number-#=EntityNumber#"},template:n.createCaseLink()},{field:"Address",title:this.addressLabel,width:"300px",filterable:{multi:!0,search:!0},attributes:{id:"address-#=EntityNumber#"}},{field:"EntityType",title:this.typeLabel,width:"300px",attributes:{id:"entity-type-#=EntityNumber#"},filterable:{multi:!0,search:!0}},{field:"InspectionType",title:this.inspectionTypeLabel,width:"295px",attributes:{id:"inspection-type-#=EntityNumber#"},filterable:{multi:!0,search:!0}}]},t}(app.Common.Controllers.PagedGenericSearchController);n.EnerGovMyRemainingInspectionsController=t})(t=n.Inspection||(n.Inspection={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f,e,o,s){var h=n.call(this,t,r,u,f)||this,c,l;return h.menuService=i,h.secondaryDataService=e,h.commonService=o,h.tylerTimeZoneFormatterService=s,h.todaysInspectionsTitle="",h.options="",h.searchTodaysInspections=function(){var n=h;n.searchCriteria.PageNumber=1;n.sortField=n.searchCriteria.Keyword?n.sortList[0].Value:n.sortList[1].Value;n.searchCriteria.SortField=n.sortField;n.searchCriteria.ScheduledDateShow!=null&&n.searchCriteria.ScheduledDateShow.toString()!=""&&(n.searchCriteria.ScheduledDate=new Date(n.searchCriteria.ScheduledDateShow));n.searchCriteria.ScheduledDate&&n.searchCriteria.ScheduledDate>n.minDate?(n.searchCriteria.ScheduledDate=new Date(n.searchCriteria.ScheduledDateShow),n.searchEvent=app.Events.SearchEvents.SearchCompleted,n.search(n.searchCriteria,n.searchEvent)):n.searchResult=undefined},c=h,l=c.menuService.getTodaysInspectionsMenu(),l?c.todaysInspectionsTitle=l.Label:c.$location.path("/"),h}return __extends(t,n),t.prototype.fileNameOkClick=function(){var n=this,t=angular.copy(this.searchCriteria);n.filename!==""&&n.filename!==undefined&&($("#FilenameModal.modal.fade.in").modal("hide"),t.PageNumber=1,t.PageSize=n.caseLimitForExport,t.SortField=n.sortField,n.options==="default"?n.searchForExport(t,app.Events.SearchEvents.SearchCompleted,function(){n.updateDateText(n.searchResultForExcel);n.commonService.downloadData(n.searchResultForExcel,n.filename,"todaysinspection");n.filename=""}):(n.updateDateText(n.searchResult),n.commonService.downloadData(n.searchResult,n.filename,"todaysinspection"),n.filename=""),$("div:not(.ng-hide) #button-Export").focus())},t.prototype.updateDateText=function(n){var t=this;angular.forEach(n,function(n){n.StartTime=t.tylerTimeZoneFormatterService.getUpdatedDateText(n.InspectionTypeSettings,!1,n.StartTime);n.EndTime=t.tylerTimeZoneFormatterService.getUpdatedDateText(n.InspectionTypeSettings,!1,n.EndTime)})},t.prototype.fileNameCancelClick=function(){$("#FilenameModal.modal.fade.in").modal("hide");$("div:not(.ng-hide) #button-Export").focus()},t.prototype.init=function(){var n=this,t,i;n.tenantName=n.globals.tenantUrl;n.commonService.getCaseLimit(function(t){n.caseLimitForExport=t});t=new Date;n.minDate=new Date(t.getFullYear()-1,t.getMonth(),t.getDate());n.datePickerControlSettings={datePickerOptions:{formatYear:"yy",startingDay:0,showWeeks:!1,maxDate:null},disableEnerGovNonWorkDay:null};i=new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate());n.searchCriteria={ExcludeCompleted:!1,IsSortedInAscendingOrder:!0,PageNumber:1,PageSize:n.globals.pageSizeList[0].Value,ScheduledDate:i,ScheduledDateShow:moment(t).local().format(app.Constants.GlobalConstants.DateFormat),SortField:"",EntityId:"",ModuleId:0,Keyword:"",ExactMatch:!1};this.secondaryDataService.getEntityRecordSortSecondaryData(function(t){n.sortList=t.Result.TodaysInspectionsSearchSortList;n.sortField=t.Result.TodaysInspectionsSearchSortList[1].Value;n.changeSortField(n.sortField)});this.search(this.searchCriteria,app.Events.SearchEvents.SearchCompleted)},t}(app.Common.Controllers.PagedGenericSearchController);n.EnerGovTodaysInspectionsController=t})(t=n.Inspection||(n.Inspection={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){"use strict";angular.module("enerGov.Inspection",["app.globalsModule","app.Common.Services","enerGov.Common","LocalStorageModule","app.Services.SettingsService"]).service("enerGovInspectionsCheckAvailabilityService",["http","resourceService",n.Services.EnerGovInspectionsCheckAvailabilityService]).service("enerGovEntityInspectionSearchService",["http","userService","eventService","resourceService","$routeParams","entityTabsService","$timeout",n.Services.EnerGovEntityInspectionSearchService]).service("enerGovInspectionService",["http","$timeout","$q","$http","globalsService",n.Services.EnerGovInspectionService]).service("enerGovMyRemainingInspectionsService",["http",n.Services.EnerGovMyRemainingInspectionsService]).service("enerGovEntityPreviousInspectionsService",["http","$q","$http","enerGovInspectionService","entityTabsService","$routeParams",n.Services.EnerGovEntityPreviousInspectionsService]).controller("enerGovEntityPreviousInspectionsController",["$routeParams","$location","globalsService","enerGovEntityPreviousInspectionsService","entitySecondaryDataService","enerGovInspectionService","$q",n.EnerGovEntityPreviousInspectionsController]).controller("enerGovEntityExistingInspectionSearchController",["$routeParams","$location","globalsService","$rootScope","enerGovEntityInspectionSearchService","entitySecondaryDataService","enerGovInspectionService","entityTabsService",n.EnerGovEntityExistingInspectionSearchController]).controller("enerGovEntityRemainingInspectionSearchController",["$routeParams","$location","$window","globalsService","$rootScope","enerGovEntityInspectionSearchService","entitySecondaryDataService","entityTabsService","settingsService","intentsService",n.EnerGovEntityRemainingInspectionSearchController]).controller("enerGovEntityOptionalInspectionSearchController",["$routeParams","$location","$window","globalsService","$rootScope","enerGovEntityInspectionSearchService","entitySecondaryDataService","entityTabsService","settingsService","intentsService",n.EnerGovEntityOptionalInspectionSearchController]).controller("enerGovEntityRequestInspectionController",["$routeParams","$location","localStorageService","enerGovEntityInspectionSearchService","enerGovInspectionService","enerGovInspectionsCheckAvailabilityService","resourceService","$q","enerGovCustomFieldsService","genericModuleCustomFieldsService","enerGovEntityHoldSearchService","globalsService",n.EnerGovEntityRequestInspectionController]).controller("enerGovTodaysInspectionsController",["$routeParams","menuService","$location","globalsService","enerGovInspectionService","entitySecondaryDataService","enerGovCommonForExportService","tylerTimeZoneFormatterService",n.EnerGovTodaysInspectionsController]).controller("enerGovMyRemainingInspectionsController",["$routeParams","$scope","$location","globalsService","$rootScope","enerGovMyRemainingInspectionsService","enerGovEntityInspectionSearchService","entitySecondaryDataService","enerGovCommonForExportService","enerGovInspectionService","enerGovViewMyEntityCriteriaService","resourceService","enerGovMyEntityTelerikService",n.EnerGovMyRemainingInspectionsController]).controller("enerGovInspectionViewController",["$routeParams","$location","$window","globalsService","enerGovInspectionService","eventService","userService","enerGovCustomFieldsService","customFieldsService","enerGovEntityPreviousInspectionsService","$q","enerGovReportService","pageTitleService","tabNavigatorService","enerGovEntityInspectionSearchService","entityTabsService",n.EnerGovInspectionViewController]).controller("enerGovEntityRescheduleInspectionController",["enerGovInspectionService","enerGovEntityInspectionSearchService","resourceService","$window",n.EnerGovEntityRescheduleInspectionController])})(t=n.Inspection||(n.Inspection={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/twilio/"}return n.prototype.getTwilioServiceRequestById=function(n,t){var i={requestId:n};this.http.get(this.rootUrl+"service-request-byid",function(n){n.Success&&t(n.Result)},!1,i)},n.prototype.getMeetingToken=function(n,t){this.http.get(this.rootUrl+"get-video-token/"+n,function(n){n.Success&&t(n.Result)},!1)},n.prototype.getGlobalSetting=function(n){this.http.get("/globalsetting/getglobalsetting",function(t){t.Success&&n(t.Result)},!1)},n}();n.EnerGovTwilioJoinMeetingService=t})(t=n.Services||(n.Services={}))})(t=n.TwilioServiceRequest||(n.TwilioServiceRequest={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/submittals/"}return n.prototype.requestVideoCall=function(n,t){this.http.post("/energov/entity/twilioservicerequestadd",n,function(n){t(n.Result)},!1)},n}();n.EnerGovTwilioServiceRequestAddService=t})(t=n.Services||(n.Services={}))})(t=n.TwilioServiceRequest||(n.TwilioServiceRequest={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/twilio/"}return n.prototype.getTwilioServiceRequest=function(n,t){this.http.post(this.rootUrl+"service-request",n,function(n){n.Success&&t(n.Result)},!1)},n.prototype.getTwilioServiceRequestDownloadCalender=function(n,t){this.http.post(this.rootUrl+"download-calendar",n,function(n){n.Success&&t(n.Result)},!1)},n}();n.EnerGovTwilioServiceRequestService=t})(t=n.Services||(n.Services={}))})(t=n.TwilioServiceRequest||(n.TwilioServiceRequest={}))}(EnerGov||(EnerGov={}));__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,null)||this,o;return e.scope=t,e.$routeParams=i,e.enerGovTwilioJoinMeetingService=r,e.userService=u,e.$location=f,e.isScreenShareExtensionInstalled=!0,e.userLoggedIn=!1,e.showActiveRoom=!1,e.isScreenSharingUser=!0,e.isScreenShared=!1,o=e,u.listenToLoginStatusChange(function(n){o.userLoggedIn=n}),o.userLoggedIn=u.isUserLoggedIn,e.userLoggedIn||e.$location.path("/"),e.requestId=e.$routeParams.id,e.getServiceRequestById(),e.enerGovTwilioJoinMeetingService.getGlobalSetting(function(n){var t=n.ScreenShareAppId;e.isInChrome&&($("#scriptScreenId").attr("src",n.GetScreenIdJsUrl),$("#scriptAdapterID").attr("src",n.AdapterLatestJsUrl));e.detectExtension(t,function(i){i||(e.isScreenShareExtensionInstalled=!1,e.screenShareExtensionUrl=n.WebStoreUrl+t)})}),e}return __extends(t,n),Object.defineProperty(t.prototype,"isInChrome",{get:function(){return"chrome"in window},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isScreenShareAdded",{get:function(){var n=this.getScreenShareElement()[0],t=n?n.childElementCount:0;return t>0},enumerable:!0,configurable:!0}),t.prototype.getServiceRequestById=function(){var n=this;this.enerGovTwilioJoinMeetingService.getTwilioServiceRequestById(this.requestId,function(t){for(var u,r=!0,i=0;i++;i<t.TwilioRequestUsers.length)t.TwilioRequestUsers[i].UserId===t.RequestedByUserId&&(r=!1);r&&(u={TwilioRequestUsersId:"",TwilioRequestId:"",UserId:t.RequestedByUserId,FirstName:t.RequestedByUserFirstName,LastName:t.RequestedByUserLastName,Email:t.RequestedByUserEmail,Phone:t.RequestedByPhone,AddedBy:"",AddedOn:new Date,IsMain:!1},t.TwilioRequestUsers.push(u));n.model=t;n.isInChrome&&n.enerGovTwilioJoinMeetingService.getMeetingToken(n.model.TwilioRequestId,function(t){n.createRoom(t,n.model.TwilioRequestId)})})},t.prototype.detectExtension=function(n,t){var i=new Image;i.src="chrome-extension://"+n+"/images/tyler-technologies-16.png";i.onload=function(){t(!0)};i.onerror=function(){t(!1)}},t.prototype.createRoom=function(n,t){var i=this;window.Twilio.Video.connect(n,{name:t,audio:!0,video:!0}).then(function(n){i.showActiveRoom=!0;n.on("participantConnected",function(n){return i.participantConnected(n)});n.participants.forEach(function(n){return i.participantConnected(n)});n.on("participantDisconnected",function(n){return i.participantDisconnected(n)});i.connectLocalVideoTrack(n.localParticipant.identity);n.on("disconnected",function(t){i.disconnectLocalVideoTrack(t);n.disconnect()});i._room=n},function(n){console.log("Could not connect to Twilio: "+n.message)})},t.prototype.participantConnected=function(n){var t=this;n.tracks.forEach(function(i){if(i.isSubscribed){var r=i.track;t.connectVideo(n.identity,r)}});n.on("trackSubscribed",function(i){t.isVideoAdded(n.identity)?(t.addScreenShare(i),t.isScreenSharingUser=!1,t.scope.$apply()):t.connectVideo(n.identity,i)});n.on("trackUnsubscribed",function(){t.isScreenShareAdded&&(t.removeScreenShare(),t.isScreenSharingUser=!0,t.scope.$apply())})},t.prototype.participantDisconnected=function(n){this.isVideoAdded(n.identity)&&this.disconnectVideo(n.identity);this.isScreenShareAdded&&this.removeScreenShare();this.isScreenSharingUser=!0},t.prototype.connectLocalVideoTrack=function(n){var t=this;window.Twilio.Video.createLocalVideoTrack().then(function(i){t.connectVideo(n,i)},function(n){console.error(n)})},t.prototype.disconnectLocalVideoTrack=function(n){n.tracks&&n.tracks.forEach(function(n){var t=n.track.detach();t.forEach(function(n){return n.remove()})},function(n){console.error(n)})},t.prototype.startStopScreenShare=function(){this.isScreenShared?this.stopScreenSharing():this.getUserScreen()},t.prototype.getUserScreen=function(){var n=this;getScreenId(function(t,i,r){t?console.log(t):navigator.mediaDevices.getUserMedia(r).then(function(t){t.oninactive=t.stop=function(){n.startStopScreenShare()};var i=t.getVideoTracks()[0];n.sendScreenTrack(!0,i);n.isScreenShared=!0;n.scope.$apply()})})},t.prototype.stopScreenSharing=function(){this.isScreenShared=!1;this.sendScreenTrack(!1,null)},t.prototype.sendScreenTrack=function(n,t){this.publishTrack({startScreenShare:n,screenTrack:t})},t.prototype.publishTrack=function(n){this._room&&(n.startScreenShare?(this._screenTrack=n.screenTrack,this._room.localParticipant.publishTrack(this._screenTrack)):(this._room.localParticipant.unpublishTrack(this._screenTrack),this._screenTrack=null),this.isScreenSharingUser=!0)},t.prototype.isVideoAdded=function(n){var t=$("#video_"+n)[0],i=t?t.childElementCount:0;return i==2},t.prototype.addScreenShare=function(n){var t=this.getScreenShareElement();t.append(n.attach());this.isScreenShared=!0},t.prototype.removeScreenShare=function(){var n=this.getScreenShareElement();n.empty();this.isScreenShared=!1},t.prototype.getScreenShareElement=function(){return $("#screenShare")},t.prototype.connectVideo=function(n,t){$("#details_"+n).addClass("hidden");$("#video_"+n).append(t.attach())},t.prototype.disconnectVideo=function(n){$("#video_"+n).empty();$("#details_"+n).removeClass("hidden")},t}(app.Core.Controllers.CoreController);n.EnerGovTwilioJoinMeetingController=t})(t=n.Controllers||(n.Controllers={}))})(t=n.TwilioServiceRequest||(n.TwilioServiceRequest={}))}(EnerGov||(EnerGov={})),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.$routeParams=n;this.$location=t;this.itemReviewTypeService=i;this.userService=r;this.enerGovSettingsService=u;this.enerGovPermitService=f;this.enerGovPlanService=e;this.enerGovTwilioServiceRequestAddService=o;this.filename="";this.options="";this.hideDetailsFlag=!0;this.requestedTime="";this.itemReviewTypeList=[];this.planPermitId="";this.submittalId="";this.isUserLoggedIn=!1;this.requestInPersonVideoCall=!1;this.isUserInPlanPermitContact=!1;this.planPermitId=this.$routeParams.id;this.submittalId=this.$routeParams.submittalId;this.moduleId=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id);this.isPermitScreen=this.moduleId==app.Common.SelfServiceModules.Permit;this.isPlanScreen=this.moduleId==app.Common.SelfServiceModules.Plan;this.isUserLoggedIn=this.userService.isUserLoggedIn;this.isUserLoggedIn&&(this.isPermitScreen?this.enerGovPermitService.checkUserAssociatedWithPermit(this.planPermitId,function(n){s.isUserInPlanPermitContact=n}):this.enerGovPlanService.checkUserAssociatedWithPlan(this.planPermitId,function(n){s.isUserInPlanPermitContact=n}));this.enerGovSettingsService.getSoftwareSetting("EnerGov","RequestInPersonVideoCall",function(n){n.SettingValue!==null&&(s.requestInPersonVideoCall=n.SettingValue=="true")})}return Object.defineProperty(n.prototype,"canRequestVideoCall",{get:function(){return(this.isPermitScreen||this.isPlanScreen)&&this.isUserLoggedIn&&this.requestInPersonVideoCall&&this.isUserInPlanPermitContact},enumerable:!0,configurable:!0}),n.prototype.requestVideoCallClick=function(n){var t=this,i;t.selectedItemReviewType=undefined;t.requestedTime="";t.twilioRequest={TwilioRequestId:"",TwilioRequestStatusId:1,Name:"",RequestedByUserId:"",SystemModuleId:this.isPermitScreen?app.Common.TwilioRequestEnerGovModules.Permit:app.Common.TwilioRequestEnerGovModules.Plan,EntityId:this.planPermitId,EntityNumber:"",ItemReviewId:undefined,IsGeneric:!1,RequestedReason:"",CompletedNotes:"",CreatedBy:"",CreateOn:new Date,LastChangedBy:"",LastChangedOn:new Date,RowVersion:1,RequestedByUserLastName:"",RequestedByUserFirstName:"",RequestedByUserEmail:"",CreatedByLastName:"",CreatedByFirstName:"",ModuleName:"",StatusName:"",TwilioRequestUsers:[],RequestedByPhone:""};i=angular.element(n.target.parentElement).find("#RequestVideoCallModal");t.itemReviewTypeList.length>0?i.modal("show"):t.itemReviewTypeService.getReviewTypeList(this.planPermitId,this.submittalId,this.isPlanScreen,function(n){t.itemReviewTypeList=n;i.modal("show")})},n.prototype.requestVideoCallOkClick=function(){var n=this,t=n.requestedTime.split(":"),i;n.twilioRequest.RequestedDate.setHours(+t[0],+t[1],0);i=new Date(n.twilioRequest.RequestedDate.getDate()).getTimezoneOffset()*-1;n.twilioRequest.RequestedDate.setMinutes(i+ +t[1]);n.twilioRequest.EntityNumber=n.selectedItemReviewType.EntityNumber;n.selectedItemReviewType.ItemReviewTypeId?n.twilioRequest.ItemReviewId=n.selectedItemReviewType.ItemReviewId:n.twilioRequest.IsGeneric=!0;n.selectedItemReviewType.ItemReviewAssignedToUserId&&n.twilioRequest.TwilioRequestUsers.push({AddedBy:"",AddedOn:new Date,Email:"",FirstName:"",LastName:"",IsMain:!0,Phone:"",TwilioRequestId:"",TwilioRequestUsersId:"",UserId:n.selectedItemReviewType.ItemReviewAssignedToUserId});n.enerGovTwilioServiceRequestAddService.requestVideoCall(n.twilioRequest,function(n){n&&n.TwilioRequestId.length>0&&$("#RequestVideoCallModal.modal.fade.in").modal("hide")})},n.prototype.requestVideoCallCancelClick=function(){$("#RequestVideoCallModal.modal.fade.in").modal("hide")},n}();n.EnerGovTwilioServiceRequestAddController=t})(t=n.TwilioServiceRequest||(n.TwilioServiceRequest={}))}(EnerGov||(EnerGov={}));__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){var r=n.call(this,null)||this,u;return r.enerGovTwilioService=t,r.$location=i,r.currentPage=1,r.totalPages=1,r.totalFound=0,r.totalFoundDisplay=0,r.pageSize=10,r.pageNumber=1,r.firstLoad=!0,r.resetFirstPage=!0,r.showBusySignal=!1,r.refresh=!1,r.criteria={PageNumber:1,PageSize:10,Tab:1,UserId:"",IsCSSRequest:!0},r.goToPage=function(n){r.pageNumber=n;r.currentPage=r.pageNumber;r.resetFirstPage=!1;r.showBusySignal=!0;r.getServiceRequest();r.showBusySignal=!1},u=r,r.getServiceRequest(),r}return __extends(t,n),t.prototype.getServiceRequest=function(){var n=this;this.criteria.PageSize=this.pageSize;this.criteria.PageNumber=this.pageNumber;this.enerGovTwilioService.getTwilioServiceRequest(this.criteria,function(t){n.model=t;n.totalPages=t.TotalRows<t.PageSize?1:Math.floor(t.TotalRows/t.PageSize)+(t.TotalRows%t.PageSize!=0?1:0);n.totalFound=t.TotalRows;n.firstLoad=!1;n.refresh=!n.refresh})},t.prototype.downloadRequestCalander=function(n){this.enerGovTwilioService.getTwilioServiceRequestDownloadCalender(n,function(n){if(n){var t=new Blob([n],{type:"text/calendar"}),i=window.URL.createObjectURL(t);window.open(i,"_blank")}else console.log("Return value was null, unable to download calender")});this.showBusySignal=!1},t.prototype.joinMeeting=function(n){this.$location.path("joinmeeting/"+n)},t.prototype.changePageSize=function(n){this.resetFirstPage=!0;this.pageNumber=1;this.pageSize=n;this.showBusySignal=!0;this.getServiceRequest();this.showBusySignal=!1},t.prototype.onTabClick=function(n){this.criteria.Tab=n;this.pageNumber=1;this.criteria.PageNumber=this.pageNumber;this.criteria.PageSize=this.pageSize;this.getServiceRequest()},t}(app.Core.Controllers.CoreController);n.EnerGovTwilioServiceRequestViewController=t})(t=n.Controllers||(n.Controllers={}))})(t=n.TwilioServiceRequest||(n.TwilioServiceRequest={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){"use strict";var i=t.Controllers.EnerGovTwilioServiceRequestViewController,r=t.Services.EnerGovTwilioServiceRequestService,u=t.EnerGovTwilioServiceRequestAddController,f=t.Services.EnerGovTwilioServiceRequestAddService,e=t.Services.EnerGovTwilioJoinMeetingService,o=n.TwilioServiceRequest.Controllers.EnerGovTwilioJoinMeetingController;angular.module("enerGov.TwilioServiceRequest",["app.globalsModule","app.Common.Services","enerGov.Permit","enerGov.Plan"]).service("enerGovTwilioServiceRequestService",["http",r]).service("enerGovTwilioServiceRequestAddService",["http",f]).service("enerGovTwilioJoinMeetingService",["http",e]).controller("enerGovTwilioJoinMeetingController",["$scope","$routeParams","enerGovTwilioJoinMeetingService","userService","$location",o]).controller("enerGovTwilioServiceRequestViewController",["enerGovTwilioServiceRequestService","$location",i]).controller("enerGovTwilioServiceRequestAddController",["$routeParams","$location","enerGovSubmittalItemReviewTypeService","userService","enerGovSettingsService","enerGovPermitService","enerGovPlanService","enerGovTwilioServiceRequestAddService",u])})(t=n.TwilioServiceRequest||(n.TwilioServiceRequest={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(){}return n.getItemReviewSearchCriteria=function(n,t,i){var r=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(t,i.id);return{PageNumber:1,PageSize:n.pageSizeList[0].Value,SortField:"",IsSortedInAscendingOrder:!0,SubmittalId:i.submittalId,ModuleId:r,EntityId:i.id}},n.getItemReviewCorrectionSearchCriteria=function(n){return{PageNumber:1,PageSize:n.pageSizeList[0].Value,SortField:"",IsSortedInAscendingOrder:!0,ItemReviewId:"1e8ca18d-80fd-42fb-a9fc-f801ecc40f1b",ModuleId:0,EntityId:""}},n}();n.EntitySubmittalHelper=t})(t=n.Helpers||(n.Helpers={}))})(t=n.Submittal||(n.Submittal={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/entity/submittals";this.isDataPresent=!1}return n.prototype.searchByCriteria=function(n,t){var i=this;this.http.post(this.rootUrl+"/search",n,function(n){n.Result&&n.Result!==null&&n.Result.length>0&&(i.isDataPresent=!0);t(n)},!0)},n.prototype.searchSubmittalsForEntityTab=function(n,t){return this.http.post(this.rootUrl+"/search",n,function(n){t(n)},!1)},n.prototype.isEntitySubmittalsExist=function(n,t,i){return this.http.get(this.rootUrl+"/isentitysubmittalsexist/"+n+"/"+t,function(n){i(n.Result)},!1)},n}();n.EnerGovEntitySubmittalSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Submittal||(n.Submittal={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/submittal/itemreview/detail/corrections"}return n.prototype.searchByCriteria=function(n,t){this.http.post(this.rootUrl,n,function(n){n.Success&&t(n)},!0)},n}();n.EnerGovItemReviewCorrectionSearchService=t})(t=n.Services||(n.Services={}))})(t=n.ItemReview||(n.ItemReview={}))})(t=n.Submittal||(n.Submittal={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/submittal/itemreview/detail/recommendations"}return n.prototype.searchByCriteria=function(n,t){this.http.post(this.rootUrl,n,function(n){n.Success&&t(n)},!0)},n}();n.EnerGovItemReviewRecommendationSearchService=t})(t=n.Services||(n.Services={}))})(t=n.ItemReview||(n.ItemReview={}))})(t=n.Submittal||(n.Submittal={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t){this.http=n;this.eventService=t;this.rootUrl="/energov/entity/submittals/itemreviews/search/"}return n.prototype.searchByCriteria=function(n,t){var i=this;i.searchWithDetails(n,function(){});this.http.post(this.rootUrl,n,function(n){if(n.Success){if(n.Result.length>0){n.Result[0].Selected=!0;var r=n.Result[0];i.eventService.boradcast("selectedItemReview",r)}t(n)}},!0)},n.prototype.searchWithDetails=function(n,t,i){i===void 0&&(i=!1);var r=this;this.http.post(this.rootUrl+"items",n,function(n){n.Success&&(i||(r.submittalTypes=n),t(n))},!0)},n}();n.EnerGovSubmittalItemReviewSearchService=t})(t=n.Services||(n.Services={}))})(t=n.ItemReview||(n.ItemReview={}))})(t=n.Submittal||(n.Submittal={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n}return n.prototype.getReviewTypeList=function(n,t,i,r){var u="/energov/entity/submittals/itemreviewtypes/item-review-type-list/"+n+"/"+t+"/"+i;this.http.get(u,function(n){n.Success&&r(n.Result)},!0)},n}();n.EnerGovSubmittalItemReviewTypeService=t})(t=n.Services||(n.Services={}))})(t=n.Submittal||(n.Submittal={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/submittals/"}return n.prototype.getById=function(n,t){var i;i="/energov/submittals/"+n;this.http.get(i,function(n){n.Success&&t(n.Result)},!0)},n}();n.EnerGovSubmittalService=t})(t=n.Services||(n.Services={}))})(t=n.Submittal||(n.Submittal={}))}(EnerGov||(EnerGov={}));__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,null)||this,o;return e.$routeParams=t,e.$location=i,e.globalService=r,e.enerGovSubmittalService=u,e.energovReportService=f,o=e,e.moduleId=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(i,t.id),e.enerGovSubmittalService.getById(e.$routeParams.submittalId,function(n){if(o.model=n,o.model.SubmittalId===""&&(alert("Unable to load the selected submittal. Please contact your municipality about the submittal you were attempting to view. Returning to home."),e.$location.path("/dashboard")),o.model.IsLoggedIn&&o.model.HasAuthorizedContact){var t=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(e.$location,e.$routeParams.id);t==app.Common.SelfServiceModules.Permit&&e.energovReportService.getReportName("PERMITCORRECTION",null,null,function(n){o.reportName=n});t==app.Common.SelfServiceModules.Plan&&e.energovReportService.getReportName("PLANCORRECTION",null,null,function(n){o.reportName=n})}}),e}return __extends(t,n),t.prototype.back=function(){window.history.back()},t.prototype.printCorrectionReport=function(){var n=this.globalService.webApiBaseUrl+"/energov/report/single?value="+this.$routeParams.id+"&reportName="+this.reportName+"&tenantId="+this.globalService.tenantId;window.open(n,"_new")},t}(app.Core.Controllers.CoreController);n.EnerGovEntitySubmittalController=t})(t=n.Detail||(n.Detail={}))})(t=n.Submittal||(n.Submittal={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f,e,o,s,h){var c=n.call(this,t,i,r,u,null,!1)||this;return c.$routeParams=t,c.$location=i,c.entitySecondaryDataService=f,c.submittalItemReviewService=e,c.tenantSettingService=o,c.eReviewEntityResponseService=s,c.eReviewsService=h,c.model=[],c.showResponseButton=!1,c.fromEntityDetail=!0,c.isAnyFileForResubmit=!1,c}return __extends(t,n),t.prototype.collapsePanel=function(n){n.isCollapsed=!n.isCollapsed},t.prototype.cssClassCollapse=function(n,t){return this.fromEntityDetail||n?t:t+" in"},t.prototype.showRecommendationResponse=function(n,t){n.showResponseArea=!n.showResponseArea;n.showResponseArea&&this.setFocus(t,300)},t.prototype.showCorrectionResponse=function(n,t){n.showResponseArea=!n.showResponseArea;n.showResponseArea&&this.setFocus(t,300)},t.prototype.setFocus=function(n,t){var r=this,i=angular.element(n);i&&r.$timeout(function(){i[0].focus()},t)},t.prototype.isDataForUpdateAvailable=function(n){var t=!0,r=this,i;return n&&(i=r.submittalTypesCopy.filter(function(t){return t.SubmittalId===n.SubmittalId&&t.ItemReviewId===n.ItemReviewId})[0],angular.forEach(n.Recommendations,function(n){if(t){var r=i.Recommendations.filter(function(t){return t.RecommendationID==n.RecommendationID})[0];n.Response&&(!n.Response.ResponseID&&n.Response.UserResponse!=null&&n.Response.UserResponse!=""||n.Response.ResponseID&&n.Response.ResponseID!="")&&n.Response.UserResponse!==r.Response.UserResponse&&(t=!1)}}),angular.forEach(n.Corrections,function(n){if(t){var r=i.Corrections.filter(function(t){return t.CorrectionID==n.CorrectionID})[0];n.Response&&(!n.Response.ResponseID&&n.Response.UserResponse!=null&&n.Response.UserResponse!=""||n.Response.ResponseID&&n.Response.ResponseID!="")&&r.Response.UserResponse!==n.Response.UserResponse&&(t=!1)}})),t},t.prototype.saveResponses=function(n){var i=this,r=this,t;this.showResponseButton&&(t=[],n&&(angular.forEach(n.Recommendations,function(n){n.Response&&(!n.Response.ResponseID&&n.Response.UserResponse!=null&&n.Response.UserResponse!=""||n.Response.ResponseID&&n.Response.ResponseID!="")&&(n.Response.ResponseEntityID=n.RecommendationID,t.push(n.Response))}),angular.forEach(n.Corrections,function(n){n.Response&&(!n.Response.ResponseID&&n.Response.UserResponse!=null&&n.Response.UserResponse!=""||n.Response.ResponseID&&n.Response.ResponseID!="")&&(n.Response.ResponseEntityID=n.CorrectionID,t.push(n.Response))}),this.eReviewEntityResponseService.save(t,function(n){n.Success&&(i.submittalItemReviewService.submittalTypes=[],window.location.reload())})))},t.prototype.init=function(){var n=this,t;window.entityRecordsSortSecondaryData===null||typeof entityRecordsSortSecondaryData=="undefined"?n.entitySecondaryDataService.getEntityRecordSortSecondaryData(function(t){n.sortList=t.Result.EntitySubmittalSearchSortList;n.sortField=t.Result.EntitySubmittalSearchSortList[0].Value;window.entityRecordsSortSecondaryData=t.Result}):(n.sortList=window.entityRecordsSortSecondaryData.EntitySubmittalSearchSortList,n.sortField=window.entityRecordsSortSecondaryData.EntitySubmittalSearchSortList[0].Value);t=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id);n.eReviewsService.getEReviewProjectByEntityId(n.$routeParams.id,t,function(t){t.Result&&(n.isAnyFileForResubmit=t.Result.ERProjectFiles.filter(function(n){return n.AllowRevisionFileUpload}).length>0)});t=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(n.$location,n.$routeParams.id);switch(t){case 1:n.parentUrl="#/permit/"+n.$routeParams.id+"/submittal/";break;case 2:n.parentUrl="#/plan/"+n.$routeParams.id+"/submittal/"}this.criteria={PageNumber:1,PageSize:100,SortField:"",IsSortedInAscendingOrder:!0,ModuleId:t,EntityId:n.$routeParams.id,IsFailed:this.$location.path().indexOf("attentionSummary")!==-1};this.reviewSearchCriteria={PageNumber:1,PageSize:10,SortField:"",IsSortedInAscendingOrder:!0,SubmittalId:"",ModuleId:t,EntityId:n.$routeParams.id};this.searchCriteria=this.criteria;this.search(this.criteria,app.Events.SearchEvents.SearchCompleted,function(t){n.tenantSettingService.getSoftwarePackageSetting("EReviewAllowResponses",function(i){n.showResponseButton=i&&i.SettingValue==="true";t=t.sort(function(n,t){return n.SubmittalCompleteDate===null&&t.SubmittalCompleteDate===null?0:n.SubmittalCompleteDate===null?-1:t.SubmittalCompleteDate===null?1:moment.utc(t.SubmittalCompleteDate).diff(moment.utc(n.SubmittalCompleteDate))});n.reviewSearchCriteria.SubmittalId=t.map(function(n){return n.SubmittalId}).join(",");n.submittalItemReviewService.searchWithDetails(n.reviewSearchCriteria,function(i){n.submittalTypes=i.Result;n.submittalTypesCopy=angular.copy(n.submittalTypes);angular.forEach(n.submittalTypes,function(t){t.isCollapsed=!0;t.isAcknowledged=!1;n.showResponseButton&&(angular.forEach(t.Corrections,function(n){n.showResponseArea=n.Response&&n.Response.UserResponse&&n.Response.UserResponse.length>0}),angular.forEach(t.Recommendations,function(n){n.showResponseArea=n.Response&&n.Response.UserResponse&&n.Response.UserResponse.length>0}))});angular.forEach(t,function(t,i){t.SubmittalCompleteDate&&i!=0&&(t.isCollapsed=!0);n.model.push({submittalDetails:t,reviewItems:n.submittalTypes.filter(function(n){return n.SubmittalId==t.SubmittalId})})})},!0)})})},t}(app.Common.Controllers.PagedSearchController);n.EnerGovEntitySubmittalSearchController=t})(t=n.Submittal||(n.Submittal={}))}(EnerGov||(EnerGov={}));__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,e,o){var h=n.call(this,t,i,r,u,null,!1)||this,s,c;return h.$rootScope=e,h.commonService=o,h.filename="",h.options="",s=h,window.entityRecordsSortSecondaryData===null||typeof entityRecordsSortSecondaryData=="undefined"?f.getEntityRecordSortSecondaryData(function(n){s.sortList=n.Result.ItemReviewCorrectionSearchSortList;s.sortField=n.Result.ItemReviewCorrectionSearchSortList[0].Value;window.entityRecordsSortSecondaryData=n.Result}):(s.sortList=window.entityRecordsSortSecondaryData.ItemReviewCorrectionSearchSortList,s.sortField=window.entityRecordsSortSecondaryData.ItemReviewCorrectionSearchSortList[0].Value),c=s.$rootScope.$on("selectedItemReview",function(n,t){var i={PageNumber:1,PageSize:r.pageSizeList[0].Value,SortField:"",IsSortedInAscendingOrder:!0,ItemReviewId:t[0].ItemReviewId};s.searchCriteria=i;s.search(s.searchCriteria,app.Events.SearchEvents.SearchCompleted);$("#itemReviewCorrectionsGrid").find("#pageSizeList").val(r.pageSizeList[0].Value);$("#itemReviewCorrectionsGrid").find("#itemReviewCorrectionSortField option:first").attr("selected","selected")}),s.$rootScope.$on("$locationChangeStart",function(n,t,i){i.indexOf("/submittal")>-1&&c()}),s.commonService.getCaseLimit(function(n){s.caseLimitForExport=n}),h}return __extends(t,n),t.prototype.fileNameOkClick=function(){var n=this;n.filename!==""&&n.filename!==undefined&&($("#FilenameModal.modal.fade.in").modal("hide"),n.options==="default"?n.searchForExport(null,app.Events.SearchEvents.SearchCompleted,function(){n.commonService.downloadData(n.searchResultForExcel,n.filename,"correction");n.filename=""},n.caseLimitForExport):(n.commonService.downloadData(n.searchResult,n.filename,"correction"),n.filename=""))},t.prototype.fileNameCancelClick=function(){$("#FilenameModal.modal.fade.in").modal("hide");$("div:not(.ng-hide) #button-Export").focus()},t}(app.Common.Controllers.PagedSearchController);n.EnerGovItemReviewCorrectionSearchController=t})(t=n.ItemReview||(n.ItemReview={}))})(t=n.Submittal||(n.Submittal={}))}(EnerGov||(EnerGov={}));__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,e,o){var h=n.call(this,t,i,r,u,null,!1)||this,s,c;return h.$rootScope=e,h.commonService=o,h.filename="",h.options="",s=h,window.entityRecordsSortSecondaryData===null||typeof entityRecordsSortSecondaryData=="undefined"?f.getEntityRecordSortSecondaryData(function(n){s.sortList=n.Result.ItemReviewRecommendationSearchSortList;s.sortField=n.Result.ItemReviewRecommendationSearchSortList[0].Value;window.entityRecordsSortSecondaryData=n.Result}):(s.sortList=window.entityRecordsSortSecondaryData.ItemReviewRecommendationSearchSortList,s.sortField=window.entityRecordsSortSecondaryData.ItemReviewRecommendationSearchSortList[0].Value),c=s.$rootScope.$on("selectedItemReview",function(n,t){var i={PageNumber:1,PageSize:r.pageSizeList[0].Value,SortField:"",IsSortedInAscendingOrder:!0,ItemReviewId:t[0].ItemReviewId};s.searchCriteria=i;s.search(s.searchCriteria,app.Events.SearchEvents.SearchCompleted);$("#itemReviewRecommendationsGrid").find("#pageSizeList").val(r.pageSizeList[0].Value);$("#itemReviewRecommendationsGrid").find("#itemReviewRecommendationSortField option:first").attr("selected","selected")}),s.$rootScope.$on("$locationChangeStart",function(n,t,i){i.indexOf("/submittal")>-1&&c()}),s.commonService.getCaseLimit(function(n){s.caseLimitForExport=n}),h}return __extends(t,n),t.prototype.fileNameOkClick=function(){var n=this,t;n.filename!==""&&n.filename!==undefined&&($("#FilenameModal.modal.fade.in").modal("hide"),t=1,n.options==="default"?n.searchForExport(null,app.Events.SearchEvents.SearchCompleted,function(){n.commonService.downloadData(n.searchResultForExcel,n.filename,"recommendation");n.filename=""},n.caseLimitForExport):(n.commonService.downloadData(n.searchResult,n.filename,"recommendation"),n.filename=""))},t.prototype.fileNameCancelClick=function(){$("#FilenameModal.modal.fade.in").modal("hide");$("div:not(.ng-hide) #button-Export").focus()},t}(app.Common.Controllers.PagedSearchController);n.EnerGovItemReviewRecommendationSearchController=t})(t=n.ItemReview||(n.ItemReview={}))})(t=n.Submittal||(n.Submittal={}))}(EnerGov||(EnerGov={}));__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,o,s,h){var c=t.call(this,i,r,u,f,n.Submittal.Helpers.EntitySubmittalHelper.getItemReviewSearchCriteria(u,r,i),i.submittalId!==null&&typeof i.submittalId!="undefined"?!0:!1)||this,l,a;return c.eventService=o,c.$rootScope=s,c.commonService=h,c.filename="",c.options="",c.hideDetailsFlag=!0,c.isVisible=function(){return this.$routeParams.submittalId!==null&&typeof this.$routeParams.submittalId!="undefined"?!0:!1},c.selectItemReview=function(n,t){this.selectedButton!==t?(this.selectedButton=t,this.hideDetailsFlag=!1):(this.hideDetailsFlag=!0,this.selectedButton=undefined);this.selectedItemReview=n;this.eventService.boradcast("selectedItemReview",n)},l=c,e.getEntityRecordSortSecondaryData(function(n){l.sortList=n.Result.SubmittalItemReviewSearchSortList;l.sortField=n.Result.SubmittalItemReviewSearchSortList[0].Value}),a=l.$rootScope.$on("selectedItemReview",function(n,t){l.selectedItemReview=t[0]}),l.$rootScope.$on("$locationChangeStart",function(n,t,i){i.indexOf("/submittal")>-1&&a()}),l.commonService.getCaseLimit(function(n){l.caseLimitForExport=n}),c}return __extends(i,t),i.prototype.fileNameOkClick=function(){var n=this,t;n.filename!==""&&n.filename!==undefined&&($("#FilenameModal.modal.fade.in").modal("hide"),t=1,n.options==="default"?n.searchForExport(null,app.Events.SearchEvents.SearchCompleted,function(){n.commonService.downloadData(n.searchResultForExcel,n.filename,"submittalitemreview");n.filename=""},n.caseLimitForExport):(n.commonService.downloadData(n.searchResult,n.filename,"submittalitemreview"),n.filename=""))},i.prototype.fileNameCancelClick=function(){$("#FilenameModal.modal.fade.in").modal("hide");$("div:not(.ng-hide) #button-Export").focus()},i}(app.Common.Controllers.PagedSearchController);t.EnerGovSubmittalItemReviewSearchController=i})(i=t.ItemReview||(t.ItemReview={}))})(t=n.Submittal||(n.Submittal={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(){"use strict";var t=n.Submittal.Detail.EnerGovEntitySubmittalController,i=n.Submittal.EnerGovEntitySubmittalSearchController,r=n.Submittal.Services.EnerGovEntitySubmittalSearchService,u=n.Submittal.Services.EnerGovSubmittalService,f=n.Submittal.ItemReview.EnerGovSubmittalItemReviewSearchController,e=n.Submittal.ItemReview.Services.EnerGovSubmittalItemReviewSearchService,o=n.Submittal.ItemReview.EnerGovItemReviewCorrectionSearchController,s=n.Submittal.ItemReview.Services.EnerGovItemReviewCorrectionSearchService,h=n.Submittal.ItemReview.EnerGovItemReviewRecommendationSearchController,c=n.Submittal.ItemReview.Services.EnerGovItemReviewRecommendationSearchService,l=n.Submittal.Services.EnerGovSubmittalItemReviewTypeService;angular.module("enerGov.Submittal",["app.globalsModule","app.Common.Services","enerGov.Permit","enerGov.TwilioServiceRequest"]).service("enerGovEntitySubmittalSearchService",["http",r]).service("enerGovSubmittalService",["http",u]).service("enerGovSubmittalItemReviewSearchService",["http","eventService",e]).service("enerGovItemReviewCorrectionSearchService",["http",s]).service("enerGovItemReviewRecommendationSearchService",["http",c]).service("enerGovSubmittalItemReviewTypeService",["http",l]).controller("enerGovEntitySubmittalController",["$routeParams","$location","globalsService","enerGovSubmittalService","enerGovReportService",t]).controller("enerGovEntitySubmittalSearchController",["$routeParams","$location","globalsService","enerGovEntitySubmittalSearchService","entitySecondaryDataService","enerGovSubmittalItemReviewSearchService","tenantSettingService","eReviewEntityResponseService","eReviewsService",i]).controller("enerGovSubmittalItemReviewSearchController",["$routeParams","$location","globalsService","enerGovSubmittalItemReviewSearchService","entitySecondaryDataService","eventService","$rootScope","enerGovCommonForExportService","enerGovSubmittalItemReviewTypeService","userService","enerGovSettingsService","enerGovPermitService",f]).controller("enerGovItemReviewCorrectionSearchController",["$routeParams","$location","globalsService","enerGovItemReviewCorrectionSearchService","entitySecondaryDataService","$rootScope","enerGovCommonForExportService",o]).controller("enerGovItemReviewRecommendationSearchController",["$routeParams","$location","globalsService","enerGovItemReviewRecommendationSearchService","entitySecondaryDataService","$rootScope","enerGovCommonForExportService",h])})(t=n.Submittal||(n.Submittal={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){var i;(function(t){"use strict";var i=n.Common.CaseTypeUseEnums.FilterModule,r=function(){function n(n,t,i,r,u,f,e){this.http=n;this.enerGovPermitService=t;this.enerGovPlanService=i;this.enerGovInspectionService=r;this.enerGovCodeCaseService=u;this.enerGovRequestsService=f;this.enerGovLicenseService=e;this.rootUrl="/energov/search/"}return n.prototype.getGlobalSearchSecondaryData=function(n){var t=this;this.http.get("/SelfServiceSecondaryData/GlobalSearchSecondaryData",function(r){if(r.Success){var u=r.Result;t.enerGovRequestsService.getSecondaryData("",function(t){t!==null&&r.Result!==null&&t.forEach(function(n){r.Result.CaseTypes.push({CaseTypeId:n.RequestTypeId,CaseTypeName:n.RequestTypeName,CategoryObjectId:i.Request,CategoryObjectName:""})});n(r.Result)});t.enerGovPermitService.getPermitStatus(function(t){t!==null&&r.Result!==null&&t.forEach(function(n){r.Result.Status.push({StatusId:n.PermitStatusId,Name:n.Name,CategoryObjectId:i.Permit,CategoryObjectName:"STATUS"})});n(r.Result)});t.enerGovPlanService.getPlanStatus(function(t){t!==null&&r.Result!==null&&t.forEach(function(n){r.Result.Status.push({StatusId:n.PlanStatusId,Name:n.Name,CategoryObjectId:i.Plan,CategoryObjectName:"STATUS"})});n(r.Result)});t.enerGovInspectionService.getInspectionStatus(function(t){t!==null&&r.Result!==null&&t.forEach(function(n){r.Result.Status.push({StatusId:n.InspectionStatusId,Name:n.Name,CategoryObjectId:i.Inspection,CategoryObjectName:"STATUS"})});n(r.Result)});t.enerGovInspectionService.getSecondaryData(function(t){t!==null&&t.InspectionTypes!=null&&r.Result!==null&&t.InspectionTypes.forEach(function(n){n.InspectionTypeID&&r.Result.CaseTypes.push({CaseTypeId:n.InspectionTypeID,CaseTypeName:n.Name,CategoryObjectId:i.Inspection,CategoryObjectName:"INSPECTION"})});n(r.Result)});t.enerGovCodeCaseService.getCodeCaseStatus(function(t){t!==null&&r.Result!==null&&t.forEach(function(n){r.Result.Status.push({StatusId:n.CodeCaseStatusId,Name:n.Name,CategoryObjectId:i.CodeCase,CategoryObjectName:"STATUS"})});n(r.Result)});t.enerGovCodeCaseService.getSecondaryData(function(t){t!==null&&t.CodeCaseTypes!=null&&r.Result!==null&&t.CodeCaseTypes.forEach(function(n){n.CodeCaseTypeID&&r.Result.CaseTypes.push({CaseTypeId:n.CodeCaseTypeID,CaseTypeName:n.Name,CategoryObjectId:i.CodeCase,CategoryObjectName:"CODECASE"})});n(r.Result)});t.enerGovRequestsService.getRequestStatus(function(t){t!==null&&r.Result!==null&&t.forEach(function(n){r.Result.Status.push({StatusId:n.RequestStatusId,Name:n.Name,CategoryObjectId:i.Request,CategoryObjectName:"STATUS"})});n(r.Result)});t.enerGovLicenseService.getBusinessLicenseStatus(function(u){u!==null&&r.Result!==null&&u.forEach(function(n){r.Result.LicenseStatus.push({LicenseStatusId:n.BusinessLicenseStatusId,Name:n.Name,CategoryObjectId:i.License,CategoryObjectName:"LICENSESTATUS"})});t.enerGovLicenseService.getProfessionalLicenseStatus(function(t){t!==null&&r.Result!==null&&t.forEach(function(n){var t=r.Result.LicenseStatus.filter(function(t){return t.Name.toLowerCase()==n.Name.toLowerCase()});t!=null&&t.length==1?(r.Result.LicenseStatus.push({LicenseStatusId:t[0].LicenseStatusId+" "+n.StatusId,Name:n.Name,CategoryObjectId:i.License,CategoryObjectName:"LICENSESTATUS"}),r.Result.LicenseStatus.splice(r.Result.LicenseStatus.indexOf(t[0]),1)):r.Result.LicenseStatus.push({LicenseStatusId:n.StatusId,Name:n.Name,CategoryObjectId:i.License,CategoryObjectName:"LICENSESTATUS"})});n(r.Result)})});t.enerGovLicenseService.getBusinessLicenseBusinessStatus(function(t){t!==null&&r.Result!==null&&t.forEach(function(n){r.Result.BusinessStatus.push({BusinessStatusId:n.BusinessStatusId,Name:n.Name,CategoryObjectId:i.License,CategoryObjectName:"BUSINESSSTATUS"})});n(r.Result)});t.enerGovLicenseService.getBusinessLicenseBusinessTypes(function(t){t!==null&&r.Result!==null&&t.forEach(function(n){r.Result.BusinessTypes.push({BusinessTypeId:n.BusinessLicenseBusinessTypeId,BusinessTypeName:n.BusinessLicenseBusinessTypeName,CategoryObjectId:i.License,CategoryObjectName:"BUSINESSTYPE"})});n(r.Result)});t.enerGovLicenseService.getBusinessLicenseCompanyTypes(function(t){t!==null&&r.Result!==null&&t.forEach(function(n){r.Result.CompanyTypes.push({CompanyTypeId:n.BusinessLicenseCompanyTypeId,CompanyTypeName:n.BusinessLicenseCompanyTypeName,CategoryObjectId:i.License,CategoryObjectName:"COMPANYTYPE"})});n(r.Result)})}},!1)},n.prototype.getCriteria=function(n){this.http.get(this.rootUrl+"criteria",function(t){t.Success&&n(t.Result)},!1)},n.prototype.search=function(n,t){this.http.post(this.rootUrl+"search",n,function(n){n.Success&&t(n)},null)},n}();t.EnerGovSearchService=r})(i=t.Services||(t.Services={}))})(t=n.Search||(n.Search={}))}(EnerGov||(EnerGov={}));__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=n.Common.Constant.QueryStringConstant,f=app.Common.SelfServiceModules,s=n.Common.CaseTypeUseEnums.BusinessLicenseTypeModule,r,u,e,h,o;(function(n){n[n.All=1]="All";n[n.Permit=2]="Permit";n[n.Plan=3]="Plan";n[n.Inspection=4]="Inspection";n[n.CodeCase=5]="CodeCase";n[n.Request=6]="Request";n[n.Business=7]="Business";n[n.BusinessLicense=8]="BusinessLicense";n[n.ProfessionalLicense=9]="ProfessionalLicense";n[n.License=10]="License";n[n.Project=11]="Project";n[n.OperationalPermit=12]="OperationalPermit"})(r=t.SearchModule||(t.SearchModule={})),function(n){n[n.All=1]="All";n[n.Permit=2]="Permit";n[n.Plan=3]="Plan";n[n.Inspection=4]="Inspection";n[n.CodeCase=5]="CodeCase";n[n.Request=6]="Request";n[n.Business=7]="Business";n[n.BusinessLicense=8]="BusinessLicense";n[n.ProfessionalLicense=9]="ProfessionalLicense";n[n.License=10]="License";n[n.Project=11]="Project";n[n.OperationalPermit=12]="OperationalPermit"}(u=t.FilterModule||(t.FilterModule={})),function(n){n.License="LICENSE";n.OperationalPermit="OPERATIONAL PERMIT"}(e=t.CaseTypeCategory||(t.CaseTypeCategory={})),function(n){n[n.Global=0]="Global";n[n.Permit=1]="Permit";n[n.Plan=2]="Plan";n[n.Code=3]="Code";n[n.Request=4]="Request";n[n.Application=6]="Application";n[n.Inspection=7]="Inspection";n[n.BusinessLicense=8]="BusinessLicense";n[n.BusinessEntity=9]="BusinessEntity";n[n.Cashier=10]="Cashier";n[n.ProfLicense=11]="ProfLicense";n[n.TaxRemittance=12]="TaxRemittance"}(h=t.AuthorizationModules||(t.AuthorizationModules={}));o=function(n){function t(t,o,h,c,l,a,v,y,p,w,b){var k=n.call(this,null)||this,d;return k.energovSearchService=t,k.$window=o,k.$location=h,k.commonService=c,k.settingService=l,k.tenantService=a,k.globalService=v,k.userService=y,k.$timeout=p,k.queryStringService=w,k.menuService=b,k.searchResult=null,k.currentPage=1,k.totalPages=0,k.totalFound=0,k.totalFoundDisplay=0,k.permitsFound=0,k.inspectionsFound=0,k.plansFound=0,k.codeCasesFound=0,k.businessLicensesFound=0,k.professionalLicensesFound=0,k.licensesFound=0,k.projectsFound=0,k.requestsFound=0,k.operationalPermitsFound=0,k.resetFilter=!0,k.pageSize=0,k.pageNumber=1,k.sortBy="",k.firstLoad=!0,k.showBusySignal=!1,k.searchKeyword="",k.resetFirstPage=!0,k.allModule=r.All,k.permitModule=r.Permit,k.planModule=r.Plan,k.inspectionModule=r.Inspection,k.codeCaseModule=r.CodeCase,k.professionalLicenseModule=r.ProfessionalLicense,k.businessLicenseModule=r.BusinessLicense,k.licenseModule=r.License,k.operationalPermitModule=r.OperationalPermit,k.requestModule=r.Request,k.projectModule=r.Project,k.recordModulePermit=u.Permit,k.recordModulePlan=u.Plan,k.recordModuleInspection=u.Inspection,k.recordModuleCodeCase=u.CodeCase,k.recordModuleRequest=u.Request,k.recordModuleBusinessLicense=u.BusinessLicense,k.recordModuleProfessionalLicense=u.ProfessionalLicense,k.recordModuleLicense=u.License,k.recordModuleProject=u.Project,k.recordOperationalPermit=u.OperationalPermit,k.filterAllModule=u.All,k.filterPermitModule=u.Permit,k.filterPlanModule=u.Plan,k.filterInspectionModule=u.Inspection,k.filterCodeCaseModule=u.CodeCase,k.filterRequestModule=u.Request,k.filterBusinessLicenseModule=u.BusinessLicense,k.filterProfessionalLicenseModule=u.ProfessionalLicense,k.filterLicenseModule=u.License,k.filterProjectModule=u.Project,k.filterOperationalPermitModule=u.OperationalPermit,k.expandStatus=!1,k.advanceTab=!1,k.showModuleResultMessage=!1,k.refresh=!1,k.searchFilterOption=u.All,k.selectedAddress={streetNumber:"",streetName:"",state:"",province:"",postalCode:"",country:"",city:"",county:""},k.isFilterSearch=!1,k.filename="",k.options="",k.isDisplayByDescriptionForBLicense=!1,k.isDisplayByDescriptionForCodeCase=!1,k.isDisplayByDescriptionForPermit=!1,k.isDisplayByDescriptionForPlan=!1,k.isDisplayByDescriptionForPLicense=!1,k.isDisplayByDescriptionForProject=!1,k.isDisplayByDescriptionForOperationalPermit=!1,k.hideLicenseFeature=!1,k.hideOperationalPermitFeature=!1,k.relevanceText="relevance",k.pagingError=!1,k.isPageloading=!1,k.isTyler311Enabled=!1,k.tyler311Url="",k.hideGlobeIcon=!1,k.licenseCaseTypes=[],k.operationalPermitCaseTypes=[],k.setup=function(){k.energovSearchService.getCriteria(function(n){k.model=n;k.model.FilterModule=k.filterAllModule;k.selectedSearchCategory=n.SearchModule;k.blankCriteria=angular.copy(n);k.showBusySignal=!1;k.showModuleResultMessage=!1;k.model.ExactMatch=!0;k.model.SortAscending=!0;k.queryStringService.isDefaultQuery()||k.startNewSearch()});var n=k;k.energovSearchService.getGlobalSearchSecondaryData(function(t){var o,f;n.globalSearchSecondaryData=t;n.model.SearchModule=n.allModule;k.showBusySignal=!1;k.showModuleResultMessage=!1;o=t.CaseTypes.filter(function(n){return n.CategoryObjectName===e.License});n.licenseCaseTypes=o.filter(function(n){return n.BusinessLicenseTypeModuleId!==s.OperationalPermit});n.operationalPermitCaseTypes=t.CaseTypes.filter(function(n){return n.CategoryObjectName===e.OperationalPermit});f=n.$location.search().category;f==="permits"?(n.model.SearchModule=r.Permit,n.model.FilterModule=u.Permit,n.selectedSearchCategory=r.Permit,n.advanceTab=!0):f==="plans"?(n.model.SearchModule=r.Plan,n.model.FilterModule=u.Plan,n.selectedSearchCategory=r.Plan,n.advanceTab=!0):f==="inspections"?(n.model.SearchModule=r.Inspection,n.model.FilterModule=u.Inspection,n.selectedSearchCategory=r.Inspection,n.advanceTab=!0):f==="codecases"?(n.model.SearchModule=r.CodeCase,n.model.FilterModule=u.CodeCase,n.selectedSearchCategory=r.CodeCase,n.advanceTab=!0):f==="requests"?(n.model.SearchModule=r.Request,n.model.FilterModule=u.Request,n.selectedSearchCategory=r.Request,n.advanceTab=!0):f==="businesslicenses"?(n.model.SearchModule=r.BusinessLicense,n.model.FilterModule=u.BusinessLicense,n.selectedSearchCategory=r.BusinessLicense,n.advanceTab=!0):f==="professionallicenses"?(n.model.SearchModule=r.ProfessionalLicense,n.model.FilterModule=u.ProfessionalLicense,n.selectedSearchCategory=r.ProfessionalLicense,n.advanceTab=!0):f==="licenses"?(n.model.FilterModule=u.License,n.selectedSearchCategory=r.All):f==="projects"?(n.model.SearchModule=r.Project,n.model.FilterModule=u.Project,n.selectedSearchCategory=r.Project,n.advanceTab=!0):(n.model.SearchModule=k.queryStringService.getByKey(i.ModuleKey),n.selectedSearchCategory=k.queryStringService.getByKey(i.ModuleKey),n.model.FilterModule=k.queryStringService.getByKey(i.FilterModuleKey),n.model.SearchModule!=r.All&&(k.advanceTab=!0))})},k.goToPage=function(n,t){k.pageNumber=n;k.pagingError=t;k.resetFirstPage=!1;k.showBusySignal=!0;k.currentPage!==n?(k.updateUrl(),k.search(!0)):k.goToElement("pagingErrorText")},d=k,k.configureUrl(),k.setup(),k.isUserLoggedIn=k.userService.isUserLoggedIn,d.commonService.getCaseLimit(function(n){d.caseLimitForExport=n}),d.settingService.getDisplaySearchByDescriptionFieldSetting(function(n){d.isDisplayByDescription=[{Key:f.BusinessLicense,Value:!0},{Key:f.Code,Value:!0},{Key:f.Permit,Value:!0},{Key:f.Plan,Value:!0},{Key:f.ProfLicense,Value:!0},{Key:f.Project,Value:!0},{Key:f.OperationalPermit,Value:!0}];angular.forEach(n,function(n){n.SettingName==="DisplaySearchByDescriptionFieldForBLicense"?(d.isDisplayByDescriptionForBLicense=n.SettingValue==="true"?!0:!1,d.isDisplayByDescription.filter(function(n){return n.Key==f.BusinessLicense})[0].Value=d.isDisplayByDescriptionForBLicense):n.SettingName==="DisplaySearchByDescriptionFieldForCodeCase"?(d.isDisplayByDescriptionForCodeCase=n.SettingValue==="true"?!0:!1,d.isDisplayByDescription.filter(function(n){return n.Key==f.Code})[0].Value=d.isDisplayByDescriptionForCodeCase):n.SettingName==="DisplaySearchByDescriptionFieldForPermit"?(d.isDisplayByDescriptionForPermit=n.SettingValue==="true"?!0:!1,d.isDisplayByDescription.filter(function(n){return n.Key==f.Permit})[0].Value=d.isDisplayByDescriptionForPermit):n.SettingName==="DisplaySearchByDescriptionFieldForPlan"?(d.isDisplayByDescriptionForPlan=n.SettingValue==="true"?!0:!1,d.isDisplayByDescription.filter(function(n){return n.Key==f.Plan})[0].Value=d.isDisplayByDescriptionForPlan):n.SettingName==="DisplaySearchByDescriptionFieldForPLicense"?(d.isDisplayByDescriptionForPLicense=n.SettingValue==="true"?!0:!1,d.isDisplayByDescription.filter(function(n){return n.Key==f.ProfLicense})[0].Value=d.isDisplayByDescriptionForPLicense):n.SettingName==="DisplaySearchByDescriptionFieldForProject"?(d.isDisplayByDescriptionForProject=n.SettingValue==="true"?!0:!1,d.isDisplayByDescription.filter(function(n){return n.Key==f.Project})[0].Value=d.isDisplayByDescriptionForProject):n.SettingName==="DisplaySearchByDescriptionFieldForHealthPermit"&&(d.isDisplayByDescriptionForOperationalPermit=n.SettingValue==="true",d.isDisplayByDescription.filter(function(n){return n.Key==f.OperationalPermit})[0].Value=d.isDisplayByDescriptionForOperationalPermit)})}),d.settingService.getSoftwareSetting("energov","HideAllLicense",function(n){d.hideLicenseFeature=n.SettingValue==="true"?!0:!1}),d.settingService.getSoftwareSetting("energov","HideAllOperationalPermit",function(n){d.hideOperationalPermitFeature=n.SettingValue==="true"}),d.tenantService.getTenantTyler311Setting(function(n){n&&(d.isTyler311Enabled=n.EnableTyler311.valueOf(),n.Tyler311Url&&(d.tyler311Url=n.Tyler311Url.replace(/\/$/,"")+d.globalService.tyler311RequestPath.replace(/\/$/,"")+"/"))}),d.menuService.getMenu(function(n){if(d.hideGlobeIcon=!1,n.Success){var t=n.Result.Menus.filter(function(n){return n.Details=="Map"});(!t||t.length<1||t[0].IsHidden==!0)&&(d.hideGlobeIcon=!0)}}),k}return __extends(t,n),t.prototype.searchFilter=function(n){this.isPageloading?this.resetFirstPage=!1:(this.resetFirstPage=!0,this.pageNumber=1);this.resetFilter=!1;this.searchFilterOption=n;this.model.SortAscending=!0;this.pagingError=!1;switch(n){case this.filterPermitModule:this.model.PermitCriteria.SortBy=this.model.Keyword?this.model.PermitSortList[0].Key:this.model.PermitSortList[1].Key;break;case this.filterPlanModule:this.model.PlanCriteria.SortBy=this.model.Keyword?this.model.PlanSortList[0].Key:this.model.PlanSortList[1].Key;break;case this.filterInspectionModule:this.model.InspectionCriteria.SortBy=this.model.Keyword?this.model.InspectionSortList[0].Key:this.model.InspectionSortList[1].Key;break;case this.filterCodeCaseModule:this.model.CodeCaseCriteria.SortBy=this.model.Keyword?this.model.CodeCaseSortList[0].Key:this.model.CodeCaseSortList[1].Key;break;case this.filterRequestModule:this.model.RequestCriteria.SortBy=this.model.Keyword?this.model.RequestSortList[0].Key:this.model.RequestSortList[1].Key;break;case this.filterBusinessLicenseModule:this.model.LicenseCriteria.SortBy=this.model.Keyword?this.model.LicenseSortList[0].Key:this.model.LicenseSortList[1].Key;break;case this.filterProfessionalLicenseModule:this.model.LicenseCriteria.SortBy=this.model.Keyword?this.model.LicenseSortList[0].Key:this.model.LicenseSortList[1].Key;break;case this.filterLicenseModule:case this.filterOperationalPermitModule:this.model.LicenseCriteria.SortBy=this.model.Keyword?this.model.LicenseSortList[0].Key:this.model.LicenseSortList[1].Key;break;case this.filterProjectModule:this.model.ProjectCriteria.SortBy=this.model.Keyword?this.model.ProjectSortList[0].Key:this.model.ProjectSortList[1].Key}this.updateUrl();this.search(!0);this.isFilterSearch=!0},t.prototype.getRecordCount=function(n){switch(n){case this.filterAllModule:return this.totalFoundDisplay;case this.filterPermitModule:return this.permitsFound;case this.filterPlanModule:return this.plansFound;case this.filterInspectionModule:return this.inspectionsFound;case this.filterCodeCaseModule:return this.codeCasesFound;case this.filterRequestModule:return this.requestsFound;case this.filterBusinessLicenseModule:return this.businessLicensesFound;case this.filterProfessionalLicenseModule:return this.professionalLicensesFound;case this.filterLicenseModule:return this.licensesFound;case this.filterProjectModule:return this.projectsFound;case this.filterOperationalPermitModule:return this.operationalPermitsFound}},t.prototype.changePageSize=function(n){this.resetFirstPage=!0;this.pagingError=!1;this.pageNumber=1;this.pageSize=n;this.showBusySignal=!0;this.updateUrl();this.search(!0)},t.prototype.getAddress=function(n){var t="";return t=n.AddressLine1,t+=n.AddressLine2!=null&&n.AddressLine2.length>0?" "+n.AddressLine2:"",t+=n.AddressLine3!=null&&n.AddressLine3.length>0?" "+n.AddressLine3:"",t+=n.City!=null&&n.City.length>0?" "+n.City:"",t+(n.CountryName!=null&&n.CountryName.length>0?" "+n.CountryName:"")},t.prototype.showFilterResult=function(){return this.searchResult.TotalFound>0&&this.selectedSearchCategory===r.All?!0:!1},t.prototype.hasSearchResults=function(){return this.searchResult!=null&&this.searchResult.EntityResults!=null&&this.searchResult.EntityResults.length>0},t.prototype.fileNameOkClick=function(){var n=this,t;n.showBusySignal=!0;t=this.getMappedSearchModuleCriteria(!1);n.filename!==""&&n.filename!==undefined&&($("#FilenameModal.modal.fade.in").modal("hide"),t.PageSize=n.caseLimitForExport,t.PageNumber=1,t.InspectionCriteria.PageSize=n.caseLimitForExport,t.InspectionCriteria.PageNumber=1,t.PermitCriteria.PageSize=n.caseLimitForExport,t.PermitCriteria.PageNumber=1,t.PlanCriteria.PageSize=n.caseLimitForExport,t.PlanCriteria.PageNumber=1,t.RequestCriteria.PageSize=n.caseLimitForExport,t.RequestCriteria.PageNumber=1,t.CodeCaseCriteria.PageSize=n.caseLimitForExport,t.CodeCaseCriteria.PageNumber=1,t.BusinessLicenseCriteria.PageSize=n.caseLimitForExport,t.BusinessLicenseCriteria.PageNumber=1,t.ProfessionalLicenseCriteria.PageSize=n.caseLimitForExport,t.ProfessionalLicenseCriteria.PageNumber=1,t.LicenseCriteria.PageSize=n.caseLimitForExport,t.LicenseCriteria.PageNumber=1,t.ProjectCriteria.PageSize=n.caseLimitForExport,t.ProjectCriteria.PageNumber=1,n.options==="default"&&n.isFilterSearch===!0?n.energovSearchService.search(t,function(t){n.commonService.downloadData(t.Result.EntityResults,n.filename,"globalsearch",n.isDisplayByDescription,n.hideLicenseFeature);n.filename=""}):n.options==="default"&&n.model.SearchModule!==u.License?n.energovSearchService.search(t,function(t){n.commonService.downloadData(t.Result.EntityResults,n.filename,"globalsearch",n.isDisplayByDescription,n.hideLicenseFeature);n.filename=""}):n.options!=="default"||n.isFilterSearch||n.model.SearchModule!==u.License?n.options!=="current"||n.isFilterSearch||n.model.SearchModule!==u.License?(n.commonService.downloadData(n.searchResult.EntityResults,n.filename,"globalsearch",n.isDisplayByDescription,n.hideLicenseFeature),n.filename=""):(n.commonService.downloadData(n.searchResult.EntityResults,n.filename,"licenses",n.isDisplayByDescription,n.hideLicenseFeature),n.filename=""):n.energovSearchService.search(t,function(t){n.commonService.downloadData(t.Result.EntityResults,n.filename,"licenses",n.isDisplayByDescription,n.hideLicenseFeature);n.filename=""}),n.showBusySignal=!1,$("div:not(.ng-hide) #button-Export").focus())},t.prototype.fileNameCancelClick=function(){$("#FilenameModal.modal.fade.in").modal("hide");$("div:not(.ng-hide) #button-Export").focus()},t.prototype.showExportButton=function(){return this.hasSearchResults()},t.prototype.setExpandStatus=function(){this.model.SearchModule!==r.All&&(this.expandStatus=!this.expandStatus)},t.prototype.changeSearchModule=function(){this.expandStatus=!1;this.advanceTab=this.model.SearchModule===r.All?!1:!0;this.updateUrl(!0);var n=this.model.SearchModule;this.model=angular.copy(this.blankCriteria);this.model.SearchModule=n;this.model.SortAscending=!0;this.model.ExactMatch=!0;this.resetResult()},t.prototype.resetResult=function(){this.currentPage=1;this.totalPages=0;this.totalFound=0;this.totalFoundDisplay=0;this.permitsFound=0;this.plansFound=0;this.inspectionsFound=0;this.codeCasesFound=0;this.requestsFound=0;this.businessLicensesFound=0;this.resetFilter=!0;this.searchFilterOption=u.All;this.pageNumber=1;this.pageSize=parseInt(this.globals.pageSizeList[0].Value);this.showBusySignal=!1;this.resetFirstPage=!0;this.showModuleResultMessage=!1;this.searchResult=null;this.pagingError=!1;this.model.SearchModule==this.permitModule?(this.model.PermitCriteria.SortBy=this.model.PermitSortList[1].Key,this.model.PermitCriteria.PermitTypeId==null&&(this.model.PermitCriteria.PermitTypeId="none"),this.model.PermitCriteria.PermitStatusId==null&&(this.model.PermitCriteria.PermitStatusId="none")):this.model.SearchModule==this.planModule?(this.model.PlanCriteria.SortBy=this.model.PlanSortList[1].Key,this.model.PlanCriteria.PlanTypeId==null&&(this.model.PlanCriteria.PlanTypeId="none"),this.model.PlanCriteria.PlanStatusId==null&&(this.model.PlanCriteria.PlanStatusId="none")):this.model.SearchModule==this.inspectionModule?(this.model.InspectionCriteria.SortBy=this.model.InspectionSortList[1].Key,this.model.InspectionCriteria.InspectionTypeId==null&&(this.model.InspectionCriteria.InspectionTypeId="none"),this.model.InspectionCriteria.InspectionStatusId==null&&(this.model.InspectionCriteria.InspectionStatusId="none")):this.model.SearchModule==this.codeCaseModule?(this.model.CodeCaseCriteria.SortBy=this.model.CodeCaseSortList[1].Key,this.model.CodeCaseCriteria.CodeCaseTypeId==null&&(this.model.CodeCaseCriteria.CodeCaseTypeId="none"),this.model.CodeCaseCriteria.CodeCaseStatusId==null&&(this.model.CodeCaseCriteria.CodeCaseStatusId="none")):this.model.SearchModule==this.requestModule?(this.model.RequestCriteria.SortBy=this.model.RequestSortList[1].Key,this.model.RequestCriteria.RequestTypeId==null&&(this.model.RequestCriteria.RequestTypeId="none"),this.model.RequestCriteria.RequestStatusId==null&&(this.model.RequestCriteria.RequestStatusId="none")):this.model.SearchModule==this.licenseModule||this.model.SearchModule===this.operationalPermitModule?(this.model.LicenseCriteria.SortBy=this.model.LicenseSortList[1].Key,this.model.LicenseCriteria.LicenseTypeId==null&&(this.model.LicenseCriteria.LicenseTypeId="none"),this.model.LicenseCriteria.LicenseClassId==null&&(this.model.LicenseCriteria.LicenseClassId="none"),this.model.LicenseCriteria.LicenseStatusId==null&&(this.model.LicenseCriteria.LicenseStatusId="none"),this.model.LicenseCriteria.CompanyTypeId==null&&(this.model.LicenseCriteria.CompanyTypeId="none"),this.model.LicenseCriteria.BusinessTypeId==null&&(this.model.LicenseCriteria.BusinessTypeId="none"),this.model.LicenseCriteria.BusinessStatusId==null&&(this.model.LicenseCriteria.BusinessStatusId="none")):this.model.SearchModule==this.allModule&&(this.isFilterSearch=!1)},t.prototype.resetSearch=function(){this.resetResult();this.resetUrl();this.model.InspectionCriteria.InspectionTypeId="none";this.model.InspectionCriteria.InspectionStatusId="none";this.model.PermitCriteria.PermitTypeId="none";this.model.PermitCriteria.PermitStatusId="none";this.model.PlanCriteria.PlanTypeId="none";this.model.PlanCriteria.PlanStatusId="none";this.model.CodeCaseCriteria.CodeCaseTypeId="none";this.model.CodeCaseCriteria.CodeCaseStatusId="none";this.model.RequestCriteria.RequestTypeId="none";this.model.RequestCriteria.RequestStatusId="none";this.model.LicenseCriteria.LicenseTypeId="none";this.model.LicenseCriteria.LicenseClassId="none";this.model.LicenseCriteria.LicenseStatusId="none";this.model.LicenseCriteria.BusinessStatusId="none";this.model.LicenseCriteria.CompanyTypeId="none";this.model.LicenseCriteria.BusinessTypeId="none";this.expandStatus=!1;this.model=angular.copy(this.blankCriteria);this.searchResult=null;this.advanceTab=!1;this.isFilterSearch=!1;this.model.ExactMatch=!0},t.prototype.mapCase=function(n,t){var i,r;n?i=encodeURI(n):t&&(i=encodeURI(t));r=location.href.split("#")[0]+"#/map?search="+i;this.$window.open(r,"_blank")},t.prototype.getEntityRecords=function(){return this.hasSearchResults()?this.searchResult.EntityResults:null},t.prototype.isActiveFilter=function(n){return this.searchFilterOption===n?!0:!1},t.prototype.isResetFirstPage=function(){var n=!1;return this.advanceTab?!0:(this.isPageloading||(this.queryStringService.getByKey(i.SearchTextKey)==""||this.queryStringService.getByKey(i.SearchTextKey)!=this.model.Keyword||this.queryStringService.getByKey(i.ExactMatchKey)!=this.model.ExactMatch)&&(n=!0,this.pageNumber=1),n)},t.prototype.startNewSearch=function(){this.showBusySignal=!1;this.resetResult();this.isFilterSearch=!1;this.resetFirstPage=this.isResetFirstPage();this.updateUrl();this.search(!1)},t.prototype.validateDateRange=function(n,t,i){var r=moment(t).isAfter(i);return n.$setValidity("valFromDate",!r),r},t.prototype.goToElement=function(t){n.prototype.goToElement.call(this,t)},t.prototype.search=function(n){var u=this,t=this,f;if(t.pagingError===!1&&angular.element("#pagingError").addClass("pagingError"),this.selectedSearchCategory=this.model.SearchModule,this.model.SearchModule==this.allModule||this.expandStatus)if(this.model.SearchModule===this.permitModule)this.model.PermitCriteria.PageSize=this.pageSize,this.model.PermitCriteria.PageNumber=this.pageNumber,n?this.model.SortBy=this.model.PermitCriteria.SortBy:this.model.PermitCriteria.PermitNumber||this.model.PermitCriteria.PermitTypeId&&this.model.PermitCriteria.PermitTypeId!=="none"||this.model.PermitCriteria.ProjectName||this.model.PermitCriteria.Address||this.model.PermitCriteria.IssueDateFrom||this.model.PermitCriteria.IssueDateTo||this.model.PermitCriteria.ExpireDateFrom||this.model.PermitCriteria.ExpireDateTo||this.model.PermitCriteria.FinalDateFrom||this.model.PermitCriteria.FinalDateTo?(this.model.PermitCriteria.SortBy=this.model.PermitSortList[0].Key,this.model.SortBy=this.model.PermitCriteria.SortBy):(this.model.PermitCriteria.SortBy=this.model.PermitSortList[1].Key,this.model.SortBy=this.model.PermitCriteria.SortBy);else if(this.model.SearchModule===this.planModule)this.model.PlanCriteria.PageSize=this.pageSize,this.model.PlanCriteria.PageNumber=this.pageNumber,n?this.model.SortBy=this.model.PlanCriteria.SortBy:this.model.PlanCriteria.PlanNumber||this.model.PlanCriteria.PlanTypeId&&this.model.PlanCriteria.PlanTypeId!=="none"||this.model.PlanCriteria.ProjectName||this.model.PlanCriteria.Address||this.model.PlanCriteria.ApplyDateTo||this.model.PlanCriteria.ApplyDateFrom?(this.model.PlanCriteria.SortBy=this.model.PlanSortList[0].Key,this.model.SortBy=this.model.PlanCriteria.SortBy):(this.model.PlanCriteria.SortBy=this.model.PlanSortList[1].Key,this.model.SortBy=this.model.PlanCriteria.SortBy);else if(this.model.SearchModule===this.projectModule)this.model.ProjectCriteria.PageSize=this.pageSize,this.model.ProjectCriteria.PageNumber=this.pageNumber,n?this.model.SortBy=this.model.ProjectCriteria.SortBy:this.model.ProjectCriteria.ProjectNumber||this.model.ProjectCriteria.ProjectName||this.model.ProjectCriteria.Address||this.model.ProjectCriteria.ParcelNumber||this.model.ProjectCriteria.StartDateTo||this.model.ProjectCriteria.StartDateFrom||this.model.ProjectCriteria.ExpectedEndDateFrom||this.model.ProjectCriteria.ExpectedEndDateTo||this.model.ProjectCriteria.CompleteDateFrom||this.model.ProjectCriteria.CompleteDateTo?(this.model.ProjectCriteria.SortBy=this.model.ProjectSortList[0].Key,this.model.SortBy=this.model.ProjectCriteria.SortBy):(this.model.ProjectCriteria.SortBy=this.model.ProjectSortList[1].Key,this.model.SortBy=this.model.ProjectCriteria.SortBy);else if(this.model.SearchModule===this.inspectionModule)this.model.InspectionCriteria.PageSize=this.pageSize,this.model.InspectionCriteria.PageNumber=this.pageNumber,n?this.model.SortBy=this.model.InspectionCriteria.SortBy:this.model.InspectionCriteria.InspectionNumber||this.model.InspectionCriteria.Address||this.model.InspectionCriteria.RequestDateFrom||this.model.InspectionCriteria.RequestDateTo||this.model.InspectionCriteria.ScheduleDateFrom||this.model.InspectionCriteria.ScheduleDateTo?(this.model.InspectionCriteria.SortBy=this.model.InspectionSortList[0].Key,this.model.SortBy=this.model.InspectionCriteria.SortBy):(this.model.InspectionCriteria.SortBy=this.model.InspectionSortList[1].Key,this.model.SortBy=this.model.InspectionCriteria.SortBy);else if(this.model.SearchModule===this.codeCaseModule)this.model.CodeCaseCriteria.PageSize=this.pageSize,this.model.CodeCaseCriteria.PageNumber=this.pageNumber,n?this.model.SortBy=this.model.CodeCaseCriteria.SortBy:this.model.CodeCaseCriteria.CodeCaseNumber||this.model.CodeCaseCriteria.CodeCaseTypeId&&this.model.CodeCaseCriteria.CodeCaseTypeId!=="none"||this.model.CodeCaseCriteria.Address||this.model.CodeCaseCriteria.OpenedDateFrom||this.model.CodeCaseCriteria.OpenedDateTo||this.model.CodeCaseCriteria.ClosedDateFrom||this.model.CodeCaseCriteria.ClosedDateTo?(this.model.CodeCaseCriteria.SortBy=this.model.CodeCaseSortList[0].Key,this.model.SortBy=this.model.CodeCaseCriteria.SortBy):(this.model.CodeCaseCriteria.SortBy=this.model.CodeCaseSortList[1].Key,this.model.SortBy=this.model.CodeCaseCriteria.SortBy);else if(this.model.SearchModule===this.requestModule)this.model.RequestCriteria.PageSize=this.pageSize,this.model.RequestCriteria.PageNumber=this.pageNumber,n?this.model.SortBy=this.model.RequestCriteria.SortBy:this.model.RequestCriteria.RequestNumber||this.model.RequestCriteria.RequestTypeId&&this.model.RequestCriteria.RequestTypeId!=="none"||this.model.RequestCriteria.Address||this.model.RequestCriteria.ParcelNumber||this.model.RequestCriteria.EnteredDateFrom||this.model.RequestCriteria.EnteredDateTo||this.model.RequestCriteria.DeadlineDateFrom||this.model.RequestCriteria.DeadlineDateTo||this.model.RequestCriteria.CompleteDateFrom||this.model.RequestCriteria.CompleteDateTo?(this.model.RequestCriteria.SortBy=this.model.RequestSortList[0].Key,this.model.SortBy=this.model.RequestCriteria.SortBy):(this.model.RequestCriteria.SortBy=this.model.RequestSortList[1].Key,this.model.SortBy=this.model.RequestCriteria.SortBy);else if(this.model.SearchModule===this.licenseModule||this.model.SearchModule===this.operationalPermitModule)this.model.LicenseCriteria.PageSize=this.pageSize,this.model.LicenseCriteria.PageNumber=this.pageNumber,n?this.model.SortBy=this.model.LicenseCriteria.SortBy:this.model.LicenseCriteria.LicenseNumber||this.model.LicenseCriteria.LicenseTypeId&&this.model.LicenseCriteria.LicenseTypeId!=="none"||this.model.LicenseCriteria.LicenseClassId&&this.model.LicenseCriteria.LicenseClassId!=="none"||this.model.LicenseCriteria.LicenseStatusId&&this.model.LicenseCriteria.LicenseStatusId!=="none"||this.model.LicenseCriteria.IssueDateFrom||this.model.LicenseCriteria.IssueDateTo||this.model.LicenseCriteria.ApplicationDateFrom||this.model.LicenseCriteria.ApplicationDateTo||this.model.LicenseCriteria.ExpirationDateFrom||this.model.LicenseCriteria.ExpirationDateTo||this.model.LicenseCriteria.LicenseStatusId&&this.model.LicenseCriteria.CompanyTypeId!=="none"||this.model.LicenseCriteria.LicenseStatusId&&this.model.LicenseCriteria.BusinessTypeId!=="none"?(this.model.LicenseCriteria.SortBy=this.model.LicenseSortList[0].Key,this.model.SortBy=this.model.LicenseCriteria.SortBy):(this.model.LicenseCriteria.SortBy=this.model.LicenseSortList[1].Key,this.model.SortBy=this.model.LicenseCriteria.SortBy);else if(this.model.SearchModule===this.allModule){this.model.PageSize=this.pageSize;this.model.PageNumber=this.pageNumber;this.model.FilterModule=this.searchFilterOption;switch(this.model.FilterModule){case this.filterPermitModule:this.model.SortBy=this.model.PermitCriteria.SortBy;break;case this.filterPlanModule:this.model.SortBy=this.model.PlanCriteria.SortBy;break;case this.filterInspectionModule:this.model.SortBy=this.model.InspectionCriteria.SortBy;break;case this.filterCodeCaseModule:this.model.SortBy=this.model.CodeCaseCriteria.SortBy;break;case this.filterRequestModule:this.model.SortBy=this.model.RequestCriteria.SortBy;break;case this.filterProfessionalLicenseModule:this.model.SortBy=this.model.ProfessionalLicenseCriteria.SortBy;break;case this.filterLicenseModule:case this.filterOperationalPermitModule:this.model.SortBy=this.model.LicenseCriteria.SortBy;break;case this.filterProjectModule:this.model.SortBy=this.model.ProjectCriteria.SortBy}}this.expandStatus||this.model.SearchModule==this.allModule||(this.model.PageSize=this.pageSize,this.model.PageNumber=this.pageNumber,f=t.getMappedSearchModuleCriteria(n));this.firstLoad=!1;this.refresh=!this.refresh;this.energovSearchService.search(!this.expandStatus&&this.model.SearchModule!=this.allModule?f:t.model,function(n){if(console.log("search result called"),t.searchKeyword=t.model.Keyword,t.searchResult=n.Result,t.searchResult!=null){t.totalPages=t.searchResult.TotalPages;t.totalFound=t.searchResult.TotalFound;u.resetFilter&&(t.totalFoundDisplay=t.searchResult.TotalFound,t.permitsFound=t.searchResult.PermitsFound,t.inspectionsFound=t.searchResult.InspectionsFound,t.plansFound=t.searchResult.PlansFound,t.codeCasesFound=t.searchResult.CodeCasesFound,t.requestsFound=t.searchResult.RequestsFound,t.businessLicensesFound=t.searchResult.BusinessLicensesFound,t.professionalLicensesFound=t.searchResult.ProfessionalLicensesFound,t.licensesFound=t.searchResult.LicensesFound,t.projectsFound=t.searchResult.ProjectsFound,t.operationalPermitsFound=t.searchResult.OperationalPermitsFound);var f=u.queryStringService.getByKey(i.FilterModuleKey);u.model.SearchModule==r.All&&f!=u.searchFilterOption&&(u.isPageloading=!0,u.searchFilter(f))}else t.totalPages=0,t.totalFound=0,t.totalFoundDisplay=0;t.currentPage=u.pageNumber;t.$timeout(function(){console.log("refresh variable from search"+t.refresh);t.showBusySignal=!1;t.refresh=!t.refresh});t.showModuleResultMessage=!0;u.pagingError===!0?t.goToElement("pagingErrorText"):t.goToElement("moduleResultMessage")})},t.prototype.setAddress=function(){if(this.selectedAddress!=null)switch(this.model.SearchModule){case this.permitModule:this.model.PermitCriteria.Address=this.selectedAddress.streetNumber+" "+this.selectedAddress.streetName+" "+this.selectedAddress.city+" "+this.selectedAddress.state+" "+this.selectedAddress.province+" "+this.selectedAddress.country+" "+this.selectedAddress.county;break;case this.planModule:this.model.PlanCriteria.Address=this.selectedAddress.streetNumber+" "+this.selectedAddress.streetName+" "+this.selectedAddress.city+" "+this.selectedAddress.state+" "+this.selectedAddress.province+" "+this.selectedAddress.country+" "+this.selectedAddress.county;break;case this.inspectionModule:this.model.InspectionCriteria.Address=this.selectedAddress.streetNumber+" "+this.selectedAddress.streetName+" "+this.selectedAddress.city+" "+this.selectedAddress.state+" "+this.selectedAddress.province+" "+this.selectedAddress.country+" "+this.selectedAddress.county;break;case this.codeCaseModule:this.model.CodeCaseCriteria.Address=this.selectedAddress.streetNumber+" "+this.selectedAddress.streetName+" "+this.selectedAddress.city+" "+this.selectedAddress.state+" "+this.selectedAddress.province+" "+this.selectedAddress.country+" "+this.selectedAddress.county;break;case this.requestModule:this.model.RequestCriteria.Address=this.selectedAddress.streetNumber+" "+this.selectedAddress.streetName+" "+this.selectedAddress.city+" "+this.selectedAddress.state+" "+this.selectedAddress.province+" "+this.selectedAddress.country+" "+this.selectedAddress.county;break;case this.licenseModule:this.model.LicenseCriteria.Address=this.selectedAddress.streetNumber+" "+this.selectedAddress.streetName+" "+this.selectedAddress.city+" "+this.selectedAddress.state+" "+this.selectedAddress.province+" "+this.selectedAddress.country+" "+this.selectedAddress.county}},t.prototype.resetUrl=function(){this.queryStringService.reset();this.$location.search(this.queryStringService.toObject()).replace()},t.prototype.updateUrl=function(n){if(n===void 0&&(n=!1),this.expandStatus||n)this.queryStringService.clear(),this.$location.search(this.queryStringService.toObject()).replace();else if(this.queryStringService.count()==0&&this.createQueryStringItems(this.model.SearchModule,this.model.FilterModule,"",10,1,0,this.model.ExactMatch.valueOf()),this.isPageloading)this.isPageloading=!1,this.model.SearchModule=this.queryStringService.getByKey(i.ModuleKey),this.model.SearchModule!=r.All&&(this.searchFilterOption=this.queryStringService.getByKey(i.FilterModuleKey)),this.model.Keyword=this.queryStringService.getByKey(i.SearchTextKey),this.model.ExactMatch=this.queryStringService.getByKey(i.ExactMatchKey),this.pageSize=this.queryStringService.getByKey(i.PageSizeKey),this.pageNumber=this.queryStringService.getByKey(i.PageNumberKey);else{var t=[[i.ModuleKey,this.model.SearchModule],[i.FilterModuleKey,this.model.SearchModule==r.All?this.searchFilterOption:0],[i.SearchTextKey,this.model.Keyword],[i.PageSizeKey,this.pageSize],[i.PageNumberKey,this.pageNumber],[i.ExactMatchKey,this.model.ExactMatch]];this.queryStringService.update(t)}this.$location.search(this.queryStringService.toObject()).replace()},t.prototype.configureUrl=function(){this.queryStringService.clear();var n=this.$routeParams[i.ModuleKey]?parseInt(this.$routeParams[i.ModuleKey]):1,f=n==r.All?this.$routeParams[i.FilterModuleKey]?parseInt(this.$routeParams[i.FilterModuleKey]):1:0,e=this.$routeParams[i.SearchTextKey]?this.$routeParams[i.SearchTextKey]:"",t=this.$routeParams[i.PageSizeKey]?parseInt(this.$routeParams[i.PageSizeKey]):10,u=this.$routeParams[i.PageNumberKey]?parseInt(this.$routeParams[i.PageNumberKey]):1,o=this.$routeParams[i.SortingOrderKey]?parseInt(this.$routeParams[i.SortingOrderKey]):0,s=this.$routeParams[i.ExactMatchKey]?this.$routeParams[i.ExactMatchKey]==="true":!0;this.createQueryStringItems(n,f,e,t,u,o,s);this.pageSize=t;this.pageNumber=u;this.queryStringService.isDefaultQuery()||(this.isPageloading=!0)},t.prototype.createQueryStringItems=function(n,t,r,u,f,e,o){this.queryStringService.add(i.ModuleName,i.ModuleKey,n,1);this.queryStringService.add(i.FilterModuleName,i.FilterModuleKey,t,1);this.queryStringService.add(i.PageSizeName,i.PageSizeKey,u,10);this.queryStringService.add(i.PageNumberName,i.PageNumberKey,f,1);this.queryStringService.add(i.SortingOrderName,i.SortingOrderKey,e,0);this.queryStringService.add(i.ExactMatchName,i.ExactMatchKey,o,!0);this.queryStringService.add(i.SearchTextName,i.SearchTextKey,r,"")},t.prototype.getMappedSearchModuleCriteria=function(n){var t=this,i=angular.copy(t.model);switch(this.model.SearchModule){case this.permitModule:i.FilterModule=t.filterPermitModule;i.SortBy=n?t.model.PermitCriteria.SortBy:t.model.PermitSortList[1].Key;t.model.PermitCriteria.SortBy=i.SortBy;break;case this.planModule:i.FilterModule=t.filterPlanModule;i.SortBy=n?t.model.PlanCriteria.SortBy:t.model.PlanSortList[1].Key;t.model.PlanCriteria.SortBy=i.SortBy;break;case this.licenseModule:case this.operationalPermitModule:i.FilterModule=this.model.SearchModule===this.licenseModule?t.filterLicenseModule:t.filterOperationalPermitModule;i.SortBy=n?t.model.LicenseCriteria.SortBy:t.model.LicenseSortList[1].Key;t.model.LicenseCriteria.SortBy=i.SortBy;break;case this.inspectionModule:i.FilterModule=t.inspectionModule;i.SortBy=n?t.model.InspectionCriteria.SortBy:t.model.InspectionSortList[1].Key;t.model.InspectionCriteria.SortBy=i.SortBy;break;case this.codeCaseModule:i.FilterModule=t.filterCodeCaseModule;i.SortBy=n?t.model.CodeCaseCriteria.SortBy:t.model.CodeCaseSortList[1].Key;t.model.CodeCaseCriteria.SortBy=i.SortBy;break;case this.requestModule:i.FilterModule=t.requestModule;i.SortBy=n?t.model.RequestCriteria.SortBy:t.model.RequestSortList[1].Key;t.model.RequestCriteria.SortBy=i.SortBy;break;case this.projectModule:i.FilterModule=t.filterProjectModule;i.SortBy=n?t.model.ProjectCriteria.SortBy:t.model.ProjectSortList[1].Key;t.model.ProjectCriteria.SortBy=i.SortBy}return i.SearchModule=t.allModule,i},t}(app.Core.Controllers.CoreController);t.EnerGovSearchController=o})(i=t.Controllers||(t.Controllers={}))})(t=n.Search||(n.Search={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){"use strict";var t=n.Services.EnerGovSearchService,i=n.Controllers.EnerGovSearchController;angular.module("enerGov.Search",["app.Common.Services"]).service("enerGovSearchService",["http","enerGovPermitService","enerGovPlanService","enerGovInspectionService","enerGovCodeCaseService","enerGovRequestsService","enerGovLicenseService",t]).controller("enerGovSearchController",["enerGovSearchService","$window","$location","enerGovCommonForExportService","enerGovSettingsService","tenantService","globalsService","userService","$timeout","queryStringService","menuService",i])})(t=n.Search||(n.Search={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){var i;(function(t){"use strict";var i=app.Common.SelfServiceModules,r=app.Common.SearchModule,u=function(){function t(t,i){this.resourceService=t;this.http=i;this.GlobalSearchExportConstant=n.Dashboard.Constants.GlobalSearchExportConstant;this.MapRecordsExportConstant=n.Dashboard.Constants.MapRecordsExportConstant}return t.prototype.getArray=function(n,t){var f,r,e,i,u;for(t===void 0&&(t=[]),f="",r=0;r<n.length;r++){if(e="",i="",t!==[]&&t.length!==0)for(u in t)i!==""&&(i+=","),i+=n[r][t[u]];else for(u in n[r])i!==""&&(i+=","),i+=n[r][u];f+=i+"\r\n"}return f},t.prototype.getHeader=function(n,t){var f,r,e,i,u;for(t===void 0&&(t=[]),f="",r=0;r<1;r++){if(e="",i="",t!==[]&&t.length!==0)for(u in t)i!==""&&(i+=","),i+=t[u];else for(u in n[r])i!==""&&(i+=","),i+=u;f+=i+"\r\n"}return f},t.prototype.downloadData=function(n,t,i,r,u){r===void 0&&(r=[]);u===void 0&&(u=!0);var f=this,e=angular.copy(n);f.sanitizeJsonObject(e,function(n){var r=n.jsonObject,u,i;r=JSON.stringify(r);u=typeof r!="object"?JSON.parse(r):r;i="";i+=f.getHeader(u,n.columnNameInSequence);i+=f.getArray(u,n.columnNameInSequence);i=i.substring(0,i.length-1);f.download(i,t)},i,r,u)},t.prototype.updateColumnNameAndSequence=function(t,i,r,u,f){f===void 0&&(f=[]);angular.forEach(t,function(u,f){var e=undefined;r==="myplans"?e=n.Dashboard.Constants.PlanExportConstant[f]:r==="mypermits"?e=n.Dashboard.Constants.PermitExportConstant[f]:r==="requestinspections"?e=n.Dashboard.Constants.RequestInspectionsExportConstant[f]:r==="todaysinspection"?e=n.Dashboard.Constants.TodaysInspectionExportConstant[f]:r==="existinginspection"?e=n.Dashboard.Constants.MyExistingInspectionExportConstant[f]:r==="paidinvoice"?e=n.Dashboard.Constants.PaidInvoicesExportConstant[f]:r==="unpaidinvoice"?e=n.Dashboard.Constants.UnPaidInvoicesExportConstant[f]:r==="voidedinvoice"?e=n.Dashboard.Constants.VoidInvoicesExportConstant[f]:r==="myrequests"?e=n.Dashboard.Constants.RequestsExportConstant[f]:r==="mylicenses"?e=n.Dashboard.Constants.MyLicensesExportConstant[f]:r==="submittalitemreview"?e=n.Dashboard.Constants.SubmittalReviewExportConstant[f]:r==="recommendation"?e=n.Dashboard.Constants.SubmittalRecommendationsExportConstant[f]:r==="correction"?e=n.Dashboard.Constants.SubmittalCorrectionsExportConstant[f]:r==="globalsearch"||r==="licenses"?e=n.Dashboard.Constants.GlobalSearchExportConstant[f]:r==="map"&&(e=n.Dashboard.Constants.MapRecordsExportConstant[f]);e!==undefined&&i[e]!==f&&(t[i[e]]=t[f],delete t[f])});r==="globalsearch"&&u==="codecase"&&(t["Opened Date"]=t["Applied Date"],t["Closed Date"]=t["Finalized Date"],delete t["Applied Date"],delete t["Finalized Date"],f!==[]&&f.indexOf("Applied Date")>-1&&(f[f.indexOf("Applied Date")]="Opened Date",f[f.indexOf("Finalized Date")]="Closed Date"));r==="map"&&(t["Record Type"]=t["Module Name"],delete t["Module Name"],f!==[]&&f.indexOf("Module Name")>-1&&(f[f.indexOf("Module Name")]="Record Type"));r==="globalsearch"&&u==="request"&&(t["Date Entered"]=t["Applied Date"],t["Deadline Date"]=t["Expiration Date"],delete t["Applied Date"],delete t["Expiration Date"],f!==[]&&f.indexOf("Applied Date")>-1&&(f[f.indexOf("Applied Date")]="Date Entered",f[f.indexOf("Expiration Date")]="Deadline Date"));(r==="globalsearch"||r==="licenses")&&(u==="businesslicenses"||u==="professionallicenses"||u==="licenses"||u=="operationalpermits")&&(t["Period Start Date"]=t["Issued Date"],delete t["Issued Date"],f!==[]&&f.indexOf("Issued Date")>-1&&(f[f.indexOf("Issued Date")]="Period Start Date"));r==="globalsearch"&&u==="projects"&&(t["Completed Date"]=t["Completion Date"],delete t["Completion Date"],f!==[]&&f.indexOf("Completion Date")>-1&&(f.splice(f.indexOf("Completion Date"),1),f.splice(f.indexOf("Expected End Date")+1,0,"Completed Date")));r==="globalsearch"&&u===""&&(t["Module Name"]==11?(t["Completed Date"]=t["Completion Date"],t["Completion Date"]=""):t["Completed Date"]="",f!==[]&&f.indexOf("Expected End Date")>-1&&f.indexOf("Completed Date")<0&&f.splice(f.indexOf("Expected End Date")+1,0,"Completed Date"))},t.prototype.sanitizeJsonObject=function(t,u,f,e,o){var c=this,a=0,l="",y=!0,w=["Dashboard_Plan_ModuleName","Dashboard_Permit_ModuleName","Dashboard_Inspection_ModuleName","Dashboard_CodeCase","Dashboard_Request_Title","Dashboard_BusinessLicense_ModuleName","Dashboard_ProfessionalLicense_ModuleName","Dashboard_Project_ModuleName","Dashboard_OperationalPermit_ModuleName"],v,h,p,s;f!==undefined&&(f.toLowerCase()==="globalsearch"||f.toLowerCase()==="map")?(angular.forEach(t,function(n){y&&(a===0?a=n.ModuleName:a!==n.ModuleName&&(a=0,y=!1))}),l=a===2?"permits":a===3?"plans":a===4?"inspections":a===5?"codecase":a===6?"request":a===8?"businesslicenses":a===9?"professionallicenses":a===10?"licenses":a===11?"projects":a===12?"operationalpermits":""):l="licenses";v=f.toLowerCase()==="myplans"?n.Dashboard.Constants.PlanExportConstant.ColumnNameInSequence:f.toLowerCase()==="map"?n.Dashboard.Constants.MapRecordsExportConstant.ColumnNameInSequence:f.toLowerCase()==="mypermits"?n.Dashboard.Constants.PermitExportConstant.ColumnNameInSequence:f.toLowerCase()==="requestinspections"?n.Dashboard.Constants.RequestInspectionsExportConstant.ColumnNameInSequence:f.toLowerCase()==="todaysinspection"?n.Dashboard.Constants.TodaysInspectionExportConstant.ColumnNameInSequence:f.toLowerCase()==="existinginspection"?n.Dashboard.Constants.MyExistingInspectionExportConstant.ColumnNameInSequence:f.toLowerCase()==="paidinvoice"?n.Dashboard.Constants.PaidInvoicesExportConstant.ColumnNameInSequence:f.toLowerCase()==="unpaidinvoice"?n.Dashboard.Constants.UnPaidInvoicesExportConstant.ColumnNameInSequence:f.toLowerCase()==="voidedinvoice"?n.Dashboard.Constants.VoidInvoicesExportConstant.ColumnNameInSequence:f.toLowerCase()==="myrequests"?n.Dashboard.Constants.RequestsExportConstant.ColumnNameInSequence:f.toLowerCase()==="mylicenses"?n.Dashboard.Constants.MyLicensesExportConstant.ColumnNameInSequence:f.toLowerCase()==="submittalitemreview"?n.Dashboard.Constants.SubmittalReviewExportConstant.ColumnNameInSequence:f.toLowerCase()==="recommendation"?n.Dashboard.Constants.SubmittalRecommendationsExportConstant.ColumnNameInSequence:f.toLowerCase()==="correction"?n.Dashboard.Constants.SubmittalCorrectionsExportConstant.ColumnNameInSequence:f.toLowerCase()==="globalsearch"?n.Dashboard.Constants.GlobalSearchExportConstant.ColumnNameInSequence:f.toLowerCase()==="licenses"?n.Dashboard.Constants.GlobalSearchExportConstant.ColumnNameInSequence:[];s=[];p=f.toLowerCase()==="mypermits"||f.toLowerCase()==="myplans"||f.toLowerCase()==="existinginspection"||f.toLowerCase()==="myrequests"||f.toLowerCase()==="mylicenses"?"SelfService.EnerGov.Resources.Dashboard.DashboardResource":f.toLowerCase().indexOf("invoice")>=0?"SelfService.EnerGov.Resources.Invoice.InvoiceResource":f.toLowerCase()==="submittalitemreview"||f.toLowerCase()==="recommendation"||f.toLowerCase()==="correction"?n.Dashboard.Constants.SubmittalReviewExportConstant.ResourceFileName:f.toLowerCase()==="globalsearch"||f.toLowerCase()==="licenses"?c.GlobalSearchExportConstant.ResourceFileName:f.toLowerCase()==="map"?n.Dashboard.Constants.MapRecordsExportConstant.ResourceFileName:"SelfService.EnerGov.Resources.Inspection.InspectionResource";c.resourceService.getSpecificKeyValues(p,v,function(n){h=n;h!==undefined&&angular.forEach(v,function(n){h[n]!==undefined&&s.push(h[n])});c.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Dashboard.DashboardResource",w,function(n){angular.forEach(t,function(t){f!==undefined&&f!==""&&(f.toLowerCase()==="myplans"?(delete t.TypeName,delete t.WorkClassName,delete t.StatusName,delete t.ApplyDate,delete t.HasUnpaidFees,delete t.HasFailedInspections,delete t.HasActiveHolds,delete t.StatusSuccessFlag,delete t.StatusHoldFlag,delete t.StatusFailureFlag,delete t.PlanStatusCodes,delete t.PlanStatusReasonCodes,delete t.Address,delete t.MainParcel,delete t.CompleteDate,delete t.ExpireDate,delete t.Description,c.updateColumnNameAndSequence(t,h,f,"")):f.toLowerCase()==="mypermits"?(delete t.PMPermitID,delete t.IssueDate,delete t.ApplyDate,delete t.ExpireDate,delete t.FinalizeDate,delete t.WorkClassName,delete t.SquareFeet,delete t.ValuationValue,delete t.LastInspectionDate,delete t.TypeName,delete t.HasUnpaidFees,delete t.HasFailedInspections,delete t.HasActiveHolds,delete t.StatusHoldFlag,delete t.StatusCompletedFlag,delete t.StatusIssuedFlag,delete t.StatusFailureFlag,delete t.PermitStatusCodes,delete t.PermitStatusReasonCodes,c.updateColumnNameAndSequence(t,h,f,"")):f.toLowerCase()==="myrequests"?(delete t.RequestId,delete t.RequestSource,delete t.Description,delete t.DistrictName,delete t.AssignedUser,delete t.EnteredDate,delete t.DeadLineDate,delete t.CompleteDate,delete t.LayoutId,delete t.IsLoggedIn,delete t.HasAuthorizedContact,c.updateColumnNameAndSequence(t,h,f,"")):f.toLowerCase()==="mylicenses"?(delete t.LicenseId,delete t.ModuleId,c.updateColumnNameAndSequence(t,h,f,"")):f.toLowerCase()==="todaysinspection"?(delete t.InspectionID,delete t.EntityID,delete t.AssignedInspectorFirstName,delete t.AssignedInspectorLastName,delete t.AssignedInspectorMiddleName,c.updateColumnNameAndSequence(t,h,f,"")):f.toLowerCase()==="existinginspection"?(delete t.EntityType,delete t.EntityClass,delete t.InspectionTypeDescription,delete t.PrimaryInspector,delete t.IsReinspectionDisplayText,delete t.IsLoggedIn,delete t.Settings,delete t.Checked,delete t.RequestInspectionErrorMessage,delete t.CanCancelInspection,delete t.CanRequestInspection,delete t.IsCAPOptionalInspection,delete t.CaseTypeIds,delete t.RequestedAMOrPM,c.updateColumnNameAndSequence(t,h,f,"")):f.toLowerCase()==="requestinspections"?(delete t.InspectionTypeDescription,delete t.ActionStepVersionNumber,delete t.IsReinspection,delete t.IsReinspectionDisplayText,delete t.TotalFound,delete t.IsLoggedIn,delete t.EntityClass,delete t.CanRequestInspection,delete t.RequestInspectionErrorMessage,delete t.Settings,delete t.AllowPublicRequests,delete t.IsEntityContact,delete t.ActiveHolds,delete t.Issued,delete t.UnPaidFees,c.updateColumnNameAndSequence(t,h,f,"")):f.toLowerCase()==="paidinvoice"?(delete t.InvoiceDescription,delete t.TotalDue,delete t.StatusName,delete t.Selected,c.updateColumnNameAndSequence(t,h,f,"")):f.toLowerCase()==="unpaidinvoice"?(delete t.InvoiceDescription,delete t.InvoiceTotal,delete t.LastPaidDate,c.updateColumnNameAndSequence(t,h,f,"")):f.toLowerCase()==="voidedinvoice"?(delete t.InvoiceDescription,delete t.InvoiceTotal,delete t.LastPaidDate,delete t.Selected,c.updateColumnNameAndSequence(t,h,f,"")):f.toLowerCase()==="submittalitemreview"?(delete t.ShowComments,delete t.ShowCorrections,delete t.ShowRecommendations,c.updateColumnNameAndSequence(t,h,f,"")):f.toLowerCase()==="map"?(delete t.CaseId,delete t.TypeId,delete t.WorkClassId,delete t.WorkClassName,s.indexOf(h[c.MapRecordsExportConstant.ModuleName])>-1&&s.splice(s.indexOf(h[c.MapRecordsExportConstant.ModuleName]),1),c.updateColumnNameAndSequence(t,h,f,l,s)):f.toLowerCase()==="recommendation"?c.updateColumnNameAndSequence(t,h,f,""):f.toLowerCase()==="correction"?(delete t.CorrectionCategoryName,c.updateColumnNameAndSequence(t,h,f,"")):f.toLowerCase()==="globalsearch"?(delete t.Address,delete t.CaseWorkclass,delete t.HolderFirstName,delete t.HolderMiddleName,delete t.HolderLastName,l===""&&(delete t.LicenseYear,s.indexOf(h[c.GlobalSearchExportConstant.LicenseYear])>-1&&s.splice(s.indexOf(h[c.GlobalSearchExportConstant.LicenseYear]),1),(t.ModuleName==r.BusinessLicense&&e.filter(function(n){return n.Key==i.BusinessLicense})[0].Value===!1||t.ModuleName==r.CodeCase&&e.filter(function(n){return n.Key==i.Code})[0].Value===!1||t.ModuleName==r.Permit&&e.filter(function(n){return n.Key==i.Permit})[0].Value===!1||t.ModuleName==r.Plan&&e.filter(function(n){return n.Key==i.Plan})[0].Value===!1||t.ModuleName==r.ProfessionalLicense&&e.filter(function(n){return n.Key==i.ProfLicense})[0].Value===!1||t.ModuleName==r.Project&&e.filter(function(n){return n.Key==i.Project})[0].Value===!1)&&(t.Description=""),delete t.HolderCompanyName,s.indexOf(h[c.GlobalSearchExportConstant.HolderCompanyName])>-1&&s.splice(s.indexOf(h[c.GlobalSearchExportConstant.HolderCompanyName]),1)),(l!=="businesslicenses"&&l!==""||o===!0)&&(delete t.LicenseYear,delete t.CompanyTypeName,delete t.BusinessTypeName,delete t.OpenedDate,delete t.ClosedDate,delete t.LastAuditDate,delete t.TaxID,delete t.DBA,delete t.CompanyName,s.indexOf(h[c.GlobalSearchExportConstant.CompanyTypeName])>-1&&(s.splice(s.indexOf(h[c.GlobalSearchExportConstant.LicenseYear]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.CompanyTypeName]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.BusinessTypeName]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.OpenedDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.ClosedDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.LastAuditDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.DBA]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.CompanyName]),1))),(l!=="professionallicenses"&&l!==""||o===!0)&&(delete t.HolderCompanyName,s.indexOf(h[c.GlobalSearchExportConstant.HolderCompanyName])>-1&&s.splice(s.indexOf(h[c.GlobalSearchExportConstant.HolderCompanyName]),1)),l==="plans"&&(delete t.IssueDate,delete t.FinalDate,delete t.RequestDate,delete t.ScheduleDate,e.filter(function(n){return n.Key==i.Plan})[0].Value===!1&&delete t.Description,s.indexOf(h[c.GlobalSearchExportConstant.IssueDate])>-1&&(s.splice(s.indexOf(h[c.GlobalSearchExportConstant.IssueDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.FinalDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.RequestDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.ScheduleDate]),1),e.filter(function(n){return n.Key==i.Plan})[0].Value===!1&&s.splice(s.indexOf(h[c.GlobalSearchExportConstant.Description]),1))),l==="permits"&&(delete t.RequestDate,delete t.ScheduleDate,delete t.CompleteDate,e.filter(function(n){return n.Key==i.Permit})[0].Value===!1&&delete t.Description,s.indexOf(h[c.GlobalSearchExportConstant.RequestDate])>-1&&(s.splice(s.indexOf(h[c.GlobalSearchExportConstant.RequestDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.ScheduleDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.CompleteDate]),1),e.filter(function(n){return n.Key==i.Permit})[0].Value===!1&&s.splice(s.indexOf(h[c.GlobalSearchExportConstant.Description]),1))),l==="inspections"&&(delete t.ProjectName,delete t.IssueDate,delete t.ApplyDate,delete t.ExpireDate,delete t.FinalDate,delete t.CompleteDate,delete t.Description,s.indexOf(h[c.GlobalSearchExportConstant.IssueDate])>-1&&(s.splice(s.indexOf(h[c.GlobalSearchExportConstant.ProjectName]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.IssueDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.ApplyDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.ExpireDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.FinalDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.CompleteDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.Description]),1))),l==="codecase"&&(delete t.IssueDate,delete t.ExpireDate,delete t.RequestDate,delete t.ScheduleDate,delete t.CompleteDate,e.filter(function(n){return n.Key==i.Code})[0].Value===!1&&delete t.Description,s.indexOf(h[c.GlobalSearchExportConstant.IssueDate])>-1&&(s.splice(s.indexOf(h[c.GlobalSearchExportConstant.IssueDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.ExpireDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.RequestDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.ScheduleDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.CompleteDate]),1),e.filter(function(n){return n.Key==i.Code})[0].Value===!1&&s.splice(s.indexOf(h[c.GlobalSearchExportConstant.Description]),1))),l!=="projects"&&l!==""&&(delete t.StartDate,delete t.ExpectedEndDate,(t.ModuleName==r.BusinessLicense&&e.filter(function(n){return n.Key==i.BusinessLicense})[0].Value===!1||t.ModuleName==r.CodeCase&&e.filter(function(n){return n.Key==i.Code})[0].Value===!1||t.ModuleName==r.Permit&&e.filter(function(n){return n.Key==i.Permit})[0].Value===!1||t.ModuleName==r.Plan&&e.filter(function(n){return n.Key==i.Plan})[0].Value===!1||t.ModuleName==r.ProfessionalLicense&&e.filter(function(n){return n.Key==i.ProfLicense})[0].Value===!1)&&delete t.Description,s.indexOf(h[c.GlobalSearchExportConstant.StartDate])>-1&&(s.splice(s.indexOf(h[c.GlobalSearchExportConstant.StartDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.ExpectedEndDate]),1),(t.ModuleName==r.BusinessLicense&&e.filter(function(n){return n.Key==i.BusinessLicense})[0].Value===!1||t.ModuleName==r.CodeCase&&e.filter(function(n){return n.Key==i.Code})[0].Value===!1||t.ModuleName==r.Permit&&e.filter(function(n){return n.Key==i.Permit})[0].Value===!1||t.ModuleName==r.Plan&&e.filter(function(n){return n.Key==i.Plan})[0].Value===!1||t.ModuleName==r.ProfessionalLicense&&e.filter(function(n){return n.Key==i.ProfLicense})[0].Value===!1)&&s.splice(s.indexOf(h[c.GlobalSearchExportConstant.Description]),1))),l==="projects"&&(delete t.IssueDate,delete t.ApplyDate,delete t.ExpireDate,delete t.FinalDate,delete t.ScheduleDate,delete t.RequestDate,e.filter(function(n){return n.Key==i.Project})[0].Value===!1&&delete t.Description,s.indexOf(h[c.GlobalSearchExportConstant.IssueDate])>-1&&(s.splice(s.indexOf(h[c.GlobalSearchExportConstant.IssueDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.ExpireDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.RequestDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.ScheduleDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.ApplyDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.FinalDate]),1),e.filter(function(n){return n.Key==i.Project})[0].Value===!1&&s.splice(s.indexOf(h[c.GlobalSearchExportConstant.Description]),1))),l==="request"&&(delete t.IssueDate,delete t.FinalDate,delete t.RequestDate,delete t.ScheduleDate,delete t.Description,s.indexOf(h[c.GlobalSearchExportConstant.IssueDate])>-1&&(s.splice(s.indexOf(h[c.GlobalSearchExportConstant.IssueDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.FinalDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.RequestDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.ScheduleDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.Description]),1))),l==="professionallicenses"&&(delete t.RequestDate,delete t.ScheduleDate,delete t.CompleteDate,e.filter(function(n){return n.Key==i.ProfLicense})[0].Value===!1&&delete t.Description,delete t.FinalDate,delete t.ProjectName,delete t.MainParcel,s.indexOf(h[c.GlobalSearchExportConstant.RequestDate])>-1&&(s.splice(s.indexOf(h[c.GlobalSearchExportConstant.RequestDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.ScheduleDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.CompleteDate]),1),e.filter(function(n){return n.Key==i.ProfLicense})[0].Value===!1&&s.splice(s.indexOf(h[c.GlobalSearchExportConstant.Description]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.FinalDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.ProjectName]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.MainParcel]),1))),l==="businesslicenses"&&(delete t.RequestDate,delete t.ScheduleDate,delete t.CompleteDate,delete t.FinalDate,delete t.ProjectName,delete t.LicenseYear,e.filter(function(n){return n.Key==i.BusinessLicense})[0].Value===!1&&delete t.Description,s.indexOf(h[c.GlobalSearchExportConstant.RequestDate])>-1&&(s.splice(s.indexOf(h[c.GlobalSearchExportConstant.RequestDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.ScheduleDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.CompleteDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.FinalDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.ProjectName]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.LicenseYear]),1),e.filter(function(n){return n.Key==i.BusinessLicense})[0].Value===!1&&s.splice(s.indexOf(h[c.GlobalSearchExportConstant.Description]),1))),c.updateColumnNameAndSequence(t,h,f,l,s)):f.toLowerCase()==="licenses"&&(l==="licenses"&&(delete t.RequestDate,delete t.ScheduleDate,delete t.CompleteDate,delete t.FinalDate,delete t.ProjectName,delete t.LicenseYear,delete t.TaxID,delete t.HolderCompanyName,e.filter(function(n){return n.Key==i.BusinessLicense})[0].Value===!1&&e.filter(function(n){return n.Key==i.ProfLicense})[0].Value===!1&&delete t.Description,s.indexOf(h[c.GlobalSearchExportConstant.RequestDate])>-1&&(s.splice(s.indexOf(h[c.GlobalSearchExportConstant.RequestDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.ScheduleDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.CompleteDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.FinalDate]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.ProjectName]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.LicenseYear]),1),s.splice(s.indexOf(h[c.GlobalSearchExportConstant.HolderCompanyName]),1),e.filter(function(n){return n.Key==i.BusinessLicense})[0].Value===!1&&e.filter(function(n){return n.Key==i.ProfLicense})[0].Value===!1&&s.splice(s.indexOf(h[c.GlobalSearchExportConstant.Description]),1))),c.updateColumnNameAndSequence(t,h,f,l,s)));angular.forEach(t,function(n,i){(n===null||n==="null")&&(n="");i.indexOf("Id",i.length-2)!==-1?delete t[i]:(typeof n=="string"||n instanceof String)&&(i.indexOf("Date")>-1||i.indexOf("Created On")>-1||i.indexOf("Resolved On")>-1?n!==""&&(n=moment(n.toString()).format(app.Constants.GlobalConstants.DateFormat)):i.indexOf("Time")>-1?n!==""&&(n=moment(n.toString()).isValid()?moment(n.toString()).format(app.Constants.GlobalConstants.DateFormatWithTime):n):(n.indexOf('"')>-1||n.indexOf(",")>-1)&&(n=n.split('"').join('""')),n='"'+n+'"',t[i]=n)});var u=h[c.GlobalSearchExportConstant.ModuleName];f==="map"&&(u=h[c.MapRecordsExportConstant.RecordType]);switch(t[u]){case 2:t[u]='"'+n.Dashboard_Permit_ModuleName+'"';break;case 3:t[u]='"'+n.Dashboard_Plan_ModuleName+'"';break;case 4:t[u]='"'+n.Dashboard_Inspection_ModuleName+'"';break;case 5:t[u]='"'+n.Dashboard_CodeCase+'"';break;case 6:t[u]='"'+n.Dashboard_Request_Title+'"';break;case 8:t[u]='"'+n.Dashboard_BusinessLicense_ModuleName+'"';break;case 9:t[u]='"'+n.Dashboard_ProfessionalLicense_ModuleName+'"';break;case 11:t[u]='"'+n.Dashboard_Project_ModuleName+'"';break;case 12:t[u]='"'+n.Dashboard_OperationalPermit_ModuleName+'"'}});u({jsonObject:t,columnNameInSequence:s})})})},t.prototype.download=function(n,t){var r=new Blob([n],{type:"text/csv;charset=utf-8;"}),i;navigator.msSaveBlob?navigator.msSaveBlob(r,t+".csv"):(i=$("<a/>",{style:"display:none",href:"data:application/octet-stream;base64,"+btoa(n.replace(/[^\x00-\x7F]/g,"")),download:t+".csv"}).appendTo("body"),i[0].click(),i.remove())},t.prototype.getCaseLimit=function(n){this.http.get("/energov/dashboard/getcaselimitforexportexcel",function(t){t.Success&&n(t.Result)},!0)},t}();t.EnerGovCommonForExportService=u})(i=t.Services||(t.Services={}))})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=app.Common.SelfServiceModules,i=app.Constants.ViewMenuConstants,r=function(){function n(n,t){this.http=n;this.menuService=t;this.rootUrl="/energov/dashboard/";this.useElastic=!0;this.includeParentRecord=!1}return n.prototype.getInspections=function(n,t){this.http.post(this.rootUrl+"inspections",n,function(n){n.Success&&t(n.Result)},!0)},n.prototype.getLicenses=function(n,t){this.http.get("/energov/dashboard/licenses/"+n,function(n){t(n.Result)})},n.prototype.getDetailInvoices=function(n,t){this.http.post("/energov/invoice/dasboarddetailinvoices",n,function(n){n.Success&&t(n.Result)},!1)},n.prototype.getMyInvoices=function(n){this.http.get(this.rootUrl+"invoices/"+this.useElastic+"/"+this.includeParentRecord,function(t){t.Success&&n(t.Result)},!0)},n.prototype.getPermits=function(n,t){this.http.post(this.rootUrl+"permits",n,function(n){n.Success&&t(n.Result)},!0)},n.prototype.getPermitsWithoutCriteria=function(n){this.http.post(this.rootUrl+"permits",null,function(t){t.Success&&n(t.Result)},!0)},n.prototype.getPlans=function(n,t){this.http.post(this.rootUrl+"plans",n,function(n){n.Success&&t(n.Result)},!0)},n.prototype.getPlansWithoutCriteria=function(n){this.http.post(this.rootUrl+"plans",null,function(t){t.Success&&n(t.Result)},!0)},n.prototype.getLicenseDrafts=function(n){this.http.post(this.rootUrl+"licensedrafts",null,function(t){t.Success&&n(t.Result)},!0)},n.prototype.getMyCaseViewLink=function(n){var r,f,e,s=this.menuService.getMyWorkMenu(),o,u;if(s&&(o=this.menuService.getViewMenu(),o)){switch(n){case t.Permit:r=i.Permit;break;case t.Plan:r=i.Plan;break;case t.BusinessLicense:case t.ProfLicense:r=i.License;break;case t.Cashier:r=i.Invoice;break;case t.Inspection:r=i.Inspection;f="existinginspections"}u=o.SubMenus.filter(function(n){return n.Details.toLowerCase()==r})[0];u&&(e=f?u.SubMenus.filter(function(n){return n.Route.toLowerCase().indexOf(f)>-1})[0]:u.SubMenus.filter(function(n){return n.Details.toLowerCase().indexOf(r)>-1})[0])}return e?"myWork?tab="+encodeURIComponent(e.Label.replace(/ +/g,"")):""},n}();n.EnerGovDashboardService=r})(t=n.Services||(n.Services={}))})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t){this.globalService=n;this.tabNavigatorService=t;this.telerikGridPageNumber=1;this.telerikGridPageSize=2e3}return n.prototype.getTelerikGridOptions=function(){var n=this;return{sortable:{mode:"multiple",allowUnsort:!0},reorderable:!0,resizable:!0,mobile:!0,height:600,navigatable:!0,scrollable:{endless:!0},pageable:{numeric:!1,previousNext:!1,messages:{display:"Showing {2} records."}},filterable:!0,toolbar:[{template:"<span class='k-textbox k-grid-search k-display-flex'><input id='search-bar' autocomplete='off' placeholder='Search...' title='Search...' class='k-input'><span class='k-input-icon'><span class='k-icon k-i-search'><\/span><\/span><\/span>"},"excel"],excel:{fileName:"Excel.xlsx",allPages:!0},dataBound:function(t){var i=t.sender.dataSource.total();t.sender.pager.options.messages.display=i>=n.telerikGridPageSize?"Results limited to "+n.telerikGridPageSize+" records.":"Showing "+i+" records.";t.sender.pager.refresh()}}},n.prototype.getDateOperators=function(){return{eq:"Equal to",neq:"Not equal to",lt:"Before",lte:"Before or equal to",gt:"After",gte:"After or equal to"}},n.prototype.getNumberOperators=function(){return{eq:"Equal to",neq:"Not equal to",lt:"Less",lte:"Less or equal to",gt:"Greater",gte:"Greater or equal to"}},n.prototype.createAttentionReasonLink=function(){var n=this;return function(t){var i,o,f;t.PermitId?(i="permit",o=t.PermitId):t.PlanId&&(i="plan",o=t.PlanId);var r="",s="",u=0,e="#/"+i+"/"+o+"?tab=",h=i==="permit"?t.PermitStatusReasonCodes.length:t.PlanStatusReasonCodes.length;for(f=0;f<h;f++){switch(i==="permit"?t.PermitStatusReasonCodes[f]:t.PlanStatusReasonCodes[f]){case 1:r="<span id ='"+n.globalService.enerGovCommonStatusReasonFail+"' tabindex= '"+u+"'>"+n.globalService.enerGovCommonStatusReasonFail+"<\/span>";break;case 2:r="<span id ='"+n.globalService.enerGovCommonStatusReasonOnHold+"' tabindex='"+u+"'>"+n.globalService.enerGovCommonStatusReasonOnHold+"<\/span>";break;case 3:r="<a class='k-grid-anchor' id ='"+n.globalService.enerGovCommonStatusReasonUnpaidFees+"' tabindex='"+u+"' data-ng-href='"+e+n.tabNavigatorService.tabConstant.Fees+"'>"+n.globalService.enerGovCommonStatusReasonUnpaidFees+"<\/a>";break;case 4:r="<a class='k-grid-anchor' id ='"+n.globalService.enerGovCommonStatusReasonFailedInspections+"' tabindex='"+u+"' data-ng-href='"+e+n.tabNavigatorService.tabConstant.Inspections+"'>"+n.globalService.enerGovCommonStatusReasonFailedInspections+"<\/a>";break;case 5:r="<a class='k-grid-anchor' id ='"+n.globalService.enerGovCommonStatusReasonFailedSubmittals+"' tabindex='"+u+"' data-ng-href='"+e+n.tabNavigatorService.tabConstant.Reviews+"'>"+n.globalService.enerGovCommonStatusReasonFailedSubmittals+"<\/a>";break;case 6:r="<a class='k-grid-anchor' id ='"+n.globalService.enerGovCommonStatusReasonFailedEReviewFiles+"' tabindex='"+u+"' data-ng-href='"+e+n.tabNavigatorService.tabConstant.Attachments+"'>"+n.globalService.enerGovCommonStatusReasonFailedEReviewFiles+"<\/a>"}s+=r+(f===h-1?"":", ")}return i==="permit"?t.PermitStatus.includes("Attention")?"<span class='css-attention-reason-ul'>"+t.PermitStatus+" ("+s+")<\/span>":t.PermitStatus:i==="plan"?t.PlanStatus.includes("Attention")?"<span class='css-attention-reason-ul'>"+t.PlanStatus+" ("+s+")<\/span>":t.PlanStatus:void 0}},n.prototype.getPageable=function(){return{pageSizes:[10,25,50,100],pageSize:10,previousNext:!0,numeric:!0,buttonCount:5,info:!0}},n}();n.EnerGovMyEntityTelerikService=t})(t=n.Services||(n.Services={}))})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/mylicenses/search/"}return n.prototype.searchByCriteria=function(n,t){this.http.post(this.rootUrl,n,function(n){n.Success&&t(n)},!0)},n.prototype.getOperationalPermitDefaultCriteria=function(n){this.http.get(this.rootUrl+"criteria",function(t){t.Success&&n(t)},!0)},n}();n.EnerGovMyOperationalPermitService=t})(t=n.Services||(n.Services={}))})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/myprojects/search/"}return n.prototype.getProjectHasRecords=function(n,t){var r=this,i=this;i.getProjectDefaultCriteria(function(u){var f=u.Result;f.IncludeParentRecords=n;i.http.post(r.rootUrl+"projecthasrecords",f,function(n){n.Success&&t(n.Result)},!0)})},n.prototype.getProjectDefaultCriteria=function(n){this.http.get(this.rootUrl+"criteria",function(t){t.Success&&n(t)},!0)},n.prototype.searchByCriteria=function(n,t){this.http.post(this.rootUrl,n,function(n){n.Success&&t(n)},!0)},n}();n.EnerGovMyProjectService=t})(t=n.Services||(n.Services={}))})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=app.Constants.DraftType,i=function(){function n(n){this.http=n}return n.prototype.searchByCriteria=function(n,t){this.http.post("/template/search",n,function(n){n.Success&&t(n)},!0)},n.prototype.getFilteredSubMenuForTemplateSearch=function(n,i){var r=n.SubMenus.filter(function(n){return n.Details.toLowerCase().indexOf(i.Draft.DraftType.toLowerCase())>-1})[0];return r||i.Draft.DraftType.toLowerCase()!==t.OperationalPermit.toLowerCase()||(r=n.SubMenus.filter(function(n){return n.Details.toLowerCase().indexOf(t.License.toLowerCase())>-1})[0]),r},n}();n.EnerGovMyTemplatesSearchService=i})(t=n.Services||(n.Services={}))})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){var i;(function(t){"use strict";var i=function(){function t(n){this.http=n;this.isInspection=!1;this.caseTypes=[];this.selectedcaseTypes=[]}return t.prototype.changeCaseTypeFilter=function(n){n.criteria!==undefined&&n.criteria!==null&&(n.criteria.CaseTypeIds=n.caseTypeFilterService.selectedcaseTypes.map(function(n){return{CaseTypeId:n.CaseTypeId,WorkClassId:n.WorkClassId}}),n.criteria.PageNumber=1,n.searchCriteria=n.criteria,n.search(n.searchCriteria,app.Events.SearchEvents.SearchCompleted))},t.prototype.addCaseTypeFilterFromUrl=function(n,t,i){i&&i.CaseTypeIds.push({CaseTypeId:n,WorkClassId:t})},t.prototype.getSpecifiedCaseTypes=function(t,i){var r="";switch(t){case n.Search.Controllers.SearchModule.Permit:r="/energov/mypermits/search/permitTypes";break;case n.Search.Controllers.SearchModule.Plan:r="/energov/myplans/search/planTypes";break;case n.Search.Controllers.SearchModule.Inspection:r="/energov/dashboard/my/existinginspections/inspectionTypes"}this.http.get(r,function(n){n.Success&&i(n)},!0)},t}();t.EnergovMyViewsCaseTypeFilterService=i})(i=t.Services||(t.Services={}))})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/mybusinesses/search/"}return n.prototype.searchByCriteria=function(n,t){this.http.post(this.rootUrl,n,function(n){n.Success&&t(n)},!0)},n.prototype.getViewMyBusinessesDefaultCriteria=function(n){this.http.get(this.rootUrl+"criteria",function(t){t.Success&&n(t)},!0)},n}();n.EnerGovViewMyBusinessesSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n}return n.prototype.searchByCriteria=function(n,t){this.http.post("/draft/search",n,function(n){n.Success&&t(n)},!0)},n}();n.EnerGovViewMyDraftsSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){var i;(function(t){"use strict";var i=function(){function t(n,t,i,r,u,f,e,o,s,h,c,l,a,v){this.http=n;this.$routeParams=t;this.$location=i;this.globalService=r;this.entitySecondaryDataService=u;this.caseTypeFilterService=f;this.enerGovViewMyPermitsSearchService=e;this.enerGovViewMyPlansSearchService=o;this.enerGovViewMyLicensesSearchService=s;this.enerGovInspectionService=h;this.myRemainingInspectionService=c;this.enerGovViewMyExistingInspectionsSearchService=l;this.enerGovViewMyRequestsSearchService=a;this.enerGovInvoiceSecondaryDataService=v;this.openAdditionalFilter=!1;var y=this}return t.prototype.getViewMyPermitsDetailCriteria=function(n){var t=this;t.openAdditionalFilter=!1;t.caseTypeFilterService.isInspection=!1;t.entitySecondaryDataService.getEntityRecordSortSecondaryData(function(i){t.sortList=i.Result.ViewMyPermitsSearchSortList;var r=i.Result.ViewMyPermitsSearchSortList[1].Value;t.statusFilterList=i.Result.ViewMyPermitsSearchFilterList;t.statusFilter=i.Result.ViewMyPermitsSearchFilterList[1].Value;t.dateFilterFieldList=i.Result.ViewMyPermitsDateFilterFieldList;t.dateFilterField=i.Result.ViewMyPermitsDateFilterFieldList[3].Value;t.durationFilterList=i.Result.ViewMyPermitsDurationFilterList;t.durationFilter=i.Result.ViewMyPermitsDurationFilterList[0].Value;t.enerGovViewMyPermitsSearchService.getViewMyPermitsDefaultCriteria(function(i){t.criteria=i.Result;t.criteria.PageSize=t.globalService.pageSizeList[0].Value;t.criteria.PageNumber=1;t.criteria.SortField=r;t.criteria.IsSortedInAscendingOrder=!0;(t.criteria.CaseTypeIds===null||t.criteria.CaseTypeIds===undefined)&&(t.criteria.CaseTypeIds=[]);n(t.criteria)})})},t.prototype.getViewMyPlansDetailCriteria=function(n){var t=this;t.caseTypeFilterService.isInspection=!1;t.entitySecondaryDataService.getEntityRecordSortSecondaryData(function(i){t.sortList=i.Result.ViewMyPlansSearchSortList;var r=i.Result.ViewMyPlansSearchSortList[1].Value;t.statusFilterList=i.Result.ViewMyPlansSearchFilterList;t.statusFilter=i.Result.ViewMyPlansSearchFilterList[1].Value;t.dateFilterFieldList=i.Result.ViewMyPlansDateFilterFieldList;t.dateFilterField=i.Result.ViewMyPlansDateFilterFieldList[3].Value;t.durationFilterList=i.Result.ViewMyPlansDurationFilterList;t.durationFilter=i.Result.ViewMyPlansDurationFilterList[0].Value;t.enerGovViewMyPlansSearchService.getViewMyPlansDefaultCriteria(function(i){t.criteria=i.Result;t.criteria.PageSize=t.globalService.pageSizeList[0].Value;t.criteria.PageNumber=1;t.criteria.SortField=r;t.criteria.IsSortedInAscendingOrder=!0;t.criteria.IsSortedInAscendingOrder=!0;(t.criteria.CaseTypeIds===null||t.criteria.CaseTypeIds===undefined)&&(t.criteria.CaseTypeIds=[]);n(t.criteria)})})},t.prototype.getViewMyLicensesDetailCriteria=function(n){var t=this;t.entitySecondaryDataService.getEntityRecordSortSecondaryData(function(i){t.sortList=i.Result.ViewMyLicensesSearchSortList;var r=i.Result.ViewMyLicensesSearchSortList[1].Value;t.enerGovViewMyLicensesSearchService.getViewMyLicensesDefaultCriteria(function(i){t.criteria=i.Result;t.criteria.PageSize=t.globalService.pageSizeList[0].Value;t.criteria.PageNumber=1;t.criteria.SortField=r;t.criteria.IsSortedInAscendingOrder=!0;n(t.criteria)})})},t.prototype.getViewMyRemainingInspectionsDetailCriteria=function(n){var t=this;t.enerGovInspectionService.getInspectionSettings(function(i){t.myRemainingInspectionService.inspectionSettings=i;t.entitySecondaryDataService.getEntityRecordSortSecondaryData(function(i){t.sortList=i.Result.EntityMyRemainingInspectionsSortList;var r=i.Result.EntityMyRemainingInspectionsSortList[1].Value;t.criteria={Keyword:"",ExactMatch:!1,IsSortedInAscendingOrder:!0,PageNumber:1,PageSize:t.globalService.pageSizeList[0].Value,SortField:r,ModuleId:0,EntityId:null,IncludeParentRecords:!1};n(t.criteria)})})},t.prototype.getViewMyExistingInspectionsDetailCriteria=function(t){var i=this;i.caseTypeFilterService.isInspection=!0;i.entitySecondaryDataService.getEntityRecordSortSecondaryData(function(r){i.sortList=r.Result.MyExistingInspectionsSortList;var u=r.Result.MyExistingInspectionsSortList[1].Value;i.statusFilterList=r.Result.MyExistingInspectionsFilterList;i.statusFilter=r.Result.MyExistingInspectionsFilterList[2].Value;i.enerGovViewMyExistingInspectionsSearchService.getViewMyExistingInspectionsDefaultCriteria(function(r){i.criteria=r.Result;i.criteria.PageSize=i.globalService.pageSizeList[0].Value;i.criteria.PageNumber=1;i.criteria.SortField=u;i.criteria.IsSortedInAscendingOrder=!0;i.criteria.FilterIndex=n.Dashboard.Enums.SelfServiceInspectionGroupType.All;i.criteria.CaseTypeIds===null&&(i.criteria.CaseTypeIds=[]);t(i.criteria)})})},t.prototype.getViewMyRequestsDetailCriteria=function(n){var t=this;t.entitySecondaryDataService.getEntityRecordSortSecondaryData(function(i){t.sortList=i.Result.ViewMyRequestsSearchSortList;var r=i.Result.ViewMyRequestsSearchSortList[1].Value;t.enerGovViewMyRequestsSearchService.getViewMyRequestsDefaultCriteria(function(i){t.criteria=i.Result;t.criteria.PageSize=t.globalService.pageSizeList[0].Value;t.criteria.PageNumber=1;t.criteria.SortField=r;t.criteria.IsSortedInAscendingOrder=!0;t.criteria.FilterIndex=app.Common.SelfServicePermitGroupType.All;n(t.criteria)})})},t.prototype.getViewMyUnpaidInvoicesDetailCriteria=function(n){var t=this;t.enerGovInvoiceSecondaryDataService.getInvoiceSecondaryData(function(i){t.statusFilterList=i.Result.UnpaidInvoiceFilterList;t.statusFilter=i.Result.UnpaidInvoiceFilterList[0].Value;t.sortList=i.Result.UnpaidInvoiceSortList;var r=i.Result.UnpaidInvoiceSortList[1].Value,u={StatusOption:2,PageNumber:1,PageSize:t.globalService.pageSizeList[0].Value,Keyword:"",SortField:r,IsSortedInAscendingOrder:!0,ModuleId:app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(t.$location,t.$routeParams.id),EntityId:t.$routeParams.id,FilterOption:1,ExactMatch:!1,IncludeParentRecords:!1};n(u)})},t.prototype.getViewMyPaidInvoicesDetailCriteria=function(n){var t=this;t.enerGovInvoiceSecondaryDataService.getInvoiceSecondaryData(function(i){var r,u;t.statusFilterList=i.Result.PaidInvoiceFilterList;t.statusFilter=i.Result.PaidInvoiceFilterList[0].Value;t.sortList=i.Result.PaidInvoiceSortList;r=i.Result.PaidInvoiceSortList[1].Value;t.durationFilterList=i.Result.PaidDurationFilterList;t.durationFilter=i.Result.PaidDurationFilterList[1].Value;u={StatusOption:1,PageNumber:1,PageSize:t.globalService.pageSizeList[0].Value,Keyword:"",SortField:r,IsSortedInAscendingOrder:!0,ModuleId:app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(t.$location,t.$routeParams.id),EntityId:t.$routeParams.id,FilterOption:1,ExactMatch:!1,IncludeParentRecords:!1};n(u)})},t.prototype.getViewMyVoidInvoicesDetailCriteria=function(n){var t=this;t.enerGovInvoiceSecondaryDataService.getInvoiceSecondaryData(function(i){t.statusFilterList=i.Result.PaidInvoiceFilterList;t.statusFilter=i.Result.PaidInvoiceFilterList[0].Value;t.sortList=i.Result.UnpaidInvoiceSortList;var r=i.Result.UnpaidInvoiceSortList[1].Value,u={StatusOption:3,PageNumber:1,PageSize:t.globalService.pageSizeList[0].Value,Keyword:"",SortField:r,IsSortedInAscendingOrder:!0,ModuleId:app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(t.$location,t.$routeParams.id),EntityId:t.$routeParams.id,FilterOption:1,ExactMatch:!1,IncludeParentRecords:!1};n(u)})},t}();t.EnerGovViewMyEntityCriteriaService=i})(i=t.Services||(t.Services={}))})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/dashboard/my/existinginspections/"}return n.prototype.searchByCriteria=function(n,t){this.http.post(this.rootUrl,n,function(n){n.Success&&t(n)},!0)},n.prototype.getViewMyExistingInspectionsDefaultCriteria=function(n){this.http.get(this.rootUrl+"criteria",function(t){t.Success&&n(t)},!0)},n}();n.EnerGovViewMyExistingInspectionsSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/mylicenses/search/"}return n.prototype.searchByCriteria=function(n,t){this.http.post(this.rootUrl,n,function(n){n.Success&&t(n)},!0)},n.prototype.getViewMyLicensesDefaultCriteria=function(n){this.http.get(this.rootUrl+"criteria",function(t){t.Success&&n(t)},!0)},n}();n.EnerGovViewMyLicensesSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/mypermits/search/"}return n.prototype.searchByCriteria=function(n,t){this.http.post(this.rootUrl,n,function(n){n.Success&&t(n)},!0)},n.prototype.getViewMyPermitsDefaultCriteria=function(n){this.http.get(this.rootUrl+"criteria",function(t){t.Success&&n(t)},!0)},n}();n.EnerGovViewMyPermitsSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/myplans/search/"}return n.prototype.searchByCriteria=function(n,t){this.http.post(this.rootUrl,n,function(n){n.Success&&t(n)},!0)},n.prototype.getViewMyPlansDefaultCriteria=function(n){this.http.get(this.rootUrl+"criteria",function(t){t.Success&&n(t)},!0)},n}();n.EnerGovViewMyPlansSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/myrequests/search/"}return n.prototype.searchByCriteria=function(n,t){this.http.post(this.rootUrl,n,function(n){n.Success&&t(n)},!0)},n.prototype.getViewMyRequestsDefaultCriteria=function(n){this.http.get(this.rootUrl+"criteria",function(t){t.Success&&n(t)},!0)},n}();n.EnerGovViewMyRequestsSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){var t,i,r,u,f,e;(function(n){n[n.Attention=0]="Attention";n[n.Pending=1]="Pending";n[n.Active=2]="Active";n[n.Draft=3]="Draft";n[n.Recent=4]="Recent";n[n.All=5]="All"})(t=n.SelfServicePlanGroupType||(n.SelfServicePlanGroupType={})),function(n){n[n.Requested=0]="Requested";n[n.Scheduled=1]="Scheduled";n[n.Closed=2]="Closed";n[n.All=3]="All"}(i=n.SelfServiceInspectionGroupType||(n.SelfServiceInspectionGroupType={})),function(n){n[n.Last_120_Days=0]="Last_120_Days";n[n.Last_1_Year=1]="Last_1_Year";n[n.Custom=2]="Custom"}(r=n.SearchDurationEnum||(n.SearchDurationEnum={})),function(n){n[n.Applied=0]="Applied";n[n.Updated=1]="Updated";n[n.Completed=2]="Completed";n[n.Expired=3]="Expired"}(u=n.PlanSearchDateFilterFieldEnum||(n.PlanSearchDateFilterFieldEnum={})),function(n){n[n.Applied=0]="Applied";n[n.Updated=1]="Updated";n[n.Issued=2]="Issued";n[n.Expired=3]="Expired"}(f=n.PermitSearchDateFilterFieldEnum||(n.PermitSearchDateFilterFieldEnum={})),function(n){n[n.Attention=0]="Attention";n[n.Pending=1]="Pending";n[n.Active=2]="Active";n[n.Draft=3]="Draft";n[n.Recent=4]="Recent";n[n.All=5]="All";n[n.AttentionFail=6]="AttentionFail";n[n.AttentionOnHold=7]="AttentionOnHold";n[n.AttentionUnPaidFees=8]="AttentionUnPaidFees";n[n.AttentionFailedInspections=9]="AttentionFailedInspections";n[n.AttentionFailedSubmittals=10]="AttentionFailedSubmittals";n[n.AttentionFailedEReviewFiles=11]="AttentionFailedEReviewFiles"}(e=n.SelfServiceGroupType||(n.SelfServiceGroupType={}))})(t=n.Enums||(n.Enums={}))})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){var p=function(){function n(){}return n.ResourceFileName="SelfService.EnerGov.Resources.Dashboard.DashboardResource",n.PermitNumber="Dashboard_MyPermit_PermitNumber",n.ProjectName="Dashboard_MyCases_Project",n.MainAddress="Dashboard_MyCases_Address",n.PermitType="Dashboard_MyPermit_PermitType",n.PermitStatus="Dashboard_MyCases_CaseStatus",n.Reason="Dashboard_MyCases_CaseReason",n.ColumnNameInSequence=[n.PermitNumber,n.ProjectName,n.MainAddress,n.PermitType,n.PermitStatus,n.Reason],n}(),t,i,r,u,f,e,o,s,h,c,l,a,v,y;n.PermitExportConstant=p;t=function(){function n(){}return n.ResourceFileName="SelfService.EnerGov.Resources.Dashboard.DashboardResource",n.PlanNumber="Dashboard_MyPlan_PlanNumber",n.ProjectName="Dashboard_MyCases_Project",n.MainAddress="Dashboard_MyCases_Address",n.PlanType="Dashboard_MyPlan_PlanType",n.PlanStatus="Dashboard_MyCases_CaseStatus",n.Reason="Dashboard_MyCases_CaseReason",n.ColumnNameInSequence=[n.PlanNumber,n.ProjectName,n.MainAddress,n.PlanType,n.PlanStatus,n.Reason],n}();n.PlanExportConstant=t;i=function(){function n(){}return n.ResourceFileName="SelfService.EnerGov.Resources.Dashboard.DashboardResource",n.InspectionNumber="Dashboard_MyExistingInspections_InspectionNumber",n.InspectionType="Dashboard_MyExistingInspections_Type",n.Address="Dashboard_MyCases_Address",n.InspectionStatus="Dashboard_MyExistingInspections_Status",n.LinkType="Dashboard_MyExistingInspections_LinkType",n.EntityNumber="Dashboard_MyExistingInspections_CaseNumber",n.Reinspection="Dashboard_MyExistingInspections_Reinspection",n.RequestedDate="Dashboard_MyExistingInspections_RequestedDate",n.ScheduledStartDate="Dashboard_MyExistingInspections_ScheduledDate",n.ActualDate="Dashboard_MyExistingInspections_ActualDate",n.ColumnNameInSequence=[n.InspectionNumber,n.InspectionType,n.Address,n.InspectionStatus,n.LinkType,n.EntityNumber,n.Reinspection,n.RequestedDate,n.ScheduledStartDate,n.ActualDate],n}();n.MyExistingInspectionExportConstant=i;r=function(){function n(){}return n.ResourceFileName="SelfService.EnerGov.Resources.Dashboard.DashboardResource",n.RequestNumber="Dashboard_MyRequest_RequestNumber",n.MainAddress="Dashboard_MyCases_Address",n.RequestType="Dashboard_MyRequest_RequestType",n.RequestStatus="Dashboard_MyCases_CaseStatus",n.ProjectName="Dashboard_MyCases_Project",n.ColumnNameInSequence=[n.RequestNumber,n.MainAddress,n.RequestType,n.RequestStatus,n.ProjectName],n}();n.RequestsExportConstant=r;u=function(){function n(){}return n.ResourceFileName="SelfService.EnerGov.Resources.Inspection.InspectionResource",n.EntityNumber="RemainingInspections_CaseNumber",n.Address="RemainingInspections_Address",n.EntityType="RemainingInspections_PermitType",n.InspectionType="RemainingInspections_InspectionType",n.Selected="RemainingInspections_SelectAll",n.ColumnNameInSequence=[n.EntityNumber,n.Address,n.EntityType,n.InspectionType],n}();n.RequestInspectionsExportConstant=u;f=function(){function n(){}return n.ResourceFileName="SelfService.EnerGov.Resources.Inspection.InspectionResource",n.InspectionNumber="TodaysInspections_ViewInspectionHeader",n.CaseNumber="TodaysInspections_EntityNumberHeader",n.CaseType="TodaysInspections_EntityTypeHeader",n.InspectionTypeName="TodaysInspections_InspectionTypeNameHeader",n.Address="TodaysInspections_AddressHeader",n.PrimaryInspectorName="TodaysInspections_PrimaryInspectorNameHeader",n.StartTime="TodaysInspections_StartTimeHeader",n.EndTime="TodaysInspections_EndTimeHeader",n.InspectorPhoneNumber="TodaysInspections_InspectorPhoneNumberHeader",n.InspectionStatusName="TodaysInspections_InspectionStatusNameHeader",n.InspectionOrder="TodaysInspections_InspectionOrderHeader",n.ColumnNameInSequence=[n.InspectionNumber,n.CaseNumber,n.CaseType,n.InspectionTypeName,n.Address,n.PrimaryInspectorName,n.StartTime,n.EndTime,n.InspectorPhoneNumber,n.InspectionStatusName,n.InspectionOrder],n}();n.TodaysInspectionExportConstant=f;e=function(){function n(){}return n.ResourceFileName="SelfService.EnerGov.Resources.Invoice.InvoiceResource",n.InvoiceNumber="MyInvoice_InvoiceNumberColumnHeader",n.InvoiceTotal="MyInvoice_AmountPaidColumnHeader",n.LastPaidDate="MyInvoice_PaymentDateColumnHeader",n.EntityNumber="MyInvoice_CaseNumberHeader",n.FullAddress="MyInvoice_AddressHeader",n.ColumnNameInSequence=[n.InvoiceNumber,n.InvoiceTotal,n.LastPaidDate,n.EntityNumber,n.FullAddress],n}();n.PaidInvoicesExportConstant=e;o=function(){function n(){}return n.ResourceFileName="SelfService.EnerGov.Resources.Invoice.InvoiceResource",n.InvoiceNumber="MyInvoice_InvoiceNumberColumnHeader",n.TotalDue="MyInvoice_AmountDueColumnHeader",n.StatusName="MyInvoice_StatusColumnHeader",n.EntityNumber="MyInvoice_CaseNumberHeader",n.FullAddress="MyInvoice_AddressHeader",n.ColumnNameInSequence=[n.InvoiceNumber,n.TotalDue,n.StatusName,n.EntityNumber,n.FullAddress],n}();n.UnPaidInvoicesExportConstant=o;s=function(){function n(){}return n.ResourceFileName="SelfService.EnerGov.Resources.Invoice.InvoiceResource",n.InvoiceNumber="MyInvoice_InvoiceNumberColumnHeader",n.TotalDue="MyInvoice_AmountDueColumnHeader",n.StatusName="MyInvoice_StatusColumnHeader",n.EntityNumber="MyInvoice_CaseNumberHeader",n.FullAddress="MyInvoice_AddressHeader",n.ColumnNameInSequence=[n.InvoiceNumber,n.TotalDue,n.StatusName,n.EntityNumber,n.FullAddress],n}();n.VoidInvoicesExportConstant=s;h=function(){function n(){}return n.ResourceFileName="SelfService.EnerGov.Resources.Submittal.SubmittalResource",n.TypeName="SubmittalItemReview_CH_Type",n.StatusText="SubmittalItemReview_CH_Status",n.DueDate="SubmittalItemReview_CH_DueDate",n.CompletedDate="SubmittalItemReview_CH_CompletedDate",n.AssignedTo="SubmittalItemReview_CH_AssignedTo",n.Comments="SubmittalItemReviewCommentsHeader",n.ColumnNameInSequence=[n.TypeName,n.StatusText,n.DueDate,n.CompletedDate,n.AssignedTo,n.Comments],n}();n.SubmittalReviewExportConstant=h;c=function(){function n(){}return n.ResourceFileName="SelfService.EnerGov.Resources.Submittal.SubmittalResource",n.RecommendationNumber="ItemReviewRecommendationNumberHeader",n.Recommendation="ItemReviewRecommendationContentHeader",n.CreatedDate="ItemReviewRecommendationCreatedOnHeader",n.ColumnNameInSequence=[n.RecommendationNumber,n.Recommendation,n.CreatedDate],n}();n.SubmittalRecommendationsExportConstant=c;l=function(){function n(){}return n.ResourceFileName="SelfService.EnerGov.Resources.Submittal.SubmittalResource",n.SortOrder="ItemReviewCorrectionOrderHeader",n.CorrectionTypeName="ItemReviewCorrectionTypeHeader",n.IsResolvedText="ItemReviewCorrectionResolvedHeader",n.ResolvedDate="ItemReviewCorrectionResolvedOnHeader",n.Comments="ItemReviewCorrectionCommentsHeader",n.CorrectiveAction="ItemReviewCorrectionCorrectiveActionHeader",n.ColumnNameInSequence=[n.SortOrder,n.CorrectionTypeName,n.IsResolvedText,n.ResolvedDate,n.Comments,n.CorrectiveAction],n}();n.SubmittalCorrectionsExportConstant=l;a=function(){function n(){}return n.ResourceFileName="SelfService.EnerGov.Resources.Map.MapResource",n.CaseNumber="CaseNumber",n.ApplyDate="ApplyDate",n.TypeName="TypeName",n.StatusName="StatusName",n.ModuleName="ModuleName",n.Address="Address",n.Parcel="Parcel",n.RecordType="RecordType",n.ColumnNameInSequence=[n.CaseNumber,n.ApplyDate,n.TypeName,n.StatusName,n.Address,n.Parcel,n.ModuleName,n.RecordType],n}();n.MapRecordsExportConstant=a;v=function(){function n(){}return n.ResourceFileName="SelfService.EnerGov.Resources.Search.SearchResource",n.CaseNumber="GlobalSearch_Export_CaseNumber",n.CaseType="GlobalSearch_TypeLabel",n.CaseStatus="GlobalSearch_StatusLabel",n.ProjectName="GlobalSearch_ProjectNameLabel",n.IssueDate="GlobalSearch_IssuedDateLabel",n.ApplyDate="GlobalSearch_AppliedDateLabel",n.ExpireDate="GlobalSearch_ExpDateLabel",n.CompleteDate="GlobalSearch_CompleteDateLabel",n.FinalDate="GlobalSearch_FinalizedDateLabel",n.RequestDate="GlobalSearch_RequestedDateLabel",n.ScheduleDate="GlobalSearch_ScheduledDateLabel",n.ModuleName="GlobalSearch_Export_ModuleName",n.AddressDisplay="GlobalSearch_AddressLabel",n.MainParcel="GlobalSearch_MainParcelLabel",n.Description="GlobalSearch_DescriptionLabel",n.HolderFirstName="GlobalSearch_FirstNameLabel",n.HolderMiddleName="GlobalSearch_MiddleName",n.HolderLastName="GlobalSearch_LastName",n.HolderCompanyName="GlobalSearch_HolderCompanyName",n.CompanyName="GlobalSearch_CompanyName",n.LicenseYear="GlobalSearch_BusinessLicenseYearLabel",n.CompanyTypeName="GlobalSearch_CompanyTypeLabel",n.BusinessTypeName="GlobalSearch_IndustryClassificationLabel",n.OpenedDate="GlobalSearch_OpenedDateLabel",n.ClosedDate="GlobalSearch_ClosedDateLabel",n.LastAuditDate="GlobalSearch_LastAuditDateLabel",n.DBA="GlobalSearch_DBALabel",n.PeriodStartDate="GlobalSearch_PeriodStartDateLabel",n.StartDate="GlobalSearch_StartDateLabel",n.ExpectedEndDate="GlobalSearch_ExpectedEndDateLabel",n.ColumnNameInSequence=[n.CaseNumber,n.CaseType,n.CaseStatus,n.LicenseYear,n.ProjectName,n.HolderCompanyName,n.IssueDate,n.ApplyDate,n.ExpireDate,n.CompleteDate,n.StartDate,n.ExpectedEndDate,n.FinalDate,n.RequestDate,n.ScheduleDate,n.ModuleName,n.CompanyName,n.CompanyTypeName,n.BusinessTypeName,n.AddressDisplay,n.MainParcel,n.Description,n.OpenedDate,n.ClosedDate,n.LastAuditDate,n.DBA],n}();n.GlobalSearchExportConstant=v;y=function(){function n(){}return n.ResourceFileName="SelfService.EnerGov.Resources.Dashboard.DashboardResource",n.LicenseNumber="Dashboard_MyLicense_LicenseNumber",n.DBA="Dashboard_MyLicense_DBAName",n.MainAddress="Dashboard_MyLicense_MainAddress",n.LicenseStatusName="Dashboard_MyLicense_Status",n.TypeName="Dashboard_MyLicense_Type",n.CompanyName="Dashboard_MyLicense_Company",n.ApplicationDate="Dashboard_MyLicense_ApplicationDate",n.IssuedDate="Dashboard_MyLicense_PeriodStartDate",n.ExpirationDate="Dashboard_MyLicense_ExpirationDate",n.ColumnNameInSequence=[n.LicenseNumber,n.DBA,n.MainAddress,n.LicenseStatusName,n.TypeName,n.CompanyName,n.ApplicationDate,n.IssuedDate,n.ExpirationDate],n}();n.MyLicensesExportConstant=y})(t=n.Constants||(n.Constants={}))})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){this.$scope=t;this.$location=i;this.isBusy=!1;var r=this;r.inspectionCriteria={MaxNumberOfTypes:3,RecentNumberOfDays:5e3,ExcludeFilterModules:[],IncludeParentRecords:!1,HiddenInspectionTypeIDs:[]};r.isBusy=!0;r.$scope.$watch("vm.$scope.$parent.vm.includeParentRecords",function(t){r.inspectionCriteria.IncludeParentRecords=t;n.getInspections(r.inspectionCriteria,function(n){r.model=n;r.isBusy=!1})});r.viewMyInspectionLink=n.getMyCaseViewLink(app.Common.SelfServiceModules.Inspection)}return n.prototype.linkToMyInspection=function(n,t){return t===undefined||t===null?this.viewMyInspectionLink+"&groupIndex="+n:this.viewMyInspectionLink+"&groupIndex="+n+"&caseTypeId="+t},n}();n.EnerGovMyInspectionsController=t})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r,u){var e=this,o,f;this.$scope=n;this.dashboardService=t;this.cartService=i;this.locationService=r;this.tenantService=u;this.pendingAddInvoiceIds=[];this.pendingAddCartItems=[];this.addToCartInProgress=!1;this.showAddedToCartSuccess=!1;this.isTenantUsesTylerPayments=function(){var n=e;e.tenantService.isTylerPaymentsUsed(function(t){n.isTylerPaymentsUsed=t})};this.gotoTylerCart=function(){var n=e;window.location.href=n.gotoCartUrl+"?signin=true"};o=this.locationService.search();this.dashboardService.useElastic=!0;f=this;f.isTenantUsesTylerPayments();this.$scope.$watch("vm.$scope.$parent.vm.includeParentRecords",function(n){f.dashboardService.includeParentRecord=n;f.getInvoices()});f.viewMyInvoiceLink=t.getMyCaseViewLink(app.Common.SelfServiceModules.Cashier)}return n.prototype.getInvoices=function(){var n=this;this.locationService.search();this.dashboardService.getMyInvoices(function(t){n.model=t})},n.prototype.addToCart=function(n,t){var u;if(this.addToCartInProgress=!0,t>0){var r=this,f={DashboardInvoiceOption:n,GlobalEntityId:""},i=r.model.filter(function(t){return t.DueType==n});i!=null&&i.length==1&&i[0].InvoiceIds.length>0&&(u=[],angular.forEach(i[0].InvoiceIds,function(n){u.push(n.InvoiceId)}),this.pendingAddInvoiceIds=u,this.isTylerPaymentsUsed?r.addToTylerCart():r.addCartItems())}else this.addToCartInProgress=!1,this.locationService.url("/mycart")},n.prototype.addToTylerCart=function(){var n=this,t=this.pendingAddInvoiceIds;t!=null&&t.length>0&&n.cartService.addTylerCartItems(t,function(t){t!==null&&(n.cartService.didCallGetTotalItem=!1,n.cartService.updateTotalNumOfItems(),n.cartService.getTylerCartItems(),n.cartService.didCallGetTotalItem=!0,n.showAddedToCartSuccess=!0,n.gotoCartUrl=t.ShoppingCartUrl,n.responseMessage=t.ResponseMessage)})},n.prototype.addCartItems=function(){var n=this;angular.forEach(this.pendingAddInvoiceIds,function(t){var i={CartItemId:-1,CartDirectiveName:"energov-cart",CartData:null,CartDataId:t,UserId:-1,TenantId:-1,SoftwarePackageId:-1,SoftwarePackageName:"",Amount:0,IsNew:!0,IsDeleted:!1};n.pendingAddCartItems.push(i)});this.cartService.addCartItems(this.pendingAddCartItems,function(t){n.addToCartInProgress=!1;t&&(n.cartService.didCallGetTotalItem=!1,n.cartService.updateTotalNumOfItems(),n.cartService.didCallGetTotalItem=!0,n.locationService.url("/mycart"))})},n}();n.EnerGovMyInvoicesController=t})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){this.$scope=n;this.$location=i;this.isBusy=!1;var r=this;r.$scope.$watch("vm.$scope.$parent.vm.includeParentRecords",function(n){var i={IncludeParentRecords:n,MaxNumberOfTypes:3,RecentNumberOfDays:90,UseWorkClass:!1,ApplicationPlanTypeIds:[],IsApplicationSupported:!1};r.isBusy=!0;t.getPermits(i,function(n){r.model=n;r.isBusy=!1})});r.viewMyPermitLink=t.getMyCaseViewLink(app.Common.SelfServiceModules.Permit)}return n.prototype.requestInspection=function(){alert("Request inspection was clicked.")},n.prototype.newPermit=function(){alert("New permit was clicked.")},n.prototype.linkToMyPermit=function(n,t,i,r){return n===app.Common.SelfServicePermitGroupType.Draft?"savedWork?tab=mydrafts&type=permit":t?i?this.viewMyPermitLink+"&groupIndex="+n+"&caseTypeId="+t+"&workClassId="+i+"&typeName="+r:this.viewMyPermitLink+"&groupIndex="+n+"&caseTypeId="+t+"&typeName="+r:this.viewMyPermitLink+"&groupIndex="+n},n}();n.EnerGovMyPermitsController=t})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){"use strict";var r=app.Constants.GlobalConstants,t=app.Common.SelfServiceModules,i=app.Common.Helpers.VersionSupport,u=function(){function n(n,u,f,e,o){this.enerGovSettingsService=u;this.$scope=f;this.$location=e;this.globalService=o;this.isBusy=!1;this.hideLicenseFeature=!1;var s=this;s.isBusy=!0;s.enerGovSettingsService.getSoftwareSetting("energov","HideAllLicense",function(t){s.hideLicenseFeature=t.SettingValue==="true"?!0:!1;s.hideLicenseFeature||s.$scope.$watch("vm.$scope.$parent.vm.includeParentRecords",function(t){n.getLicenses(t,function(n){angular.forEach(n,function(n){i(s.globalService.enerGovAPIVersion,"2017.4.0.26")||(n.AllowRenewInfo.ShowRenewButton=!1);n.StringIssueDate=moment(n.IssuedDate).format(r.DateFormat)});s.model=n;s.isBusy=!1})})});n.getLicenseDrafts(function(n){s.licenseDrafts=n;s.isBusy=!1});s.viewMyLicenseLink=n.getMyCaseViewLink(t.BusinessLicense)}return n.prototype.linkToLicense=function(n,r,u){if(u){var f,e;if(angular.forEach(this.model,function(t){t.LicenseId==n&&(f=t.TypeId,e=t.WorkClassId)}),r.toLowerCase()==t[t.BusinessLicense].toLowerCase()){if(i(this.globalService.enerGovAPIVersion,"2017.4.0.26"))return"businessLicense/renew/"+n+"/"+f+"/"+e}else return"profLicense/renew/"+n+"/"+f+"/"+e}else return r+"/"+n},n.prototype.linkToMyLicense=function(n){if(n===app.Common.SelfServicePermitGroupType.Draft)return"savedWork?tab=mydrafts&type=license"},n}();n.EnerGovMyLicensesController=u})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){this.$scope=n;this.$location=i;this.isBusy=!1;var r=this;r.$scope.$watch("vm.$scope.$parent.vm.includeParentRecords",function(n){var i={IncludeParentRecords:n,MaxNumberOfTypes:3,RecentNumberOfDays:90,UseWorkClass:!1,ApplicationPlanTypeIds:[],IsApplicationSupported:!1};r.isBusy=!0;t.getPlans(i,function(n){r.model=n;r.isBusy=!1})});r.viewMyPlanLink=t.getMyCaseViewLink(app.Common.SelfServiceModules.Plan)}return n.prototype.requestInspection=function(){alert("Request inspection was clicked.")},n.prototype.newPlan=function(){alert("New plan was clicked.")},n.prototype.linkToMyPlan=function(n,t,i,r){return n===app.Common.SelfServicePermitGroupType.Draft?"savedWork?tab=mydrafts&type=plan":t?i?this.viewMyPlanLink+"&groupIndex="+n+"&caseTypeId="+t+"&workClassId="+i+"&typeName="+r:this.viewMyPlanLink+"&groupIndex="+n+"&caseTypeId="+t+"&typeName="+r:this.viewMyPlanLink+"&groupIndex="+n},n}();n.EnerGovMyPlansController=t})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={}));__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){"use strict";var i=n.Common.CaseTypeUseEnums.MenuActionType,r=function(n){function t(t,i,r,u,f,e,o,s){var h=n.call(this,t,i,r,f,null,!1)||this,c;return h.$routeParams=t,h.$location=i,h.globalService=r,h.$scope=u,h.enerGovMyTemplatesSearchService=f,h.templateService=e,h.entitySecondaryDataService=o,h.menuService=s,h.processing=!1,h.processed=!1,h.isTemplate=!0,c=h,c.applyMenu=c.menuService.getApplyMenu(),o.getEntityRecordSortSecondaryData(function(n){c.sortList=n.Result.ViewMyTemplatesSearchSortList;c.sortField=n.Result.ViewMyTemplatesSearchSortList[0].Value;c.filterList=n.Result.ViewMyDraftsSearchFilterList;c.filterField="ALL";var t={PackageName:"EnerGov",TemplateType:"ALL",PageNumber:1,SortField:c.sortField,IsSortedInAscendingOrder:!0,PageSize:c.globalService.pageSizeList[0].Value,TenantId:c.globalService.tenantId};c.searchCriteria=t;c.search(t,app.Events.SearchEvents.SearchCompleted,function(){c.removeTemplatesWithDeletedWorkClass()})}),h}return __extends(t,n),t.prototype.filterTemplates=function(n){this.searchCriteria.DraftType=n;this.searchCriteria.TemplateType=n;this.search(this.searchCriteria,app.Events.SearchEvents.SearchCompleted)},t.prototype.useTemplate=function(n,t){var r="/"+i.UseTemplate.valueOf();n.indexOf("?")>=0?this.$location.url(n.split("?")[0]+t+r+"?"+n.split("?")[1]):this.$location.url(n+t+r)},t.prototype.updateTemplate=function(n,t){var r="/"+i.UpdateTemplate.valueOf();n.indexOf("?")>=0?this.$location.url(n.split("?")[0]+t+r+"?"+n.split("?")[1]):this.$location.url(n+t+r)},t.prototype.deleteTemplate=function(t){var r=this,i=this;$("#deleteDraftModal").modal("show");$("#deleteDraftModal").find("#selectedDraftId").val(t);i.processed=!1;i.processing=!1;$("#deleteDraftModal").on("hidden.bs.modal",function(t){$(t.target).removeData("bs.modal");n.prototype.goToElement.call(r,"delete-draft-"+$("#deleteDraftModal").find("#selectedDraftId").val())})},t.prototype.confirmDelete=function(){var n=this,t;n.processing=!0;t=parseInt($("#deleteDraftModal").find("#selectedDraftId").val(),10);n.templateService.deleteById(t,function(t){n.processing=!1;n.processed=!0;t==null&&$("#deleteDraftModal").modal("hide")},!0)},t.prototype.reloadGrid=function(){$("#deleteDraftModal").modal("hide");this.search(this.searchCriteria,app.Events.SearchEvents.PageLoadCompleted)},t.prototype.removeTemplatesWithDeletedWorkClass=function(){var n=this;this.searchResult.forEach(function(t){var r=n.enerGovMyTemplatesSearchService.getFilteredSubMenuForTemplateSearch(n.applyMenu,t),i=JSON.parse(t.Draft.DraftData),u=r.SubMenus.filter(function(n){return n.CaseTypeInfo.PackageCaseTypeId==i.TypeId&&(n.CaseTypeInfo.PackageCaseClassId==i.WorkClassId||n.CaseTypeInfo.PackageCaseClassId=="N/A"&&i.WorkClassId==null)})[0];u||n.templateService.deleteById(t.Draft.DraftId,function(){},!0);n.$scope.$$phase||n.$scope.$root.$$phase||n.$scope.$apply()})},t}(app.Common.Controllers.PagedSearchController);t.EnerGovViewMyTemplatesController=r})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f){var e=n.call(this,t,i,r,u,null,!1)||this,o;return e.enerGovViewMyBusinessesSearchService=u,e.changeKeyword=function(){e.searchCriteria.PageNumber=1;e.sortField=e.searchCriteria.Keyword?e.sortList[0].Value:e.sortList[1].Value;e.searchCriteria.SortField=e.sortField;e.search(e.searchCriteria,app.Events.SearchEvents.SearchCompleted)},o=e,f.getEntityRecordSortSecondaryData(function(n){o.sortList=n.Result.ViewMyBusinessesSearchSortList;o.sortField=n.Result.ViewMyBusinessesSearchSortList[0].Value;e.enerGovViewMyBusinessesSearchService.getViewMyBusinessesDefaultCriteria(function(n){o.criteria=n.Result;o.criteria.PageSize=o.globalService.pageSizeList[0].Value;o.criteria.PageNumber=1;o.criteria.SortField=o.sortField;o.criteria.IsSortedInAscendingOrder=!0;o.searchCriteria=o.criteria;o.search(o.criteria,app.Events.SearchEvents.SearchCompleted)})}),e}return __extends(t,n),t.prototype.payNow=function(n){this.$location.path("/business/"+n+"/taxremittance")},t}(app.Common.Controllers.PagedSearchController);n.EnerGovViewMyBusinessesController=t})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={}));__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){"use strict";var i=n.Common.CaseTypeUseEnums.MenuActionType,r=function(n){function t(t,r,u,f,e,o){var s=n.call(this,t,r,u,f,null,!1)||this,h;return s.draftService=e,s.processing=!1,s.processed=!1,s.isTemplate=!1,s.changeStatusFilter=function(n){s.$location.url("savedWork?tab=mydrafts&type="+n.toLowerCase());s.searchCriteria.DraftType=n;s.search(s.searchCriteria,app.Events.SearchEvents.SearchCompleted)},s.resumeDraft=function(n,t){var r="/"+i.Apply;n.indexOf("?")>=0?s.$location.url(n.split("?")[0]+t+r+"?"+n.split("?")[1]):s.$location.url(n+t+r)},s.deleteDraft=function(t){$("#deleteDraftModal").modal("show");$("#deleteDraftModal").find("#selectedDraftId").val(t.toString());s.processed=!1;s.processing=!1;$("#deleteDraftModal").on("hidden.bs.modal",function(t){$(t.target).removeData("bs.modal");n.prototype.goToElement.call(s,"delete-draft-"+$("#deleteDraftModal").find("#selectedDraftId").val())})},s.confirmDelete=function(){var n=s,t;n.processing=!0;t=parseInt($("#deleteDraftModal").find("#selectedDraftId").val(),10);n.draftService.deleteDraftById(t,function(){n.processing=!1;n.processed=!0},!0)},s.reloadGrid=function(){$("#deleteDraftModal").modal("hide");s.search(s.searchCriteria,app.Events.SearchEvents.PageLoadCompleted)},h=s,o.getEntityRecordSortSecondaryData(function(n){var i,t,r;h.sortList=n.Result.ViewMyDraftsSearchSortList;h.sortField=n.Result.ViewMyDraftsSearchSortList[0].Value;h.statusFilterList=n.Result.ViewMyDraftsSearchFilterList;i=s.$location.search();t=i.type?i.type.toUpperCase():"ALL";h.statusFilter=t;h.statusFilter.toLowerCase()!=="all"&&h.statusFilter.toLowerCase()!=="permit"&&h.statusFilter.toLowerCase()!=="plan"&&h.statusFilter.toLowerCase()!=="license"&&h.$location.path("/dashboard");r={PackageName:"EnerGov",DraftType:typeof t!="undefined"&&t!==null?t.toUpperCase():"ALL",PageNumber:1,SortField:"",IsSortedInAscendingOrder:!0,PageSize:h.globalService.pageSizeList[0].Value,TenantId:h.globalService.tenantId};h.searchCriteria=r;h.search(r,app.Events.SearchEvents.SearchCompleted)}),s}return __extends(t,n),t}(app.Common.Controllers.PagedSearchController);t.EnerGovViewMyDraftsController=r})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={}));__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){"use strict";var i=function(t){function i(n,i,r,u,f,e,o,s,h,c,l,a){var v=t.call(this,n,r,u,f,null,!1)||this,y;return v.$routeParams=n,v.$scope=i,v.enerGovViewMyExistingInspectionsSearchService=f,v.enerGovInspectionService=o,v.commonService=s,v.caseTypeFilterService=h,v.resourceService=l,v.enerGovMyEntityTelerikService=a,v.processing=!1,v.processed=!1,v.filename="",v.options="",v.moduleId=0,v.entityId="",v.showHeader=!1,v.expandStatus=!1,v.caseDetail=function(n,t){switch(t){case app.Common.SelfServiceModules.Permit:v.$location.path("/permit/"+n);break;case app.Common.SelfServiceModules.Plan:v.$location.path("/plan/"+n);break;case app.Common.SelfServiceModules.BusinessLicense:v.$location.path("/businessLicense/"+n);break;case app.Common.SelfServiceModules.ProfLicense:v.$location.path("/profLicense/"+n);break;case app.Common.SelfServiceModules.OperationalPermit:v.$location.path("/operationalPermit/"+n)}},v.changeStatusFilter=function(n){v.updateUrl(n);v.searchCriteria.PageNumber=v.enerGovMyEntityTelerikService.telerikGridPageNumber;v.searchCriteria.PageSize=v.enerGovMyEntityTelerikService.telerikGridPageSize;v.searchCriteria.FilterIndex=n;v.isLoading=!0;v.search(v.searchCriteria,app.Events.SearchEvents.SearchCompleted,function(){var n=v.searchResult;v.mainGridOptions.dataSource=v.getDataSource(n);v.isLoading=!1})},v.searchByCriteria=function(){v.searchCriteria.PageNumber=1;v.sortField=v.searchCriteria.Keyword?v.sortList[0].Value:v.sortList[1].Value;v.searchCriteria.SortField=v.sortField;v.search(v.searchCriteria,app.Events.SearchEvents.SearchCompleted)},y=v,y.caseTypeFilterService.isInspection=!0,y.showHeader=y.$location.path()!=="/myWork",y.mainGridOptions=a.getTelerikGridOptions(),y.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Dashboard.DashboardResource",["Dashboard_MyExistingInspections_InspectionNumber","Dashboard_MyExistingInspections_Type","Dashboard_MyCases_Address","Dashboard_MyExistingInspections_Status","Dashboard_MyExistingInspections_LinkType","Dashboard_MyExistingInspections_CaseNumber","Dashboard_MyExistingInspections_Reinspection","Dashboard_MyExistingInspections_RequestedDate","Dashboard_MyExistingInspections_ScheduledDate","Dashboard_MyExistingInspections_ActualDate","Dashboard_MyCases_Filter","Dashboard_MyPermit_State"],function(n){v.inspectionNumberLabel=n.Dashboard_MyExistingInspections_InspectionNumber;v.inspectionTypeLabel=n.Dashboard_MyExistingInspections_Type;v.addressLabel=n.Dashboard_MyCases_Address;v.inspectionStatusLabel=n.Dashboard_MyExistingInspections_Status;v.inspectionLinkTypeLabel=n.Dashboard_MyExistingInspections_LinkType;v.caseNumberLabel=n.Dashboard_MyExistingInspections_CaseNumber;v.reinspectionLabel=n.Dashboard_MyExistingInspections_Reinspection;v.requestDateLabel=n.Dashboard_MyExistingInspections_RequestedDate;v.scheduleDateLabel=n.Dashboard_MyExistingInspections_ScheduledDate;v.actualDateLabel=n.Dashboard_MyExistingInspections_ActualDate;v.dashboardMyCasesFilterLable=n.Dashboard_MyCases_Filter;v.inspectionStateLabel=n.Dashboard_MyPermit_State;var t=y.mainGridOptions.toolbar;t.push({template:'<label class="k-label-margin" for='+v.dashboardMyCasesFilterLable+">"+v.dashboardMyCasesFilterLable+'<\/label><select id="myExistingInspectionsFilterList" name="myExistingInspectionsFilterList" class="k-form-control" ng-model="vm.statusFilter" ng-options="item.Value as item.Key for item in vm.statusFilterList" ng-change="vm.changeStatusFilter(vm.statusFilter)"><\/select>'});y.mainGridOptions.columns=y.getTelerikGridColumns();c.getViewMyExistingInspectionsDetailCriteria(function(n){y.criteria=n;y.statusFilterList=c.statusFilterList;y.statusFilter=c.statusFilter;y.caseTypeFilterService.caseTypes=c.caseTypeFilterService.caseTypes;y.caseTypeFilterService.selectedcaseTypes=c.caseTypeFilterService.selectedcaseTypes;y.$scope.$watch("vm.$scope.$parent.vm.includeParentRecords",function(n){y.searchAndFillGrid(n)})})},!0),v}return __extends(i,t),i.prototype.getCaseLink=function(n,t){switch(t){case app.Common.SelfServiceModules.Permit:return"#/permit/"+n;case app.Common.SelfServiceModules.Plan:return"#/plan/"+n;case app.Common.SelfServiceModules.BusinessLicense:return"#/businessLicense/"+n;case app.Common.SelfServiceModules.ProfLicense:return"#/profLicense/"+n}},i.prototype.updateUrl=function(n){this.$location.search({tab:this.$routeParams.tab,groupIndex:n}).replace()},i.prototype.setExpandStatus=function(){this.expandStatus=!this.expandStatus},i.prototype.fileNameOkClick=function(){var n=this,t=angular.copy(n.searchCriteria);n.filename!==""&&n.filename!==undefined&&($("#FilenameModal.modal.fade.in").modal("hide"),$("div:not(.ng-hide) #button-Export").focus(),t.PageNumber=1,t.PageSize=n.caseLimitForExport,t.SortField=n.sortField,n.options==="default"?n.searchForExport(t,app.Events.SearchEvents.SearchCompleted,function(){n.commonService.downloadData(n.searchResultForExcel,n.filename,"existinginspection");n.filename=""}):(n.commonService.downloadData(n.searchResult,n.filename,"existinginspection"),n.filename=""))},i.prototype.fileNameCancelClick=function(){$("#FilenameModal.modal.fade.in").modal("hide");$("div:not(.ng-hide) #button-Export").focus()},i.prototype.searchAndFillGrid=function(t){var i=this,r;i.isLoading=!0;i.criteria.IncludeParentRecords=t;i.criteria.PageSize=i.enerGovMyEntityTelerikService.telerikGridPageSize;i.criteria.PageNumber=i.enerGovMyEntityTelerikService.telerikGridPageNumber;i.$routeParams.groupIndex?(i.statusFilter=+i.$routeParams.groupIndex,i.criteria.FilterIndex=+i.$routeParams.groupIndex):(i.criteria.FilterIndex=i.statusFilter,i.updateUrl(i.statusFilter));i.searchCriteria=i.criteria;r="";i.search(i.criteria,app.Events.SearchEvents.SearchCompleted,function(){var t=i.searchResult;i.mainGridOptions.dataSource=i.getDataSource(t);i.$routeParams.caseTypeId?i.caseTypeFilterService.getSpecifiedCaseTypes(n.Search.Controllers.SearchModule.Inspection,function(n){var t=i.$routeParams.caseTypeId,u=i.$routeParams.workClassId;r=n.Result.filter(function(n){return n.CaseTypeId==t&&n.WorkClassId==u})[0].CaseTypeName;i.mainGridOptions.dataSource.filter({field:"InspectionType",operator:"eq",value:r});i.isLoading=!1}):i.isLoading=!1})},i.prototype.getDataSource=function(n){return new kendo.data.DataSource({transport:{read:function(t){t.success(n)}},pageSize:20,schema:{model:{fields:{InspectionNumber:{type:"string"},InspectionType:{type:"string"},Address:{type:"string"},InspectionStatus:{type:"string"},LinkType:{type:"string"},StatusName:{type:"string"},EntityNumber:{type:"string"},Reinspection:{type:"string"},RequestedDate:{type:"date"},ScheduledStartDate:{type:"date"},ActualDate:{type:"date"}}},parse:function(n){return $.map(n,function(n){n.RequestedDate!=null&&(n.RequestedDate=kendo.toString(kendo.parseDate(n.RequestedDate),app.Constants.GlobalConstants.DateFormatForSearch));n.ScheduledStartDate!=null&&(n.ScheduledStartDate=kendo.toString(kendo.parseDate(n.ScheduledStartDate),app.Constants.GlobalConstants.DateFormatForSearch));n.ActualDate!=null&&(n.ActualDate=kendo.toString(kendo.parseDate(n.ActualDate),app.Constants.GlobalConstants.DateFormatForSearch))}),n}}})},i.prototype.getTelerikGridColumns=function(){return[{field:"InspectionNumber",title:this.inspectionNumberLabel,width:"160px",filterable:!1,attributes:{id:"inspection-number-#=InspectionNumber#"},template:"<a class='k-grid-anchor' href='\\#/inspectionDetail/inspection/#=InspectionId#'><span>#=InspectionNumber#<\/span><\/a>"},{field:"InspectionType",title:this.inspectionTypeLabel,width:"165px",attributes:{id:"inspection-type-#=InspectionNumber#","class":"wrap-state"},filterable:{extra:!1,operators:{string:{contains:"Contains"}}}},{field:"Address",title:this.addressLabel,width:"120px",filterable:{extra:!1,operators:{string:{contains:"Contains"}}},attributes:{id:"inspection-address-#=InspectionNumber#"}},{field:"StatusName",title:this.inspectionStatusLabel,width:"110px",attributes:{id:"inspection-status-#=InspectionNumber#"},filterable:{multi:!0}},{field:"InspectionStatus",title:this.inspectionStateLabel,width:"110px",attributes:{id:"inspection-state-#=InspectionNumber#"},filterable:{multi:!0}},{field:"EntityNumber",title:this.caseNumberLabel,width:"155px",attributes:{id:"entity-number-#=InspectionNumber#"},filterable:{extra:!1,operators:{string:{contains:"Contains"}}},template:"<div ng-init='address=vm.getCaseLink(dataItem.EntityId, #=ModuleId#)'><a class='k-grid-anchor' ng-href='{{address}}'><span>#=EntityNumber#<\/span><\/a><\/div>"},{field:"RequestedDate",title:this.requestDateLabel,width:"133px",attributes:{id:"request-date-#=InspectionNumber#"},filterable:{ui:function(n){n.kendoDatePicker({format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"})}},format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"},{field:"ScheduledStartDate",title:this.scheduleDateLabel,width:"133px",attributes:{id:"schedule-date-#=InspectionNumber#"},filterable:{ui:function(n){n.kendoDatePicker({format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"})}},format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"},{field:"ActualDate",title:this.actualDateLabel,width:"137px",attributes:{id:"actual-date-#=InspectionNumber#"},filterable:{ui:function(n){n.kendoDatePicker({format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"})}},format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"},{field:"LinkType",title:this.inspectionLinkTypeLabel,width:"130px",attributes:{id:"link-type-#=InspectionNumber#"},filterable:{multi:!0}},{field:"Reinspection",title:this.reinspectionLabel,width:"150px",attributes:{id:"reinspection-#=InspectionNumber#"},filterable:{multi:!0}}]},i}(app.Common.Controllers.PagedSearchController);t.EnerGovViewMyExistingInspectionsController=i})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=app.Common.SelfServiceModules,i=function(n){function i(t,i,r,u,f,e,o,s,h,c){var l=n.call(this,t,r,u,f,null,!1)||this,a;return l.$scope=i,l.enerGovViewMyLicensesSearchService=f,l.commonService=o,l.resourceService=h,l.enerGovMyEntityTelerikService=c,l.filename="",l.options="",l.showHeader=!1,a=l,a.showHeader=a.$location.path()!=="/myWork",a.mainGridOptions=c.getTelerikGridOptions(),a.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Dashboard.DashboardResource",["Dashboard_MyLicense_LicenseNumber","Dashboard_MyLicense_DBAName","Dashboard_MyLicense_MainAddress","Dashboard_MyLicense_Status","Dashboard_MyLicense_Type","Dashboard_MyLicense_Company","Dashboard_MyLicense_ApplicationDate","Dashboard_MyLicense_PeriodStartDate","Dashboard_MyLicense_ExpirationDate","Dashboard_ViewMy_License_RenewText","Dashboard_MyLicense_License_BusinessName_ADA"],function(n){l.licenseNumberLabel=n.Dashboard_MyLicense_LicenseNumber;l.dbaLabel=n.Dashboard_MyLicense_DBAName;l.addressLabel=n.Dashboard_MyLicense_MainAddress;l.statusLabel=n.Dashboard_MyLicense_Status;l.licenseTypeLabel=n.Dashboard_MyLicense_Type;l.companyLabel=n.Dashboard_MyLicense_Company;l.appliedDateLabel=n.Dashboard_MyLicense_ApplicationDate;l.startDateLabel=n.Dashboard_MyLicense_PeriodStartDate;l.expirationDateLabel=n.Dashboard_MyLicense_ExpirationDate;l.renewActionLabel=n.Dashboard_ViewMy_License_RenewText;l.businessNameADALabel=n.Dashboard_MyLicense_License_BusinessName_ADA;a.mainGridOptions.columns=a.getTelerikGridColumns();s.getViewMyLicensesDetailCriteria(function(n){a.criteria=n;a.$scope.$watch("vm.$scope.$parent.vm.includeParentRecords",function(n){a.searchAndFillGrid(n)});i.$on("kendoWidgetCreated",function(){var n=!1;a.kgrid.bind("excelExport",function(t){n?(t.sender.showColumn("AllowRenewData.ShowRenewButton"),n=!1):(t.sender.hideColumn("AllowRenewData.ShowRenewButton"),t.preventDefault(),n=!0,t.sender.saveAsExcel())})})})},!0),l}return __extends(i,n),i.prototype.fileNameOkClick=function(){var n=this,t=angular.copy(this.searchCriteria);n.filename!==""&&n.filename!==undefined&&($("#FilenameModal.modal.fade.in").modal("hide"),t.PageNumber=1,t.PageSize=n.caseLimitForExport,t.SortField=n.sortField,n.options==="default"?n.searchForExport(t,app.Events.SearchEvents.SearchCompleted,function(){n.commonService.downloadData(n.searchResultForExcel,n.filename,"mylicenses");n.filename=""}):(n.commonService.downloadData(n.searchResult,n.filename,"mylicenses"),n.filename=""),$("div:not(.ng-hide) #button-Export").focus())},i.prototype.renew=function(n){n.ModuleId===t.BusinessLicense?this.$location.path("/businessLicense/renew/"+n.LicenseId+"/"+n.LicenseTypeId+"/"+n.LicenseClassId):n.ModuleId===t.OperationalPermit?this.$location.path("/operationalPermit/renew/"+n.LicenseId+"/"+n.LicenseTypeId+"/"+n.LicenseClassId):this.$location.path("/profLicense/renew/"+n.LicenseId+"/"+n.LicenseTypeId+"/"+n.LicenseClassId)},i.prototype.fileNameCancelClick=function(){$("#FilenameModal.modal.fade.in").modal("hide");$("div:not(.ng-hide) #button-Export").focus()},i.prototype.searchAndFillGrid=function(n){var t=this;t.isLoading=!0;t.criteria.IncludeParentRecords=n;t.criteria.PageSize=t.enerGovMyEntityTelerikService.telerikGridPageSize;t.criteria.PageNumber=t.enerGovMyEntityTelerikService.telerikGridPageNumber;t.searchCriteria=t.criteria;t.search(t.criteria,app.Events.SearchEvents.SearchCompleted,function(){var n=t.searchResult;t.mainGridOptions.dataSource=t.getDataSource(n);t.isLoading=!1})},i.prototype.getTelerikGridColumns=function(){var n=this;return[{field:"LicenseNumber",title:n.licenseNumberLabel,width:140,filterable:!1,attributes:{id:"license-number-#=LicenseNumber#"},template:"#if(ModuleId == 8) {#<a class='k-grid-anchor' href='\\#/businessLicense/#=LicenseId#' ><span>#=LicenseNumber#<\/span><\/a>#} else {#<a class='k-grid-anchor' href='\\#/profLicense/#=LicenseId#'><span>#=LicenseNumber#<\/span><\/a>#}#"},{field:"AllowRenewData.ShowRenewButton",title:n.renewActionLabel,filterable:!1,sortable:{compare:function(t,i){return n.isLicenseRenewable(t)===n.isLicenseRenewable(i)?0:n.isLicenseRenewable(t)>n.isLicenseRenewable(i)?1:-1}},width:85,attributes:{id:"renew-action-#=LicenseNumber#"},template:"<div ng-show='dataItem.AllowRenewData.ShowRenewButton && !dataItem.AllowRenewData.HasStopActionHold' ><button id='button-renew-{{dataItem.LicenseId}}' name='button-Renew' class='btn btn-primary css-btn-primary tab-button kendo-grid-renew-action-button' tabindex='0' ng-click=\"vm.renew(dataItem)\"> {{vm.renewActionLabel}} <\/button><\/div>"},{field:"CompanyName",title:n.companyLabel,filterable:{multi:!0,search:!0},sortable:!0,width:130,attributes:{id:"company-name-#=LicenseNumber#"},template:"#if(BusinessId && CompanyName) {#<a class='k-grid-anchor' href='\\#/business/#=BusinessId#' aria-label='{{vm.businessNameADALabel}}'>#=CompanyName#<\/a>#} else {#<div>{{dataItem.CompanyName}}<\/a>#}#"},{field:"DBA",title:n.dbaLabel,width:130,filterable:{multi:!0,search:!0},attributes:{id:"dba-#=LicenseNumber#"}},{field:"MainAddress",title:n.addressLabel,width:200,filterable:{multi:!0,search:!0},attributes:{id:"main-address-#=LicenseNumber#"}},{field:"LicenseStatusName",title:n.statusLabel,width:110,filterable:{multi:!0},attributes:{id:"license-status-name-#=LicenseNumber#"}},{field:"TypeName",title:n.licenseTypeLabel,width:200,attributes:{id:"type-name-#=LicenseNumber#"},filterable:{multi:!0,search:!0}},{field:"ApplicationDate",title:n.appliedDateLabel,width:130,attributes:{id:"application-date-#=LicenseNumber#"},filterable:{ui:function(n){n.kendoDatePicker({format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"})}},format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"},{field:"IssuedDate",title:n.startDateLabel,filterable:{ui:function(n){n.kendoDatePicker({format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"})}},width:145,attributes:{id:"issued-date-#=LicenseNumber#"},format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"},{field:"ExpirationDate",title:n.expirationDateLabel,filterable:{ui:function(n){n.kendoDatePicker({format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"})}},width:165,attributes:{id:"expiration-date-#=LicenseNumber#"},format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"}]},i.prototype.isLicenseRenewable=function(n){return n.AllowRenewData.ShowRenewButton&&!n.AllowRenewData.HasStopActionHold},i.prototype.getDataSource=function(n){return new kendo.data.DataSource({transport:{read:function(t){t.success(n)}},pageSize:20,schema:{model:{fields:{LicenseNumber:{type:"string"},DBA:{type:"string"},Address:{type:"string"},Status:{type:"string"},LicenseType:{type:"string"},Company:{type:"string"},ApplicationDate:{type:"date"},IssuedDate:{type:"date"},ExpirationDate:{type:"date"}}},parse:function(n){return $.map(n,function(n){n.ApplicationDate!=null&&(n.ApplicationDate=kendo.toString(kendo.parseDate(n.ApplicationDate),app.Constants.GlobalConstants.DateFormatForSearch));n.IssuedDate!=null&&(n.IssuedDate=kendo.toString(kendo.parseDate(n.IssuedDate),app.Constants.GlobalConstants.DateFormatForSearch));n.ExpirationDate!=null&&(n.ExpirationDate=kendo.toString(kendo.parseDate(n.ExpirationDate),app.Constants.GlobalConstants.DateFormatForSearch))}),n}}})},i}(app.Common.Controllers.PagedSearchController);n.EnerGovViewMyLicensesController=i})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={}));__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){"use strict";var i=n.Common.CaseTypeUseEnums.BusinessLicenseTypeModule,r=function(n){function t(t,r,u,f,e,o,s,h){var l=n.call(this,t,u,f,s,null,!1)||this,c;return l.$routeParams=t,l.$scope=r,l.resourceService=e,l.enerGovMyEntityTelerikService=o,l.enerGovMyOperationalPermitService=s,l.enerGovSettingsService=h,l.showHeader=!1,l.isHideAllOperationalPermits=!1,c=l,c.showHeader=c.$location.path()!=="/myWork",c.mainGridOptions=o.getTelerikGridOptions(),c.enerGovSettingsService.getSoftwareSetting("energov","HideAllOperationalPermit",function(n){c.isHideAllOperationalPermits=n.SettingValue==="true"?!0:!1}),c.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Dashboard.DashboardResource",["Dashboard_MyOperationalPermit_Number","Dashboard_MyOperationalPermit_Company","Dashboard_MyOperationalPermit_Address","Dashboard_MyOperationalPermit_Status","Dashboard_MyOperationalPermit_Type","Dashboard_MyOperationalPermit_AppliedDate","Dashboard_MyOperationalPermit_ExpirationDate","Dashboard_MyOperationalPermit_RenewText"],function(n){c.numberLabel=n.Dashboard_MyOperationalPermit_Number;c.companyLabel=n.Dashboard_MyOperationalPermit_Company;c.addressLabel=n.Dashboard_MyOperationalPermit_Address;c.statusLabel=n.Dashboard_MyOperationalPermit_Status;c.typeLabel=n.Dashboard_MyOperationalPermit_Type;c.appliedDateLabel=n.Dashboard_MyOperationalPermit_AppliedDate;c.expirationDateLabel=n.Dashboard_MyOperationalPermit_ExpirationDate;c.renewActionLabel=n.Dashboard_MyOperationalPermit_RenewText;c.mainGridOptions.columns=c.getTelerikGridColumns();s.getOperationalPermitDefaultCriteria(function(n){c.criteria=n.Result;c.criteria.IsSortedInAscendingOrder=!0;c.criteria.LicenseTypeModule=i.OperationalPermit;c.criteria.SortField="LicenseNumber";c.$scope.$watch("vm.$scope.$parent.vm.includeParentRecords",function(n){c.searchAndFillGrid(n)})})},!0),l}return __extends(t,n),t.prototype.renew=function(n){this.$location.path("/operationalPermit/renew/"+n.LicenseId+"/"+n.LicenseTypeId+"/"+n.LicenseClassId)},t.prototype.searchAndFillGrid=function(n){var t=this;t.isLoading=!0;t.criteria.IncludeParentRecords=n;t.criteria.PageSize=t.enerGovMyEntityTelerikService.telerikGridPageSize;t.criteria.PageNumber=t.enerGovMyEntityTelerikService.telerikGridPageNumber;t.searchCriteria=t.criteria;t.search(t.criteria,app.Events.SearchEvents.SearchCompleted,function(){var n=t.searchResult;t.mainGridOptions.dataSource=t.getDataSource(n);t.isLoading=!1})},t.prototype.getTelerikGridColumns=function(){var n=this;return[{field:"LicenseNumber",title:n.numberLabel,width:200,filterable:!1,attributes:{id:"license-number-#=LicenseNumber#"},template:"<a class='k-grid-anchor' target='_blank' href='\\#/operationalPermit/#=LicenseId#'><span>#=LicenseNumber#<\/span><\/a>"},{field:"AllowRenewData.ShowRenewButton",title:n.renewActionLabel,filterable:!1,sortable:{compare:function(t,i){return n.isLicenseRenewable(t)===n.isLicenseRenewable(i)?0:n.isLicenseRenewable(t)>n.isLicenseRenewable(i)?1:-1}},width:85,attributes:{id:"renew-action-#=LicenseNumber#"},template:"<div ng-show='dataItem.AllowRenewData.ShowRenewButton && !dataItem.AllowRenewData.HasStopActionHold' ><button id='button-renew-{{dataItem.LicenseId}}' name='button-Renew' class='btn btn-primary css-btn-primary tab-button kendo-grid-renew-action-button' tabindex='0' ng-click=\"vm.renew(dataItem)\"> {{vm.renewActionLabel}} <\/button><\/div>"},{field:"CompanyName",title:n.companyLabel,filterable:{multi:!0,search:!0},sortable:!0,width:200,attributes:{id:"company-name-#=LicenseNumber#"},template:"#if(BusinessId && CompanyName) {#<a class='k-grid-anchor' target='_blank' href='\\#/business/#=BusinessId#'>#=CompanyName#<\/a>#} else {#<div>{{dataItem.CompanyName}}<\/a>#}#"},{field:"MainAddress",title:n.addressLabel,width:200,attributes:{id:"main-address-#=LicenseNumber#"},filterable:{multi:!0,search:!0}},{field:"LicenseStatusName",title:n.statusLabel,width:100,attributes:{id:"license-status-#=LicenseNumber#"},filterable:{multi:!0,search:!0}},{field:"TypeName",title:n.typeLabel,width:200,attributes:{id:"license-type-#=LicenseNumber#"},filterable:{multi:!0,search:!0}},{field:"ApplicationDate",title:n.appliedDateLabel,width:150,attributes:{id:"license-applied-date-#=LicenseNumber#"},filterable:{ui:function(n){n.kendoDatePicker({format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"})}},format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"},{field:"ExpirationDate",title:n.expirationDateLabel,width:150,attributes:{id:"project-expiration-date-#=LicenseNumber#"},filterable:{ui:function(n){n.kendoDatePicker({format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"})}},format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"},]},t.prototype.isLicenseRenewable=function(n){return n.AllowRenewData.ShowRenewButton&&!n.AllowRenewData.HasStopActionHold},t.prototype.getDataSource=function(n){return new kendo.data.DataSource({transport:{read:function(t){t.success(n)}},pageSize:20,schema:{model:{fields:{LicenseNumber:{type:"string"},MainAddress:{type:"string"},LicenseStatusName:{type:"string"},TypeName:{type:"string"},ApplicationDate:{type:"date"},ExpirationDate:{type:"date"}}},parse:function(n){return $.map(n,function(n){n.MainAddress==null&&(n.MainAddress="");n.ApplicationDate!=null&&(n.ApplicationDate=kendo.toString(kendo.parseDate(n.ApplicationDate),app.Constants.GlobalConstants.DateFormatForSearch));n.ExpirationDate!=null&&(n.ExpirationDate=kendo.toString(kendo.parseDate(n.ExpirationDate),app.Constants.GlobalConstants.DateFormatForSearch))}),n}}})},t}(app.Common.Controllers.PagedSearchController);t.EnerGovViewMyOperationalPermitsController=r})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={}));__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){"use strict";var i=function(t){function i(n,i,r,u,f,e,o,s,h,c,l){var a=t.call(this,n,r,u,f,null,!1)||this,v;return a.$routeParams=n,a.$scope=i,a.enerGovViewMyPermitsSearchService=f,a.commonService=o,a.caseTypeFilterService=s,a.resourceService=c,a.enerGovMyEntityTelerikService=l,a.filename="",a.options="",a.showHeader=!1,a.expandStatus=!1,a.startDate="",a.endDate="",a.maxDate=new Date,a.todaysDate=new Date,a.permitDetail=function(n){a.$location.path("/permit/"+n)},a.onFilterChange=function(){var n=a;n.searchCriteria.PageNumber=n.enerGovMyEntityTelerikService.telerikGridPageNumber;n.searchCriteria.PageSize=n.enerGovMyEntityTelerikService.telerikGridPageSize;n.searchCriteria.FilterIndex=n.statusFilter;n.updateUrl(n.statusFilter);n.isLoading=!0;n.search(n.searchCriteria,app.Events.SearchEvents.SearchCompleted,function(){var t=n.searchResult;n.mainGridOptions.dataSource=n.getDataSource(t);n.isLoading=!1;n.$timeout(function(){n.setGridContentHeight()},100,!0)})},a.invalidDateRange=!1,a.changeKeyword=function(){a.searchCriteria.PageNumber=1;a.sortField=a.searchCriteria.Keyword?a.sortList[0].Value:a.sortList[1].Value;a.searchCriteria.SortField=a.sortField;a.search(a.searchCriteria,app.Events.SearchEvents.SearchCompleted)},a.searchByCriteria=function(){a.search(a.searchCriteria,app.Events.SearchEvents.SearchCompleted)},v=a,v.showHeader=v.$location.path()!=="/myWork",v.mainGridOptions=l.getTelerikGridOptions(),v.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Common.CommonResource",["DatePickerPopupFormatString","DatePickerCloseButtonLabel","DatePickerClearButtonLabel","DatePickerTodayButtonLabel","DatePickerValidatorFormatString","DatePickerInvalidDateFormat","StartDateLabel","EndDateLabel","StartDateRequiredErrorMessage","DatePickerInvalidDateRange","EndDateRequiredErrorMessage"],function(n){a.datePickerPopupFormatString=n.DatePickerPopupFormatString;a.datePickerCloseButtonLabel=n.DatePickerCloseButtonLabel;a.datePickerClearButtonLabel=n.DatePickerClearButtonLabel;a.datePickerTodayButtonLabel=n.DatePickerTodayButtonLabel;a.datePickerValidatorFormatString=n.DatePickerValidatorFormatString;a.datePickerInvalidDateFormat=n.DatePickerInvalidDateFormat;a.datePickerInvalidDateRange=n.DatePickerInvalidDateRange;a.startDateLabel=n.StartDateLabel;a.endDateLabel=n.EndDateLabel;a.startDateRequiredErrorMessage=n.StartDateRequiredErrorMessage;a.endDateRequiredErrorMessage=n.EndDateRequiredErrorMessage}),v.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Dashboard.DashboardResource",["Dashboard_MyPermit_PermitNumber","Dashboard_MyCases_Project","Dashboard_MyCases_Address","Dashboard_MyPermit_PermitType","Dashboard_MyCases_CaseStatus","Dashboard_MyCases_CaseReason","Dashboard_MyCases_Filter","Dashboard_MyPermit_State","Dashboard_MyPermit_ApplyDate","Dashboard_MyPermit_ExpiredDate","Dashboard_MyPermit_IssuedDate","Dashboard_MyPermit_LastUpdatedDate","Dashboard_ViewMyRecords_DateFilterField_Label","Dashboard_ViewMyRecords_Duration_Label"],function(n){a.permitNumberLabel=n.Dashboard_MyPermit_PermitNumber;a.projectLabel=n.Dashboard_MyCases_Project;a.addressLabel=n.Dashboard_MyCases_Address;a.permitTypeLabel=n.Dashboard_MyPermit_PermitType;a.permitStatusLabel=n.Dashboard_MyCases_CaseStatus;a.permitStatusReasonLabel=n.Dashboard_MyCases_CaseReason;a.dashboardMyCasesFilterLable=n.Dashboard_MyCases_Filter;a.permitStateLabel=n.Dashboard_MyPermit_State;a.permitApplyDateLabel=n.Dashboard_MyPermit_ApplyDate;a.permitExpiredDateLabel=n.Dashboard_MyPermit_ExpiredDate;a.permitIssuedDateLabel=n.Dashboard_MyPermit_IssuedDate;a.permitLastUpdateddDateLabel=n.Dashboard_MyPermit_LastUpdatedDate;a.dateFilterFieldLabel=n.Dashboard_ViewMyRecords_DateFilterField_Label;a.durationLabel=n.Dashboard_ViewMyRecords_Duration_Label;var t=v.mainGridOptions.toolbar;t.push({template:'<div ng-form="viewMyPermitsForm">\n                                <div style="white-space: nowrap;">\n                                    <label class="k-label-margin" for= '+a.dashboardMyCasesFilterLable+" > "+a.dashboardMyCasesFilterLable+' <\/label>\n                                    <select id="viewMyFilterList" name="viewMyFilterList" class="k-form-control" ng-model="vm.statusFilter" ng-options="item.Value as item.Key for item in vm.statusFilterList" ng-change="vm.onFilterChange(vm.statusFilter)"><\/select>\n\n                                    <div ng-if="vm.isAllStatusFilterSelected()" class="k-header-element"> \n                                        <label class="k-label-margin margin-md-left"> '+a.dateFilterFieldLabel+' <\/label>\n                                        <select id="viewMyDateFilterFieldList" name="viewMyDateFilterFieldList" class="k-form-control" ng-model="vm.dateFilterField" ng-options="item.Value as item.Key for item in vm.dateFilterFieldList" ng-change="vm.onDateFilterFieldChange()"><\/select>\n                                    \n                                        <label class="k-label-margin margin-md-left"> '+a.durationLabel+' <\/label>\n                                        <select id="viewMyDurationFilterList" name="viewMyDurationFilterList" class="k-form-control" ng-model="vm.durationFilter" ng-options="item.Value as item.Key for item in vm.durationFilterList" ng-change="vm.onDurationFilterChange()"><\/select>\n                                    <\/div>\n                                <\/div>\n                                    \n                                <div >\n                                    <div ng-if="vm.isAllStatusFilterSelected()"> \n                                        <div ng-if="vm.isCustomDurationSelected()" class="k-header-date-filter form-horizontal no-padding" style="white-space: nowrap;"> \n                                        \n                                            <label id="startDate" class="control-label date-range-label k-header-element"> {{ vm.startDateLabel }} <\/label>\n                                            <div class="input-group k-header-element" >\n                                                <md-datepicker id="StartDate" name="StartDate"\n                                                                ng-model="vm.startDate" md-placeholder="{{ vm.startDateLabel }}"\n                                                                aria-label="{{ vm.startDateLabel }}"\n                                                                tabindex="@tabindex"\n                                                                required\n                                                                ng-change="vm.validateDatePickerDateRange()"\n                                                                md-hide-icons="triangle"><\/md-datepicker>\n                                                <div class="no-padding text-danger" ng-if="vm.invalidDateRange && viewMyPermitsForm.$valid">{{vm.datePickerInvalidDateRange}}<\/div>\n                                                <div ng-messages="viewMyPermitsForm.StartDate.$error" class="no-padding text-danger" role="alert">\n                                                    <div ng-message="required">{{vm.startDateRequiredErrorMessage}}<\/div>\n                                                    <div ng-message-default>{{vm.datePickerInvalidDateFormat}}<\/div>\n                                                <\/div>\n                                            <\/div>\n\n\n                                            <label id="endDate" class="control-label date-range-label margin-md-left k-header-element"> {{ vm.endDateLabel }} <\/label>\n                                            <div class="input-group k-header-element">\n                                                <md-datepicker id="EndDate" name="EndDate"  \n                                                                ng-model="vm.endDate" md-placeholder="{{ vm.endDateLabel }}"\n                                                                aria-label="{{ vm.endDateLabel }}"\n                                                                tabindex="@tabindex"\n                                                                required\n                                                                ng-change="vm.validateDatePickerDateRange()"\n                                                                md-hide-icons="triangle"><\/md-datepicker>\n                                                <div ng-messages="viewMyPermitsForm.EndDate.$error" class="no-padding text-danger" role="alert">\n                                                    <div ng-message="required">{{vm.endDateRequiredErrorMessage}}<\/div>\n                                                    <div ng-message-default>{{vm.datePickerInvalidDateFormat}}<\/div>\n                                                <\/div>\n                                            <\/div>\n                                        \n                                            <button id="button-Go" class="k-header-btn k-header-element fa fa-search date-search-btn" type="submit" ng-click="vm.onSearchClick()"\n                                                    data-ng-disabled="viewMyPermitsForm.$invalid || vm.invalidDateRange" tabindex="@tabindex"><\/button>\n                                        <\/div>\n                                    <\/div>\n                                <\/div>\n                            <\/div>'});v.mainGridOptions.columns=v.getTelerikGridColumns();h.getViewMyPermitsDetailCriteria(function(n){v.criteria=n;v.statusFilterList=h.statusFilterList;v.statusFilter=v.criteria.FilterIndex;v.dateFilterFieldList=h.dateFilterFieldList;v.dateFilterField=h.dateFilterField;v.durationFilterList=h.durationFilterList;v.durationFilter=h.durationFilter;v.$scope.$watch("vm.$scope.$parent.vm.includeParentRecords",function(n){v.searchAndFillGrid(n)});i.$on("kendoWidgetCreated",function(){var n=!1;v.kgrid.bind("excelExport",function(t){n?(t.sender.showColumn("PermitStatusReasonCodes"),t.sender.hideColumn("Reason"),n=!1):(t.sender.hideColumn("PermitStatusReasonCodes"),t.sender.showColumn("Reason"),t.preventDefault(),n=!0,t.sender.saveAsExcel())})})})},!0),a}return __extends(i,t),i.prototype.setGridContentHeight=function(){var n=this;n.isCustomDurationSelected()?$(".k-grid-content").height(408):$(".k-grid-content").height(452)},i.prototype.updateUrl=function(n){this.$location.search({tab:this.$routeParams.tab,groupIndex:n}).replace()},i.prototype.setExpandStatus=function(){this.expandStatus=!this.expandStatus},i.prototype.fileNameOkClick=function(){var n=this,t=angular.copy(this.searchCriteria);n.filename!==""&&n.filename!==undefined&&($("#FilenameModal.modal.fade.in").modal("hide"),t.PageNumber=1,t.PageSize=n.caseLimitForExport,t.SortField=n.sortField,n.options==="default"?n.searchForExport(t,app.Events.SearchEvents.SearchCompleted,function(){n.commonService.downloadData(n.searchResultForExcel,n.filename,"mypermits");n.filename=""}):(n.commonService.downloadData(n.searchResult,n.filename,"mypermits"),n.filename=""),$("div:not(.ng-hide) #button-Export").focus())},i.prototype.fileNameCancelClick=function(){$("#FilenameModal.modal.fade.in").modal("hide");$("div:not(.ng-hide) #button-Export").focus()},i.prototype.isAllStatusFilterSelected=function(){return this.statusFilter==n.Dashboard.Enums.SelfServiceGroupType.All},i.prototype.isCustomDurationSelected=function(){return this.durationFilter==n.Dashboard.Enums.SearchDurationEnum.Custom},i.prototype.validateDatePickerDateRange=function(){var n=this,t=moment(n.startDate).diff(moment(n.endDate));n.invalidDateRange=isNaN(t)?!1:t>=0},i.prototype.onDurationFilterChange=function(){var n=this;n.isCustomDurationSelected()?$(".k-grid-content").height(408):(n.setDurationFilter(),n.onFilterChange(),$(".k-grid-content").height(452))},i.prototype.onSearchClick=function(){this.setDurationFilter();this.onFilterChange()},i.prototype.onDateFilterFieldChange=function(){this.criteria.dateFilterField=this.dateFilterField;this.onFilterChange()},i.prototype.setDurationFilter=function(){var t=this,i;t.durationFilter==n.Dashboard.Enums.SearchDurationEnum.Custom?(t.criteria.StartDate=moment(t.startDate).startOf("day").local().format(app.Constants.GlobalConstants.DateFormat+" "+app.Constants.GlobalConstants.DateFormatOnlyTime),t.criteria.EndDate=moment(t.endDate).endOf("day").local().format(app.Constants.GlobalConstants.DateFormat+" "+app.Constants.GlobalConstants.DateFormatOnlyTime)):(i=t.durationFilter==n.Dashboard.Enums.SearchDurationEnum.Last_120_Days?120:moment(new Date).isLeapYear()?366:365,t.criteria.StartDate=moment().subtract(i,"days").startOf("day").local().format(app.Constants.GlobalConstants.DateFormat+" "+app.Constants.GlobalConstants.DateFormatOnlyTime),t.criteria.EndDate=moment().endOf("day").local().format(app.Constants.GlobalConstants.DateFormat+" "+app.Constants.GlobalConstants.DateFormatOnlyTime),t.startDate=moment(new Date(t.criteria.StartDate)).local().format(app.Constants.GlobalConstants.DateFormat),t.endDate=moment(new Date(t.criteria.EndDate)).local().format(app.Constants.GlobalConstants.DateFormat))},i.prototype.searchAndFillGrid=function(t){var i=this,r;i.isLoading=!0;i.criteria.IncludeParentRecords=t;i.criteria.PageSize=i.enerGovMyEntityTelerikService.telerikGridPageSize;i.criteria.PageNumber=i.enerGovMyEntityTelerikService.telerikGridPageNumber;i.$routeParams.groupIndex?(i.statusFilter=+i.$routeParams.groupIndex,i.criteria.FilterIndex=+i.$routeParams.groupIndex):i.updateUrl(i.statusFilter);i.setDurationFilter();i.searchCriteria=i.criteria;r="";i.search(i.criteria,app.Events.SearchEvents.SearchCompleted,function(){var t=i.searchResult;i.mainGridOptions.dataSource=i.getDataSource(t);i.$routeParams.caseTypeId?i.caseTypeFilterService.getSpecifiedCaseTypes(n.Search.Controllers.SearchModule.Permit,function(n){var u=i.$routeParams.caseTypeId,f=i.$routeParams.workClassId,e=i.$routeParams.typeName,t;f?(t=n.Result.filter(function(n){return n.CaseTypeId==u&&n.WorkClassId==f}),r=t.length>0?t[0].CaseTypeName:""):(t=n.Result.filter(function(n){return n.CaseTypeId==u&&n.WorkClassId=="N/A"}),r=t.length>0?t[0].CaseTypeName:"");r==""&&(r=e);i.mainGridOptions.dataSource.filter({field:"PermitType",operator:"eq",value:r});i.isLoading=!1}):i.isLoading=!1})},i.prototype.getTelerikGridColumns=function(){var n=this;return[{field:"PermitNumber",title:n.permitNumberLabel,width:200,filterable:!1,attributes:{id:"permit-number-#=PermitNumber#"},template:"#if(IsApplication == true) {#<a class='k-grid-anchor' href='\\#/application/#=PermitId#' ><span>#=PermitNumber#<\/span><\/a>#} else {#<a class='k-grid-anchor' href='\\#/permit/#=PermitId#'><span>#=PermitNumber#<\/span><\/a>#}#"},{field:"ProjectName",title:n.projectLabel,width:200,attributes:{id:"project-name-#=PermitNumber#"},filterable:{multi:!0}},{field:"MainAddress",title:n.addressLabel,width:200,attributes:{id:"main-address-#=PermitNumber#"},filterable:{extra:!1,operators:{string:{contains:"Contains"}}}},{field:"PermitType",title:n.permitTypeLabel,width:200,attributes:{id:"permit-type-#=PermitNumber#","class":"wrap-state"},filterable:{extra:!1,operators:{string:{contains:"Contains"}}}},{field:"StatusName",title:n.permitStatusLabel,width:130,attributes:{id:"permit-status-#=PermitNumber#"},filterable:{multi:!0}},{field:"PermitStatusReasonCodes",title:n.permitStateLabel,filterable:!1,sortable:!1,width:220,attributes:{id:"attention-reason-#=PermitNumber#","class":"wrap-state"},template:n.enerGovMyEntityTelerikService.createAttentionReasonLink()},{field:"ApplyDate",title:n.permitApplyDateLabel,width:130,attributes:{id:"permit-applydate-#=PermitNumber#"},filterable:{ui:function(n){n.kendoDatePicker({format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"})}},format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"},{field:"ExpireDate",title:n.permitExpiredDateLabel,width:130,attributes:{id:"permit-expiredate-#=PermitNumber#"},filterable:{ui:function(n){n.kendoDatePicker({format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"})}},format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"},{field:"IssueDate",title:n.permitIssuedDateLabel,width:130,attributes:{id:"permit-issueddate-#=PermitNumber#"},filterable:{ui:function(n){n.kendoDatePicker({format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"})}},format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"},{field:"LastChangedOn",title:n.permitLastUpdateddDateLabel,width:130,attributes:{id:"permit-lastupdateddate-#=PermitNumber#"},filterable:{ui:function(n){n.kendoDatePicker({format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"})}},format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"},{field:"Reason",title:n.permitStatusReasonLabel,hidden:!0,filterable:!1,sortable:!1}]},i.prototype.getDataSource=function(n){return new kendo.data.DataSource({transport:{read:function(t){t.success(n)}},pageSize:20,schema:{model:{fields:{PermitNumber:{type:"string"},ProjectName:{type:"string"},MainAddress:{type:"string"},PermitType:{type:"string"},StatusName:{type:"string"},ApplyDate:{type:"date"},ExpireDate:{type:"date"},IssueDate:{type:"date"},LastChangedOn:{type:"date"},Reason:{type:"string"}}},parse:function(n){return $.map(n,function(n){n.ApplyDate!=null&&(n.ApplyDate=kendo.toString(kendo.parseDate(n.ApplyDate),app.Constants.GlobalConstants.DateFormatForSearch));n.LastChangedOn!=null&&(n.LastChangedOn=kendo.toString(kendo.parseDate(n.LastChangedOn),app.Constants.GlobalConstants.DateFormatForSearch));n.IssueDate!=null&&(n.IssueDate=kendo.toString(kendo.parseDate(n.IssueDate),app.Constants.GlobalConstants.DateFormatForSearch));n.ExpireDate!=null&&(n.ExpireDate=kendo.toString(kendo.parseDate(n.ExpireDate),app.Constants.GlobalConstants.DateFormatForSearch))}),n}}})},i}(app.Common.Controllers.PagedSearchController);t.EnerGovViewMyPermitsController=i})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={}));__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){"use strict";var i=n.Dashboard.Enums.SearchDurationEnum,r=function(t){function r(n,i,r,u,f,e,o,s,h,c,l){var a=t.call(this,i,r,u,f,null,!1)||this,v;return a.$scope=n,a.$routeParams=i,a.enerGovViewMyPlansSearchService=f,a.entitySecondaryDataService=e,a.commonService=o,a.caseTypeFilterService=s,a.resourceService=c,a.enerGovMyEntityTelerikService=l,a.showHeader=!1,a.expandStatus=!1,a.planDetail=function(n){a.$location.path("/plan/"+n)},a.startDate="",a.endDate="",a.todaysDate=new Date,a.onFilterChange=function(){var n=a;n.searchCriteria.PageNumber=n.enerGovMyEntityTelerikService.telerikGridPageNumber;n.searchCriteria.PageSize=n.enerGovMyEntityTelerikService.telerikGridPageSize;n.searchCriteria.FilterIndex=n.statusFilter;n.updateUrl(n.statusFilter);n.isLoading=!0;n.search(n.criteria,app.Events.SearchEvents.SearchCompleted,function(){var t=n.searchResult;n.mainGridOptions.dataSource=n.getDataSource(t);n.isLoading=!1;n.$timeout(function(){n.setGridContentHeight()},100,!0)})},a.changeKeyword=function(){a.searchCriteria.PageNumber=1;a.sortField=a.searchCriteria.Keyword?a.sortList[0].Value:a.sortList[1].Value;a.searchCriteria.SortField=a.sortField;a.search(a.searchCriteria,app.Events.SearchEvents.SearchCompleted)},a.searchByCriteria=function(){a.search(a.searchCriteria,app.Events.SearchEvents.SearchCompleted)},v=a,v.showHeader=v.$location.path()!=="/myWork",v.mainGridOptions=l.getTelerikGridOptions(),v.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Common.CommonResource",["DatePickerPopupFormatString","DatePickerCloseButtonLabel","DatePickerClearButtonLabel","DatePickerTodayButtonLabel","DatePickerValidatorFormatString","DatePickerInvalidDateFormat","StartDateLabel","EndDateLabel","StartDateRequiredErrorMessage","EndDateRequiredErrorMessage","DatePickerInvalidDateRange"],function(n){a.datePickerPopupFormatString=n.DatePickerPopupFormatString;a.datePickerCloseButtonLabel=n.DatePickerCloseButtonLabel;a.datePickerClearButtonLabel=n.DatePickerClearButtonLabel;a.datePickerTodayButtonLabel=n.DatePickerTodayButtonLabel;a.datePickerValidatorFormatString=n.DatePickerValidatorFormatString;a.datePickerInvalidDateFormat=n.DatePickerInvalidDateFormat;a.datePickerInvalidDateRange=n.DatePickerInvalidDateRange;a.startDateLabel=n.StartDateLabel;a.endDateLabel=n.EndDateLabel;a.startDateRequiredErrorMessage=n.StartDateRequiredErrorMessage;a.endDateRequiredErrorMessage=n.EndDateRequiredErrorMessage}),v.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Dashboard.DashboardResource",["Dashboard_MyPlan_PlanNumber","Dashboard_MyCases_Project","Dashboard_MyCases_Address","Dashboard_MyPlan_PlanType","Dashboard_MyCases_CaseStatus","Dashboard_MyCases_CaseReason","Dashboard_MyCases_Filter","Dashboard_MyPermit_State","Dashboard_MyPermit_ApplyDate","Dashboard_MyPermit_ExpiredDate","Dashboard_MyPlan_CompleteDate","Dashboard_MyPermit_LastUpdatedDate","Dashboard_ViewMyRecords_DateFilterField_Label","Dashboard_ViewMyRecords_Duration_Label"],function(t){a.planNumberLabel=t.Dashboard_MyPlan_PlanNumber;a.projectLabel=t.Dashboard_MyCases_Project;a.addressLabel=t.Dashboard_MyCases_Address;a.planTypeLabel=t.Dashboard_MyPlan_PlanType;a.planStatusLabel=t.Dashboard_MyCases_CaseStatus;a.planStatusReasonLabel=t.Dashboard_MyCases_CaseReason;a.dashboardMyCasesFilterLable=t.Dashboard_MyCases_Filter;a.planStateLabel=t.Dashboard_MyPermit_State;a.planApplyDateLabel=t.Dashboard_MyPermit_ApplyDate;a.planExpiredDateLabel=t.Dashboard_MyPermit_ExpiredDate;a.planCompleteDateLabel=t.Dashboard_MyPlan_CompleteDate;a.planLastUpdateddDateLabel=t.Dashboard_MyPermit_LastUpdatedDate;a.dateFilterFieldLabel=t.Dashboard_ViewMyRecords_DateFilterField_Label;a.durationLabel=t.Dashboard_ViewMyRecords_Duration_Label;var i=v.mainGridOptions.toolbar;i.push({template:'<div ng-form="viewMyPlansForm">\n                                <div style="white-space: nowrap;" class="display-style">\n                                    <div>\n                                        <label class="k-label-margin" for= '+a.dashboardMyCasesFilterLable+" > "+a.dashboardMyCasesFilterLable+' <\/label>\n                                        <select id="viewMyPlanFilterList" name="viewMyPlanFilterList" class="k-form-control" ng-model="vm.statusFilter" ng-options="item.Value as item.Key for item in vm.statusFilterList" ng-change="vm.onFilterChange(vm.statusFilter)"><\/select>\n                                    <\/div>\n\n                                    <div ng-if="vm.isAllStatusFilterSelected()" class="k-header-element"> \n                                        <label class="k-label-margin"> '+a.dateFilterFieldLabel+' <\/label>\n                                        <select id="viewMyPlansDateFilterFieldList" name="viewMyPlansDateFilterFieldList" class="k-form-control" ng-model="vm.dateFilterField" ng-options="item.Value as item.Key for item in vm.dateFilterFieldList" ng-change="vm.onDateFilterFieldChange()"><\/select>\n                                    \n                                        <label class="k-label-margin"> '+a.durationLabel+' <\/label>\n                                        <select id="viewMyPlansDurationFilterList" name="viewMyPlansDurationFilterList" class="k-form-control" ng-model="vm.durationFilter" ng-options="item.Value as item.Key for item in vm.durationFilterList" ng-change="vm.onDurationFilterChange()"><\/select>\n                                    <\/div>\n                                <\/div>\n                                    \n                                <div >\n                                    <div ng-if="vm.isAllStatusFilterSelected()"> \n                                        <div ng-if="vm.isCustomDurationSelected()" class="k-header-date-filter form-horizontal no-padding" style="white-space: nowrap;"> \n                                        \n                                            <label id="startDate" class="control-label date-range-label k-header-element"> {{ vm.startDateLabel }} <\/label>\n                                            <div class="input-group k-header-element" >\n                                                <md-datepicker id="StartDate" name="StartDate"\n                                                                ng-model="vm.startDate" md-placeholder="{{ vm.startDateLabel }}"\n                                                                aria-label="{{ vm.startDateLabel }}"\n                                                                tabindex="@tabindex"\n                                                                required\n                                                                ng-change="vm.validateDatePickerDateRange()"\n                                                                md-hide-icons="triangle"><\/md-datepicker>\n                                                <div class="no-padding text-danger" ng-if="vm.invalidDateRange && viewMyPlansForm.$valid">{{vm.datePickerInvalidDateRange}}<\/div>\n                                                <div ng-messages="viewMyPlansForm.StartDate.$error" class="no-padding text-danger" role="alert">\n                                                    <div ng-message="required">{{vm.startDateRequiredErrorMessage}}<\/div>\n                                                    <div ng-message-default>{{vm.datePickerInvalidDateFormat}}<\/div>\n                                                <\/div>\n                                            <\/div>\n\n                                            <label id="endDate" class="control-label date-range-label margin-md-left k-header-element"> {{ vm.endDateLabel }} <\/label>\n                                            <div class="input-group k-header-element">\n                                                <md-datepicker id="EndDate" name="EndDate"  \n                                                                ng-model="vm.endDate" md-placeholder="{{ vm.endDateLabel }}"\n                                                                aria-label="{{ vm.endDateLabel }}"\n                                                                tabindex="@tabindex"\n                                                                required\n                                                                ng-change="vm.validateDatePickerDateRange()"\n                                                                md-hide-icons="triangle"><\/md-datepicker>\n                                                <div ng-messages="viewMyPlansForm.EndDate.$error" class="no-padding text-danger" role="alert">\n                                                    <div ng-message="required">{{vm.endDateRequiredErrorMessage}}<\/div>\n                                                    <div ng-message-default>{{vm.datePickerInvalidDateFormat}}<\/div>\n                                                <\/div>\n                                            <\/div>\n                                        \n                                            <button id="button-Go" class="fa fa-search date-search-btn k-header-btn k-header-element" type="submit" ng-click="vm.onSearchClick()"\n                                                    data-ng-disabled="viewMyPlansForm.$invalid || vm.invalidDateRange"><\/button>\n                                        <\/div>\n                                    <\/div>\n                                <\/div>\n                            <\/div>'});v.mainGridOptions.columns=v.getTelerikGridColumns();h.getViewMyPlansDetailCriteria(function(t){v.criteria=t;v.statusFilterList=h.statusFilterList;v.statusFilter=v.criteria.FilterIndex;v.dateFilterFieldList=h.dateFilterFieldList;v.dateFilterField=h.dateFilterField;v.durationFilterList=h.durationFilterList;v.durationFilter=h.durationFilter;v.$scope.$watch("vm.$scope.$parent.vm.includeParentRecords",function(n){v.searchAndFillGrid(n)});n.$on("kendoWidgetCreated",function(){var n=!1;v.kgrid.bind("excelExport",function(t){n?(t.sender.showColumn("PlanStatusReasonCodes"),t.sender.hideColumn("Reason"),n=!1):(t.sender.hideColumn("PlanStatusReasonCodes"),t.sender.showColumn("Reason"),t.preventDefault(),n=!0,t.sender.saveAsExcel())})})})},!0),a}return __extends(r,t),r.prototype.setGridContentHeight=function(){var n=this;n.isCustomDurationSelected()?$(".k-grid-content").height(408):$(".k-grid-content").height(452)},r.prototype.updateUrl=function(n){this.$location.search({tab:this.$routeParams.tab,groupIndex:n}).replace()},r.prototype.setExpandStatus=function(){this.expandStatus=!this.expandStatus},r.prototype.fileNameOkClick=function(){var n=this,t=angular.copy(this.searchCriteria);n.filename!==""&&n.filename!==undefined&&($("#FilenameModal.modal.fade.in").modal("hide"),t.PageNumber=1,t.PageSize=n.caseLimitForExport,t.SortField=n.sortField,n.options==="default"?n.searchForExport(t,app.Events.SearchEvents.SearchCompleted,function(){n.commonService.downloadData(n.searchResultForExcel,n.filename,"myplans");n.filename=""}):(n.commonService.downloadData(n.searchResult,n.filename,"myplans"),n.filename=""),$("div:not(.ng-hide) #button-Export").focus())},r.prototype.fileNameCancelClick=function(){$("#FilenameModal.modal.fade.in").modal("hide");$("div:not(.ng-hide) #button-Export").focus()},r.prototype.isAllStatusFilterSelected=function(){return this.statusFilter==n.Dashboard.Enums.SelfServiceGroupType.All},r.prototype.isCustomDurationSelected=function(){return this.durationFilter==n.Dashboard.Enums.SearchDurationEnum.Custom},r.prototype.validateDatePickerDateRange=function(){var n=this,t=moment(n.startDate).diff(moment(n.endDate));n.invalidDateRange=isNaN(t)?!1:t>=0},r.prototype.onDurationFilterChange=function(){var n=this;n.isCustomDurationSelected()?$(".k-grid-content").height(408):(n.setDurationFilter(),n.onFilterChange(),$(".k-grid-content").height(452))},r.prototype.onSearchClick=function(){this.setDurationFilter();this.onFilterChange()},r.prototype.onDateFilterFieldChange=function(){this.criteria.dateFilterField=this.dateFilterField;this.onFilterChange()},r.prototype.setDurationFilter=function(){var n=this,t;n.durationFilter==i.Custom?(n.criteria.StartDate=moment(n.startDate).startOf("day").local().format(app.Constants.GlobalConstants.DateFormat+" "+app.Constants.GlobalConstants.DateFormatOnlyTime),n.criteria.EndDate=moment(n.endDate).endOf("day").local().format(app.Constants.GlobalConstants.DateFormat+" "+app.Constants.GlobalConstants.DateFormatOnlyTime)):(t=n.durationFilter==i.Last_120_Days?120:moment(new Date).isLeapYear()?366:365,n.criteria.StartDate=moment().subtract(t,"days").startOf("day").local().format(app.Constants.GlobalConstants.DateFormat+" "+app.Constants.GlobalConstants.DateFormatOnlyTime),n.criteria.EndDate=moment().endOf("day").local().format(app.Constants.GlobalConstants.DateFormat+" "+app.Constants.GlobalConstants.DateFormatOnlyTime),n.startDate=moment(new Date(n.criteria.StartDate)).local().format(app.Constants.GlobalConstants.DateFormat),n.endDate=moment(new Date(n.criteria.EndDate)).local().format(app.Constants.GlobalConstants.DateFormat))},r.prototype.searchAndFillGrid=function(t){var i=this,r;i.isLoading=!0;i.criteria.IncludeParentRecords=t;i.criteria.PageSize=i.enerGovMyEntityTelerikService.telerikGridPageSize;i.criteria.PageNumber=i.enerGovMyEntityTelerikService.telerikGridPageNumber;i.$routeParams.groupIndex?(i.statusFilter=+i.$routeParams.groupIndex,i.criteria.FilterIndex=+i.$routeParams.groupIndex):i.updateUrl(i.statusFilter);i.setDurationFilter();i.searchCriteria=i.criteria;r="";i.search(i.criteria,app.Events.SearchEvents.SearchCompleted,function(){var t=i.searchResult;i.mainGridOptions.dataSource=i.getDataSource(t);i.$routeParams.caseTypeId?i.caseTypeFilterService.getSpecifiedCaseTypes(n.Search.Controllers.SearchModule.Plan,function(n){var u=i.$routeParams.caseTypeId,f=i.$routeParams.workClassId,e=i.$routeParams.typeName,t;f?(t=n.Result.filter(function(n){return n.CaseTypeId==u&&n.WorkClassId==f}),r=t.length>0?t[0].CaseTypeName:""):(t=n.Result.filter(function(n){return n.CaseTypeId==u&&n.WorkClassId=="N/A"}),r=t.length>0?t[0].CaseTypeName:"");r==""&&(r=e);i.mainGridOptions.dataSource.filter({field:"PlanType",operator:"eq",value:r});i.isLoading=!1}):i.isLoading=!1})},r.prototype.getTelerikGridColumns=function(){var n=this;return[{field:"PlanNumber",title:n.planNumberLabel,width:200,filterable:!1,attributes:{id:"plan-number-#=PlanNumber#"},template:"#if(IsApplication == true) {#<a class='k-grid-anchor' href='\\#/application/#=PlanId#' ><span>#=PlanNumber#<\/span><\/a>#} else {#<a class='k-grid-anchor' href='\\#/plan/#=PlanId#'><span>#=PlanNumber#<\/span><\/a>#}#"},{field:"ProjectName",title:n.projectLabel,width:200,attributes:{id:"project-name-#=PlanNumber#"},filterable:{multi:!0}},{field:"MainAddress",title:n.addressLabel,width:200,attributes:{id:"main-address-#=PlanNumber#"},filterable:{extra:!1,operators:{string:{contains:"Contains"}}}},{field:"PlanType",title:n.planTypeLabel,width:200,attributes:{id:"plan-type-#=PlanNumber#","class":"wrap-state"},filterable:{extra:!1,operators:{string:{contains:"Contains"}}}},{field:"StatusName",title:n.planStatusLabel,width:200,attributes:{id:"plan-status-#=PlanNumber#"},filterable:{multi:!0}},{field:"PlanStatusReasonCodes",title:n.planStateLabel,filterable:!1,sortable:!1,width:220,attributes:{id:"attention-reason-#=PlanNumber#","class":"wrap-state"},template:n.enerGovMyEntityTelerikService.createAttentionReasonLink()},{field:"ApplyDate",title:n.planApplyDateLabel,width:130,attributes:{id:"plan-applydate-#=PlanNumber#"},filterable:{ui:function(n){n.kendoDatePicker({format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"})}},format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"},{field:"ExpireDate",title:n.planExpiredDateLabel,width:130,attributes:{id:"plan-expiredate-#=PlanNumber#"},filterable:{ui:function(n){n.kendoDatePicker({format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"})}},format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"},{field:"CompleteDate",title:n.planCompleteDateLabel,width:130,attributes:{id:"plan-completedate-#=PlanNumber#"},filterable:{ui:function(n){n.kendoDatePicker({format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"})}},format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"},{field:"LastChangedOn",title:n.planLastUpdateddDateLabel,width:130,attributes:{id:"plan-lastupdateddate-#=PlanNumber#"},filterable:{ui:function(n){n.kendoDatePicker({format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"})}},format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"},{field:"Reason",title:n.planStatusReasonLabel,hidden:!0,filterable:!1,sortable:!1}]},r.prototype.getDataSource=function(n){return new kendo.data.DataSource({transport:{read:function(t){t.success(n)}},pageSize:20,schema:{model:{fields:{PlanNumber:{type:"string"},ProjectName:{type:"string"},MainAddress:{type:"string"},PlanType:{type:"string"},PlanStatus:{type:"string"},ApplyDate:{type:"date"},ExpireDate:{type:"date"},CompleteDate:{type:"date"},LastChangedOn:{type:"date"},Reason:{type:"string"}}},parse:function(n){return $.map(n,function(n){n.ApplyDate!=null&&(n.ApplyDate=kendo.toString(kendo.parseDate(n.ApplyDate),app.Constants.GlobalConstants.DateFormatForSearch));n.LastChangedOn!=null&&(n.LastChangedOn=kendo.toString(kendo.parseDate(n.LastChangedOn),app.Constants.GlobalConstants.DateFormatForSearch));n.CompleteDate!=null&&(n.CompleteDate=kendo.toString(kendo.parseDate(n.CompleteDate),app.Constants.GlobalConstants.DateFormatForSearch));n.ExpireDate!=null&&(n.ExpireDate=kendo.toString(kendo.parseDate(n.ExpireDate),app.Constants.GlobalConstants.DateFormatForSearch))}),n}}})},r}(app.Common.Controllers.PagedSearchController);t.EnerGovViewMyPlansController=r})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f,e,o){var h=n.call(this,t,r,u,o,null,!1)||this,s;return h.$routeParams=t,h.$scope=i,h.resourceService=f,h.enerGovMyEntityTelerikService=e,h.enerGovMyProjectService=o,h.showHeader=!1,s=h,s.showHeader=s.$location.path()!=="/myWork",s.mainGridOptions=e.getTelerikGridOptions(),s.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Dashboard.DashboardResource",["Dashboard_MyProject_ProjectNumber","Dashboard_MyProject_ProjectName","Dashboard_MyProject_Status","Dashboard_MyProject_Type","Dashboard_MyProject_StartDate","Dashboard_MyProject_ExpectedEndDate","Dashboard_MyProject_CompletedDate"],function(n){s.projectNumberLabel=n.Dashboard_MyProject_ProjectNumber;s.projectNameLabel=n.Dashboard_MyProject_ProjectName;s.projectStatusLabel=n.Dashboard_MyProject_Status;s.projectTypeLabel=n.Dashboard_MyProject_Type;s.projectStartDateLabel=n.Dashboard_MyProject_StartDate;s.projectExpectedEndDateLabel=n.Dashboard_MyProject_ExpectedEndDate;s.projectCompletedDateLabel=n.Dashboard_MyProject_CompletedDate;s.mainGridOptions.columns=s.getTelerikGridColumns();o.getProjectDefaultCriteria(function(n){s.criteria=n.Result;s.criteria.IsSortedInAscendingOrder=!0;s.$scope.$watch("vm.$scope.$parent.vm.includeParentRecords",function(n){s.searchAndFillGrid(n)})})},!0),h}return __extends(t,n),t.prototype.searchAndFillGrid=function(n){var t=this;t.isLoading=!0;t.criteria.IncludeParentRecords=n;t.criteria.PageSize=t.enerGovMyEntityTelerikService.telerikGridPageSize;t.criteria.PageNumber=t.enerGovMyEntityTelerikService.telerikGridPageNumber;t.searchCriteria=t.criteria;t.search(t.criteria,app.Events.SearchEvents.SearchCompleted,function(){var n=t.searchResult;t.mainGridOptions.dataSource=t.getDataSource(n);t.isLoading=!1})},t.prototype.getTelerikGridColumns=function(){var n=this;return[{field:"ProjectNumber",title:n.projectNumberLabel,width:200,filterable:!1,attributes:{id:"project-number-#=ProjectNumber#"},template:"<a class='k-grid-anchor' href='\\#/project/#=ProjectId#'><span>#=ProjectNumber#<\/span><\/a>"},{field:"ProjectName",title:n.projectNameLabel,width:200,attributes:{id:"project-name-#=ProjectNumber#"},filterable:{multi:!0},template:"<a class='k-grid-anchor' href='\\#/project/#=ProjectId#'><span>#=ProjectName#<\/span><\/a>"},{field:"StatusName",title:n.projectStatusLabel,width:200,attributes:{id:"project-status-#=ProjectNumber#"},filterable:{multi:!0,search:!0}},{field:"TypeName",title:n.projectTypeLabel,width:200,attributes:{id:"project-type-#=ProjectNumber#"},filterable:{multi:!0,search:!0}},{field:"StartDate",title:n.projectStartDateLabel,width:200,attributes:{id:"project-startdate-#=ProjectNumber#"},filterable:{ui:function(n){n.kendoDatePicker({format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"})}},format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"},{field:"ExpectedEndDate",title:n.projectExpectedEndDateLabel,width:130,attributes:{id:"project-ExpectedEndDate-#=ProjectNumber#"},filterable:{ui:function(n){n.kendoDatePicker({format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"})}},format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"},{field:"CompleteDate",title:n.projectCompletedDateLabel,width:130,attributes:{id:"project-CompleteDate-#=ProjectNumber#"},filterable:{ui:function(n){n.kendoDatePicker({format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"})}},format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"}]},t.prototype.getDataSource=function(n){return new kendo.data.DataSource({transport:{read:function(t){t.success(n)}},pageSize:20,schema:{model:{fields:{ProjectNumber:{type:"string"},ProjectName:{type:"string"},StatusName:{type:"string"},TypeName:{type:"string"},StartDate:{type:"date"},ExpectedEndDate:{type:"date"},CompleteDate:{type:"date"}}},parse:function(n){return $.map(n,function(n){n.StartDate!=null&&(n.StartDate=kendo.toString(kendo.parseDate(n.StartDate),app.Constants.GlobalConstants.DateFormatForSearch));n.ExpectedEndDate!=null&&(n.ExpectedEndDate=kendo.toString(kendo.parseDate(n.ExpectedEndDate),app.Constants.GlobalConstants.DateFormatForSearch));n.CompleteDate!=null&&(n.CompleteDate=kendo.toString(kendo.parseDate(n.CompleteDate),app.Constants.GlobalConstants.DateFormatForSearch))}),n}}})},t}(app.Common.Controllers.PagedSearchController);n.EnerGovViewMyProjectsController=t})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f,e,o,s,h,c){var l=n.call(this,i,r,u,f,null,!1)||this,a;return l.$scope=t,l.enerGovViewMyRequestsSearchService=f,l.commonService=o,l.resourceService=h,l.enerGovMyEntityTelerikService=c,l.filename="",l.options="",l.showHeader=!1,l.expandStatus=!1,l.requestDetail=function(n){l.$location.path("/request/"+n)},l.changeStatusFilter=function(n){l.searchCriteria.PageNumber=1;l.searchCriteria.FilterIndex=n;l.search(l.searchCriteria,app.Events.SearchEvents.SearchCompleted)},l.changeKeyword=function(){l.searchCriteria.PageNumber=1;l.sortField=l.searchCriteria.Keyword?l.sortList[0].Value:l.sortList[1].Value;l.searchCriteria.SortField=l.sortField;l.search(l.searchCriteria,app.Events.SearchEvents.SearchCompleted)},a=l,a.showHeader=a.$location.path()!=="/myWork",a.mainGridOptions=a.enerGovMyEntityTelerikService.getTelerikGridOptions(),a.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Dashboard.DashboardResource",["Dashboard_MyRequest_RequestNumber","Dashboard_MyCases_Address","Dashboard_MyRequest_RequestType","Dashboard_MyCases_CaseStatus","Dashboard_MyCases_Project"],function(n){l.requestNumberLabel=n.Dashboard_MyRequest_RequestNumber;l.addressLabel=n.Dashboard_MyCases_Address;l.requestTypeLabel=n.Dashboard_MyRequest_RequestType;l.statusLabel=n.Dashboard_MyCases_CaseStatus;l.projectLabel=n.Dashboard_MyCases_Project;a.mainGridOptions.columns=a.getTelerikGridColumns();s.getViewMyRequestsDetailCriteria(function(n){a.criteria=n;a.$scope.$watch("vm.$scope.$parent.vm.includeParentRecords",function(n){a.searchAndFillGrid(n)})})},!0),l}return __extends(t,n),t.prototype.setExpandStatus=function(){this.expandStatus=!this.expandStatus},t.prototype.fileNameOkClick=function(){var n=this,t=angular.copy(this.searchCriteria);n.filename!==""&&n.filename!==undefined&&($("#FilenameModal.modal.fade.in").modal("hide"),t.PageNumber=1,t.PageSize=n.caseLimitForExport,t.SortField=n.sortField,n.options==="default"?n.searchForExport(t,app.Events.SearchEvents.SearchCompleted,function(){n.commonService.downloadData(n.searchResultForExcel,n.filename,"myrequests");n.filename=""}):(n.commonService.downloadData(n.searchResult,n.filename,"myrequests"),n.filename=""),$("div:not(.ng-hide) #button-Export").focus())},t.prototype.fileNameCancelClick=function(){$("#FilenameModal.modal.fade.in").modal("hide");$("div:not(.ng-hide) #button-Export").focus()},t.prototype.searchAndFillGrid=function(n){var t=this;t.isLoading=!0;t.criteria.IncludeParentRecords=n;t.criteria.PageSize=t.enerGovMyEntityTelerikService.telerikGridPageSize;t.criteria.PageNumber=t.enerGovMyEntityTelerikService.telerikGridPageNumber;t.searchCriteria=t.criteria;t.search(t.criteria,app.Events.SearchEvents.SearchCompleted,function(){var n=t.searchResult;t.mainGridOptions.dataSource=t.getDataSource(n);t.isLoading=!1})},t.prototype.getDataSource=function(n){return new kendo.data.DataSource({transport:{read:function(t){t.success(n)}},pageSize:20,schema:{model:{id:"RequestId",fields:{RequestNumber:{type:"string"},MainAddress:{type:"string"},RequestType:{type:"string"},RequestStatus:{type:"string"},ProjectName:{type:"string"}}}}})},t.prototype.getTelerikGridColumns=function(){return[{field:"RequestNumber",title:this.requestNumberLabel,width:"200px",filterable:{multi:!0,search:!0},attributes:{id:"request-number-#=RequestNumber#"},template:"<a class='k-grid-anchor' data-ng-href='\\#/request/#=RequestId#'><span>#=RequestNumber#<\/span><\/a>"},{field:"MainAddress",title:this.addressLabel,width:"200px",filterable:{multi:!0,search:!0},attributes:{id:"address-#=RequestNumber#"}},{field:"RequestType",title:this.requestTypeLabel,width:"200px",attributes:{id:"request-type-#=RequestNumber#"},filterable:{multi:!0,search:!0}},{field:"RequestStatus",title:this.statusLabel,width:"200px",attributes:{id:"request-status-#=RequestNumber#"},filterable:{multi:!0,search:!0}},{field:"ProjectName",title:this.projectLabel,width:"200px",attributes:{id:"project-name-#=RequestNumber#"},filterable:{multi:!0,search:!0}}]},t}(app.Common.Controllers.PagedSearchController);n.EnerGovViewMyRequestsController=t})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){"use strict";var i=n.Dashboard.EnerGovMyInspectionsController,r=n.Dashboard.EnerGovMyInvoicesController,u=n.Dashboard.Services.EnerGovDashboardService,f=n.Dashboard.EnerGovMyPermitsController,e=n.Dashboard.EnerGovMyPlansController,o=n.Dashboard.Services.EnerGovViewMyPermitsSearchService,s=n.Dashboard.EnerGovViewMyPermitsController,h=n.Dashboard.Services.EnerGovViewMyPlansSearchService,c=n.Dashboard.EnerGovViewMyPlansController,l=n.Dashboard.Services.EnerGovViewMyExistingInspectionsSearchService,a=n.Dashboard.EnerGovViewMyExistingInspectionsController,v=n.Dashboard.Services.EnerGovCommonForExportService,y=n.Dashboard.Services.EnerGovViewMyRequestsSearchService,p=n.Dashboard.EnerGovViewMyRequestsController,w=n.Dashboard.Services.EnerGovViewMyLicensesSearchService,b=n.Dashboard.EnerGovViewMyLicensesController,k=n.Dashboard.EnerGovMyLicensesController,d=n.Dashboard.Services.EnerGovViewMyBusinessesSearchService,g=n.Dashboard.Services.EnerGovMyTemplatesSearchService,nt=n.Dashboard.EnerGovViewMyBusinessesController,tt=n.Dashboard.Services.EnerGovViewMyEntityCriteriaService,it=n.Dashboard.Services.EnerGovMyEntityTelerikService,rt=n.Dashboard.EnerGovViewMyProjectsController;angular.module("enerGov.Dashboard",["app.globalsModule","app.Common.Services","enerGov.Common","app.Draft","app.Common.Services.Resource","ui.bootstrap.typeahead","azSuggestBox","enerGov.Template","kendo.directives"]).service("enerGovDashboardService",["http","menuService",u]).service("enerGovViewMyPermitsSearchService",["http",o]).service("enerGovViewMyPlansSearchService",["http",h]).service("enerGovViewMyDraftsSearchService",["http",n.Dashboard.Services.EnerGovViewMyDraftsSearchService]).service("enerGovViewMyExistingInspectionsSearchService",["http",l]).service("enerGovViewMyRequestsSearchService",["http",y]).service("enerGovViewMyLicensesSearchService",["http",w]).service("enerGovViewMyBusinessesSearchService",["http",d]).service("enerGovMyTemplatesSearchService",["http",g]).service("enerGovCommonForExportService",["resourceService","http",v]).service("enerGovMyEntityTelerikService",["globalsService","tabNavigatorService",it]).service("EnergovMyViewsCaseTypeFilterService",["http",n.Dashboard.Services.EnergovMyViewsCaseTypeFilterService]).service("enerGovViewMyEntityCriteriaService",["http","$routeParams","$location","globalsService","entitySecondaryDataService","EnergovMyViewsCaseTypeFilterService","enerGovViewMyPermitsSearchService","enerGovViewMyPlansSearchService","enerGovViewMyLicensesSearchService","enerGovInspectionService","enerGovMyRemainingInspectionsService","enerGovViewMyExistingInspectionsSearchService","enerGovViewMyRequestsSearchService","enerGovInvoiceSecondaryDataService",tt]).service("enerGovMyProjectService",["http",n.Dashboard.Services.EnerGovMyProjectService]).service("enerGovMyOperationalPermitService",["http",n.Dashboard.Services.EnerGovMyOperationalPermitService]).controller("enerGovMyInspectionsController",["enerGovDashboardService","$scope","$location",i]).controller("enerGovMyInvoicesController",["$scope","enerGovDashboardService",app.Constants.ServiceConstant.CartService,"$location","tenantService",r]).controller("enerGovMyPermitsController",["$scope","enerGovDashboardService","$location",f]).controller("enerGovViewMyPermitsController",["$routeParams","$scope","$location","globalsService","enerGovViewMyPermitsSearchService","entitySecondaryDataService","enerGovCommonForExportService","EnergovMyViewsCaseTypeFilterService","enerGovViewMyEntityCriteriaService","resourceService","enerGovMyEntityTelerikService",s]).controller("enerGovViewMyPlansController",["$scope","$routeParams","$location","globalsService","enerGovViewMyPlansSearchService","entitySecondaryDataService","enerGovCommonForExportService","EnergovMyViewsCaseTypeFilterService","enerGovViewMyEntityCriteriaService","resourceService","enerGovMyEntityTelerikService",c]).controller("enerGovMyPlansController",["$scope","enerGovDashboardService","$location",e]).controller("enerGovViewMyDraftsController",["$routeParams","$location","globalsService","enerGovViewMyDraftsSearchService","draftService","entitySecondaryDataService",n.Dashboard.EnerGovViewMyDraftsController]).controller("enerGovViewMyTemplatesController",["$routeParams","$location","globalsService","$scope","enerGovMyTemplatesSearchService","enerGovTemplateService","entitySecondaryDataService","menuService",n.Dashboard.EnerGovViewMyTemplatesController]).controller("enerGovViewMyExistingInspectionsController",["$routeParams","$scope","$location","globalsService","enerGovViewMyExistingInspectionsSearchService","entitySecondaryDataService","enerGovInspectionService","enerGovCommonForExportService","EnergovMyViewsCaseTypeFilterService","enerGovViewMyEntityCriteriaService","resourceService","enerGovMyEntityTelerikService",a]).controller("enerGovViewMyRequestsController",["$scope","$routeParams","$location","globalsService","enerGovViewMyRequestsSearchService","entitySecondaryDataService","enerGovCommonForExportService","enerGovViewMyEntityCriteriaService","resourceService","enerGovMyEntityTelerikService",p]).controller("enerGovViewMyLicensesController",["$routeParams","$scope","$location","globalsService","enerGovViewMyLicensesSearchService","entitySecondaryDataService","enerGovCommonForExportService","enerGovViewMyEntityCriteriaService","resourceService","enerGovMyEntityTelerikService",b]).controller("enerGovMyLicensesController",["enerGovDashboardService","enerGovSettingsService","$scope","$location","globalsService",k]).controller("enerGovViewMyBusinessesController",["$routeParams","$location","globalsService","enerGovViewMyBusinessesSearchService","entitySecondaryDataService",nt]).controller("enerGovViewMyProjectsController",["$routeParams","$scope","$location","globalsService","resourceService","enerGovMyEntityTelerikService","enerGovMyProjectService",rt]).controller("enerGovViewMyOperationalPermitsController",["$routeParams","$scope","$location","globalsService","resourceService","enerGovMyEntityTelerikService","enerGovMyOperationalPermitService","enerGovSettingsService",t.EnerGovViewMyOperationalPermitsController]);angular.module("azSuggestBox").directive("sbRemoveItemFromSelectionKeyboard",[function(){return{restrict:"AE",link:function(n,t){t.on("keydown",function(t){var i=t.keyCode;i===13&&(n.sbRemoveItemFromSelection(),angular.element("#caseTypeFilterInputControl").focus(),n.$apply())})}}}]);angular.module("azSuggestBox").directive("sbDropdownItemOverride",[function(){return{transclude:"element",restrict:"AE",link:function(n,t,i,r,u){var f=[],o=n.listAlias,e=t.parent();n.highlightedItem=-1;n.$watch("isOpen",function(){n.isOpen?e.removeClass("ng-hide"):e.addClass("ng-hide")});n.$watchCollection("list",function(){for(var i,s,r,e=0;e<f.length;e++)f[e].clone[0].outerHTML="",f[e].scope.$destroy();for(f=[],i=0;i<n.list.length;i++)s=n.list[i],r=n.$new(),r[o]=s,r.$index=i,r.$first=i==0,r.$last=i==n.list.length-1,u(r,function(n,i){i.hidden=!1;i.hide=function(){i.hidden||(angular.element(n).addClass("ng-hide"),i.hidden=!0)};i.show=function(){i.hidden&&(i.selected&&i.sbSelectedListItemClass=="ng-hide"||angular.element(n).removeClass("ng-hide"),i.hidden=!1)};i.selected=!1;i.select=function(){i.selected||(angular.element(n).addClass(i.sbSelectedListItemClass),i.selected=!0)};i.unSelect=function(){i.selected&&(angular.element(n).removeClass(i.sbSelectedListItemClass),i.selected=!1)};i.isSelected=function(){return i.selected};i.highlighted=!1;i.highlight=function(){i.highlighted||(angular.element(n).addClass(i.sbHighlightedListItemClass),angular.element("#caseTypeFilterInputControl").attr("aria-activedescendant","autoCompleteElement"+i.$index),i.highlighted=!0)};i.unHighlight=function(){i.highlighted&&(angular.element(n).removeClass(i.sbHighlightedListItemClass),i.highlighted=!1)};f.push({scope:i,clone:n});i.$index==0?t.after(n):f[i.$index-1].clone.after(n);n.on("click keydown",function(n){var t=n.keyCode;(t===undefined||t!==undefined&&t===13)&&(i.toggleItemSelection(i.$index),angular.element("#caseTypeFilterInputControl").focus(),i.$apply())})})});n.toggleItemSelection=function(t){var i,r;if(n.sbCloseListOnSelect&&(n.closeDropDown(),n.highlightNone(),n.$broadcast("clearSearch")),n.sbAllowDuplicates){n.indexes.push(t);n.model.push(n.list[t]);n.model[n.model.length-1].$listIndex=t;return}for(i=0;i<n.indexes.length;i++)if(n.indexes[i]===t){for(n.indexes.splice(i,1),n.unSelectListItem(t),r=0;r<n.model.length;r++)n.model[r].$listIndex==t&&n.model.splice(r,1);return}n.sbMaxSelection==1&&(n.indexes.forEach(function(t){n.unSelectListItem(t)}),n.indexes.splice(0,n.indexes.length),n.model.splice(0,n.model.length));n.indexes.push(t);n.model.push(n.list[t]);n.model[n.model.length-1].$listIndex=t;n.highlightNone()};n.highlightNone=function(){n.highlightedItem>-1&&(f[n.highlightedItem].scope.unHighlight(),n.highlightedItem=-1)};n.hideListItem=function(t){t==n.highlightedItem&&(f[t].scope.unHighlight(),n.highlightedItem=-1);f[t].scope.hide()};n.showListItem=function(n){f[n]&&f[n].scope.show()};n.unSelectListItem=function(n){f[n].scope.unSelect()};n.selectListItem=function(t){f[t]&&(t==n.highlightedItem&&f[t].scope.unHighlight(),f[t].scope.select())};n.getSearchResultsCount=function(){for(var t=0,n=0;n<f.length;n++)f[n].scope.hidden||t++;return t};n.getListItemsCount=function(){return f.length};n.highlightListItem=function(t){n.highlightedItem>-1&&f[n.highlightedItem].scope.unHighlight();f[t].scope.highlight();n.highlightedItem=t};n.highlightNextItem=function(){var i=0,t=n.highlightedItem;do i++,t++,t>=f.length&&(t=0);while(i<f.length&&(f[t].scope.hidden||f[t].scope.selected&&n.sbSelectedListItemClass=="ng-hide"));f[t].scope.hidden||n.highlightListItem(t)};n.highlightPrevItem=function(){var i=0,t=n.highlightedItem;do i++,t--,t<=-1&&(t=f.length-1);while(i<f.length&&(f[t].scope.hidden||f[t].scope.selected&&n.sbSelectedListItemClass=="ng-hide"));f[t].scope.hidden||n.highlightListItem(t)}}}}])})(t=n.Dashboard||(n.Dashboard={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r){this.http=n;this.entityTabsService=t;this.$routeParams=i;this.$timeout=r;this.rootUrl="/energov/entity/fees/search"}return n.prototype.searchByCriteria=function(n,t){var i=this;this.$timeout(function(){i.http.post(i.rootUrl,n,function(n){t(n)},!1)},1e3)},n.prototype.getEntityFeeSummary=function(n,t){var i=this;this.$timeout(function(){i.http.post(i.rootUrl+"/summary",n,function(n){t(n)},!1)},1e3)},n}();n.EnerGovEntityFeeSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Fee||(n.Fee={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f){var e=n.call(this)||this;return e.$routeParams=t,e.$location=i,e.enerGovEntityFeeSearchService=r,e.selfServiceStateService=u,e.entityTabsService=f,e.errorMessage="",e}return __extends(t,n),t.prototype.init=function(){var n=this,t=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(n.$location,n.$routeParams.id),i={PageNumber:1,PageSize:1e3,SortField:"",IsSortedInAscendingOrder:!0,ModuleId:t,EntityId:n.$routeParams.id,IsRemainingFee:!0};n.enerGovEntityFeeSearchService.getEntityFeeSummary(i,function(t){t.Success?t.Success&&t!=null&&t.Result!=null&&(n.entityFeeSummaryInfo=t.Result,n.entityTabsService.showFeesTab=!0,n.$routeParams.tab&&n.$routeParams.tab==app.Constants.TabConstants.Fees?n.entityTabsService.setAdditionalEntityTabsVisibility(n.$routeParams.tab,!0):n.entityTabsService.setFirstTabOnHidingOtherTabs()):(t.StatusCode==app.Common.Services.HttpStatusCode.NoContent||t.StatusCode==app.Common.Services.HttpStatusCode.Forbidden?n.entityTabsService.showFeesTab=!1:t.StatusCode==app.Common.Services.HttpStatusCode.PreconditionFailed&&(n.entityTabsService.showFeesTab=!0,n.entityTabsService.feeHasErroMessage=!0,n.errorMessage=t.ErrorMessage),n.$routeParams.tab&&n.$routeParams.tab==app.Constants.TabConstants.Fees?n.entityTabsService.setAdditionalEntityTabsVisibility(n.$routeParams.tab,n.entityTabsService.showFeesTab):n.entityTabsService.setFirstTabOnHidingOtherTabs())})},t}(app.Core.Controllers.CoreController);n.EnerGovEntityFeeSummaryController=t})(t=n.Fee||(n.Fee={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f,e){var o=n.call(this,t,i,r,u,null,!1)||this;return o.enerGovEntityFeeSearchService=u,o.entitySecondaryDataService=f,o.entityTabsService=e,o}return __extends(t,n),t.prototype.init=function(){var n=this,t=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(n.$location,n.$routeParams.id);n.criteria={PageNumber:1,PageSize:n.globalService.pageSizeList[0].Value,SortField:"",IsSortedInAscendingOrder:!0,ModuleId:t,EntityId:n.$routeParams.id,IsRemainingFee:!1};this.searchCriteria=n.criteria;n.entitySecondaryDataService.getEntityRecordSortSecondaryData(function(t){n.sortList=t.Result.EntityPaidFeesSearchSortList;n.sortField=t.Result.EntityPaidFeesSearchSortList[0].Value});this.search(this.criteria,app.Events.SearchEvents.SearchCompleted)},t}(app.Common.Controllers.PagedSearchController);n.EnerGovEntityPaidFeesSearchController=t})(t=n.Fee||(n.Fee={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f,e){var o=n.call(this,t,i,r,u,null,!1)||this;return o.enerGovEntityFeeSearchService=u,o.entitySecondaryDataService=f,o.entityTabsService=e,o}return __extends(t,n),t.prototype.init=function(){var n=this,t=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(n.$location,n.$routeParams.id);n.criteria={PageNumber:1,PageSize:n.globalService.pageSizeList[0].Value,SortField:"",IsSortedInAscendingOrder:!0,ModuleId:t,EntityId:n.$routeParams.id,IsRemainingFee:!0};n.searchCriteria=n.criteria;n.entitySecondaryDataService.getEntityRecordSortSecondaryData(function(t){n.sortList=t.Result.EntityPaidFeesSearchSortList;n.sortField=t.Result.EntityPaidFeesSearchSortList[0].Value});n.search(n.criteria,app.Events.SearchEvents.SearchCompleted)},t}(app.Common.Controllers.PagedSearchController);n.EnerGovEntityRemainingFeesSearchController=t})(t=n.Fee||(n.Fee={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i){var u=n.call(this,null)||this,r;return u.$location=t,u.stepperService=i,r=u,r.stepperService.backToApplicationTypeStep=!1,r.stepperService.backToBusinessTypeStep=!1,r.stepperService.backToContactsStep=!1,r.stepperService.backToLocationStep=!1,r.stepperService.currentStepNumber=0,u}return __extends(t,n),t.prototype.toPermit=function(){this.$location.path("/estimate/permit")},t.prototype.toPlan=function(){this.$location.path("/estimate/plan")},t}(app.Core.Controllers.CoreController);n.FeeEstimatorController=t})(t=n.Fee||(n.Fee={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(){"use strict";var t=n.Fee.Services.EnerGovEntityFeeSearchService,i=n.Fee.EnerGovEntityRemainingFeesSearchController,r=n.Fee.EnerGovEntityPaidFeesSearchController,u=n.Fee.FeeEstimatorController,f=n.Fee.EnerGovEntityFeeSummaryController;angular.module("enerGov.Fee",["app.globalsModule","app.Common.Services"]).service("enerGovEntityFeeSearchService",["http","entityTabsService","$routeParams","$timeout",t]).controller("enerGovEntityRemainingFeesSearchController",["$routeParams","$location","globalsService","enerGovEntityFeeSearchService","entitySecondaryDataService","entityTabsService",i]).controller("enerGovEntityPaidFeesSearchController",["$routeParams","$location","globalsService","enerGovEntityFeeSearchService","entitySecondaryDataService","entityTabsService",r]).controller("feeEstimatorController",["$location","stepperService",u]).controller("enerGovEntityFeeSummaryController",["$routeParams","$location","enerGovEntityFeeSearchService","selfServiceStateService","entityTabsService",f])})(t=n.Fee||(n.Fee={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){var i;(function(i){"use strict";var u=app.Core.Controllers.CoreController,r=app.Common.SelfServiceModules,f=function(){function i(i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b){var d=this,k,g;this.http=i;this.$routeParams=r;this.$location=u;this.globalService=f;this.eReviewsService=e;this.$upload=o;this.$q=s;this.$timeout=h;this.$http=c;this.fileUploadService=l;this.$filter=a;this.authUtils=v;this.resourceService=y;this.tenantService=p;this.$sce=w;this.requestConfig=b;this.attachmentFileType="Uploaded via Civic Access";this.uploadedFileCatgories=[];this.fileAttachments=[];this.ereviewAttachments=[];this.categoryEreviewFiles=[];this.historyPopupData=[];this.markupPopupData=[];this.currentEreviewPopupTitle="";this.currentCategoryTitle="";this.currentEreviewFileList=[];this.currentCaseSubmissionStatusPopupTitle="";this.currentCaseSubmissionFileList=[];this.nonCategoryCards=[];this.fileSetInfo=null;this.$files=[];this.hasAuthorizedContact=!1;this.hasAuthorizedContactForAttachment=!1;this.showEReviewResubmitStepper=!0;this.hideAttachmentForTemplate=!1;this.isResubmitAdditionalAttachments=!1;this.isShowDiv=!1;this.uploadedFiles=0;this.percentage=0;this.hideActionColumnOnSummary=!0;this.resubmitCategoryCards=[];this.eRFileSubmissionQueueID="";this.isFileCategory=!1;this.selectedERProjectId="";this.allowResubmitAdditionalFiles=!1;this.fileChunkSize=1e6;this.showDigEplanIFrame=!0;this.showRequiredFilesCards=!1;this.showNewFilesCards=!1;this.showResubmitButtonOnCards=!1;this.showSubmissionMessage=!1;this.attachmentFlowOptions={target:this.globalService.baseUrl+"api/energov/attachments/uploadchunk",permanentErrors:["404","500","501"],maxChunkRetries:1,chunkRetryInterval:5e3,simultaneousUploads:4,chunkSize:this.fileChunkSize,testChunks:!1,generateUniqueIdentifier:function(n){return d.create_UUID()+"-"+n.size+"-"+(n.name?n.name.trim():n.name)},headers:{}};this.ereviewFlowOptions={target:this.globalService.baseUrl+"api/energov/ereviews/uploadchunk",permanentErrors:["404","500","501"],maxChunkRetries:1,chunkRetryInterval:5e3,simultaneousUploads:4,chunkSize:this.fileChunkSize,testChunks:!1,generateUniqueIdentifier:function(n){return d.create_UUID()+"-"+n.size+"-"+(n.name?n.name.trim():n.name)},headers:{}};this.addAttachmentsToParent=!1;this.parentId="";this.isServiceModelCleaned=!0;this.attachmentInstruction="";this.attachmentAllowedFileTypes="";this.attachmentsFileTypes=[];this.requiredFileCards=[];this.filesDropDown=[];this.duplicateFiles=[];this.notSupportedFiles=[];this.categoryOnlyOneCanSelected="";this.cards=[];this.setEReviewFileVersion=function(n,t){for(var r,u=d,i=0;i<t.length;i++)t[i].name=u.getFileNameWithVersion(t[i].name,1),t[i].file.name=u.getFileNameWithVersion(t[i].file.name,1);for(r=0;r<n.files.length;r++)n.files[r].name=u.getFileNameWithVersion(n.files[r].name,1)};this.setEReviewFileNameFileCategoryOptions=function(n,t){for(var r,e,u=d,f=[],i=0;i<n.files.length;i++)for(r=0;r<t.length;r++)n.files[i].name===t[r].file.name&&(e=u.eReviewsService.ereviewsSecondaryData.ERProjectFileCategories.filter(function(n){return n.Name===t[r].fileType})[0],f.push({FileName:encodeURIComponent(n.files[i].file.name?n.files[i].file.name.trim():n.files[i].file.name),FileCategory:e.ERProjectFileCategoryId}));u.ereviewFlowOptions.headers.FileNameFileCategory=f};NProgress.configure({showSpinner:!1});k=this;k.eReviewsService.getFileUploadChunkSize(function(n){k.fileChunkSize=n;k.ereviewFlowOptions.chunkSize=k.fileChunkSize;k.attachmentFlowOptions.chunkSize=k.fileChunkSize;k.$attachmentFlow&&(k.$attachmentFlow.opts.chunkSize=k.fileChunkSize);k.$ereviewFlow&&(k.$ereviewFlow.opts.chunkSize=k.fileChunkSize)});y.getSpecificKeyValues("SelfService.EnerGov.Resources.Common.CommonResource",["SelectType_Option"],function(n){k.defaultFileTypeName=n.SelectType_Option});g=["EReview_Files_NoRecordsToDisplay"];y.getSpecificKeyValues("SelfService.EnerGov.Resources.EReview.EReviewResource",g,function(n){return d.eReviewResourceValues=n});this.getFileTypeNames=function(n){d.http.get("/attachment/GetAttachments/",function(t){t.Success&&n(t.Result)},!1)};this.getHasAuthorizedContactSetting=function(n,t){var i=d;return d.http.get("/energov/entity/attachments/search/authorizedContact/"+n+"/"+t,function(n){n.Success&&(i.hasAuthorizedContactForAttachment=n.Result)},!1)};this.setRequiredFiles=function(){d.getSoftwarePackageSettings(function(t){var s=[],h,c,i,f,u,r,o,e;if(k.fileSetInfo===null?angular.forEach(k.attachmentsFileTypes,function(t){if(t.IsRequired)for(var i=0;i<t.Quantity;i++)s.push({AttachmentReqFileRefID:t.AttachmentReqFileRefID,Name:t.Name,Quantity:1,AttachmentGroupID:t.AttachmentReqFileRefID,isFilled:!1,AttachmentType:n.Attachment.Models.AttachmentType.Attachment,AllowedFileTypes:k.attachmentAllowedFileTypes,ERProjectFileCategoryDescription:null})}):angular.forEach(k.fileSetInfo.FileSetFileCategories.filter(function(n){return n.IsRequired==!0}),function(i){var r=d.getFilteredFileTypes(t.SettingValue,i.AllowedFileTypes);s.push({AttachmentReqFileRefID:i.FileSetFileCategoryId,Name:i.FileCategoryName,Quantity:1,AttachmentGroupID:"",AttachmentType:n.Attachment.Models.AttachmentType.EReview,isFilled:!1,ERProjectFileCategoryId:i.FileCategoryId,AllowedFileTypes:r,ERProjectFileCategoryDescription:i.FileCategoryDescription})}),k.requiredFileCards=s,k.requiredFileCards.sort(function(n,t){return n.Name>t.Name?1:n.Name<t.Name?-1:0}),k.fileSetInfo!==null)for(h=[],i=0;i<k.ereviewAttachments.length;i++){for(f=!1,u=0;u<k.fileSetInfo.FileSetFileCategories.length;u++)if(k.fileSetInfo.FileSetFileCategories[u].FileCategoryName===k.ereviewAttachments[i].fileType)for(f=!0,r=0;r<k.requiredFileCards.length;r++)if(k.requiredFileCards[r].Name==k.fileSetInfo.FileSetFileCategories[u].FileCategoryName&&!k.requiredFileCards[r].isFilled){k.requiredFileCards[r].isFilled=!0;break}f||h.push(i)}for(c=[],i=0;i<d.fileAttachments.length;i++){if(f=!1,d.attachmentsFileTypes!==null)for(u=0;u<d.attachmentsFileTypes.length;u++)if(d.attachmentsFileTypes[u].Name===d.fileAttachments[i].fileType)for(f=!0,r=0;r<d.requiredFileCards.length;r++)if(d.requiredFileCards[r].Name==d.attachmentsFileTypes[u].Name&&!d.requiredFileCards[r].isFilled){d.requiredFileCards[r].isFilled=!0;break}if(f||c.push(i),d.fileAttachments[i].erProjectFileVersionId)for(o=0;o<k.requiredFileCards.length;o++)k.requiredFileCards[o].Name==d.fileAttachments[i].fileType&&k.requiredFileCards.splice(o,1)}if(k.selectedFileType=k.attachmentsFileTypes!==null&&k.attachmentsFileTypes.length>0?k.filesDropDown[0]:null,k.uploadedFileCatgories.length>0)for(e=0;e<k.requiredFileCards.length;e++)k.requiredFileCards[e].isFilled||(k.requiredFileCards[e].isFilled=k.uploadedFileCatgories.some(function(n){return n==k.requiredFileCards[e].Name}));k.requiredFilesCallback&&k.requiredFilesCallback(k.attachmentsFileTypes)})};this.clean=function(){k.uploadedFileCatgories=[];k.isServiceModelCleaned=!0;k.cards=[];k.fileAttachments=[];k.ereviewAttachments=[];k.attachmentsFileTypes=[];k.requiredFileCards=[];k.filesDropDown=[];k.fileSetInfo=null;k.addAttachmentsToParent=!1;k.hasAuthorizedContactForAttachment=!1;k.parentId="";k.attachmentInstruction="";k.attachmentAllowedFileTypes="";k.erProject=null;k.uploadedEReviewAttachments=[];d.$ereviewFlow!=undefined&&d.$ereviewFlow!=null&&k.$ereviewFlow.cancel();d.$attachmentFlow!=undefined&&d.$attachmentFlow!=null&&k.$attachmentFlow.cancel();d.$resubmitEReviewFlow!=undefined&&d.$resubmitEReviewFlow!=null&&k.$resubmitEReviewFlow.cancel()};this.addAttachments=function(n){angular.forEach(n,function(n){k.fileAttachments.push({name:n.FileName,fileType:n.Notes,attachment:n,file:null,size:null,type:t.Models.AttachmentType.Attachment,cssFileName:n.FileName,createdDate:n.AddedOn})});d.getCombinedCardsForExistingFiles()};this.addEReviewAttachments=function(n){angular.forEach(n,function(n){k.ereviewAttachments.push({name:n.FileName,fileType:n.Notes,attachment:n,file:null,size:null,type:t.Models.AttachmentType.EReview,cssFileName:n.FileName,createdDate:n.AddedOn})});d.getCombinedCardsForExistingFiles()};k.tenantService&&k.tenantService.getTenants(function(n){if(n){var t=n.filter(function(n){return n.TenantID==k.globalService.tenantId})[0];t.FriendlyTenantName&&(k.attachmentFileType="Uploaded via "+t.FriendlyTenantName)}})}return i.prototype.showLable=function(){return this.isShowDiv==!0?"Hide Details":"Show Details"},i.prototype.create_UUID=function(){var n=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var i=(n+Math.random()*16)%16|0;return n=Math.floor(n/16),(t=="x"?i:i&3|8).toString(16)})},i.prototype.toResubmitStepper=function(n){this.returnToUrl=this.$location.url();var t="";n&&n!=="null"&&(t=n);this.$location.path().toUpperCase().indexOf("PERMIT")>-1?this.$location.url(("/permit/{0}/resubmitAttachment/"+t).replace("{0}",this.$routeParams.id)):this.$location.path().toUpperCase().indexOf("PLAN")>-1&&this.$location.url(("/plan/{0}/resubmitAttachment/"+t).replace("{0}",this.$routeParams.id))},i.prototype.setAttachmentAlertFocus=function(n){var i=this,t=null;i.duplicateFiles.length>0?t=angular.element("#DuplicateFileAlertPanel"):i.notSupportedFiles.length>0?t=angular.element("#AttachmentAlertPanel"):n&&(t=angular.element(n));t&&this.$timeout(function(){t.focus()},300)},i.prototype.setFileCategoryInfo=function(n,t){var i=this;app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2022.2.0.0")&&this.hasAuthorizedContact&&(t===app.Common.SelfServiceModules.Permit||t===app.Common.SelfServiceModules.Plan)&&this.eReviewsService.getEReviewSubmissionInfoByEntityId(n,t,function(n){n.Result&&n.Success&&(i.isFileCategory=n.Result.IsCategoryView,i.allowResubmitAdditionalFiles=n.Result.AllowResubmitAdditionalFiles)})},i.prototype.isDuplicateAttachment=function(n){var t=this,i;return t.ereviewAttachments.filter(function(t){return!t.attachment&&t.name.toLowerCase()===n.toLowerCase()}).length>0||t.$resubmitEReviewFlow.files.filter(function(t){return t.file.name.toLowerCase()===n.toLowerCase()}).length>0?!0:t.ereviewAttachments.filter(function(n){return n.attachment!==undefined&&n.attachment!==null}).length>0?(i=!1,angular.forEach(t.ereviewAttachments,function(t){if(!i){var r=t.name.substring(0,t.name.lastIndexOf(".")),u=t.name.substring(t.name.lastIndexOf(".")),f=r.substring(0,r.lastIndexOf("_v"))+u;i=f.toLowerCase()===n.toLowerCase()}}),i):!1},i.prototype.addResubmitAttachment=function(n,t,i,r){var f=this;n.length!==0&&(f.duplicateFiles=[],f.notSupportedFiles=[],angular.forEach(n,function(n){var t;if(n.name!=r.name&&f.isDuplicateAttachment(n.name))f.duplicateFiles.push(n.name),i.removeFile(n);else{var o=f.eReviewsService.ereviewsSecondaryData.ERProjectFileCategories.filter(function(n){return n.Name===r.fileType})[0],s=o?o.AllowedFileTypes:".*",e=f.getFilteredFileTypes(f.allowedFileTypes.SettingValue,s);e.match(n.getType())&&u.isNotNullEmptyUndefined(n.getType())||e.match(n.getExtension())&&u.isNotNullEmptyUndefined(n.getExtension())||e.indexOf(".*")>-1&&u.isNotNullEmptyUndefined(n.getExtension())?(t=f.ereviewAttachments.filter(function(n){return n.ereviewProjectFile!==null&&n.ereviewProjectFile.ERProjectFileID==r.ereviewProjectFile.ERProjectFileID})[0],t.file=n,t.size=n.file.size,f.$resubmitEReviewFlow.addFile(n.file),t.file.name=f.getFileNameWithVersion(t.file.name,r.ereviewProjectFile.NextFileVersion),f.$resubmitEReviewFlow.files[f.$resubmitEReviewFlow.files.length-1].name=t.file.name):(f.notSupportedFiles.push(n.name),i.removeFile(n))}f.setAttachmentAlertFocus()}))},i.prototype.showProgressBarDialogForResubmit=function(n){var t=this;this.fileUploadService.clean();this.fileUploadService.fileProgressList=n.map(function(n){return{FileName:n.file.name,Percentage:0,ChunksUploaded:0}});this.fileProgressList=this.fileUploadService.fileProgressList},i.prototype.removeResubmitAttachment=function(n){var t=this,i=t.$resubmitEReviewFlow.files.filter(function(t){return n.file&&t.file.name==n.file.file.name});t.$resubmitEReviewFlow.removeFile(i[0]);n.file=null;n.size=null},i.prototype.uploadResubmitEReviewAttachments=function(t,i){var r=this;r.setEReviewFileNameFileCategoryOptions(r.$resubmitEReviewFlow,t);r.fileUploadService.uploadFiles(r.$resubmitEReviewFlow,t,function(u){t.forEach(function(t){u.forEach(function(i){r.erProject.ERProjectFiles.forEach(function(r){t.ereviewProjectFile&&t.ereviewProjectFile.ERProjectFileID==r.ERProjectFileID&&t.file.name===i.FileName&&(r.LatestVersion.Latest=!1,r.LatestVersion.ERProjectFileSystemStatusID=n.EReview.Enums.ERProjectFileSystemStatus.Locked,r.AllowRevisionFileUpload=!1,r.Pending=!1,r.IsApplyOnline=!0,r.ERProjectFileVersions.push({ERProjectFileVersionID:null,ERProjectFileStatusID:"",ERProjectFileSystemStatusID:n.EReview.Enums.ERProjectFileSystemStatus.UnderReview,SaveFileName:i.FileName,IsFileSecure:i.IsFileSecure,Locked:!1,Latest:!0,AllowViewCorrection:!1,FileVersion:r.NextFileVersion,Submitted:!0,IsNew:!0,IsDeleted:!1,ClientId:null,Comments:"",SystemtaskId:null,MarkDelete:!1,Pending:!1,StatusName:"",FileStatusName:"",ThumbnailUrl:"",FileMarkups:null,SubmittalID:"",NeedAttention:!1,TempUploadFolderName:null}))})})});i(r.erProject)})},i.prototype.saveResubmitAttachments=function(n,t){var i=this;i.showProgressBarDialogForResubmit(n);i.ereviewFlowOptions.headers.UploadFolder=i.erProject.UploadFolder;i.setFlowOptions(!0);i.$resubmitEReviewFlow.opts.headers=i.ereviewFlowOptions.headers;i.uploadResubmitEReviewAttachments(n,function(){i.isResubmitAdditionalAttachments?i.$ereviewFlow!==undefined&&i.$ereviewFlow.files.length>0&&i.uploadEReviewAttachments(function(n){i.updateEReviewProjectModel(n,i.erProject);i.erProject.ERProjectSystemStatusID=i.getERProjectSystemStatusID(i.erProject);i.eReviewsService.resubmitEReview(i.erProject,function(n){t(n!=null&&n!==undefined)})}):(i.removeAdditionalAttachments(),i.erProject.ERProjectSystemStatusID=i.getERProjectSystemStatusID(i.erProject),i.eReviewsService.resubmitEReview(i.erProject,function(n){t(n!=null&&n!==undefined)}))})},i.prototype.createFileSubmissionQueue=function(n,t,i){var u=this,r=this;r.ereviewAttachments.length>0&&(r.eRFileSubmissionQueueID=n.ERFileSubmissionQueueID,r.eReviewsService.createFileSubmissionQueue(n).then(function(f){f.Success&&r.eReviewsService.updateFileSubmissionQueue(r.addAttachmentsInfoToQueue(n)).then(function(n){if(n.Success){var f=r.ereviewAttachments.filter(function(n){return n.attachment===null&&n.ereviewProjectFile===null});r.uploadFilesChunk(f);r.fileUploadService.uploadFiles(u.$ereviewFlow,f,function(){r.$ereviewFlow.files=[];r.$files=[];r.updateCaseForAttachments(r.$routeParams.id,[],t,function(t){i(n.Result,t)})})}})}))},i.prototype.addAttachmentsInfoToQueue=function(n){var i=this,t=i.ereviewAttachments.filter(function(n){return n.attachment===null&&n.ereviewProjectFile===null});return t&&t.length&&t.forEach(function(t){var r=i.getSubmissionQueueFileInfo(t.ERProjectFileCategoryId,t.name);n.ERFileSubmissionQueueFiles.push(r)}),n.IsNew=!1,n},i.prototype.uploadFilesChunk=function(n){var t=this;n&&n.length&&(t.showProgressBarDialogForResubmit(n),t.ereviewFlowOptions.headers.UploadFolder=t.eRFileSubmissionQueueID,t.setFlowOptions(!0),t.$resubmitEReviewFlow&&(t.$resubmitEReviewFlow.opts.headers=this.ereviewFlowOptions.headers),t.setEReviewFileNameFileCategoryOptions(this.$ereviewFlow,n))},i.prototype.getSubmissionQueueInfo=function(){return{ERFileSubmissionQueueID:this.create_UUID(),UserID:"",ERProjectID:"",CreateDate:new Date,IsReadyForProcessing:!1,IsSentToBus:!1,IsSuccessful:!1,Result:"",IsAppliedOnline:!0,ERFileSubmissionQueueFiles:[],IsNew:!0,IsDeleted:!1,ClientId:""}},i.prototype.getSubmissionQueueFileInfo=function(n,t){return{ERFileSubmissionQueueFileID:this.create_UUID(),FileCategoryID:n,Errors:"",FileName:t,InformationMessage:"",IsSuccessful:!0,IsNew:!0,IsDeleted:!1,ClientId:null}},i.prototype.removeAdditionalAttachments=function(){for(var i,u,f,e,o,n=this,r=0;r<n.ereviewAttachments.length;r++)i=n.ereviewAttachments[r],i.type==t.Models.AttachmentType.EReview&&i.attachment===null&&((i.ereviewProjectFile==undefined||i.ereviewProjectFile===null)&&(u=n.ereviewAttachments.indexOf(i),n.ereviewAttachments.splice(u,1),f=n.cards.filter(function(n){return n.file&&n.file.name==i.file.file.name}),e=n.cards.indexOf(f[0]),n.cards.splice(e,1),o=n.$ereviewFlow.files.filter(function(n){return n.file&&n.file.name==i.file.file.name}),n.$ereviewFlow.removeFile(o[0])),n.fileSetInfo!==null&&n.updateFilesDropDownIfFileSet());this.$ereviewFlow!=undefined&&this.$ereviewFlow!=null&&n.$ereviewFlow.cancel()},i.prototype.propertyExistsInAttachment=function(n,t){var i,r;if(!t)return!1;if(t.hasOwnProperty(n))return!0;if(i=[],n.indexOf(".")>0)for(i=n.split("."),r=0;;)if(t.hasOwnProperty(i[r])){if(r===i.length-1)return!0;t=t[i[r]];r++}else return!1;return!1},i.prototype.getCombinedCardsForExistingFiles=function(n){var t=this,i;if(t.cards=[],[].push.apply(t.cards,t.fileAttachments),[].push.apply(t.cards,t.ereviewAttachments),n&&n.trim().length>=1&&t.cards.length>0){if(i=n.replace("-",""),!t.propertyExistsInAttachment(i,t.fileAttachments[0])&&!t.propertyExistsInAttachment(i,t.ereviewAttachments[0]))return console.log(n+" does not exist in the Attachments"),t.cards;t.cards=t.$filter("orderBy")(t.cards,n);t.nonCategoryCards=t.$filter("orderBy")(t.nonCategoryCards,t.getSortMappingForNonCategoryCards(n))}else t.$q.when(t.attachmentInitialSortPromise).then(function(){t.cards=t.$filter("orderBy")(t.cards,t.attachmentInitialSortProperty);t.nonCategoryCards=t.$filter("orderBy")(t.nonCategoryCards,t.getSortMappingForNonCategoryCards(t.attachmentInitialSortProperty))});return t.cards.sort(function(n,t){return n.fileType>t.fileType?1:n.fileType<t.fileType?-1:0}),t.nonCategoryCards.sort(function(n,t){return n.CategoryName>t.CategoryName?1:n.CategoryName<t.CategoryName?-1:0}),t.cards},i.prototype.getSortMappingForNonCategoryCards=function(n){var t="";switch(n){case"-needsAction":t="AllowResubmission";break;case"cssFileName":t="FileName";break;case"fileType":t="CategoryName";break;case"createdDate":t="UploadDate";break;default:t="AllowResubmission"}return t},i.prototype.getSoftwarePackageSettings=function(n){var t=this;this.allowedFileTypes?n(this.allowedFileTypes):this.http.get("/tenantSettings/SoftwarePackageSettings",function(i){i.Success&&(t.allowedFileTypes=i.Result,n(i.Result))},!0,{softwarePackageName:"SelfService",settingName:"FileTypesAllowed"})},i.prototype.getFileTypes=function(n){var t=this;t.$http.get(this.globalService.webApiBaseUrl+"/attachment/GetAttachments/").then(function(i){var r=i.data?i.data.Result:null;t.stdFileTypes=r;n(r)},function(){n(null)})},i.prototype.getFileNameWithVersion=function(n,t){var i=n.lastIndexOf(".");return n.substring(0,i)+"_v"+t+n.substring(i)},i.prototype.setSelectedFileType=function(){var n=this,t,i;n.filesDropDown.length>0?(t=n.filesDropDown[0].AttachmentType,n.filesDropDown=_.sortBy(n.filesDropDown,function(n){return n.Name.toLowerCase()}),n.filesDropDown=n.filesDropDown.filter(function(n){return n.Id!="0"}),n.filesDropDown.length>0&&(i={Id:"0",Name:n.defaultFileTypeName,AttachmentType:t,AllowedFileTypes:null,ERProjectFileCategoryDescription:null},n.filesDropDown.unshift(i),n.selectedFileType=n.filesDropDown[0])):n.selectedFileType=null},i.prototype.updateFilesDropDownIfFileSet=function(){var n=this;n.fileSetInfo!==null&&(angular.forEach(n.fileSetInfo.FileSetFileCategories.filter(function(n){return n.NumberOfFilesAllowed===1}),function(i){var r,u,f;n.ereviewAttachments.filter(function(n){return n.fileType===i.FileCategoryName}).length>0?(r=n.filesDropDown.filter(function(n){return n.Id===i.FileCategoryId})[0],r!==undefined&&(u=n.filesDropDown.indexOf(r),n.filesDropDown.splice(u,1))):n.filesDropDown.filter(function(n){return n.Id===i.FileCategoryId}).length===0&&(f=n.getFilteredFileTypes(n.allowedFileTypes.SettingValue,i.AllowedFileTypes),n.filesDropDown.push({Name:i.FileCategoryName,Id:i.FileCategoryId,AttachmentType:t.Models.AttachmentType.EReview,AllowedFileTypes:f,ERProjectFileCategoryDescription:i.FileCategoryDescription}))}),n.setSelectedFileType())},i.prototype.removeFlowAttachmentCard=function(n,i,u,f){var e,o,h,s;f===void 0&&(f=!0);e=this;n.type==t.Models.AttachmentType.EReview?((n.ereviewProjectFile==undefined||n.ereviewProjectFile===null)&&(o=e.ereviewAttachments.indexOf(n),e.ereviewAttachments.splice(o,1),s=e.$ereviewFlow.files.filter(function(t){return n.file&&t.file.name==n.file.file.name}),e.$ereviewFlow.removeFile(s[0])),e.fileSetInfo!==null&&(e.setRequiredFiles(),e.updateFilesDropDownIfFileSet())):n&&(o=e.fileAttachments.indexOf(n),e.fileAttachments.splice(o,1),h=u==r[r.BusinessLicense].toUpperCase()||u==r[r.OperationalPermit].toUpperCase(),(e.$routeParams.id===undefined||i||h)&&e.setRequiredFiles(),s=e.$attachmentFlow.files.filter(function(t){return n.file&&t.file.name==n.file.file.name}),e.$attachmentFlow.removeFile(s[0]));f&&e.getCombinedCardsForExistingFiles()},i.prototype.showProgressBarDialog=function(n){var i,r,t;n===void 0&&(n=!1);i=this;this.fileUploadService.clean();r=this.fileAttachments.filter(function(n){return n.attachment===null}).map(function(n){return{FileName:n.name,Percentage:0,ChunksUploaded:0}});t=null;(!n||n&&app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2019.0.0.0"))&&(t=this.ereviewAttachments.filter(function(n){return n.attachment===null}).map(function(n){return{FileName:i.getFileNameWithVersion(n.name,1),Percentage:0,ChunksUploaded:0}}));this.fileUploadService.fileProgressList=r;t!==null&&(this.fileUploadService.fileProgressList=this.fileUploadService.fileProgressList.concat(t));this.fileProgressList=this.fileUploadService.fileProgressList},i.prototype.closeProgressBarDialog=function(){angular.element("#AttachmentUploadProgressModal").modal("hide")},i.prototype.anyErrorInUploadFile=function(){if(this.fileUploadService.fileProgressList===undefined||this.fileUploadService.fileProgressList===null)return!1;var n=this.fileUploadService.fileProgressList.filter(function(n){return n.UploadErrorMessage!=null});return n.length>0},i.prototype.getNumberOfUploadedFiles=function(n,t){var i=this,r=n;return i.fileUploadService.fileProgressList!=undefined&&i.fileUploadService.fileProgressList.length<r?(r=1,i.percentage=i.percentage>100?0:i.percentage,i.isShowDiv=!1,i.uploadedFiles=r,i.uploadedFiles):(t===100&&(r=r+1),i.uploadedFiles=r,i.percentage=Math.round(i.uploadedFiles/i.fileUploadService.fileProgressList.length*100),i.uploadedFiles)},i.prototype.uploadFileAttachments=function(n,t){var i,r,u,f;t===void 0&&(t=!1);i=this;i.setFlowOptions();i.$attachmentFlow.opts.headers=i.attachmentFlowOptions.headers;r=this.fileAttachments.filter(function(n){return n.attachment!=null});t&&(r=r.filter(function(n){return n.attachment.ParentID}));u=this.fileAttachments.filter(function(n){return n.attachment===null});u.length>0?this.fileUploadService.uploadFiles(i.$attachmentFlow,u,function(t){i.$attachmentFlow.files=[];i.$files=[];r.length>0&&angular.forEach(r,function(n){t.push(n.attachment)});t.forEach(function(n){u.forEach(function(t){t.name==n.FileName&&(t.attachment=n)})});n(t,u)}):r.length>0?(f=[],angular.forEach(r,function(n){f.push(n.attachment)}),n(f,[])):n([],[])},i.prototype.uploadEReviewAttachments=function(n){var t=this,u,r,i,f;if(t.setFlowOptions(!0),t.$ereviewFlow.opts.headers=t.ereviewFlowOptions.headers,u=t.ereviewFlowOptions.headers.UploadFolder,(!u||u.length===0)&&!app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2019.0.0.0")){n([]);return}r=t.ereviewAttachments.filter(function(n){return n.attachment!=null});i=t.ereviewAttachments.filter(function(n){return n.attachment===null});i.length>0?(t.setEReviewFileVersion(t.$ereviewFlow,i),t.setEReviewFileNameFileCategoryOptions(t.$ereviewFlow,i),t.isResubmitAdditionalAttachments&&t.showProgressBarDialogForResubmit(i),t.fileUploadService.uploadFiles(t.$ereviewFlow,i,function(i){t.$ereviewFlow.files=[];t.$files=[];r.length>0&&!t.isResubmitAdditionalAttachments?t.processExistingEReviews(r).then(function(t){angular.forEach(t,function(n){i.push(n.attachment)});n(i)}):n(i)})):r.length>0?(f=[],t.processExistingEReviews(r).then(function(t){angular.forEach(t,function(n){f.push(n.attachment)});n(f)})):n([])},i.prototype.isERProjectSaveSupported=function(){return app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2022.0.0.0")||app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2021.1.3.100")&&app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2021.2.0.0",!0)?!0:!1},i.prototype.getERProjectSystemStatusID=function(t){if(t.AllowFileUpload)return n.EReview.Enums.ERProjectSystemStatus.WaitingForFiles;for(var i=0;i<t.ERProjectFiles.length;i++)if(t.ERProjectFiles[i].AllowRevisionFileUpload)return n.EReview.Enums.ERProjectSystemStatus.WaitingForFiles;return n.EReview.Enums.ERProjectSystemStatus.SubmitteForReview},i.prototype.updateEReviewProjectModel=function(t,i){var r=this;return t?(i.ERProjectFiles===null&&(i.ERProjectFiles=[]),t.forEach(function(t){var u=[],f=t.FileName,e=r.fileUploadService.returnNameWithoutVersion(f,"_v1"),o={EProjectFileProjectFileCategoryID:null,ERProjectFileCategoryID:t.ERProjectFileCategoryId,ERProjectFileCategoryName:"",IsNew:!0,IsDeleted:!1,ClientId:null};u.push({AllowViewCorrection:!1,ClientId:"",ERProjectFileStatusID:"",ERProjectFileSystemStatusID:n.EReview.Enums.ERProjectFileSystemStatus.UnderReview,ERProjectFileVersionID:"",FileVersion:1,IsDeleted:!1,IsNew:!0,Latest:!0,Locked:!1,SaveFileName:t.FileName,IsFileSecure:t.IsFileSecure,TempUploadFolderName:i.ERProjectID,Submitted:!0,Comments:"",SystemtaskId:null,MarkDelete:!1,Pending:!1,CreateDate:new Date,StatusName:"",FileStatusName:"",ThumbnailUrl:"",FileMarkups:null,SubmittalID:"",NeedAttention:!1});i.ERProjectFiles.push({AllowRevisionFileUpload:!1,ERProjectFileID:"",FileName:e,FileCategories:[t.ERProjectFileCategoryId],ClientId:"",ERProjectFileVersions:u,EProjectFileVersionList:u,FileCategoryXRefList:[],EAttachedCategories:[o],IsApplyOnline:!0,IsDeleted:!1,IsNew:!0,NextFileVersion:1,Pending:!1,Categories:null,LatestVersion:null});i.EProjectFiles=i.ERProjectFiles}),i.ERProjectSystemStatusID=r.getERProjectSystemStatusID(i),i):i},i.prototype.setFlowOptions=function(n){n===void 0&&(n=!1);var t=this,i=t.globalService.tylerIdEnabled?t.authUtils.getTylerIdToken():"";n?(t.ereviewFlowOptions.headers.UploadProvider="ereview",t.ereviewFlowOptions.headers.tenantId=t.globalService.tenantId,t.ereviewFlowOptions.headers["Tyler-TenantUrl"]=t.globalService.tenantUrl,t.ereviewFlowOptions.headers["Tyler-Tenant-Culture"]=t.globalService.culture,t.globalService.tylerIdEnabled&&(t.ereviewFlowOptions.headers.Authorization="Bearer "+i.access_token)):(t.attachmentFlowOptions.headers.UploadProvider="attachment",t.attachmentFlowOptions.headers.tenantId=t.globalService.tenantId,t.attachmentFlowOptions.headers["Tyler-TenantUrl"]=t.globalService.tenantUrl,t.attachmentFlowOptions.headers["Tyler-Tenant-Culture"]=t.globalService.culture,t.globalService.tylerIdEnabled&&(t.attachmentFlowOptions.headers.Authorization="Bearer "+i.access_token))},i.prototype.setExtReviewIntegrationTypeInfo=function(t,i,r){r===void 0&&(r=null);var u=this,f=u.$q.defer(),e=app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2024.3.0.0");return e&&i&&t?u.eReviewsService.getExtReviewIntegrationTypeInfo(t,function(t){t.Success===!0&&(u.extReviewIntegrationTypeInfo=t.Result,r&&(u.extReviewIntegrationTypeInfo.DigEplanIFrameUrl=r.trustAsResourceUrl(t.Result.DigEplanIFrameUrl)),u.showDigEplanIFrame=u.extReviewIntegrationTypeInfo.ExtReviewIntegrationType===n.EReview.Enums.ExtReviewIntegrationType.DigEplan&&u.extReviewIntegrationTypeInfo.ExtReviewIntegrationSubType===n.EReview.Enums.ExtReviewIntegrationSubType.DigEplanPro);f.resolve()}):(u.showDigEplanIFrame=!1,f.resolve()),f.promise},i.prototype.setCaseRequestInfo=function(n){var t=this,i=t.$q.defer(),r,u;return n?(r={ERProjectId:n.ERProjectID,Module:0,SubModule:0,CaseTypeId:"",WorkClassId:"",IsApply:!1},u=app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2024.3.0.0"),n.ERProjectFiles.length==0&&u?t.eReviewsService.getCaseRequestInfo(n.ERProjectID,function(n){n.Success===!0&&(t.eReviewsService.caseRequestInfo=n.Result,t.eReviewsService.caseRequestInfo.IsApply=!0);i.resolve()}):(t.eReviewsService.caseRequestInfo=r,i.resolve())):i.resolve(),i.promise},i.prototype.setFileSubmissionStatusInfo=function(){var t=this,i=t.$q.defer(),r=app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2024.3.0.0");return!r||t.extReviewIntegrationTypeInfo&&t.extReviewIntegrationTypeInfo.ExtReviewIntegrationType!==n.EReview.Enums.ExtReviewIntegrationType.DigEplan?(t.fileSubmissionStatusInfo=null,t.showRequiredFilesCards=!0,t.showNewFilesCards=!0,t.showResubmitButtonOnCards=!0,i.resolve()):t.eReviewsService.caseRequestInfo?t.eReviewsService.getFileSubmissionStatusInfo(t.eReviewsService.caseRequestInfo,function(r){t.showRequiredFilesCards=!1;t.eReviewsService.hasFilesThatNeedsResubmission||(t.showNewFilesCards=!0);t.showResubmitButtonOnCards=!0;t.showSubmissionMessage=!1;r.Success===!0&&(t.fileSubmissionStatusInfo=r.Result);t.fileSubmissionStatusInfo&&t.fileSubmissionStatusInfo.SubmissionStatus===n.EReview.Enums.FileSubmissionStatus.Submission_In_Progress&&(t.showResubmitButtonOnCards=!1,t.showSubmissionMessage=!0,t.showNewFilesCards=!1);i.resolve()}):(t.fileSubmissionStatusInfo=null,i.resolve()),i.promise},i.prototype.getFilteredFileTypes=function(n,t){var i=this,r,u;return t.indexOf(".*")>-1?n:(r=i.fileTypeConversionToStdExtension(n,i.stdFileTypes),u=r.split(",").filter(function(n){return t.split(",").indexOf(n)!=-1?!0:!1}),u.join())},i.prototype.fileTypeConversionToStdExtension=function(n,t,i){if(i===void 0&&(i=","),t){var r="";return angular.forEach(n.split(","),function(n){var u=t.filter(function(t){return t.FileTypeExtension===n})[0];r=u?r+"."+u.FileTypeName+i:r+n+i}),r.replace(/,\s*$/,"").toString()}return n},i.prototype.moveEReviewToDestination=function(n,t){var i=this,r=this.$q.defer(),u=[],f=[];return this.requestConfig={headers:{}},this.requestConfig.headers.UploadProvider="ereview",this.requestConfig.headers.UploadFolder=n,this.requestConfig.headers.tenantId=this.globalService.tenantId,this.requestConfig.headers["Tyler-TenantUrl"]=this.globalService.tenantUrl,this.requestConfig.headers["Tyler-Tenant-Culture"]=this.globalService.culture,angular.forEach(t,function(n){i.requestConfig.headers.FileId=n.attachment.AttachmentID;i.requestConfig.headers.FileName=n.name;var t=i.$http.put(i.globalService.baseUrl+"api/energov/ereviews/movetodestination",null,i.requestConfig).then(function(n){n&&f.push({fileId:n.data.Result.DocumentId,fileName:n.data.Result.FileName,fileSize:null,fileToken:null,modifiedDate:null})});u.push(t)}),this.$q.all(u).then(function(){r.resolve(f)}).catch(function(){r.reject(!1)}),r.promise},i.prototype.processExistingEReviews=function(n){var t=this,i=this.$q.defer(),r=[];return t.isERProjectSaveSupported()||!t.ereviewFlowOptions.headers.UploadFolder||t.ereviewFlowOptions.headers.UploadFolder.length===0?i.resolve(n):this.moveEReviewToDestination(t.ereviewFlowOptions.headers.UploadFolder,n).then(function(t){angular.forEach(n,function(n){var i=app.Core.Controllers.CoreController.findItemInArray(t,"fileName",n.name);i&&(n.attachment.AttachmentID=i.fileId);r.push(n)});i.resolve(r)}),i.promise},i.prototype.updateCaseForAttachments=function(n,t,i,r){var u=app.Common.Helpers.ModuleHelper.getModuleUpdateUrl(i),f={EntityId:n,Attachments:t,Contacts:[],ERFileSubmissionQueueID:this.eRFileSubmissionQueueID};this.http.put(u,f,function(n){return r(n.Success)})},i}();i.EnerGovAttachmentCardsService=f})(i=t.Services||(t.Services={}))})(t=n.Attachment||(n.Attachment={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){var t=this,i;this.http=n;i=this;i.getAttachmentById=function(n,i){t.http.get(t.attachmentUrl+i,function(t){t.Success&&n(t.Result)},!0)}}return n.prototype.searchByCriteria=function(){return null},n.prototype.searchByEntityId=function(n,t,i,r){return this.entityAttachmentsUrl="/energov/entity/attachments/search/entityattachments/",this.http.get(this.entityAttachmentsUrl+n+"/"+t+"/"+i,function(n){r(n)},!0)},n.prototype.getAttachmentCapFileTypes=function(n,t,i){return this.entityAttachmentsUrl="/energov/entity/attachments/search/capFileTypes/",this.http.get(this.entityAttachmentsUrl+n+"/"+t,function(n){i(n)},!0)},n.prototype.searchHistoryById=function(n,t){return this.entityAttachmentHistoryUrl="/energov/entity/attachments/search/entityattachmenthistory/",this.http.get(this.entityAttachmentHistoryUrl+n,function(n){t(n)},!1)},n}();n.EnerGovEntityAttachmentSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Attachment||(n.Attachment={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r){var u=this,e,f;for(this.totalChunks=0,this.chunkBlobs=[],this.getEmptyChunkIndexes=function(){for(var t=u,i=[],n=0;n<t.totalChunks;n++)t.chunkBlobs[n]==null&&i.push(n);return i},this.getByteRangeHeaderValue=function(n){var t=u,i=n===0?0:t.downloadConfig.chunkSize*n,r=i+t.downloadConfig.chunkSize-1;return"bytes="+i+"-"+r},this.addChunk=function(n){var t=u;u.chunkBlobs[n.chunkIndex]=n.content},this.completeDownload=function(){var n=u,i="Origin",t=n.metadata.fileName,r=t.slice(0,t.lastIndexOf(".")),e=t.slice(t.lastIndexOf(".")+1,t.length),f;if(r.slice(i.length*-1)===i&&(n.metadata.fileName=r.slice(0,r.lastIndexOf(i))+"."+e),f=new Blob(u.chunkBlobs,{type:n.contentType}),n.chunkBlobs=null,n.content=f,n.onFileComplete)n.onFileComplete(n)},this.haveAllChunksDownloaded=function(){var n=u,t=n.getEmptyChunkIndexes();return t.length<=0},this.identifier=n,this.metadata=t,this.downloadConfig=i,this.onFileComplete=r,e=Math.ceil(t.fileSize/i.chunkSize),this.totalChunks=e,f=0;f<e;f++)this.chunkBlobs[f]=null}return n}(),i;n.FileDetails=t;i=function(){function n(n,i,r,u,f,e){var o=this;this.$http=n;this.$q=i;this.$timeout=r;this.$log=u;this.globalService=f;this.utilities=e;this.routeGetInfo="/energov/attachments/metadata/";this.routeDownload="/energov/attachments/rangedownload/";this.headerFileToken="FileToken";this.headerRange="range";this.isInProgress=!0;this.failedRequests=[];this.failRetryMax=5;this.failRetryCount=0;this.downloadFile=function(n,t,i,r,u,f,e,s,h){var c=o;c.apiDownload=c.globalService.webApiBaseUrl;c.onFileStarted=r;c.onFileProgress=u;c.onFileComplete=f;c.onFileError=e;t.simultaneousDownloads=5;i={FileID:n,FileToken:"",DownloadProvider:s==="ereview"?"ereview":"attachment",FileType:s==="ereview"?"ereview":"attachment",tenantId:c.globalService.tenantId,"Tyler-TenantUrl":c.globalService.tenantUrl,"Tyler-Tenant-Culture":c.globalService.culture,AllowViewCorrection:h===!0?!0:!1};c.identifier=n;c.downloadConfig=t;c.requestConfig={headers:i};c.isInProgress=!0;c.failedRequests=[];c.failRetryCount=0;c.startDownload()};this.pauseFile=function(){var n=o;n.isInProgress=!1};this.resumeFile=function(){var n=o;if(n.fileDetails!=null)n.isInProgress=!0,n.sendBatchOfRequests(n.downloadConfig.simultaneousDownloads);else throw new Error("File details has been lost - cannot resume download.");};this.cancelFile=function(){var n=o;n.isInProgress=!1;n.fileDetails=null};this.startDownload=function(){var n=o;n.utilities.showPleaseWait();n.$http.get(n.apiDownload+n.routeGetInfo,n.requestConfig).then(function(t){var i={fileName:t.data.Result.FileName,fileToken:t.data.Result.FileToken,fileSize:t.data.Result.FileSize,modifiedDate:t.data.modifiedDate};n.onFileMetadataReceived(i)}).catch(function(t){n.utilities.hidePleaseWait(!0);var i="Failed to get file meta data for file: '"+n.identifier+"'. - ";i=t.data!=null?i+t.data.exceptionMessage:i+"(unknown error)";n.$log.error(i);n.handleError(t)})};this.onFileMetadataReceived=function(n){var i=o;if(i.$log.info("Retreived meta data for file '"+i.identifier+" (size: "+n.fileSize+" bytes)' - starting download."),i.onFileStarted)i.onFileStarted(n);if(i.fileDetails=new t(i.identifier,n,i.downloadConfig,i.onFileComplete),i.requestConfig.headers[i.headerFileToken]=n.fileToken,i.requestConfig.responseType="arraybuffer",i.onFileStarted)i.onFileStarted(i.fileDetails);i.sendBatchOfRequests(i.downloadConfig.simultaneousDownloads)};this.sendBatchOfRequests=function(n){var t=o,i,r,u;if(t.isInProgress){if(i=[],r=t.fileDetails.getEmptyChunkIndexes(),r.length<=0){for(t.failRetryCount=0;!t.fileDetails.haveAllChunksDownloaded()&&t.failRetryCount<=t.failRetryMax;)t.failRetryCount++,t.$timeout(function(){},750);t.fileDetails.completeDownload();t.utilities.hidePleaseWait(!0);return}r.forEach(function(r){i.length<n&&i.push(t.getDownloadChunkPromise(r,t.fileDetails))});u=r.length-i.length;t.$q.all(i).then(function(){var u=t.failedRequests.length,i;u>0&&r.length<=u?(i=new Error("File failed to download: "+t.identifier+"."),t.$log.error(i),t.handleError(i)):t.sendBatchOfRequests(n)})}};this.getDownloadChunkPromise=function(n,t){var i=o,r=i.$q.defer();return i.requestConfig.headers[i.headerRange]=t.getByteRangeHeaderValue(n),i.$http.get(i.apiDownload+"/"+i.routeDownload,i.requestConfig).then(function(u){try{var f=i.parseResponse(u);if(i.fileDetails.contentType=f.contentType,i.fileDetails.addChunk(f),i.onFileProgress)i.onFileProgress((n+1)/t.totalChunks);r.resolve(f)}catch(e){i.failedRequests.push(n);i.utilities.hidePleaseWait(!0);i.isInProgress?(r.reject(e),i.$log.error("Failed to get chunk "+n+" of file "+i.identifier+": "+e)):r.reject("Process has been paused or cancelled.")}}).catch(function(t){i.failedRequests.push(n);i.utilities.hidePleaseWait(!0);i.isInProgress?(r.reject(t),i.$log.error("Request to download chunk "+n+" of file "+i.identifier+" has failed: "+t)):r.reject("Process has been paused or cancelled.")}),r.promise};this.parseResponse=function(n){var r=o,u=n.headers("content-length"),t=n.headers("content-range").replace("bytes ",""),i=Number(t.split("-")[0]);return{contentLength:Number(u),contentRangeStart:i,contentRangeEnd:Number(t.split("-")[1].split("/")[0]),contentTotalSize:Number(t.split("/")[1]),chunkIndex:Math.ceil(i/r.downloadConfig.chunkSize),content:new Blob([n.data]),contentType:n.headers("content-type")}};this.handleError=function(n){var t=o;if(t.onFileError)t.onFileError(n)}}return n}();n.FileDownloadService=i})(t=n.Services||(n.Services={}))})(t=n.Attachment||(n.Attachment={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t){this.globalService=n;this.$timeout=t}return n.prototype.updateFileUploadProgress=function(n,t,i,r){var f=this,u=this.fileProgressList.filter(function(i){var r=i.FileName,u;return n.opts.headers.UploadProvider==="ereview"&&(u="_v1",r=f.returnNameWithoutVersion(i.FileName,u)),r===t.name&&i.UploadErrorMessage==null})[0];if(u){if(r){t.pause();u.UploadErrorMessage=r;u.Percentage=0;return}u.Percentage=Math.round(t.progress(!0)*100)}},n.prototype.uploadFiles=function(n,t,i){function o(f,e,o){var h=JSON.parse(e).Result,s,c;if(h&&h.Status==2){r.updateFileUploadProgress(n,f,o,"Attachment not uploaded properly");return}if(h==null&&JSON.parse(e).Success==!1||JSON.parse(e).ErrorMessage){r.updateFileUploadProgress(n,f,o,JSON.parse(e).ErrorMessage);return}app.Core.Controllers.CoreController.findItemInArray(u,"FileName",h.FileName)||(s={},s.AttachmentID=h.DocumentId,s.FileName=h.FileName,s.IsNew=!0,s.IsOnline=!0,s.ThumbnailUrl=h.ThumbnailUrl,f.flowObj.opts.headers.UploadProvider=="attachment"&&(s.FilePath=JSON.parse(h.Metadata).RelativePath),f.flowObj.opts.headers.UploadProvider=="ereview"&&(s.IsFileSecure=h.IsFileSecure),angular.forEach(t,function(n){var t=r.returnNameWithoutVersion(n.file.name,"_v1");t==s.FileName&&(n.attachment=s,s.Notes=n.fileType,s.ERProjectFileCategoryId=n.ERProjectFileCategoryId)}),u.push(s),t.length===u.length&&(c=r.fileProgressList.filter(function(n){return n.Percentage!=100}),c.length==0&&r.$timeout(function(){angular.element("#AttachmentUploadProgressModal").modal("hide")},1e3),i(u)))}function s(t,i){var u=r.fileProgressList.filter(function(i){var u=i.FileName;return n.opts.headers.UploadProvider==="ereview"&&(u=r.returnNameWithoutVersion(i.FileName,"_v1")),u===t.name&&i.UploadErrorMessage==null});u.length&&t.error&&(t.pause(),u.forEach(function(n){n.UploadErrorMessage||(n.UploadErrorMessage="Error uploading file - "+i,n.Percentage=0)}))}function h(t,i){var u;i.message()!=null&&i.message()!=""&&JSON.parse(i.message()).Success==!1&&(u=JSON.parse(i.message()).ErrorMessage);r.updateFileUploadProgress(n,t,i,u)}for(var e,r=this,u=[],f=0;f<t.length;f++)t[f].file==null&&t[f].attachment!=null&&u.push(t[f].attachment);if(e=n.opts.headers.FileNameFileCategory,n!=undefined&&n!=null){n.off("fileSuccess");n.on("fileSuccess",function(n,t,i){o(n,t,i)});n.on("fileError",function(n,t){s(n,t)});n.off("fileProgress");n.on("fileProgress",function(n,t){h(n,t)});n.files.length>0?n.opts.headers.UploadProvider==="attachment"?(angular.element("#AttachmentUploadProgressModal").modal("show"),n.upload()):n.opts.headers.UploadProvider==="ereview"&&(n.files=[],angular.element("#AttachmentUploadProgressModal").modal("show"),t.forEach(function(t,i){r.$timeout(function(){n.opts.headers.FileNameFileCategory=JSON.stringify(e);n.addFile(t.file.file);t.ereviewProjectFile&&t.ereviewProjectFile.NextFileVersion>1&&n.files.length>0&&(n.files[i].name=t.file.name);n.upload()})})):i(u)}},n.prototype.returnNameWithoutVersion=function(n,t){return n.indexOf(t)!==-1?n.substring(0,n.lastIndexOf(t))+n.substring(n.lastIndexOf(t)+t.length,n.length):n},n.prototype.clean=function(){this.fileProgressList=[]},n}();n.FileUploadService=t})(t=n.Services||(n.Services={}))})(t=n.Attachment||(n.Attachment={}))}(EnerGov||(EnerGov={}));__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(i){"use strict";var r=app.Common.Helpers.VersionSupport,u=app.Common.SelfServiceModules,f=function(i){function f(n,r,u,f,e,o,s,h,c,l,a,v,y,p,w){var b=i.call(this,n,r,u,f,e,c,l,o,h,a,s)||this,k;return b.$routeParams=n,b.userService=r,b.$location=u,b.globalService=f,b.enerGovAttachmentCardsService=e,b.eReviewsService=o,b.enerGovAttachmentsSearchService=s,b.fileUploadService=h,b.$q=c,b.$scope=l,b.$timeout=a,b.tenantSettingService=y,b.eReviewEntityResponseService=p,b.attachmentCommonCardService=w,b.showResponseButton=!1,b.processingSaveResponse=!1,b.isSubmit=!1,b.uploadSuccessful=!1,b.isAttachmentUploaded=!1,b.isApiCallCompleted=!1,b.attachmentType=t.Models.AttachmentType,b.fileNames="",b.isMultipleFiles=!1,b.sortingData=!1,b.showCaseAttachmentNotes=!1,k=b,k.moduleId=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(b.$location,b.$routeParams.id),k.enerGovAttachmentCardsService.attachmentInitialSortDefer=k.$q.defer(),k.enerGovAttachmentCardsService.attachmentInitialSortPromise=k.enerGovAttachmentCardsService.attachmentInitialSortDefer.promise,v.getEntityRecordSortSecondaryData(function(n){k.sortList=n.Result.EntityAttachmentCardsSortList;k.sortProperty=n.Result.EntityAttachmentCardsSortList[0].Value;k.enerGovAttachmentCardsService.attachmentInitialSortProperty=k.sortProperty;k.enerGovAttachmentCardsService.attachmentInitialSortDefer.resolve()}),k.eReviewsService.isAllowedFileRevisionUploadPresent=!1,k.eReviewsService.isFileNeedsAttention=!1,r.isUserLoggedIn&&k.enerGovAttachmentCardsService.getHasAuthorizedContactSetting(k.moduleId.toString(),k.entityId),k.selectFilterHistory="SaveFileName",k.selectFilter="SaveFileName",k.eReviewsService.getEnergovEreviewConfirmMessageSetting(function(n){k.ereviewConfirmMessage=n}),k.eReviewsService.isEReviewCaseTypeDefer&&k.eReviewsService.isEReviewCaseTypeDefer.resolve(),k.getShowCaseAttachmentNoteSetting(),k.tenantSettingService.getSoftwarePackageSetting("EReviewAllowResponses",function(n){k.showResponseButton=n&&n.SettingValue==="true"}),b}return __extends(f,i),f.prototype.Cancelupload=function(){this.isSubmit=!1},f.prototype.removeEReviewFileVersion=function(n,t,i){var r=this;i.resubmitFile=null;n.removeFile(n.files[0])},Object.defineProperty(f.prototype,"displayCategorySubmission",{get:function(){return app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2022.2.0.0")&&this.enerGovAttachmentCardsService.isFileCategory},enumerable:!0,configurable:!0}),f.prototype.removeClass=function(){angular.element("#fileTypeSelect").removeClass("border-dropdown");this.enerGovAttachmentCardsService.filesDropDown=this.enerGovAttachmentCardsService.filesDropDown.filter(function(n){return n.Id!="0"})},f.prototype.showPopup=function(n,t){var i=this,r;i.validateType();r=i.enerGovAttachmentCardsService.cards.filter(function(n){return n.ereviewProjectFile&&n.ereviewProjectFile.AllowRevisionFileUpload&&n.type==1&&n.fileType==i.enerGovAttachmentCardsService.selectedFileType.Name});r.length>0&&(t.stopPropagation(),t.preventDefault(),r.length>1&&(this.isMultipleFiles=!0),this.fileNames=r.map(function(n){return n.name}).join(", "),angular.element("#uploadConfermationPopup").modal("show"),i.setNewFocus("#popup-title-uploadInstruction",300))},f.prototype.closeModal=function(){angular.element("#uploadConfermationPopup").modal("hide")},f.prototype.continueModal=function(){var n=this;n.closeModal()},f.prototype.getFileSet=function(){var n=this,t=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id);if(app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2019.0.0.0"))return n.isFileSetPromiseInProgress=!0,this.eReviewsService.getFileSetByEntityId(n.$routeParams.id,t,function(t){t.Success==!0&&(n.enerGovAttachmentCardsService.fileSetInfo=t.Result,n.isFileSetPromiseInProgress=!1)});n.isFileSetPromiseInProgress=!1},f.prototype.getFileMarkups=function(n,t){var i=this,r;i.focusedElement=t.target.id;i.selectedFileforMarkups=n;i.selectedFileforMarkupsCopy=angular.copy(n);angular.element("#fileMarkupPopup").modal("show");r=angular.element("#popup-title-file-markup")[0];r&&this.$timeout(function(){r.focus()},300)},f.prototype.modalClose=function(){var t=this,n=angular.element("#"+t.focusedElement);n&&this.$timeout(function(){return n.focus()},300)},f.prototype.sortFieldFile=function(n){var i=this,t;n==="file"?(t=i.selectFilter,i.erProject.ERProjectFiles.sort(function(n,i){return t==="FileVersion"?parseFloat(n.LatestVersion[t])-parseFloat(i.LatestVersion[t]):t==="Categories"?n[t].localeCompare(i[t]):t==="AllowViewCorrection"?n.LatestVersion[t].toString().localeCompare(i.LatestVersion[t].toString()):n.LatestVersion[t].localeCompare(i.LatestVersion[t])})):n==="history"?(t=i.selectFilterHistory,i.selectedFileHistory.ERProjectFileVersions.sort(function(n,i){return t==="FileVersion"?parseFloat(n[t])-parseFloat(i[t]):t==="AllowViewCorrection"?n[t].toString().localeCompare(i[t].toString()):n[t].localeCompare(i[t])})):n==="attachmenthistory"&&(t=i.selectFilterHistory,i.selectedAttachmentHistory.ERProjectFileVersions.sort(function(n,i){return t==="FileVersion"?parseFloat(n[t])-parseFloat(i[t]):t==="AllowViewCorrection"?n[t].toString().localeCompare(i[t].toString()):n[t].localeCompare(i[t])}))},f.prototype.isNewFileAddedToUpload=function(){var n=this,t=!1;return angular.forEach(n.enerGovAttachmentCardsService.ereviewAttachments,function(n){!t&&n.$resubmitFlow!==undefined&&n.$resubmitFlow!==null&&n.$resubmitFlow.files.length>0&&(t=!0)}),t||n.enerGovAttachmentCardsService.$ereviewFlow!==undefined&&n.enerGovAttachmentCardsService.$ereviewFlow.files.length>0||n.enerGovAttachmentCardsService.$attachmentFlow!==undefined&&n.enerGovAttachmentCardsService.$attachmentFlow.files.length>0},f.prototype.getExistingAttachments=function(){var n=this,t;return n.$routeParams.id&&(n.entityId=n.$routeParams.id),n.moduleId=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id),t=r(this.globalService.enerGovAPIVersion,"2019.0.0.0")?"true":"false",this.enerGovAttachmentsSearchService.searchByEntityId(n.entityId,n.moduleId.toString(),t,function(t){n.existingAttachmentsResult(t)})},f.prototype.existingAttachmentsResult=function(n){var i=this,t;n.StatusCode==app.Common.Services.HttpStatusCode.PreconditionFailed?this.setErrorMessage(n.ErrorMessage):(t=n.Result.Attachments,this.enerGovAttachmentCardsService.uploadedFileCatgories=n.Result.UploadedFileCategories,this.setAdditionalAttachmentProperties(t),t.forEach(function(n){i.setAttachmentsModel(n)}))},f.prototype.setAdditionalAttachmentProperties=function(n){n!==null&&n.length>0&&(this.isAttachmentUploaded=n[0].IsShowUploadMessage)},f.prototype.setErrorMessage=function(n){var t=this;t.errorMessage=n},f.prototype.setAttachmentsModel=function(t){var u=this,i="Attachment";r(this.globalService.enerGovAPIVersion,"2019.0.0.0")&&t.FileCategoryNames!=null&&t.FileCategoryNames.length>0&&(i=t.FileCategoryNames);u.enerGovAttachmentCardsService.fileAttachments.push({name:t.FileName,fileType:i,file:null,size:null,type:n.Attachment.Models.AttachmentType.Attachment,attachment:t,cssFileName:t.FileName,createdDate:t.AddedOn,needsAction:!1,erProjectFileVersionId:t.ERProjectFileVersionId})},f.prototype.getCAPFileTypes=function(){var n=this,t=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id);return this.enerGovAttachmentsSearchService.getAttachmentCapFileTypes(n.$routeParams.id,t,function(t){t.Success==!0&&(n.enerGovAttachmentCardsService.attachmentsFileTypes=t.Result)})},f.prototype.closeMessageDiv=function(){this.uploadSuccessful=!1},f.prototype.showAttachmentCard=function(){var n=this;return!n.enerGovAttachmentCardsService.isResubmitAdditionalAttachments||n.isFileSetPromiseInProgress===!0||n.isFileSetPromiseInProgress===undefined&&n.getFileSetInfoPromise!==undefined||n.enerGovAttachmentCardsService.filesDropDown.length===0&&n.eReviewsService.disallowAttachmentAfterApplication&&n.moduleId!=u.Inspection?!1:n.enerGovAttachmentCardsService.fileSetInfo!==null&&n.enerGovAttachmentCardsService.filesDropDown.length>0&&(n.enerGovAttachmentCardsService.hasAuthorizedContactForAttachment||n.enerGovAttachmentCardsService.hasAuthorizedContact)||n.enerGovAttachmentCardsService.fileSetInfo===null&&(n.enerGovAttachmentCardsService.hasAuthorizedContactForAttachment||n.enerGovAttachmentCardsService.hasAuthorizedContact)},f.prototype.getShowCaseAttachmentNoteSetting=function(){var n=this;n.tenantSettingService.getSoftwarePackageSetting("ShowCaseAttachmentNotes",function(t){n.showCaseAttachmentNotes=t&&t.SettingValue==="true"})},f}(n.Common.Controllers.EnerGovAttachmentBaseController);i.EnerGovAdditionalAttachmentController=f})(i=t.Controllers||(t.Controllers={}))})(t=n.Attachment||(n.Attachment={}))}(EnerGov||(EnerGov={}));__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){"use strict";var i=function(n){function t(t,i,r,u,f,e,o,s,h,c,l){var a=n.call(this,t,i,r,u,f,e,o,s,h,c)||this,v;return a.$routeParams=t,a.userService=i,a.$location=r,a.globalService=u,a.enerGovAttachmentCardsService=f,a.$q=e,a.$scope=o,a.eReviewsService=s,a.fileUploadService=h,a.$timeout=c,a.attachmentCommonCardService=l,a.displaySize=function(n){return n>1048576?(Math.round(n*100/1048576)/100).toString()+" MB":(Math.round(n*100/1024)/100).toString()+" KB"},v=a,a.showAdditionalCard=function(){return v.enerGovAttachmentCardsService.fileSetInfo===null&&v.enerGovAttachmentCardsService.fileAttachments.length>=v.enerGovAttachmentCardsService.requiredFileCards.length||v.enerGovAttachmentCardsService.filesDropDown.length>0},a.enerGovAttachmentCardsService.hideActionColumnOnSummary=!1,v.$scope.$watchCollection("vm.enerGovAttachmentCardsService.cards",v.attachmentCommonCardService.loadDataForCards),a}return __extends(t,n),t.prototype.openShowFilesModalOnAttachments=function(n,t){this.attachmentCommonCardService.openShowFilesModal(n,t)},t.prototype.openCaseSubmissionStatusPopup=function(n,t){this.attachmentCommonCardService.openCaseSubmissionStatusPopup(n,t)},t.prototype.setSelectedFileType=function(){var n=this;n.enerGovAttachmentCardsService.filesDropDown.length>0?(n.enerGovAttachmentCardsService.filesDropDown=_.sortBy(n.enerGovAttachmentCardsService.filesDropDown,function(n){return n.Name.toLowerCase()}),n.enerGovAttachmentCardsService.selectedFileType=n.enerGovAttachmentCardsService.filesDropDown[0]):n.enerGovAttachmentCardsService.selectedFileType=null},t}(n.Common.Controllers.EnerGovAttachmentBaseController);t.EnerGovAttachmentController=i})(t=n.Attachment||(n.Attachment={}))}(EnerGov||(EnerGov={}));__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(i){"use strict";var r=app.Core.Controllers.CoreController,u=app.Common.Helpers.VersionSupport,f=app.Common.SelfServiceModules,e=function(i){function e(n,r,u,f,e,o,s,h,c,l,a,v,y,p,w){var b=i.call(this,n,r,u,f,e,c,l,o,h,a,s)||this,k;return b.$routeParams=n,b.userService=r,b.$location=u,b.globalService=f,b.enerGovAttachmentCardsService=e,b.eReviewsService=o,b.enerGovAttachmentsSearchService=s,b.fileUploadService=h,b.$q=c,b.$scope=l,b.$timeout=a,b.entitySecondaryDataService=v,b.tenantSettingService=y,b.eReviewEntityResponseService=p,b.entityTabsService=w,b.selectedNonCategoryFileHistory=[],b.selectedFileforNonCategoryMarkups=[],b.selectedFileforNonCategoryMarkupsCopy=[],b.showResponseButton=!1,b.processingSaveResponse=!1,b.isSubmit=!1,b.uploadSuccessful=!1,b.isAttachmentUploaded=!1,b.isApiCallCompleted=!1,b.attachmentType=t.Models.AttachmentType,b.fileNames="",b.isMultipleFiles=!1,b.sortingData=!1,b.showCaseAttachmentNotes=!1,b.isChromeiOS=!1,b.submissionFilesInfo=null,b.isFileCategory=!1,b.getFileCategoryValueComplete=!1,b.areAttachmentsInProcess=!1,b.isBusy=!1,b.entityAttachmentsPromise=null,b.getAttachmentUploadPromise=function(){var n=b,t=n.$q.defer();return n.enerGovAttachmentCardsService.$attachmentFlow.files.length>0?n.enerGovAttachmentCardsService.uploadFileAttachments(function(i,r){n.updateCaseForAttachments(r,function(){t.resolve()})}):(n.isAttachmentUploaded=!1,t.resolve()),t.promise},b.getEReviewsUploadedPromise=function(){var n=b,t=n.$q.defer();return b.enerGovAttachmentCardsService.$ereviewFlow.files.length>0?n.enerGovAttachmentCardsService.uploadEReviewAttachments(function(i){n.enerGovAttachmentCardsService.updateEReviewProjectModel(i,n.erProject);var r=n.eReviewsService.resubmitEReview(n.erProject,function(i){n.setEReviewProjectModel(i);t.resolve()})}):t.resolve(),t.promise},b.cards=[],k=b,$(window).off("beforeunload"),k.CheckIsChromeiOS(),k.enerGovAttachmentCardsService.isResubmitAdditionalAttachments=!1,k.moduleId=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(b.$location,b.$routeParams.id),k.enerGovAttachmentCardsService.attachmentInitialSortDefer=k.$q.defer(),k.enerGovAttachmentCardsService.attachmentInitialSortPromise=k.enerGovAttachmentCardsService.attachmentInitialSortDefer.promise,v.getEntityRecordSortSecondaryData(function(n){k.sortList=n.Result.EntityAttachmentCardsSortList;k.sortProperty=n.Result.EntityAttachmentCardsSortList[0].Value;k.enerGovAttachmentCardsService.attachmentInitialSortProperty=k.sortProperty;k.enerGovAttachmentCardsService.attachmentInitialSortDefer.resolve()}),k.eReviewsService.isAllowedFileRevisionUploadPresent=!1,k.eReviewsService.isFileNeedsAttention=!1,r.isUserLoggedIn&&k.enerGovAttachmentCardsService.getHasAuthorizedContactSetting(k.moduleId.toString(),k.entityId),k.selectFilterHistory="SaveFileName",k.selectFilter="SaveFileName",k.selectFilterHistoryNonCategory="SaveFileName",k.eReviewsService.getEnergovEreviewConfirmMessageSetting(function(n){k.ereviewConfirmMessage=n}),k.getShowCaseAttachmentNoteSetting(),k.tenantSettingService.getSoftwarePackageSetting("EReviewAllowResponses",function(n){k.showResponseButton=n&&n.SettingValue==="true"}),b.entityAttachmentsPromise=k.$q.defer(),b.entitySecondaryDataService.setEReviewPromise(b.entityAttachmentsPromise),k.eReviewsService.isEReviewCaseType||k.getAttachmentsInfo(),b}return __extends(e,i),Object.defineProperty(e.prototype,"fileProgressListCount",{get:function(){return this.enerGovAttachmentCardsService.fileProgressList?this.enerGovAttachmentCardsService.fileProgressList.length:0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"displayCategorySubmission",{get:function(){return app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2022.2.0.0")&&this.enerGovAttachmentCardsService.isFileCategory},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"categories",{get:function(){return this.submissionFilesInfo&&this.submissionFilesInfo.IsCategoryView?this.submissionFilesInfo.CategorySummary.Categories:[]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"categoryAttachments",{get:function(){return this.submissionFilesInfo&&this.submissionFilesInfo.IsCategoryView?this.submissionFilesInfo.CategorySummary.Attachments:[]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"showNonCategoryCards",{get:function(){return this.getFileCategoryValueComplete&&!this.isFileCategory&&this.enerGovAttachmentCardsService.hasAuthorizedContact&&this.submissionFilesInfo!==null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isApplicableForNonCategory",{get:function(){return app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2022.3.0.0")&&this.submissionFilesInfo&&this.submissionFilesInfo.FileSummary&&this.submissionFilesInfo.FileSummary.Files&&this.submissionFilesInfo.FileSummary.Files.length>0&&!this.isFileCategory},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"showResubmitMessage",{get:function(){return this.isApplicableForNonCategory?this.enerGovAttachmentCardsService.nonCategoryCards.some(function(n){return!n.AttachmentId&&n.AllowResubmission}):this.isFileCategory?this.categories.some(function(n){return n.HasFilesThatNeedResubmission}):this.eReviewsService.isAllowedFileRevisionUploadPresent},enumerable:!0,configurable:!0}),e.prototype.submitclick=function(n){var t=this,i;this.displayCategorySubmission?(i=this.enerGovAttachmentCardsService.getSubmissionQueueInfo(),this.enerGovAttachmentCardsService.createFileSubmissionQueue(i,this.moduleId,function(i,r){r&&(t.enerGovAttachmentCardsService.fileAttachments.filter(function(n){return n.isNewlyUploaded==!0}).length>0&&t.enerGovAttachmentCardsService.$attachmentFlow.files.length>0&&t.uploadAttachments(n),t.afterSubmitRefreshAttchments())}),this.enerGovAttachmentCardsService.fileAttachments.length>0&&this.enerGovAttachmentCardsService.ereviewAttachments.length==0&&this.enerGovAttachmentCardsService.$attachmentFlow.files.length>0&&this.uploadAttachments(n)):this.enerGovAttachmentCardsService.$ereviewFlow.files.length>0?(this.isSubmit=!0&&this.eReviewsService.isApplySubmitForReviewRule,this.eReviewsService.isApplySubmitForReviewRule||this.uploadAttachments(n)):this.enerGovAttachmentCardsService.$attachmentFlow.files.length>0&&this.uploadAttachments(n)},e.prototype.afterSubmitRefreshAttchments=function(){this.uploadSuccessful=!0;this.refreshCardAfterSubmit();this.isSubmit=!1},e.prototype.Cancelupload=function(){this.isSubmit=!1},e.prototype.removeEReviewFileVersion=function(n,t,i){var r=this;i.resubmitFile=null;n.removeFile(n.files[0])},e.prototype.removeClass=function(){angular.element("#fileTypeSelect").removeClass("border-dropdown");this.enerGovAttachmentCardsService.filesDropDown=this.enerGovAttachmentCardsService.filesDropDown.filter(function(n){return n.Id!="0"})},e.prototype.showPopup=function(n,t){var i=this,r;i.validateType();r=i.enerGovAttachmentCardsService.cards.filter(function(n){return n.ereviewProjectFile&&n.ereviewProjectFile.AllowRevisionFileUpload&&n.type==1&&n.fileType==i.enerGovAttachmentCardsService.selectedFileType.Name});r.length>0&&(t.stopPropagation(),t.preventDefault(),r.length>1&&(this.isMultipleFiles=!0),this.fileNames=r.map(function(n){return n.name}).join(", "),angular.element("#uploadConfermationPopup").modal("show"),i.setNewFocus("#popup-title-uploadInstruction",300))},e.prototype.closeModal=function(){angular.element("#uploadConfermationPopup").modal("hide")},e.prototype.continueModal=function(){var n=this;n.closeModal()},e.prototype.showAdditionalCard=function(){return this.enerGovAttachmentCardsService.fileAttachments.length>=this.enerGovAttachmentCardsService.requiredFileCards.length||this.enerGovAttachmentCardsService.attachmentsFileTypes.length>0||this.eReviewsService.isAllowFileUpload},e.prototype.addEReviewFileVersion=function(n,t,i,u){var e,f,o,s;for(this.enerGovAttachmentCardsService.filesDropDown.filter(function(n){return n.AttachmentType!=1}).length,e=this,t=n.flowobj,f=t.files[0],o=0;o<e.enerGovAttachmentCardsService.ereviewAttachments.length;o++)if(e.enerGovAttachmentCardsService.ereviewAttachments[o].name==u.name){s="";u.ereviewProjectFile.FileCategoryXRefList.forEach(function(n){s+=n.AllowedFileTypes+","});s.match(f.getType())&&r.isNotNullEmptyUndefined(f.getType())||s.match(f.getExtension())&&r.isNotNullEmptyUndefined(f.getExtension())||s.indexOf(".*")>-1&&r.isNotNullEmptyUndefined(f.getExtension())?(f.name=e.enerGovAttachmentCardsService.getFileNameWithVersion(f.name,u.ereviewProjectFile.NextFileVersion),u.ereviewProjectFile.RevisionFileName=f.name,e.enerGovAttachmentCardsService.ereviewAttachments[o].resubmitFile={FileName:f.name,size:0},this.notSupportedFiles=[]):(this.notSupportedFiles.push(f.name),t.removeFile(f));break}},e.prototype.getFileSet=function(){var n=this,t=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id);if(app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2019.0.0.0"))return n.isFileSetPromiseInProgress=!0,this.eReviewsService.getFileSetByEntityId(n.$routeParams.id,t,function(t){t.Success==!0&&(n.enerGovAttachmentCardsService.fileSetInfo=t.Result,n.isFileSetPromiseInProgress=!1)});n.isFileSetPromiseInProgress=!1},e.prototype.showFilesClicked=function(n){var t=this,i;if(n.TotalNumberOfFiles==0){this.enerGovAttachmentCardsService.categoryEreviewFiles=[];this.openShowFilesModal(n.Name,"showFilesModalId");return}i={SubmittalModule:this.moduleId,CaseId:this.entityId,CategoryId:n.CategoryId,PageNumber:1,PageSize:n.TotalNumberOfFiles,SortField:"fileName"};this.eReviewsService.getEReviewSingleCategoryInfoByCriteria(i,function(i){t.enerGovAttachmentCardsService.categoryEreviewFiles=i.Result;t.openShowFilesModal(n.Name,"showFilesModalId")})},e.prototype.openShowFilesModal=function(n,t){this.enerGovAttachmentCardsService.currentEreviewPopupTitle=n;$("#"+t).modal("show")},e.prototype.getFileMarkups=function(n,t){var i=this,r;i.focusedElement=t.target.id;i.selectedFileforMarkups=n;i.selectedFileforMarkupsCopy=angular.copy(n);angular.element("#fileMarkupPopup").modal("show");r=angular.element("#popup-title-file-markup")[0];r&&this.$timeout(function(){r.focus()},300)},e.prototype.showFileMarkupsForNonCategory=function(n,t){var i=this,r,u;i.focusedElement=t.target.id;r=i.enerGovAttachmentCardsService.cards.filter(function(t){return t.ereviewProjectFile&&t.ereviewProjectFile.ERProjectFileID===n.EReviewProjectFileId})[0].ereviewProjectFile;i.selectedFileforMarkups=r;i.selectedFileforMarkupsCopy=angular.copy(r);n.FileMarkups.forEach(function(n){return n.Author=n.AuthorDisplayName});i.selectedFileforNonCategoryMarkups=n.FileMarkups;i.selectedFileforNonCategoryMarkupsCopy=angular.copy(n.FileMarkups);angular.element("#fileMarkupPopup").modal("show");u=angular.element("#popup-title-file-markup")[0];u&&this.$timeout(function(){u.focus()},300)},e.prototype.isDataForUpdateAvailable=function(n){var i=!0,t=this;return t.selectedFileforMarkupsCopy&&angular.forEach(t.selectedFileforMarkupsCopy.LatestVersion.FileMarkups,function(n){if(i){var r=t.selectedFileforMarkups.LatestVersion.FileMarkups.filter(function(t){return t.ERFileMarkupId==n.ERFileMarkupId})[0];n.Response&&(!n.Response.ResponseID&&n.Response.UserResponse||n.Response.ResponseID)&&(r.Response==null&&n.Response.UserResponse||n.Response.UserResponse!==r.Response.UserResponse)&&(i=!1)}}),t.isApplicableForNonCategory&&n&&t.selectedFileforNonCategoryMarkups&&angular.forEach(t.selectedFileforNonCategoryMarkupsCopy,function(n){if(i){var r=t.selectedFileforNonCategoryMarkups.filter(function(t){return t.ERFileMarkupId==n.ERFileMarkupId})[0];n.Response&&(!n.Response.ResponseID&&n.Response.UserResponse||n.Response.ResponseID)&&(r.Response==null&&n.Response.UserResponse||n.Response.UserResponse!==r.Response.UserResponse)&&(i=!1)}}),i},e.prototype.onMarkupDataChange=function(t){var r=this,i;!t.isFromClose&&t.data&&(i=[],angular.forEach(t.data,function(t){t.Response&&(!t.Response.ResponseID&&t.Response.UserResponse||t.Response.ResponseID)&&(t.Response.ResponseEntityID=t.ERFileMarkupId,t.Response.ResponseTypeID=t.Response.ResponseTypeID==0?n.EReview.Enums.ResponseType.Markup:t.Response.ResponseTypeID,i.push(t.Response))}),this.eReviewEntityResponseService.save(i,function(n){n.Success&&(angular.element("#markupResponseSaveSuccessPopup").modal("show"),r.enerGovAttachmentCardsService.cards.forEach(function(n){var i=n.ereviewProjectFile;i&&i.LatestVersion.FileMarkups.forEach(function(n){angular.forEach(t.data,function(t){var i=t.Response;n.Response.ResponseID?n.Response.ResponseID===i.ResponseID&&(n.Response.UserResponse=i.UserResponse):n.ERFileMarkupId===i.ResponseEntityID&&(n.Response=i)})})}))}))},e.prototype.saveResponses=function(t){var u=this,i=this,r;i.processingSaveResponse=!0;r=[];t&&(i.selectedFileforMarkupsCopy.LatestVersion.FileMarkups=angular.copy(i.selectedFileforNonCategoryMarkupsCopy));angular.forEach(i.selectedFileforMarkupsCopy.LatestVersion.FileMarkups,function(t){t.Response&&(!t.Response.ResponseID&&t.Response.UserResponse||t.Response.ResponseID)&&(t.Response.ResponseEntityID=t.ERFileMarkupId,t.Response.ResponseTypeID=t.Response.ResponseTypeID==0?n.EReview.Enums.ResponseType.Markup:t.Response.ResponseTypeID,r.push(t.Response))});this.eReviewEntityResponseService.save(r,function(n){if(n.Success){angular.element("#fileMarkupPopup").modal("hide");i.setEReviewModelAfterUpdateResponses(t);angular.element("#markupResponseSaveSuccessPopup").modal("show");var r=angular.element("#responseSaveSuccessMessageText")[0];r&&u.$timeout(function(){r.focus()},300)}i.processingSaveResponse=!1})},e.prototype.setEReviewModelAfterUpdateResponses=function(n){for(var u,f=this,t=this,r=-1,i=0;i<t.erProject.ERProjectFiles.length;i++)if(t.erProject.ERProjectFiles[i].ERProjectFileID==t.selectedFileforMarkupsCopy.ERProjectFileID){r=i;break}t.erProject.ERProjectFiles.splice(r,1,t.selectedFileforMarkupsCopy);u=t.enerGovAttachmentCardsService.ereviewAttachments.filter(function(n){return n.ereviewProjectFile!==null&&n.ereviewProjectFile.ERProjectFileID==t.selectedFileforMarkupsCopy.ERProjectFileID})[0];u.ereviewProjectFile=t.erProject.ERProjectFiles[r];n&&this.submissionFilesInfo.FileSummary.Files.forEach(function(n){n.EReviewProjectFileVersionId===t.selectedFileforMarkupsCopy.LatestVersion.ERProjectFileVersionID&&(n.FileMarkups=f.selectedFileforNonCategoryMarkupsCopy)})},e.prototype.openHistoryPopup=function(n,t){this.enerGovAttachmentCardsService.currentEreviewPopupTitle=n;$("#"+t).modal("show")},e.prototype.showNonCategoryAttachmentHistory=function(n){this.selectedNonCategoryFileHistory=angular.copy(n.History);angular.element("#historyPopupNonCategory").modal("show");this.sortFieldFile("noncategoryhistory");var t=angular.element("#popup-title-history")[0];t&&this.$timeout(function(){t.focus()},300)},e.prototype.getHistory=function(n,t){var i=this,r;i.focusedElement=t.target.id;i.selectedFileHistory=angular.copy(n);i.selectedFileHistory.ERProjectFileVersions=this.selectedFileHistory.ERProjectFileVersions.filter(function(t){return t.Categories=i.selectedFileHistory.Categories,t.ERProjectFileVersionID!==n.LatestVersion.ERProjectFileVersionID});angular.element("#historyPopup").modal("show");i.sortFieldFile("history");r=angular.element("#popup-title-history")[0];r&&this.$timeout(function(){r.focus()},300)},e.prototype.getAttachmentHistory=function(n,t){var i=this;i.focusedElement=t.target.id;i.isApiCallCompleted=!1;i.selectedAttachmentHistory=angular.copy(n);u(this.globalService.enerGovAPIVersion,"2019.0.0.0")&&this.enerGovAttachmentsSearchService.searchHistoryById(n.ERProjectFileVersionId,function(n){n.StatusCode==app.Common.Services.HttpStatusCode.PreconditionFailed?i.setErrorMessage(n.ErrorMessage):(i.selectedAttachmentHistory.ERProjectFileVersions=n.Result,i.sortFieldFile("attachmenthistory"));i.isApiCallCompleted=!0;i.setNewFocus("#attachment-popup-title-history",300)});angular.element("#attachmentHistoryPopup").modal("show");i.setNewFocus("#attachment-popup-title-history",300)},e.prototype.modalClose=function(n){n&&this.isFileCategory&&$("#showFilesModalId").modal("show");var i=this,t=angular.element("#"+i.focusedElement);t&&this.$timeout(function(){return t.focus()},300)},e.prototype.sortFieldFile=function(n){var i=this,t;n==="file"?(t=i.selectFilter,i.erProject.ERProjectFiles.sort(function(n,i){return t==="FileVersion"?parseFloat(n.LatestVersion[t])-parseFloat(i.LatestVersion[t]):t==="Categories"?n[t].localeCompare(i[t]):t==="AllowViewCorrection"?n.LatestVersion[t].toString().localeCompare(i.LatestVersion[t].toString()):n.LatestVersion[t].localeCompare(i.LatestVersion[t])})):n==="history"?(t=i.selectFilterHistory,i.selectedFileHistory.ERProjectFileVersions.sort(function(n,i){return t==="FileVersion"?parseFloat(n[t])-parseFloat(i[t]):t==="AllowViewCorrection"?n[t].toString().localeCompare(i[t].toString()):n[t].localeCompare(i[t])})):n==="attachmenthistory"?(t=i.selectFilterHistory,i.selectedAttachmentHistory.ERProjectFileVersions.sort(function(n,i){return t==="FileVersion"?parseFloat(n[t])-parseFloat(i[t]):t==="AllowViewCorrection"?n[t].toString().localeCompare(i[t].toString()):n[t].localeCompare(i[t])})):n==="noncategoryhistory"&&(t=i.selectFilterHistoryNonCategory,i.selectedNonCategoryFileHistory.sort(function(n,i){return t==="FileVersion"?parseFloat(n[t])-parseFloat(i[t]):t==="HasMarkups"?n[t].toString().localeCompare(i[t].toString()):n[t].localeCompare(i[t])}))},e.prototype.closeProgressBarDialog=function(){var n=this,t;n.enerGovAttachmentCardsService.closeProgressBarDialog();t=n.enerGovAttachmentCardsService.fileAttachments.filter(function(n){return n.attachment&&n.attachment.IsNew});t&&t.length==0?n.enerGovAttachmentCardsService.fileUploadService.fileProgressList.forEach(function(t){var i,r;t.UploadErrorMessage&&(i=n.enerGovAttachmentCardsService.fileAttachments.filter(function(n){return n.name==t.FileName}),i&&i.length>0?n.enerGovAttachmentCardsService.removeFlowAttachmentCard(i[0],!1,""):(r=n.enerGovAttachmentCardsService.ereviewAttachments.filter(function(n){return n.name==t.FileName}),r&&r.length>0&&n.enerGovAttachmentCardsService.removeFlowAttachmentCard(r[0],!1,"")))}):n.updateCaseForAttachments(t,function(){n.uploadSuccessful=!0;n.refreshCardAfterSubmit();n.isSubmit=!1})},e.prototype.isNewFileAddedToUpload=function(){var n=this,t=!1;return angular.forEach(n.enerGovAttachmentCardsService.ereviewAttachments,function(n){!t&&n.$resubmitFlow!==undefined&&n.$resubmitFlow!==null&&n.$resubmitFlow.files.length>0&&(t=!0)}),n.submissionFilesInfo&&n.submissionFilesInfo.CategorySummary&&n.submissionFilesInfo.CategorySummary.Categories&&n.submissionFilesInfo.IsCategoryView&&angular.forEach(n.enerGovAttachmentCardsService.ereviewAttachments,function(t){var r=n.submissionFilesInfo.CategorySummary.Categories.filter(function(n){return n.CategoryId==t.ERProjectFileCategoryId}),i;r.length==0&&t.ERProjectFileCategoryId&&(i={CategoryId:t.ERProjectFileCategoryId,Name:t.fileType,HasFilesThatNeedAttention:undefined,HasFilesThatNeedResubmission:undefined,CanUploadFiles:undefined,RequiresFiles:undefined,TotalNumberOfFiles:0,TotalFilesSize:0},n.submissionFilesInfo.CategorySummary.Categories.push(i))}),t||n.enerGovAttachmentCardsService.$ereviewFlow!==undefined&&n.enerGovAttachmentCardsService.$ereviewFlow.files.length>0||n.enerGovAttachmentCardsService.$attachmentFlow!==undefined&&n.enerGovAttachmentCardsService.$attachmentFlow.files.length>0},e.prototype.refreshCardAfterSubmit=function(){var n=this,i,t;n.enerGovAttachmentCardsService.fileAttachments=[];n.getExistingAttachmentsPromise=n.getExistingAttachments();n.eReviewsService.isEnerGovEReviewEnable&&n.eReviewsService.isEReviewCaseType&&(n.getExistingEReviewProjectPromise=n.getExistingEReviewProject());i=n.getEreviewSubmissionInfo();t=[];n.getExistingAttachmentsPromise&&t.push(n.getExistingAttachmentsPromise);n.getExistingEReviewProjectPromise&&t.push(n.getExistingEReviewProjectPromise);i&&t.push(i);n.$q.all(t).then(function(){var t=n.enerGovAttachmentCardsService.erProject;n.enerGovAttachmentCardsService.setCaseRequestInfo(t).then(function(){n.enerGovAttachmentCardsService.setExtReviewIntegrationTypeInfo(n.eReviewsService.caseRequestInfo,n.eReviewsService.isEReviewCaseType,null).then(function(){n.enerGovAttachmentCardsService.setFileSubmissionStatusInfo().then(function(){n.callbackDependencies(n.sortProperty);n.isAttachmentUploaded?n.setNewFocus("#upload_successful_attachment",300):n.setNewFocus("#upload_successful_ereviews",300)})})})});n.enerGovAttachmentCardsService.filesDropDown=[];n.fillFileTypesForAttachment();n.fillFileTypesForEReview();n.enerGovAttachmentCardsService.setSelectedFileType()},e.prototype.uploadAttachments=function(){var r=this,n=this,i,t;n.duplicateFiles=[];n.notSupportedFiles=[];n.uploadSuccessful=!1;n.enerGovAttachmentCardsService.showProgressBarDialog();t=this.getAttachmentUploadPromise();this.displayCategorySubmission||(i=this.getEReviewsUploadedPromise());n.$q.all([t,i]).then(function(){r.afterSubmitRefreshAttchments()})},e.prototype.updateCaseForAttachments=function(n,t){var i=this,r=[],u;i.enerGovAttachmentCardsService.attachmentsFileTypes!==null&&i.enerGovAttachmentCardsService.attachmentsFileTypes!==undefined&&i.enerGovAttachmentCardsService.attachmentsFileTypes.length>0&&(u=i.enerGovAttachmentCardsService.attachmentsFileTypes[0].AttachmentGroupID);n.forEach(function(n){var t=n.attachment;t.ParentID=i.$routeParams.id;t.AttachmentGroupID=u;r.push(t)});i.enerGovAttachmentCardsService.updateCaseForAttachments(i.$routeParams.id,r,i.moduleId,function(){i.isAttachmentUploaded=!0;t()})},e.prototype.checkForRemainingResubmitCards=function(n){var t=this;n.every(function(n){return n.AllowRevisionFileUpload===!1})&&(t.eReviewsService.isAllowedFileRevisionUploadPresent=!1)},e.prototype.addResubmitAttachment=function(n,t,i,u){var f=this;n.length!==0&&(f.duplicateFiles=[],f.notSupportedFiles=[],angular.forEach(n,function(n){var e,t;n.name!=u.name&&f.isDuplicateAttachment(n.name)?(f.duplicateFiles.push(n.name),i.removeFile(n)):(e=f.eReviewsService.ereviewsSecondaryData.ERProjectFileCategories.filter(function(n){return n.Name===u.fileType})[0].AllowedFileTypes,e.match(n.getType())&&r.isNotNullEmptyUndefined(n.getType())||e.match(n.getExtension())&&r.isNotNullEmptyUndefined(n.getExtension())||e.indexOf(".*")>-1&&r.isNotNullEmptyUndefined(n.getExtension())?(t=f.enerGovAttachmentCardsService.ereviewAttachments.filter(function(n){return n.ereviewProjectFile!==null&&n.ereviewProjectFile.ERProjectFileID==u.ereviewProjectFile.ERProjectFileID})[0],t.file=n,t.size=n.file.size,t.$resubmitFlow=i,t.file.name=f.enerGovAttachmentCardsService.getFileNameWithVersion(t.file.name,u.ereviewProjectFile.NextFileVersion)):(f.notSupportedFiles.push(n.name),i.removeFile(n)));f.setAttachmentAlertFocus()}))},e.prototype.removeResubmitAttachment=function(n){var i=this,t=i.enerGovAttachmentCardsService.ereviewAttachments.filter(function(t){return t.ereviewProjectFile!==null&&t.ereviewProjectFile.ERProjectFileID==n.ereviewProjectFile.ERProjectFileID})[0];t.$resubmitFlow.files=[];t.file=null;t.size=null},e.prototype.showProgressBarDialogForResubmit=function(n){var t=this;this.fileUploadService.clean();this.fileUploadService.fileProgressList=n.map(function(n){return{FileName:n.file.name,Percentage:0,ChunksUploaded:0}})},e.prototype.uploadResubmitAttachment=function(n){var t=this,i=[];i.push(n);t.showProgressBarDialogForResubmit(i);t.enerGovAttachmentCardsService.ereviewFlowOptions.headers.UploadFolder=t.erProject.UploadFolder;t.enerGovAttachmentCardsService.setFlowOptions(!0);t.enerGovAttachmentCardsService.$ereviewFlow.opts.headers=t.enerGovAttachmentCardsService.ereviewFlowOptions.headers;n.$resubmitFlow.opts=t.enerGovAttachmentCardsService.$ereviewFlow.opts;t.uploadSuccessful=!1;this.fileUploadService.uploadFiles(n.$resubmitFlow,i,function(i){n.$resubmitFlow.files=[];t.eReviewsFileUploadCallback(i,n.ereviewProjectFile.ERProjectFileID);t.uploadSuccessful=!0})},e.prototype.eReviewsFileUploadCallback=function(t,i){var r=this;t.forEach(function(t){r.erProject.ERProjectFiles.forEach(function(r){r.ERProjectFileID==i&&(r.LatestVersion.Latest=!1,r.LatestVersion.ERProjectFileSystemStatusID=n.EReview.Enums.ERProjectFileSystemStatus.Locked,r.AllowRevisionFileUpload=!1,r.Pending=!1,r.IsApplyOnline=!0,r.ERProjectFileVersions.push({ERProjectFileVersionID:null,ERProjectFileStatusID:"",ERProjectFileSystemStatusID:n.EReview.Enums.ERProjectFileSystemStatus.UnderReview,SaveFileName:t.FileName,IsFileSecure:t.IsFileSecure,Locked:!1,Latest:!0,AllowViewCorrection:!1,FileVersion:r.NextFileVersion,Submitted:!0,IsNew:!0,IsDeleted:!1,ClientId:null,Comments:"",SystemtaskId:null,MarkDelete:!1,Pending:!1,StatusName:"",FileStatusName:"",ThumbnailUrl:"",FileMarkups:null,SubmittalID:"",NeedAttention:!1,TempUploadFolderName:null}))})});r.erProject.ERProjectSystemStatusID=r.enerGovAttachmentCardsService.getERProjectSystemStatusID(r.erProject);r.eReviewsService.resubmitEReview(r.erProject,function(n){r.setEReviewProjectModelAfterResubmit(n,i);r.checkForRemainingResubmitCards(n.ERProjectFiles)})},e.prototype.setEReviewProjectModelAfterResubmit=function(n,t){var i=this;i.eReviewsService.getEReviewProjectByEntityId(i.entityId,i.moduleId,function(n){for(var f,e=n.Result.ERProjectFiles.filter(function(n){return n.ERProjectFileID==t})[0],r=-1,u=0;u<i.erProject.ERProjectFiles.length;u++)if(i.erProject.ERProjectFiles[u].ERProjectFileID==t){r=u;break}i.erProject.ERProjectFiles.splice(r,1,e);i.erProject.ERProjectFiles[r].ERProjectFileVersions.forEach(function(n){if(n.Latest){i.erProject.ERProjectFiles[r].LatestVersion=n;return}});f=i.enerGovAttachmentCardsService.ereviewAttachments.filter(function(n){return n.ereviewProjectFile!==null&&n.ereviewProjectFile.ERProjectFileID==t})[0];f.ereviewProjectFile=i.erProject.ERProjectFiles[r];f.file=null;f.size=null;i.isAttachmentUploaded=!1;i.sortAttachments();i.setNewFocus("#upload_successful_ereviews",300)})},e.prototype.setEReviewProjectModel=function(t,i){i===void 0&&(i=!0);var r=this;r.erProject=t;r.eReviewsService.isAllowFileUpload=r.erProject.AllowFileUpload&&r.erProject.ERProjectSystemStatusID==1?!0:!1;r.enerGovAttachmentCardsService.ereviewAttachments=[];r.enerGovAttachmentCardsService.hasAuthorizedContact=r.erProject.HasAuthorizedContact;i&&this.getEreviewSubmissionInfo();r.enerGovAttachmentCardsService.erProject=t;r.erProject.ERProjectFiles.forEach(function(t){t.AllowRevisionFileUpload&&(r.eReviewsService.isAllowedFileRevisionUploadPresent=!0);t.ERProjectFileVersions.forEach(function(n){n.Latest&&(r.eReviewsService.isFileNeedsAttention=n.NeedAttention,t.LatestVersion=n)});var i=t.LatestVersion;i&&r.enerGovAttachmentCardsService.ereviewAttachments.push({name:t.FileName,fileType:t.Categories!=""?t.Categories:r.getFileCategoryNameById(t.FileCategories),file:null,size:null,ERProjectFileCategoryId:t.FileCategories&&t.FileCategories.length?t.FileCategories[0]:null,type:n.Attachment.Models.AttachmentType.EReview,ereviewProjectFile:{AllowRevisionFileUpload:t.AllowRevisionFileUpload,Categories:t.Categories,ERProjectFileID:t.ERProjectFileID,ERProjectFileVersions:t.ERProjectFileVersions,EProjectFileVersionList:t.ERProjectFileVersions,FileCategories:t.FileCategories,FileCategoryXRefList:t.FileCategoryXRefList,EAttachedCategories:[],IsApplyOnline:t.IsApplyOnline,NextFileVersion:t.NextFileVersion,Pending:t.Pending,FileName:i.SaveFileName,IsNew:t.IsNew,ClientId:t.ClientId,IsDeleted:t.IsDeleted,LatestVersion:i},cssFileName:i.SaveFileName,createdDate:i.CreateDate,needsAction:t.AllowRevisionFileUpload&&r.enerGovAttachmentCardsService.hasAuthorizedContact?!0:!1})})},e.prototype.getFileCategoryNameById=function(n){if(n===null||n.length==0)return"";var t=this.categorylist.filter(function(t){return t.ERProjectFileCategoryId==n[0]});return t[0].Name},e.prototype.callbackDependencies=function(n){this.enerGovAttachmentCardsService.getCombinedCardsForExistingFiles(n);this.entityAttachmentsPromise.resolve()},e.prototype.getExistingEReviewProject=function(){var i=this,n=this,t=n.$q.defer();return n.moduleId=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id),this.isBusy=!0,this.eReviewsService.getEReviewProjectByEntityId(n.entityId,n.moduleId,function(r){r.StatusCode==app.Common.Services.HttpStatusCode.PreconditionFailed?n.errorMessage=r.ErrorMessage:r.Result&&(n.setEReviewProjectModel(r.Result),n.enerGovAttachmentCardsService.ereviewFlowOptions.headers.UploadFolder=n.erProject.UploadFolder,n.enerGovAttachmentCardsService.erProject=r.Result);i.isBusy=!1;t.resolve(r.Result)}),t.promise},e.prototype.disableSorting=function(){return this.newlyAddedFileExists(this.enerGovAttachmentCardsService.cards)},e.prototype.disableUpload=function(){return(this.enerGovAttachmentCardsService.$attachmentFlow.files.length>0||this.enerGovAttachmentCardsService.$ereviewFlow.files.length>0)&&this.enerGovAttachmentCardsService.requiredFileCards.filter(function(n){return n.isFilled==!1}).length===0?!1:!0},e.prototype.getExistingAttachments=function(){var n=this,t;return n.$routeParams.id&&(n.entityId=n.$routeParams.id),n.moduleId=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id),t=u(this.globalService.enerGovAPIVersion,"2019.0.0.0")?"true":"false",this.enerGovAttachmentsSearchService.searchByEntityId(n.entityId,n.moduleId.toString(),t,function(t){n.existingAttachmentsResult(t)})},e.prototype.getAttachmentsInfo=function(){var n=this;app.Common.Helpers.VersionSupport(n.globalService.enerGovAPIVersion,"2022.2.0.0")&&(n.moduleId===app.Common.SelfServiceModules.Permit||n.moduleId===app.Common.SelfServiceModules.Plan)?n.eReviewsService.getEReviewProjectByEntityId(n.entityId,n.moduleId,function(t){t&&t.Result?(n.enerGovAttachmentCardsService.hasAuthorizedContact=t.Result.HasAuthorizedContact,n.enerGovAttachmentCardsService.hasAuthorizedContact&&n.eReviewsService.getEReviewSubmissionInfoByEntityId(n.entityId,n.moduleId,function(t){n.submissionFilesInfo=t.Result;n.submissionFilesInfo&&t.Success&&(n.isFileCategory=t.Result.IsCategoryView,n.getFileCategoryValueComplete=!0,n.enerGovAttachmentCardsService.isFileCategory=t.Result.IsCategoryView,n.enerGovAttachmentCardsService.allowResubmitAdditionalFiles=t.Result.AllowResubmitAdditionalFiles,n.isFileCategory||(n.enerGovAttachmentCardsService.nonCategoryCards=n.submissionFilesInfo.FileSummary.Files))})):t&&t.Success&&!t.Result&&(n.getFileCategoryValueComplete=!0)}):n.getFileCategoryValueComplete=!0},e.prototype.existingAttachmentsResult=function(n){var i=this,t;n.Success?(t=n.Result.Attachments,this.enerGovAttachmentCardsService.uploadedFileCatgories=n.Result.UploadedFileCategories,this.setAdditionalAttachmentProperties(t),t.forEach(function(n){i.setAttachmentsModel(n)})):(n.StatusCode==app.Common.Services.HttpStatusCode.NoContent||n.StatusCode==app.Common.Services.HttpStatusCode.Forbidden?(this.setErrorMessage(n.ErrorMessage),this.entityTabsService.showAttachmentsTab=!1):n.StatusCode==app.Common.Services.HttpStatusCode.PreconditionFailed&&(this.setErrorMessage(n.ErrorMessage),this.entityTabsService.showAttachmentsTab=!0),this.$routeParams.tab&&this.$routeParams.tab==app.Constants.TabConstants.Attachments?this.entityTabsService.setAdditionalEntityTabsVisibility(this.$routeParams.tab,this.entityTabsService.showAttachmentsTab):this.entityTabsService.setFirstTabOnHidingOtherTabs())},e.prototype.setAdditionalAttachmentProperties=function(n){n!==null&&n.length>0&&(this.isAttachmentUploaded=n[0].IsShowUploadMessage)},e.prototype.setErrorMessage=function(n){var t=this;t.errorMessage=n},e.prototype.setAttachmentsModel=function(t){var r=this,i="Attachment";u(this.globalService.enerGovAPIVersion,"2019.0.0.0")&&t.FileCategoryNames!=null&&t.FileCategoryNames.length>0&&(i=t.FileCategoryNames);r.enerGovAttachmentCardsService.fileAttachments.push({name:t.FileName,fileType:i,file:null,size:null,type:n.Attachment.Models.AttachmentType.Attachment,attachment:t,cssFileName:t.FileName,createdDate:t.AddedOn,needsAction:!1,erProjectFileVersionId:t.ERProjectFileVersionId})},e.prototype.getCAPFileTypes=function(){var n=this,t=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id);return this.enerGovAttachmentsSearchService.getAttachmentCapFileTypes(n.$routeParams.id,t,function(t){t.Success==!0&&(n.enerGovAttachmentCardsService.attachmentsFileTypes=t.Result)})},e.prototype.closeMessageDiv=function(){this.uploadSuccessful=!1},e.prototype.getAttachmentMessage=function(){var n=this;return n.enerGovAttachmentCardsService.fileSubmissionStatusInfo?n.enerGovAttachmentCardsService.fileSubmissionStatusInfo.SubmissionStatusMessage:n.enerGovAttachmentCardsService.eReviewResourceValues?n.enerGovAttachmentCardsService.eReviewResourceValues.EReview_Files_NoRecordsToDisplay:void 0},e.prototype.showAttachmentCard=function(){var n=this;return n.moduleId==app.Common.SelfServiceModules.Project||n.moduleId==app.Common.SelfServiceModules.Cashier||n.moduleId==app.Common.SelfServiceModules.OperationalPermit?!1:n.enerGovAttachmentCardsService.extReviewIntegrationTypeInfo&&!n.enerGovAttachmentCardsService.showNewFilesCards?!1:n.isFileSetPromiseInProgress===!0||n.isFileSetPromiseInProgress===undefined&&n.getFileSetInfoPromise!==undefined||n.enerGovAttachmentCardsService.filesDropDown.length===0&&n.eReviewsService.disallowAttachmentAfterApplication&&n.moduleId!=f.Inspection?!1:n.enerGovAttachmentCardsService.fileSetInfo!==null&&n.enerGovAttachmentCardsService.filesDropDown.length>0&&(n.enerGovAttachmentCardsService.hasAuthorizedContactForAttachment||n.enerGovAttachmentCardsService.hasAuthorizedContact)||n.enerGovAttachmentCardsService.fileSetInfo===null&&(n.enerGovAttachmentCardsService.hasAuthorizedContactForAttachment||n.enerGovAttachmentCardsService.hasAuthorizedContact)},e.prototype.sortAttachments=function(){var n=this,t;n.sortingData=!0;n.enerGovAttachmentCardsService.fileAttachments=[];n.enerGovAttachmentCardsService.ereviewAttachments=[];n.enerGovAttachmentCardsService.filesDropDown=[];t=n.fetchAllAttachments(n.sortProperty);n.$q.when(t).then(function(){n.sortingData=!1})},e.prototype.getShowCaseAttachmentNoteSetting=function(){var n=this;n.tenantSettingService.getSoftwarePackageSetting("ShowCaseAttachmentNotes",function(t){n.showCaseAttachmentNotes=t&&t.SettingValue==="true"})},e.prototype.CheckIsChromeiOS=function(){var n=this,t=window.navigator.userAgent;n.isChromeiOS=t.match("CriOS")?!0:!1},e.prototype.getEreviewSubmissionInfo=function(){var n=this;return this.$q(function(t){app.Common.Helpers.VersionSupport(n.globalService.enerGovAPIVersion,"2022.2.0.0")&&n.enerGovAttachmentCardsService.hasAuthorizedContact?n.moduleId===app.Common.SelfServiceModules.Permit||n.moduleId===app.Common.SelfServiceModules.Plan?(n.isBusy=!0,n.eReviewsService.getEReviewSubmissionInfoByEntityId(n.entityId,n.moduleId,function(i){i.Result&&i.Success?(n.isFileCategory=i.Result.IsCategoryView,n.enerGovAttachmentCardsService.isFileCategory=n.isFileCategory,n.getFileCategoryValueComplete=!0,n.enerGovAttachmentCardsService.allowResubmitAdditionalFiles=i.Result.AllowResubmitAdditionalFiles,n.isFileCategory?n.eReviewsService.getEReviewSubmissionQueueStatus(n.entityId,n.moduleId).then(function(i){n.areAttachmentsInProcess=i.Result.IsProcessing;n.areAttachmentsInProcess?(n.isBusy=!1,t()):n.eReviewsService.getEReviewSubmissionInfoByEntityId(n.entityId,n.moduleId,function(i){i.Result&&i.Success?(n.updateResubmitAttachmentsFlag(i.Result),n.submissionFilesInfo=i.Result,n.resetRequiredFileCards(n.submissionFilesInfo),n.eReviewsService.getEReviewProjectByEntityId(n.entityId,n.moduleId,function(t){n.isBusy=!1;t.Success?n.setEReviewProjectModel(t.Result,!1):n.errorMessage=t.ErrorMessage}),t()):(n.isBusy=!1,t())})}):(n.updateResubmitAttachmentsFlag(i.Result),n.submissionFilesInfo=i.Result,n.enerGovAttachmentCardsService.nonCategoryCards=n.submissionFilesInfo.FileSummary.Files,n.updateDateForNonCategoryCard(),n.isBusy=!1,t())):(n.isBusy=!1,t())})):t():(n.getFileCategoryValueComplete=!0,t())})},e.prototype.updateDateForNonCategoryCard=function(){var n=this;this.enerGovAttachmentCardsService.nonCategoryCards.forEach(function(t){var i=n.enerGovAttachmentCardsService.cards.filter(function(n){return n.attachment&&n.attachment.AttachmentID===t.AttachmentId});i.length>0&&(t.AddedOn=i[0].attachment.AddedOn)})},e.prototype.resetRequiredFileCards=function(n){var t=this;angular.forEach(n.CategorySummary.Categories,function(n){for(var i=0;i<t.enerGovAttachmentCardsService.requiredFileCards.length;i++)t.enerGovAttachmentCardsService.requiredFileCards[i].ERProjectFileCategoryId==n.CategoryId&&t.enerGovAttachmentCardsService.requiredFileCards.splice(i,1)})},e.prototype.updateResubmitAttachmentsFlag=function(n){n.IsCategoryView?(this.eReviewsService.hasFilesThatNeedsResubmission=n.CategorySummary.Categories.some(function(n){return n.HasFilesThatNeedResubmission===!0}),this.eReviewsService.hasFilesThatNeedsAttention=n.CategorySummary.Categories.some(function(n){return n.HasFilesThatNeedAttention===!0})):(this.eReviewsService.hasFilesThatNeedsResubmission=n.FileSummary.Files.some(function(n){return n.AllowResubmission===!0}),this.eReviewsService.hasFilesThatNeedsAttention=n.FileSummary.Files.some(function(n){return n.NeedsAttention===!0}))},e}(n.Common.Controllers.EnerGovAttachmentBaseController);i.EnerGovEntityAttachmentController=e})(i=t.Controllers||(t.Controllers={}))})(t=n.Attachment||(n.Attachment={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f){var o=n.call(this,t,i,r,u)||this,e;return o.deleteAttachment=function(n){alert("Attachment Id is: "+n)},e=o,window.entityRecordsSortSecondaryData===null||typeof entityRecordsSortSecondaryData=="undefined"?f.getEntityRecordSortSecondaryData(function(n){e.sortList=n.Result.EntityAttachmentSearchSortList;e.sortField=n.Result.EntityAttachmentSearchSortList[0].Value;window.entityRecordsSortSecondaryData=n.Result}):(e.sortList=window.entityRecordsSortSecondaryData.EntityAttachmentSearchSortList,e.sortField=window.entityRecordsSortSecondaryData.EntityAttachmentSearchSortList[0].Value),o}return __extends(t,n),t}(app.Common.Controllers.PagedSearchController);n.EnerGovEntityAttachmentSearchController=t})(t=n.Attachment||(n.Attachment={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u){var f=n.call(this,null)||this,e;return f.globalService=r,f.enerGovAttachmentCardsService=u,f.uploadSuccessful=!1,f.notSupportedFiles=[],f.displaySize=function(n){return n>1048576?(Math.round(n*100/1048576)/100).toString()+" MB":(Math.round(n*100/1024)/100).toString()+" KB"},f.flowOptions={target:f.globalService.baseUrl+"api/energov/attachments/uploadchunk",permanentErrors:["404","500","501"],maxChunkRetries:1,chunkRetryInterval:5e3,simultaneousUploads:4,chunkSize:1e6,testChunks:!1,generateUniqueIdentifier:function(n){return Math.floor((1+Math.random())*65536).toString(16)+"-"+n.size+"-"+n.name}},f.fileSize=function(n,t){var i=null;if(n.size?i=n.size:n.file.size!==null&&(i=n.file.size),i===undefined){n.hideSize=!0;return}return n.hideSize=!1,n.tooBig=i>t?!0:!1,f.displaySize(i)},f.flowFileSize=function(n){var t=null;if(n.size>=0?t=n.size:n.file.size!==null&&(t=n.file.size),t===undefined){n.hideSize=!0;return}return n.hideSize=!1,f.displaySize(t)},e=f,e.flowOptions.headers={UploadProvider:"attachment",parentId:t.id,tenantId:r.tenantId,"Tyler-TenantUrl":r.tenantUrl,"Tyler-Tenant-Culture":r.culture},e.enerGovAttachmentCardsService.clean(),f.enerGovAttachmentCardsService.getSoftwarePackageSettings(function(n){n!=null&&(e.fileTypesAllowed=n.SettingValue,f.enerGovAttachmentCardsService.getFileTypeNames(function(n){if(n!=null){var t="";angular.forEach(n,function(n){f.fileTypesAllowed.match(n.FileTypeExtension)&&(t=t+n.FileTypeName+", ")});f.fileNames=t.replace(/,\s*$/,"").toString()}}))}),f.addAttachment=function(){var t,n;if(e.files&&e.files.length!==0){for(t=0;t<e.files.length;t++)(n=e.files[t],n instanceof File)&&e.enerGovAttachmentCardsService.fileAttachments.push({name:n.name,size:n.size,fileType:e.enerGovAttachmentCardsService.attachmentFileType,file:n,attachment:null,cssFileName:n.name});e.files=null}},f.upload=function(){e.enerGovAttachmentCardsService.addAttachmentsToParent=!0;e.enerGovAttachmentCardsService.parentId=t.id;for(var n=0;n<e.enerGovAttachmentCardsService.fileAttachments.length;n++)e.enerGovAttachmentCardsService.fileAttachments[n].tooBig==!0&&f.removeAttachmentCard(e.enerGovAttachmentCardsService.fileAttachments[n])},f}return __extends(t,n),t}(app.Core.Controllers.CoreController);n.EnerGovPendingAttachmentontroller=t})(t=n.Attachment||(n.Attachment={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){var t,i;(function(n){n[n.Attachment=0]="Attachment";n[n.EReview=1]="EReview"})(t=n.AttachmentType||(n.AttachmentType={})),function(n){n[n.RequireAllFilesToBeResubmittedAtOnce=1]="RequireAllFilesToBeResubmittedAtOnce";n[n.AllowResubmitUntilAllFilesResubmitted=2]="AllowResubmitUntilAllFilesResubmitted";n[n.DisableResubmitAfterOneFileIsResubmitted=3]="DisableResubmitAfterOneFileIsResubmitted";n[n.UseFileCategoriesForResubmission=4]="UseFileCategoriesForResubmission"}(i=n.ReviewFileResubmitSetting||(n.ReviewFileResubmitSetting={}))})(t=n.Models||(n.Models={}))})(t=n.Attachment||(n.Attachment={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(){"use strict";var t=n.Attachment.Services.EnerGovEntityAttachmentSearchService,i=n.Attachment.EnerGovEntityAttachmentSearchController,r=n.Attachment.EnerGovAttachmentController,u=n.Attachment.Services.EnerGovAttachmentCardsService,f=n.Attachment.EnerGovPendingAttachmentontroller,e=n.Attachment.Services.FileDownloadService,o=n.Attachment.Services.FileUploadService;angular.module("enerGov.Attachment",["app.globalsModule","app.Common.Services","enerGov.Common","flow","app.Services.Utilities"]).service("fileUploadService",["globalsService","$timeout",o]).service("enerGovEntityAttachmentSearchService",["http","userService",t]).service("enerGovAttachmentCardsService",["http","$routeParams","$location","globalsService","eReviewsService","Upload","$q","$timeout","$http","fileUploadService","$filter","authUtils","resourceService","tenantService",u]).service("fileDownloadService",["$http","$q","$timeout","$log","globalsService","utilities",e]).controller("enerGovEntityAttachmentController",["$routeParams","userService","$location","globalsService","enerGovAttachmentCardsService","eReviewsService","enerGovEntityAttachmentSearchService","fileUploadService","$q","$sce","$timeout","entitySecondaryDataService","tenantSettingService","eReviewEntityResponseService","entityTabsService","attachmentCommonCardService",n.Attachment.Controllers.EnerGovEntityAttachmentController]).controller("enerGovAdditionalAttachmentController",["$routeParams","userService","$location","globalsService","enerGovAttachmentCardsService","eReviewsService","enerGovEntityAttachmentSearchService","fileUploadService","$q","$sce","$timeout","entitySecondaryDataService","tenantSettingService","eReviewEntityResponseService","attachmentCommonCardService",n.Attachment.Controllers.EnerGovAdditionalAttachmentController]).controller("enerGovEntityAttachmentSearchController",["$routeParams","$location","globalsService","enerGovEntityAttachmentSearchService","entitySecondaryDataService","$window","$sce",i]).controller("enerGovAttachmentController",["$routeParams","userService","$location","globalsService","enerGovAttachmentCardsService","$q","$scope","eReviewsService","fileUploadService","$timeout","attachmentCommonCardService",r]).controller("enerGovPendingAttachmentController",["$routeParams","$location","globalsService","enerGovAttachmentCardsService","$timeout",f])})(t=n.Attachment||(n.Attachment={}))}(EnerGov||(EnerGov={}));__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){var t;(function(n){"use strict";var t=function(n){function t(){var t=n.call(this)||this;return t.scope={loggedin:"=",caseModel:"="},t.link=function(n,t,i){n.$watch("caseModel",function(n){i.accessLevel!="NoAccess"&&(i.accessLevel!="LoggedIn"||n==null||n.IsLoggedIn)&&(i.accessLevel!="CaseContact"||n==null||n.HasAuthorizedContact)||t.css("display","none")})},t.restrict="A",t}return __extends(t,n),t}(app.Directives.Core.BaseDirective);n.EnergovAccessLevelDirective=t;angular.module("app.EnerGov.Common.Directives.AccessLevel",[]).directive("accessLevel",[function(){return new t}])})(t=n.AccessLevel||(n.AccessLevel={}))})(t=n.Directive||(n.Directive={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={}));__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 i=function(n){function t(t){var i=n.call(this)||this;return i.restrict="AE",i.replace=!0,i.templateUrl=t.baseUrl+t.tenantUrl+"/EnerGovEscrowAccount/AddFundToEscrowAccountTemplate",i.controllerAs="vm",i.scope={accountDetail:"=",tabIndex:"="},i.controller="addFundToEscrowAccount",i}return __extends(t,n),t}(app.Directives.Core.BaseDirective),t;n.AddFundToEscrowAccountDirective=i;t=function(n){function t(t,i,r,u,f,e){var o=n.call(this,null)||this,s;return o.$scope=t,o.$location=i,o.globalService=r,o.addFundToEscrowAccountService=u,o.tenantService=f,o.resourceService=e,o.newBalance=0,o.isBusy=!1,o.errorMessage="",o.options={decimals:2},o.validationError="",o.accountNumber="",s=o,s.myEscrowAccount=s.$scope.accountDetail,s.accountNumber=s.myEscrowAccount.AccountNumber.split(" ").join("-"),o.tenantService.isTylerPaymentsUsed(function(n){s.isTylerPaymentsUsed=n}),o.resourceService.getSpecificKeyValues("SelfService.Resources.SelfService",["PaymentRequestErrorMessage"],function(n){s.validationError=n.PaymentRequestErrorMessage}),o}return __extends(t,n),t.prototype.closePopup=function(n){var t=this;t.resetFields();n.addFundsform.depositeAmount&&n.addFundsform.depositeAmount.$touched&&(n.addFundsform.depositeAmount.$touched=!1,n.addFundsform.depositeAmount.$untouched=!0,n.addFundsform.depositeAmount.$invalid=!1,n.addFundsform.depositeAmount.$valid=!0,n.addFundsform.depositeAmount.$$element.parent().css("border-color","rgba(33,37,41,.15)"),n.addFundsform.$invalid=!1);$("#addFundModal.modal.fade.in").modal("hide")},t.prototype.calculateNewBalance=function(n){var t=this,i,r;t.depositeAmount&&isNaN(Number(t.depositeAmount))&&(i=t.depositeAmount.toString(),t.depositeAmount=parseFloat(i.replace(/[^\d\.]*/g,"")));isNaN(Number(t.depositeAmount))&&n.addFundsform.depositeAmount.$error&&(n.addFundsform.depositeAmount.$error.required=!0,n.addFundsform.$invalid=!0);n.addFundsform.$invalid=isNaN(Number(t.depositeAmount))||t.depositeAmount==null;n.addFundsform.$invalid?n.addFundsform.depositeAmount.$$element.parent().css("border-color","red"):n.addFundsform.depositeAmount.$$element.parent().css("border-color","rgba(33,37,41,.15)");r=Number(t.depositeAmount)>1e9?1e9:Number(t.depositeAmount);t.newBalance=t.myEscrowAccount.AccountBalance+r},t.prototype.onAddFunds=function(){var n=this;NProgress.start();this.globalService.showProcessing=!0;this.isBusy=!0;this.errorMessage="";this.addFundToEscrowAccountService.getTenantEscrowAccountsSettings().then(function(t){t.Result.PaymentGatewayUrl&&t.Result.PaymentGatewayUrl!==""?n.addFundToEscrowAccountService.testPaymentGatewayUrl(t.Result.PaymentGatewayUrl).then(function(t){t.Success?n.depositeFund():(n.stopProgressBar(),n.errorMessage=n.validationError)}):(n.stopProgressBar(),n.errorMessage=n.validationError)})},t.prototype.depositeFund=function(){var n=this;this.isTylerPaymentsUsed?this.addFundToEscrowAccountService.getTylerPaymentRequestPageUrl(this.getTylerPaymentRequest()).then(function(t){n.stopProgressBar();t.Result.IsValid?window.location.href=t.Result.RedirectUri+"?signin=true":n.errorMessage=n.validationError}):this.addFundToEscrowAccountService.getNonTylerPaymentRequestPageUrl(this.getTenantInfo()).then(function(t){n.stopProgressBar();t.Result.StatusCode===1?window.location.href=t.Result.PaymentPageUrl:n.errorMessage=t.Result.Message})},t.prototype.stopProgressBar=function(){NProgress.done();this.globalService.showProcessing=!1;this.isBusy=!1},t.prototype.getTylerPaymentRequest=function(){var n=this.getAccountId();return{Amount:Number(this.depositeAmount),DepositAccountInfo:this.getDepositAccountInfo(),PaymentRequestItemData:this.getItemData(n)}},t.prototype.getTenantInfo=function(){var n=[],t=this.getAccountId(),i={CartItemId:-1,CartDirectiveName:"energov-cart",CartData:angular.toJson(this.getItemData(t)),CartDataId:null,UserId:-1,TenantId:this.globalService.tenantId,SoftwarePackageId:-1,SoftwarePackageName:"",Amount:Number(this.depositeAmount),IsNew:!0,IsDeleted:!1};return n.push(i),{CurrentUrl:this.$location.absUrl(),CartItems:n,DepositAccountInfo:this.getDepositAccountInfo()}},t.prototype.getItemData=function(n){return{GlobalEntityNumber:this.myEscrowAccount.GlobalEntityId,AccountId:n}},t.prototype.getDepositAccountInfo=function(){return{IsDeposit:!0,AccountName:this.myEscrowAccount.AccountName,AccountNumber:this.myEscrowAccount.AccountNumber}},t.prototype.getAccountId=function(){var n="";return this.myEscrowAccount.CaseId&&this.myEscrowAccount.CaseNumber?this.myEscrowAccount.Module===1?n="PERMIT|"+this.myEscrowAccount.AccountId:this.myEscrowAccount.Module===2?n="PLAN|"+this.myEscrowAccount.AccountId:this.myEscrowAccount.Module===14&&(n="PROJECT|"+this.myEscrowAccount.AccountId):n=this.myEscrowAccount.AccountId,n},t.prototype.resetFields=function(){var n=this;n.depositeAmount=undefined;n.newBalance=0;n.errorMessage=""},t}(app.Core.Controllers.CoreController);n.EnergovAddFundToEscrowAccountController=t;angular.module("EnerGov.Directives.AddFundToEscrowAccount",[]).controller("addFundToEscrowAccount",["$scope","$location","globalsService","addFundToEscrowAccountService","tenantService","resourceService",t]).directive("addfundtoescrowaccount",["globalsService",function(n){return new i(n)}])})(t=n.AddFundToEscrowAccount||(n.AddFundToEscrowAccount={}))})(t=n.Directives||(n.Directives={}))}(EnerGov||(EnerGov={}));__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 i=function(n){function t(t){var i=n.call(this)||this;return i.restrict="AE",i.replace=!0,i.templateUrl=t.baseUrl+t.tenantUrl+"/EnerGovCart/AddToCartTemplate",i.controllerAs="vm",i.scope={parentModel:"=",totoalDueAmmount:"=?",hideButtonWhenDisabled:"=?",possiblePayWithoutLogin:"=?",showAsPayNow:"=?",inoviceId:"=?",tabIndex:"=?",canShowPending:"=?"},i.controller="addToCartController",i}return __extends(t,n),t}(app.Directives.Core.BaseDirective),t;n.EnergovAddToCartDirective=i;t=function(n){function t(t,i,r,u,f,e){var s=n.call(this,null)||this,o;return s.$scope=t,s.$location=i,s.cartService=r,s.enerGovMyInvoiceSearchService=u,s.settingPolicyService=f,s.tenantService=e,s.pendingAddCartItems=[],s.showPending=!1,s.isTenantUsesTylerPayments=function(){var n=s;s.tenantService.isTylerPaymentsUsed(function(t){n.isTylerPaymentsUsed=t})},o=s,o.canDisableButton=!1,o.canHideButton=!1,o.canShowBasedOnPolicy=!1,o.showPayNow=!0,o.hideAddToCartButonVal=!0,o.hidePayNowButtonVal=!0,o.disabledPayNowButtonVal=!0,o.isTylerPaymentsUsed=!1,o.isTenantUsesTylerPayments(),o.$scope.$watch("vm.$scope.parentModel",function(n){n&&(o.hasUnpaidInvoices=n.UnpaidInvoiceIds&&n.UnpaidInvoiceIds.length>0,o.hasUnpaidInvoices&&n.UnPaidInvoicedFees!=null&&n.UnPaidInvoicedFees?o.cartService.getPendingInvoices(n.UnpaidInvoiceIds,function(t){o.invoicesPending=t;t.length>0&&t.length==n.UnpaidInvoiceIds.length?n.UnpaidPendingInvoiceIds?(o.showPayNow=!0,o.invoicesPending=null):o.showPayNow=!1:o.showPayNow=!0}):o.showPayNow=!0,o.canShowButtonBasedOnPolicy(function(){o.hideAddToCartButon();o.hidePayNowButton();o.disabledPayNowButton()}))}),s}return __extends(t,n),t.prototype.canShowButtonBasedOnPolicy=function(n){var t=this;this.settingPolicyService.canShowPayNowButon(this.$scope.parentModel,this.$scope.possiblePayWithoutLogin?this.$scope.possiblePayWithoutLogin:!1,function(i){t.canShowBasedOnPolicy=i;n()})},t.prototype.payNow=function(){this.$scope.inoviceId&&this.$location.path("/invoice/"+this.$scope.inoviceId+"/true")},t.prototype.addToCart=function(){var i=this,n=this,t;this.$scope.parentModel.UnpaidInvoiceIds!=null&&this.$scope.parentModel.UnpaidInvoiceIds.length>0&&(t=_.difference(this.$scope.parentModel.UnpaidInvoiceIds,this.invoicesPending),this.enerGovMyInvoiceSearchService.getDetailInvoices(t,!1,function(t){t!=null&&t.length>0&&(angular.forEach(t,function(t){var i={ItemName:t.InvoiceDescription,Due:t.InvoiceDueDate,Invoice:t.InvoiceNumber,InvoiceId:t.InvoiceId,BillingContact:t.BillingContact,ContactAddresses:t.ContactAddresses==null||t.ContactAddresses.length==0?[]:t.ContactAddresses,HomePhone:t.HomePhone,BusinessPhone:t.BusinessPhone,OtherPhone:t.OtherPhone,MobilePhone:t.MobilePhone,InvoiceEntityList:t.InvoiceEntities,InvoiceFees:t.InvoiceFees==null||t.InvoiceFees.length==0?[]:t.InvoiceFees},r={CartItemId:-1,CartDirectiveName:"energov-cart",CartData:angular.toJson(i),CartDataId:t.InvoiceId,UserId:-1,TenantId:-1,SoftwarePackageId:-1,SoftwarePackageName:"",Amount:t.TotalDue,IsNew:!0,IsDeleted:!1};n.pendingAddCartItems.push(r)}),n.cartService.addCartItems(i.pendingAddCartItems,function(t){t&&(n.cartService.didCallGetTotalItem=!1,n.cartService.updateTotalNumOfItems(),n.cartService.didCallGetTotalItem=!0,n.$location.url("/mycart"))}))}))},t.prototype.showPendingStatus=function(){var n=this;return n.$scope.canShowPending&&n.$scope.totoalDueAmmount>0&&(!n.showPayNow||!n.hasUnpaidInvoices)},t.prototype.commonDisableAndHideCondition=function(){var n=this;return!n.hasUnpaidInvoices||!n.showPayNow||n.$scope.totoalDueAmmount<=0||!n.canShowBasedOnPolicy},t.prototype.hideAddToCartButon=function(){var n=this;n.hideAddToCartButonVal=n.isTylerPaymentsUsed||n.commonDisableAndHideCondition()},t.prototype.hidePayNowButton=function(){var n=this;n.hidePayNowButtonVal=n.isTylerPaymentsUsed||n.commonDisableAndHideCondition()&&n.$scope.hideButtonWhenDisabled},t.prototype.disabledPayNowButton=function(){var n=this;n.disabledPayNowButtonVal=n.isTylerPaymentsUsed||n.commonDisableAndHideCondition()},t}(app.Core.Controllers.CoreController);n.EnergovAddToCartController=t;angular.module("EnerGov.Directives.AddToCart",[]).controller("addToCartController",["$scope","$location",app.Constants.ServiceConstant.CartService,"enerGovMyInvoiceSearchService","settingPolicyService","tenantService",t]).directive("addToCart",["globalsService",function(n){return new i(n)}])})(t=n.AddToCart||(n.AddToCart={}))})(t=n.Directives||(n.Directives={}))}(EnerGov||(EnerGov={}));__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 i="Add to Cart",u="In Cart",r=function(n){function t(t){var i=n.call(this)||this;return i.restrict="AE",i.replace=!0,i.templateUrl=t.baseUrl+t.tenantUrl+"/EnerGovCart/AddToTylerCartTemplate",i.controllerAs="vm",i.scope={invoiceIds:"=",tabIndex:"=?",useTelerikClass:"=?",isInCart:"=?",noNeedReload:"=?"},i.controller="addToTylerCartController",i}return __extends(t,n),t}(app.Directives.Core.BaseDirective),t;n.AddToTylerCartDirective=r;t=function(n){function t(t,r,f,e,o,s){var h=n.call(this,null)||this,c;return h.$scope=t,h.$location=r,h.$route=f,h.cartService=e,h.tenantService=o,h.authService=s,h.showAddedToCartSuccess=!1,h.buttonName=i,h.isTenantUsesTylerPayments=function(){var n=h;n.tenantService.isTylerPaymentsUsed(function(t){n.isTylerPaymentsUsed=t})},h.setButtonName=function(){var n=h;n.buttonName=n.$scope.isInCart?u:i},h.hasInvoiceIds=function(){return h.$scope.invoiceIds!=null&&h.$scope.invoiceIds.length>0},h.gotoTylerCart=function(){var n=h;window.location.href=n.gotoCartUrl+"?signin=true"},h.continue=function(){var n=h;n.cartService.getTylerCartItems();n.$scope.isInCart=n.cartService.getInCartStatus(n.$scope.invoiceIds);n.setButtonName();n.$scope.noNeedReload||n.$route.reload()},h.setIsInCartAndButtonText=function(){h.isTylerPaymentsUsed&&(h.$scope.isInCart=h.cartService.getInCartStatus(h.$scope.invoiceIds),h.setButtonName())},c=h,c.isTenantUsesTylerPayments(),h.authService.isAuth()&&(c.isLoggedIn=!0),c.$scope.$watch("vm.$scope.invoiceIds",function(n){n&&n.length!=0&&c.setIsInCartAndButtonText()}),c.$scope.$watch("vm.cartService.tylerCartItems",function(){c.setIsInCartAndButtonText()}),h}return __extends(t,n),t.prototype.addToTylerCart=function(){var n=this;this.$scope.invoiceIds!=null&&this.$scope.invoiceIds.length>0&&n.cartService.addTylerCartItems(this.$scope.invoiceIds,function(t){t!==null&&(n.cartService.didCallGetTotalItem=!1,n.cartService.updateTotalNumOfItems(),n.cartService.getTylerCartItems(),n.cartService.didCallGetTotalItem=!0,n.showAddedToCartSuccess=!0,n.gotoCartUrl=t.ShoppingCartUrl,n.responseMessage=t.ResponseMessage,n.$scope.isInCart=n.cartService.getInCartStatus(n.$scope.invoiceIds),n.setButtonName())})},t}(app.Core.Controllers.CoreController);n.AddToTylerCartController=t;angular.module("EnerGov.Directives.AddToTylerCart",[]).controller("addToTylerCartController",["$scope","$location","$route",app.Constants.ServiceConstant.CartService,"tenantService","authService",t]).directive("addToTylerCart",["globalsService",function(n){return new r(n)}])})(t=n.AddToTylerCart||(n.AddToTylerCart={}))})(t=n.Directives||(n.Directives={}))}(EnerGov||(EnerGov={}));__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){var t;(function(n){"use strict";var t=function(n){function t(t,i,r){var u=n.call(this)||this;u.restrict="A";u.replace=!0;u.template="";u.scope={statusReasonCode:"=",tabIndex:"=",entityModule:"@",entityId:"="};var f=i.enerGovCommonStatusReasonFail,e=i.enerGovCommonStatusReasonOnHold,o=i.enerGovCommonStatusReasonUnpaidFees,s=i.enerGovCommonStatusReasonFailedInspections,h=i.enerGovCommonStatusReasonFailedSubmittals,c=i.enerGovCommonStatusReasonFailedEReviewFiles;return u.link=function(n,i){var a=null,l="",u="#/"+n.entityModule+"/"+n.entityId+"?tab=",v;switch(n.statusReasonCode){case 1:l="<div id ='"+f+"' tabindex= '"+n.tabIndex+"'>"+f+"<\/div>";break;case 2:l="<div id ='"+e+"' tabindex='"+n.tabIndex+"'>"+e+"<\/div>";break;case 3:u=u+r.tabConstant.Fees;l="<a id ='"+o+"' tabindex='"+n.tabIndex+"' data-ng-href='"+u+"'>"+o+"<\/a>";break;case 4:u=u+r.tabConstant.Inspections;l="<a id ='"+s+"' tabindex='"+n.tabIndex+"' data-ng-href='"+u+"'>"+s+"<\/a>";break;case 5:u=u+r.tabConstant.Reviews;l="<a id ='"+h+"' tabindex='"+n.tabIndex+"' data-ng-href='"+u+"'>"+h+"<\/a>";break;case 6:u=u+r.tabConstant.Attachments;l="<a id ='"+c+"' tabindex='"+n.tabIndex+"' data-ng-href='"+u+"'>"+c+"<\/a>"}a=angular.element(l).appendTo(i);v=t(a)(n)},u}return __extends(t,n),t}(app.Directives.Core.BaseDirective);n.AttentionReasonLinkDirective=t;angular.module("app.EnerGov.Common.Directive.AttentionReason",[]).directive("attentionReasonLink",["$compile","globalsService","tabNavigatorService",function(n,i,r){return new t(n,i,r)}])})(t=n.AttentionReason||(n.AttentionReason={}))})(t=n.Directive||(n.Directive={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={}));__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){var t;(function(n){"use strict";var t=function(n){function t(t){var i=n.call(this)||this;return i.restrict="A",i.replace=!0,i.templateUrl=t.baseUrl+t.tenantUrl+"/EnerGovCart/CartTemplate",i.scope={amount:"=cartAmount",cartItemId:"=cartItemId",event:"=event",model:"=cartData",removeItem:"&cartRemoveItem",hideLicense:"=",dateFormat:"@"},i}return __extends(t,n),t}(app.Directives.Core.BaseDirective);n.EnergovCartDirective=t;angular.module(app.Constants.AppModule.AppEnerGovCommonDirectiveCart,[]).directive(app.Constants.DirectiveConstant.EnerGovCart,["globalsService",function(n){return new t(n)}])})(t=n.Cart||(n.Cart={}))})(t=n.Directive||(n.Directive={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={}));__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(){var t=n.call(this)||this;return t.restrict="A",t.replace=!0,t.scope={data:"="},t.link=function(n){function tt(){o=o.data(y(t[this.value].percentage));o.enter().append("path").attr("fill",function(n,i){return t[i].color}).attr("d",e(v)).each(function(n){this._current={data:n.data,value:n.value,startAngle:v.startAngle,endAngle:v.endAngle}});o.exit().transition().duration(750).attrTween("d",it).remove();o.transition().duration(750).attrTween("d",k)}function k(n){var t=d3.interpolate(this._current,n);return this._current=t(0),function(n){return e(t(n))}}function it(){var n=d3.interpolate(this._current,{startAngle:Math.PI*2,endAngle:Math.PI*2,value:0});return this._current=n(0),function(t){return e(n(t))}}var t=n.data,u=[{x:110,y:0},{x:110,y:30},{x:110,y:63}],f=[{x:100,y:-3},{x:100,y:28},{x:100,y:61}],h=[{x:105,y:-70},{x:105,y:-45}],rt=$(".chart"),c=225,s=186,l=Math.min(c,s)/2,r=Math.min(c,s)/10,a={startAngle:0,endAngle:0},v={startAngle:Math.PI*2,endAngle:Math.PI*2},y=d3.layout.pie().sort(null),e=d3.svg.arc().innerRadius(l*.4).outerRadius(l-10),d=d3.svg.arc().innerRadius(l*.4).outerRadius(l-8),i=d3.select("#Donut-chart").append("svg").attr("id","Donut-chart-render").attr("width","110%").attr("height","110%").attr("viewBox","-100 -"+s*(1/2)+" "+Math.min(c,s)*1.7+" "+Math.min(c,s)*1.5).attr("preserveAspectRatio","xMinYMin"),p=t[0].percentage+"%",ut=i.append("text").attr("class","mainText").text(p).attr("text-anchor","start").style("font-family","'Lato', sans-serif").style("font-size",r*2+"px").attr("dy",r/3).attr("dx",2).attr("x",h[0].x).attr("y",h[0].y),b,nt;i.append("text").style("font-size",r*(5/6)+"px").attr("dx",2).style("font-weight","bold").style("font-family","'Lato', sans-serif").attr("class","mainText2").attr("x",h[1].x).attr("y",h[1].y).attr("fill",t[0].color).text(t[0].name);var g=[t[0].percentage+"% of Case has been Completed",t[1].percentage+"% of Processes are Currently Active",t[2].percentage+"% of Processes are Remaining"],w=i.selectAll("path").data(y(t.map(function(n){return n.percentage}))).enter().append("g").attr("class","arc"),o=w.append("path").attr("class",function(n,t){return t}).attr("fill",function(n,i){return t[i].color}).style("font-weight","bold").attr("aria-label",function(n,t){return g[t]}).attr("tabindex",100).attr("d",e(a)).on("mouseover",function(n,u){var e=this,h=i.selectAll(".arc").filter(function(){return this.children[0]!==e}),o=i.selectAll(".arc").filter(function(){return this.children[0]===e}),s,f;h.selectAll("path").style("opacity",.3);d3.select(this).transition().duration(500).attr("d",d);o[0][0].children[1].children[0].style.fontWeight="bold";o[0][0].children[1].children[0].style.fontSize=r*(4/3)+"px";s=i.selectAll(".mainText");s[0][0].textContent=t[u].percentage+"%";f=i.selectAll(".mainText2");f[0][0].textContent=t[u].name;f[0][0].setAttribute("fill",t[u].color)}).on("mouseout",function(){var n,u,o,s,f;d3.select(this).transition().duration(500).attr("d",e);n=this;d3.select(this).style("opacity",1);u=i.selectAll(".arc").filter(function(){return this.children[0]===n});o=i.selectAll(".arc").filter(function(){return this.children[0]!==n});o.selectAll("path").style("opacity",1);u[0][0].children[1].children[0].style.fontWeight="normal";u[0][0].children[1].children[0].style.fontSize=r;s=i.selectAll(".mainText");s[0][0].textContent=p;f=i.selectAll(".mainText2");f[0][0].textContent=t[0].name;f[0][0].setAttribute("fill",t[0].color)}).each(function(n){this._current={data:n.data,value:n.value,startAngle:a.startAngle,endAngle:a.endAngle}});i.append("circle").attr().attr("r",5).attr("dx",2).attr("fill",t[0].color).attr("cx",f[0].x).attr("cy",f[0].y);i.append("circle").attr().attr("r",5).attr("dx",2).attr("fill",t[1].color).attr("cx",f[1].x).attr("cy",f[1].y);i.append("circle").attr().attr("r",5).attr("dx",2).attr("fill",t[2].color).attr("cx",f[2].x).attr("cy",f[2].y);i.append("text").style("font-size",r*(5/6)+"px").attr("dx",2).style("font-family","'Lato', sans-serif").attr("x",u[0].x).attr("y",u[0].y).text(t[0].name).on("mouseover",null);i.append("text").attr("dx",2).style("font-family","'Lato', sans-serif").style("font-size",r*(5/6)+"px").attr("dy",r/4.5).text(t[1].name).attr("x",u[1].x).attr("y",u[1].y);i.append("text").attr("dx",2).style("font-size",r*(5/6)+"px").attr("dy",r/4.5).style("font-family","'Lato', sans-serif").text(t[2].name).attr("x",u[2].x).attr("y",u[2].y);b=w.append("g").attr("transform",function(n){var t=e.centroid(n);return"translate("+t[0]+","+t[1]+")"});nt=b.append("text").style("font-size",r+"px").style("font-family","'Lato', sans-serif").attr("text-anchor","middle").on("mouseover",function(){d3.select(this.parentNode.parentNode.children[0]).node().dispatchEvent(new MouseEvent("mouseover"))}).on("mouseout",function(){d3.select(this.parentNode.parentNode.children[0]).node().dispatchEvent(new MouseEvent("mouseout"))});o.transition().duration(1750).attrTween("d",k);d3.selectAll("input").on("change",tt)},t}return __extends(t,n),t}(app.Directives.Core.BaseDirective);n.DonutChartDirective=t;angular.module("EnerGov.Directives.DonutChart",[]).directive("donutChart",["$compile",function(n){return new t(n)}])})(t=n.DonutChart||(n.DonutChart={}))})(t=n.Directives||(n.Directives={}))}(EnerGov||(EnerGov={}));__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 e=app.Common.Helpers.VersionSupport,t,i,r,f,u;(function(n){n[n.All=1]="All";n[n.Permit=2]="Permit";n[n.Plan=3]="Plan";n[n.Inspection=4]="Inspection";n[n.CodeCase=5]="CodeCase";n[n.Request=6]="Request"})(t=n.MapSearchModule||(n.MapSearchModule={}));i=function(n){function i(i,r){var u=n.call(this)||this;return u.restrict="A",u.replace=!0,u.templateUrl=i.baseUrl+i.tenantUrl+"/EnerGovMap/AddressTemplate",u.scope={selectedAddress:"=",wkid:"=",config:"=",mapFiltersCriteria:"="},u.link=function(n){var u=null,e,f,o;n.isSearchingPermit=!1;n.isSearchingPlan=!1;n.isSearchingInspection=!1;n.isSearchingCodeCase=!1;n.isSearchingRequest=!1;n.permitsList=null;n.plansList=null;n.inspectionsList=null;n.codecasesList=null;n.requestsList=null;e=function(f,e){var c,o,h,s;n.selectedAddress.Point?(h=n.selectedAddress,s={ActiveDuring:n.mapFiltersCriteria.ActiveDuring,AllData:n.mapFiltersCriteria.AllData,AppliedDuring:n.mapFiltersCriteria.AppliedDuring,FirstCorner:h.FirstCorner,MapSearchModule:t.Permit,EnerGovMapSearchModule:n.mapFiltersCriteria.MapSearchModule,PageNumber:1,PageSize:i.pageSizeList[0].Value,SecondCorner:h.SecondCorner,HiddenInspectionTypeIDs:[]},f==="permits"&&(s.MapSearchModule=t.Permit,n.permitsList&&(s.PageNumber=e?n.permitsList.CurrentPage+1:n.permitsList.CurrentPage-1,s.PageNumber>=1&&s.PageNumber<=n.permitsList.TotalPages&&(n.permitsList=null,r.searchByFilterModuleCriteria(s,function(t){n.permitsList=t})))),f==="plans"&&(s.MapSearchModule=t.Plan,n.plansList&&(s.PageNumber=e?n.plansList.CurrentPage+1:n.plansList.CurrentPage-1,s.PageNumber>=1&&s.PageNumber<=n.plansList.TotalPages&&(n.plansList=null,r.searchByFilterModuleCriteria(s,function(t){n.plansList=t})))),f==="inspections"&&(s.MapSearchModule=t.Inspection,n.inspectionsList&&(s.PageNumber=e?n.inspectionsList.CurrentPage+1:n.inspectionsList.CurrentPage-1,s.PageNumber>=1&&s.PageNumber<=n.inspectionsList.TotalPages&&(n.inspectionsList=null,r.searchByFilterModuleCriteria(s,function(t){n.inspectionsList=t})))),f==="codecases"&&(s.MapSearchModule=t.CodeCase,n.codecasesList&&(s.PageNumber=e?n.codecasesList.CurrentPage+1:n.codecasesList.CurrentPage-1,s.PageNumber>=1&&s.PageNumber<=n.codecasesList.TotalPages&&(n.codecasesList=null,r.searchByFilterModuleCriteria(s,function(t){n.codecasesList=t})))),f==="requests"&&(s.MapSearchModule=t.Request,n.requestsList&&(s.PageNumber=e?n.requestsList.CurrentPage+1:n.requestsList.CurrentPage-1,s.PageNumber>=1&&s.PageNumber<=n.requestsList.TotalPages&&(n.requestsList=null,r.searchByFilterModuleCriteria(s,function(t){n.requestsList=t}))))):u&&u.Origin&&(c={Latitude:u.Origin.lat,Longitude:u.Origin.lon},o={DistanceFromOrigin:u.DistanceFromOrigin,ArcGisGeometryServiceUrl:u.ArcGisGeometryServiceUrl,MapWkid:u.MapWkid,Module:t.Inspection,Origin:c,ExcludeCases:[],PageNumber:1,PageSize:i.pageSizeList[0].Value,Units:u.Units,Wkid:u.Wkid,IncludeCodeCases:!1,IncludeRequests:!1,ParcelNumber:n.selectedAddress.parcelNumber,Address:n.selectedAddress.Address,HiddenInspectionTypeIDs:[]},f==="inspections"&&(o.Module=t.Inspection,n.inspectionsList&&(o.PageNumber=e?n.inspectionsList.CurrentPage+1:n.inspectionsList.CurrentPage-1,o.PageNumber>=1&&o.PageNumber<=n.inspectionsList.TotalPages&&(n.inspectionsList=null,r.searchByBufferModuleCriteria(o,null,function(t){n.inspectionsList=t})))),f==="codecases"&&(o.Module=t.CodeCase,n.codecasesList&&(o.PageNumber=e?n.codecasesList.CurrentPage+1:n.codecasesList.CurrentPage-1,o.PageNumber>=1&&o.PageNumber<=n.codecasesList.TotalPages&&(n.codecasesList=null,r.searchByBufferModuleCriteria(o,null,function(t){n.codecasesList=t})))),f==="requests"&&(o.Module=t.Request,n.requestsList&&(o.PageNumber=e?n.requestsList.CurrentPage+1:n.requestsList.CurrentPage-1,o.PageNumber>=1&&o.PageNumber<=n.requestsList.TotalPages&&(n.requestsList=null,r.searchByBufferModuleCriteria(o,null,function(t){n.requestsList=t})))),f==="permits"&&(o.Module=t.Permit,n.permitsList&&(o.PageNumber=e?n.permitsList.CurrentPage+1:n.permitsList.CurrentPage-1,o.PageNumber>=1&&o.PageNumber<=n.permitsList.TotalPages&&(n.permitsList=null,r.searchByBufferModuleCriteria(o,null,function(t){n.permitsList=t})))),f==="plans"&&(o.Module=t.Plan,n.plansList&&(o.PageNumber=e?n.plansList.CurrentPage+1:n.plansList.CurrentPage-1,o.PageNumber>=1&&o.PageNumber<=n.plansList.TotalPages&&(n.plansList=null,r.searchByBufferModuleCriteria(o,null,function(t){n.plansList=t})))))};n.nextPage=function(n){e(n,!0)};n.previousPage=function(n){e(n,!1)};f=function(f,e){var y,p,s,c,l,a,v;if(n.wkid&&n.selectedAddress&&n.config)if(n.isSearchingPermit=!0,n.isSearchingPlan=!0,n.isSearchingInspection=!0,n.isSearchingCodeCase=!0,n.isSearchingRequest=!0,n.permitsList=null,n.plansList=null,n.inspectionsList=null,n.codecasesList=null,n.requestsList=null,y={X:n.selectedAddress.X,Y:n.selectedAddress.Y,Wkid:n.wkid},n.selectedAddress.Point){var w=n.selectedAddress,h={ActiveDuring:n.mapFiltersCriteria.ActiveDuring,AllData:n.mapFiltersCriteria.AllData,AppliedDuring:n.mapFiltersCriteria.AppliedDuring,FirstCorner:w.FirstCorner,MapSearchModule:t.Permit,EnerGovMapSearchModule:n.mapFiltersCriteria.MapSearchModule,PageNumber:1,PageSize:i.pageSizeList[0].Value,SecondCorner:w.SecondCorner,HiddenInspectionTypeIDs:[]},o=angular.copy(h);r.searchByFilterModuleCriteria(o,function(t){n.permitsList=t;n.isSearchingPermit=!1;n.permits=n.permitsList.TotalFound});o=angular.copy(h);o.MapSearchModule=t.Plan;r.searchByFilterModuleCriteria(o,function(t){n.plansList=t;n.isSearchingPlan=!1;n.plans=n.plansList.TotalFound});o=angular.copy(h);o.MapSearchModule=t.Inspection;r.searchByFilterModuleCriteria(o,function(t){n.inspectionsList=t;n.isSearchingInspection=!1;n.inspections=n.inspectionsList.TotalFound});o=angular.copy(h);o.MapSearchModule=t.CodeCase;r.searchByFilterModuleCriteria(o,function(t){n.codecasesList=t;n.isSearchingCodeCase=!1;n.codecases=n.codecasesList.TotalFound});o=angular.copy(h);o.MapSearchModule=t.Request;r.searchByFilterModuleCriteria(o,function(t){n.requestsList=t;n.isSearchingRequest=!1;n.requests=n.requestsList.TotalFound})}else u={AggregationPrecision:n.config.ArcGisBufferAggregationPrecision,DistanceFromOrigin:f,Origin:{lat:n.selectedAddress.Y,lon:n.selectedAddress.X},Units:e,Wkid:n.config.LocatorOutputWKID,MapWkid:n.wkid,ArcGisGeometryServiceUrl:n.config.ArcGisGeometryServiceUrl},p={Latitude:u.Origin.lat,Longitude:u.Origin.lon},s={DistanceFromOrigin:u.DistanceFromOrigin,ArcGisGeometryServiceUrl:u.ArcGisGeometryServiceUrl,MapWkid:u.MapWkid,Module:t.Permit,Origin:p,PageNumber:1,ExcludeCases:[],PageSize:i.pageSizeList[0].Value,Units:u.Units,Wkid:u.Wkid,IncludeCodeCases:!1,IncludeRequests:!1,ParcelNumber:n.selectedAddress.parcelNumber,Address:n.selectedAddress.Address,HiddenInspectionTypeIDs:[]},r.searchByBufferModuleCriteria(s,null,function(t){n.permitsList=t;n.isSearchingPermit=!1;n.permits=n.permitsList.TotalFound}),c=angular.copy(s),c.Module=t.Plan,r.searchByBufferModuleCriteria(c,null,function(t){n.plansList=t;n.isSearchingPlan=!1;n.plans=n.plansList.TotalFound}),l=angular.copy(s),l.Module=t.Inspection,r.searchByBufferModuleCriteria(l,null,function(t){n.inspectionsList=t;n.isSearchingInspection=!1;n.inspections=n.inspectionsList.TotalFound}),a=angular.copy(s),a.Module=t.CodeCase,r.searchByBufferModuleCriteria(a,null,function(t){n.codecasesList=t;n.isSearchingCodeCase=!1;n.codecases=n.codecasesList.TotalFound}),v=angular.copy(s),v.Module=t.Request,r.searchByBufferModuleCriteria(v,null,function(t){n.requestsList=t;n.isSearchingRequest=!1;n.requests=n.requestsList.TotalFound}),r.searchForParcelData(n.config,y,function(t){n.selectedAddress&&t.Result&&(n.selectedAddress.owner=t.Result[0].ParcelOwner,n.selectedAddress.parcelNumber=t.Result[0].ParcelNumber,n.selectedAddress.isMultiple=t.Result[0].IsMultiple)})};n.$on("onBufferFeetChange",function(t,i){i.bufferInFeet==null||i.bufferInFeet==0?f(n.config.ArcGisBufferDistanceFromOrigin,n.config.ArcGisBufferUnits):f(i.bufferInFeet,"Feet")});o=n.$watch("selectedAddress",function(){n.config!==undefined&&f(n.config.ArcGisBufferDistanceFromOrigin,n.config.ArcGisBufferUnits)});n.$on("$destroy",function(){o()})},u}return __extends(i,n),i}(app.Directives.Core.BaseDirective);n.AddressDetailsDirective=i;r=function(n){function t(){var t=n.call(this)||this;return t.restrict="A",t.link=function(n,t){t.on("keydown",function(n){var i=$(this),t=i.val();return t=t.replace(/[^0-9]/g,""),i.val(t),n.which==64||n.which==16?!1:n.which>=48&&n.which<=57?!0:n.which>=96&&n.which<=105?!0:[8,9,13,27,37,38,39,40,46].indexOf(n.which)>-1?!0:(n.preventDefault(),!1)})},t}return __extends(t,n),t}(app.Directives.Core.BaseDirective);n.AllowNumberDirective=r;f=function(){function n(n,t,i,r){var u=this,e,f;for(this.totalChunks=0,this.chunkBlobs=[],this.getEmptyChunkIndexes=function(){for(var t=u,i=[],n=0;n<t.totalChunks;n++)t.chunkBlobs[n]==null&&i.push(n);return i},this.getByteRangeHeaderValue=function(n){var t=u,i=n===0?0:t.downloadConfig.chunkSize*n,r=i+t.downloadConfig.chunkSize-1;return"bytes="+i+"-"+r},this.addChunk=function(n){var t=u;u.chunkBlobs[n.chunkIndex]=n.content},this.completeDownload=function(){var n=u,t=new Blob(u.chunkBlobs,{type:n.contentType});if(n.chunkBlobs=null,n.content=t,n.onFileComplete)n.onFileComplete(n)},this.haveAllChunksDownloaded=function(){var n=u,t=n.getEmptyChunkIndexes();return t.length<=0},this.identifier=n,this.metadata=t,this.downloadConfig=i,this.onFileComplete=r,e=Math.ceil(t.fileSize/i.chunkSize),this.totalChunks=e,f=0;f<e;f++)this.chunkBlobs[f]=null}return n}();n.FileDetails=f;u=function(n){function t(t,i,r,u,f,o,s){var h=n.call(this)||this,c;return h.$window=t,h.settingsService=s,h.downloadConfig={},h.inProgress=!1,h.hasError=!1,h.isPaused=!1,h.percentComplete=0,h.onFileStarted=function(n){var t=h;t.fileMetadata=n;t.inProgress=!0},h.onFileProgress=function(n){var t=h;t.percentComplete=n*100},h.onFileComplete=function(n){var e=h,t,o,u,f,i,r,s;e.inProgress=!1;e.percentComplete=100;t=window.navigator.userAgent;t.indexOf("Trident/")>0||t.indexOf("Edge")>0?window.navigator.msSaveOrOpenBlob(n.content,n.metadata.fileName):t.match("FxiOS")?alert("Cannot display on FF iOS"):t.match("CriOS")?(o=new Blob([n.content],{type:"application/pdf"}),u=(window.URL||window.webkitURL).createObjectURL(o),window.open(u,"_blank"),(window.URL||window.webkitURL).revokeObjectURL(u)):t.indexOf("Chrome")!=-1||t.indexOf("Firefox")!=-1||t.indexOf("Safari")!=-1?(f=window.URL.createObjectURL(n.content),i=angular.element("<a><\/a>"),i.attr("href",f),i.attr("download",n.metadata.fileName),i.attr("target","_self"),i[0].click(),window.URL.revokeObjectURL(f)):t.match(/iPad/i)||t.match(/iPhone/i)?(r=window.URL.createObjectURL(n.content),window.location.href=r):(r=URL.createObjectURL(n.content),s=window.open(r))},h.onFileError=function(n){var t=h;if(t.hasError=!0,t.inProgress=!1,t.percentComplete=0,t.onError)t.onError({identifier:t.identifier,error:n})},c=h,c.downloadConfig.simultaneousDownloads=5,h.scope={attachmentId:"=",attachmentName:"=",fileType:"=",ereviewCorrection:"="},h.template="<a class='attachment cursor-pointer' target=\"_blank\" download={{attachmentName}}>{{attachmentName}}<\/a>",h.link=function(n,i){i.on("click keyup",function(i){(i.type=="click"||i.type=="keyup"&&i.keyCode==13)&&c.settingsService.getFileDownloadChunkSize(function(i){c.downloadConfig.chunkSize=i;e(o.enerGovAPIVersion,"2016.3.0.212")?f.downloadFile(n.attachmentId,c.downloadConfig,null,c.onFileStarted,c.onFileProgress,c.onFileComplete,c.onFileError,n.fileType,n.ereviewCorrection):u.getAttachmentById(function(i){var f,e,o,u,s,r,h;if(i!=null)if(f=t.navigator.userAgent,f.indexOf("Trident/")>0||f.indexOf("Edge")>0){for(e=atob(i),o=[],u=0;u<e.length;u++)o.push(e.charCodeAt(u));s=new Blob([new Uint8Array(o)],{type:"application/octet-stream"});t.navigator.msSaveOrOpenBlob(s,n.attachmentName)}else r=angular.element("<a/>"),r.attr({id:n.attachmentId,href:"data:application/octet-stream;base64,"+i,target:"_blank",download:n.attachmentName}),h=angular.element(document).find("body").eq(0),h.append(r),r[0].click(),r.remove()},n.attachmentId)})})},h}return __extends(t,n),t}(app.Directives.Core.BaseDirective);n.DownloadAttachmentDirective=u;angular.module("app.EnerGov.Directives.Map",[]).directive("downloadattachment",["$window","$sce","$timeout","enerGovEntityAttachmentSearchService","fileDownloadService","globalsService","settingsService",function(n,t,i,r,f,e,o){return new u(n,t,i,r,f,e,o)}]).directive("allowNumbers",[function(){return new r}]).directive("energovAddressDetails",["globalsService","enerGovMapService",function(n,t){return new i(n,t)}])})(t=n.Map||(n.Map={}))})(t=n.Directives||(n.Directives={}))}(EnerGov||(EnerGov={}));__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(t){"use strict";var i=function(n){function t(){var t=n.call(this)||this;return t.restrict="E",t.replace=!0,t.scope={bindingSource:"=",bindingTarget:"="},t.link=function(n){n.$watch("bindingSource",function(t){n.bindingTarget=t})},t}return __extends(t,n),t}(n.Core.BaseDirective);t.BindCaseApplyServiceDirective=i;angular.module("app.Directives.EnergovCaseApply",[]).directive("energovBindCaseApplyService",[function(){return new i}])})(t=n.EnergovCaseApply||(n.EnergovCaseApply={}))})(t=n.Directives||(n.Directives={}))}(app||(app={}));__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(i){var u=n.call(this)||this,r=u;return r.currentPage=0,u.restrict="A",r.currentlyShownPages=[],u.templateUrl=i.tenantUrl&&i.tenantUrl.length>0?i.baseUrl+i.tenantUrl+"/directiveTemplate/paginationTemplate?v="+i.version:i.baseUrl+"directiveTemplate/paginationTemplate?v="+i.version,u.replace=!0,u.scope={currentPage:"=",totalPages:"=",totalFound:"=",goToPage:"&",firstLoad:"=",resetFirstPage:"=",pageSize:"=",showBusySignal:"=",changePageSize:"&",searchCompleted:"=",pageLoadCompleted:"=",refreshPaging:"="},u.link=function(n,u,f){var h,s,e;f.pageSizeChanged=!1;f.pageNumberChanged=!1;u.removeAttr("tabindex");n.$watch("pageSize",function(n,t){n&&n!=t&&n==i.pageSizeList[0].Value&&$("#pageSizeList").val(n)});$.each(i.pageSizeList,function(n,t){u.find("#pageSizeList").append($("<option><\/option>").attr("value",t.Value).attr("label",t.Key).text(t.Key))});h=i.pageSizeList.filter(function(t){return t.Value==n.pageSize});s="";h.length==0||n.pageSize==10?(n.pageSize=i.pageSizeList[0].Value,s=":first"):s="[value="+h[0].Value+"]";u.find("#pageSizeList option"+s).attr("selected","selected");u.find("#pageSizeList").change(function(){var t=parseInt(u.find("#pageSizeList").val(),10);u.find("#pagingError").addClass("pagingError");n.$apply(function(){f.pageSizeChanged=!0;n.changePageSize({pageSize:t})})});e=u.find("#paginationList");e.addClass("pagination");var o=function(t){var e,r,i;n.pagingError=!1;t.preventDefault();e=angular.element(t.delegateTarget);e.hasClass("disabled")||(r=t.data.page,r===">"?n.pageSize*parseInt((n.currentPage+1).toString(),10)>1e4?(n.pagingError=!0,i=n.currentPage):(i=n.currentPage+1,i>n.totalPages&&(i=n.totalPages)):r===">>"?n.totalFound>1e4?(n.pagingError=!0,i=1e4/n.pageSize):i=n.totalPages:r==="<<"?i=1:r==="<"?(i=n.currentPage-1,i<1&&(i=1)):n.pageSize*parseInt(r,10)>1e4?(n.pagingError=!0,i=n.currentPage):i=parseInt(r,10),n.currentPage=i,n.pagingError===!0?u.find("#pagingError").removeClass("pagingError"):u.find("#pagingError").addClass("pagingError"),n.$apply(function(){f.pageNumberChanged=!0;n.goToPage({pageNumber:i,pagingError:n.pagingError})}))},l=function(){var t=!1;return angular.forEach(u.children(),function(i){var r=angular.element(i);r.text()===n.currentPage.toString()&&(t=!0)}),t},c=function(i){var v,p,w,b,s,h,c,a,k,y;if(console.log("refresh called"),v=r.totalPages,r.totalPages=n.totalPages,r.currentPage=n.currentPage,console.log("total pages"+r.totalPages),r.totalPages>0){if(p=i||r.currentPage>r.totalPages,p&&(r.currentPage=1),console.log("has page button"),console.log("goToFirstPage"+i),console.log("totalPages local variable"+v),console.log("totalPages scope variable"+r.totalPages),w=!l()||i||v!==r.totalPages,console.log("total pages"+r.totalPages),w){for(e.empty(),b=5,s=r.currentPage;s+4>r.totalPages;)s--;for(s<1&&(s=1),r.currentlyShownPages=[],h=s;h<=r.totalPages;h++)if(h<s+b)r.currentlyShownPages.push(h);else break;for(e.append(t.createButton("<<","link-FirstPage","first page",f.tabindex,o)),e.append(t.createButton("<","link-PreviousPage","previous page",f.tabindex,o)),c=0;c<r.currentlyShownPages.length;c++)a=r.currentlyShownPages[c].toString(),k=t.createButton(a,"link-Page"+a,"page "+a,f.tabindex,o),e.append(k);e.append(t.createButton(">","link-NextPage","next page",f.tabindex,o));e.append(t.createButton(">>","link-LastPage","last page",f.tabindex,o))}angular.forEach(e.children(),function(n){var t=angular.element(n),i=t.text();r.currentPage===r.totalPages&&(i===">"||i===">>")?t.addClass("disabled"):r.currentPage===1&&(i==="<"||i==="<<")?t.addClass("disabled"):t.removeClass("disabled");i===r.currentPage.toString()?t.addClass("active"):t.removeClass("active")});y=t.calculateStartAndEndCount(n.totalFound,r.currentPage,parseInt(u.find("#pageSizeList").val(),10));u.find("#startAndEndCount").html(y.start+" - "+y.end+" of "+n.totalFound);u.find(".pagination-text").attr("tabindex",f.tabindex);u.find("#pageSizeList").attr("tabindex",f.tabindex);u.find("#spinningIcon").attr("tabindex",f.tabindex)}else e.empty()},a=n.$watch("refreshPaging",function(){console.log("refreshPaging called");n.firstLoad||(u.find("#spinningIcon").show(),u.find(".form-group").hide());n.showBusySignal?u.find("#spinningIcon").show():u.find("#spinningIcon").hide();n.resetFirstPage?c(!0):c(!1);n.totalFound>0&&(u.find(".form-group").show(),f.pageNumberChanged&&u.find("#paginationList").find(".active").find("a").focus());f.pageNumberChanged=!1});n.$on("$destroy",function(){a()})},u}return __extends(t,n),t.createButton=function(n,t,i,r,u){var f=angular.element("<li><a id='"+t+"'href=# aria-label='"+i+"' tabindex='"+r+"'>"+n+"<\/a><\/li>");return f.click({page:n},u),f},t.calculateStartAndEndCount=function(n,t,i){var r,u;return t*i>=n?(r=(t-1)*i+1,u=n):(r=(t-1)*i+1,u=r+i-1),{start:r,end:u}},t}(n.Directives.Core.BaseDirective);t.EnergovCustomPagination=i;angular.module("app.Directives.EnergovPagination",[]).directive("energovCustomPagination",["globalsService",function(n){return new i(n)}])})(i=t.EnergovPagination||(t.EnergovPagination={}))})(t=n.Directives||(n.Directives={}))}(app||(app={}));__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){var t;(function(n){"use strict";var t=function(n){function t(){var t=n.call(this)||this;return t.link=function(n,t){t.on("click",function(n){var t=angular.element(n.target.parentElement).find("#FilenameModal"),i=angular.element(n.target.parentElement).find("#filename");t.modal("show");t.on("shown.bs.modal",function(){i.focus()});t.find("#Cancelclick").on("keydown",function(n){n.shiftKey||$("this:focus")&&n.which===9&&(n.preventDefault(),i.focus())});i.on("keydown",function(n){n.shiftKey&&n.which===9&&n.preventDefault()})})},t.restrict="A",t}return __extends(t,n),t}(app.Directives.Core.BaseDirective);n.EnergovExportDirective=t;angular.module("app.EnerGov.Common.Directives.ExportToExcel",[]).directive("exportToExcel",[function(){return new t}])})(t=n.ExportToExcel||(n.ExportToExcel={}))})(t=n.Directive||(n.Directive={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={}));__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){var i;(function(t){var i=function(t){function i(i,r){var u=t.call(this)||this;return u.$timeout=i,u.$parse=r,u.restrict="A",u.bindToController=!0,u.link=function(t,r){var u=r,f=function(){$(u).attr("element-to-focus-id")!==undefined&&$(u).attr("element-to-focus-id")!==null&&$(u).attr("element-to-focus-id")!==""&&i(function(){angular.element("#"+$(u).attr("element-to-focus-id")).focus()})};r.on("click",function(){f(u)});r.on("keydown",function(t){t.shiftKey?t.which===9&&angular.element(r).attr("id")==="detailId"&&(n.Calendar.EnerGovCalendar.clickedEvent.focus(),t.preventDefault()):t.which===9?angular.element(r).attr("id")==="lastElement"&&i(function(){n.Calendar.EnerGovCalendar.clickedEvent.focus()}):t.which===13&&(angular.element(r).attr("id")==="lastElement"?i(function(){n.Calendar.EnerGovCalendar.clickedEvent.focus()}):f(u))})},u}return __extends(i,t),i}(app.Directives.Core.BaseDirective);t.FocusElement=i})(i=t.FocusElement||(t.FocusElement={}))})(i=t.Directives||(t.Directives={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={}));__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){var t;(function(n){"use strict";var t=function(n){function t(){var t=n.call(this)||this;return t.restrict="A",t.replace=!0,t.scope={showMessage:"="},t.link=function(n,t){n.$watch("showMessage",function(n,i){var u=t.find("#GeoRuleNotificationClose"),r=t.find("#GeoRuleNotificationHeader");if(!i&&n){t.modal("show");t.on("shown.bs.modal",function(){r.focus()})}u.on("keydown",function(n){!n.shiftKey&&$("this:focus")&&n.which===9&&(n.preventDefault(),r.focus())});r.on("keydown",function(n){n.shiftKey&&n.which===9&&n.preventDefault()})})},t}return __extends(t,n),t}(app.Directives.Core.BaseDirective);n.GeoRuleNotificationModel=t;angular.module("app.EnerGov.Common.Directives.GeoRuleNotificationModel",[]).directive("geoRuleNotificationModel",[function(){return new t}])})(t=n.GeoRuleNotificationModel||(n.GeoRuleNotificationModel={}))})(t=n.Directive||(n.Directive={}))})(t=n.Common||(n.Common={}))}(EnerGov||(EnerGov={}));__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 i=function(n){function t(t){var i=n.call(this)||this;return i.restrict="E",i.replace=!0,i.templateUrl=t.baseUrl+t.tenantUrl+"/home/IFrameTemplate",i.controllerAs="vm",i.scope={url:"="},i.controller="iFrameDirectiveController",i}return __extends(t,n),t}(app.Directives.Core.BaseDirective),t;n.IFrameDirective=i;t=function(n){function t(t,i){var r=n.call(this,null)||this,u;return r.$scope=t,r.$sce=i,r.securedurl="",u=r,u.$scope.$watch("vm.$scope.url",function(n){if(n){var t=n.replace(/\/+$/,"");u.securedurl=u.$sce.trustAsResourceUrl(t)}}),r}return __extends(t,n),t}(app.Core.Controllers.CoreController);n.IFrameDirectiveController=t;angular.module("EnerGov.Directives.IFrame",[]).controller("iFrameDirectiveController",["$scope","$sce",t]).directive("iFrame",["globalsService",function(n){return new i(n)}])})(t=n.IFrame||(n.IFrame={}))})(t=n.Directives||(n.Directives={}))}(EnerGov||(EnerGov={}));__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){var u=t.call(this)||this,r,f,e,o,s;return u.restrict="A",u.replace=!0,u.template="",r="",f=null,u.scope={item:"=",cssClass:"@?"},e=function(n,t,i){s(t);switch(n){case"pdf":r="<span class='"+i.cssClass+" pdf-icon mdi mdi-file-pdf-box'><\/span>";break;case"doc":case"docx":r="<span class='"+i.cssClass+" doc-icon mdi mdi-file-word-box'><\/span>";break;case"xls":case"xlsx":case"csv":r="<span class='"+i.cssClass+" xls-icon mdi mdi-file-excel-box'><\/span>";break;case"ppt":case"pptx":r="<span class='"+i.cssClass+" ppt-icon mdi mdi-file-powerpoint-box'><\/span>";break;case"tiff":case"tif":case"jpg":case"jpeg":case"gif":case"png":case"bmp":r="<span class='"+i.cssClass+" mdi mdi-image image-icon'><\/span>";break;default:r="<span class='"+i.cssClass+" txt-icon mdi mdi-file-document-box'><\/span>"}f=angular.element(r).appendTo(t)},o=function(t,u){var o,e;s(u);t.item.file===null?(r=t.item.type==n.Attachment.Models.AttachmentType.EReview?'<img src="'+t.item.ereviewProjectFile.LatestVersion.ThumbnailUrl+'&ereview=1&width=180&height=100" class="image-preview '+t.cssClass+'">':'<img src="'+t.item.attachment.ThumbnailUrl+'&width=180&height=100" class="image-preview '+t.cssClass+'">',f=angular.element(r).appendTo(u),o=i(f)(t)):(e=new FileReader,e.readAsDataURL(t.item.file.file),e.onload=function(){r='<img src="'+e.result+'" class="image-preview '+t.cssClass+'">';f=angular.element(r).appendTo(u);var n=i(f)(t)})},u.link=function(t,i){t.$watch("item",function(){var u=!1,r;t.cssClass||(t.cssClass="file-preview-size");t.item&&t.item.file===null?(r=t.item.type==n.Attachment.Models.AttachmentType.EReview&&t.item.ereviewProjectFile?t.item.ereviewProjectFile.LatestVersion.SaveFileName.substr(t.item.ereviewProjectFile.LatestVersion.SaveFileName.lastIndexOf(".")+1):t.item.name.substr(t.item.name.lastIndexOf(".")+1),angular.forEach(["jpg","jpeg","gif","png","bmp"],function(i){if(i==r.toLowerCase()&&(t.item.type==n.Attachment.Models.AttachmentType.EReview&&t.item.ereviewProjectFile&&t.item.ereviewProjectFile.LatestVersion.ThumbnailUrl!==null||t.item.type==n.Attachment.Models.AttachmentType.Attachment&&t.item.attachment.ThumbnailUrl!==null))return u=!0}),u?o(t,i):e(r.toLowerCase(),i,t)):(r=t.item.file.getExtension(),r.toLowerCase()!="tiff"&&r.toLowerCase()!="tif"&&t.item.file.file.type.match(/image.*/)?o(t,i):e(r.toLowerCase(),i,t))})},s=function(n){var i=n[0].getElementsByTagName("span")[0],t;i&&n[0].removeChild(i);t=n[0].getElementsByTagName("img")[0];t&&n[0].removeChild(t)},u}return __extends(i,t),i}(app.Directives.Core.BaseDirective);t.TylerFileIconDirective=i;angular.module("EnerGov.Directives.TylerFileIcon",[]).directive("tylerFileIcon",["$compile",function(n){return new i(n)}])})(i=t.TylerFileIcon||(t.TylerFileIcon={}))})(t=n.Directives||(n.Directives={}))}(EnerGov||(EnerGov={}));__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){var i=n.call(this)||this;return i.restrict="EA",i.replace=!0,i.scope={entityValue:"=",field:"@?",highlights:"=",index:"@?",isFooter:"@?",tabIndex:"@?"},i.link=function(n,i){var s=null,o="",u=n.entityValue||"",f="",r,e,h,c;if(n.highlights&&n.highlights.length>0)for(r=0;r<n.highlights.length;r++){if(n.index=n.index||-1,n.index!==-1&&n.highlights[r].Field===n.field&&n.highlights[r].ChildIndex===n.index){u=n.highlights[r].HighlightText;break}if(n.highlights[r].Field===n.field&&n.field!="typeName"){u=n.highlights[r].HighlightText;break}if(!n.isFooter&&n.field==="typeName"&&(n.highlights[r].Field==="typeName"||n.highlights[r].Field==="workClassName"))if(e=n.highlights[r].HighlightText.replace(/<span class='eg-global-search-highlight'>/g,"").replace(/<[/]span>/g,""),n.highlights[r].Field==="workClassName"&&n.entityValue.indexOf(e)>-1)if(f){u=f+" - "+n.highlights[r].HighlightText;break}else u=n.entityValue.split(" - "+e)[0]+" - "+n.highlights[r].HighlightText,f=n.highlights[r].HighlightText;else if(n.highlights[r].Field==="typeName"&&n.entityValue.indexOf(e)>-1)if(f){u=n.highlights[r].HighlightText+" - "+f;break}else h=n.entityValue.split(e+" - ")[1],u=h?n.highlights[r].HighlightText+" - "+n.entityValue.split(e+" - ")[1]:n.highlights[r].HighlightText,f=n.highlights[r].HighlightText;n.highlights[r].ShowInFooter&&n.isFooter&&(o=o+"<div class='col-sm-10 form-inline' tabIndex = "+n.tabIndex+"><label>"+n.highlights[r].FriendlyName+"<\/label><span class='margin-md-left'>"+n.highlights[r].HighlightText+"<\/span><\/div>")}o||n.isFooter||(o="<span class='margin-md-left'>"+u+"<\/span>");s=angular.element(o).appendTo(i);c=t(s)(n)},i}return __extends(t,n),t}(app.Directives.Core.BaseDirective);n.TylerHighlightDirective=t;angular.module("EnerGov.Directives.TylerHighlight",[]).directive("tylerHighlight",["$compile",function(n){return new t(n)}])})(t=n.TylerHighlight||(n.TylerHighlight={}))})(t=n.Directives||(n.Directives={}))}(EnerGov||(EnerGov={}));__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 e=n.call(this)||this,f;return e.restrict="EA",e.replace=!0,e.templateUrl=r.baseUrl+r.tenantUrl+"/EnerGovApply/SignaturePad",e.scope={height:"@",width:"@",clear:"&",agreementText:"@",canvasHeaderText:"@",signatureConsentText:"@",tabIndex:"@"},e.link=function(n){function s(n,t,i,r,u){for(var e=[],h=0,f,o,s,c=n.measureText("M").width*1.2;t.length;){for(f=t.length;n.measureText(t.substr(0,f)).width>i;f--);if(s=t.substr(0,f),f!==t.length)for(o=0;s.indexOf(" ",o)!==-1;o=s.indexOf(" ",o)+1);e.push(s.substr(0,o||s.length));h=Math.max(h,n.measureText(e[e.length-1]).width);t=t.substr(e[e.length-1].length,t.length)}for(f=0,o=e.length;f<o;++f)n.fillText(e[f],r,u-c*(e.length-f-1))}var h=e,o={penColor:"rgb(0, 0, 0)",backgroundColor:"rgb(255,255,255)",canvasHeaderText:n.canvasHeaderText+"\n"+moment(new Date).format("MMMM, DD YYYY")},t=document.getElementById("canvas"),r;t.height=n.height;t.width=n.width;t.getContext("2d");f=new SignaturePad(t,o);angular.element(t).bind("click",function(){n.isType||r()});angular.element(t).bind("touchend",function(){n.isType||r()});angular.element(t).on("mouseleave",function(){n.isType||r()});i.isSignatureAddded&&i.imageData.imageBlob&&f.fromDataURL(i.imageData.imageBlob);i.imageData.consentName&&(n.consentName=i.imageData.consentName);i.isType&&(n.isType=i.isType,i.signatureTypedName&&(n.signatureTypedName=i.signatureTypedName));n.clear=function(n){f.clear(n);i.imageData.imageBlob="";i.isSignatureAddded=!1};n.changeConsentname=function(){i.imageData.consentName=n.consentName};n.changeSignatureType=function(){if(n.isType){i.isType=!0;f.off();n.clear(!0);var t=angular.element("#signatureTypedNameId");t&&u(function(){t.focus()},300)}else i.isType=!1,f.on(),n.clear();n.signatureTypedName=""};n.fillSignatureBox=function(){n.clear(!0);f._ctx.font="45px Brush Script MT, Brush Script Std, cursive";s(f._ctx,n.signatureTypedName,t.width-55,55,t.height-28);i.signatureTypedName=n.signatureTypedName;n.signatureTypedName.length>0&&(f._isEmpty=!1,r())};r=function(){if(!f.isEmpty()){var t=f.toDataURL("image/jpeg");i.imageData.consentName=n.consentName;i.imageData.imageBlob=t;i.isSignatureAddded=!0;n.$evalAsync()}}},e}return __extends(t,n),t}(app.Directives.Core.BaseDirective);n.TylerSignaturePadDirective=t;angular.module("EnerGov.Directives.TylerSignaturePad",[]).directive("tylerSignaturePad",["$window","tylerSignaturePadService","globalsService","$timeout",function(n,i,r,u){return new t(n,i,r,u)}])})(t=n.TylerSignaturePad||(n.TylerSignaturePad={}))})(t=n.Directives||(n.Directives={}))}(EnerGov||(EnerGov={}));__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){var i=n.call(this)||this;return i.restrict="EA",i.replace=!0,i.scope={staffName:"@",staffEmail:"@",tabIndex:"@",enableStaffNameAsEmail:"@",isReview:"=?"},i.link=function(n,i){var r=n.enableStaffNameAsEmail&&n.enableStaffNameAsEmail.toLowerCase()=="true";n.$watch("staffName",function(u){var s;if(u){var e=null,f="",o=u.toLowerCase()!=" "&&u.toLowerCase()!="";r&&n.staffName.toLowerCase()!="administrator, system"&&n.staffName.toLowerCase()!="system administrator"&&n.staffName.toLowerCase()!="administrator system"?f=n.isReview?'<a ng-if = "'+o+'" class="glyphicon glyphicon-envelope review-envelope-icon" tabindex = '+n.tabIndex+' href="mailTo:'+n.staffEmail+'"> <\/a>':"<a tabindex = "+n.tabIndex+' href="mailTo:'+n.staffEmail+'">'+n.staffName+"<\/a>":n.isReview||(f="<span tabindex = "+n.tabIndex+">"+n.staffName+"<\/span>");e=angular.element(f).appendTo(i);s=t(e)(n)}})},i}return __extends(t,n),t}(app.Directives.Core.BaseDirective);n.TylerStaffEmailDirective=t;angular.module("EnerGov.Directives.TylerStaffEmail",[]).directive("tylerStaffEmail",["$compile",function(n){return new t(n)}])})(t=n.TylerStaffEmail||(n.TylerStaffEmail={}))})(t=n.Directives||(n.Directives={}))}(EnerGov||(EnerGov={}));__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){var r=n.call(this)||this;return r.restrict="EA",r.replace=!0,r.scope={consolidatedData:"=",date:"=",tabIndex:"@",isCalendar:"=?",isRequestDate:"=?"},r.link=function(n,r){n.$watch("date",function(){var u=null,f="",e=i.getUpdatedDateText(n.consolidatedData,n.isCalendar,n.date,n.isRequestDate),o;f="<p tabindex = "+n.tabIndex+">"+e+"<\/p>";r[0].innerHTML!==""&&(r[0].innerHTML="");u=angular.element(f).appendTo(r);o=t(u)(n)})},r}return __extends(t,n),t}(app.Directives.Core.BaseDirective);n.TylerTimeZoneFormatterDirective=t;angular.module("EnerGov.Directives.TylerTimeZoneFormatter",[]).directive("tylerTimeZoneFormatter",["$compile","tylerTimeZoneFormatterService",function(n,i){return new t(n,i)}])})(t=n.TylerTimeZoneFormatter||(n.TylerTimeZoneFormatter={}))})(t=n.Directives||(n.Directives={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){var t,i,r;(function(n){n[n.All=1]="All";n[n.Plan=2]="Plan";n[n.Permit=3]="Permit";n[n.Inspection=4]="Inspection";n[n.BusinessLicense=5]="BusinessLicense";n[n.OverDue=6]="OverDue";n[n.DueInSevenDay=7]="DueInSevenDay";n[n.ProfLicense=11]="ProfLicense"})(t=n.InvoiceFilterOption||(n.InvoiceFilterOption={})),function(n){n[n.Paid=1]="Paid";n[n.Unpaid=2]="Unpaid";n[n.Voided=3]="Voided"}(i=n.InvoiceStatus||(n.InvoiceStatus={})),function(n){n[n.Due=1]="Due";n[n.PastDue=2]="PastDue";n[n.PartialPayment=3]="PartialPayment";n[n.PaidInFull=4]="PaidInFull";n[n.Void=5]="Void";n[n.Invoiced=6]="Invoiced";n[n.Invoiced_PastDue=7]="Invoiced_PastDue";n[n.PartialPayment_PastDue=8]="PartialPayment_PastDue";n[n.Refunded=9]="Refunded";n[n.Deleted=10]="Deleted"}(r=n.FeeStatuses||(n.FeeStatuses={}))})(t=n.Enums||(n.Enums={}))})(t=n.Invoice||(n.Invoice={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/entity/attachments/search/search"}return n.prototype.searchByCriteria=function(n,t){this.http.post(this.rootUrl,n,function(n){n.Success&&t(n)},!0)},n}();n.EnerGovInvoiceAttachmentSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Invoice||(n.Invoice={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/invoice/invoicecontacts"}return n.prototype.searchByCriteria=function(n,t){this.http.post(this.rootUrl,n,function(n){n.Success&&t(n)},!0)},n}();n.EnerGovInvoiceContactSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Invoice||(n.Invoice={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/invoice/invoicefees"}return n.prototype.searchByCriteria=function(n,t){this.http.post(this.rootUrl,n,function(n){n.Success&&t(n)},!0)},n}();n.EnerGovInvoiceFeeSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Invoice||(n.Invoice={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/invoice/invoicemiscfees"}return n.prototype.searchByCriteria=function(n,t){this.http.post(this.rootUrl,n,function(n){n.Success&&t(n)},!0)},n}();n.EnerGovInvoiceMiscFeeSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Invoice||(n.Invoice={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/invoice/invoicepayments"}return n.prototype.searchByCriteria=function(n,t){this.http.post(this.rootUrl,n,function(n){n.Success&&t(n)},!0)},n}();n.EnerGovInvoicePaymentSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Invoice||(n.Invoice={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(){function t(t){this.http=t;this.rootUrl="/energov/invoice/setup/";this.invoiceTypeList=[{Key:n.Enums.InvoiceStatus[n.Enums.InvoiceStatus.Unpaid],Value:n.Enums.InvoiceStatus.Unpaid},{Key:n.Enums.InvoiceStatus[n.Enums.InvoiceStatus.Paid],Value:n.Enums.InvoiceStatus.Paid},{Key:n.Enums.InvoiceStatus[n.Enums.InvoiceStatus.Voided],Value:n.Enums.InvoiceStatus.Voided}]}return t.prototype.getInvoiceSecondaryData=function(n){if(this.invoiceSecondaryData){n(this.invoiceSecondaryData);return}var t=this;this.http.get(this.rootUrl+"myinvoicesearchdata",function(i){i.Success&&(t.invoiceSecondaryData=i,n(i))},!0)},t.prototype.getInvoiceViewSecondaryData=function(n){if(this.invoiceViewSecondaryData){n(this.invoiceViewSecondaryData);return}var t=this;this.http.get(this.rootUrl+"invoiceviewsearchdata",function(i){i.Success&&(t.invoiceViewSecondaryData=i,n(i))},!1)},t}();t.EnerGovInvoiceSecondaryDataService=i})(t=n.Services||(n.Services={}))})(t=n.Invoice||(n.Invoice={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/invoice/"}return n.prototype.getById=function(n,t){this.http.get(this.rootUrl+n,function(n){n.Success&&t(n.Result)},!0)},n.prototype.getInvoiceEntities=function(n,t){this.http.get(this.rootUrl+"invoiceentities/"+n,function(n){n.Success&&t(n.Result)},!0)},n.prototype.getAnonymousInvoiceEntities=function(n,t){this.http.get(this.rootUrl+"anonymousinvoicedetail/"+n,function(n){n.Success&&t(n.Result)},!0)},n.prototype.getAnonymousInvoiceEntitiesList=function(n,t){this.http.post(this.rootUrl+"anonymousinvoicedetaillist",n,function(n){n.Success&&t(n.Result)},!1)},n.prototype.getReportName=function(n){this.http.get("/report/name",function(t){t.Success&&n(t.Result)},!1,{category:"invoice"})},n}();n.EnerGovInvoiceService=t})(t=n.Services||(n.Services={}))})(t=n.Invoice||(n.Invoice={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(t){"use strict";var i=function(){function t(t){this.http=t;this.rootUrl="/energov/invoice/myinvoices";this.elasticUrl="/energov/invoice/invoicesElastic";this.apiUrl="";this.isSelectAll=!1;this.currentSelectedItems=[];this.useElastic=!0;this.isUnpaidInvoiceDataPresent=!1;this.selectedInvoiceType=n.Enums.InvoiceStatus.Unpaid}return t.prototype.searchByCriteria=function(t,i){var u=this,r=this;this.apiUrl=this.useElastic?this.elasticUrl:this.rootUrl;this.http.post(this.apiUrl,t,function(f){if(f.Success){if(u.isUnpaidInvoiceDataPresent=t.StatusOption===n.Enums.InvoiceStatus.Unpaid&&t.FilterOption===n.Enums.InvoiceFilterOption.All&&f.Result&&f.Result!==null&&f.Result.length>0?!0:!1,t.StatusOption==n.Enums.InvoiceStatus.Unpaid){r.isSelectAll=!1;var e=!0;angular.forEach(f.Result,function(n){var t=r.currentSelectedItems.indexOf(n.InvoiceId,0);e&&(t!=null&&t!=-1?r.isSelectAll=!0:(r.isSelectAll=!1,e=!1));t!=null&&t!=-1&&(n.Selected=!0)})}i(f)}},!0)},t.prototype.getDetailInvoices=function(n,t,i){this.http.post("/energov/invoice/detailinvoices",n,function(n){n.Success&&i(n.Result)},!0)},t}();t.EnerGovMyInvoiceSearchService=i})(t=n.Services||(n.Services={}))})(t=n.Invoice||(n.Invoice={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(n){this.http=n;this.rootUrl="/energov/invoice/unpaidinvoice/"}return n.prototype.getByNumber=function(n,t){this.http.get(this.rootUrl+n,function(n){n.Success&&t(n.Result)})},n}();n.EnerGovPayInvoiceService=t})(t=n.Services||(n.Services={}))})(t=n.Invoice||(n.Invoice={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f){var e=n.call(this,t,i,r,u)||this,o=e;return f.getInvoiceViewSecondaryData(function(n){o.sortList=n.Result.AttachmentSortList;o.sortField=n.Result.AttachmentSortList[0].Value}),e}return __extends(t,n),t.prototype.search=function(t,i){t.ModuleId=10;n.prototype.search.call(this,t,i)},t}(app.Common.Controllers.PagedSearchController);n.EnerGovInvoiceAttachmentSearchController=t})(t=n.Invoice||(n.Invoice={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f){var e=n.call(this,t,i,r,u)||this,o=e;return f.getInvoiceViewSecondaryData(function(n){o.sortList=n.Result.ContactSortList;o.sortField=n.Result.ContactSortList[0].Value}),e}return __extends(t,n),t.prototype.search=function(t,i){t.InvoiceId=this.searchCriteria.EntityId;n.prototype.search.call(this,t,i)},t}(app.Common.Controllers.PagedSearchController);n.EnerGovInvoiceContactSearchController=t})(t=n.Invoice||(n.Invoice={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f){var e=n.call(this,t,i,r,u)||this,o=e;return f.getInvoiceViewSecondaryData(function(n){o.sortList=n.Result.PrimaryFeeSortList;o.sortField=n.Result.PrimaryFeeSortList[0].Value}),e}return __extends(t,n),t.prototype.search=function(t,i){t.InvoiceId=this.searchCriteria.EntityId;n.prototype.search.call(this,t,i)},t}(app.Common.Controllers.PagedSearchController);n.EnerGovInvoiceFeeSearchController=t})(t=n.Invoice||(n.Invoice={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f){var e=n.call(this,t,i,r,u)||this,o=e;return f.getInvoiceViewSecondaryData(function(n){o.sortList=n.Result.MiscFeeSortList;o.sortField=n.Result.MiscFeeSortList[0].Value}),e}return __extends(t,n),t.prototype.search=function(t,i){t.InvoiceId=this.searchCriteria.EntityId;n.prototype.search.call(this,t,i)},t}(app.Common.Controllers.PagedSearchController);n.EnerGovInvoiceMiscFeeSearchController=t})(t=n.Invoice||(n.Invoice={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f){var e=n.call(this,t,i,r,u)||this,o=e;return f.getInvoiceViewSecondaryData(function(n){o.sortList=n.Result.PaymentSortList;o.sortField=n.Result.PaymentSortList[0].Value}),e}return __extends(t,n),t.prototype.search=function(t,i){t.InvoiceId=this.searchCriteria.EntityId;n.prototype.search.call(this,t,i)},t}(app.Common.Controllers.PagedSearchController);n.EnerGovInvoicePaymentSearchController=t})(t=n.Invoice||(n.Invoice={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=app.Common.Helpers.ModuleHelper,i=function(n){function i(t,i,r,u,f,e,o,s,h,c,l,a,v,y){var p=n.call(this,null)||this,w;return p.$routeParams=t,p.$location=i,p.globalService=r,p.enerGovInvoiceService=u,p.cartService=f,p.energovReportService=e,p.enerGovSettingsService=o,p.pageTitleService=s,p.tabNavigatorService=h,p.tenantService=c,p.settingsService=l,p.enerGovInvoiceContactSearchService=a,p.userService=v,p.resourceService=y,p.addToCartInProgress=!1,p.isInvoicePending=!1,p.isInCart=!1,p.allowPayInvoiceNotLoggedIn=!1,p.allowPayInvoiceNotContact=!1,p.showPayNowButton=!1,p.showAddedToCartSuccess=!1,p.isBillingContact=!1,p.validationError="",p.alertMessage="",p.isTenantUsesTylerPayments=function(){var n=p;p.tenantService.isTylerPaymentsUsed(function(t){n.isTylerPaymentsUsed=t})},w=p,w.isTenantUsesTylerPayments(),w.tabNavigatorService.cleanUp(),w.isPayInvoice=t.isPayInvoice==="true",w.$routeParams.tab&&w.tabNavigatorService.selectTab(w.$routeParams.tab),p.enerGovInvoiceService.getById(p.$routeParams.id,function(n){if(w.model=n,n&&n.IsLoggedIn&&(w.isPayInvoice=!1,w.isTylerPaymentsUsed||w.cartService.getMyCartItems(function(t){t.forEach(function(t){var i=JSON.parse(t.CartData);i.InvoiceId===n.InvoiceId&&(w.isPayInvoice=!0,w.setPayNowButtonVisibility(),w.isInCart=!0)})}),w.isTylerPaymentsUsed&&(w.inTylerCartInvoiceIds=w.cartService.tylerCartItems,w.inTylerCartInvoiceIds&&w.inTylerCartInvoiceIds.length>0))){var t=p.inTylerCartInvoiceIds.filter(function(t){return t===n.InvoiceId});t&&t.length>0&&(n.InvoiceStatus="In Cart",w.isInvoicePending=!0,w.isInCart=!0)}w.invoiceIds=p.model.InvoiceId?[p.model.InvoiceId]:[];w.model.InvoiceStatus!=="Pending"||w.model.AllowPendingInvoicePayment||(w.isInvoicePending=!0);w.model==null&&(alert("Unable to load the selected invoice. Please contact your municipality about the invoice you were attempting to view. Returning to home."),p.$location.path("/dashboard"));w.pageTitleService.setPageTitle(w.model.InvoiceNumber);w.setPayNowButtonVisibility()}),w.checkLoginUserIsFromBillingContact(w.$routeParams.id),p.resourceService.getSpecificKeyValues("SelfService.Resources.SelfService",["TylerPaymentRequestErrorMessage"],function(n){p.validationError=n.TylerPaymentRequestErrorMessage}),p}return __extends(i,n),i.prototype.back=function(){window.history.back()},i.prototype.printInvoice=function(){var n=this;this.energovReportService.getReportName("invoice","","",function(t){var i=n.globalService.webApiBaseUrl+"/energov/report/single?value="+n.model.InvoiceId+"&reportName="+t+"&tenantId="+n.globalService.tenantId;window.open(i,"_new")})},i.prototype.tylerPayNow=function(){var n=this;this.invoiceIds!=null&&this.invoiceIds.length>0&&n.cartService.getTylerPaymentPageUrl(this.invoiceIds,function(t){t.IsValid&&t.RedirectUri!=""?window.location.href=t.RedirectUri:n.alertMessage=n.validationError})},i.prototype.oldPayNow=function(){var n=this,t=[];this.enerGovInvoiceService.getAnonymousInvoiceEntities(this.$routeParams.id,function(i){if(i!=null&&i.length>0&&i[0]!=null){var r=i[0],u={ItemName:r.InvoiceDescription,Due:r.InvoiceDueDate,Invoice:r.InvoiceNumber,InvoiceId:r.InvoiceId,BillingContact:r.BillingContact,ContactAddresses:r.ContactAddresses==null||r.ContactAddresses.length==0?[]:r.ContactAddresses,HomePhone:r.HomePhone,BusinessPhone:r.BusinessPhone,OtherPhone:r.OtherPhone,MobilePhone:r.MobilePhone,InvoiceEntityList:r.InvoiceEntities,InvoiceFees:r.InvoiceFees==null||r.InvoiceFees.length==0?[]:r.InvoiceFees},f={CartItemId:-1,CartDirectiveName:"energov-cart",CartData:angular.toJson(u),CartDataId:r.InvoiceId,UserId:-1,TenantId:n.globalService.tenantId,SoftwarePackageId:-1,SoftwarePackageName:"",Amount:r.TotalDue,IsNew:!0,IsDeleted:!1};t.push(f)}NProgress.start();n.globalService.showProcessing=!0;$("#overlay").focus().click();n.cartService.getPaymentPageUrl(n.$location.absUrl(),function(t){NProgress.done();n.globalService.showProcessing=!1;t.StatusCode==1?window.location.href=t.PaymentPageUrl:n.alertMessage=n.validationError},t)})},i.prototype.payNow=function(){var n=this;n.alertMessage="";n.isTylerPaymentsUsed?n.tylerPayNow():n.oldPayNow()},i.prototype.addToCart=function(){if(this.addToCartInProgress=!0,this.model.TotalDue>=.01){var n=this;n.addNewCartItem()}else this.addToCartInProgress=!1,this.$location.url("/mycart")},i.prototype.showPrintButton=function(){var n=this;return n.model?n.isPayInvoice?(!n.model.IsLoggedIn&&n.allowPayInvoiceNotLoggedIn||n.model.IsLoggedIn)&&(n.allowPayInvoiceNotContact||n.model.HasAuthorizedContact||n.isBillingContact):n.model.IsLoggedIn&&(n.allowPayInvoiceNotContact||n.model.HasAuthorizedContact||n.isBillingContact):!1},i.prototype.addNewCartItem=function(){var n=this,t={ItemName:n.model.InvoiceDescription,Due:n.model.InvoiceDueDate,Invoice:n.model.InvoiceNumber,InvoiceId:n.model.InvoiceId,BillingContact:n.model.BillingContact,ContactAddresses:n.model.ContactAddresses==null||n.model.ContactAddresses.length==0?[]:n.model.ContactAddresses,HomePhone:n.model.HomePhone,BusinessPhone:n.model.BusinessPhone,OtherPhone:n.model.OtherPhone,MobilePhone:n.model.MobilePhone,InvoiceEntityList:n.model.InvoiceEntities,InvoiceFees:n.model.InvoiceFees==null||n.model.InvoiceFees.length==0?[]:n.model.InvoiceFees},i={CartItemId:-1,CartDirectiveName:"energov-cart",CartData:angular.toJson(t),CartDataId:this.$routeParams.id,UserId:-1,TenantId:-1,SoftwarePackageId:-1,SoftwarePackageName:"",Amount:n.model.TotalDue,IsNew:!0,IsDeleted:!1};n.cartService.addCartItem(i,function(t){n.addToCartInProgress=!1;t&&(n.cartService.didCallGetTotalItem=!1,n.cartService.updateTotalNumOfItems(),n.cartService.didCallGetTotalItem=!0,n.$location.url("/mycart"))})},i.prototype.checkLoginUserIsFromBillingContact=function(n){var i=this;i.userService.isUserLoggedIn&&i.userService.getUser(function(r){var u=r,f;u.Email&&(f={InvoiceId:n,EntityId:n,ModuleId:t.getSelfServiceModuleId(i.$location,n),ContactEmailId:u.Email,PageNumber:1,PageSize:i.globalService.pageSizeList[0].Value,IsSortedInAscendingOrder:!0,SortField:""},i.enerGovInvoiceContactSearchService.searchByCriteria(f,function(n){n.Result&&(i.isBillingContact=n.Result.length>0?!0:!1)}))})},i.prototype.setPayNowButtonVisibility=function(){var n=this;n.settingsService.getAllowPayInvoiceNotLoggedInSetting(function(t){n.allowPayInvoiceNotLoggedIn=t.SettingValue==="true"?!0:!1;n.settingsService.getAllowPayInvoiceNotContactSetting(function(t){n.allowPayInvoiceNotContact=t.SettingValue==="true"?!0:!1;n.showPayNowButton=n.model.InvoiceStatus!==app.Constants.InvoiceStatus.PaidInFull&&n.model.InvoiceStatus!==app.Constants.InvoiceStatus.Void&&(n.model.IsLoggedIn&&n.isPayInvoice||!n.model.IsLoggedIn)&&(n.allowPayInvoiceNotLoggedIn||n.model.IsLoggedIn&&n.allowPayInvoiceNotContact||n.model.HasAuthorizedContact)})})},i.prototype.showAddToCartButton=function(){var n=this;return n.model.AllowAddToCart&&!n.isPayInvoice&&(n.isBillingContact&&!n.allowPayInvoiceNotContact||!n.isBillingContact&&n.allowPayInvoiceNotContact||n.isBillingContact&&n.allowPayInvoiceNotContact)},i}(app.Core.Controllers.CoreController);n.EnerGovInvoiceViewController=i})(t=n.Invoice||(n.Invoice={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(t){function i(i,r,u){var e=t.call(this,null)||this,f;return e.eventService=r,e.enerGovMyInvoiceSearchService=u,e.showHeader=!1,f=e,f.showHeader=f.$location.path()!=="/myWork",f.enerGovMyInvoiceSearchService.selectedInvoiceType=f.$routeParams.status?+f.$routeParams.status:n.Enums.InvoiceStatus.Unpaid,e}return __extends(i,t),i}(app.Core.Controllers.CoreController);n.EnerGovMyInvoiceViewController=t})(t=n.Invoice||(n.Invoice={}))}(EnerGov||(EnerGov={}));__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){"use strict";var i=function(i){function r(n,r,u,f,e,o,s,h,c,l,a){var v=i.call(this,r,u,f,e,null,!1)||this,y;return v.$scope=n,v.enerGovMyInvoiceSearchService=e,v.enerGovInvoiceSecondaryDataService=o,v.commonService=s,v.eventService=h,v.enerGovViewMyEntityCriteriaService=c,v.resourceService=l,v.enerGovMyEntityTelerikService=a,v.filename="",v.options="",v.Keyword="",v.ExactMatch=!1,v.useElastic=!0,v.includeParentRecords=!1,v.expandStatus=!0,v.startDate="",v.endDate="",v.invalidDateRange=!1,v.todaysDate=new Date,v.minDate=new Date(v.todaysDate.getFullYear()-10,v.todaysDate.getMonth(),v.todaysDate.getDate()),v.changeKeyword=function(){var n={StatusOption:v.statusOption,PageNumber:1,PageSize:v.searchCriteria.PageSize,Keyword:v.Keyword,SortField:v.searchCriteria.SortField,IsSortedInAscendingOrder:v.searchCriteria.IsSortedInAscendingOrder,ModuleId:v.searchCriteria.ModuleId,EntityId:v.searchCriteria.EntityId,FilterOption:v.filterOption,ExactMatch:v.ExactMatch,IncludeParentRecords:v.includeParentRecords};n.PageNumber=1;v.sortField=n.Keyword?v.sortList[0].Value:v.sortList[1].Value;n.SortField=v.sortField;v.search(n,app.Events.SearchEvents.SearchCompleted)},v.onFilterChange=function(){var n=v;n.searchCriteria.PageNumber=n.enerGovMyEntityTelerikService.telerikGridPageNumber;n.searchCriteria.PageSize=n.enerGovMyEntityTelerikService.telerikGridPageSize;n.updateUrl(n.filterOption);n.isLoading=!0;i.prototype.search.call(v,n.searchCriteria,app.Events.SearchEvents.SearchCompleted,function(){var t=n.searchResult;n.mainPaidGridOptions.dataSource=n.getDataSource(t);n.isLoading=!1;n.$timeout(function(){n.setGridContentHeight()},100,!0)})},y=v,y.useElastic=!0,e.useElastic=y.useElastic,y.mainPaidGridOptions=y.enerGovMyEntityTelerikService.getTelerikGridOptions(),y.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Common.CommonResource",["DatePickerInvalidDateFormat","StartDateLabel","EndDateLabel","StartDateRequiredErrorMessage","EndDateRequiredErrorMessage"],function(n){v.datePickerInvalidDateFormat=n.DatePickerInvalidDateFormat;v.startDateLabel=n.StartDateLabel;v.endDateLabel=n.EndDateLabel;v.startDateRequiredErrorMessage=n.StartDateRequiredErrorMessage;v.endDateRequiredErrorMessage=n.EndDateRequiredErrorMessage}),y.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Invoice.InvoiceResource",["MyInvoice_InvoiceNumberColumnHeader","MyInvoice_AmountPaidColumnHeader","MyInvoice_PaymentDateColumnHeader","MyInvoice_CaseNumberHeader","MyInvoice_AddressHeader","MyInvoice_DisplaySort","MyInvoice_ForLabel","MyInvoice_PaidWithin_Label","MyInvoice_StartDate_Label","MyInvoice_EndDate_Label"],function(n){v.invoiceNumberLabel=n.MyInvoice_InvoiceNumberColumnHeader;v.amountPaidLabel=n.MyInvoice_AmountPaidColumnHeader;v.paymentDateLabel=n.MyInvoice_PaymentDateColumnHeader;v.caseNumberLabel=n.MyInvoice_CaseNumberHeader;v.invoiceAddressLabel=n.MyInvoice_AddressHeader;v.myInvoiceDisplayLabel=n.MyInvoice_DisplaySort;v.myInvoiceForLabel=n.MyInvoice_ForLabel;v.myInvoicePaidWithinLabel=n.MyInvoice_PaidWithin_Label;var i=y.mainPaidGridOptions.toolbar;i.push({template:'<div ng-form="myPaidInvoicesForm">\n                                <div style="white-space: nowrap;">\n                                    <label class="k-label-margin" for= '+v.myInvoiceDisplayLabel+" > "+v.myInvoiceDisplayLabel+' <\/label>\n                                    <select aria-invalid="false" aria-label= '+v.myInvoiceDisplayLabel+' id="invoiceTypeOption" name="invoiceTypeOption" class="k-form-control" ng-model="vm.enerGovMyInvoiceSearchService.selectedInvoiceType" ng-options="item.Value as item.Key for item in vm.enerGovInvoiceSecondaryDataService.invoiceTypeList"><\/select>\n\n                                    <label class="k-label-margin" for= '+v.myInvoiceForLabel+" > "+v.myInvoiceForLabel+' <\/label>\n                                    <select  aria-invalid="false" aria-label='+v.myInvoiceForLabel+' id="paidInvoiceFilterOption" name="paidInvoiceFilterOption" class="k-form-control" ng-model="vm.filterOption" ng-options="item.Value as item.Key for item in vm.filterList" ng-change="vm.changeFilterOption(vm.filterOption)"><\/select>\n\n                                    <label class="k-label-margin"> '+v.myInvoicePaidWithinLabel+' <\/label>\n                                    <select id="myPaidInvoiceDurationList" name="myPaidInvoiceDurationList" class="k-form-control" ng-model="vm.durationFilter" ng-options="item.Value as item.Key for item in vm.durationFilterList" ng-change="vm.onDurationFilterChange()"><\/select>\n                                <\/div>\n                                    \n                               <div>\n                                    <div ng-if="vm.isCustomDurationSelected()" class="k-header-date-filter form-horizontal no-padding" style="white-space: nowrap;">\n\n                                        <label id="startDate" class="control-label date-range-label k-header-element"> {{ vm.startDateLabel }} <\/label>\n                                        <div class="input-group k-header-element" >\n                                            <md-datepicker id="StartDate" name="StartDate"\n                                                            ng-model="vm.startDate" md-placeholder="Start Date"\n                                                            aria-label="{{ vm.startDateLabel }}"\n                                                            tabindex="@tabindex"\n                                                            required\n                                                            ng-change="vm.validateDatePickerDateRange()"\n                                                            md-hide-icons="triangle"\n                                                            md-min-date="vm.minDate"><\/md-datepicker>\n                                            <div class="no-padding text-danger" ng-if="vm.invalidDateRange && myPaidInvoicesForm.$valid">{{vm.datePickerInvalidDateRange}}<\/div>\n                                            <div ng-messages="myPaidInvoicesForm.StartDate.$error" class="no-padding text-danger" role="alert">\n                                                <div ng-message="required">{{vm.startDateRequiredErrorMessage}}<\/div>\n                                                <div ng-message-default>{{vm.datePickerInvalidDateFormat}}<\/div>\n                                            <\/div>\n                                        <\/div>\n\n\n                                        <label id="endDate" class="control-label date-range-label margin-md-left k-header-element"> {{ vm.endDateLabel }} <\/label>\n                                        <div class="input-group k-header-element">\n                                            <md-datepicker id="EndDate" name="EndDate"\n                                                            ng-model="vm.endDate" md-placeholder="{{ vm.endDateLabel }}"\n                                                            aria-label="{{ vm.endDateLabel }}"\n                                                            tabindex="@tabindex"\n                                                            required\n                                                            ng-change="vm.validateDatePickerDateRange()"\n                                                            md-hide-icons="triangle"\n                                                            md-min-date="vm.minDate" ><\/md-datepicker>\n                                            <div ng-messages="myPaidInvoicesForm.EndDate.$error" class="no-padding text-danger" role="alert">\n                                                <div ng-message="required">{{vm.endDateRequiredErrorMessage}}<\/div>\n                                                <div ng-message-default>{{vm.datePickerInvalidDateFormat}}<\/div>\n                                            <\/div>\n                                        <\/div>\n\n                                        <button id="button-Go" class="k-header-btn k-header-element fa fa-search date-search-btn" type="submit" ng-click="vm.onSearchClick()"\n                                                data-ng-disabled="myPaidInvoicesForm.$invalid || vm.invalidDateRange" tabindex="@tabindex"><\/button>\n                                    <\/div>\n                                <\/div>\n                            <\/div>'});y.mainPaidGridOptions.columns=y.getTelerikGridColumns();y.enerGovViewMyEntityCriteriaService.getViewMyPaidInvoicesDetailCriteria(function(n){var i=n;v.invoiceCriteria=i;y.filterList=y.enerGovViewMyEntityCriteriaService.statusFilterList;y.filterOption=y.enerGovViewMyEntityCriteriaService.statusFilter;v.filterOption=t.Enums.InvoiceFilterOption.All;v.statusOption=t.Enums.InvoiceStatus.Paid;y.durationFilterList=c.durationFilterList;y.durationFilter=c.durationFilter;+y.$routeParams.status===y.statusOption?(y.filterOption=+y.$routeParams.filter,y.statusOption=+y.$routeParams.status):y.updateUrl(y.filterOption);y.$scope.$watch("vm.$scope.$parent.$parent.$parent.$parent.vm.includeParentRecords",function(n){y.includeParentRecords=n;i.IncludeParentRecords=n;y.enerGovMyInvoiceSearchService.selectedInvoiceType==t.Enums.InvoiceStatus.Paid&&y.searchAndFillGrid(i)})})},!0),v}return __extends(r,i),r.prototype.search=function(n,t){n.StatusOption=this.statusOption;n.FilterOption=this.filterOption;n.Keyword=this.Keyword;n.ExactMatch=this.ExactMatch;this.searchCriteria=n;i.prototype.search.call(this,n,t)},r.prototype.changeFilterOption=function(n){this.updateUrl(n);this.filterOption=n;var t={StatusOption:this.statusOption,PageNumber:1,PageSize:this.searchCriteria.PageSize,Keyword:this.Keyword,SortField:this.searchCriteria.SortField,IsSortedInAscendingOrder:this.searchCriteria.IsSortedInAscendingOrder,ModuleId:this.searchCriteria.ModuleId,EntityId:this.searchCriteria.EntityId,FilterOption:n,ExactMatch:this.ExactMatch,IncludeParentRecords:this.includeParentRecords};this.invoiceCriteria=t;this.searchAndFillGrid(t)},r.prototype.updateUrl=function(n){this.$location.search({tab:this.$routeParams.tab,status:this.statusOption,filter:n}).replace()},r.prototype.setExpandStatus=function(){this.expandStatus=!this.expandStatus},r.prototype.startSearch=function(n){this.search(n,app.Events.SearchEvents.SortCompleted)},r.prototype.fileNameOkClick=function(){var n=this,i,t;n.filename!==""&&n.filename!==undefined&&($("#FilenameModal.modal.fade.in").modal("hide"),$("div:not(.ng-hide) #button-Export").focus(),i=1,t={StatusOption:n.statusOption,PageNumber:1,PageSize:n.caseLimitForExport,Keyword:this.Keyword,SortField:n.searchCriteria.SortField,IsSortedInAscendingOrder:n.searchCriteria.IsSortedInAscendingOrder,ModuleId:n.searchCriteria.ModuleId,EntityId:n.searchCriteria.EntityId,FilterOption:this.filterOption,ExactMatch:this.ExactMatch,IncludeParentRecords:this.includeParentRecords},n.options==="default"?n.searchForExport(t,app.Events.SearchEvents.SearchCompleted,function(){n.commonService.downloadData(n.searchResultForExcel,n.filename,"paidinvoice");n.filename=""}):(n.commonService.downloadData(n.searchResult,n.filename,"paidinvoice"),n.filename=""))},r.prototype.fileNameCancelClick=function(){$("#FilenameModal.modal.fade.in").modal("hide");$("div:not(.ng-hide) #button-Export").focus()},r.prototype.isCustomDurationSelected=function(){return this.durationFilter==n.Dashboard.Enums.SearchDurationEnum.Custom},r.prototype.validateDatePickerDateRange=function(){var n=this,t=moment(n.startDate).diff(moment(n.endDate));n.invalidDateRange=isNaN(t)?!1:t>=0},r.prototype.onDurationFilterChange=function(){var n=this;n.isCustomDurationSelected()?$(".k-grid-content").height(408):(n.setDurationFilter(),n.onFilterChange(),$(".k-grid-content").height(452))},r.prototype.onSearchClick=function(){this.setDurationFilter();this.onFilterChange()},r.prototype.setDurationFilter=function(){var t=this,i;t.durationFilter==n.Dashboard.Enums.SearchDurationEnum.Custom?(t.invoiceCriteria.StartDate=moment(t.startDate).startOf("day").local().format(app.Constants.GlobalConstants.DateFormat+" "+app.Constants.GlobalConstants.DateFormatOnlyTime),t.invoiceCriteria.EndDate=moment(t.endDate).endOf("day").local().format(app.Constants.GlobalConstants.DateFormat+" "+app.Constants.GlobalConstants.DateFormatOnlyTime)):(i=t.durationFilter==n.Dashboard.Enums.SearchDurationEnum.Last_120_Days?120:moment(new Date).isLeapYear()?366:365,t.invoiceCriteria.StartDate=moment().subtract(i,"days").startOf("day").local().format(app.Constants.GlobalConstants.DateFormat+" "+app.Constants.GlobalConstants.DateFormatOnlyTime),t.invoiceCriteria.EndDate=moment().endOf("day").local().format(app.Constants.GlobalConstants.DateFormat+" "+app.Constants.GlobalConstants.DateFormatOnlyTime),t.startDate=moment(t.invoiceCriteria.StartDate).local().format(app.Constants.GlobalConstants.DateFormat),t.endDate=moment(t.invoiceCriteria.EndDate).local().format(app.Constants.GlobalConstants.DateFormat))},r.prototype.setGridContentHeight=function(){var n=this;n.isCustomDurationSelected()?$(".k-grid-content").height(408):$(".k-grid-content").height(452)},r.prototype.searchAndFillGrid=function(n){var t=this;t.isLoading=!0;n.PageSize=t.enerGovMyEntityTelerikService.telerikGridPageSize;n.PageNumber=t.enerGovMyEntityTelerikService.telerikGridPageNumber;n.StatusOption=t.statusOption;n.FilterOption=t.filterOption;t.setDurationFilter();t.searchCriteria=n;i.prototype.search.call(this,n,app.Events.SearchEvents.SearchCompleted,function(){var n=t.searchResult;t.mainPaidGridOptions.dataSource=t.getDataSource(n);t.isLoading=!1})},r.prototype.getDataSource=function(n){return new kendo.data.DataSource({transport:{read:function(t){t.success(n)}},pageSize:20,schema:{model:{fields:{InvoiceNumber:{type:"string"},InvoiceTotal:{type:"number"},LastPaidDate:{type:"date"},EntityNumber:{type:"string"},FullAddress:{type:"string"}}},parse:function(n){return $.map(n,function(n){n.LastPaidDate!=null&&(n.LastPaidDate=kendo.toString(kendo.parseDate(n.LastPaidDate),app.Constants.GlobalConstants.DateFormatForSearch))}),n}}})},r.prototype.getTelerikGridColumns=function(){return[{field:"InvoiceNumber",title:this.invoiceNumberLabel,width:"120px",filterable:!1,attributes:{id:"invoice-number-#=InvoiceNumber#"},template:"<a class='k-grid-anchor' href='\\#/invoice/#=InvoiceId#'><span>#=InvoiceNumber#<\/span><\/a>"},{field:"InvoiceTotal",title:this.amountPaidLabel,width:"120px",format:"{0:c}",attributes:{id:"amount-paid-#=InvoiceNumber#"},filterable:{operators:{number:this.enerGovMyEntityTelerikService.getNumberOperators()}}},{field:"LastPaidDate",title:this.paymentDateLabel,width:"120px",filterable:{ui:function(n){n.kendoDatePicker({format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"})}},format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}",attributes:{id:"payment-date-#=InvoiceNumber#"}},{field:"EntityNumber",title:this.caseNumberLabel,width:"120px",attributes:{id:"entity-number-#=InvoiceNumber#"},filterable:{multi:!0,search:!0}},{field:"FullAddress",title:this.invoiceAddressLabel,width:"120px",attributes:{id:"full-address-#=InvoiceNumber#"},filterable:{multi:!0,search:!0}}]},r}(app.Common.Controllers.PagedSearchController);t.EnerGovMyPaidInvoiceSearchController=i})(t=n.Invoice||(n.Invoice={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(t){function i(n,i,r,u,f,e,o,s,h,c,l,a,v,y,p){var w=t.call(this,i,r,u,f,null,!1)||this,b;return w.$scope=n,w.enerGovMyInvoiceSearchService=f,w.enerGovInvoiceSecondaryDataService=e,w.cartService=o,w.commonService=s,w.enerGovPermitService=h,w.enerGovPlanService=c,w.tenantService=l,w.eventService=a,w.enerGovViewMyEntityCriteriaService=v,w.resourceService=y,w.enerGovMyEntityTelerikService=p,w.pendingAddInvoiceIds=[],w.pendingAddDetailInvoices=[],w.pendingAddCartItems=[],w.addToCartInProgress=!1,w.filename="",w.options="",w.Keyword="",w.ExactMatch=!1,w.useElastic=!0,w.isAttentionSummary=!1,w.includeParentRecords=!1,w.isTenantUsesTylerPayments=function(){var n=w;w.tenantService.isTylerPaymentsUsed(function(t){n.isTylerPaymentsUsed=t})},w.expandStatus=!0,w.changeKeyword=function(){var n={StatusOption:w.statusOption,PageNumber:1,PageSize:w.searchCriteria.PageSize,Keyword:w.Keyword,SortField:w.searchCriteria.SortField,IsSortedInAscendingOrder:w.searchCriteria.IsSortedInAscendingOrder,ModuleId:w.searchCriteria.ModuleId,EntityId:w.searchCriteria.EntityId,FilterOption:w.filterOption,ExactMatch:w.ExactMatch,IncludeParentRecords:w.includeParentRecords};n.PageNumber=1;w.sortField=n.Keyword?w.sortList[0].Value:w.sortList[1].Value;n.SortField=w.sortField;w.search(n,app.Events.SearchEvents.SearchCompleted)},b=w,b.isTenantUsesTylerPayments(),w}return __extends(i,t),i.prototype.search=function(n,i){n.StatusOption=this.statusOption;n.FilterOption=this.filterOption;n.Keyword=this.Keyword;n.ExactMatch=this.ExactMatch;this.searchCriteria=n;t.prototype.search.call(this,n,i)},i.prototype.setExpandStatus=function(){this.expandStatus=!this.expandStatus},i.prototype.hasSelectedItems=function(){return this.enerGovMyInvoiceSearchService.currentSelectedItems.length>0},i.prototype.startSearch=function(n){this.search(n,app.Events.SearchEvents.SortCompleted)},i.prototype.selectAllOrNone=function(){var n=this;this.enerGovMyInvoiceSearchService.isSelectAll?angular.forEach(this.searchResult,function(t){if(!t.IsPending||t.AllowPendingInvoicePayment){t.Selected=!0;var i=n.enerGovMyInvoiceSearchService.currentSelectedItems.indexOf(t.InvoiceId,0);(i==null||i==-1)&&n.enerGovMyInvoiceSearchService.currentSelectedItems.push(t.InvoiceId)}}):angular.forEach(this.searchResult,function(t){t.Selected=!1;var i=n.enerGovMyInvoiceSearchService.currentSelectedItems.indexOf(t.InvoiceId,0);i!=null&&i!=-1&&n.enerGovMyInvoiceSearchService.currentSelectedItems.splice(i,1)});n.mainUnpaidGridOptions.dataSource=n.getDataSource(n.searchResult)},i.prototype.addToCart=function(){if(this.addToCartInProgress=!0,this.enerGovMyInvoiceSearchService.currentSelectedItems.length==0){this.addToCartInProgress=!1;return}var n=this;this.pendingAddInvoiceIds=[];angular.forEach(this.enerGovMyInvoiceSearchService.currentSelectedItems,function(t){n.pendingAddInvoiceIds.push(t)});this.pendingAddInvoiceIds.length>0?n.addCartItems():n.addToCartInProgress=!1},i.prototype.addCartItems=function(){var n=this;angular.forEach(this.pendingAddInvoiceIds,function(t){var i={CartItemId:-1,CartDirectiveName:"energov-cart",CartData:null,CartDataId:t,UserId:-1,TenantId:-1,SoftwarePackageId:-1,SoftwarePackageName:"",Amount:0,IsNew:!0,IsDeleted:!1};n.pendingAddCartItems.push(i)});this.cartService.addCartItems(this.pendingAddCartItems,function(t){n.addToCartInProgress=!1;t&&(n.cartService.didCallGetTotalItem=!1,n.cartService.updateTotalNumOfItems(),n.cartService.didCallGetTotalItem=!0,n.$location.url("/mycart"))})},i.prototype.changeFilterOption=function(n){this.updateUrl(n);this.filterOption=n;this.enerGovMyInvoiceSearchService.currentSelectedItems=[];var t={StatusOption:this.statusOption,PageNumber:1,PageSize:this.searchCriteria.PageSize,Keyword:this.Keyword,SortField:this.searchCriteria.SortField,IsSortedInAscendingOrder:this.searchCriteria.IsSortedInAscendingOrder,ModuleId:this.searchCriteria.ModuleId,EntityId:this.searchCriteria.EntityId,FilterOption:n,ExactMatch:this.ExactMatch,IncludeParentRecords:this.includeParentRecords};this.searchAndFillGrid(t)},i.prototype.updateUrl=function(n){this.$location.search({tab:this.$routeParams.tab,status:this.statusOption,filter:n}).replace()},i.prototype.changeSelectStatus=function(n,t){var i=this.enerGovMyInvoiceSearchService.currentSelectedItems.indexOf(n,0),r=this,u;t?((i==null||i==-1)&&this.enerGovMyInvoiceSearchService.currentSelectedItems.push(n),r.enerGovMyInvoiceSearchService.isSelectAll=!1,u=!0,angular.forEach(this.searchResult,function(n){if(u){var t=r.enerGovMyInvoiceSearchService.currentSelectedItems.indexOf(n.InvoiceId,0);t!=null&&t!=-1?r.enerGovMyInvoiceSearchService.isSelectAll=!0:(r.enerGovMyInvoiceSearchService.isSelectAll=!1,u=!1)}})):(i!=null&&i!=-1&&this.enerGovMyInvoiceSearchService.currentSelectedItems.splice(i,1),this.enerGovMyInvoiceSearchService.isSelectAll=!1)},i.prototype.fileNameOkClick=function(){var n=this,t;n.filename!==""&&n.filename!==undefined&&($("#FilenameModal.modal.fade.in").modal("hide"),$("div:not(.ng-hide) #button-Export").focus(),t={StatusOption:n.statusOption,PageNumber:1,PageSize:n.caseLimitForExport,Keyword:this.Keyword,SortField:n.searchCriteria.SortField,IsSortedInAscendingOrder:n.searchCriteria.IsSortedInAscendingOrder,ModuleId:n.searchCriteria.ModuleId,EntityId:n.searchCriteria.EntityId,FilterOption:this.filterOption===0?1:this.filterOption,ExactMatch:this.ExactMatch,IncludeParentRecords:this.includeParentRecords},n.options==="default"?n.searchForExport(t,app.Events.SearchEvents.SearchCompleted,function(){n.commonService.downloadData(n.searchResultForExcel,n.filename,"unpaidinvoice");n.filename=""}):(n.commonService.downloadData(n.searchResult,n.filename,"unpaidinvoice"),n.filename=""))},i.prototype.fileNameCancelClick=function(){$("#FilenameModal.modal.fade.in").modal("hide");$("div:not(.ng-hide) #button-Export").focus()},i.prototype.init=function(){var i=this,t=this,r,u;t.useElastic=!0;this.enerGovMyInvoiceSearchService.useElastic=t.useElastic;this.enerGovMyInvoiceSearchService.isSelectAll=!1;this.enerGovMyInvoiceSearchService.currentSelectedItems=[];this.$location.path().indexOf("attentionSummary")!==-1&&(r=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id),u={StatusOption:this.statusOption,PageNumber:1,PageSize:this.searchCriteria.PageSize,Keyword:this.Keyword,SortField:this.searchCriteria.SortField,IsSortedInAscendingOrder:this.searchCriteria.IsSortedInAscendingOrder,ModuleId:this.searchCriteria.ModuleId,EntityId:this.searchCriteria.EntityId,FilterOption:this.filterOption,ExactMatch:this.ExactMatch,IncludeParentRecords:this.includeParentRecords},r==app.Common.SelfServiceModules.Permit&&this.enerGovPermitService.getPermitDetail(this.$routeParams.id,function(n){n!=null&&(i.Keyword=n.PermitNumber,i.ExactMatch=!0,i.search(u,app.Events.SearchEvents.SearchCompleted),t.isAttentionSummary=!0)}),r==app.Common.SelfServiceModules.Plan&&this.enerGovPlanService.getById(this.$routeParams.id,function(n){n!=null&&(i.Keyword=n.PlanNumber,i.ExactMatch=!0,i.search(u,app.Events.SearchEvents.SearchCompleted),t.isAttentionSummary=!0)}));t.mainUnpaidGridOptions=t.enerGovMyEntityTelerikService.getTelerikGridOptions();t.mainUnpaidGridOptions.change=t.onChange;t.mainUnpaidGridOptions.persistSelection=!0;t.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Invoice.InvoiceResource",["MyInvoice_InvoiceNumberColumnHeader","MyInvoice_AmountDueColumnHeader","MyInvoice_StatusColumnHeader","MyInvoice_CaseNumberHeader","MyInvoice_AddressHeader","MyInvoice_DueDateHeader","MyInvoice_SelectAll","MyInvoice_DisplaySort","MyInvoice_ForLabel","MyInvoice_AddToCartButton"],function(r){i.invoiceNumberLabel=r.MyInvoice_InvoiceNumberColumnHeader;i.amountDueLabel=r.MyInvoice_AmountDueColumnHeader;i.invoiceStatusLabel=r.MyInvoice_StatusColumnHeader;i.caseNumberLabel=r.MyInvoice_CaseNumberHeader;i.invoiceAddressLabel=r.MyInvoice_AddressHeader;i.dueDateLabel=r.MyInvoice_DueDateHeader;i.selectAllLabel=r.MyInvoice_SelectAll;i.myInvoiceDisplayLabel=r.MyInvoice_DisplaySort;i.myInvoiceForLabel=r.MyInvoice_ForLabel;i.myInvoiceAddToCartLabel=r.MyInvoice_AddToCartButton;var u=t.mainUnpaidGridOptions.toolbar;u.push({template:'<button id="button-AddToCart" class="k-button k-btn-primary" ng-click="vm.addToCart()" data-ng-disabled="vm.addToCartInProgress || !vm.hasSelectedItems()" ng-if="!vm.isTylerPaymentsUsed">'+i.myInvoiceAddToCartLabel+'<\/button><add-to-tyler-cart ng-if="vm.isTylerPaymentsUsed" use-telerik-class="true" no-need-reload="true" invoice-ids="vm.enerGovMyInvoiceSearchService.currentSelectedItems"><\/add-to-tyler-cart>'});u.push({template:'<label class="k-label-margin" for='+i.myInvoiceDisplayLabel+">"+i.myInvoiceDisplayLabel+'<\/label><select aria-invalid="false" aria-label='+i.myInvoiceDisplayLabel+' class="k-form-control" id="invoiceTypeOption" name="invoiceTypeOption" ng-model="vm.enerGovMyInvoiceSearchService.selectedInvoiceType" ng-options="item.Value as item.Key for item in vm.enerGovInvoiceSecondaryDataService.invoiceTypeList"><\/select><label for="for" class="k-label-margin">'+i.myInvoiceForLabel+'<\/label><select aria-invalid="false" aria-label='+i.myInvoiceDisplayLabel+' class="k-form-control" id="unpaidInvoiceFilterOption" name="unpaidInvoiceFilterOption" ng-change="vm.changeFilterOption(vm.filterOption)" ng-model="vm.filterOption" ng-options="item.Value as item.Key for item in vm.filterList"><\/select>'});t.mainUnpaidGridOptions.columns=t.getTelerikGridColumns();t.enerGovViewMyEntityCriteriaService.getViewMyUnpaidInvoicesDetailCriteria(function(r){var u=r;t.filterList=t.enerGovViewMyEntityCriteriaService.statusFilterList;t.filterOption=t.enerGovViewMyEntityCriteriaService.statusFilter;i.filterOption=n.Enums.InvoiceFilterOption.All;i.statusOption=n.Enums.InvoiceStatus.Unpaid;+t.$routeParams.status===t.statusOption?(t.filterOption=+t.$routeParams.filter,t.statusOption=+t.$routeParams.status):t.updateUrl(t.filterOption);t.$scope.$watch("vm.$scope.$parent.$parent.$parent.$parent.vm.includeParentRecords",function(i){t.enerGovMyInvoiceSearchService.currentSelectedItems=[];t.includeParentRecords=i;u.IncludeParentRecords=i;t.enerGovMyInvoiceSearchService.selectedInvoiceType==n.Enums.InvoiceStatus.Unpaid&&t.searchAndFillGrid(u)})})},!0)},i.prototype.onChange=function(n){var t=n.sender.$angular_scope.vm,i,r;t.enerGovMyInvoiceSearchService.currentSelectedItems=n.sender.selectedKeyNames();t.$scope.$applyAsync();i=n.sender.select();r=n.sender;i.each(function(n,i){var f=r.dataItem(i),e,u;f.AllowPendingInvoicePayment==!1&&f.IsPending==!0&&($(i).removeClass("k-state-selected"),e=$(i).find(".k-checkbox"),$(e).prop("checked",!1),u=t.enerGovMyInvoiceSearchService.currentSelectedItems.indexOf(f.InvoiceId,0),u!=null&&u!=-1&&t.enerGovMyInvoiceSearchService.currentSelectedItems.splice(u,1))})},i.prototype.searchAndFillGrid=function(n){var r=this,i=this;i.isLoading=!0;n.PageSize=i.enerGovMyEntityTelerikService.telerikGridPageSize;n.PageNumber=i.enerGovMyEntityTelerikService.telerikGridPageNumber;n.StatusOption=i.statusOption;n.FilterOption=i.filterOption;i.searchCriteria=n;t.prototype.search.call(this,n,app.Events.SearchEvents.SearchCompleted,function(){var n=i.searchResult;n!==null&&i.isTylerPaymentsUsed&&(i.inTylerCartInvoiceIds=i.cartService.tylerCartItems,i.inTylerCartInvoiceIds&&i.inTylerCartInvoiceIds.length>0&&angular.forEach(n,function(n){var t=r.inTylerCartInvoiceIds!==undefined&&r.inTylerCartInvoiceIds.length>0?r.inTylerCartInvoiceIds.filter(function(t){return t===n.InvoiceId}):[];n.IsPending&&t!==null&&t.length>0&&(n.StatusName="In Cart")}));i.mainUnpaidGridOptions.dataSource=i.getDataSource(n);i.isLoading=!1})},i.prototype.getDataSource=function(n){return new kendo.data.DataSource({transport:{read:function(t){t.success(n)}},pageSize:20,schema:{model:{id:"InvoiceId",fields:{InvoiceNumber:{type:"string"},TotalDue:{type:"number"},InvoiceDueDate:{type:"date"},StatusName:{type:"string"},EntityNumber:{type:"string"},FullAddress:{type:"string"}}},parse:function(n){return $.map(n,function(n){n.InvoiceDueDate!=null&&(n.InvoiceDueDate=kendo.toString(kendo.parseDate(n.InvoiceDueDate),app.Constants.GlobalConstants.DateFormatForSearch))}),n}}})},i.prototype.getTelerikGridColumns=function(){return[{selectable:!0,width:"32px",locked:!0,attributes:{"class":"#=(AllowPendingInvoicePayment == false && IsPending == true) ? 'k-state-disabled':''#"}},{field:"InvoiceNumber",title:this.invoiceNumberLabel,width:"200px",filterable:!1,attributes:{id:"invoice-number-#=InvoiceNumber#"},template:"<a class='k-grid-anchor' href='\\#/invoice/#=InvoiceId#'><span>#=InvoiceNumber#<\/span><\/a>"},{field:"TotalDue",title:this.amountDueLabel,width:"180px",format:"{0:c}",attributes:{id:"amount-due-#=InvoiceNumber#"},filterable:{operators:{number:this.enerGovMyEntityTelerikService.getNumberOperators()}}},{field:"InvoiceDueDate",title:this.dueDateLabel,width:"120px",filterable:{ui:function(n){n.kendoDatePicker({format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"})}},format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}",attributes:{id:"due-date-#=InvoiceNumber#"}},{field:"StatusName",title:this.invoiceStatusLabel,width:"177px",filterable:{multi:!0},attributes:{id:"status-name-#=InvoiceNumber#"}},{field:"EntityNumber",title:this.caseNumberLabel,width:"220px",attributes:{id:"entity-number-#=InvoiceNumber#"},filterable:{multi:!0,search:!0}},{field:"FullAddress",title:this.invoiceAddressLabel,width:"200px",attributes:{id:"full-address-#=InvoiceNumber#"},filterable:{multi:!0,search:!0}}]},i}(app.Common.Controllers.PagedSearchController);n.EnerGovMyUnpaidInvoiceSearchController=t})(t=n.Invoice||(n.Invoice={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(t){function i(i,r,u,f,e,o,s,h,c,l,a,v){var y=t.call(this,r,u,f,e,null,!1)||this,p;return y.$scope=i,y.enerGovMyInvoiceSearchService=e,y.enerGovInvoiceSecondaryDataService=o,y.commonService=s,y.eventService=h,y.cartService=c,y.enerGovViewMyEntityCriteriaService=l,y.resourceService=a,y.enerGovMyEntityTelerikService=v,y.pendingAddInvoiceIds=[],y.pendingAddDetailInvoices=[],y.pendingAddCartItems=[],y.filename="",y.options="",y.Keyword="",y.ExactMatch=!1,y.useElastic=!0,y.includeParentRecords=!1,y.expandStatus=!0,y.changeKeyword=function(){var n={StatusOption:y.statusOption,PageNumber:1,PageSize:y.searchCriteria.PageSize,Keyword:y.Keyword,SortField:y.searchCriteria.SortField,IsSortedInAscendingOrder:y.searchCriteria.IsSortedInAscendingOrder,ModuleId:y.searchCriteria.ModuleId,EntityId:y.searchCriteria.EntityId,FilterOption:y.filterOption,ExactMatch:y.ExactMatch,IncludeParentRecords:y.includeParentRecords};n.PageNumber=1;y.sortField=n.Keyword?y.sortList[0].Value:y.sortList[1].Value;n.SortField=y.sortField;y.search(n,app.Events.SearchEvents.SearchCompleted)},p=y,p.useElastic=!0,e.useElastic=p.useElastic,y.enerGovMyInvoiceSearchService.isSelectAll=!1,y.enerGovMyInvoiceSearchService.currentSelectedItems=[],p.mainVoidGridOptions=p.enerGovMyEntityTelerikService.getTelerikGridOptions(),p.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Invoice.InvoiceResource",["MyInvoice_InvoiceNumberColumnHeader","MyInvoice_AmountDueColumnHeader","MyInvoice_StatusColumnHeader","MyInvoice_CaseNumberHeader","MyInvoice_AddressHeader","MyInvoice_DisplaySort","MyInvoice_ForLabel"],function(t){y.invoiceNumberLabel=t.MyInvoice_InvoiceNumberColumnHeader;y.amountDueLabel=t.MyInvoice_AmountDueColumnHeader;y.invoiceStatusLabel=t.MyInvoice_StatusColumnHeader;y.caseNumberLabel=t.MyInvoice_CaseNumberHeader;y.invoiceAddressLabel=t.MyInvoice_AddressHeader;y.myInvoiceDisplayLabel=t.MyInvoice_DisplaySort;y.myInvoiceForLabel=t.MyInvoice_ForLabel;var i=p.mainVoidGridOptions.toolbar;i.push({template:'<label class="k-label-margin" for='+y.myInvoiceDisplayLabel+'>Display<\/label><select aria-invalid="false" aria-label='+y.myInvoiceDisplayLabel+' class="k-form-control" id="invoiceTypeOption" name="invoiceTypeOption" ng-model="vm.enerGovMyInvoiceSearchService.selectedInvoiceType" ng-options="item.Value as item.Key for item in vm.enerGovInvoiceSecondaryDataService.invoiceTypeList"><\/select><label for="for" class="k-label-margin">'+y.myInvoiceForLabel+'<\/label><select aria-invalid="false" aria-label='+y.myInvoiceForLabel+' class="k-form-control" id="voidInvoiceFilterOption" name="voidInvoiceFilterOption" ng-change="vm.changeFilterOption(vm.filterOption)" ng-model="vm.filterOption" ng-options="item.Value as item.Key for item in vm.filterList"><\/select>'});p.mainVoidGridOptions.columns=p.getTelerikGridColumns();p.enerGovViewMyEntityCriteriaService.getViewMyVoidInvoicesDetailCriteria(function(t){var i=t;p.filterList=p.enerGovViewMyEntityCriteriaService.statusFilterList;p.filterOption=p.enerGovViewMyEntityCriteriaService.statusFilter;y.filterOption=n.Enums.InvoiceFilterOption.All;y.statusOption=n.Enums.InvoiceStatus.Voided;+p.$routeParams.status===p.statusOption?(p.filterOption=+p.$routeParams.filter,p.statusOption=+p.$routeParams.status):p.updateUrl(p.filterOption);p.$scope.$watch("vm.$scope.$parent.$parent.$parent.$parent.vm.includeParentRecords",function(t){p.includeParentRecords=t;i.IncludeParentRecords=t;p.enerGovMyInvoiceSearchService.selectedInvoiceType==n.Enums.InvoiceStatus.Voided&&p.searchAndFillGrid(i)})})},!0),y}return __extends(i,t),i.prototype.search=function(n,i){n.StatusOption=this.statusOption;n.FilterOption=this.filterOption;n.Keyword=this.Keyword;n.ExactMatch=this.ExactMatch;this.searchCriteria=n;t.prototype.search.call(this,n,i)},i.prototype.startSearch=function(n){this.search(n,app.Events.SearchEvents.SortCompleted)},i.prototype.changeFilterOption=function(n){this.updateUrl(n);this.filterOption=n;var t={StatusOption:this.statusOption,PageNumber:1,PageSize:this.searchCriteria.PageSize,Keyword:this.Keyword,SortField:this.searchCriteria.SortField,IsSortedInAscendingOrder:this.searchCriteria.IsSortedInAscendingOrder,ModuleId:this.searchCriteria.ModuleId,EntityId:this.searchCriteria.EntityId,FilterOption:n,ExactMatch:this.ExactMatch,IncludeParentRecords:this.includeParentRecords};this.searchAndFillGrid(t)},i.prototype.updateUrl=function(n){this.$location.search({tab:this.$routeParams.tab,status:this.statusOption,filter:n}).replace()},i.prototype.setExpandStatus=function(){this.expandStatus=!this.expandStatus},i.prototype.fileNameOkClick=function(){var n=this,t,i;n.filename!==""&&n.filename!==undefined&&($("#FilenameModal.modal.fade.in").modal("hide"),t=1,i={StatusOption:n.statusOption,PageNumber:1,PageSize:n.caseLimitForExport,Keyword:this.Keyword,SortField:n.searchCriteria.SortField,IsSortedInAscendingOrder:n.searchCriteria.IsSortedInAscendingOrder,ModuleId:n.searchCriteria.ModuleId,EntityId:n.searchCriteria.EntityId,FilterOption:t,ExactMatch:this.ExactMatch,IncludeParentRecords:this.includeParentRecords},n.options==="default"?n.searchForExport(i,app.Events.SearchEvents.SearchCompleted,function(){n.commonService.downloadData(n.searchResultForExcel,n.filename,"voidedinvoice");n.filename=""}):(n.commonService.downloadData(n.searchResult,n.filename,"voidedinvoice"),n.filename=""))},i.prototype.fileNameCancelClick=function(){$("#FilenameModal.modal.fade.in").modal("hide");$("div:not(.ng-hide) #button-Export").focus()},i.prototype.searchAndFillGrid=function(n){var i=this;i.isLoading=!0;n.PageSize=i.enerGovMyEntityTelerikService.telerikGridPageSize;n.PageNumber=i.enerGovMyEntityTelerikService.telerikGridPageNumber;n.StatusOption=i.statusOption;n.FilterOption=i.filterOption;i.searchCriteria=n;t.prototype.search.call(this,n,app.Events.SearchEvents.SearchCompleted,function(){var n=i.searchResult;i.mainVoidGridOptions.dataSource=i.getDataSource(n);i.isLoading=!1})},i.prototype.getDataSource=function(n){return new kendo.data.DataSource({transport:{read:function(t){t.success(n)}},pageSize:20,schema:{model:{fields:{InvoiceNumber:{type:"string"},TotalDue:{type:"number"},StatusName:{type:"string"},EntityNumber:{type:"string"},FullAddress:{type:"string"}}}}})},i.prototype.getTelerikGridColumns=function(){return[{field:"InvoiceNumber",title:this.invoiceNumberLabel,width:"120px",filterable:!1,attributes:{id:"invoice-number-#=InvoiceNumber#"},template:"<a class='k-grid-anchor' href='\\#/invoice/#=InvoiceId#'><span>#=InvoiceNumber#<\/span><\/a>"},{field:"TotalDue",title:this.amountDueLabel,width:"120px",format:"{0:c}",attributes:{id:"amount-due-#=InvoiceNumber#"},filterable:{operators:{number:this.enerGovMyEntityTelerikService.getNumberOperators()}}},{field:"StatusName",title:this.invoiceStatusLabel,width:"120px",filterable:!1,attributes:{id:"status-name-#=InvoiceNumber#"}},{field:"EntityNumber",title:this.caseNumberLabel,width:"120px",attributes:{id:"entity-number-#=InvoiceNumber#"},filterable:{multi:!0,search:!0}},{field:"FullAddress",title:this.invoiceAddressLabel,width:"120px",attributes:{id:"full-address-#=InvoiceNumber#"},filterable:{multi:!0,search:!0}}]},i}(app.Common.Controllers.PagedSearchController);n.EnerGovMyVoidInvoiceSearchController=t})(t=n.Invoice||(n.Invoice={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r){var u=n.call(this,null)||this;return u.enerGovPayInvoiceService=t,u.$location=i,u.$timeout=r,u.invoiceFound=!0,u}return __extends(t,n),t.prototype.search=function(){var t=this,n=this;n.enerGovPayInvoiceService.getByNumber(n.invoiceNumber,function(i){i!==null?n.$location.path("/invoice/"+i+"/true"):(n.invoiceFound=!1,t.setFocusOnErrorMessage())})},t.prototype.setFocusOnErrorMessage=function(){var n=this;this.$timeout(function(){$("#noUnpaidInvoice").focus()})},t}(app.Core.Controllers.CoreController);n.EnerGovPayInvoiceController=t})(t=n.Invoice||(n.Invoice={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(){"use strict";var t=n.Invoice.EnerGovPayInvoiceController,i=n.Invoice.EnerGovMyInvoiceViewController,r=n.Invoice.EnerGovMyPaidInvoiceSearchController,u=n.Invoice.EnerGovMyVoidInvoiceSearchController,f=n.Invoice.EnerGovInvoiceFeeSearchController,e=n.Invoice.EnerGovInvoiceContactSearchController,o=n.Invoice.EnerGovInvoiceAttachmentSearchController,s=n.Invoice.EnerGovInvoicePaymentSearchController,h=n.Invoice.EnerGovInvoiceMiscFeeSearchController,c=n.Invoice.EnerGovMyUnpaidInvoiceSearchController,l=n.Invoice.Services.EnerGovPayInvoiceService,a=n.Invoice.Services.EnerGovMyInvoiceSearchService,v=n.Invoice.Services.EnerGovInvoiceFeeSearchService,y=n.Invoice.Services.EnerGovInvoiceAttachmentSearchService,p=n.Invoice.Services.EnerGovInvoicePaymentSearchService,w=n.Invoice.Services.EnerGovInvoiceContactSearchService,b=n.Invoice.Services.EnerGovInvoiceMiscFeeSearchService,k=n.Invoice.Services.EnerGovInvoiceSecondaryDataService,d=n.Invoice.Services.EnerGovInvoiceService,g=n.Invoice.EnerGovInvoiceViewController;angular.module("enerGov.Invoice",["app.globalsModule","app.Common.Services","kendo.directives"]).service("enerGovPayInvoiceService",["http",l]).service("enerGovInvoiceSecondaryDataService",["http",k]).service("enerGovMyInvoiceSearchService",["http",a]).service("enerGovInvoiceFeeSearchService",["http",v]).service("enerGovInvoiceAttachmentSearchService",["http",y]).service("enerGovInvoiceContactSearchService",["http",w]).service("enerGovInvoicePaymentSearchService",["http",p]).service("enerGovInvoiceMiscFeeSearchService",["http",b]).service("enerGovInvoiceService",["http",d]).controller("enerGovInvoiceViewController",["$routeParams","$location","globalsService","enerGovInvoiceService",app.Constants.ServiceConstant.CartService,"enerGovReportService","enerGovSettingsService","pageTitleService","tabNavigatorService","tenantService","settingsService","enerGovInvoiceContactSearchService","userService","resourceService",g]).controller("enerGovMyInvoiceViewController",["$location","eventService","enerGovMyInvoiceSearchService",i]).controller("enerGovInvoiceFeeSearchController",["$routeParams","$location","globalsService","enerGovInvoiceFeeSearchService","enerGovInvoiceSecondaryDataService",f]).controller("enerGovInvoiceAttachmentSearchController",["$routeParams","$location","globalsService","enerGovInvoiceAttachmentSearchService","enerGovInvoiceSecondaryDataService",o]).controller("enerGovInvoicePaymentSearchController",["$routeParams","$location","globalsService","enerGovInvoicePaymentSearchService","enerGovInvoiceSecondaryDataService",s]).controller("enerGovInvoiceContactSearchController",["$routeParams","$location","globalsService","enerGovInvoiceContactSearchService","enerGovInvoiceSecondaryDataService",e]).controller("enerGovInvoiceMiscFeeSearchController",["$routeParams","$location","globalsService","enerGovInvoiceMiscFeeSearchService","enerGovInvoiceSecondaryDataService",h]).controller("enerGovMyPaidInvoiceSearchController",["$scope","$routeParams","$location","globalsService","enerGovMyInvoiceSearchService","enerGovInvoiceSecondaryDataService","enerGovCommonForExportService","eventService","enerGovViewMyEntityCriteriaService","resourceService","enerGovMyEntityTelerikService",r]).controller("enerGovMyVoidInvoiceSearchController",["$scope","$routeParams","$location","globalsService","enerGovMyInvoiceSearchService","enerGovInvoiceSecondaryDataService","enerGovCommonForExportService","eventService","cartService","enerGovViewMyEntityCriteriaService","resourceService","enerGovMyEntityTelerikService",u]).controller("enerGovMyUnpaidInvoiceSearchController",["$scope","$routeParams","$location","globalsService","enerGovMyInvoiceSearchService","enerGovInvoiceSecondaryDataService",app.Constants.ServiceConstant.CartService,"enerGovCommonForExportService","enerGovPermitService","enerGovPlanService","tenantService","eventService","enerGovViewMyEntityCriteriaService","resourceService","enerGovMyEntityTelerikService",c]).controller("enerGovPayInvoiceController",["enerGovPayInvoiceService","$location","$timeout",t])})(t=n.Invoice||(n.Invoice={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){var t,i,r,u,f,e;(function(n){n[n.WaitingForFiles=1]="WaitingForFiles";n[n.UnderReview=2]="UnderReview";n[n.Denied=3]="Denied";n[n.SubmitteForReview=4]="SubmitteForReview";n[n.Approved=5]="Approved"})(t=n.ERProjectSystemStatus||(n.ERProjectSystemStatus={})),function(n){n[n.FilesAdded=1]="FilesAdded";n[n.CorrectionsAdded=2]="CorrectionsAdded";n[n.UnderReview=3]="UnderReview";n[n.Locked=4]="Locked";n[n.WaitingForSubmit=5]="WaitingForSubmit";n[n.Approved=6]="Approved"}(i=n.ERProjectFileSystemStatus||(n.ERProjectFileSystemStatus={})),function(n){n[n.Markup=1]="Markup";n[n.Recommendation=2]="Recommendation";n[n.Correction=3]="Correction"}(r=n.ResponseType||(n.ResponseType={})),function(n){n[n.None=1]="None";n[n.BlueBeam=2]="BlueBeam";n[n.DigEplan=3]="DigEplan"}(u=n.ExtReviewIntegrationType||(n.ExtReviewIntegrationType={})),function(n){n[n.DigEplanPro=1]="DigEplanPro";n[n.DigEplanCore=2]="DigEplanCore"}(f=n.ExtReviewIntegrationSubType||(n.ExtReviewIntegrationSubType={})),function(n){n[n.New=1]="New";n[n.Submission_In_Progress=2]="Submission_In_Progress";n[n.Submitted=3]="Submitted";n[n.Submission_Failed=4]="Submission_Failed";n[n.No_Submission=5]="No_Submission";n[n.Unknown=6]="Unknown"}(e=n.FileSubmissionStatus||(n.FileSubmissionStatus={}))})(t=n.Enums||(n.Enums={}))})(t=n.EReview||(n.EReview={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/ereviews/ereviewprojects"}return n.prototype.searchByCriteria=function(n,t){this.http.post(this.rootUrl,n,function(n){n.Success&&t(n)},!0)},n}();n.EnerGovEntityEReviewProjectSearchService=t})(t=n.Services||(n.Services={}))})(t=n.EReview||(n.EReview={}))}(EnerGov||(EnerGov={}));__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(t){"use strict";var i=function(n){function t(t,i,r,u,f,e,o,s,h,c){var l=n.call(this,t,null,null,i,e,r,u,s,f,null,o,h,c,null,null)||this,a,v;return l.http=t,l.globalService=i,l.$upload=r,l.$q=u,l.$http=f,l.eReviewsService=e,l.$filter=o,l.$timeout=s,l.authUtils=h,l.resourceService=c,l.ereviewFileAttachments=[],l.eReviewsflowOptions={target:l.globalService.baseUrl+"api/energov/ereviews/uploadchunk",permanentErrors:["404","500","501"],maxChunkRetries:1,chunkRetryInterval:5e3,simultaneousUploads:4,chunkSize:1e6,testChunks:!1,generateUniqueIdentifier:function(n){return Math.floor((1+Math.random())*65536).toString(16)+"-"+n.size+"-"+n.name}},l.setEReviewFileVersionAndUpload=function(n){var t=l,i,u,r;if(t.$flowEreview!=undefined&&l.$flowEreview!=null)for(i=0;i<t.$flowEreview.files.length;i++)for(u=t.$flowEreview.files[i].name,t.$flowEreview.files[i].name=t.getFileNameWithVersion(t.$flowEreview.files[i].name,1),r=0;r<t.ereviewFileAttachments.length;r++)t.ereviewFileAttachments[i].name==u&&(t.ereviewFileAttachments[i].name=t.$flowEreview.files[i].name);t.uploadEReviewFiles(n)},l.uploadEReviewFiles=function(n){var t=l,i=[],r;for(l.flowFileSuccess=function(r,u){var e=JSON.parse(u).Result,f;app.Core.Controllers.CoreController.findItemInArray(i,"AttachmentID",e.DocumentId)||(f={},f.AttachmentID=e.DocumentId,f.FileName=e.FileName,f.IsNew=!0,f.Status=e.Status,f.ThumbnailUrl=e.ThumbnailUrl,angular.forEach(t.ereviewFileAttachments,function(n){n.name==f.FileName&&(n.attachment=f,f.Notes=n.fileType,f.ERProjectFileCategoryId=n.ERProjectFileCategoryId)}),i.push(f),l.ereviewFileAttachments.length===i.length&&(NProgress.done(),l.globalService.showProcessing=!1,n(i)))},r=0;r<t.ereviewFileAttachments.length;r++)t.ereviewFileAttachments[r].file==null&&t.ereviewFileAttachments[r].attachment!=null&&i.push(t.ereviewFileAttachments[r].attachment);if(l.$flowEreview!=undefined&&l.$flowEreview!=null){l.$flowEreview.on("fileSuccess",function(n,i,r){t.flowFileSuccess(n,i,r)});l.$flowEreview.on("fileError",function(n,i){t.flowFileFailed(i)});l.$flowEreview.files.length>0?(l.$flowEreview.upload(),NProgress.start(),l.globalService.showProcessing=!0):n(i)}else n(i)},l.clean=function(){l.ereviewFileAttachments=[];l.$flowEreview!=undefined&&l.$flowEreview!=null&&l.$flowEreview.cancel()},l.flowFileFailed=function(n){console.log("Error uploading file - "+n)},a=l,a.eReviewsflowOptions.headers={UploadProvider:"ereview",tenantId:i.tenantId,"Tyler-TenantUrl":i.tenantUrl,"Tyler-Tenant-Culture":i.culture},a.globalService.tylerIdEnabled&&(v=a.globalService.tylerIdEnabled?a.authUtils.getTylerIdToken():"",a.ereviewFlowOptions.headers.Authorization=v?"Bearer "+v.access_token:""),l}return __extends(t,n),t.prototype.getFileNameWithVersion=function(n,t){var i=n.lastIndexOf(".");return n.substring(0,i)+"_v"+t+n.substring(i)},t.prototype.removeEReviewAttachmentCard=function(n){var t=this.ereviewFileAttachments.indexOf(n);t>-1&&this.ereviewFileAttachments.splice(t,1)},t}(n.Services.EnerGovAttachmentCardsService);t.EReviewAttachmentCardsService=i})(t=n.Services||(n.Services={}))})(t=n.Attachment||(n.Attachment={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(n){this.http=n;this.rootUrl="/energov/ereviews/responses/";this.isDataPresent=!1}return n.prototype.searchByCriteria=function(n,t){var i=this;i.http.post(i.rootUrl+"search",n,function(n){n.Success&&t(n)},!0)},n.prototype.save=function(n,t){var i=this;i.http.post(i.rootUrl+"save",n,function(n){n.Success&&t(n)},!0)},n}();n.EReviewEntityResponseService=t})(t=n.Services||(n.Services={}))})(t=n.EReview||(n.EReview={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(n){this.http=n;this.rootUrl="/energov/ereviews/files";this.isDataPresent=!1}return n.prototype.searchByCriteria=function(n,t){var i=this,r=this;r.http.post(r.rootUrl,n,function(n){n.Success&&(i.isDataPresent=n.Result&&n.Result!==null&&n.Result.length>0?!0:!1,t(n))},!0)},n}();n.EReviewFilesService=t})(t=n.Services||(n.Services={}))})(t=n.EReview||(n.EReview={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r){this.http=n;this.$q=t;this.globalsService=i;this.$http=r;this.rootUrl="/energov/ereviews";this.isEnerGovEReviewEnable=!1;this.isEReviewCaseType=!1;this.isAllowedFileRevisionUploadPresent=!1;this.isAllowFileUpload=!1;this.isApplySubmitForReviewRule=!1;this.disallowAttachmentAfterApplication=!1;this.isFileNeedsAttention=!1;this.hasFilesThatNeedsResubmission=!1;this.hasFilesThatNeedsAttention=!1}return n.prototype.setup=function(n){var t=this;return this.http.get(this.rootUrl+"/setup",function(i){i.Success&&(t.ereviewsSecondaryData=i.Result,n())},!0)},n.prototype.getEnerGovEReviewEnableSetting=function(n){var t=this;return this.http.get("/energovsetting/isereviewenable",function(i){i.Success&&(t.isEnerGovEReviewEnable=i.Result,n())},!0)},n.prototype.getEnergovApplySubmitForReviewRuleSetting=function(n){var t=this;this.http.get("/energovsetting/applySubmitForReviewRule",function(i){i.Success&&(t.isApplySubmitForReviewRule=i.Result,n(i.Result))},!1)},n.prototype.getEnergovEreviewConfirmMessageSetting=function(n){var t=this;this.http.get("/energovsetting/reviewmessage",function(t){t.Success&&n(t.Result)},!1)},n.prototype.getFileSetByEntityId=function(n,t,i){return this.http.get(this.rootUrl+"/fileset/"+n+"/"+t,function(n){i(n)},!0)},n.prototype.getExtReviewIntegrationTypeInfo=function(n,t){return this.http.post(this.rootUrl+"/external-review-integration-type/",n,function(n){t(n)},!0)},n.prototype.getCaseSubmissionStatus=function(n,t){return this.http.post(this.rootUrl+"/case-submission-status/",n,function(n){t(n)},!0)},n.prototype.getFileSubmissionStatusInfo=function(n,t){return this.http.post(this.rootUrl+"/file-submission-status/",n,function(n){t(n)},!0)},n.prototype.getCaseRequestInfo=function(n,t){return this.http.get(this.rootUrl+"/case-request-info/"+n,function(n){t(n)},!0)},n.prototype.getEReviewProjectByEntityId=function(n,t,i){return this.http.get(this.rootUrl+"/project/"+n+"/"+t,function(n){i(n)},!0)},n.prototype.getEReviewSubmissionInfoByEntityId=function(n,t,i){return this.http.get("/energov/ereview-submission/"+t+"/"+n,function(n){i(n)},!0)},n.prototype.getEReviewSingleCategoryInfoByCriteria=function(n,t){this.http.post("/energov/ereview-submission/category-files",n,function(n){t(n)},!1)},n.prototype.saveEreview=function(n,t){n.EReviewAttachments.length===0?t():this.http.post("/energov/ereviews/save",n,t,!1)},n.prototype.resubmitEReview=function(n,t){this.http.post("/energov/ereviews/resubmit",n,function(n){t(n.Result)},!1)},n.prototype.createFileSubmissionQueue=function(n){var t=this,i=t.$q.defer(),r=t.globalsService.webApiBaseUrl+"/energov/ereview-submission-queue/create";return t.$http.post(r,n).then(function(n){i.resolve(n.data)}).catch(function(n){i.reject(n)}),i.promise},n.prototype.getFileUploadChunkSize=function(n){this.http.get("/tyleridsetting/fileUploadChunkSize",function(t){n(t)})},n.prototype.updateFileSubmissionQueue=function(n){var t=this,i=t.$q.defer(),r=t.globalsService.webApiBaseUrl+"/energov/ereview-submission-queue/update";return t.$http.put(r,n).then(function(n){i.resolve(n.data)}).catch(function(n){i.reject(n)}),i.promise},n.prototype.getEReviewSubmissionQueueStatus=function(n,t){var i=this,r=i.$q.defer(),u=i.globalsService.webApiBaseUrl+"/energov/ereview-submission-queue/status/"+t+"/"+n;return i.$http.get(u).then(function(n){r.resolve(n.data)}).catch(function(n){r.reject(n)}),r.promise},n.prototype.cleanUp=function(){this.isEnerGovEReviewEnable=!1;this.isEReviewCaseType=!1;this.isAllowFileUpload=!1;this.isEReviewCaseTypeDefer=null;this.isEReviewCaseTypePromise=null},n}();n.EReviewsService=t})(t=n.Services||(n.Services={}))})(t=n.EReview||(n.EReview={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){"use strict";var r=app.Core.Controllers.CoreController,u=n.Attachment.Models.AttachmentType,i=n.Attachment.Models.ReviewFileResubmitSetting,f=app.Common.SelfServiceModules,e=function(){function t(n,t,r,f,e,o,s,h,c,l,a,v,y,p,w,b,k){var g=this,d;this.$routeParams=n;this.$location=t;this.globalService=r;this.enerGovAttachmentCardsService=f;this.eReviewsService=e;this.stepperService=o;this.conditionService=s;this.submittalItemReviewService=h;this.tenantSettingService=c;this.eReviewEntityResponseService=l;this.$timeout=a;this.enerGovPermitService=v;this.enerGovPlanService=y;this.$scope=p;this.attachmentCommonCardService=w;this.$sce=b;this.$q=k;this.isConditionsPresent=!1;this.isFileMarkupsPresent=!1;this.showResponseButton=!1;this.eReviewRequireAllFilesResubmit=!0;this.isResubmitDone=!1;this.showWarning=!1;this.isSubmittalAttached=!1;this.enableResubmitOnSingleFileUpload=!1;this.attachmentCards=[];this.$onInit=function(){};this.loadDataForCards=function(n){var t=g,i;n&&(i=t.itemGroupBy(n,"fileType"),t.attachmentCards=t.attachmentCommonCardService.getStackCardDetails(i))};d=this;d.enerGovAttachmentCardsService.isResubmitAdditionalAttachments=!1;d.$routeParams.id&&(d.entityId=d.$routeParams.id);d.$routeParams.submittalId&&d.$routeParams.submittalId!=="null"&&(d.isSubmittalAttached=!0);d.moduleId=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id);d.enerGovAttachmentCardsService.getCombinedCardsForExistingFiles();d.attachmentCardsCopy=angular.copy(d.enerGovAttachmentCardsService.cards);d.enerGovAttachmentCardsService.setFileCategoryInfo(d.entityId,d.moduleId);d.resetWarnings();angular.forEach(d.enerGovAttachmentCardsService.cards,function(n){if(n.type==u.EReview){var t="";t=n.ereviewProjectFile?n.ereviewProjectFile.FileCategoryXRefList.length>0?n.ereviewProjectFile.FileCategoryXRefList[0].AllowedFileTypes:"":d.eReviewsService.ereviewsSecondaryData.ERProjectFileCategories.filter(function(t){return t.Name===n.fileType})[0].AllowedFileTypes;n.AllowedFileTypes=d.enerGovAttachmentCardsService.getFilteredFileTypes(d.enerGovAttachmentCardsService.allowedFileTypes.SettingValue,t)}});d.tenantSettingService.getSoftwarePackageSetting("EReviewAllowResponses",function(n){d.showResponseButton=n&&n.SettingValue==="true"});this.getEReviewProjectByEntity().then(function(){d.conditionService.getConditions(d.entityId,d.moduleId,function(n){n&&n.length>0&&(d.isConditionsPresent=!0);d.enerGovAttachmentCardsService.duplicateFiles=[];d.enerGovAttachmentCardsService.notSupportedFiles=[];d.setStepperSteps()})});app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2022.0.0.0")?d.moduleId===app.Common.SelfServiceModules.Permit?this.enerGovPermitService.getById(d.entityId,function(n){d.eReviewRequireAllFilesResubmit=n&&n.PermitTypeFilesResubmitTypeId===i.RequireAllFilesToBeResubmittedAtOnce;n&&(n.PermitTypeFilesResubmitTypeId===i.AllowResubmitUntilAllFilesResubmitted||n.PermitTypeFilesResubmitTypeId===i.DisableResubmitAfterOneFileIsResubmitted)&&(d.enableResubmitOnSingleFileUpload=!0)}):d.moduleId===app.Common.SelfServiceModules.Plan&&this.enerGovPlanService.getById(d.entityId,function(n){d.eReviewRequireAllFilesResubmit=n&&n.PlanTypeFilesResubmitTypeId===i.RequireAllFilesToBeResubmittedAtOnce;n&&(n.PlanTypeFilesResubmitTypeId===i.AllowResubmitUntilAllFilesResubmitted||n.PlanTypeFilesResubmitTypeId===i.DisableResubmitAfterOneFileIsResubmitted)&&(d.enableResubmitOnSingleFileUpload=!0)}):d.tenantSettingService.getSoftwarePackageSetting("EReviewRequireAllFilesResubmit",function(n){d.eReviewRequireAllFilesResubmit=n&&n.SettingValue==="true"});d.enerGovAttachmentCardsService.hasAuthorizedContactForAttachment||d.enerGovAttachmentCardsService.hasAuthorizedContact||this.$location.path("/dashboard")}return t.prototype.getEReviewProjectByEntity=function(){var t=this,n=this,i=n.$q.defer();return this.eReviewsService.getEReviewProjectByEntityId(this.entityId,this.moduleId,function(r){if(r.Success&&r.Result){var u={ERProjectId:r.Result.ERProjectID,Module:0,SubModule:0,CaseTypeId:"",WorkClassId:"",IsApply:!1};t.eReviewsService.caseRequestInfo=u;t.enerGovAttachmentCardsService.setExtReviewIntegrationTypeInfo(t.eReviewsService.caseRequestInfo,!0,t.$sce).then(function(){if(t.enerGovAttachmentCardsService.resubmitCategoryCards=[],app.Common.Helpers.VersionSupport(t.globalService.enerGovAPIVersion,"2022.3.0.0")&&t.enerGovAttachmentCardsService.isFileCategory)t.eReviewsService.getEReviewSubmissionInfoByEntityId(t.entityId,t.moduleId,function(t){t.Success&&t.Result&&t.Result.CategorySummary.Categories&&t.Result.CategorySummary.Categories.forEach(function(t){if(t.HasFilesThatNeedResubmission){var i=n.enerGovAttachmentCardsService.cards.filter(function(n){return n.ERProjectFileCategoryId&&n.ERProjectFileCategoryId===t.CategoryId});i&&i.length&&n.createResubmitCategoryCards(i[0])}})});else if(n.enerGovAttachmentCardsService.cards.length&&n.enerGovAttachmentCardsService.hasAuthorizedContact){var i=[];n.enerGovAttachmentCardsService.cards.forEach(function(t){t.ereviewProjectFile&&t.ereviewProjectFile.AllowRevisionFileUpload&&t.type==1&&i.indexOf(t.fileType)===-1&&(i.push(t.fileType),n.createResubmitCategoryCards(t))})}t.showNonCategoryAttachments?t.eReviewsService.getEReviewSubmissionInfoByEntityId(t.entityId,t.moduleId,function(i){i.Success&&i.Result&&i.Result.FileSummary.Files&&t.bindResubmitFilesData(n.enerGovAttachmentCardsService.cards,i.Result.FileSummary.Files)}):t.enerGovAttachmentCardsService.isFileCategory&&n.enerGovAttachmentCardsService.categoryEreviewFiles.length>0&&t.bindResubmitFilesData(n.enerGovAttachmentCardsService.cards,n.enerGovAttachmentCardsService.categoryEreviewFiles);n.attachmentCardsCopy=angular.copy(n.enerGovAttachmentCardsService.cards);n.isFileMarkupsPresent=n.enerGovAttachmentCardsService.cards.some(function(n){return n.type==1&&n.ereviewProjectFile&&n.ereviewProjectFile.AllowRevisionFileUpload&&n.ereviewProjectFile.LatestVersion.FileMarkups.length&&n.ereviewProjectFile.LatestVersion.FileMarkups.some(function(n){return n.Comments})})&&n.enerGovAttachmentCardsService.hasAuthorizedContact.valueOf();n.$scope.$watchCollection("vm.enerGovAttachmentCardsService.ereviewAttachments",n.loadDataForCards)}).then(function(){i.resolve()})}else i.resolve()}),i.promise},t.prototype.bindResubmitFilesData=function(n,t){n.forEach(function(n){t.forEach(function(t){t.AllowResubmission&&n.ereviewProjectFile&&n.ereviewProjectFile.ERProjectFileID===t.EReviewProjectFileId&&(n.fileType=t.CategoryName,n.ereviewProjectFile.AllowRevisionFileUpload=!0,n.ereviewProjectFile.LatestVersion.SaveFileName=t.SaveFileName,n.ereviewProjectFile.LatestVersion.FileVersion=t.FileVersion,n.ereviewProjectFile.LatestVersion.Comments=t.Comments,n.ereviewProjectFile.LatestVersion.ThumbnailUrl=t.ThumbnailUrl,n.ereviewProjectFile.LatestVersion.FileMarkups=t.FileMarkups,n.requiresFiles=t.RequiresFiles,n.allowResubmission=t.AllowResubmission)})})},t.prototype.createResubmitCategoryCards=function(n){if(this.enerGovAttachmentCardsService.fileSetInfo){var t=this.enerGovAttachmentCardsService.fileSetInfo.FileSetFileCategories.filter(function(t){return t.FileCategoryName===n.fileType});t.length&&(n.uploadInstruction=t[0].FileCategoryDescription)}this.enerGovAttachmentCardsService.resubmitCategoryCards.filter(function(t){return t.ERProjectFileCategoryId===n.ERProjectFileCategoryId}).length||this.enerGovAttachmentCardsService.resubmitCategoryCards.push(n)},Object.defineProperty(t.prototype,"fileProgressListCount",{get:function(){return this.enerGovAttachmentCardsService.fileProgressList?this.enerGovAttachmentCardsService.fileProgressList.length:0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"displayCategorySubmission",{get:function(){return app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2022.2.0.0")&&this.enerGovAttachmentCardsService.isFileCategory},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nonOptionalCards",{get:function(){return this.enerGovAttachmentCardsService.hasAuthorizedContact&&app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2022.2.0.0")&&!this.enerGovAttachmentCardsService.isFileCategory&&this.enerGovAttachmentCardsService.cards.length?this.enerGovAttachmentCardsService.cards.filter(function(n){return n.ereviewProjectFile&&n.ereviewProjectFile.AllowRevisionFileUpload&&n.type==1&&!(n.allowResubmission&&!n.requiresFiles)}):[]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"optionalCards",{get:function(){return this.enerGovAttachmentCardsService.hasAuthorizedContact&&app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2022.2.0.0")&&!this.enerGovAttachmentCardsService.isFileCategory&&this.enerGovAttachmentCardsService.cards.length?this.enerGovAttachmentCardsService.cards.filter(function(n){return n.ereviewProjectFile&&n.ereviewProjectFile.AllowRevisionFileUpload&&n.type==1&&n.allowResubmission&&!n.requiresFiles}):[]},enumerable:!0,configurable:!0}),t.prototype.getResubmitAttachments=function(){return this.enerGovAttachmentCardsService.cards.filter(function(n){return n.type==1&&n.ereviewProjectFile&&n.ereviewProjectFile.AllowRevisionFileUpload})},t.prototype.getResubmitAttachmentsToUpload=function(){return this.enerGovAttachmentCardsService.cards.filter(function(n){return n.type==1&&n.file!=null&&n.ereviewProjectFile&&n.ereviewProjectFile.AllowRevisionFileUpload})},t.prototype.getResubmitAttachmentsForCategory=function(){return this.enerGovAttachmentCardsService.cards.filter(function(n){return n.file&&n.type==1})},Object.defineProperty(t.prototype,"showNonCategoryAttachments",{get:function(){return app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2022.3.0.0")&&!this.enerGovAttachmentCardsService.isFileCategory},enumerable:!0,configurable:!0}),t.prototype.openShowFilesModal=function(n){this.enerGovAttachmentCardsService.hideActionColumnOnSummary=!1;this.enerGovAttachmentCardsService.currentEreviewPopupTitle=n;this.enerGovAttachmentCardsService.currentEreviewFileList=this.attachmentCards;$("#showFilesModalId").modal("show")},t.prototype.disableUpload=function(){var n=this,t;return n.enerGovAttachmentCardsService.showDigEplanIFrame?!1:(t=n.displayCategorySubmission?n.getResubmitAttachmentsForCategory():n.getResubmitAttachments(),n.enableResubmitOnSingleFileUpload)?t.every(function(n){return n.file==null}):n.eReviewRequireAllFilesResubmit?app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2022.3.0.0")&&!this.enerGovAttachmentCardsService.isFileCategory?this.nonOptionalCards.some(function(n){return!n.file}):t.some(function(n){return!n.file}):app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2022.3.0.0")&&!this.enerGovAttachmentCardsService.isFileCategory?n.nonOptionalCards.some(function(n){return!n.file}):t.every(function(n){return n.file==null})},t.prototype.showAddAttachmentToggle=function(){var n=this;return!(n.enerGovAttachmentCardsService.filesDropDown.length===0&&n.eReviewsService.disallowAttachmentAfterApplication&&n.moduleId!=f.Inspection)},t.prototype.showUploadInstructions=function(n,t,i){i.stopPropagation();i.preventDefault();this.focusedElement=i.target.id;this.fileCategoryName=n;this.uploadInstruction=t;angular.element("#resubmitUploadInstructionPopup").modal("show");this.setNewFocus("#popup-title-uploadInstruction",300)},t.prototype.setNewFocus=function(n,t){var r=this,i=angular.element(n);i&&r.$timeout(function(){i.focus()},t)},t.prototype.modalClose=function(){var n="#"+this.focusedElement;this.setNewFocus(n,300)},t.prototype.validateAttachments=function(){var n=this,i=this,t=i.$q.defer(),r=app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2024.3.0.0");return r?i.enerGovAttachmentCardsService.showDigEplanIFrame?this.eReviewsService.getCaseSubmissionStatus(this.eReviewsService.caseRequestInfo,function(i){i.Success==!0&&(n.eReviewsService.caseSubmissionStatusInfo=i.Result);n.enerGovAttachmentCardsService.erProject?t.resolve():n.eReviewsService.getEReviewProjectByEntityId(n.entityId,n.moduleId,function(i){n.enerGovAttachmentCardsService.erProject=i.Result;t.resolve()})}):t.resolve():t.resolve(),t.promise},t.prototype.save=function(){var t=this;this.validateAttachments().then(function(){var r=!1,u,i,f,e;if(t.enerGovAttachmentCardsService.showDigEplanIFrame)if(t.eReviewsService.caseSubmissionStatusInfo)if(t.enerGovAttachmentCardsService.currentCaseSubmissionFileList=t.eReviewsService.caseSubmissionStatusInfo.Files,t.eReviewsService.caseSubmissionStatusInfo.ReadyToSubmit)r=!0,t.enerGovAttachmentCardsService.erProject.ShouldMakeCaseSubmissionCallForResubmit=!0;else{t.attachmentCommonCardService.openCaseSubmissionStatusPopup("File(s) Not Ready To Submit",t.eReviewsService.caseSubmissionStatusInfo.Files);return}else{alert("File(s) status could not be determined.");return}else r=!0;r&&(t.showResponseButton&&(u=t.attachmentCardsCopy.filter(function(n){return n.type==1&&n.ereviewProjectFile.AllowRevisionFileUpload}),i=[],angular.forEach(u,function(t){angular.forEach(t.ereviewProjectFile.ERProjectFileVersions,function(t){t.Latest&&angular.forEach(t.FileMarkups,function(t){t.Response&&(!t.Response.ResponseID&&t.Response.UserResponse!=null&&t.Response.UserResponse!=""||t.Response.ResponseID&&t.Response.ResponseID!="")&&(t.Response.ResponseEntityID=t.ERFileMarkupId,t.Response.ResponseTypeID=t.Response.ResponseTypeID==0?n.EReview.Enums.ResponseType.Markup:t.Response.ResponseTypeID,i.push(t.Response))})})}),t.submittalItemReviewService.submittalTypes&&(f=t.submittalItemReviewService.submittalTypes.Result,angular.forEach(f,function(t){angular.forEach(t.Recommendations,function(t){t.Response&&(!t.Response.ResponseID&&t.Response.UserResponse!=null&&t.Response.UserResponse!=""||t.Response.ResponseID&&t.Response.ResponseID!="")&&(t.Response.ResponseEntityID=t.RecommendationID,t.Response.ResponseTypeID=t.Response.ResponseTypeID==0?n.EReview.Enums.ResponseType.Recommendation:t.Response.ResponseTypeID,i.push(t.Response))});angular.forEach(t.Corrections,function(t){t.Response&&(!t.Response.ResponseID&&t.Response.UserResponse!=null&&t.Response.UserResponse!=""||t.Response.ResponseID&&t.Response.ResponseID!="")&&(t.Response.ResponseEntityID=t.CorrectionID,t.Response.ResponseTypeID=t.Response.ResponseTypeID==0?n.EReview.Enums.ResponseType.Correction:t.Response.ResponseTypeID,i.push(t.Response))})}))),t.displayCategorySubmission?(e=t.enerGovAttachmentCardsService.getSubmissionQueueInfo(),t.enerGovAttachmentCardsService.createFileSubmissionQueue(e,t.moduleId,function(n,r){t.saveEReviewResponses(r,i)})):t.disableUpload()||t.enerGovAttachmentCardsService.saveResubmitAttachments(t.getResubmitAttachmentsToUpload(),function(n){t.saveEReviewResponses(n,i)}))})},t.prototype.saveEReviewResponses=function(n,t){var i=this;n&&this.showResponseButton?this.eReviewEntityResponseService.save(t,function(n){n.Success&&(i.isResubmitDone=!0,i.submittalItemReviewService.submittalTypes=[])}):n&&(this.isResubmitDone=!0)},t.prototype.returnToUrl=function(){this.$location.url(this.enerGovAttachmentCardsService.returnToUrl)},t.prototype.showNextButton=function(n){if(n.ShowNextButton&&n.Label!==undefined)return!0},t.prototype.cancleClick=function(){this.showWarning=!1},t.prototype.goToNextStep=function(n,t){var i=this;if(t.Label==="Reviews"&&i.submittalItemReviewService.submittalTypes&&i.submittalItemReviewService.submittalTypes.Result.filter(function(n){return n.FailureFlag&&n.isAcknowledged==!1}).length>0){i.showWarning=!0;return}if(n)this.stepperService.nextStep();else return},t.prototype.setStepperSteps=function(){var n=this,i;n.stepperService.module=n.moduleId;n.stepperService.isResubmitProcess=!0;var r=this.globalService.baseUrl+this.globalService.tenantUrl+"/energovereview/page?v="+this.globalService.version+"&id=",t=[],u={Label:"Files",Order:0,ViewUrl:r+"Files",ShowBackButton:!1,ShowNextButton:!0},f={Label:"Reviews",Order:1,ViewUrl:r+"reviews&entity="+app.Common.SelfServiceModules[n.moduleId].toLowerCase(),ShowBackButton:!0,ShowNextButton:!0},e={Label:"Conditions",Order:2,ViewUrl:r+"conditions",ShowBackButton:!0,ShowNextButton:!0},o={Label:"Resubmit",Order:3,ViewUrl:r+"resubmit",ShowBackButton:!0,ShowNextButton:!1};for(n.isFileMarkupsPresent&&t.push(u),n.isSubmittalAttached&&t.push(f),n.isConditionsPresent&&t.push(e),t.push(o),i=0;i<t.length;i++)t[i].Order=i;n.stepperService.stepsSetup("ResubmitAttachment",t,null)},t.prototype.showAcknowledgeAlert=function(){var n=this;return n.submittalItemReviewService.submittalTypes?n.submittalItemReviewService.submittalTypes.Result.filter(function(n){return n.FailureFlag}).length>0:!1},t.prototype.updateIncludeAdditionalNewFile=function(){var n=this;n.enerGovAttachmentCardsService.isResubmitAdditionalAttachments=n.includeAdditionalNewFile;n.includeAdditionalNewFile&&n.setFocusAttachmentCard()},t.prototype.setFocusAttachmentCard=function(){var n=angular.element("#card-AddNewAttachment");n&&this.$timeout(function(){n.focus()},200)},t.prototype.resetWarnings=function(){this.enerGovAttachmentCardsService.duplicateFiles=[];this.enerGovAttachmentCardsService.notSupportedFiles=[];this.enerGovAttachmentCardsService.categoryOnlyOneCanSelected=""},t.prototype.addAttachments=function(n,t,i){var u=this,o,f,s,h,c,e;if(n.length!==0){if(u.resetWarnings(),o=i.ereviewProjectFile.FileCategories[0],u.enerGovAttachmentCardsService.fileSetInfo!==null){if(f=u.enerGovAttachmentCardsService.fileSetInfo.FileSetFileCategories.filter(function(n){return n.FileCategoryId===o})[0].NumberOfFilesAllowed,s=u.enerGovAttachmentCardsService.cards.filter(function(n){return n.attachment===null&&n.ereviewProjectFile===null&&n.fileType===i.fileType}),s.length===f){u.enerGovAttachmentCardsService.categoryOnlyOneCanSelected=i.fileType;t.files=[];n=[];return}n.length>f&&(n.splice(f),u.enerGovAttachmentCardsService.categoryOnlyOneCanSelected=i.fileType)}for(h=function(){var t=n[e],f;if(u.enerGovAttachmentCardsService.ereviewAttachments.filter(function(n){return!n.attachment&&!n.ereviewProjectFile&&n.isNewlyUploaded&&n.name.toLowerCase()===t.name.toLowerCase()}).length>0)return u.enerGovAttachmentCardsService.duplicateFiles.push(t.name),"continue";f=i.AllowedFileTypes;f.match(t.getType())&&r.isNotNullEmptyUndefined(t.getType())||f.match(t.getExtension())&&r.isNotNullEmptyUndefined(t.getExtension())||f.indexOf(".*")>-1&&r.isNotNullEmptyUndefined(t.getExtension())?(u.enerGovAttachmentCardsService.ereviewAttachments.push({name:t.name,fileType:i.fileType,size:t.size,file:t,attachment:null,ereviewProjectFile:null,type:i.type,ERProjectFileCategoryId:o,cssFileName:t.name,isNewlyUploaded:!0}),u.enerGovAttachmentCardsService.$ereviewFlow.addFile(t.file)):c.enerGovAttachmentCardsService.notSupportedFiles.push(t.name)},c=this,e=0;e<n.length;e++)h();u.enerGovAttachmentCardsService.getCombinedCardsForExistingFiles();t.files=[];u.setAttachmentAlertFocus();u.enerGovAttachmentCardsService.$files.push(n[0])}},t.prototype.setAttachmentAlertFocus=function(){var t=this,n=null;t.enerGovAttachmentCardsService.categoryOnlyOneCanSelected!=""?n=angular.element("#FileSetCategoryFileCountLimitPanel"):t.enerGovAttachmentCardsService.duplicateFiles.length>0?n=angular.element("#DuplicateFileAlertPanel"):t.enerGovAttachmentCardsService.notSupportedFiles.length>0&&(n=angular.element("#AttachmentAlertPanel"));n&&this.$timeout(function(){n.focus()},300)},t.prototype.itemGroupBy=function(n,t){var i=this;return n.reduce(function(n,r){return r.ereviewProjectFile?{}:i.attachmentCommonCardService.getCategoryBasedData(t,n,r)},{})},t}();t.EnerGovEReviewResubmitController=e})(t=n.EReview||(n.EReview={}))}(EnerGov||(EnerGov={}));__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){"use strict";var i=function(t){function i(n,i,r,u,f,e,o){var s=t.call(this,null)||this;return s.$routeParams=n,s.$location=i,s.$timeout=r,s.globalService=u,s.submittalItemReviewService=f,s.enerGovSubmittalService=e,s.tenantSettingService=o,s.model=[],s.showResponseButton=!1,s.fromEntityDetail=!1,s}return __extends(i,t),i.prototype.collapsePanel=function(n){n.isCollapsed=!n.isCollapsed},i.prototype.cssClassCollapse=function(n,t){return this.fromEntityDetail||n?t:t+" in"},i.prototype.showRecommendationResponse=function(n,t){n.showResponseArea=!n.showResponseArea;n.showResponseArea&&this.setFocus(t,300)},i.prototype.showCorrectionResponse=function(n,t){n.showResponseArea=!n.showResponseArea;n.showResponseArea&&this.setFocus(t,300)},i.prototype.setFocus=function(n,t){var r=this,i=angular.element(n);i&&r.$timeout(function(){i[0].focus()},t)},i.prototype.init=function(){var i=this,t=this;t.$routeParams.submittalId&&t.$routeParams.submittalId!=="null"&&(this.criteria=n.Submittal.Helpers.EntitySubmittalHelper.getItemReviewSearchCriteria(t.globalService,t.$location,t.$routeParams),t.enerGovSubmittalService.getById(this.$routeParams.submittalId,function(n){n.SubmittalId===""?(alert("Unable to load the selected submittal. Please contact your municipality about the submittal you were attempting to view. Returning to home."),i.$location.path("/dashboard")):(n.isCollapsed=!1,t.tenantSettingService.getSoftwarePackageSetting("EReviewAllowResponses",function(r){t.showResponseButton=r&&r.SettingValue==="true";t.submittalItemReviewService.submittalTypes&&t.submittalItemReviewService.submittalTypes.Result?t.submittalTypes||(t.submittalTypes=t.submittalItemReviewService.submittalTypes.Result,t.model.push({submittalDetails:n,reviewItems:t.submittalTypes})):i.submittalItemReviewService.searchWithDetails(t.criteria,function(i){t.submittalTypes=i.Result;angular.forEach(t.submittalTypes,function(n){n.isCollapsed=!n.FailureFlag;n.isAcknowledged=!1;t.showResponseButton&&(angular.forEach(n.Corrections,function(n){n.showResponseArea=n.Response.UserResponse&&n.Response.UserResponse.length>0}),angular.forEach(n.Recommendations,function(n){n.showResponseArea=n.Response.UserResponse&&n.Response.UserResponse.length>0}))});t.model.push({submittalDetails:n,reviewItems:t.submittalTypes})})}))}))},i}(app.Core.Controllers.CoreController);t.EnerGovEReviewSubmittalController=i})(t=n.EReview||(n.EReview={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f){var e=n.call(this,t,i,r,u,null,!1)||this,o=e,s=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(i,t.id);return e.criteria={PageNumber:1,PageSize:r.pageSizeList[0].Value,SortField:"",IsSortedInAscendingOrder:!0,ModuleId:s,EntityId:t.id},f.getEntityRecordSortSecondaryData(function(n){o.sortList=n.Result.EntityPermitEReviewProjectSearchSortList;o.sortField=n.Result.EntityPermitEReviewProjectSearchSortList[0].Value}),n.call(this,t,i,r,u,e.criteria)||this}return __extends(t,n),t}(app.Common.Controllers.PagedSearchController);n.EnerGovPermitEReviewProjectSearchController=t})(t=n.EReview||(n.EReview={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f){var e=n.call(this,t,i,r,u,null,!1)||this,o=e,s=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(i,t.id);return e.criteria={PageNumber:1,PageSize:r.pageSizeList[0].Value,SortField:"",IsSortedInAscendingOrder:!0,ModuleId:s,EntityId:t.id},f.getEntityRecordSortSecondaryData(function(n){o.sortList=n.Result.EntityPlanEReviewProjectSearchSortList;o.sortField=n.Result.EntityPlanEReviewProjectSearchSortList[0].Value}),n.call(this,t,i,r,u,e.criteria)||this}return __extends(t,n),t}(app.Common.Controllers.PagedSearchController);n.EnerGovPlanEReviewProjectSearchController=t})(t=n.EReview||(n.EReview={}))}(EnerGov||(EnerGov={}));__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){"use strict";var i=app.Core.Controllers.CoreController,r=function(t){function r(n,i,r,u,f,e,o,s){var h=t.call(this,n,i,r,null,null,!1)||this,c;h.$routeParams=n;h.$location=i;h.globalService=r;h.eReviewFilesService=u;h.entitySecondaryDataService=f;h.enerGovAttachmentCardsService=e;h.eReviewsService=o;h.eventService=s;h.uploadInProgress=!1;h.notSupportedFiles=[];h.uploadSuccessful=!1;c=h;h.eventService.on("EReviewNewFileUploaded",function(){c.getEReviewProject()});return h}return __extends(r,t),r.prototype.init=function(){var n=this;n.moduleId=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id);n.selectFilter="SaveFileName";n.selectFilterHistory="SaveFileName";n.getEReviewProject()},r.prototype.sortFieldFile=function(n){var i=this,t;n==="file"?(t=i.selectFilter,i.erProject.ERProjectFiles.sort(function(n,i){return t==="FileVersion"?parseFloat(n.LatestVersion[t])-parseFloat(i.LatestVersion[t]):t==="Categories"?n[t].localeCompare(i[t]):t==="AllowViewCorrection"?n.LatestVersion[t].toString().localeCompare(i.LatestVersion[t].toString()):n.LatestVersion[t].localeCompare(i.LatestVersion[t])})):n==="history"&&(t=i.selectFilterHistory,i.selectedFileHistory.ERProjectFileVersions.sort(function(n,i){return t==="FileVersion"?parseFloat(n[t])-parseFloat(i[t]):t==="AllowViewCorrection"?n[t].toString().localeCompare(i[t].toString()):n[t].localeCompare(i[t])}))},r.prototype.getEReviewProject=function(){var n=this;n.eReviewsService.isAllowedFileRevisionUploadPresent=!1;n.eReviewsService.isFileNeedsAttention=!1;n.selectedFileHistory=null;n.selectedButton=undefined;n.eReviewsService.getEReviewProjectByEntityId(this.$routeParams.id,n.moduleId,function(t){if(t.StatusCode==app.Common.Services.HttpStatusCode.PreconditionFailed)n.errorMessage=t.ErrorMessage;else if(n.erProject=t.Result,n.eReviewsService.isAllowFileUpload=n.erProject.AllowFileUpload&&n.erProject.ERProjectSystemStatusID==1?!0:!1,n.erProject.ERProjectFiles.forEach(function(t){t.AllowRevisionFileUpload&&(n.eReviewsService.isAllowedFileRevisionUploadPresent=!0);t.ERProjectFileVersions.forEach(function(i){i.Latest&&(n.eReviewsService.isFileNeedsAttention=i.NeedAttention,t.LatestVersion=i)})}),n.sortFieldFile("file"),n.erProject.ERProjectFiles.length>0){var i=n.erProject.ERProjectFiles.filter(function(n){return n.ERProjectFileVersions.length>1});i.length>0&&n.getHistory(i[0],n.erProject.ERProjectFiles.indexOf(i[0]))}})},r.prototype.getHistory=function(n,t){var i=this;i.selectedButton!==t?(i.selectedButton=t,i.selectedFileHistory=angular.copy(n),i.selectedFileHistory.ERProjectFileVersions=this.selectedFileHistory.ERProjectFileVersions.filter(function(t){return t.Categories=i.selectedFileHistory.Categories,t.ERProjectFileVersionID!==n.LatestVersion.ERProjectFileVersionID}),i.sortFieldFile("history")):(i.selectedFileHistory=null,i.selectedButton=undefined)},r.prototype.addFlowAttachment=function(n,t){var f=this,e=this,r,u;r=t.srcElement!==undefined&&t.srcElement!==null?angular.element(t.srcElement):angular.element(t.originalTarget);u=r.scope().entity;angular.forEach(n.files,function(t,o){var s,h;if(n.files.length>o+1)for(s=o+1;s<n.files.length;s++)if(t.file.name==n.files[s].file.name){n.removeFile(n.files[s]);return}t.file.name==t.name&&(h="",u.FileCategoryXRefList.forEach(function(n){h+=n.AllowedFileTypes+","}),h.match(t.getType())&&i.isNotNullEmptyUndefined(t.getType())||h.match(t.getExtension())&&i.isNotNullEmptyUndefined(t.getExtension())||h.indexOf(".*")>-1&&i.isNotNullEmptyUndefined(t.getExtension())?(t.name=e.enerGovAttachmentCardsService.getFileNameWithVersion(t.name,u.NextFileVersion),u.RevisionFileName=t.name,e.enerGovAttachmentCardsService.ereviewFileAttachments.push({name:t.name,fileType:e.enerGovAttachmentCardsService.attachmentFileType,size:t.size,file:null,attachment:null,cssFileName:t.name}),f.notSupportedFiles=[],r[0].parentElement.attributes["class"].value=r[0].parentElement.attributes["class"].value+" ng-hide"):(f.notSupportedFiles.push(t.name),n.removeFile(t)),f.enerGovAttachmentCardsService.$flowEreview=n)})},r.prototype.removeAttachmentFile=function(n,t){for(var r,u=this,i=this.enerGovAttachmentCardsService.ereviewFileAttachments.length-1;i>=0;i--)this.enerGovAttachmentCardsService.ereviewFileAttachments[i].name==n.RevisionFileName&&this.enerGovAttachmentCardsService.ereviewFileAttachments.splice(i,1);if(this.enerGovAttachmentCardsService.$flowEreview!=undefined&&this.enerGovAttachmentCardsService.$flowEreview!=null)for(i=this.enerGovAttachmentCardsService.$flowEreview.files.length-1;i>=0;i--)this.enerGovAttachmentCardsService.$flowEreview.files[i].name==n.RevisionFileName&&this.enerGovAttachmentCardsService.$flowEreview.files.splice(i,1);t.currentTarget.attributes["class"].value=t.currentTarget.attributes["class"].value+" ng-hide";r="btnBrowse_"+t.currentTarget.id.split("btnRemoveEreviewFile_")[1];t.currentTarget.previousElementSibling.classList.remove("ng-hide");n.RevisionFileName=null},r.prototype.upload=function(){var n=this;n.uploadInProgress=!0;n.uploadSuccessful=!1;n.enerGovAttachmentCardsService.eReviewsflowOptions.headers.UploadFolder=n.erProject.UploadFolder;n.enerGovAttachmentCardsService.uploadEReviewFiles(function(t){n.eReviewsFileUploadCallback(t,n.erProject.ERProjectID);n.selectedFileHistory=undefined;n.uploadSuccessful=!0})},r.prototype.eReviewsFileUploadCallback=function(t){var i=this;i.erProject.ERProjectSystemStatusID=n.EReview.Enums.ERProjectSystemStatus.UnderReview;t.forEach(function(t){i.erProject.ERProjectFiles.forEach(function(i){t.FileName==i.RevisionFileName&&(i.LatestVersion.Latest=!1,i.LatestVersion.ERProjectFileSystemStatusID=n.EReview.Enums.ERProjectFileSystemStatus.Locked,i.AllowRevisionFileUpload=!1,i.Pending=!1,i.ERProjectFileVersions.push({ERProjectFileVersionID:null,ERProjectFileStatusID:"",ERProjectFileSystemStatusID:n.EReview.Enums.ERProjectFileSystemStatus.UnderReview,SaveFileName:t.FileName,IsFileSecure:t.IsFileSecure,Locked:!1,Latest:!0,AllowViewCorrection:!1,FileVersion:i.NextFileVersion,Submitted:!0,IsNew:!0,IsDeleted:!1,ClientId:null,MarkDelete:!1,Comments:"",Pending:!1,SystemtaskId:null,CreateDate:new Date,StatusName:"",FileStatusName:"",ThumbnailUrl:"",FileMarkups:null,SubmittalID:"",NeedAttention:!1,TempUploadFolderName:null}))})});i.eReviewsService&&i.eReviewsService.resubmitEReview(i.erProject,function(){i.uploadInProgress=!1;i.getEReviewProject();i.enerGovAttachmentCardsService.clean()})},r}(app.Common.Controllers.PagedSearchController);t.EReviewFilesSearchController=r})(t=n.EReview||(n.EReview={}))}(EnerGov||(EnerGov={}));__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 r=function(n){function t(t){var i=n.call(this)||this;return i.restrict="AE",i.replace=!0,i.templateUrl=t.baseUrl+t.tenantUrl+"/energovereview/FileInfo",i.controllerAs="vm",i.scope={item:"=",isUploadStep:"="},i.controller="fileInfoController",i}return __extends(t,n),t}(app.Directives.Core.BaseDirective),i;t.EnergovEReviewFileInfoDirective=r;i=function(n){function t(t,i,r,u,f,e,o,s,h,c){var l=n.call(this,t,i,r,u,f,h,e,o,s,c)||this,a;return l.$routeParams=t,l.userService=i,l.$location=r,l.globalService=u,l.enerGovAttachmentCardsService=f,l.eReviewsService=o,l.fileUploadService=s,l.$q=h,l.$timeout=c,a=l,l}return __extends(t,n),t}(n.Common.Controllers.EnerGovAttachmentBaseController);t.EnergovFileInfoController=i;angular.module("EnerGov.Directives.EReviewFileInfo",[]).controller("fileInfoController",["$routeParams","userService","$location","globalsService","enerGovAttachmentCardsService","$scope","eReviewsService","fileUploadService","$q","$timeout",i]).directive("fileInfo",["globalsService",function(n){return new r(n)}])})(i=t.EReviewFileInfo||(t.EReviewFileInfo={}))})(t=n.Directives||(n.Directives={}))}(EnerGov||(EnerGov={}));__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 i=function(n){function t(t){var i=n.call(this)||this;return i.restrict="AE",i.replace=!0,i.templateUrl=t.baseUrl+t.tenantUrl+"/energovereview/FileMarkupInfo",i.controllerAs="vm",i.scope={markup:"=",showResponseButton:"=",index:"@",tabIndex:"@?"},i.controller="fileMarkupInfoController",i}return __extends(t,n),t}(app.Directives.Core.BaseDirective),t;n.EnergovEReviewMarkupInfoDirective=i;t=function(n){function t(t,i){var u=n.call(this,null)||this,r;return u.$scope=t,u.$timeout=i,r=u,r.collapsed=!(t.markup&&t.markup.Response&&t.markup.Response.UserResponse&&t.markup.Response.UserResponse.length>0),r.showResponseButton=t.showResponseButton,r.index=t.index,r.tabIndex=t.tabIndex,u}return __extends(t,n),t.prototype.showResponse=function(n){this.collapsed=!this.collapsed;this.collapsed||this.setFocus(n+this.index,300)},t.prototype.setFocus=function(n,t){var r=this,i=angular.element(n);i&&r.$timeout(function(){i[0].focus()},t)},t}(app.Core.Controllers.CoreController);n.EnergovFileMarkupInfoController=t;angular.module("EnerGov.Directives.EReviewFileMarkupInfo",["app.Common.Services"]).controller("fileMarkupInfoController",["$scope","$timeout",t]).directive("markupInfo",["globalsService",function(n){return new i(n)}])})(t=n.EReviewFileMarkupInfo||(n.EReviewFileMarkupInfo={}))})(t=n.Directives||(n.Directives={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(){"use strict";var t=n.EReview.EnerGovPlanEReviewProjectSearchController,i=n.EReview.EnerGovPermitEReviewProjectSearchController,r=n.EReview.Services.EnerGovEntityEReviewProjectSearchService;angular.module("enerGov.EReview",["app.globalsModule","app.Common.Services","enerGov.Common","app.EnerGov.Condition"]).service("enerGovEntityEReviewProjectSearchService",["http",r]).service("eReviewsService",["http","$q","globalsService","$http",n.EReview.Services.EReviewsService]).service("eReviewAttachmentCardsService",["http","globalsService","Upload","$q","$http","eReviewsService","$filter","$timeout","authUtils","resourceService","$sce",n.Attachment.Services.EReviewAttachmentCardsService]).service("eReviewFilesService",["http",n.EReview.Services.EReviewFilesService]).service("eReviewEntityResponseService",["http",n.EReview.Services.EReviewEntityResponseService]).controller("enerGovPermitEReviewProjectSearchController",["$routeParams","$location","globalsService","enerGovEntityEReviewProjectSearchService","entitySecondaryDataService",i]).controller("enerGovPlanEReviewProjectSearchController",["$routeParams","$location","globalsService","enerGovEntityEReviewProjectSearchService","entitySecondaryDataService",t]).controller("eReviewFilesSearchController",["$routeParams","$location","globalsService","eReviewFilesService","entitySecondaryDataService","eReviewAttachmentCardsService","eReviewsService","eventService",n.EReview.EReviewFilesSearchController]).controller("enerGovEReviewResubmitController",["$routeParams","$location","globalsService","enerGovAttachmentCardsService","eReviewsService","stepperService","conditionService","enerGovSubmittalItemReviewSearchService","tenantSettingService","eReviewEntityResponseService","$timeout","enerGovPermitService","enerGovPlanService","$scope","attachmentCommonCardService","$sce","$q",n.EReview.EnerGovEReviewResubmitController]).controller("enerGovEReviewSubmittalController",["$routeParams","$location","$timeout","globalsService","enerGovSubmittalItemReviewSearchService","enerGovSubmittalService","tenantSettingService",n.EReview.EnerGovEReviewSubmittalController])})(t=n.EReview||(n.EReview={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/arcgis/search/associate/parcel"}return n.prototype.searchByCriteria=function(n,t){var i=this;i.http.post(i.rootUrl,n,function(n){n.Success&&t(n)},!0)},n}();n.EnerGovAssociatedParcelSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Address||(n.Address={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/arcgis/search/address"}return n.prototype.searchByCriteria=function(n,t){this.http.post(this.rootUrl,n,function(n){n.Success&&t(n)},!0)},n}();n.EnerGovGlobalSearchAddressService=t})(t=n.Services||(n.Services={}))})(t=n.Address||(n.Address={}))})(t=n.GlobalSearch||(n.GlobalSearch={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/search/";this.http=n;var t=this;this.searchByCriteria=function(n,i){n.IsActive=!0;t.http.post(t.rootUrl+"searchcontact/",n,function(n){n.Success&&i(n)},!0)}}return n}();n.EnerGovGlobalSearchContactService=t})(t=n.Contact||(n.Contact={}))})(t=n.GlobalSearch||(n.GlobalSearch={}))}(EnerGov||(EnerGov={}));__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,e,o,s){var h=n.call(this,t,i,r,u,null,!1)||this;return h.enerGovAssociatedParcelSearchService=u,h.eventService=f,h.enerGovAddressCardsService=e,h.enerGovEntityParcelSearchService=o,h.enerGovAddressService=s,h.associatedParcelList=[],h.showAssociatedParcels=!1,h.disableAddAddress=!1,h.searchingAssociatedParcels=!1,h}return __extends(t,n),t.prototype.cancel=function(){this.showAssociatedParcels=!1;this.disableAddAddress=!1;this.eventService.boradcast("disableAddAddress",this.disableAddAddress)},t.prototype.addOrRemoveParcel=function(n){if(n.Selected)this.enerGovEntityParcelSearchService.parcels.push(n);else{var t=this.enerGovEntityParcelSearchService.parcels.indexOf(n);this.enerGovEntityParcelSearchService.parcels.splice(t,1)}},t.prototype.addSelectedParcels=function(){var n=this,t=[];n.enerGovAddressCardsService.addAddress(n.enerGovAddressCardsService.selectedAddress);angular.forEach(n.enerGovEntityParcelSearchService.parcels,function(i){var r=n.createNewLocationCard();r.IsParcel=!0;r.ParcelNumber=i.ParcelNumber;r.Section=i.Section;r.Range=i.Range;r.Township=i.Township;r.Associated=n.enerGovAddressCardsService.selectedAddress.Associated;t.push(r)});n.enerGovAddressCardsService.addLocations(t);n.enerGovAddressCardsService.returnFromAddAddress=!0;n.$location.path(n.enerGovAddressCardsService.returnToUrl)},t.prototype.createNewLocationCard=function(){return{ParentAddressID:"",ParentID:"",MailingAddressID:"",CountryType:0,AddressType:"",Main:!1,AddressLine1:"",AddressLine2:"",AddressLine3:"",City:"",State:"",County:"",Country:"",PostalCode:"",PreDirection:"",PostDirection:"",StreetType:"",ParcelID:"",ParcelNumber:"",ParcelAddressID:"",RowVersion:0,LastChangedOn:null,LastChangedBy:"",AddressDisplay:"",UnitOrSuite:"",Province:"",POBox:"",CompSite:"",RuralRoute:"",Station:"",ATTN:"",AddressSystemType:"",GeneralDelivery:!1,Section:"",Range:"",Township:"",IsParcel:!1,IsNew:!1,IsDeleted:!1,ClientId:"",Associated:"",GisAddressId:"",FormattedAddressString:""}},t.prototype.searchAssociatedParcels=function(n){var t=this,i;n!==undefined&&(t.showAssociatedParcels=!1,t.searchingAssociatedParcels=!0,i={PageSize:this.searchCriteria.PageSize,PageNumber:1,GisAddressId:n.GisAddressId,ParcelNumber:n.ParcelNumber},t.searchCriteria=i,t.search(i,app.Events.SearchEvents.SearchCompleted),t.searchingAssociatedParcels=!1,t.showAssociatedParcels=!0)},t.prototype.search=function(n,t){var r=this,i=this;i.searchEvent=app.Events.SearchEvents.SearchStart;i.searchingAssociatedParcels=!0;this.enerGovAssociatedParcelSearchService.searchByCriteria(n,function(n){if(i.searchResult=n.Result,i.totalFound=n.TotalFound,i.totalPages=n.PageCount,i.currentPage=i.searchCriteria.PageNumber,i.searchResult&&i.totalFound<2){if(r.enerGovAddressService.patchAddressRelatedInfo(i.enerGovAddressCardsService.selectedAddress,function(n){i.enerGovAddressCardsService.selectedAddress.ParcelID=n.ParcelID;i.enerGovAddressCardsService.selectedAddress.ParcelAddressID=n.ParcelAddressID}),i.searchResult.length>0){var u=i.createNewLocationCard();u.IsParcel=!0;u.ParcelNumber=i.searchResult[0].ParcelNumber;u.Section=i.searchResult[0].Section;u.Range=i.searchResult[0].Range;u.Township=i.searchResult[0].Township;u.Associated=i.enerGovAddressCardsService.selectedAddress.Associated;i.enerGovAddressCardsService.addLocations([i.enerGovAddressCardsService.selectedAddress,u])}else i.enerGovAddressCardsService.addLocations([i.enerGovAddressCardsService.selectedAddress]);i.$location.url(i.enerGovAddressCardsService.returnToUrl)}t===app.Events.SearchEvents.SearchCompleted&&(i.searchEvent=app.Events.SearchEvents.SearchCompleted);t===app.Events.SearchEvents.PageLoadCompleted&&(i.searchEvent=app.Events.SearchEvents.PageLoadCompleted);t===app.Events.SearchEvents.SortCompleted&&(i.searchEvent=app.Events.SearchEvents.SortCompleted);i.searchingAssociatedParcels=!1})},t}(app.Common.Controllers.PagedSearchController);n.EnerGovAssociatedParcelSearchController=t})(t=n.Address||(n.Address={}))})(t=n.GlobalSearch||(n.GlobalSearch={}))}(EnerGov||(EnerGov={}));__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,e,o,s,h,c){var l=n.call(this,t,i,r,u,null,!1)||this;return l.enerGovGlobalSearchAddressService=u,l.enerGovAddressCardsService=f,l.enerGovEntityParcelSearchService=o,l.eventService=s,l.enerGovAssociatedParcelSearchService=h,l.randomStringGeneratorService=c,l.associatedParcelList=[],l.showAssociatedParcels=!1,l.showAssociatedAddresses=!1,l.disableAddAddress=!1,l.searchingAssociatedParcels=!1,l.useRelationalLiveLink=!1,l.searchParcelCriteria=null,l.searchingAssociatedParcels=!1,l.useRelationalLiveLink=!1,l}return __extends(t,n),t.prototype.searchAddresses=function(){if($("#addAddressFromSearchBox").val().trim().length!=0){var n={PageSize:this.searchCriteria.PageSize,PageNumber:1,Address:$("#addAddressFromSearchBox").val().trim()};this.searchCriteria=n;this.search(n,app.Events.SearchEvents.SearchCompleted)}},t.prototype.addAddress=function(n){var i=this,r="",u="",t,f;if(this.disableAddAddress=!0,t=i.createNewLocationCard(),t.Associated=i.randomStringGeneratorService.GenerateString(),t.FormattedAddressString=n.Address,angular.forEach(n.AddressFields,function(n){switch(n.FieldName.toUpperCase()){case"STREETNUMBER":t.AddressLine1=n.FieldValue;break;case"STREETNAME":t.AddressLine2=n.FieldValue;break;case"STREETTYPE":t.StreetType=n.FieldValue;break;case"CITY":t.City=n.FieldValue;break;case"STATE":t.State=n.FieldValue;break;case"POSTALCODE":t.PostalCode=n.FieldValue;break;case"COUNTY":t.County=n.FieldValue;break;case"CIVICNUMBER":t.AddressLine1=n.FieldValue;break;case"PROVINCE":t.Province=n.FieldValue;break;case"COUNTRY":t.Country=n.FieldValue;break;case"UNITORSUITE":t.UnitOrSuite=n.FieldValue;break;case"PREDIRECTION":t.PreDirection=n.FieldValue;break;case"POSTDIRECTION":t.PostDirection=n.FieldValue;break;case"RELATIONSHIPCOLUMN":i.useRelationalLiveLink=!0;r=n.FieldValue;break;case"GISADDRESSID":t.GisAddressId=n.FieldValue;u=n.FieldValue;break;case"COUNTRYTYPE":t.CountryType=parseInt(n.FieldValue)}}),i.enerGovAddressCardsService.returnFromAddAddress=!0,i.enerGovAddressCardsService.isSelfServiceMailingAddressTypeAvailable&&i.enerGovAddressCardsService.selectedAddressType.SystemActionName=="Location"){i.eventService.on("disableAddAddress",function(n,t){i.disableAddAddress=t[0];i.searchParcelCriteria=null;i.showAssociatedParcels=!1});f={GisAddressId:u,ParcelNumber:r};i.enerGovAddressCardsService.setAddress(t);i.searchParcelCriteria=f}else i.enerGovAddressCardsService.addAddress(t),i.$location.url(i.enerGovAddressCardsService.returnToUrl)},t.prototype.createNewLocationCard=function(){return{ParentAddressID:"",ParentID:"",MailingAddressID:"",CountryType:0,AddressType:"",Main:!1,AddressLine1:"",AddressLine2:"",AddressLine3:"",City:"",State:"",County:"",Country:"",PostalCode:"",PreDirection:"",PostDirection:"",StreetType:"",ParcelID:"",ParcelNumber:"",ParcelAddressID:"",RowVersion:0,LastChangedOn:null,LastChangedBy:"",AddressDisplay:"",UnitOrSuite:"",Province:"",POBox:"",CompSite:"",RuralRoute:"",Station:"",ATTN:"",AddressSystemType:"",GeneralDelivery:!1,Section:"",Range:"",Township:"",IsParcel:!1,IsNew:!1,IsDeleted:!1,ClientId:"",Associated:"",GisAddressId:"",FormattedAddressString:""}},t}(app.Common.Controllers.PagedSearchController);n.EnerGovGlobalSearchAddressController=t})(t=n.Address||(n.Address={}))})(t=n.GlobalSearch||(n.GlobalSearch={}))}(EnerGov||(EnerGov={}));__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,i;(function(n){n[n.Global=0]="Global";n[n.Permit=1]="Permit";n[n.Plan=2]="Plan";n[n.Code=3]="Code";n[n.Request=4]="Request";n[n.Application=6]="Application";n[n.Inspection=7]="Inspection";n[n.BusinessLicense=8]="BusinessLicense";n[n.BusinessEntity=9]="BusinessEntity";n[n.Cashier=10]="Cashier";n[n.ProfLicense=11]="ProfLicense";n[n.TaxRemittance=12]="TaxRemittance"})(t=n.ParentContactModule||(n.ParentContactModule={}));i=function(n){function i(i,r,u,f,e,o,s,h,c,l,a,v,y,p){var w=n.call(this,i,r,e,s)||this,b;return w.enerGovPermitService=u,w.enerGovPlanService=f,w.globalService=e,w.$rootScope=o,w.globalSearchContactService=s,w.contactCardsService=h,w.entitySecondaryDataService=c,w.searchContactService=l,w.favoriteContactService=a,w.eventService=v,w.scope=y,w.utilities=p,w.isSelectedContextTypeNull=!1,w.isOnLoad=!0,w.addContact=function(n){var t=w,i;t.contactCardsService.selectedContactType===null?t.isSelectedContextTypeNull=!0:t.$routeParams.id!==null&&t.$routeParams.id!==undefined?(t.caseNumber=w.$routeParams.id,i={EntityId:w.caseNumber,ParentContactId:"",GlobalEntityId:n.EntityId,ContactTypeId:w.contactCardsService.selectedContactType.ContactTypeId,GlobalEntityName:n.CompanyName,FirstName:n.FirstName,LastName:n.LastName,IsNew:!0,IsDeleted:!1,ClientId:"",Certifications:n.Certifications},t.$location.path().toUpperCase().indexOf("PERMIT")>-1&&(t.contactCardsService.showContactValidationAlert=!1,i.IsLicenseValid=!0,t.enerGovPermitService.getById(w.caseNumber,function(n){t.contactCardsService.validationModule=n;t.contactCardsService.validationModule.PermitTypeID=t.contactCardsService.validationModule.permitTypeId;t.contactCardsService.validationModule.PermitWorkClassID=t.contactCardsService.validationModule.PermitWorkClassId;t.contactCardsService.validationModule.Contacts=[];t.contactCardsService.validationModule.Contacts.push(i);t.contactCardsService.validatePermitContact(t.contactCardsService.validationModule,function(n){n.Result!=null&&n.Result.length>0&&n.Success==!0?(t.contactCardsService.validationFailureContactName=i.FirstName+" "+i.LastName,t.contactCardsService.showContactValidationAlert=!0,t.utilities.showMessage(i.FirstName+" "+i.LastName+" "+t.utilities.getResourceMessage("ContactLicenseInvalidAlertMessage"))):t.contactCardsService.updatePermit(i,function(n){n!=null&&t.$location.url(t.contactCardsService.returnToUrl)})})})),t.$location.path().toUpperCase().indexOf("PLAN")>-1&&t.contactCardsService.updatePlan(i,function(n){n!=null&&t.$location.url(t.contactCardsService.returnToUrl)}),t.$location.path().toUpperCase().indexOf("PROJECT")>-1&&t.contactCardsService.updateProject(i,function(n){n!=null&&t.$location.url(t.contactCardsService.returnToUrl)})):(t.contactCardsService.validationFailureContactName="",t.contactCardsService.showContactValidationAlert=!1,t.contactCardsService.returnFromAddContact=!0,t.contactCardsService.addContact(n,!1))},w.validatePermitContact=function(n){var t=w;t.contactCardsService.addContact(n,!1,w.contactCardsService.selectedContactType)},w.searchByCriteria=function(){var n=w;n.criteria.KeyWord&&n.criteria.KeyWord.length>0&&(n.isOnLoad=!1,n.$location.path().toUpperCase().indexOf("OPERATIONALPERMIT")>-1?n.criteria.ParentContactModuleId=t.BusinessLicense:n.$location.path().toUpperCase().indexOf("PERMIT")>-1?n.criteria.ParentContactModuleId=t.Permit:n.$location.path().toUpperCase().indexOf("PLAN")>-1?n.criteria.ParentContactModuleId=t.Plan:n.$location.path().toUpperCase().indexOf("APPLICATION")>-1&&(n.criteria.ParentContactModuleId=t.Application),n.sortField=n.criteria.KeyWord?n.sortList[0].Value:n.sortList[1].Value,n.criteria.SortField=n.sortField,n.criteria.PageNumber=1,n.criteria.PageSize=n.searchCriteria.PageSize,n.search(angular.copy(n.criteria),app.Events.SearchEvents.SearchCompleted))},w.addRemoveFavoriteContact=function(n){var t=w,i={ContactNumber:n.ContactNumber,ContactId:n.EntityId,FirstName:n.FirstName,LastName:n.LastName,AddressString:n.Address===null?null:n.Address.AddressDisplay,CompanyName:n.CompanyName,Email:n.Email,IsSelected:!0,IsExcluded:!1,ModuleName:"",FavoriteContactId:0,BusinessPhone:n.ContactTypeId,ContactTypeId:n.ContactTypeName,ContactTypeName:n.ContactTypeName,EntityId:n.EntityId,FullName:n.FullName,HomePhone:n.HomePhone,IsActive:n.IsActive,IsLicenseValid:n.IsLicenseValid,IsMe:n.IsMe,MiddleName:n.MiddleName,MobilePhone:n.MobilePhone,Address:null,IsContact:n.IsContact,IsCompany:n.IsCompany};t.favoriteContacts.push(i);t.globalService.tenantId;n.IsFavorite?t.favoriteContactService.removeContacts(t.favoriteContacts,function(){n.IsFavorite=!1;t.eventService.boradcast("FavoriteContactAddedRemoved")}):t.searchContactService.addContacts(t.favoriteContacts,function(){n.IsFavorite=!0;t.eventService.boradcast("FavoriteContactAddedRemoved")});t.favoriteContacts=[]},w.favoriteContacts=[],b=w,b.isOnLoad=!0,b.criteria==null&&(b.criteria={PageNumber:1,PageSize:e.pageSizeList[0].Value,SortField:"",IsSortedInAscendingOrder:!0,KeyWord:"",ParentContactModuleId:null,ModuleId:0,EntityId:null}),w}return __extends(i,n),i.prototype.init=function(){var n=this,t;n.entitySecondaryDataService.getEntityRecordSortSecondaryData(function(t){n.sortList=t.Result.SearchContactSortList;n.sortField=t.Result.SearchContactSortList[1].Value;n.changeSortField(n.sortField,!1);n.searchByCriteria()});t=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id);t==app.Common.SelfServiceModules.Permit?this.enerGovPermitService.getPermit(this.$routeParams.id,function(t){n.contactCardsService.validationModule=t}):t==app.Common.SelfServiceModules.Plan;n.scope.$on("FavoriteContactAdded",function(t,i){var r=i[0],u={EntityId:r.EntityId,CompanyName:r.CompanyName,FirstName:r.FirstName,MiddleName:r.MiddleName,LastName:r.LastName,FullName:r.FirstName+" "+r.LastName,Address:r.Address,Email:r.Email,HomePhone:null,MobilePhone:null,BusinessPhone:null,IsActive:null,IsMe:null,ContactTypeId:null,ContactTypeName:null,IsLicenseValid:null,ContactNumber:"",IsFavorite:!0,IsContact:r.IsContact,IsCompany:r.IsCompany,Certifications:r.Certifications};n.addContact(u)})},i.prototype.updatePermit=function(n,t,i){var r=this;i(n);r.contactCardsService.showContactValidationAlert||(t.IsLicenseValid=!0,r.contactCardsService.updatePermit(t,function(n){n!=null&&r.$location.url(r.contactCardsService.returnToUrl)}))},i}(app.Common.Controllers.PagedGenericSearchController);n.EnerGovGlobalSearchContactController=i})(t=n.Contact||(n.Contact={}))})(t=n.GlobalSearch||(n.GlobalSearch={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){"use strict";var i=n.GlobalSearch.Address.EnerGovGlobalSearchAddressController,r=n.GlobalSearch.Address.Services.EnerGovGlobalSearchAddressService,u=n.GlobalSearch.Address.EnerGovAssociatedParcelSearchController,f=n.Address.Services.EnerGovAssociatedParcelSearchService;angular.module("enerGov.GlobalSearch",["app.Services.Utilities","app.globalsModule","app.Common.Services","enerGov.Common","LocalStorageModule","app.Users","app.Services.Utilities"]).service("enerGovGlobalSearchContactService",["http",t.Contact.EnerGovGlobalSearchContactService]).service("enerGovGlobalSearchAddressService",["http",r]).service("enerGovAssociatedParcelSearchService",["http",f]).controller("enerGovGlobalSearchContactController",["$routeParams","$location","enerGovPermitService","enerGovPlanService","globalsService","$rootScope","enerGovGlobalSearchContactService","enerGovContactCardsService","entitySecondaryDataService","searchContactService","favoriteContactService","eventService","$scope","utilities",t.Contact.EnerGovGlobalSearchContactController]).controller("enerGovGlobalSearchAddressController",["$routeParams","$location","globalsService","enerGovGlobalSearchAddressService","enerGovAddressCardsService","entitySecondaryDataService","enerGovArcGisParcelSearchService","eventService","enerGovAssociatedParcelSearchService","randomStringGeneratorService",i]).controller("enerGovAssociatedParcelSearchController",["$routeParams","$location","globalsService","enerGovAssociatedParcelSearchService","eventService","enerGovAddressCardsService","enerGovArcGisParcelSearchService","enerGovAddressService",u])})(t=n.GlobalSearch||(n.GlobalSearch={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){this.http=n;this.entityTabsService=t;this.$routeParams=i;this.rootUrl="/energov/customfields/";this.businessCustomFileds=[]}return Object.defineProperty(n.prototype,"customFields",{get:function(){return this.customFieldData},enumerable:!0,configurable:!0}),n.prototype.getCustomLayout=function(n,t,i){n||t?(n=n||t,t=t||n,this.http.get(this.rootUrl+"template/"+n+"/"+t,function(n){n.Success&&i(n.Result)},!0)):i({CustomGroups:[],Id:0,Label:"",Name:"",PackageId:"",OfflineCustomFieldLyoutId:"",TenantId:0})},n.prototype.getCustomLayoutWithData=function(n,t,i,r,u){var f=this,e={EntityId:i,ModuleId:r,LayoutId:n,OnlineLayoutId:t};this.http.post(this.rootUrl+"data/",e,function(n){n.Success||(n.StatusCode===app.Common.Services.HttpStatusCode.NoContent||n.StatusCode===app.Common.Services.HttpStatusCode.Forbidden?f.entityTabsService.showMoreInfoTab=!1:n.StatusCode===app.Common.Services.HttpStatusCode.PreconditionFailed&&(f.entityTabsService.showMoreInfoTab=!0),f.$routeParams.tab&&f.$routeParams.tab==app.Constants.TabConstants.Moreinfo?f.entityTabsService.setAdditionalEntityTabsVisibility(f.$routeParams.tab,f.entityTabsService.showMoreInfoTab):f.entityTabsService.setFirstTabOnHidingOtherTabs());f.customFieldData=n.Result;u(n)},!0)},n}();n.EnerGovCustomFieldsService=t})(t=n.Services||(n.Services={}))})(t=n.CustomFields||(n.CustomFields={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){"use strict";angular.module("enerGov.CustomFields",["app.Common.Services"]).service("customFieldsService",["http",app.CustomFields.CustomFieldsService]).service("enerGovCustomFieldsService",["http","entityTabsService","$routeParams",n.Services.EnerGovCustomFieldsService])})(t=n.CustomFields||(n.CustomFields={}))}(EnerGov||(EnerGov={}));__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=app.Constants.MapConstants,i=function(n){function i(t,i,r,u,f){var e=n.call(this,null)||this;return e.enerGovMapService=t,e.userService=i,e.mapViewer=r,e.$timeout=u,e.eventService=f,e.isUserLoggedIn=!1,e.isAppliedClicked=!1,e.isSearching=!1,e.lastScale=-1,e.conversions=[],e.waitForMap=function(){var n=e;n.$timeout(function(){if(n.mapViewer.Map&&n.mapViewer.Map.extent){n.init();n.updateModel(n.mapViewer.Map.getScale(),n.mapViewer.Map.extent);n.mapViewer.Map.on("extent-change",function(t){var i=t.target.getScale();Math.abs(n.lastScale-i)>10&&(n.lastScale=i,n.updateModel(i,t.extent),n.isAppliedClicked&&n.startNewSearch())})}else n.waitForMap()},100)},e.model={MapSearchModule:1,AllPermits:!1,AllInspections:!1,AllCodeCases:!1,AllRequests:!1,AllPlans:!1,AllData:!0,ActiveDuring:1,AppliedDuring:1,BottomLeftX:0,BottomLeftY:0,TopRightX:0,TopRightY:0,AggregationPrecision:7,MapWkid:0,Wkid:0,ArcGisGeometryServiceUrl:""},e.waitForMap(),e}return __extends(i,n),i.prototype.startNewSearch=function(){var i=this,n=this;n.isSearching=!0;n.delayInvoke(function(){var r=i.model;i.enerGovMapService.searchByFilterCriteria(r,function(i){n.result=i;n.isAppliedClicked=!0;n.isSearching=!1;n.eventService.boradcast(t.mapSearchCompletedEventName,{data:i,precision:n.model.AggregationPrecision,criteria:r})})})},i.prototype.init=function(){var n=this;this.enerGovMapService.mapFiltersSetupData(function(t){n.mapFiltersSecondaryData=t});this.isUserLoggedIn=this.userService.isUserLoggedIn;this.userService.listenToLoginStatusChange(function(){n.isUserLoggedIn=n.userService.isUserLoggedIn});this.conversions.push({geoHashPrecision:4,scale:this.mapViewer.config.ArcGisGeoHashPrecision4Scale});this.conversions.push({geoHashPrecision:5,scale:this.mapViewer.config.ArcGisGeoHashPrecision5Scale});this.conversions.push({geoHashPrecision:6,scale:this.mapViewer.config.ArcGisGeoHashPrecision6Scale});this.conversions.push({geoHashPrecision:7,scale:this.mapViewer.config.ArcGisGeoHashPrecision7Scale});this.conversions.push({geoHashPrecision:8,scale:this.mapViewer.config.ArcGisGeoHashPrecision8Scale});this.conversions.push({geoHashPrecision:9,scale:this.mapViewer.config.ArcGisGeoHashPrecision9Scale})},i.prototype.clear=function(){this.result={Results:[]};this.isAppliedClicked=!1;this.isSearching=!1;this.eventService.boradcast(t.mapSearchCompletedEventName,{data:this.result})},i.prototype.updateModel=function(n,t){var i=0;angular.forEach(this.conversions,function(t){t.scale<n&&(i||(i=t.geoHashPrecision))});this.model.AggregationPrecision=i;this.model.BottomLeftX=t.xmin;this.model.BottomLeftY=t.ymin;this.model.TopRightX=t.xmax;this.model.TopRightY=t.ymax;this.model.MapWkid=t.spatialReference.wkid;this.model.Wkid=this.mapViewer.config.LocatorOutputWKID;this.model.ArcGisGeometryServiceUrl=this.mapViewer.config.ArcGisGeometryServiceUrl},i}(app.Core.Controllers.CoreController);n.EnergovMapFiltersController=i})(t=n.Controllers||(n.Controllers={}))})(t=n.Map||(n.Map={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){"use strict";var t=n.Controllers.EnergovMapFiltersController;angular.module("enerGov.Map",["app.Common.Services"]).controller("energovMapFiltersController",["enerGovMapService","userService","esriMapViewer","$timeout","eventService",t])})(t=n.Map||(n.Map={}))}(EnerGov||(EnerGov={}));__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){var t=function(n){function t(t,i,r){var u=n.call(this)||this;return u.calendarConfig=r,u.restrict="A",u.replace=!0,u.bindToController=!1,u.scope={date:"=",increment:"=",decrement:"=",events:"=",options:"="},u.link=function(n,i,r){var f=u;i.on("click",function(){var u=angular.copy(n.date),i;angular.isDefined(r.setToToday)?n.date=new Date:angular.isDefined(r.increment)?n.date=moment(n.date).add(1,n.increment).toDate():angular.isDefined(r.decrement)&&(n.date=moment(n.date).subtract(1,n.decrement).toDate());n.date.getFullYear()!==u.getFullYear()&&(i={FromDate:new Date(n.date.getFullYear(),0,1,0,0,0,0),ToDate:new Date(n.date.getFullYear(),11,31,23,59,59,0),CalendarOptions:n.options,HideLicense:!1},t.getEvents(i,function(t){n.events=t}));n.$apply()})},u}return __extends(t,n),t}(app.Directives.Core.BaseDirective);n.CalendarDateModifier=t})(t=n.Directives||(n.Directives={}))})(t=n.Calendar||(n.Calendar={}))}(EnerGov||(EnerGov={}));__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){var t;(function(n){var t=function(n){function t(){var t=n.call(this)||this;return t.restrict="E",t.replace=!0,t.template='<div mwl-dynamic-directive-template name="eventSlideBox" overrides="vm.customTemplateUrls"><\/div>',t.bindToController=!1,t.scope={isOpen:"=",event:"=",customTemplateUrls:"=?",templateScope:"="},t}return __extends(t,n),t}(app.Directives.Core.BaseDirective);n.EventSlideBox=t})(t=n.EventSlideBox||(n.EventSlideBox={}))})(t=n.Directives||(n.Directives={}))})(t=n.Calendar||(n.Calendar={}))}(EnerGov||(EnerGov={}));__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){var t=function(n){function t(){var t=n.call(this)||this;return t.restrict="A",t.replace=!0,t.bindToController=!0,t.link=function(n,t){t.on("click",function(){angular.element(document.querySelector("div[name=eventSlideBox]")).hide()})},t}return __extends(t,n),t}(app.Directives.Core.BaseDirective);n.RemoveInfoBox=t})(t=n.Directives||(n.Directives={}))})(t=n.Calendar||(n.Calendar={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(){}return n.colorTypes={meetings:{primary:"#21508f",secondary:"#fff"},hearings:{primary:"#8f2e85",secondary:"#fff"},holidays:{primary:"#deebf7",secondary:"#000"},invoices:{primary:"#2f4f4f",secondary:"#fff"},plans:{primary:"#dcdcdc",secondary:"#000"},inspections:{primary:"#a52a2a",secondary:"#fff"},permits:{primary:"#ffd700",secondary:"#000"},licenses:{primary:"#ff8c00",secondary:"#000"}},n}();n.CalendarColourService=t})(t=n.Services||(n.Services={}))})(t=n.Calendar||(n.Calendar={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){var i;(function(t){"use strict";var i=function(){function i(n,i,r){var u=this;this.http=n;this.calendarConfig=i;this.holidayColour={primary:"rgb(65,113,156)",secondary:"rgb(222, 235, 247)"};this.invoice={primary:"#b50000",secondary:"#ffa58f"};this.calendarItemsConfig={hearings:t.CalendarColourService.colorTypes.hearings,meetings:t.CalendarColourService.colorTypes.meetings,holidays:t.CalendarColourService.colorTypes.holidays,inspections:t.CalendarColourService.colorTypes.inspections,plan:t.CalendarColourService.colorTypes.plans,permit:t.CalendarColourService.colorTypes.permits,invoice:t.CalendarColourService.colorTypes.invoices,license:t.CalendarColourService.colorTypes.licenses,warning:this.calendarConfig.colorTypes.warning,info:this.calendarConfig.colorTypes.info,special:this.calendarConfig.colorTypes.special,inverse:this.calendarConfig.colorTypes.inverse,important:this.calendarConfig.colorTypes.important,success:this.calendarConfig.colorTypes.success};r.getSpecificKeyValues("SelfService.EnerGov.Resources.Calendar.CalendarResource",["Calendar_Invoice_Payment","Calendar_ExpiringToday"],function(n){u.invoiceRes=n.Calendar_Invoice_Payment;u.expiringToday=n.Calendar_ExpiringToday})}return i.prototype.getTenantSetting=function(n,t,i){var r={softwarePackageName:t,settingName:i};this.http.get("/tenantSettings/SoftwarePackageSettings",function(t){t.Success&&n(t.Result)},!1,r)},i.prototype.getEvents=function(n,t){var i=this;this.http.post("/calendar/events",n,function(n){t(i.toCalendarEvents(n.Result))},!1)},i.prototype.toCalendarEvents=function(t){var i=this,r=[];return angular.forEach(t,function(t){var u={title:"",startOpen:null,endOpen:null,type:"",scheduledDate:null,keyPress:jQuery,startsAt:null,endsAt:null,color:null,typeToShow:"",showTimeAs:"",showRequestedOrScheduleTime:"",specifiedAMText:"",specifiedPMText:"",scheduledStartDate:null,scheduledEndDate:null,timeZone:"",hideScheduleTime:!1};u.startDate=moment(t.StartDate).format(app.Constants.GlobalConstants.DateFormat);u.invoiceDate=t.InvoiceDate===null?null:moment(t.InvoiceDate).format(app.Constants.GlobalConstants.DateFormat);u.invoiceTotal=t.InvoiceTotal;u.projectName=t.ProjectName;u.applyDate=t.ApplyDate===null?null:moment(t.ApplyDate).format(app.Constants.GlobalConstants.DateFormat);u.issueDate=t.IssueDate===null?null:moment(t.IssueDate).format(app.Constants.GlobalConstants.DateFormat);u.finalizeDate=t.FinalizeDate===null?null:moment(t.FinalizeDate).format(app.Constants.GlobalConstants.DateFormat);u.completeDate=t.CompleteDate===null?null:moment(t.CompleteDate).format(app.Constants.GlobalConstants.DateFormat);u.address=t.Address;u.startsAt=moment(t.StartDate).toDate();u.endsAt=moment(t.EndDate).toDate();u.comments=t.Comments;u.title=t.EventName;u.subject=t.Subject;u.location=t.Location;u.status=t.Status;u.dba=t.DBA;u.company=t.Company;t.Record!==undefined&&(u.caseType=t.Record.CaseType,u.caseNumber=t.Record.CaseNumber,u.caseDescription=t.Record.CaseDescription,u.assignedTo=t.Record.AssignedUser,u.caseWorkClass=t.Record.CaseWorkclass,u.caseRecordId=t.Record.CaseRecordId,u.caseModuleId=t.Record.CaseModule,u.caseTypeId=t.Record.CaseTypeId);u.type=n.Calendar.Enums.SelfServiceCalendarType[t.CalendarOption];u.typeToShow=u.type;switch(u.type){case"BusinessLicense":case"ProfLicense":u.typeToShow="License"}switch(parseInt(t.CalendarOption.toString())){case n.Calendar.Enums.SelfServiceCalendarType.Hearing:u.color=i.calendarItemsConfig.hearings;u.startsAtString=moment(t.StartDate).format(app.Constants.GlobalConstants.DateFormatOnlyTime)+" "+moment.tz(moment.tz.guess()).format("z");u.endsAtString=moment(t.EndDate).format(app.Constants.GlobalConstants.DateFormatOnlyTime)+" "+moment.tz(moment.tz.guess()).format("z");break;case n.Calendar.Enums.SelfServiceCalendarType.Holiday:u.color=i.calendarItemsConfig.holidays;u.allDay=!0;break;case n.Calendar.Enums.SelfServiceCalendarType.Inspection:u.color=i.calendarItemsConfig.inspections;u.InspectionTypeSettings=t.InspectionTypeSettings;u.scheduledStartDate=t.StartDate;u.scheduledEndDate=t.EndDate;break;case n.Calendar.Enums.SelfServiceCalendarType.Meeting:u.color=i.calendarItemsConfig.meetings;u.startsAtString=moment(t.StartDate).format(app.Constants.GlobalConstants.DateFormatOnlyTime)+" "+moment.tz(moment.tz.guess()).format("z");u.endsAtString=moment(t.EndDate).format(app.Constants.GlobalConstants.DateFormatOnlyTime)+" "+moment.tz(moment.tz.guess()).format("z");break;case n.Calendar.Enums.SelfServiceCalendarType.Plan:u.color=i.calendarItemsConfig.plan;u.title=u.caseNumber+" "+i.expiringToday;u.endsAtString=moment(t.EndDate).format(app.Constants.GlobalConstants.DateFormat);u.approvalExpirationDate=t.ApprovalExpirationDate===null?null:moment(t.ApprovalExpirationDate).format(app.Constants.GlobalConstants.DateFormat);u.expirationDate=t.ExpirationDate===null?null:moment(t.ExpirationDate).format(app.Constants.GlobalConstants.DateFormat);break;case n.Calendar.Enums.SelfServiceCalendarType.Permit:u.color=i.calendarItemsConfig.permit;u.title=u.caseNumber+" "+i.expiringToday;u.endsAtString=moment(t.EndDate).format(app.Constants.GlobalConstants.DateFormat);break;case n.Calendar.Enums.SelfServiceCalendarType.Invoice:u.color=i.calendarItemsConfig.invoice;u.title=i.invoiceRes.replace("{0}",u.caseNumber);break;case n.Calendar.Enums.SelfServiceCalendarType.BusinessLicense:case n.Calendar.Enums.SelfServiceCalendarType.ProfLicense:u.color=i.calendarItemsConfig.license;u.title=u.caseNumber+" "+i.expiringToday;u.endsAtString=moment(t.EndDate).format(app.Constants.GlobalConstants.DateFormat)}r.push(u)}),r},i}();t.EnerGovCalendarService=i})(i=t.Services||(t.Services={}))})(t=n.Calendar||(n.Calendar={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){var t,i;(function(n){n[n.None=0]="None";n[n.Hearing=1]="Hearing";n[n.Meeting=2]="Meeting";n[n.Holiday=3]="Holiday";n[n.Plan=4]="Plan";n[n.Permit=5]="Permit";n[n.Inspection=6]="Inspection";n[n.Invoice=7]="Invoice";n[n.BusinessLicense=8]="BusinessLicense";n[n.ProfLicense=9]="ProfLicense"})(t=n.SelfServiceCalendarType||(n.SelfServiceCalendarType={})),function(n){n[n.None=0]="None";n[n.Permit=1]="Permit";n[n.Plan=2]="Plan";n[n.Inspection=3]="Inspection";n[n.Application=4]="Application"}(i=n.SelfServiceCalendarCaseModule||(n.SelfServiceCalendarCaseModule={}))})(t=n.Enums||(n.Enums={}))})(t=n.Calendar||(n.Calendar={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){var i=n.Calendar.Enums.SelfServiceCalendarType,r=function(){function n(n,t,i){this.userService=n;this.calenderEventService=t;this.calendarConstants=i;this.calendarView="month";this.viewDate=new Date;this.isCellOpen=!1;this.isEventCollapse=!1;this.calanderOptionsForFilter=[];this.hideInfo=!1;this.showInvoiceDueDatesOnCalendar=!1;this.hideLicenseFeature=!1;this.isUserLoggedIn=!1;this.loading=!0;var r=this;r.loading=!0;t.getTenantSetting(function(n){n.SettingValue!==null&&(r.showInvoiceDueDatesOnCalendar=n.SettingValue=="true");r.loadEvents()},"EnerGov","ShowInvoiceDueDatesOnCalendar");t.getTenantSetting(function(n){n.SettingValue!==null&&(r.hideLicenseFeature=n.SettingValue=="true")},"EnerGov","HideAllLicense")}return n.prototype.loadEvents=function(){var n=this,t;n.isUserLoggedIn=n.userService.isUserLoggedIn;n.userService.listenToLoginStatusChange(function(){n.isUserLoggedIn=n.userService.isUserLoggedIn});n.calanderOptionsForFilter=[i.Hearing,i.Meeting,i.Holiday,i.Plan,i.Permit,i.Inspection,i.BusinessLicense,i.ProfLicense];n.showInvoiceDueDatesOnCalendar&&n.calanderOptionsForFilter.push(i.Invoice);t={FromDate:new Date((new Date).getFullYear(),0,1,0,0,0,0),ToDate:new Date((new Date).getFullYear(),11,31,23,59,59,0),CalendarOptions:n.calanderOptionsForFilter,HideLicense:!1};n.calenderEventService.getEvents(t,function(t){n.events=t;n.modifyHolidayCell(n.events);n.loading=!1})},n.prototype.modifyHolidayCell=function(){this.cellModifier=function(n){if(n.events!==undefined){var t=n.events.filter(function(n){return n.type===app.Constants.CalendarConstants.Holiday});t.length>0&&(n.holidayLabels=[],n.cssClass="calendar-month-holiday",angular.forEach(t,function(t){n.holidayLabels.push(t.title)}))}}},n.prototype.eventClicked=function(t,i){var r=this;this.viewedEvent=null;angular.element(document.querySelector("div[name=eventSlideBox]")).hide();setTimeout(function(){t.type!==app.Constants.CalendarConstants.Holiday&&(r.viewedEvent=t)});angular.element(document.querySelector("div[name=eventSlideBox]")).show();n.clickedEvent=$(i.target)},n.prototype.filterEventsByType=function(n){var t=this,r=this.calanderOptionsForFilter.indexOf(parseInt(n.currentTarget.value)),u;r<0?(this.calanderOptionsForFilter.push(parseInt(n.currentTarget.value)),parseInt(n.currentTarget.value)===i.BusinessLicense&&this.calanderOptionsForFilter.push(i.ProfLicense)):(this.calanderOptionsForFilter.splice(r,1),parseInt(n.currentTarget.value)===i.BusinessLicense&&this.calanderOptionsForFilter.splice(this.calanderOptionsForFilter.indexOf(i.ProfLicense),1));u={FromDate:new Date(this.viewDate.getFullYear(),0,1,0,0,0,0),ToDate:new Date(this.viewDate.getFullYear(),11,31,23,59,59,0),CalendarOptions:this.calanderOptionsForFilter,HideLicense:!1};this.calenderEventService.getEvents(u,function(n){t.events=n;t.modifyHolidayCell(t.events)})},n}();t.EnerGovCalendar=r})(t=n.Calendar||(n.Calendar={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(){"use strict";var t=n.Calendar.EnerGovCalendar;angular.module("enerGov.calendar",["mwl.calendar","ui.bootstrap","app.Common.Services"]).service("calenderEventService",["http","calendarConfig","resourceService",n.Calendar.Services.EnerGovCalendarService]).directive("eventSlideBox",[function(){return new n.Calendar.Directives.EventSlideBox.EventSlideBox}]).directive("calendarDateModifier",["calenderEventService","http","calendarConfig",function(t,i,r){return new n.Calendar.Directives.CalendarDateModifier(t,i,r)}]).directive("eventFocus",["$timeout","$parse",function(t,i){return new n.Common.Directives.FocusElement.FocusElement(t,i)}]).directive("removeInfoBox",[function(){return new n.Calendar.Directives.RemoveInfoBox}]).constant("calendarConstants",new app.Constants.CalendarConstants).controller("calendarController",["userService","calenderEventService",t]).config(["calendarConfig",function(n){n.templates.calendar="calendar.html";n.templates.calendarMonthView="calendarMonthView.html";n.templates.calendarDayView="calendarDayView.html";n.templates.calendarHourList="calendarHourList.html";n.templates.calendarMonthCell="calendarMonthCell.html";n.templates.calendarMonthCellEvents="calendarMonthCellEvents.html";n.templates.calendarSlideBox="calendarSlideBox.html";n.templates.eventSlideBox="eventSlideBox.html";n.templates.calendarMonthView="calendarMonthView.html";n.templates.calendarWeekView="calendarWeekView.html";n.templates.calendarYearView="calendarYearView.html"}])})(t=n.Calendar||(n.Calendar={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/entity/events"}return n.prototype.searchByCriteria=function(n,t){var i=this;this.http.post(this.rootUrl+"/search",n,function(n){t(i.convertToEventView(n))},!0)},n.prototype.searchEventForEntityTab=function(n,t){return this.http.post(this.rootUrl+"/search",n,function(n){t(n)},!1)},n.prototype.convertToEventView=function(n){var t={ErrorMessage:n.ErrorMessage,PageCount:n.PageCount,Result:null,Success:n.Success,TotalFound:n.TotalFound,StatusCode:n.StatusCode},i=n.Result===null?null:[];return angular.forEach(n.Result,function(n){var t={Location:"",Date:null,EndTime:null,EndTimeString:"",StartTime:null,StartTimeString:"",Subject:"",Type:"",Status:""};t.Date=n.Date;t.EndTime=n.EndTime;t.Location=n.Location;t.Subject=n.Subject;t.Status=n.Status;t.Type=n.Type;t.StartTime=n.StartTime;t.StartTimeString=n.StartTime===null?null:moment(n.StartTime).format(app.Constants.GlobalConstants.DateFormatOnlyTime)+" "+moment.tz(moment.tz.guess()).format("z");t.EndTimeString=n.EndTime===null?null:moment(n.EndTime).format(app.Constants.GlobalConstants.DateFormatOnlyTime)+" "+moment.tz(moment.tz.guess()).format("z");i.push(t)}),t.Result=i,t},n.prototype.isEntityEventsExist=function(n,t,i){return this.http.get(this.rootUrl+"/isEntityEventsExist/"+n+"/"+t,function(n){i(n.Result)},!1)},n}();n.EnerGovEntityEventSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Event||(n.Event={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f){var e=n.call(this,t,i,r,u,null,!1)||this;return e.entitySecondaryDataService=f,e}return __extends(t,n),t.prototype.init=function(){var n=this,t=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id);this.criteria={PageNumber:1,PageSize:this.globalService.pageSizeList[0].Value,SortField:"",IsSortedInAscendingOrder:!0,ModuleId:t,EntityId:this.$routeParams.id};this.entitySecondaryDataService.sortSecondaryData===null||typeof this.entitySecondaryDataService.sortSecondaryData=="undefined"?this.entitySecondaryDataService.getEntityRecordSortSecondaryData(function(t){n.sortList=t.Result.EntityEventSearchSortList;n.sortField=t.Result.EntityEventSearchSortList[0].Value}):(n.sortList=this.entitySecondaryDataService.sortSecondaryData.Result.EntityEventSearchSortList,n.sortField=this.entitySecondaryDataService.sortSecondaryData.Result.EntityEventSearchSortList[0].Value);this.search(this.criteria,app.Events.SearchEvents.SearchCompleted)},t}(app.Common.Controllers.PagedSearchController);n.EnerGovEntityEventSearchController=t})(t=n.Event||(n.Event={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){angular.module("enerGov.Event",["app.globalsModule","app.Common.Services","enerGov.Common"]).service("enerGovEntityEventSearchService",["http",n.Services.EnerGovEntityEventSearchService]).controller("enerGovEntityEventSearchController",["$routeParams","$location","globalsService","enerGovEntityEventSearchService","entitySecondaryDataService",n.EnerGovEntityEventSearchController])})(t=n.Event||(n.Event={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/requests/";this.tabControlId=0}return n.prototype.getSecondaryData=function(n,t){var i;i=this.rootUrl+"requesttypes";this.http.get(i,function(n){n.Success?t(n.Result):t(null)},!1)},n.prototype.getById=function(n,t){var i;i=this.rootUrl+n;this.http.get(i,function(n){t(n.Result)},!1)},n.prototype.getRequestStatus=function(n){var t;t=this.rootUrl+"request/status";this.http.get(t,function(t){t.Success?n(t.Result):n(null)},!1)},n}();n.EnerGovRequestsService=t})(t=n.Services||(n.Services={}))})(t=n.Requests||(n.Requests={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f,e,o,s,h,c){var l=n.call(this,null)||this;return l.$routeParams=t,l.$location=i,l.globalService=r,l.enerGovRequestsService=u,l.userService=f,l.enerGovCustomFieldsService=e,l.customFieldsService=o,l.pageTitleService=s,l.tabNavigatorService=h,l.entityTabsService=c,l.userLoggedIn=!1,l}return __extends(t,n),t.prototype.initialise=function(){var n=this,t;n.tabNavigatorService.cleanUp();n.customFieldsService.setLayout(null);t=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(n.$location,n.$routeParams.id);n.entityTabsService.setEntityTabsVisibility(n.$routeParams.id,t,n.$routeParams.tab);n.$routeParams.tab&&n.tabNavigatorService.selectTab(n.$routeParams.tab);this.enerGovRequestsService.getById(this.$routeParams.id,function(i){(n.model=i,n.model!=null)&&(n.pageTitleService.setPageTitle(n.model.RequestNumber),n.model.RequestId!==null&&n.model.RequestId!=="",n.model.LayoutId!==null&&n.model.LayoutId!==""&&n.model.RequestId!==null&&n.model.RequestId!==""?n.enerGovCustomFieldsService.getCustomLayoutWithData(n.model.LayoutId,n.model.OnlineLayoutId,n.model.RequestId,t,function(t){t.Success?t.Result!=null?n.customFieldsService.setLayout(t.Result):n.errorMessage=t.ErrorMessage:(t.StatusCode===app.Common.Services.HttpStatusCode.PreconditionFailed||t.StatusCode===app.Common.Services.HttpStatusCode.NoContent||t.StatusCode===app.Common.Services.HttpStatusCode.Forbidden)&&(n.errorMessage=t.ErrorMessage)}):(n.entityTabsService.showMoreInfoTab=!1,n.$routeParams.tab&&n.$routeParams.tab==app.Constants.TabConstants.Moreinfo?n.entityTabsService.setAdditionalEntityTabsVisibility(n.$routeParams.tab,n.entityTabsService.showMoreInfoTab):n.entityTabsService.setFirstTabOnHidingOtherTabs()),n.model.RequestId||(alert("Unable to load the selected request. Please contact your municipality about the request you were attempting to view. Returning to home."),n.$location.path("/home")))})},t}(app.Core.Controllers.CoreController);n.EnerGovRequestsViewController=t})(t=n.Requests||(n.Requests={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){"use strict";var t=n.EnerGovRequestsViewController,i=n.Services.EnerGovRequestsService;angular.module("enerGov.requests",["app.globalsModule","app.Common.Services"]).service("enerGovRequestsService",["http",i]).controller("enerGovRequestsViewController",["$routeParams","$location","globalsService","enerGovRequestsService","userService","enerGovCustomFieldsService","customFieldsService","pageTitleService","tabNavigatorService","entityTabsService",t])})(t=n.Requests||(n.Requests={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){this.http=n;this.$http=t;this.globalsService=i;this.rootUrl="/energov/report/"}return n.prototype.getAllReports=function(n){this.http.get(this.rootUrl+"reports",function(t){t.Success&&n(t)},!1)},n.prototype.generateReport=function(n,t){var i=this;this.$http.post(i.globalsService.webApiBaseUrl+"/energov/report/generate",n,{headers:{"Content-Type":"application/json",dataType:"text"}}).then(function(n){n.status===200&&t(n)}).catch(function(){t(null)})},n.prototype.getReportName=function(n,t,i,r){var u={};u.category=n;t!==""&&t!==null&&(u.packageTypeId=t);t!==""&&t!==null&&(u.packageClassId=i);this.http.get("/report/name",function(n){n.Success&&r(n.Result)},!1,u)},n.prototype.getInspectionReportName=function(n,t,i){var r={};r.category=n;r.inspectionTypeId=t;this.http.get("/report/inspectionReportName",function(n){n.Success&&i(n.Result)},!1,r)},n}();n.EnerGovReportService=t})(t=n.Services||(n.Services={}))})(t=n.Report||(n.Report={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u){var f=n.call(this,null)||this;return f.globalService=t,f.entitySecondaryDataService=i,f.enerGovReportService=r,f.$window=u,f.FromDate="",f.ToDate="",f.ReportModuleListToShow=[],f.startDate="STARTDATE",f.endDate="ENDDATE",f.formateString=app.Constants.GlobalConstants.DateFormat,f.dateCompareValidation=!1,f.ExportReportCriteria={ReportId:"",ReportParameters:[],TenantId:f.globalService.tenantId},f.reportGenerationError=!1,f.isError=!1,f.isGenerating=!1,f.isPopupBlocked=!1,f.init(),f}return __extends(t,n),t.prototype.init=function(){var n=this;n.entitySecondaryDataService.getEntityRecordSortSecondaryData(function(t){n.ReportModuleList=t.Result.ReportModuleTypeFilterList;n.getAllReports()})},t.prototype.generateReport=function(){var n=this;if(angular.forEach(n.ExportReportParameters,function(t){(t.ParameterName.toLowerCase().indexOf(n.startDate.toLowerCase())!==-1||t.ParameterName.toLowerCase().indexOf(n.endDate.toLowerCase())!==-1)&&t.ParameterValue!==""&&moment.isDate(t.ParameterValue)&&(t.ParameterValue=moment(t.ParameterValue).format(n.formateString),t.ParameterName===n.startDate?n.FromDate=t.ParameterValue:n.ToDate=t.ParameterValue);n.dateCompareValidation=n.FromDate!==""&&n.ToDate!==""&&moment(n.FromDate,n.formateString).diff(moment(n.ToDate,n.formateString))>0?!0:!1}),n.dateCompareValidation===!0)return!1;n.ExportReportCriteria.ReportId=n.SelectedReport.ReportId;n.ExportReportCriteria.ReportParameters=n.ExportReportParameters;n.isGenerating=!0;NProgress.start();n.globalService.showProcessing=!0;this.enerGovReportService.generateReport(n.ExportReportCriteria,function(t){var i,e,o,s,r,f,h,u,a,c,v,l;if(t!==null){for(n.isError=!1,n.isPopupBlocked=!1,i=t.data,e=512,i=i.replace(/^[^,]+,/,""),i=i.replace(/\s/g,""),o=atob(i),s=[],r=0;r<o.length;r+=e){for(f=o.slice(r,r+e),h=new Array(f.length),u=0;u<f.length;u++)h[u]=f.charCodeAt(u);a=new Uint8Array(h);s.push(a)}c=new Blob(s,{type:"application/pdf"});navigator.msSaveBlob?navigator.msSaveBlob(c,"report.pdf"):(v=URL.createObjectURL(c),l=window.open(),l?l.document.write('<iframe src="'+v+'" frameborder="0" style="border:0; top:0px; left:0px; bottom:0px; right:0px; width:100%; height:100%;" allowfullscreen><\/iframe>'):(n.isError=!0,n.isPopupBlocked=!0))}else n.isError=!0,n.reportGenerationError=!0;n.isGenerating=!1;NProgress.done();n.globalService.showProcessing=!1})},t.prototype.getAllReports=function(){var n=this;this.enerGovReportService.getAllReports(function(t){n.ReportList=t.Result;n.SelectedReportList=n.ReportList;n.removeModuleOnBasesOfReport()})},t.prototype.moduleChange=function(){this.FromDate="";this.ToDate="";this.isError=!1;this.reportGenerationError=!1;this.dateCompareValidation=!1;this.getParameters()},t.prototype.removeModuleOnBasesOfReport=function(){var n=this,t=n.ReportList.map(function(n){return n.ModuleId});n.ReportModuleList.map(function(i){t.indexOf(i.Value)>=0&&n.ReportModuleListToShow.push(i)})},t.prototype.getParameters=function(){var n=this;this.ExportReportParameters=n.SelectedReport.ReportParameters.map(function(n){var t={ParameterName:"",ParameterValue:"",ParameterOrder:0};return t.ParameterName=n.ParameterName,t.ParameterValue="",t.ParameterOrder=n.ParameterOrder,t});n.ExportReportParameters.length!==2&&n.ExportReportParameters.length!==0&&(n.isError=!0)},t.prototype.showSelectedReports=function(){var n=this;if(n.FromDate="",n.ToDate="",n.isError=!1,n.reportGenerationError=!1,n.SelectedReportList=[],n.SelectedReport=undefined,n.dateCompareValidation=!1,parseInt(n.moduleId)===-1)return this.SelectedReportList=this.ReportList,!1;n.ReportList.map(function(t){t.ModuleId===parseInt(n.moduleId)&&n.SelectedReportList.push(t)})},t}(app.Core.Controllers.CoreController);n.EnerGovReportController=t})(t=n.Report||(n.Report={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(){"use strict";var t=n.Report.EnerGovReportController,i=n.Report.Services.EnerGovReportService;angular.module("enerGov.Report",["app.globalsModule","app.Common.Services","app.Services.Utilities"]).service("enerGovReportService",["http","$http","globalsService",i]).controller("enerGovReportController",["globalsService","entitySecondaryDataService","enerGovReportService","$window",t])})(t=n.Report||(n.Report={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){var i;(function(t){"use strict";var r=n.Common.CaseTypeUseEnums.BusinessLicenseTypeModule,i=n.Common.CaseTypeUseEnums.BusinessLicenseCompanyTypeModule,u=function(){function n(n,t,i,r,u){this.http=n;this.$q=t;this.$http=i;this.globalsService=r;this.userService=u;this.contactDataUrl="/energov/search/searchcontactcards";this.estimatedFees=[];this.rootUrl="/energov/licenses/";this.contactCardInfoResult=null;this.didGetBusinessInfoForApply=!1;this.isfreeformtextcompanyname=!1;this.didGetUserInfoForApply=!1;this.showWorkClass=!1;this.showMoreInfoStep=!1;var f=this;f.setDefaultStates()}return n.prototype.setDefaultStates=function(){this.model={BusinessLicenseId:"",GlobalEntityExtensionId:"",GlobalEntityExtensionName:"",GlobalEntityId:"",LicenseNumber:"",Description:"",LicenseTypeId:"",LicenseClassId:"",IsAppliedOnline:!1,IsRequiredDescription:!1,CustomFields:[],Attachments:[],Addresses:[],Parcels:[],Contacts:[],IsNew:!0,IsDeleted:!1,ClientId:"",CustomFieldLayoutID:"",CustomFieldsLayout:null,BusinessCustomFieldsLayout:null,BusinessCustomFieldLayoutID:"",BusinessTypes:[],LicenseStatusId:"",ComputedFees:[],OriginalEstimatedReceipts:0,ReportedReceipts:0,EstimatedReceipts:0,ActualReceipts:0,DBAName:"",AllowedDeductionAmount:null,CompanyType:null,BusinessDescription:null,Location:null,TIN:null,TaxID:null,FeeTemplateId:"",CompanyName:"",AppliedDate:null,TaxYear:0,TaxYearString:"",IsBusinessManageBusinessTypeCodes:!1,IsLicenseManageBusinessTypeCodes:!1,EntityId:null,Holds:[],BusinessLicenseTypeModuleId:r.BusinessLicense,BusinessCompanyTypeModule:i.Business};this.secondaryData=null;this.businessSecondaryData=null;this.selectedType=null;this.selectedWorkClass=null;this.selectedTypeItems=[];this.selectedLicenseTypeInfo=null;this.selectedCompanyTypeInfo=null;this.didGetBusinessInfoForApply=!1;this.businessGlobalEntityExtensionInfo=null;this.showMoreInfoStep=!1},n.prototype.getBusinessGlobalEntityExtensionById=function(n,t){var i;i="/energov/businessEntities/businessglobalextensioninfo/"+n;this.http.get(i,function(n){t(n.Result)},!1)},n.prototype.totalEstimatedFee=function(){var n=0;return angular.forEach(this.estimatedFees,function(t){n=n+t.ComputedAmount}),n},n.prototype.getBusinessLicenseEstimateFees=function(n,t){var i=this;this.estimatedFees=[];this.http.post(this.rootUrl+"estimatedfees",n,function(n){n.Success&&(i.estimatedFees=n.Result,t(n.Result))})},n.prototype.saveBusinessLicense=function(n,t){n.IsBusinessManageBusinessTypeCodes=this.selectedCompanyTypeInfo?this.selectedCompanyTypeInfo.ManageBusinessTypeCodes:!1;n.IsLicenseManageBusinessTypeCodes=this.selectedLicenseTypeInfo?this.selectedLicenseTypeInfo.ManageBusinessTypeCodes:!1;n.BusinessCompanyTypeModule=this.selectedCompanyTypeInfo?this.selectedCompanyTypeInfo.BusinessCompanyTypeModule:i.Business;this.http.post(this.rootUrl+"businessLicenses/save",n,function(n){t(n)})},n.prototype.getEnerGovUseFreeFormTextCompanyNameSetting=function(n){var t=this;return this.http.get("/energovsetting/isfreeformtextcompanyname",function(i){i.Success&&(t.isfreeformtextcompanyname=i.Result,n())},!0)},n.prototype.updateGlobalEntityName=function(n,t){var i=this;n&&i.user.Company!==i.model.CompanyName?(i.user.Company=i.model.CompanyName,i.user.AccountType=i.model.CompanyName?app.Common.AccountTypeEnums.AccountType.Both.toString():app.Common.AccountTypeEnums.AccountType.Individual.toString(),i.userService.saveMyUser(i.user,function(){t()})):t()},n}();t.EnerGovBusinessLicenseApplyService=u})(i=t.Services||(t.Services={}))})(t=n.License||(n.License={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){var i;(function(t){"use strict";var i=n.Common.CaseTypeUseEnums.BusinessLicenseTypeModule,r=function(){function n(n,t,i,r){this.http=n;this.$q=t;this.$http=i;this.globalsService=r;this.contactDataUrl="/energov/search/searchcontactcards";this.estimatedFees=[];this.rootUrl="/energov/licenses/";this.contactCardInfoResult=null;this.showMoreInfoStep=!1;this.showWorkClass=!1;this.estimatedReceipts="EstimatedReceipts";this.originalEstimatedReceipts="OriginalEstimatedReceipts";this.reportedReceipts="ReportedReceipts";this.allowedDeductionAmount="AllowedDeductionAmount";this.actualReceipts="ActualReceipts";var u=this;u.setDefaultStates()}return n.prototype.setDefaultStates=function(){this.model={LicenseCAPApplicationTypeId:0,LicenseCAPApplicationTypeName:"",CapRenewalTypeId:0,CapRenewalTypeName:"",BusinessLicenseId:"",LicenseParentId:"",LicenseParentNumber:"",GlobalEntityExtensionId:"",GlobalEntityExtensionName:"",GlobalEntityExtensionDBAName:"",GlobalEntityId:"",LicenseNumber:"",Description:"",LicenseTypeId:"",LicenseTypeName:"",LicenseClassId:"",LicenseClassName:"",LicenseStatusId:"",LicenseStatusName:"",IssuedDate:null,ApplicationDate:null,LastRenewalDate:null,ExpirationDate:null,DistrictId:"",IssuedBy:"",TaxYear:0,OriginalEstimatedReceipts:0,OrigianlIssuedDate:null,OriginalExpirationDate:null,IsSecondYearLicense:!1,EstimatedReceipts:0,LicenseFee:0,ActualReceipts:0,AccountBalance:0,AllowedDeductionAmount:0,ReportedReceipts:0,GlobalEntityAccountId:"",AccountNumber:"",IsReceiptsType:!1,LicenseWFTemplateId:"",LicenseWFTemplateRenewalId:"",RowVersion:0,LicensePrefix:"",LastChangedOn:null,LastChangedBy:"",LastChangedByName:"",IsMissingRenewFeeSetup:!1,IsAppliedOnline:!1,LastUpdatedByText:"",IsAlreadyCalculated:!1,CustomFields:[],Attachments:[],Addresses:[],RequiredFields:[],Parcels:[],Contacts:[],IsFromBusiness:!1,ExistingAccountNumber:!1,UseIssueDateAsFeeDate:!1,EntityNumber:"",BillingGlobalEntityId:"",FeeDate:null,CPIVestedMapDate:null,PaidInFull:!1,CanPayNow:!1,SecureUser:"",IsNew:!1,IsDeleted:!1,ClientId:"",CustomFieldLayoutID:"",CustomLayout:null,BusinessTypes:null,FeeTemplateId:"",BusinessLicenseTypeModuleId:i.BusinessLicense};this.secondaryData=null;this.selectedType=null;this.selectedWorkClass=null;this.selectedTypeItems=[];this.selectedLicenseTypeInfo=null;this.showMoreInfoStep=!1},n.prototype.totalReceiptsAmount=function(n){var i=this,t=0;return angular.forEach(i.model.BusinessTypes,function(r){switch(n){case i.estimatedReceipts:t=t+Number(r.EstimatedReceipts);break;case i.originalEstimatedReceipts:t=t+Number(r.OriginalEstimatedReceipts);break;case i.reportedReceipts:t=t+Number(r.ReportedReceipts);break;case i.allowedDeductionAmount:t=t+Number(r.AllowedDeductionAmount);break;case i.actualReceipts:t=t+Number(r.ActualReceipts)}}),t},n.prototype.totalEstimatedFee=function(){var n=0;return angular.forEach(this.estimatedFees,function(t){n=n+t.ComputedAmount}),n},n.prototype.getLicenseRenewalsEstimateFees=function(n,t){var i=this;this.estimatedFees=[];this.http.post(this.rootUrl+"license-renewals/estimated-fees",n,function(n){n.Success&&(i.estimatedFees=n.Result,t(n.Result))})},n.prototype.getLicenseRenewalById=function(n,t){this.http.post(this.rootUrl+"license-renewals",n,function(n){t(n.Result)},!1)},n.prototype.renewBusinessLicense=function(n,t){this.http.post(this.rootUrl+"businessLicenses/renew",n,function(n){t(n)})},n}();t.EnerGovBusinessLicenseRenewService=r})(i=t.Services||(t.Services={}))})(t=n.License||(n.License={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){this.http=n;this.$routeParams=t;this.energovBusinessService=i;this.rootUrl="/energov/licenses/";this.isOperationalPermit=!1}return n.prototype.getSecondaryData=function(n,t){var i=this,r=this.rootUrl+(this.isOperationalPermit?"operational-permit/setup/":"businessLicenses/setup/")+n;this.http.get(r,function(n){n.Success?i.$routeParams.id!=="0"?t(n.Result):i.energovBusinessService.getSecondaryData(i.isOperationalPermit,function(i){n.Result.BusinessSecondaryData=i;t(n.Result)}):t(null)},!1)},n}();n.EnerGovBusinessLicenseService=t})(t=n.Services||(n.Services={}))})(t=n.License||(n.License={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){var t=this,i;this.http=n;this.businessTypeCards=[];this.businessCategories=[];this.getBusinessCategoriesInProgress=!1;this.returnFromAddBusinessType=!1;this.removeBusinessType=function(n){var i=t.businessTypeCards.indexOf(n);i>=0&&t.businessTypeCards.splice(i,1)};i=this}return n.prototype.addBusinessType=function(n){this.businessTypeCards.push(n)},n}();n.EnerGovBusinessTypeCardsService=t})(t=n.Services||(n.Services={}))})(t=n.License||(n.License={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(n){this.http=n;this.rootUrl="/energov/businesstypes/search"}return n.prototype.searchByCriteria=function(n,t){var i=this;i.http.post(i.rootUrl,n,function(n){t(n)},!0)},n}();n.EnergovBusinessTypeSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Contact||(n.Contact={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(n,t,i){this.http=n;this.entityTabsService=t;this.$routeParams=i;this.rootUrl="/energov/businesstypes"}return n.prototype.searchByCriteria=function(n,t){var i=this;i.http.post(i.rootUrl,n,function(n){n.Success||(n.StatusCode===app.Common.Services.HttpStatusCode.NoContent||n.StatusCode===app.Common.Services.HttpStatusCode.Forbidden?i.entityTabsService.showBusinessTypesTab=!1:n.StatusCode===app.Common.Services.HttpStatusCode.PreconditionFailed&&(i.entityTabsService.showBusinessTypesTab=!0),i.$routeParams.tab&&i.$routeParams.tab==app.Constants.TabConstants.Businesstypes?i.entityTabsService.setAdditionalEntityTabsVisibility(i.$routeParams.tab,i.entityTabsService.showBusinessTypesTab):i.entityTabsService.setFirstTabOnHidingOtherTabs());t(n)},!0)},n}();n.EnergovBusinessTypesService=t})(t=n.Services||(n.Services={}))})(t=n.Contact||(n.Contact={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/licenses/";this.tabControlId=0}return n.prototype.getProfessionalLicenseStatus=function(n){var t;t=this.rootUrl+"professional/status";this.http.get(t,function(t){t.Success?n(t.Result):n(null)},!1)},n.prototype.getBusinessLicenseById=function(n,t){var i;i=this.rootUrl+"business/"+n;this.http.get(i,function(n){t(n.Result)},!1)},n.prototype.getProfessionalLicenseById=function(n,t){var i;i=this.rootUrl+"professional/"+n;this.http.get(i,function(n){t(n.Result)},!1)},n.prototype.getBusinessLicenseStatus=function(n){var t;t=this.rootUrl+"business/licensestatus";this.http.get(t,function(t){t.Success?n(t.Result):n(null)},!1)},n.prototype.getBusinessLicenseBusinessStatus=function(n){var t;t=this.rootUrl+"business/businessstatus";this.http.get(t,function(t){t.Success?n(t.Result):n(null)},!1)},n.prototype.getBusinessLicenseBusinessTypes=function(n){var t;t=this.rootUrl+"business/businessTypes";this.http.get(t,function(t){t.Success?n(t.Result):n(null)},!1)},n.prototype.getBusinessLicenseCompanyTypes=function(n){var t;t=this.rootUrl+"business/companyTypes";this.http.get(t,function(t){t.Success?n(t.Result):n(null)},!1)},n.prototype.getOperationalPermitById=function(n,t){var i=this.rootUrl+"operational-permit/"+n;this.http.get(i,function(n){t(n.Result)},!1)},n}();n.EnerGovLicenseService=t})(t=n.Services||(n.Services={}))})(t=n.License||(n.License={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.estimatedFees=[];this.rootUrl="/energov/licenses/";this.showWorkClass=!1;this.showMoreInfoStep=!1;var t=this;t.setDefaultStates()}return n.prototype.setDefaultStates=function(){this.model={ProfessionalLicenseId:"",GlobalEntityId:"",LicenseHolderType:0,LicenseNumber:"",Description:"",LicenseTypeId:"",LicenseClassId:"",Attachments:[],Addresses:[],Parcels:[],Contacts:[],CustomFields:[],CustomFieldLayoutID:"",CustomLayout:null,CustomFieldsLayout:null,IsAppliedOnline:!0,IsRequiredDescription:!1,GlobalEntityName:"",BusinessPhone:"",DistrictId:"",AppliedDate:null,IssuedBy:"",LicenseYearString:"",LicenseYear:0,LicenseStatusId:"",IsNew:!0,IsDeleted:!1,ClientId:"",ComputedFees:[],FeeTemplateId:"",EntityId:null,Holds:[]};this.secondaryData=null;this.selectedType=null;this.selectedWorkClass=null;this.selectedTypeItems=[];this.showMoreInfoStep=!1},n.prototype.totalEstimatedFee=function(){var n=0;return angular.forEach(this.estimatedFees,function(t){n=n+t.ComputedAmount}),n},n.prototype.getProfessionalLicenseEstimateFees=function(n,t){var i=this;this.estimatedFees=[];this.http.post(this.rootUrl+"professionalLicenses/estimatedfees",n,function(n){n.Success&&(i.estimatedFees=n.Result,t(n.Result))})},n.prototype.saveProfessionalLicense=function(n,t){this.http.post(this.rootUrl+"professionalLicenses/save",n,function(n){t(n)})},n}();n.EnerGovProfessionalLicenseApplyService=t})(t=n.Services||(n.Services={}))})(t=n.License||(n.License={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r){this.http=n;this.$q=t;this.$http=i;this.globalsService=r;this.contactDataUrl="/energov/search/searchcontactcards";this.estimatedFees=[];this.rootUrl="/energov/licenses/";this.contactCardInfoResult=null;this.showMoreInfoStep=!1;this.showWorkClass=!1;var u=this;u.setDefaultStates()}return n.prototype.setDefaultStates=function(){this.model={LicenseCAPApplicationTypeId:0,ProfessionalLicenseId:"",LicenseParentId:"",LicenseParentNumber:"",GlobalEntityId:"",GlobalEntityName:"",BusinessPhone:"",LicenseNumber:"",Description:"",LicenseTypeId:"",LicenseTypeName:"",LicenseClassId:"",LicenseClassName:"",LicenseStatusId:"",LicenseStatusName:"",IssuedDate:null,ApplicationDate:null,LastRenewalDate:null,ExpirationDate:null,DistrictId:"",IssuedBy:"",LicenseYear:0,AccountBalance:0,LicenseFee:0,GlobalEntityAccountId:"",AccountNumber:"",LicenseWFTemplateId:"",LicenseWFTemplateRenewalId:"",RowVersion:0,LicensePrefix:"",LastChangedOn:null,LastChangedBy:"",LastChangedByName:"",IsMissingRenewFeeSetup:!1,IsAppliedOnline:!1,LastUpdatedByText:"",IsAlreadyCalculated:!1,CustomFields:[],Attachments:[],Addresses:[],RequiredFields:[],Parcels:[],Contacts:[],ExistingAccountNumber:!1,UseIssueDateAsFeeDate:!1,EntityNumber:"",BillingGlobalEntityId:"",FeeDate:null,CPIVestedMapDate:null,PaidInFull:!1,CanPayNow:!1,SecureUser:"",IsNew:!1,IsDeleted:!1,ClientId:"",CustomFieldLayoutID:"",CustomLayout:null,FeeTemplateId:"",Holds:[]};this.secondaryData=null;this.selectedType=null;this.selectedWorkClass=null;this.selectedTypeItems=[];this.showMoreInfoStep=!1},n.prototype.totalEstimatedFee=function(){var n=0;return angular.forEach(this.estimatedFees,function(t){n=n+t.ComputedAmount}),n},n.prototype.getProfessionalLicenseRenewalsEstimateFees=function(n,t){var i=this;this.estimatedFees=[];this.http.post(this.rootUrl+"professionalLicenseRenewals/estimatedfees",n,function(n){n.Success&&(i.estimatedFees=n.Result,t(n.Result))})},n.prototype.getProfessionalLicenseRenewalById=function(n,t){var i;i=this.rootUrl+"professionallicenserenewals/"+n;this.http.get(i,function(n){t(n.Result)},!1)},n.prototype.renewProfessionalLicense=function(n,t){this.http.post(this.rootUrl+"professionalLicenses/renew",n,function(n){t(n)})},n}();n.EnerGovProfessionalLicenseRenewService=t})(t=n.Services||(n.Services={}))})(t=n.License||(n.License={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/licenses/"}return n.prototype.getSecondaryData=function(n,t){var i;i=this.rootUrl+"professionalLicenses/setup/"+n;this.http.get(i,function(n){n.Success?t(n.Result):t(null)},!1)},n}();n.EnerGovProfessionalLicenseService=t})(t=n.Services||(n.Services={}))})(t=n.License||(n.License={}))}(EnerGov||(EnerGov={}));__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){"use strict";var f=app.Common.Helpers.VersionSupport,i=n.Common.CaseTypeUseEnums.BusinessLicenseTypeModule,r,u;(function(n){n[n.Active=1]="Active";n[n.Closed=2]="Closed";n[n.Hold=3]="Hold";n[n.Other=4]="Other"})(r=t.BusinessLicenseExtSystemStatus||(t.BusinessLicenseExtSystemStatus={}));u=function(t){function u(n,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d,g,nt,tt,it,rt,ut,ft,et,ot,st,ht,ct){var lt=t.call(this,n,i,r,u,f,e,o,c,a,v,p,h,s,y,w,b,d,l,nt,null,g,rt,ut,ft,et,ot,ht)||this,vt,yt,wt,at,bt;if(lt.$routeParams=n,lt.$location=i,lt.globalService=r,lt.menuService=u,lt.settingsService=f,lt.enerGovContactCardsService=e,lt.enerGovAddressCardsService=o,lt.enerGovApplyModuleService=s,lt.enerGovBusinessLicenseService=h,lt.enerGovAttachmentCardsService=c,lt.locationService=l,lt.enerGovCustomFieldsService=a,lt.customFieldsService=v,lt.enerGovSubrecordApplyService=y,lt.draftService=p,lt.userService=w,lt.$q=b,lt.$filter=k,lt.stepperService=d,lt.enerGovBusinessTypeCardsService=g,lt.eReviewsService=nt,lt.energovBusinessService=tt,lt.utilities=it,lt.caseTypeInstructionService=rt,lt.tylerSignaturePadService=ut,lt.enerGovTemplateService=ft,lt.entitySignatureMetaDataService=et,lt.$timeout=ot,lt.mapApplySerivce=st,lt.attachmentCommonCardService=ht,lt.$sanitize=ct,lt.businessSecondaryDataRequired=!1,lt.copyBusinessData=null,lt.selectedCompanyTypeName=null,lt.didSetupStep=!1,lt.businessLicense=app.Common.SelfServiceModules.BusinessLicense,lt.operationalPermit=app.Common.SelfServiceModules.OperationalPermit,lt.removeBusinessType=function(n){var t=lt,r=t.enerGovApplyModuleService.model.BusinessTypes.indexOf(n),i,u;r>=0&&(i=angular.copy(t.enerGovApplyModuleService.model.BusinessTypes),i.splice(r,1),t.enerGovApplyModuleService.model.BusinessTypes=angular.copy(i),lt.businessTypeEstimatedReceiptChanged());u=t.enerGovApplyModuleService.model.BusinessTypes.filter(function(n){return n.Main===!0});u.length===0&&t.enerGovApplyModuleService.model.BusinessTypes.length>0&&(t.enerGovApplyModuleService.model.BusinessTypes[0].Main=!0)},lt.draftType=lt.isOperationalPermitApply?app.Constants.DraftType.OperationalPermit:app.Constants.DraftType.License,lt.isBusLicRenewal=!1,lt.isBusLicApply=!0,lt.stepperService.module=lt.isOperationalPermitApply?lt.operationalPermit:lt.businessLicense,lt.enerGovApplyModuleService.model.AppliedDate=new Date(lt.$filter("date")(Date.now(),app.Constants.GlobalConstants.DateFormatForSearch)),lt.enerGovCustomFieldsService.businessCustomFileds=[],n.id&&n.id==="0"&&lt.enerGovApplyModuleService.getEnerGovUseFreeFormTextCompanyNameSetting(function(){}).then(function(){lt.enerGovApplyModuleService.isfreeformtextcompanyname||lt.userService.getUser(function(n){lt.enerGovApplyModuleService.didGetUserInfoForApply=!0;lt.enerGovApplyModuleService.user=n;lt.enerGovApplyModuleService.model.CompanyName||(lt.enerGovApplyModuleService.model.CompanyName=n.Company);lt.enerGovApplyModuleService.model.GlobalEntityId=n.OtherData})}),n.id==="0"||lt.enerGovApplyModuleService.didGetBusinessInfoForApply||lt.getBusinessInfoForLicenseApply(n.id),lt.enerGovAddressCardsService.locationAddressType==null&&lt.userService.isUserLoggedIn)lt.enerGovAddressCardsService.getSecondaryDataAndSetAddressType();else if(lt.enerGovAddressCardsService.locationAddressType){if(st.mapLocations.length>0&&o.buildLocationCardFromMap(st.mapLocations),st.mapSPCollections.length>0)for(vt=0,yt=st.mapSPCollections;vt<yt.length;vt++)wt=yt[vt],lt.enerGovAddressCardsService.addSpatialCollection(wt);st.resetMapApplyData()}lt.businessSecondaryDataRequired=!0;at=lt;angular.forEach(at.enerGovBusinessTypeCardsService.businessTypeCards,function(n){var t={CodeNumber:n.CodeNumber,Name:n.Name,BusinessCategoryName:n.BusinessCategoryName,Main:n.Main,Selected:null,BusinessTypeID:n.BusinessTypeID,IsNew:!0,IsDeleted:!1,ClientId:"",ParentBusinessTypeID:"",ParentID:"",EstimatedReceipts:null,AllowedDeductionAmount:0,OriginalEstimatedReceipts:0,ReportedReceipts:0,ActualReceipts:0,RenewFromLicenseExtBusinessTypeID:""},i=s.model.BusinessTypes.filter(function(t){return t.BusinessTypeID===n.BusinessTypeID})[0];i||at.enerGovApplyModuleService.model.BusinessTypes.push(t)});bt=at.enerGovApplyModuleService.model.BusinessTypes.filter(function(n){return n.Main===!0});bt.length===0&&at.enerGovApplyModuleService.model.BusinessTypes.length>0&&(at.enerGovApplyModuleService.model.BusinessTypes[0].Main=!0);var kt=lt.getTypeId(),dt=lt.getWorkClassId(),pt=lt.enerGovApplyModuleService.selectedTypeItems.filter(function(n){return n.CaseTypeInfo.PackageCaseTypeId===kt&&n.CaseTypeInfo.PackageCaseClassId===dt});return pt!==null&&pt.length>0&&(lt.enerGovApplyModuleService.model.IsRequiredDescription=pt[0].CaseTypeInfo.DescriptionRequired),lt}return __extends(u,t),Object.defineProperty(u.prototype,"fileProgressListCount",{get:function(){return this.enerGovAttachmentCardsService.fileProgressList?this.enerGovAttachmentCardsService.fileProgressList.length:0},enumerable:!0,configurable:!0}),u.prototype.saveModule=function(){var r=this,t=this;t.isOperationalPermitApply&&(t.enerGovApplyModuleService.model.BusinessLicenseTypeModuleId=i.OperationalPermit);t.enerGovApplyModuleService.updateGlobalEntityName(t.$routeParams.id&&t.$routeParams.id==="0"&&!t.enerGovApplyModuleService.isfreeformtextcompanyname,function(){t.enerGovApplyModuleService.model.Contacts=t.enerGovContactCardsService.saveContacts();t.enerGovApplyModuleService.model.Addresses=[];t.enerGovApplyModuleService.model.Addresses=t.enerGovAddressCardsService.addressCards.filter(function(n){return!n.IsParcel});t.enerGovApplyModuleService.model.Parcels=[];var i=t.enerGovAddressCardsService.addressCards.filter(function(n){return n.IsParcel});angular.forEach(i,function(n){var i={ParentParcelID:"",ParcelID:"",ParentID:"",ParcelNumber:n.ParcelNumber,Section:n.Section,Range:n.Range,Township:n.Township,Main:n.Main,IsNew:!0,IsDeleted:!1,ClientId:""};t.enerGovApplyModuleService.model.Parcels.push(i)});angular.forEach(t.enerGovApplyModuleService.model.BusinessTypes,function(n){n.EstimatedReceipts||(n.EstimatedReceipts=0)});t.enerGovApplyModuleService.model.LicenseTypeId=t.getTypeId();t.enerGovApplyModuleService.model.LicenseClassId=t.getWorkClassId();t.enerGovApplyModuleService.model.Holds=[];(t.enerGovAddressCardsService.copyParcelHolds||t.enerGovContactCardsService.copyContactHolds)&&(t.enerGovAddressCardsService.copyParcelHolds.length>0&&angular.forEach(t.enerGovAddressCardsService.copyParcelHolds,function(n){t.enerGovApplyModuleService.model.Holds.push(n)}),t.enerGovContactCardsService.copyContactHolds.length>0&&angular.forEach(t.enerGovContactCardsService.copyContactHolds,function(n){t.enerGovApplyModuleService.model.Holds.push(n)}));t.enerGovApplyModuleService.model.CustomFieldsLayout=t.customFieldsService.customLayout;t.enerGovApplyModuleService.model.BusinessCustomFieldsLayout=t.customFieldsService.additionalCustomLayout;t.enerGovAttachmentCardsService.showProgressBarDialog();t.enerGovAttachmentCardsService.uploadFileAttachments(function(i){t.enerGovApplyModuleService.model.Attachments=i;var u=t.enerGovApplyModuleService.model.Location;u&&u.ExtLocationID&&(t.enerGovApplyModuleService.model.Location=u.ExtLocationID);t.enerGovApplyModuleService.model.CompanyName=r.$sanitize(t.enerGovApplyModuleService.model.CompanyName);t.enerGovApplyModuleService.saveBusinessLicense(t.enerGovApplyModuleService.model,function(i){i.Success?(t.utilities.showPleaseWait(),t.saveSignatureToEnergov(n.Common.CaseTypeUseEnums.AgreementType.BusinessLicense,i,function(){t.utilities.hidePleaseWait();var r=t.isOperationalPermitApply?n.Common.CaseTypeUseEnums.FilterModule.OperationalPermit:n.Common.CaseTypeUseEnums.FilterModule.BusinessLicense;t.afterSaveRedirection(r,i.Result)})):t.enerGovAttachmentCardsService.closeProgressBarDialog()})})})},u.prototype.selectType=function(){t.prototype.selectType.call(this);this.setStepperSteps()},u.prototype.showMoreInfo=function(n){var t=this;return n.CustomFieldsLayoutId||n.OnlineCustomFieldLayoutID?!0:t.enerGovApplyModuleService.selectedCompanyTypeInfo&&(t.enerGovApplyModuleService.selectedCompanyTypeInfo.CustomFieldLayoutID||t.enerGovApplyModuleService.selectedCompanyTypeInfo.OnlineCustomFieldLayoutID)?!0:!1},u.prototype.getBusinessInfoForLicenseApply=function(n){var i=this,t=this;t.copyBusinessData=t.enerGovSubrecordApplyService.subrecordApplyInfo;this.enerGovApplyModuleService.didGetBusinessInfoForApply=!0;this.enerGovApplyModuleService.businessGlobalEntityExtensionInfo=null;this.enerGovApplyModuleService.getBusinessGlobalEntityExtensionById(n,function(n){if(t.enerGovApplyModuleService.businessGlobalEntityExtensionInfo=n,i.draftId==0&&(t.enerGovCustomFieldsService.businessCustomFileds=n.CustomFields,angular.forEach(n.BusinessTypes,function(n){n.IsNew=!0;t.enerGovApplyModuleService.model.BusinessTypes.push(n)})),n.GlobalEntityExtensionID&&n.SystemStatusId!=r.Closed){t.enerGovApplyModuleService.model.GlobalEntityExtensionId=n.GlobalEntityExtensionID;t.copyBusinessData={Addresses:n.Addresses,Contacts:n.Contacts,CustomFields:n.CustomFields,Parcels:n.Parcels,Description:n.Description,Holds:n.Holds,Value:null,IsSubPermitFromPermit:!1,IsSubPermitFromPlan:!1,IsSubPlanFromPermit:!1,IsSubPlanFromPlan:!1,SquareFeet:0,VersionNumber:1,WorkflowActionId:"",WorkflowStatusId:0,LicenseRenewalRequiredFields:null,BusinessTypes:n.BusinessTypes,IsWorkflowActionPersistent:!1,IsWorkflowActionOptional:!1,WorkflowTemplateId:"",WorkflowTemplateActionId:"",WfActionData:null,ParentEntityId:"",Project:null};var u={CaseId:t.$routeParams.id,CaseModule:app.Common.SelfServiceModules.BusinessEntity,ContactTypeIds:[]};t.enerGovSubrecordApplyService.getSubrecordContactsData(u,function(n){i.draftId==0&&(t.enerGovSubrecordApplyService.contactCardInfoResult=n);t.selectType();i.draftId==0&&t.CopyBusinessDataToLicense(t.copyBusinessData)});t.draftService.isDraftResumed=!0}else t.utilities.showMessage(t.utilities.getResourceMessage("InvalidBusinessLicenseDraft")),t.$location.path("/businessLicense/apply/business/"+i.$routeParams.menuId),i.draftId&&t.draftService.deleteDraftById(i.draftId)})},u.prototype.CopyBusinessDataToLicense=function(n){var u=this,t=this,i,r;n===null||t.enerGovAddressCardsService.isBusinessAddressCopied||t.enerGovContactCardsService.isBusinessContactCopied||(i=t.enerGovAddressCardsService.addressCards.filter(function(n){return n.Main&&!n.IsParcel}),angular.forEach(n.Addresses,function(n){n.Main&&i.length>0&&i[0].Main&&(i[0].Main=!1);n.IsParcel=!1;t.enerGovAddressCardsService.addAddress(n,!0)}),t.setupAddressRequired(),t.$q.all([t.getSecondaryDataPromise]).then(function(){var n=t.enerGovContactCardsService.setDefaultContactType(function(){},!0);t.$q.all([n]).then(function(){t.enerGovSubrecordApplyService.contactCardInfoResult!=null&&t.enerGovSubrecordApplyService.contactCardInfoResult.ContactResults!==null&&(t.enerGovContactCardsService.returnToUrl=u.$location.path().toUpperCase(),angular.forEach(t.enerGovSubrecordApplyService.contactCardInfoResult.ContactResults,function(n){t.enerGovContactCardsService.addContact(n,!0)}))})}),r=t.enerGovAddressCardsService.addressCards.filter(function(n){return n.Main&&n.IsParcel}),angular.forEach(n.Parcels,function(n){n.Main&&r.length>0&&r[0].Main&&(r[0].Main=!1);var i=t.enerGovAddressCardsService.createBlankAddress();i.ParcelNumber=n.ParcelNumber;i.Range=n.Range;i.Section=n.Section;i.Township=n.Township;i.IsParcel=!0;i.Main=n.Main;t.enerGovAddressCardsService.addAddress(i)}),t.setupAddressRequired(),t.enerGovAddressCardsService.isBusinessAddressCopied=!0,t.enerGovContactCardsService.isBusinessContactCopied=!0,t.enerGovAddressCardsService.getHoldsForParcel(null).then(function(){t.enerGovAddressCardsService.getGeoRuleResults()}),angular.forEach(n.Holds,function(n){n.IsNew=!0;t.enerGovApplyModuleService.model.Holds.push(n)}))},u.prototype.getSelectedBusinessSecondaryData=function(){var n=this,t;if(n.$routeParams.id==0){if(n.enerGovApplyModuleService.secondaryData&&n.enerGovApplyModuleService.secondaryData.BusinessSecondaryData)return t=n.enerGovApplyModuleService.secondaryData.BusinessSecondaryData.CompanyTypes.filter(function(t){return t.ExtCompanyTypeID===n.$routeParams.companyId}),t.length>0&&(n.enerGovApplyModuleService.selectedCompanyTypeInfo=t[0],n.selectedCompanyTypeName=n.enerGovApplyModuleService.selectedCompanyTypeInfo.Name,n.enerGovApplyModuleService.model.CompanyType=n.enerGovApplyModuleService.selectedCompanyTypeInfo.ExtCompanyTypeID),n.enerGovBusinessTypeCardsService.businessCategories=n.enerGovApplyModuleService.secondaryData.BusinessSecondaryData.BusinessCategories,t[0]}else(n.enerGovBusinessTypeCardsService.businessCategories===null||n.enerGovBusinessTypeCardsService.businessCategories.length===0)&&n.enerGovBusinessTypeCardsService.getBusinessCategoriesInProgress===!1&&(n.enerGovBusinessTypeCardsService.getBusinessCategoriesInProgress=!0,n.energovBusinessService.getSecondaryData(this.isOperationalPermitApply,function(t){n.enerGovBusinessTypeCardsService.getBusinessCategoriesInProgress=!1;n.enerGovBusinessTypeCardsService.businessCategories=t.BusinessCategories}));return null},u.prototype.getSelectedWorkClassSecondaryData=function(){var r=this,i,u,e,t,f;if(this.enerGovApplyModuleService==null||!this.enerGovApplyModuleService.secondaryData||this.enerGovApplyModuleService.selectedType==null)return null;var n=null,o=this.getTypeId(),s=this.getWorkClassId();if(o==null||s==null)return null;for(i=0;i<this.enerGovApplyModuleService.secondaryData.LicenseTypes.length;i++)if(this.enerGovApplyModuleService.secondaryData.LicenseTypes[i].BusinessLicenseTypeID===o){for(this.enerGovApplyModuleService.selectedLicenseTypeInfo=this.enerGovApplyModuleService.secondaryData.LicenseTypes[i],u=0;u<this.enerGovApplyModuleService.secondaryData.LicenseTypes[i].LicenseTypeClasses.length;u++)if(this.enerGovApplyModuleService.secondaryData.LicenseTypes[i].LicenseTypeClasses[u].LicenseClassId===s){for(e=0;e<this.enerGovApplyModuleService.secondaryData.LicenseTypes[i].LicenseTypeClasses[u].ContactTypeList.length;e++){t=this.enerGovApplyModuleService.secondaryData.LicenseTypes[i].LicenseTypeClasses[u].ContactTypeList[e];this.contactType={ContactTypeId:t.LandManagementContactTypeID,Name:t.Name,IsRequired:t.IsRequired,GroupId:t.ContactTypeGroup,LandManagementContactSystemTypeID:t.LandManagementContactSystemTypeID,isFilled:!1,IsDefaultOnlineContactType:t.IsDefaultOnlineContactType,IsValidateLic:t.IsValidateLic,IsValidateBLLicense:t.IsValidateBLLicense,IsValidateILLicense:t.IsValidateILLicense,RequiredValidLic:t.RequiredValidLic};break}n=this.enerGovApplyModuleService.secondaryData.LicenseTypes[i].LicenseTypeClasses[u];break}break}return this.businessSecondaryDataRequired?(r.$routeParams.companyId&&r.$routeParams.companyId!==""&&r.enerGovApplyModuleService.secondaryData.BusinessSecondaryData&&(f=r.enerGovApplyModuleService.secondaryData.BusinessSecondaryData.CompanyTypes.filter(function(n){return n.ExtCompanyTypeID===r.$routeParams.companyId})[0],r.enerGovApplyModuleService.showMoreInfoStep=r.showMoreInfo(n),this.updateGroupNumber(f,n),this.removeSameGroup(f,n),angular.forEach(f.ContactTypeList,function(t){var i=n.ContactTypeList.filter(function(n){return n.ContactTypeID===t.ContactTypeID})[0],r;i&&t.ContactTypeGroup===0&&i.ContactTypeGroup===0?(t.IsRequired===!0&&(i.IsRequired=t.IsRequired),t.IsDefaultOnlineContactType===!0&&(i.IsDefaultOnlineContactType=t.IsDefaultOnlineContactType)):(r={ContactTypeExtID:t.ContactTypeExtID,ContactTypeGroup:t.ContactTypeGroup,ContactTypeID:t.ContactTypeID,Description:t.Description,IsDefaultOnlineContactType:t.IsDefaultOnlineContactType,IsRequired:t.IsRequired,LandManagementContactTypeID:t.ContactTypeID,Name:t.Name,ObjClassID:t.ObjClassID,ObjModuleID:t.ObjModuleID,ObjTypeID:t.ObjTypeID,RequiredValidLic:t.RequiredValidLic},n.ContactTypeList.push(r))}),f.CAPAddressRequired&&!n.IsCAPAddressRequired&&(n.IsCAPAddressRequired=f.CAPAddressRequired)),n):(this.enerGovApplyModuleService.showMoreInfoStep=this.showMoreInfo(n),n)},u.prototype.calculateEstimateFees=function(){var n,u,t,r;f(this.globalService.enerGovAPIVersion,"2016.3.0.151")==!0&&(n=this,n.enerGovApplyModuleService.model.LicenseTypeId=n.getTypeId(),n.enerGovApplyModuleService.model.LicenseClassId=n.getWorkClassId(),u=n.getSelectedWorkClassSecondaryData(),n.enerGovApplyModuleService.model.FeeTemplateId=u.FeeTemplateId,n.enerGovApplyModuleService.model.CustomFieldsLayout=n.customFieldsService.customLayout,t=angular.copy(n.enerGovApplyModuleService.model),r=t.Location,r&&r.ExtLocationID&&(t.Location=r.ExtLocationID),n.isOperationalPermitApply&&(t.BusinessLicenseTypeModuleId=i.OperationalPermit),n.enerGovApplyModuleService.getBusinessLicenseEstimateFees(t,function(){}))},u.prototype.updateGroupNumber=function(n,t){var i=Math.max.apply(Math,n.ContactTypeList.map(function(n){return n.ContactTypeGroup})),r=Math.max.apply(Math,t.ContactTypeList.map(function(n){return n.ContactTypeGroup}));i!==0&&r!==0&&(i===r?_.each(n.ContactTypeList.filter(function(n){return n.ContactTypeGroup>0}),function(n){n.ContactTypeGroup=n.ContactTypeGroup+i}):i>r?_.each(t.ContactTypeList.filter(function(n){return n.ContactTypeGroup>0}),function(n){n.ContactTypeGroup=n.ContactTypeGroup+i}):_.each(n.ContactTypeList.filter(function(n){return n.ContactTypeGroup>0}),function(n){n.ContactTypeGroup=n.ContactTypeGroup+r}))},u.prototype.removeSameGroup=function(n,t){var r=[],i;_.each(_.groupBy(n.ContactTypeList,function(n){return n.ContactTypeGroup}),function(n){var t="",i=0;_.each(_.sortBy(n,function(n){return n.ContactTypeID}),function(n){t=t+n.ContactTypeID;i=n.ContactTypeGroup});r.push({val:t,grpId:i})});i=[];_.each(_.groupBy(t.ContactTypeList,function(n){return n.ContactTypeGroup}),function(n){var t="",r=0;_.each(_.sortBy(n,function(n){return n.ContactTypeID}),function(n){t=t+n.ContactTypeID;r=n.ContactTypeGroup});i.push({val:t,grpId:r})});angular.forEach(r,function(t){i.filter(function(n){return n.val===t.val&&n.grpId!==0}).length>0&&(n.ContactTypeList=n.ContactTypeList.filter(function(n){return n.ContactTypeGroup!==t.grpId}))})},u.prototype.setStepperSteps=function(){var i,r,n,t;if(this.stepperService.module=this.isOperationalPermitApply?this.operationalPermit:this.businessLicense,i=this,r=i.getSelectedWorkClassSecondaryData(),r!==null)this.enerGovApplyModuleService.showMoreInfoStep=this.showMoreInfo(r);else return;n=this.globalService.baseUrl+this.globalService.tenantUrl+"/energovapply/page?v="+this.globalService.version+"&id=";this.steps=[];t=0;i.disableLocationsInTemplates||(!this.selectedType.CaseTypeInfo.HideLocationStep||this.selectedType.CaseTypeInfo.HideLocationStep&&this.enerGovAddressCardsService.addressRequired)&&this.steps.push({Label:"Locations",Order:t++,ViewUrl:n+"location",ShowBackButton:!1,ShowNextButton:!0});this.steps.push({Label:"Type",Order:t++,ViewUrl:n+"businesslicenseapplytype",ShowBackButton:this.enerGovAddressCardsService.addressRequired||this.selectedType&&!this.selectedType.CaseTypeInfo.HideLocationStep?!this.disableLocationsInTemplates:!1,ShowNextButton:!0});this.steps.push({Label:"Contacts",Order:t++,ViewUrl:n+"contacts",ShowBackButton:!0,ShowNextButton:!0});this.enerGovApplyModuleService.showMoreInfoStep&&this.steps.push({Label:"More Info",Order:t++,ViewUrl:n+"customfield",ShowBackButton:!0,ShowNextButton:!0});this.steps.push({Label:"Attachments",Order:t++,ViewUrl:n+"attachmentfiles",ShowBackButton:!0,ShowNextButton:!0});this.selectedType.CaseTypeInfo.SignatureRequired&&this.isFreshApplyOrUseTemplate()?(this.steps.push({Label:"Signature",Order:t++,ViewUrl:n+"signature",ShowBackButton:!0,ShowNextButton:!0}),this.steps.push({Label:this.menuActionType==this.menuActionTypeValues.UpdateTemplate?"Review and Save":"Review and Submit",Order:t++,ViewUrl:n+"summary",ShowBackButton:!0,ShowNextButton:!1})):this.steps.push({Label:this.menuActionType==this.menuActionTypeValues.UpdateTemplate?"Review and Save":"Review and Submit",Order:t++,ViewUrl:n+"summary",ShowBackButton:!0,ShowNextButton:!1});this.stepperService.stepsSetup("BusinessLicense",this.steps,this.enerGovApplyModuleService.selectedType)},u.prototype.populateCustomFieldDataForBusiness=function(n){var t=this;angular.forEach(this.enerGovCustomFieldsService.businessCustomFileds,function(i){angular.forEach(n.CustomGroups,function(n){var r=n.CustomFields.filter(function(n){return n.FieldName===i.FieldName})[0],u,f;r&&(r.typeData.elementType==="many"||r.IsTable||i.Value)&&(r.Value=i.Value,r.typeData.elementType==="many"&&(r.Value==null&&(r.Value=i.DefaultValue),angular.forEach(r.CustomPickListItems,function(n){var t=i.PickListItems.filter(function(t){return t.Value===n.Value})[0],r;t&&(r=t.IsMultiSelected,n.IsSelected=r)})),r.typeData.elementType==="select"?(u=i.PickListItems.filter(function(n){return n.CustomFieldPickListItemID===i.Value})[0],u&&(f=r.CustomPickListItems.filter(function(n){return n.Value===u.Value})[0],f.IsSelected=!0,r.Value=f.PackageId)):r.IsTable&&(r.Value==null&&(r.Value=i.DefaultValue),r.CustomFieldTableRows=[],t.customFieldsService.formatDateForExistingRows(r),angular.forEach(r.CustomFieldTableRows,function(n,i){r.CustomFieldTableRows[i].IsValidRow=!0;angular.forEach(r.CustomFieldTableColumnRefItems,function(n,u){r.CustomFieldTableRows[i]["Column"+u].Retire||t.customFieldsService.isColumnValid(r.CustomFieldTableRows[i]["Column"+u],n)||(r.CustomFieldTableRows[i].IsValidRow=!1)})}),r.tableData.rows=r.CustomFieldTableRows))})})},u.prototype.setMainBusinessType=function(n){var t=this.enerGovApplyModuleService.model.BusinessTypes.filter(function(n){return n.Main==!0});t.length==0?n.Main=!0:this.enerGovApplyModuleService.model.BusinessTypes.forEach(function(t){t.Main=t!=n?!1:n.Main})},u.prototype.businessTypeEstimatedReceiptChanged=function(){var n=0;this.enerGovApplyModuleService.model.BusinessTypes.forEach(function(t){t.EstimatedReceipts&&(n=n+t.EstimatedReceipts)});n=Number(n.toFixed(4));this.enerGovApplyModuleService.model.EstimatedReceipts=n},u.prototype.getTypeIdFromPackageData=function(n){var t=JSON.parse(n);return t.LicenseTypeID?t.LicenseTypeID:null},u.prototype.getWorkClassIdFromPackageData=function(n){var t=JSON.parse(n);return t.LicenseClassID?t.LicenseClassID:null},u.prototype.addNewBusinessType=function(){var n=this.$location.path().toUpperCase(),t=n.indexOf("BUSINESSLICENSE")>-1,i=n.indexOf("OPERATIONALPERMIT")>-1;(t||i)&&(this.enerGovBusinessTypeCardsService.returnToUrl=this.$location.url(),this.$location.url(t?"/businessLicense/apply/businessType":"/operationalPermit/apply/businessType"))},u.prototype.updateDraftPartialFromModel=function(n){n.Description=this.enerGovApplyModuleService.model.Description;n.CompanyType=this.enerGovApplyModuleService.model.CompanyType;n.CompanyName=this.enerGovApplyModuleService.model.CompanyName;n.BusinessDescription=this.enerGovApplyModuleService.model.BusinessDescription;n.DBAName=this.enerGovApplyModuleService.model.DBAName;n.TIN=this.enerGovApplyModuleService.model.TIN;n.TaxID=this.enerGovApplyModuleService.model.TaxID;var t=this.enerGovApplyModuleService.model.Location;return t&&t.ExtLocationID&&(n.Location=t.ExtLocationID),n.BusinessTypes=this.enerGovApplyModuleService.model.BusinessTypes,n.BusinessCustomFieldsLayoutID=this.enerGovApplyModuleService.model.BusinessCustomFieldLayoutID,n.GlobalEntityExtensionId=this.enerGovApplyModuleService.model.GlobalEntityExtensionId,n.EstimatedReceipts=this.enerGovApplyModuleService.model.EstimatedReceipts,n},u.prototype.updateModelPartialFromFraft=function(n){this.enerGovApplyModuleService.model.Description=n.Description;this.enerGovApplyModuleService.model.CompanyType=n.CompanyType;this.enerGovApplyModuleService.model.CompanyName=n.CompanyName;this.enerGovApplyModuleService.model.BusinessDescription=n.BusinessDescription;this.enerGovApplyModuleService.model.DBAName=n.DBAName;this.enerGovApplyModuleService.model.TaxID=n.TaxID;this.enerGovApplyModuleService.model.TIN=n.TIN;this.enerGovApplyModuleService.model.Location=n.Location;this.enerGovApplyModuleService.model.BusinessTypes=n.BusinessTypes;this.enerGovApplyModuleService.model.BusinessCustomFieldLayoutID=n.BusinessCustomFieldsLayoutID;this.enerGovApplyModuleService.model.GlobalEntityExtensionId=n.GlobalEntityExtensionId;this.enerGovApplyModuleService.model.EstimatedReceipts=n.EstimatedReceipts},u.prototype.updateBusinessLocationFromDraft=function(n){if(n.Location!==undefined&&n.Location!==null){var t=this.enerGovApplyModuleService.secondaryData.BusinessSecondaryData.BusinessLocations.filter(function(t){return t.ExtLocationID==n.Location})[0];this.enerGovApplyModuleService.model.Location=t}},u}(n.Common.Controllers.Apply.EnerGovApplyController);t.EnerGovBusinessLicenseApplyController=u})(t=n.License||(n.License={}))}(EnerGov||(EnerGov={}));__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){"use strict";var r=app.Common.Helpers.VersionSupport,i=n.Common.CaseTypeUseEnums.BusinessLicenseTypeModule,u=function(n){function t(t,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d,g,nt,tt,it,rt,ut,ft,et){it===void 0&&(it=null);var ot=n.call(this,t,r,u,f,e,o,s,l,a,v,p,c,h,y,w,b,d,null,nt,null,g,tt,it,rt,null,ut,ft)||this;return ot.$routeParams=t,ot.$location=r,ot.globalService=u,ot.menuService=f,ot.settingsService=e,ot.enerGovContactCardsService=o,ot.enerGovAddressCardsService=s,ot.enerGovApplyModuleService=h,ot.enerGovBusinessLicenseService=c,ot.enerGovAttachmentCardsService=l,ot.enerGovCustomFieldsService=a,ot.customFieldsService=v,ot.enerGovSubrecordApplyService=y,ot.draftService=p,ot.userService=w,ot.$q=b,ot.$filter=k,ot.stepperService=d,ot.enerGovBusinessTypeCardsService=g,ot.eReviewsService=nt,ot.caseTypeInstructionService=tt,ot.tylerSignaturePadService=it,ot.enerGovTemplateService=rt,ot.$timeout=ut,ot.attachmentCommonCardService=ft,ot.enerGovLicenseService=et,ot.businessLicense=app.Common.SelfServiceModules.BusinessLicense,ot.operationalPermit=app.Common.SelfServiceModules.OperationalPermit,ot.isOperationalPermitApply?(ot.stepperService.module=ot.operationalPermit,ot.enerGovApplyModuleService.model.BusinessLicenseTypeModuleId=i.OperationalPermit):ot.stepperService.module=ot.businessLicense,ot}return __extends(t,n),t.prototype.saveModule=function(){var n=this,t;n.enerGovApplyModuleService.model.BusinessTypes=[];angular.forEach(n.enerGovBusinessTypeCardsService.businessTypeCards,function(t){var i={CodeNumber:t.CodeNumber,Name:t.Name,BusinessCategoryName:t.BusinessCategoryName,Main:t.Main,Selected:null,BusinessTypeID:t.BusinessTypeID,IsNew:!0,IsDeleted:!1,ClientId:"",ParentBusinessTypeID:"",ParentID:"",AllowedDeductionAmount:t.AllowedDeductionAmount,EstimatedReceipts:t.EstimatedReceipts,OriginalEstimatedReceipts:t.OriginalEstimatedReceipts,ReportedReceipts:t.ReportedReceipts,ActualReceipts:t.ActualReceipts,RenewFromLicenseExtBusinessTypeID:t.RenewFromLicenseExtBusinessTypeID};n.enerGovApplyModuleService.model.BusinessTypes.push(i)});this.enerGovApplyModuleService.selectedLicenseTypeInfo.DefaultWebRenewStatus!==null&&(n.enerGovApplyModuleService.model.LicenseStatusId=this.enerGovApplyModuleService.selectedLicenseTypeInfo.DefaultWebRenewStatus);n.enerGovApplyModuleService.model.Contacts=n.enerGovContactCardsService.saveContacts();n.enerGovApplyModuleService.model.Addresses=[];n.enerGovApplyModuleService.model.Addresses=$.grep(n.enerGovAddressCardsService.addressCards,function(n){return!n.IsParcel});n.enerGovApplyModuleService.model.Parcels=[];t=$.grep(n.enerGovAddressCardsService.addressCards,function(n){return n.IsParcel});angular.forEach(t,function(t){var i={ParentParcelID:"",ParcelID:"",ParentID:"",ParcelNumber:t.ParcelNumber,Section:t.Section,Range:t.Range,Township:t.Township,Main:t.Main,IsNew:!0,IsDeleted:!1,ClientId:""};n.enerGovApplyModuleService.model.Parcels.push(i)});n.enerGovAttachmentCardsService.showProgressBarDialog();n.enerGovAttachmentCardsService.uploadFileAttachments(function(t){n.enerGovApplyModuleService.model.Attachments=t;n.enerGovApplyModuleService.renewBusinessLicense(n.enerGovApplyModuleService.model,function(t){if(t.Success){n.cleanUp();n.enerGovBusinessTypeCardsService.businessTypeCards=[];var i=n.isOperationalPermitApply?"/operationalPermit/":"/businessLicense/";n.$location.path(""+i+t.Result).search({success:!0,isRenewal:!0})}else n.enerGovAttachmentCardsService.closeProgressBarDialog()})})},t.prototype.selectType=function(){n.prototype.selectType.call(this);this.setStepperSteps()},t.prototype.calculateReceiptsAmount=function(){this.enerGovApplyModuleService.model.ReportedReceipts.toString()==""&&(this.enerGovApplyModuleService.model.ReportedReceipts=0);this.enerGovApplyModuleService.model.AllowedDeductionAmount.toString()==""&&(this.enerGovApplyModuleService.model.AllowedDeductionAmount=0);this.enerGovApplyModuleService.model.EstimatedReceipts.toString()==""&&(this.enerGovApplyModuleService.model.EstimatedReceipts=0);this.enerGovApplyModuleService.model.ActualReceipts=this.enerGovApplyModuleService.model.ReportedReceipts-this.enerGovApplyModuleService.model.AllowedDeductionAmount;this.enerGovApplyModuleService.selectedLicenseTypeInfo.UseActualReceiptsAsest&&(this.enerGovApplyModuleService.model.EstimatedReceipts=this.enerGovApplyModuleService.model.ActualReceipts)},t.prototype.calculateCodeLevelReceiptsAmount=function(n){n.ReportedReceipts||(n.ReportedReceipts=0);n.AllowedDeductionAmount||(n.AllowedDeductionAmount=0);n.EstimatedReceipts||(n.EstimatedReceipts=0);n.ActualReceipts=n.ReportedReceipts-n.AllowedDeductionAmount;this.enerGovApplyModuleService.selectedLicenseTypeInfo.UseActualReceiptsAsest&&(n.EstimatedReceipts=n.ActualReceipts)},t.prototype.initializeData=function(){var t=this,n=this,r;n.moduleId=n.isOperationalPermitApply?n.operationalPermit:n.businessLicense;r={LicenseId:n.$routeParams.id,BusinessLicenseTypeModule:n.isOperationalPermitApply?i.OperationalPermit:i.BusinessLicense};n.enerGovApplyModuleService.model.BusinessLicenseId==""&&n.enerGovApplyModuleService.getLicenseRenewalById(r,function(i){var r,u;i!=null?(n.enerGovApplyModuleService.model=i,n.enerGovApplyModuleService.model.ApplicationDate=new Date(n.$filter("date")(Date.now(),app.Constants.GlobalConstants.DateFormatForSearch)),n.enerGovApplyModuleService.model.AppliedDate=new Date(n.$filter("date")(Date.now(),app.Constants.GlobalConstants.DateFormatForSearch)),r=n.getMenuItem(),t.menuItem=r,r.Label=i.LicenseTypeName,n.enerGovApplyModuleService.selectedTypeItems.push(r),n.enerGovApplyModuleService.selectedType=n.enerGovApplyModuleService.selectedTypeItems[0],n.enerGovSubrecordApplyService.subrecordApplyInfo={Addresses:i.Addresses,Contacts:i.Contacts,CustomFields:i.CustomFields,Parcels:i.Parcels,Description:i.Description,Holds:[],Value:null,IsSubPermitFromPermit:!1,IsSubPermitFromPlan:!1,IsSubPlanFromPermit:!1,IsSubPlanFromPlan:!1,SquareFeet:0,VersionNumber:1,WorkflowActionId:"",WorkflowStatusId:0,LicenseRenewalRequiredFields:i.RequiredFields,BusinessTypes:i.BusinessTypes,IsWorkflowActionPersistent:!1,IsWorkflowActionOptional:!1,WorkflowTemplateId:"",WorkflowTemplateActionId:"",WfActionData:null,ParentEntityId:"",Project:null},u={CaseId:n.$routeParams.id,CaseModule:n.moduleId,ContactTypeIds:[]},n.enerGovSubrecordApplyService.getSubrecordContactsData(u,function(i){t.enerGovLicenseService.getBusinessLicenseById(t.$routeParams.id,function(r){n.enerGovCustomFieldsService.getCustomLayoutWithData(r.LayoutId,r.OnlineLayoutId,t.$routeParams.id,n.moduleId,function(){n.enerGovSubrecordApplyService.contactCardInfoResult=i;n.selectType();n.populateRenewalDataWithoutCustomFields();n.enerGovAddressCardsService.addressCards=t.sortAddressCards(n.enerGovAddressCardsService.addressCards);n.enerGovBusinessTypeCardsService.returnFromAddBusinessType||angular.forEach(n.enerGovSubrecordApplyService.subrecordApplyInfo.BusinessTypes,function(t){n.enerGovBusinessTypeCardsService.addBusinessType(t)});t.enerGovContactCardsService.setDefaultContactType(function(){},!1)})})})):t.$location.path("/dashboard")})},t.prototype.sortAddressCards=function(n){var i={},r=[],t;return n.forEach(function(n){n.ParcelNumber?(i[n.ParcelNumber]||(i[n.ParcelNumber]=[]),i[n.ParcelNumber].push(n)):r.push(n)}),t=[],Object.keys(i).forEach(function(n){var r=i[n];r.sort(function(n,t){return n.AddressLine1&&!t.AddressLine1?-1:!n.AddressLine1&&t.AddressLine1?1:0});t.push.apply(t,r)}),t.push.apply(t,r),t},t.prototype.getSelectedWorkClassSecondaryData=function(){var t,i,r,n;if(this.enerGovApplyModuleService==null||!this.enerGovApplyModuleService.secondaryData||this.enerGovApplyModuleService.selectedType==null)return null;var u=null,f=this.getTypeId(),e=this.getWorkClassId();if(f==null||e==null)return null;for(t=0;t<this.enerGovApplyModuleService.secondaryData.LicenseTypes.length;t++)if(this.enerGovApplyModuleService.secondaryData.LicenseTypes[t].BusinessLicenseTypeID===f){for(this.enerGovApplyModuleService.selectedLicenseTypeInfo=this.enerGovApplyModuleService.secondaryData.LicenseTypes[t],i=0;i<this.enerGovApplyModuleService.secondaryData.LicenseTypes[t].LicenseTypeClasses.length;i++)if(this.enerGovApplyModuleService.secondaryData.LicenseTypes[t].LicenseTypeClasses[i].LicenseClassId===e){for(r=0;r<this.enerGovApplyModuleService.secondaryData.LicenseTypes[t].LicenseTypeClasses[i].ContactTypeList.length;r++){n=this.enerGovApplyModuleService.secondaryData.LicenseTypes[t].LicenseTypeClasses[i].ContactTypeList[r];this.contactType={ContactTypeId:n.LandManagementContactTypeID,Name:n.Name,IsRequired:n.IsRequired,GroupId:n.ContactTypeGroup,LandManagementContactSystemTypeID:n.LandManagementContactSystemTypeID,isFilled:!1,IsDefaultOnlineContactType:n.IsDefaultOnlineContactType,IsValidateLic:n.IsValidateLic,IsValidateBLLicense:n.IsValidateBLLicense,IsValidateILLicense:n.IsValidateILLicense,RequiredValidLic:n.RequiredValidLic};break}u=this.enerGovApplyModuleService.secondaryData.LicenseTypes[t].LicenseTypeClasses[i];break}break}return this.enerGovApplyModuleService.showMoreInfoStep=this.showMoreInfo(u)&&this.customFieldsService.showMoreInfoStep,u},t.prototype.calculateEstimateFees=function(){var n,t;r(this.globalService.enerGovAPIVersion,"2019.1.0.0")==!0&&(n=this,n.enerGovApplyModuleService.model.LicenseTypeId=n.getTypeId(),n.enerGovApplyModuleService.model.LicenseClassId=n.getWorkClassId(),t=n.getSelectedWorkClassSecondaryData(),n.enerGovApplyModuleService.model.FeeTemplateId=t.LicenseWorkFeeTemplateId,n.enerGovApplyModuleService.getLicenseRenewalsEstimateFees(n.enerGovApplyModuleService.model,function(){}))},t.prototype.getWorkClassIdFromPackageData=function(n){var t=JSON.parse(n);return t.LicenseWorkClassID?t.LicenseWorkClassID:null},t.prototype.setStepperSteps=function(){var i,t,n;if(this.stepperService.module=this.isOperationalPermitApply?this.operationalPermit:this.businessLicense,i=this,t=i.getSelectedWorkClassSecondaryData(),t!==null)this.enerGovApplyModuleService.showMoreInfoStep=this.showMoreInfo(t)&&this.customFieldsService.showMoreInfoStep;else return;n=this.globalService.baseUrl+this.globalService.tenantUrl+"/energovapply/page?v="+this.globalService.version+"&id=";this.steps=[{Label:"Type",Order:0,ViewUrl:n+"businesslicensetype",ShowBackButton:!1,ShowNextButton:!0},{Label:"Review and Submit",Order:3,ViewUrl:n+"summary",ShowBackButton:!0,ShowNextButton:!1}];this.steps.push({Label:"Attachments",Order:2,ViewUrl:n+"attachmentfiles",ShowBackButton:!0,ShowNextButton:!0});this.enerGovApplyModuleService.showMoreInfoStep&&this.steps.push({Label:"More Info",Order:1,ViewUrl:n+"customfield",ShowBackButton:!0,ShowNextButton:!0});this.stepperService.stepsSetup("BusinessLicense",this.steps,this.enerGovApplyModuleService.selectedType)},t}(n.Common.Controllers.Apply.EnerGovApplyController);t.EnerGovBusinessLicenseRenewController=u})(t=n.License||(n.License={}))}(EnerGov||(EnerGov={}));__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){"use strict";var i=app.Common.Helpers.VersionSupport,r=n.Common.CaseTypeUseEnums.BusinessLicenseTypeModule,u=n.Common.CaseTypeUseEnums.BusinessLicenseCompanyTypeModule,f=app.Common.SelfServiceModules,e=function(n){function t(t,i,r,u,f,e,o,s,h,c,l,a,v,y,p){var w=n.call(this,null)||this,b;return w.$routeParams=t,w.$location=i,w.globalService=r,w.enerGovLicenseService=u,w.enerGovCustomFieldsService=f,w.customFieldsService=e,w.energovReportService=o,w.cartService=s,w.enerGovMyInvoiceSearchService=h,w.pageTitleService=c,w.tabNavigatorService=l,w.selfServiceStateService=a,w.entityTabsService=v,w.tenantService=y,w.enerGovEntityHoldSearchService=p,w.userLoggedIn=!1,w.attachmentChunking=!0,w.pendingAddCartItems=[],w.applyStatus=!1,w.isRenewal=!1,w.showPayNow=!1,w.invoicesPending=[],w.isOperationalPermit=!1,w.isSite=!1,w.BusinessLicenseApplicationTypes={ReviewRequired:1,ReviewRequiredWithPayment:2,Simple:3},w.isTenantUsesTylerPayments=function(){var n=w;w.tenantService.isTylerPaymentsUsed(function(t){n.isTylerPaymentsUsed=t})},b=w,b.isTenantUsesTylerPayments(),b.tabNavigatorService.cleanUp(),b.applyStatus=b.$location.search().success,b.isRenewal=b.$location.search().isRenewal,w}return __extends(t,n),t.prototype.printLicense=function(){var n=this.globalService.webApiBaseUrl+"/energov/report/single?value="+this.model.LicenseId+"&reportName="+this.reportName+"&tenantId="+this.globalService.tenantId;window.open(n,"_new")},t.prototype.init=function(){var n=this,t;n.customFieldsService.setLayout(null);t=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id);this.entityTabsService.setEntityTabsVisibility(this.$routeParams.id,t,n.$routeParams.tab);t===f.OperationalPermit?this.enerGovLicenseService.getOperationalPermitById(this.$routeParams.id,function(i){n.setLicenseDetails(i,t)}):this.enerGovLicenseService.getBusinessLicenseById(this.$routeParams.id,function(i){n.setLicenseDetails(i,t)});i(this.globalService.enerGovAPIVersion,"2016.3.0.212")||(n.attachmentChunking=!1)},t.prototype.setLicenseDetails=function(n,t){var i=this;(i.model=n,i.model!=null)&&(i.isOperationalPermit=i.model.ModuleTypeId===r.OperationalPermit,i.isSite=i.model.CompanyTypeModuleId===u.Site,i.model.HoldExist?this.enerGovEntityHoldSearchService.getCaseHolds(i.model.LicenseId,t,function(t){i.model.EntityHolds=t;i.selfServiceStateService.setParentModel(n)}):i.selfServiceStateService.setParentModel(n),i.pageTitleService.setPageTitle(i.model.LicenseNumber),i.model.LicenseId===""&&(alert("Unable to load the selected license. Please contact your municipality about the license you were attempting to view. Returning to home."),this.$location.path("/dashboard")),i.model.LicenseId!==null&&i.model.LicenseId!==""&&i.model.Issued&&!i.model.UnPaidInvoicedFees&&i.model.IsLoggedIn&&i.model.HasAuthorizedContact&&this.energovReportService.getReportName("BusinessLicense",i.model.LicenseTypeId,i.model.ClassificationId,function(n){i.reportName=n}),i.model.IsLoggedIn&&i.model.HasAuthorizedContact&&i.model.AllowPayNow&&i.model.UnPaidInvoicedFees!=null&&i.model.UnPaidInvoicedFees?i.isTylerPaymentsUsed||i.cartService.getPendingInvoices(i.model.UnpaidInvoiceIds,function(n){i.invoicesPending=n;i.showPayNow=n.length>0&&n.length==i.model.UnpaidInvoiceIds.length?!1:!0}):i.showPayNow=!0,i.model.LayoutId!==null&&i.model.LayoutId!==""&&i.model.LicenseId!==null&&i.model.LicenseId!==""?i.enerGovCustomFieldsService.getCustomLayoutWithData(i.model.LayoutId,i.model.OnlineLayoutId,i.model.LicenseId,t,function(n){n.Success?n.Result!=null?i.customFieldsService.setLayout(n.Result):i.errorMessage=n.ErrorMessage:(n.StatusCode===app.Common.Services.HttpStatusCode.PreconditionFailed||n.StatusCode===app.Common.Services.HttpStatusCode.NoContent||n.StatusCode===app.Common.Services.HttpStatusCode.Forbidden)&&(i.errorMessage=n.ErrorMessage)}):(i.entityTabsService.showMoreInfoTab=!1,i.$routeParams.tab&&i.$routeParams.tab==app.Constants.TabConstants.Moreinfo?i.entityTabsService.setAdditionalEntityTabsVisibility(i.$routeParams.tab,i.entityTabsService.showMoreInfoTab):i.entityTabsService.setFirstTabOnHidingOtherTabs()))},t.prototype.renew=function(){i(this.globalService.enerGovAPIVersion,"2017.4.0.26")&&(this.isOperationalPermit?this.$location.path("/operationalPermit/renew/"+this.model.LicenseId+"/"+this.model.LicenseTypeId+"/"+this.model.ClassificationId):this.$location.path("/businessLicense/renew/"+this.model.LicenseId+"/"+this.model.LicenseTypeId+"/"+this.model.ClassificationId))},t.prototype.payNow=function(){var i=this,n=this,t;this.model.UnpaidInvoiceIds!=null&&this.model.UnpaidInvoiceIds.length>0&&(t=_.difference(this.model.UnpaidInvoiceIds,this.invoicesPending),this.enerGovMyInvoiceSearchService.getDetailInvoices(t,!1,function(t){t!=null&&t.length>0&&(angular.forEach(t,function(t){var i={ItemName:t.InvoiceDescription,Due:t.InvoiceDueDate,Invoice:t.InvoiceNumber,InvoiceId:t.InvoiceId,BillingContact:t.BillingContact,ContactAddresses:t.ContactAddresses==null||t.ContactAddresses.length==0?[]:t.ContactAddresses,HomePhone:t.HomePhone,BusinessPhone:t.BusinessPhone,OtherPhone:t.OtherPhone,MobilePhone:t.MobilePhone,InvoiceEntityList:t.InvoiceEntities,InvoiceFees:t.InvoiceFees==null||t.InvoiceFees.length==0?[]:t.InvoiceFees},r={CartItemId:-1,CartDirectiveName:"energov-cart",CartData:angular.toJson(i),CartDataId:t.InvoiceId,UserId:-1,TenantId:-1,SoftwarePackageId:-1,SoftwarePackageName:"",Amount:t.TotalDue,IsNew:!0,IsDeleted:!1};n.pendingAddCartItems.push(r)}),n.cartService.addCartItems(i.pendingAddCartItems,function(t){t&&(n.cartService.didCallGetTotalItem=!1,n.cartService.updateTotalNumOfItems(),n.cartService.didCallGetTotalItem=!0,n.$location.url("/mycart"))}))}))},t}(app.Core.Controllers.CoreController);t.EnerGovBusinessLicenseViewController=e})(t=n.License||(n.License={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u){var f=n.call(this,null)||this,e;return f.$routeParams=t,f.$location=i,f.$q=r,f.enerGovBusinessTypeCardsService=u,f.removeBusinessType=function(n){var t,r,i;f.enerGovBusinessTypeCardsService.removeBusinessType(n);t=f;r=t.enerGovBusinessTypeCardsService.businessTypeCards.filter(function(n){return n.Main===!0});r.length===0&&t.enerGovBusinessTypeCardsService.businessTypeCards.length>0&&(t.enerGovBusinessTypeCardsService.businessTypeCards[0].Main=!0);i=angular.element("#businessTypeCardsId");i&&i.focus()},e=f,i.url()==="/businessLicense/renew/businessType"&&(u.returnToUrl==null||u.returnToUrl==="")&&(f.$q.defer().resolve(),i.url("/home/dashboard")),f}return __extends(t,n),t.prototype.addBusinessType=function(n){this.enerGovBusinessTypeCardsService.addBusinessType(n)},t.prototype.addNewBusinessType=function(){this.$location.path().toUpperCase().indexOf("BUSINESSLICENSE")>-1&&(this.enerGovBusinessTypeCardsService.returnToUrl=this.$location.path(),this.$location.url("/businessLicense/renew/businessType"))},t.prototype.setMain=function(n){n.Main=!0;angular.forEach(this.enerGovBusinessTypeCardsService.businessTypeCards,function(t){(t.CodeNumber!==n.CodeNumber||t.Name!==n.Name||t.BusinessCategoryName!==n.BusinessCategoryName)&&(t.Main=!1)})},t}(app.Core.Controllers.CoreController);n.EnerGovBusinessTypeCardsController=t})(t=n.License||(n.License={}))}(EnerGov||(EnerGov={}));__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,u,null,!1)||this;return e.energovBusinessTypesService=u,e.entitySecondaryDataService=f,e}return __extends(t,n),t.prototype.init=function(){var n=this,t=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id);this.criteria={PageNumber:1,PageSize:this.globalService.pageSizeList[0].Value,SortField:this.sortField,IsSortedInAscendingOrder:!0,ModuleId:t,EntityId:this.$routeParams.id};this.entitySecondaryDataService.sortSecondaryData===null||typeof this.entitySecondaryDataService.sortSecondaryData=="undefined"?this.entitySecondaryDataService.getEntityRecordSortSecondaryData(function(t){n.sortList=t.Result.EntityBusinessTypesFilterList;n.sortField=t.Result.EntityBusinessTypesFilterList[0].Value}):(n.sortList=this.entitySecondaryDataService.sortSecondaryData.Result.EntityBusinessTypesFilterList,n.sortField=this.entitySecondaryDataService.sortSecondaryData.Result.EntityBusinessTypesFilterList[0].Value);n.search(this.criteria,app.Events.SearchEvents.PageLoadCompleted)},t}(app.Common.Controllers.PagedSearchController);n.EnergovBusinessTypesController=t})(t=n.Controllers||(n.Controllers={}))})(t=n.License||(n.License={}))}(EnerGov||(EnerGov={}));__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,e){var o=n.call(this,t,i,r,u)||this;return o.energovBusinessTypeSearchService=u,o.entitySecondaryDataService=f,o.enerGovBusinessTypeCardsService=e,o.businessTypes=[],o.isOnLoad=!0,o.selectedBusinessTypes=[],o.enerGovBusinessTypeCardsService.businessTypeCards=[],o.isOnLoad=!0,o.initializeSearchCriteria(),o}return __extends(t,n),t.prototype.initializeSearchCriteria=function(){this.criteria={PageNumber:1,PageSize:this.globals.pageSizeList[0].Value,SortField:"CodeNumber",IsSortedInAscendingOrder:!1,ModuleId:0,EntityId:null,Keyword:"",CategoryId:"none"}},t.prototype.addOrRemoveBusinessType=function(n){if(n.IsSelected)this.selectedBusinessTypes.push(n);else{var t=this.selectedBusinessTypes.indexOf(n);this.selectedBusinessTypes.splice(t,1)}this.updateCheckedValuesList(this.selectedBusinessTypes,"BusinessTypeId")},t.prototype.returnToUrl=function(){this.enerGovBusinessTypeCardsService.returnFromAddBusinessType=!0;this.$location.url(this.enerGovBusinessTypeCardsService.returnToUrl)},t.prototype.addSelectedBusinessTypes=function(){var n=this;angular.forEach(n.selectedBusinessTypes,function(t){var i={CodeNumber:t.CodeNumber,Name:t.CodeName,BusinessCategoryName:t.CodeCategory,Main:t.Main,Selected:t.IsSelected,BusinessTypeID:t.BusinessTypeId,IsNew:!0,IsDeleted:!1,ClientId:"",ParentBusinessTypeID:"",ParentID:"",EstimatedReceipts:null,AllowedDeductionAmount:0,OriginalEstimatedReceipts:0,ReportedReceipts:0,ActualReceipts:0,RenewFromLicenseExtBusinessTypeID:""},r=n.enerGovBusinessTypeCardsService.businessTypeCards.filter(function(n){return n.BusinessTypeID===t.BusinessTypeId})[0];r||n.enerGovBusinessTypeCardsService.businessTypeCards.push(i)});n.enerGovBusinessTypeCardsService.returnFromAddBusinessType=!0;n.$location.url(n.enerGovBusinessTypeCardsService.returnToUrl)},t.prototype.resetSearch=function(){this.initializeSearchCriteria();this.searchResult=null;this.isOnLoad=!0;$("#pageSizeList").val(this.globals.pageSizeList[0].Value)},t.prototype.searchByCriteria=function(){var n=this;this.isOnLoad=!1;n.search(angular.copy(this.criteria),app.Events.SearchEvents.SearchCompleted)},t}(app.Common.Controllers.PagedGenericSearchController);n.EnergovBusinessTypeSearchController=t})(t=n.Controllers||(n.Controllers={}))})(t=n.License||(n.License={}))}(EnerGov||(EnerGov={}));__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){"use strict";var u=app.Common.Helpers.VersionSupport,i,r;(function(n){n[n.Contact=1]="Contact";n[n.Company=2]="Company";n[n.CompanyAndContact=3]="CompanyAndContact"})(i=t.ProLicenseHolderType||(t.ProLicenseHolderType={}));r=function(t){function r(n,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d,g,nt,tt,it,rt,ut,ft,et){var ot=t.call(this,n,i,r,u,f,e,o,c,a,v,p,h,s,y,w,b,d,l,nt,null,null,tt,it,rt,ut,ft,et)||this,st,ht,lt;if(ot.$routeParams=n,ot.$location=i,ot.globalService=r,ot.menuService=u,ot.settingsService=f,ot.enerGovContactCardsService=e,ot.enerGovAddressCardsService=o,ot.enerGovApplyModuleService=s,ot.enerGovProfessionalLicenseService=h,ot.enerGovAttachmentCardsService=c,ot.locationService=l,ot.enerGovCustomFieldsService=a,ot.customFieldsService=v,ot.enerGovSubrecordApplyService=y,ot.draftService=p,ot.userService=w,ot.$q=b,ot.$filter=k,ot.stepperService=d,ot.mapApplySerivce=g,ot.eReviewsService=nt,ot.caseTypeInstructionService=tt,ot.tylerSignaturePadService=it,ot.enerGovTemplateService=rt,ot.entitySignatureMetaDataService=ut,ot.$timeout=ft,ot.attachmentCommonCardService=et,ot.showMoreInfoStep=!1,ot.draftType=app.Constants.DraftType.License,ot.stepperService.module=app.Common.SelfServiceModules.ProfLicense,ot.isProfLicRenewal=!1,ot.showLicenseHolder=!0,ot.setLicenseHolder(),ot.enerGovApplyModuleService.model.AppliedDate=new Date(ot.$filter("date")(Date.now(),app.Constants.GlobalConstants.DateFormatForSearch)),ot.enerGovAddressCardsService.locationAddressType==null&&ot.userService.isUserLoggedIn)ot.enerGovAddressCardsService.getSecondaryDataAndSetAddressType();else if(ot.enerGovAddressCardsService.locationAddressType){if(g.mapLocations.length>0&&o.buildLocationCardFromMap(g.mapLocations),g.mapSPCollections.length>0)for(st=0,ht=g.mapSPCollections;st<ht.length;st++)lt=ht[st],ot.enerGovAddressCardsService.addSpatialCollection(lt);g.resetMapApplyData()}var at=ot.getTypeId(),vt=ot.getWorkClassId(),ct=ot.enerGovApplyModuleService.selectedTypeItems.filter(function(n){return n.CaseTypeInfo.PackageCaseTypeId===at&&n.CaseTypeInfo.PackageCaseClassId===vt});return ct!==null&&ct.length>0&&(ot.enerGovApplyModuleService.model.IsRequiredDescription=ct[0].CaseTypeInfo.DescriptionRequired),ot}return __extends(r,t),Object.defineProperty(r.prototype,"fileProgressListCount",{get:function(){return this.enerGovAttachmentCardsService.fileProgressList?this.enerGovAttachmentCardsService.fileProgressList.length:0},enumerable:!0,configurable:!0}),r.prototype.saveModule=function(){var t=this,i;t.enerGovApplyModuleService.model.Contacts=t.enerGovContactCardsService.saveContacts();t.enerGovApplyModuleService.model.Addresses=[];t.enerGovApplyModuleService.model.Addresses=$.grep(t.enerGovAddressCardsService.addressCards,function(n){return!n.IsParcel});t.enerGovApplyModuleService.model.Parcels=[];i=$.grep(t.enerGovAddressCardsService.addressCards,function(n){return n.IsParcel});angular.forEach(i,function(n){var i={ParentParcelID:"",ParcelID:"",ParentID:"",ParcelNumber:n.ParcelNumber,Section:n.Section,Range:n.Range,Township:n.Township,Main:n.Main,IsNew:!0,IsDeleted:!1,ClientId:""};t.enerGovApplyModuleService.model.Parcels.push(i)});t.enerGovApplyModuleService.model.LicenseTypeId=t.getTypeId();t.enerGovApplyModuleService.model.LicenseClassId=t.getWorkClassId();t.enerGovApplyModuleService.model.Holds=[];(t.enerGovAddressCardsService.copyParcelHolds||t.enerGovContactCardsService.copyContactHolds)&&(t.enerGovAddressCardsService.copyParcelHolds.length>0&&angular.forEach(t.enerGovAddressCardsService.copyParcelHolds,function(n){t.enerGovApplyModuleService.model.Holds.push(n)}),t.enerGovContactCardsService.copyContactHolds.length>0&&angular.forEach(t.enerGovContactCardsService.copyContactHolds,function(n){t.enerGovApplyModuleService.model.Holds.push(n)}));t.enerGovApplyModuleService.model.CustomLayout=t.customFieldsService.customLayout;t.enerGovApplyModuleService.model.CustomFieldsLayout=t.customFieldsService.customLayout;t.enerGovAttachmentCardsService.showProgressBarDialog();t.enerGovAttachmentCardsService.uploadFileAttachments(function(i){t.enerGovApplyModuleService.model.Attachments=i;t.enerGovApplyModuleService.saveProfessionalLicense(t.enerGovApplyModuleService.model,function(i){i.Success?(t.utilities.showPleaseWait(),t.saveSignatureToEnergov(n.Common.CaseTypeUseEnums.AgreementType.ProfessionalLicense,i,function(){t.utilities.hidePleaseWait();t.afterSaveRedirection(n.Common.CaseTypeUseEnums.FilterModule.ProfessionalLicense,i.Result)})):t.enerGovAttachmentCardsService.closeProgressBarDialog()})})},r.prototype.selectType=function(){t.prototype.selectType.call(this);this.setStepperSteps()},r.prototype.getSelectedWorkClassSecondaryData=function(){var e=null,u,f,n,i,r,t;if(this.enerGovApplyModuleService==null||!this.enerGovApplyModuleService.secondaryData||this.enerGovApplyModuleService.selectedType==null||(u=this.getTypeId(),f=this.getWorkClassId(),u==null||f==null))return null;for(n=0;n<this.enerGovApplyModuleService.secondaryData.LicenseTypes.length;n++)if(this.enerGovApplyModuleService.secondaryData.LicenseTypes[n].ProfessionalLicenseTypeID===u){for(this.enerGovApplyModuleService.secondaryData.LicenseTypes[n].DefaultWebApplyStatusID!==null&&(this.enerGovApplyModuleService.model.LicenseStatusId=this.enerGovApplyModuleService.secondaryData.LicenseTypes[n].DefaultWebApplyStatusID),i=0;i<this.enerGovApplyModuleService.secondaryData.LicenseTypes[n].LicenseTypeClasses.length;i++)if(this.enerGovApplyModuleService.secondaryData.LicenseTypes[n].LicenseTypeClasses[i].LicenseClassId===f){for(r=0;r<this.enerGovApplyModuleService.secondaryData.LicenseTypes[n].LicenseTypeClasses[i].ContactTypeList.length;r++){t=this.enerGovApplyModuleService.secondaryData.LicenseTypes[n].LicenseTypeClasses[i].ContactTypeList[r];this.contactType={ContactTypeId:t.LandManagementContactTypeID,Name:t.Name,IsRequired:t.IsRequired,GroupId:t.ContactTypeGroup,LandManagementContactSystemTypeID:t.LandManagementContactSystemTypeID,isFilled:!1,IsDefaultOnlineContactType:t.IsDefaultOnlineContactType,IsValidateLic:t.IsValidateLic,IsValidateBLLicense:t.IsValidateBLLicense,IsValidateILLicense:t.IsValidateILLicense,RequiredValidLic:t.RequiredValidLic};break}e=this.enerGovApplyModuleService.secondaryData.LicenseTypes[n].LicenseTypeClasses[i];break}break}return e},r.prototype.calculateEstimateFees=function(){var n,t,i;u(this.globalService.enerGovAPIVersion,"2019.1.0.0")==!0&&(n=this,n.enerGovApplyModuleService.model.LicenseTypeId=n.getTypeId(),n.enerGovApplyModuleService.model.LicenseClassId=n.getWorkClassId(),t=n.getSelectedWorkClassSecondaryData(),n.enerGovApplyModuleService.model.FeeTemplateId=t.LicenseWorkFeeTemplateId,n.enerGovApplyModuleService.model.CustomFieldsLayout=n.customFieldsService.customLayout,i=angular.copy(n.enerGovApplyModuleService.model),n.enerGovApplyModuleService.getProfessionalLicenseEstimateFees(i,function(){}))},r.prototype.setStepperSteps=function(){var i,r,n,t;if(this.stepperService.module=app.Common.SelfServiceModules.ProfLicense,i=this,r=i.getSelectedWorkClassSecondaryData(),r!==null)this.enerGovApplyModuleService.showMoreInfoStep=this.showMoreInfo(r);else return;n=this.globalService.baseUrl+this.globalService.tenantUrl+"/energovapply/page?v="+this.globalService.version+"&id=";this.steps=[];t=0;i.disableLocationsInTemplates||(!this.selectedType.CaseTypeInfo.HideLocationStep||this.selectedType.CaseTypeInfo.HideLocationStep&&this.enerGovAddressCardsService.addressRequired)&&this.steps.push({Label:"Locations",Order:t++,ViewUrl:n+"location",ShowBackButton:!1,ShowNextButton:!0});this.steps.push({Label:"Type",Order:t++,ViewUrl:n+"professionallicenseapplytype",ShowBackButton:this.enerGovAddressCardsService.addressRequired||this.selectedType&&!this.selectedType.CaseTypeInfo.HideLocationStep?!this.disableLocationsInTemplates:!1,ShowNextButton:!0});this.steps.push({Label:"Contacts",Order:t++,ViewUrl:n+"contacts",ShowBackButton:!0,ShowNextButton:!0});this.enerGovApplyModuleService.showMoreInfoStep&&this.steps.push({Label:"More Info",Order:t++,ViewUrl:n+"customfield",ShowBackButton:!0,ShowNextButton:!0});this.steps.push({Label:"Attachments",Order:t++,ViewUrl:n+"attachmentfiles",ShowBackButton:!0,ShowNextButton:!0});this.selectedType.CaseTypeInfo.SignatureRequired&&this.isFreshApplyOrUseTemplate()?(this.steps.push({Label:"Signature",Order:t++,ViewUrl:n+"signature",ShowBackButton:!0,ShowNextButton:!0}),this.steps.push({Label:this.menuActionType==this.menuActionTypeValues.UpdateTemplate?"Review and Save":"Review and Submit",Order:t++,ViewUrl:n+"summary",ShowBackButton:!0,ShowNextButton:!1})):this.steps.push({Label:this.menuActionType==this.menuActionTypeValues.UpdateTemplate?"Review and Save":"Review and Submit",Order:t++,ViewUrl:n+"summary",ShowBackButton:!0,ShowNextButton:!1});this.stepperService.stepsSetup("ProfessionalLicense",this.steps,this.enerGovApplyModuleService.selectedType)},r.prototype.setLicenseHolder=function(){var t=this,n=this;n.userService.isUserLoggedIn&&this.userService.getUser(function(r){parseInt(r.AccountType)===2?(n.enerGovApplyModuleService.model.LicenseHolderType=i.Contact,n.enerGovApplyModuleService.model.GlobalEntityName=t.userService.createFullName(r.LastName,r.FirstName,r.MiddleName)):parseInt(r.AccountType)===3?(n.enerGovApplyModuleService.model.LicenseHolderType=i.CompanyAndContact,n.enerGovApplyModuleService.model.GlobalEntityName=t.userService.createFullName(r.LastName,r.FirstName,r.MiddleName)):(n.enerGovApplyModuleService.model.LicenseHolderType=i.Company,n.enerGovApplyModuleService.model.GlobalEntityName=r.Company,t.isCompanyTypeOnly=!0);n.enerGovApplyModuleService.model.GlobalEntityId=r.OtherData})},r.prototype.getTypeIdFromPackageData=function(n){var t=JSON.parse(n);return t.LicenseTypeID?t.LicenseTypeID:null},r.prototype.getWorkClassIdFromPackageData=function(n){var t=JSON.parse(n);return t.LicenseClassID?t.LicenseClassID:null},r.prototype.updateDraftPartialFromModel=function(n){return n.Description=this.enerGovApplyModuleService.model.Description,n},r.prototype.updateModelPartialFromFraft=function(n){this.enerGovApplyModuleService.model.Description=n.Description},r}(n.Common.Controllers.Apply.EnerGovApplyController);t.EnerGovProfessionalLicenseApplyController=r})(t=n.License||(n.License={}))}(EnerGov||(EnerGov={}));__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){"use strict";var i=app.Common.Helpers.VersionSupport,r=function(n){function t(t,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d,g,nt,tt,it,rt,ut){nt===void 0&&(nt=null);var ft=n.call(this,t,i,r,u,f,e,o,c,l,a,y,h,s,v,p,w,k,null,d,null,null,g,nt,tt,null,it,rt)||this;return ft.$routeParams=t,ft.$location=i,ft.globalService=r,ft.menuService=u,ft.settingsService=f,ft.enerGovContactCardsService=e,ft.enerGovAddressCardsService=o,ft.enerGovApplyModuleService=s,ft.enerGovProfessionalLicenseService=h,ft.enerGovAttachmentCardsService=c,ft.enerGovCustomFieldsService=l,ft.customFieldsService=a,ft.enerGovSubrecordApplyService=v,ft.draftService=y,ft.userService=p,ft.$q=w,ft.$filter=b,ft.stepperService=k,ft.eReviewsService=d,ft.caseTypeInstructionService=g,ft.tylerSignaturePadService=nt,ft.enerGovTemplateService=tt,ft.$timeout=it,ft.attachmentCommonCardService=rt,ft.enerGovLicenseService=ut,ft.stepperService.module=app.Common.SelfServiceModules.ProfLicense,ft.showLicenseHolder=!0,ft}return __extends(t,n),Object.defineProperty(t.prototype,"fileProgressListCount",{get:function(){return this.enerGovAttachmentCardsService.fileProgressList?this.enerGovAttachmentCardsService.fileProgressList.length:0},enumerable:!0,configurable:!0}),t.prototype.saveModule=function(){var n=this,t;this.enerGovApplyModuleService.selectedLicenseTypeInfo.DefaultWebRenewStatus!==null&&(n.enerGovApplyModuleService.model.LicenseStatusId=this.enerGovApplyModuleService.selectedLicenseTypeInfo.DefaultWebRenewStatus);n.enerGovApplyModuleService.model.Contacts=n.enerGovContactCardsService.saveContacts();n.enerGovApplyModuleService.model.Addresses=[];n.enerGovApplyModuleService.model.Addresses=$.grep(n.enerGovAddressCardsService.addressCards,function(n){return!n.IsParcel});n.enerGovApplyModuleService.model.Holds=[];n.enerGovContactCardsService.copyContactHolds&&(n.enerGovApplyModuleService.model.Holds=n.enerGovContactCardsService.copyContactHolds);n.enerGovApplyModuleService.model.Parcels=[];t=$.grep(n.enerGovAddressCardsService.addressCards,function(n){return n.IsParcel});angular.forEach(t,function(t){var i={ParentParcelID:"",ParcelID:"",ParentID:"",ParcelNumber:t.ParcelNumber,Section:t.Section,Range:t.Range,Township:t.Township,Main:t.Main,IsNew:!0,IsDeleted:!1,ClientId:""};n.enerGovApplyModuleService.model.Parcels.push(i)});n.enerGovAttachmentCardsService.showProgressBarDialog();n.enerGovAttachmentCardsService.uploadFileAttachments(function(t){n.enerGovApplyModuleService.model.Attachments=t;n.enerGovApplyModuleService.renewProfessionalLicense(n.enerGovApplyModuleService.model,function(t){t.Success?(n.cleanUp(),n.$location.path("/profLicense/"+t.Result).search({success:!0,isRenewal:!0})):n.enerGovAttachmentCardsService.closeProgressBarDialog()})})},t.prototype.initializeData=function(){var t=this,n=this;n.moduleId=app.Common.SelfServiceModules.ProfLicense;n.enerGovApplyModuleService.model.ProfessionalLicenseId==""&&n.enerGovApplyModuleService.getProfessionalLicenseRenewalById(n.$routeParams.id,function(i){var r,u;i!=null?(n.enerGovApplyModuleService.model=i,n.enerGovApplyModuleService.model.ApplicationDate=new Date(n.$filter("date")(Date.now(),app.Constants.GlobalConstants.DateFormatForSearch)),n.enerGovApplyModuleService.model.AppliedDate=new Date(n.$filter("date")(Date.now(),app.Constants.GlobalConstants.DateFormatForSearch)),r=n.getMenuItem(),t.menuItem=r,r.Label=i.LicenseTypeName,n.enerGovApplyModuleService.selectedTypeItems.push(r),n.enerGovApplyModuleService.selectedType=n.enerGovApplyModuleService.selectedTypeItems[0],n.enerGovSubrecordApplyService.subrecordApplyInfo={Addresses:i.Addresses,Contacts:i.Contacts,CustomFields:i.CustomFields,Parcels:i.Parcels,Description:i.Description,Holds:[],Value:null,IsSubPermitFromPermit:!1,IsSubPermitFromPlan:!1,IsSubPlanFromPermit:!1,IsSubPlanFromPlan:!1,SquareFeet:0,VersionNumber:1,WorkflowActionId:"",WorkflowStatusId:0,LicenseRenewalRequiredFields:i.RequiredFields,BusinessTypes:null,IsWorkflowActionPersistent:!1,IsWorkflowActionOptional:!1,WorkflowTemplateId:"",WorkflowTemplateActionId:"",WfActionData:null,ParentEntityId:"",Project:null},u={CaseId:n.$routeParams.id,CaseModule:n.moduleId,ContactTypeIds:[]},n.enerGovSubrecordApplyService.getSubrecordContactsData(u,function(i){t.enerGovLicenseService.getProfessionalLicenseById(t.$routeParams.id,function(r){n.enerGovCustomFieldsService.getCustomLayoutWithData(r.LayoutId,r.OnlineLayoutId,t.$routeParams.id,n.moduleId,function(){n.enerGovSubrecordApplyService.contactCardInfoResult=i;n.selectType();n.populateRenewalDataWithoutCustomFields();t.enerGovContactCardsService.setDefaultContactType(function(){},!1)})})})):t.$location.path("/dashboard")})},t.prototype.selectType=function(){n.prototype.selectType.call(this)},t.prototype.getSelectedWorkClassSecondaryData=function(){var e=null,u,f,t,i,r,n;if(this.enerGovApplyModuleService==null||!this.enerGovApplyModuleService.secondaryData||this.enerGovApplyModuleService.selectedType==null||(u=this.getTypeId(),f=this.getWorkClassId(),u==null||f==null))return null;for(t=0;t<this.enerGovApplyModuleService.secondaryData.LicenseTypes.length;t++)if(this.enerGovApplyModuleService.secondaryData.LicenseTypes[t].ProfessionalLicenseTypeID===u){for(this.enerGovApplyModuleService.selectedLicenseTypeInfo=this.enerGovApplyModuleService.secondaryData.LicenseTypes[t],i=0;i<this.enerGovApplyModuleService.secondaryData.LicenseTypes[t].LicenseTypeClasses.length;i++)if(this.enerGovApplyModuleService.secondaryData.LicenseTypes[t].LicenseTypeClasses[i].LicenseClassId===f){for(r=0;r<this.enerGovApplyModuleService.secondaryData.LicenseTypes[t].LicenseTypeClasses[i].ContactTypeList.length;r++){n=this.enerGovApplyModuleService.secondaryData.LicenseTypes[t].LicenseTypeClasses[i].ContactTypeList[r];this.contactType={ContactTypeId:n.LandManagementContactTypeID,Name:n.Name,IsRequired:n.IsRequired,GroupId:n.ContactTypeGroup,LandManagementContactSystemTypeID:n.LandManagementContactSystemTypeID,isFilled:!1,IsDefaultOnlineContactType:n.IsDefaultOnlineContactType,IsValidateLic:n.IsValidateLic,IsValidateBLLicense:n.IsValidateBLLicense,IsValidateILLicense:n.IsValidateILLicense,RequiredValidLic:n.RequiredValidLic};break}e=this.enerGovApplyModuleService.secondaryData.LicenseTypes[t].LicenseTypeClasses[i];break}break}return e},t.prototype.calculateEstimateFees=function(){var n,t;i(this.globalService.enerGovAPIVersion,"2019.1.0.0")==!0&&(n=this,n.enerGovApplyModuleService.model.LicenseTypeId=n.getTypeId(),n.enerGovApplyModuleService.model.LicenseClassId=n.getWorkClassId(),t=n.getSelectedWorkClassSecondaryData(),n.enerGovApplyModuleService.model.FeeTemplateId=t.LicenseWorkFeeTemplateId,n.enerGovApplyModuleService.getProfessionalLicenseRenewalsEstimateFees(n.enerGovApplyModuleService.model,function(){}))},t.prototype.getWorkClassIdFromPackageData=function(n){var t=JSON.parse(n);return t.LicenseWorkClassID?t.LicenseWorkClassID:null},t.prototype.setStepperSteps=function(){var i,t,n;this.stepperService.module=app.Common.SelfServiceModules.ProfLicense;i=this;t=i.getSelectedWorkClassSecondaryData();t!==null&&(this.enerGovApplyModuleService.showMoreInfoStep=this.showMoreInfo(t)&&this.customFieldsService.showMoreInfoStep);n=this.globalService.baseUrl+this.globalService.tenantUrl+"/energovapply/page?v="+this.globalService.version+"&id=";this.steps=[{Label:"Type",Order:0,ViewUrl:n+"professionallicensetype",ShowBackButton:!1,ShowNextButton:!0},{Label:"Review and Submit",Order:3,ViewUrl:n+"summary",ShowBackButton:!0,ShowNextButton:!1}];this.steps.push({Label:"Attachments",Order:2,ViewUrl:n+"attachmentfiles",ShowBackButton:!0,ShowNextButton:!0});this.enerGovApplyModuleService.showMoreInfoStep&&this.steps.push({Label:"More Info",Order:1,ViewUrl:n+"customfield",ShowBackButton:!0,ShowNextButton:!0});this.stepperService.stepsSetup("BusinessLicense",this.steps,this.enerGovApplyModuleService.selectedType)},t}(n.Common.Controllers.Apply.EnerGovApplyController);t.EnerGovProfessionalLicenseRenewController=r})(t=n.License||(n.License={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=app.Common.Helpers.VersionSupport,i=function(n){function i(t,i,r,u,f,e,o,s,h,c,l,a,v,y){var p=n.call(this,null)||this,w;return p.$routeParams=t,p.$location=i,p.globalService=r,p.enerGovLicenseService=u,p.enerGovCustomFieldsService=f,p.customFieldsService=e,p.energovReportService=o,p.cartService=s,p.enerGovMyInvoiceSearchService=h,p.pageTitleService=c,p.tabNavigatorService=l,p.selfServiceStateService=a,p.entityTabsService=v,p.tenantService=y,p.userLoggedIn=!1,p.attachmentChunking=!0,p.pendingAddCartItems=[],p.applyStatus=!1,p.isRenewal=!1,p.showPayNow=!1,p.invoicesPending=[],p.profLicenseApplicationTypes={ReviewRequired:1,ReviewRequiredWithPayment:2,Simple:3},p.isTenantUsesTylerPayments=function(){var n=p;p.tenantService.isTylerPaymentsUsed(function(t){n.isTylerPaymentsUsed=t})},w=p,w.isTenantUsesTylerPayments(),w.tabNavigatorService.cleanUp(),w.applyStatus=w.$location.search().success,w.isRenewal=w.$location.search().isRenewal,p}return __extends(i,n),i.prototype.printLicense=function(){var n=this.globalService.webApiBaseUrl+"/energov/report/single?value="+this.model.LicenseId+"&reportName="+this.reportName+"&tenantId="+this.globalService.tenantId;window.open(n,"_new")},i.prototype.init=function(){var r=this,n=this,i;n.customFieldsService.setLayout(null);i=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id);this.entityTabsService.setEntityTabsVisibility(this.$routeParams.id,i,n.$routeParams.tab);this.enerGovLicenseService.getProfessionalLicenseById(this.$routeParams.id,function(t){(n.model=t,n.model!=null)&&(n.selfServiceStateService.setParentModel(t),n.pageTitleService.setPageTitle(n.model.LicenseNumber),n.model.LicenseId===""&&(alert("Unable to load the selected license. Please contact your municipality about the license you were attempting to view. Returning to home."),r.$location.path("/dashboard")),n.model.LicenseId!==null&&n.model.LicenseId!==""&&n.model.Issued&&!n.model.UnPaidInvoicedFees&&n.model.IsLoggedIn&&n.model.HasAuthorizedContact&&r.energovReportService.getReportName("ProfessionalLicense",n.model.LicenseTypeId,n.model.ClassificationId,function(t){n.reportName=t}),n.model.IsLoggedIn&&n.model.HasAuthorizedContact&&n.model.AllowPayNow&&n.model.UnPaidInvoicedFees!=null&&n.model.UnPaidInvoicedFees?n.isTylerPaymentsUsed||n.cartService.getPendingInvoices(n.model.UnpaidInvoiceIds,function(t){n.invoicesPending=t;n.showPayNow=t.length>0&&t.length==n.model.UnpaidInvoiceIds.length?!1:!0}):n.showPayNow=!0,n.model.LayoutId!==null&&n.model.LayoutId!==""&&n.model.LicenseId!==null&&n.model.LicenseId!==""?n.enerGovCustomFieldsService.getCustomLayoutWithData(n.model.LayoutId,n.model.OnlineLayoutId,n.model.LicenseId,i,function(t){t.Success?t.Result!=null?n.customFieldsService.setLayout(t.Result):n.errorMessage=t.ErrorMessage:(t.StatusCode===app.Common.Services.HttpStatusCode.PreconditionFailed||t.StatusCode===app.Common.Services.HttpStatusCode.NoContent||t.StatusCode===app.Common.Services.HttpStatusCode.Forbidden)&&(n.errorMessage=t.ErrorMessage)}):(n.entityTabsService.showMoreInfoTab=!1,n.$routeParams.tab&&n.$routeParams.tab==app.Constants.TabConstants.Moreinfo?n.entityTabsService.setAdditionalEntityTabsVisibility(n.$routeParams.tab,n.entityTabsService.showMoreInfoTab):n.entityTabsService.setFirstTabOnHidingOtherTabs()),$("#label-licenseDetail-Description").attr("class","col-lg-10 col-md-9 col-sm-9 col-xs-12 entity-detail-description-multiline"))});t(this.globalService.enerGovAPIVersion,"2016.3.0.212")||(n.attachmentChunking=!1)},i.prototype.renew=function(){this.$location.path("/profLicense/renew/"+this.model.LicenseId+"/"+this.model.LicenseTypeId+"/"+this.model.ClassificationId)},i.prototype.payNow=function(){var i=this,n=this,t;this.model.UnpaidInvoiceIds!=null&&this.model.UnpaidInvoiceIds.length>0&&(t=_.difference(this.model.UnpaidInvoiceIds,this.invoicesPending),this.enerGovMyInvoiceSearchService.getDetailInvoices(t,!1,function(t){t!=null&&t.length>0&&(angular.forEach(t,function(t){var i={ItemName:t.InvoiceDescription,Due:t.InvoiceDueDate,Invoice:t.InvoiceNumber,InvoiceId:t.InvoiceId,BillingContact:t.BillingContact,ContactAddresses:t.ContactAddresses==null||t.ContactAddresses.length==0?[]:t.ContactAddresses,HomePhone:t.HomePhone,BusinessPhone:t.BusinessPhone,OtherPhone:t.OtherPhone,MobilePhone:t.MobilePhone,InvoiceEntityList:t.InvoiceEntities,InvoiceFees:t.InvoiceFees==null||t.InvoiceFees.length==0?[]:t.InvoiceFees},r={CartItemId:-1,CartDirectiveName:"energov-cart",CartData:angular.toJson(i),CartDataId:t.InvoiceId,UserId:-1,TenantId:-1,SoftwarePackageId:-1,SoftwarePackageName:"",Amount:t.TotalDue,IsNew:!0,IsDeleted:!1};n.pendingAddCartItems.push(r)}),n.cartService.addCartItems(i.pendingAddCartItems,function(t){t&&(n.cartService.didCallGetTotalItem=!1,n.cartService.updateTotalNumOfItems(),n.cartService.didCallGetTotalItem=!0,n.$location.url("/mycart"))}))}))},i}(app.Core.Controllers.CoreController);n.EnerGovProfessionalLicenseViewController=i})(t=n.License||(n.License={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){"use strict";var i=t.EnerGovBusinessLicenseViewController,r=t.EnerGovProfessionalLicenseViewController,u=t.Services.EnerGovLicenseService,f=t.Services.EnerGovBusinessLicenseService,e=t.Services.EnerGovProfessionalLicenseService,o=t.EnerGovBusinessLicenseRenewController,s=t.EnerGovProfessionalLicenseRenewController,h=t.Services.EnerGovBusinessLicenseRenewService,c=t.Services.EnerGovProfessionalLicenseRenewService,l=t.Services.EnerGovBusinessTypeCardsService,a=t.EnerGovProfessionalLicenseApplyController,v=t.Services.EnerGovProfessionalLicenseApplyService,y=t.EnerGovBusinessLicenseApplyController,p=t.Services.EnerGovBusinessLicenseApplyService;angular.module("enerGov.license",["app.globalsModule","app.Common.Services","enerGov.Template","ngSanitize"]).service("enerGovLicenseService",["http",u]).service("enerGovBusinessLicenseService",["http","$routeParams","enerGovBusinessService",f]).service("enerGovProfessionalLicenseService",["http",e]).service("energovBusinessTypesService",["http","entityTabsService","$routeParams",n.Contact.Services.EnergovBusinessTypesService]).service("enerGovBusinessLicenseRenewService",["http","$q","$http","globalsService",h]).service("enerGovBusinessLicenseApplyService",["http","$q","$http","globalsService","userService",p]).service("enerGovProfessionalLicenseRenewService",["http","$q","$http","globalsService",c]).service("enerGovBusinessTypeCardsService",["http",l]).service("energovBusinessTypeSearchService",["http",n.Contact.Services.EnergovBusinessTypeSearchService]).service("enerGovProfessionalLicenseApplyService",["http",v]).controller("enerGovBusinessLicenseViewController",["$routeParams","$location","globalsService","enerGovLicenseService","enerGovCustomFieldsService","customFieldsService","enerGovReportService","cartService","enerGovMyInvoiceSearchService","pageTitleService","tabNavigatorService","selfServiceStateService","entityTabsService","tenantService","enerGovEntityHoldSearchService",i]).controller("enerGovProfessionalLicenseViewController",["$routeParams","$location","globalsService","enerGovLicenseService","enerGovCustomFieldsService","customFieldsService","enerGovReportService","cartService","enerGovMyInvoiceSearchService","pageTitleService","tabNavigatorService","selfServiceStateService","entityTabsService","tenantService",r]).controller("energovBusinessTypesController",["$routeParams","$location","globalsService","energovBusinessTypesService","entitySecondaryDataService",n.License.Controllers.EnergovBusinessTypesController]).controller("enerGovBusinessLicenseRenewController",["$routeParams","$location","globalsService","menuService","enerGovSettingsService","enerGovContactCardsService","enerGovAddressCardsService","enerGovBusinessLicenseRenewService","enerGovBusinessLicenseService","enerGovAttachmentCardsService","enerGovCustomFieldsService","customFieldsService","enerGovSubrecordApplyService","draftService","userService","$q","$filter","stepperService","enerGovBusinessTypeCardsService","eReviewsService","caseTypeInstructionService","tylerSignaturePadService","enerGovTemplateService","$timeout","attachmentCommonCardService","enerGovLicenseService",o]).controller("enerGovProfessionalLicenseRenewController",["$routeParams","$location","globalsService","menuService","enerGovSettingsService","enerGovContactCardsService","enerGovAddressCardsService","enerGovProfessionalLicenseRenewService","enerGovProfessionalLicenseService","enerGovAttachmentCardsService","enerGovCustomFieldsService","customFieldsService","enerGovSubrecordApplyService","draftService","userService","$q","$filter","stepperService","eReviewsService","caseTypeInstructionService","tylerSignaturePadService","enerGovTemplateService","$timeout","attachmentCommonCardService","enerGovLicenseService",s]).controller("enerGovBusinessTypeCardsController",["$routeParams","$location","$q","enerGovBusinessTypeCardsService",t.EnerGovBusinessTypeCardsController]).controller("energovBusinessTypeSearchController",["$routeParams","$location","globalsService","energovBusinessTypeSearchService","entitySecondaryDataService","enerGovBusinessTypeCardsService",n.License.Controllers.EnergovBusinessTypeSearchController]).controller("enerGovProfessionalLicenseApplyController",["$routeParams","$location","globalsService","menuService","enerGovSettingsService","enerGovContactCardsService","enerGovAddressCardsService","enerGovProfessionalLicenseApplyService","enerGovProfessionalLicenseService","enerGovAttachmentCardsService","locationService","enerGovCustomFieldsService","customFieldsService","enerGovSubrecordApplyService","draftService","userService","$q","$filter","stepperService","mapApplyService","eReviewsService","caseTypeInstructionService","tylerSignaturePadService","enerGovTemplateService","entitySignatureMetaDataService","$timeout","attachmentCommonCardService",a]).controller("enerGovBusinessLicenseApplyController",["$routeParams","$location","globalsService","menuService","enerGovSettingsService","enerGovContactCardsService","enerGovAddressCardsService","enerGovBusinessLicenseApplyService","enerGovBusinessLicenseService","enerGovAttachmentCardsService","locationService","enerGovCustomFieldsService","customFieldsService","enerGovSubrecordApplyService","draftService","userService","$q","$filter","stepperService","enerGovBusinessTypeCardsService","eReviewsService","enerGovBusinessService","utilities","caseTypeInstructionService","tylerSignaturePadService","enerGovTemplateService","entitySignatureMetaDataService","$timeout","mapApplyService","attachmentCommonCardService","$sanitize",y])})(t=n.License||(n.License={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/businessEntities/"}return n.prototype.getBusinessesForCurrentUser=function(n){this.http.get(this.rootUrl+"contact",function(t){n(t.Result)},!1)},n.prototype.getCompanyTypeForCardDropdown=function(n,t){this.http.get(this.rootUrl+"companyTypes/"+n,function(n){n.Success&&t(n.Result)},!1)},n}();n.EnerGovBusinessCardsService=t})(t=n.Services||(n.Services={}))})(t=n.Business||(n.Business={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/businessEntities/";this.tabControlId=0}return n.prototype.getBusinessById=function(n,t){var i;i=this.rootUrl+n;this.http.get(i,function(n){t(n.Result)},!1)},n.prototype.getBusinessIdFromEntityId=function(n,t){var i=this.rootUrl+"getBusinessId/";this.http.get(i+n,function(n){t(n.Result)},!1)},n.prototype.getSecondaryData=function(n,t){var i;i=this.rootUrl+"setup/"+n;this.http.get(i,function(n){n.Success?t(n.Result):t(null)},!1)},n}();n.EnerGovBusinessService=t})(t=n.Services||(n.Services={}))})(t=n.Business||(n.Business={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/businessEntities/search/search"}return n.prototype.searchByEntityId=function(n,t){var i=this;i.http.post(i.rootUrl,n,function(n){t(n)},!0)},n}();n.EnerGovEntityBusinessService=t})(t=n.Services||(n.Services={}))})(t=n.Business||(n.Business={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(n,t,i){this.http=n;this.entityTabsService=t;this.$routeParams=i;this.rootUrl="/energov/businessEntities/linkedLicenses/"}return n.prototype.searchByCriteria=function(n,t){var i=this;i.http.post(i.rootUrl,n,function(n){n.Success||(n.StatusCode===app.Common.Services.HttpStatusCode.NoContent||n.StatusCode===app.Common.Services.HttpStatusCode.Forbidden?i.entityTabsService.showLinkedLicenseTab=!1:n.StatusCode===app.Common.Services.HttpStatusCode.PreconditionFailed&&(i.entityTabsService.showLinkedLicenseTab=!0),i.$routeParams.tab&&i.$routeParams.tab==app.Constants.TabConstants.LinkedLicenses?i.entityTabsService.setAdditionalEntityTabsVisibility(i.$routeParams.tab,i.entityTabsService.showLinkedLicenseTab):i.entityTabsService.setFirstTabOnHidingOtherTabs());t(n)},!0)},n}();n.EnergovLinkedLicensesService=t})(t=n.Services||(n.Services={}))})(t=n.Contact||(n.Contact={}))}(EnerGov||(EnerGov={}));__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=n.Common.CaseTypeUseEnums.MenuActionType,r=n.Common.CaseTypeUseEnums.CategoryObject,u=function(t){function u(n,i,r,u,f,e,o){var s=t.call(this,null)||this;return s.$routeParams=n,s.$location=i,s.enerGovBusinessCardsService=r,s.menuService=u,s.resourceService=f,s.userService=e,s.locationService=o,s.businessList=[],s.isOperationalPermit=!1,$("#companyTypesDropDown").click(function(n){n.stopPropagation()}),s}return __extends(u,t),u.prototype.init=function(){var t=this,n=this;n.userService.isUserLoggedIn&&(n.enerGovBusinessCardsService.getBusinessesForCurrentUser(function(t){n.businessList=t;angular.forEach(n.businessList,function(t){var r=t.Addresses.filter(function(n){return n.Main===!0})[0],i;t.MainAddress=n.getFullAddress(r);i=t.BusinessTypes.filter(function(n){return n.Main===!0})[0];t.MainBusinessTypeName=i?i.Name:""})}),n.menuInfo=n.menuService.getMenuById(parseInt(n.$routeParams.menuId),!0),n.isOperationalPermit=n.menuInfo.CategoryObjectID===r.OperationalPermit,this.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Business.BusinessResource",["EnerGovBusinessCard_SelectCompanyType"],function(i){t.defaultCompanyType=i.EnerGovBusinessCard_SelectCompanyType;n.enerGovBusinessCardsService.getCompanyTypeForCardDropdown(t.isOperationalPermit,function(t){n.companyTypeList=t;var i={Id:"0",Name:n.defaultCompanyType};n.companyTypeList.unshift(i);n.selectedCompanyType=t[0]})}))},u.prototype.getFullAddress=function(n){return n?n.AddressLine1+" "+n.AddressLine2+" "+n.AddressLine3+" "+n.City+" "+n.State+" "+n.PostalCode+" "+n.County+" "+n.Country:""},u.prototype.selectBusiness=function(n){this.isOperationalPermit?this.$location.path("/operationalPermit/apply/"+n.GlobalEntityExtensionID+"/"+this.$routeParams.menuId+"/0/"+i.Apply):this.$location.path("/businessLicense/apply/"+n.GlobalEntityExtensionID+"/"+this.$routeParams.menuId+"/0/"+i.Apply)},u.prototype.selectNewBusiness=function(){this.selectedCompanyType.Id==="0"?(angular.element("#companyTypeSelect").addClass("border-dropdown"),angular.element("#companyTypeSelect").removeAttr("aria-label"),angular.element("#companyTypeSelect").attr("aria-label",this.defaultCompanyType.toString()),angular.element("#companyTypeSelect").focus()):this.isOperationalPermit?this.$location.url("/operationalPermit/apply/0/"+this.$routeParams.menuId+"/0/"+i.Apply+"?companyId="+this.selectedCompanyType.Id):this.$location.url("/businessLicense/apply/0/"+this.$routeParams.menuId+"/0/"+i.Apply+"?companyId="+this.selectedCompanyType.Id)},u.prototype.disableSelect=function(t){var i=new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate());return t.SystemStatusId===n.Common.CaseTypeUseEnums.LicenseSystemStatus.Closed||t.SystemStatusId===n.Common.CaseTypeUseEnums.LicenseSystemStatus.Hold||t.CloseDate!==null&&moment(t.CloseDate).toDate()<i},u.prototype.removeClass=function(){angular.element("#companyTypeSelect").removeClass("border-dropdown")},u}(app.Core.Controllers.CoreController);t.EnerGovBusinessCardsController=u})(i=t.Controller||(t.Controller={}))})(t=n.Business||(n.Business={}))}(EnerGov||(EnerGov={}));__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=n.Common.CaseTypeUseEnums.BusinessLicenseTypeModule,r=n.Common.CaseTypeUseEnums.BusinessLicenseCompanyTypeModule,u=function(n){function t(t,i,r,u){var f=n.call(this,null)||this;return f.$routeParams=t,f.$location=i,f.enerGovBusinessEntityService=r,f.entityTabsService=u,f.isOperationalPermit=!1,f.isSite=!1,f.entityId=t.id,f}return __extends(t,n),t.prototype.init=function(){var n=this;this.criteria={EntityId:this.entityId,IsSortedInAscendingOrder:!1,ModuleId:app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id),PageNumber:1,PageSize:1,SortField:""};this.enerGovBusinessEntityService.searchByEntityId(this.criteria,function(t){var u=n;t!==null&&(u.model=t.Result,u.model!=null&&(u.isOperationalPermit=u.model.ModuleTypeId===i.OperationalPermit,u.isSite=u.model.CompanyTypeModuleId===r.Site),t.Success||(n.errorMessage=t.ErrorMessage,t.StatusCode===app.Common.Services.HttpStatusCode.NoContent||t.StatusCode===app.Common.Services.HttpStatusCode.Forbidden?u.entityTabsService.showBusinessTab=!1:t.StatusCode===app.Common.Services.HttpStatusCode.PreconditionFailed&&(u.entityTabsService.showBusinessTab=!0),u.$routeParams.tab&&u.$routeParams.tab==app.Constants.TabConstants.Business?u.entityTabsService.setAdditionalEntityTabsVisibility(u.$routeParams.tab,u.entityTabsService.showBusinessTab):u.entityTabsService.setFirstTabOnHidingOtherTabs()));$("#label-licenseDetail-BusinessDescription").attr("class","col-lg-10 col-md-9 col-sm-9 col-xs-12 entity-detail-description-multiline")})},t}(app.Core.Controllers.CoreController);t.EnerGovBusinessEntityController=u})(i=t.Controller||(t.Controller={}))})(t=n.Business||(n.Business={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=app.Common.Helpers.VersionSupport,i=function(n){function i(t,i,r,u,f,e,o,s,h){var c=n.call(this,null)||this;return c.$routeParams=t,c.$location=i,c.globalService=r,c.enerGovBusinessService=u,c.enerGovCustomFieldsService=f,c.customFieldsService=e,c.pageTitleService=o,c.tabNavigatorService=s,c.entityTabsService=h,c.userLoggedIn=!1,c.attachmentChunking=!0,c}return __extends(i,n),i.prototype.payNow=function(n){this.$location.path("/business/"+n+"/taxremittance")},i.prototype.init=function(){var r=this,n=this,i;n.customFieldsService.setLayout(null);i=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id);n.entityTabsService.setEntityTabsVisibility(n.$routeParams.id,i,n.$routeParams.tab);n.tabNavigatorService.cleanUp();n.$routeParams.tab&&n.tabNavigatorService.selectTab(n.$routeParams.tab);this.enerGovBusinessService.getBusinessById(this.$routeParams.id,function(t){(n.model=t,n.model!=null)&&(n.pageTitleService.setPageTitle(n.model.BusinessNumber),n.model.BusinessId===""&&(alert("Unable to load the selected business. Please contact your municipality about the business you were attempting to view. Returning to home."),r.$location.path("/dashboard")),n.model.LayoutId!==null&&n.model.LayoutId!==""&&n.model.BusinessId!==null&&n.model.BusinessId!==""?n.enerGovCustomFieldsService.getCustomLayoutWithData(n.model.LayoutId,n.model.OnlineLayoutId,n.model.BusinessId,i,function(t){t.Success?t.Result!=null?n.customFieldsService.setLayout(t.Result):n.errorMessage=t.ErrorMessage:(t.StatusCode===app.Common.Services.HttpStatusCode.PreconditionFailed||t.StatusCode===app.Common.Services.HttpStatusCode.NoContent||t.StatusCode===app.Common.Services.HttpStatusCode.Forbidden)&&(n.errorMessage=t.ErrorMessage)}):(n.entityTabsService.showMoreInfoTab=!1,n.$routeParams.tab&&n.$routeParams.tab==app.Constants.TabConstants.Moreinfo?n.entityTabsService.setAdditionalEntityTabsVisibility(n.$routeParams.tab,n.entityTabsService.showMoreInfoTab):n.entityTabsService.setFirstTabOnHidingOtherTabs()))});t(this.globalService.enerGovAPIVersion,"2016.3.0.212")||(n.attachmentChunking=!1)},i}(app.Core.Controllers.CoreController);n.EnerGovBusinessViewController=i})(t=n.Business||(n.Business={}))}(EnerGov||(EnerGov={}));__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,u,null,!1)||this;return e.energovLinkedLicensesService=u,e.entitySecondaryDataService=f,e}return __extends(t,n),t.prototype.init=function(){var n=this,t=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id);this.criteria={PageNumber:1,PageSize:this.globalService.pageSizeList[0].Value,SortField:this.sortField,IsSortedInAscendingOrder:!0,ModuleId:t,EntityId:this.$routeParams.id};this.entitySecondaryDataService.sortSecondaryData===null||typeof this.entitySecondaryDataService.sortSecondaryData=="undefined"?this.entitySecondaryDataService.getEntityRecordSortSecondaryData(function(t){n.sortList=t.Result.EntityLinkedLicensesFilterList;n.sortField=t.Result.EntityLinkedLicensesFilterList[0].Value}):(n.sortList=this.entitySecondaryDataService.sortSecondaryData.Result.EntityLinkedLicensesFilterList,n.sortField=this.entitySecondaryDataService.sortSecondaryData.Result.EntityLinkedLicensesFilterList[0].Value);n.search(this.criteria,app.Events.SearchEvents.PageLoadCompleted)},t}(app.Common.Controllers.PagedSearchController);n.EnergovLinkedLicensesController=t})(t=n.Controllers||(n.Controllers={}))})(t=n.License||(n.License={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){"use strict";var i=t.EnerGovBusinessViewController,r=t.Services.EnerGovBusinessService;angular.module("enerGov.business",["app.globalsModule","app.Common.Services"]).service("enerGovBusinessService",["http",r]).service("energovBusinessTypesService",["http","entityTabsService","$routeParams",n.Contact.Services.EnergovBusinessTypesService]).service("energovLinkedLicensesService",["http","entityTabsService","$routeParams",n.Contact.Services.EnergovLinkedLicensesService]).service("enerGovBusinessEntityService",["http",n.Business.Services.EnerGovEntityBusinessService]).service("enerGovBusinessCardsService",["http",n.Business.Services.EnerGovBusinessCardsService]).controller("enerGovBusinessViewController",["$routeParams","$location","globalsService","enerGovBusinessService","enerGovCustomFieldsService","customFieldsService","pageTitleService","tabNavigatorService","entityTabsService",i]).controller("energovBusinessTypesController",["$routeParams","$location","globalsService","energovBusinessTypesService","entitySecondaryDataService",n.License.Controllers.EnergovBusinessTypesController]).controller("energovLinkedLicensesController",["$routeParams","$location","globalsService","energovLinkedLicensesService","entitySecondaryDataService",n.License.Controllers.EnergovLinkedLicensesController]).controller("enerGovBusinessEntityController",["$routeParams","$location","enerGovBusinessEntityService","entityTabsService",n.Business.Controller.EnerGovBusinessEntityController]).controller("enerGovBusinessCardsController",["$routeParams","$location","enerGovBusinessCardsService","menuService","resourceService","userService","locationService",n.Business.Controller.EnerGovBusinessCardsController])})(t=n.Business||(n.Business={}))}(EnerGov||(EnerGov={}));__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){"use strict";var i=app.Common.HoldType,r=app.Common.SelfServiceModules,t,u;(function(n){n[n.FailedInspection=1]="FailedInspection";n[n.UnpaidFees=2]="UnpaidFees";n[n.ResubmitFiles=3]="ResubmitFiles";n[n.RequestInspection=4]="RequestInspection"})(t=n.SummaryActions||(n.SummaryActions={}));u=function(n){function u(t,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k){var d=n.call(this,null)||this,g;return d.$location=t,d.$routeParams=i,d.cartService=r,d.enerGovInvoiceService=u,d.enerGovEntityInspectionSearchService=f,d.enerGovAttachmentCardsService=e,d.eReviewsService=o,d.tabNavigatorService=s,d.enerGovEntityFeeSearchService=h,d.userService=c,d.selfServiceStateService=l,d.enerGovWorkflowActivitySummaryService=a,d.tenantService=v,d.$q=y,d.globalService=p,d.$window=w,d.settingsService=b,d.intentsService=k,d.actions=[],d.unpaidInvoiceIds=[],d.cartItems=[],d.failedInspections=[],d.errorMessage="",d.submittalMap=[],d.restrictHoldOnParent=!1,d.useNewRequestInspections=!1,d.isTenantUsesTylerPayments=function(){var n=d;d.tenantService.isTylerPaymentsUsed(function(t){n.isTylerPaymentsUsed=t;t&&(n.inTylerCartInvoiceIds=n.cartService.tylerCartItems)})},d.findInspection=function(n,t){return n.filter(function(n){return n.moduleId===t})[0]},g=d,g.setup(),g.isTenantUsesTylerPayments(),d}return __extends(u,n),u.prototype.isPendingInvoice=function(n){var t=this,i=t.inTylerCartInvoiceIds&&t.inTylerCartInvoiceIds.length>0?t.inTylerCartInvoiceIds.filter(function(t){return t===n}):[];return i.length>0?!0:!1},u.prototype.gotoInvoiceToPay=function(n){var t=this;t.$location.path("/invoice/"+n)},u.prototype.payNow=function(){var t=this,n=this;this.detailedUnpaidInvoices!=null&&this.detailedUnpaidInvoices.length>0&&(angular.forEach(this.detailedUnpaidInvoices,function(t){var i={ItemName:t.InvoiceDescription,Due:t.InvoiceDueDate,Invoice:t.InvoiceNumber,InvoiceId:t.InvoiceId,BillingContact:t.BillingContact,ContactAddresses:t.ContactAddresses==null||t.ContactAddresses.length==0?[]:t.ContactAddresses,HomePhone:t.HomePhone,BusinessPhone:t.BusinessPhone,OtherPhone:t.OtherPhone,MobilePhone:t.MobilePhone,InvoiceEntityList:t.InvoiceEntities,InvoiceFees:t.InvoiceFees==null||t.InvoiceFees.length==0?[]:t.InvoiceFees},r={CartItemId:-1,CartDirectiveName:"energov-cart",CartData:angular.toJson(i),CartDataId:t.InvoiceId,UserId:-1,TenantId:-1,SoftwarePackageId:-1,SoftwarePackageName:"",Amount:t.TotalDue,IsNew:!0,IsDeleted:!1};n.cartItems.push(r)}),n.cartService.addCartItems(this.cartItems,function(i){i&&(t.cartService.didCallGetTotalItem=!1,n.cartService.updateTotalNumOfItems(),n.cartService.didCallGetTotalItem=!0,n.$location.url("/mycart"))}))},u.prototype.resubmitFiles=function(n){if(this.enerGovAttachmentCardsService.showEReviewResubmitStepper){var t=this.submittalMap.filter(function(t){return t.Key===n}),i=t.length>0?t[0].Value:null;this.enerGovAttachmentCardsService.toResubmitStepper(i)}else this.tabNavigatorService.navigate(app.Constants.TabConstants.Attachments)},u.prototype.reschedule=function(n){var t=this;this.settingsService.getSoftwarePackageSetting("UseUpdatedInspectionRequests",function(i){var u,r;if(t.useNewRequestInspections=i&&i.SettingValue==="true",t.useNewRequestInspections)t.intentsService.getIntent("View","RequestInspections","Default",function(i){var s=i.URI,r=[],u={moduleId:t.moduleId,workflowActionIds:[n.actionId],entityId:t.$routeParams.id},o=t.settingsService.getRequestInspections(),e,f;o?(e=JSON.parse(o),e.length===0?r.push(u):(f=t.findInspection(e,t.moduleId),f?(f.workflowActionIds=u.workflowActionIds.filter(function(n,t,i){return i.indexOf(n)===t}),r.push(f)):r.push(u))):r.push(u);t.settingsService.storeRequestInspections(r);t.$window.open(s,"_blank")});else{for(u=null,r=0;r<t.failedInspections.length;r++)if(t.failedInspections[r].WorkflowActionId===n.actionId&&t.failedInspections[r].WorkflowStepId===n.stepId){u=t.failedInspections[r];break}u!=null&&(t.enerGovEntityInspectionSearchService.entityRemainingInspections=[],t.enerGovEntityInspectionSearchService.entityRemainingInspections.push(u));switch(t.moduleId){case app.Common.SelfServiceModules.Permit:t.$location.path("/permit/request/inspections/"+t.$routeParams.id+"/false");break;case app.Common.SelfServiceModules.Plan:t.$location.path("/plan/request/inspections/"+t.$routeParams.id+"/false");break;case app.Common.SelfServiceModules.BusinessLicense:t.$location.path("/businessLicense/request/inspections/"+t.$routeParams.id+"/false");break;case app.Common.SelfServiceModules.ProfLicense:t.$location.path("/profLicense/request/inspections/"+t.$routeParams.id+"/false");break;case app.Common.SelfServiceModules.OperationalPermit:t.$location.path("/operationalPermit/request/inspections/"+t.$routeParams.id+"/false")}}})},u.prototype.getInspections=function(){var n=this,i={EntityId:this.$routeParams.id,IsExistingInspection:!1,IsFailed:!0,IsOptionalInspection:!1,IsSortedInAscendingOrder:!0,ModuleId:this.moduleId,PageNumber:1,PageSize:1e3,SortField:""};this.enerGovEntityInspectionSearchService.searchByCriteria(i,function(i){i!=null&&i.Result!=null&&(n.failedInspections=i.Result,i.Result.forEach(function(i){if(i.CanRequestInspection&&i.IsAllowRequestInspectionByPriority&&!i.IsPreventRequestInspection){var r={name:i.InspectionTypeDescription,id:i.EntityId,action:t.RequestInspection,date:null,actionId:i.WorkflowActionId,stepId:i.WorkflowStepId,order:4};i.IsReinspectionDisplayText!=null&&i.IsReinspectionDisplayText==="Yes"&&(r.action=t.FailedInspection,r.order=1,r.parentInspectionStatus=i.ParentInspectionStatus.replace(/inspection$/i,""));n.actions.push(r)}}))})},u.prototype.getUnpaidFees=function(){var n=this,i={PageNumber:1,PageSize:1e3,SortField:"",IsSortedInAscendingOrder:!0,ModuleId:this.moduleId,EntityId:this.$routeParams.id,IsRemainingFee:!0};this.enerGovEntityFeeSearchService.searchByCriteria(i,function(i){if(i!=null&&i.Result!=null){for(var r=0;r<i.Result.length;r++)n.unpaidInvoiceIds.indexOf(i.Result[r].InvoiceId)<=-1&&n.unpaidInvoiceIds.push(i.Result[r].InvoiceId);n.enerGovInvoiceService.getAnonymousInvoiceEntitiesList(n.unpaidInvoiceIds,function(i){n.detailedUnpaidInvoices=i;i!=null&&i.length>0&&i.forEach(function(i){var r={name:i.TotalDue.toString(),id:i.InvoiceId,action:t.UnpaidFees,date:moment(i.InvoiceDueDate).format("MM-DD-YYYY"),actionId:null,stepId:null,order:3};n.actions.push(r)})})}})},u.prototype.getFilesToResubmit=function(){var n=this;this.$q.all([this.eReviewsService.getEnerGovEReviewEnableSetting(function(){}),this.eReviewsService.isEReviewCaseTypePromise]).then(function(){(n.eReviewsService.isEnerGovEReviewEnable&&n.eReviewsService.isEReviewCaseType||app.Common.Helpers.VersionSupport(n.globalService.enerGovAPIVersion,"2022.2.0.0"))&&n.eReviewsService.getEReviewProjectByEntityId(n.$routeParams.id,n.moduleId,function(i){i!=null&&i.Result!=null&&(app.Common.Helpers.VersionSupport(n.globalService.enerGovAPIVersion,"2022.2.0.0")&&i.Result.HasAuthorizedContact&&(n.moduleId===app.Common.SelfServiceModules.Permit||n.moduleId===app.Common.SelfServiceModules.Plan)?n.eReviewsService.getEReviewSubmissionInfoByEntityId(n.$routeParams.id,n.moduleId,function(t){t.Result&&t.Success&&n.getEReviewResubmissionFiles(t.Result.IsCategoryView,t.Result)}):i.Result.ERProjectFiles.forEach(function(i){if(i.AllowRevisionFileUpload){var r={name:i.FileName,id:i.ERProjectFileID,action:t.ResubmitFiles,date:i.NextFileVersion.toString(),actionId:null,stepId:null,order:2};n.actions.push(r);i.ERProjectFileVersions.length>0&&n.submittalMap.push({Key:i.FileName,Value:i.ERProjectFileVersions[0].SubmittalID})}}))})})},u.prototype.setup=function(){var n=this,t=this,u;this.moduleId=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id);u=t.$routeParams.id;this.selfServiceStateService.observeParentModel().then(null,null,function(t){if(t.EntityHolds&&t.EntityHolds.length>0){var u=t.EntityHolds;switch(n.moduleId){case r.Permit:u.filter(function(n){return n.HoldTypeID==i.StopActionAndAlert&&(n.HoldSetupInfo.PermitInspection||n.HoldSetupInfo.EntOnlineInspectionRequest)}).length>0&&(n.restrictHoldOnParent=!0);break;case r.Plan:u.filter(function(n){return n.HoldTypeID==i.StopActionAndAlert&&(n.HoldSetupInfo.PlanInspection||n.HoldSetupInfo.EntOnlineInspectionRequest)}).length>0&&(n.restrictHoldOnParent=!0)}}n.moduleId==app.Common.SelfServiceModules.Permit?!t.IsLoggedIn||t.ActiveHolds||t.UnPaidFees||!t.Issued||n.restrictHoldOnParent||n.getInspections():n.moduleId==app.Common.SelfServiceModules.Plan&&(!t.IsLoggedIn||t.UnPaidFees||t.HoldExist||n.restrictHoldOnParent||n.getInspections())});this.enerGovWorkflowActivitySummaryService.getActivitiesActionPermission(this.moduleId,u,function(i){i.StatusCode==app.Common.Services.HttpStatusCode.PreconditionFailed?t.errorMessage=i.ErrorMessage:(n.moduleId>0&&n.getUnpaidFees(),n.getFilesToResubmit())})},u.prototype.getEReviewResubmissionFiles=function(n,i){var r=this,u,f,e;n?(f=i.CategorySummary.Categories.some(function(n){return n.HasFilesThatNeedResubmission==!0}),f&&(e={name:null,id:null,action:t.ResubmitFiles,date:null,actionId:null,stepId:null,order:2,isCategoryView:!0},this.actions.push(e))):(u=i.FileSummary.Files,u.forEach(function(n){if(n.AllowResubmission){var i={name:n.FileName,id:n.EReviewProjectFileId,action:t.ResubmitFiles,date:(n.FileVersion+1).toString(),actionId:null,stepId:null,order:2};r.actions.push(i);r.submittalMap.push({Key:n.FileName,Value:n.SubmittalId})}}))},u}(app.Core.Controllers.CoreController);n.EnerGovActionsSummaryController=u})(t=n.Summary||(n.Summary={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u,f,e,o,s,h,c){var l=n.call(this,i,r,u,f,null,!1)||this,a;return l.$scope=t,l.$routeParams=i,l.$location=r,l.energovEntitySummaryFeesCardService=f,l.selfServiceStateService=e,l.cartService=o,l.enerGovMyInvoiceSearchService=s,l.tabNavigatorService=h,l.tenantService=c,l.pendingAddCartItems=[],l.maxPageSize=1e5,l.isTenantUsesTylerPayments=function(){var n=l;l.tenantService.isTylerPaymentsUsed(function(t){n.isTylerPaymentsUsed=t})},l.totoalDueAmmount=0,l.feesDetailUrl="#"+l.$location.path()+"/?tab="+app.Constants.PermitTabs.fees,a=l,a.isTenantUsesTylerPayments(),a.criteria={PageNumber:1,PageSize:a.maxPageSize,SortField:"",IsSortedInAscendingOrder:!0,ModuleId:a.searchCriteria.ModuleId,EntityId:a.searchCriteria.EntityId,IsRemainingFee:!0},a.search(a.criteria,app.Events.SearchEvents.SearchCompleted),a.selfServiceStateService.observeParentModel().then(null,null,function(n){n.IsLoggedIn&&n.HasAuthorizedContact&&n.AllowPayNow&&n.UnPaidInvoicedFees!=null&&n.UnPaidInvoicedFees?a.isTylerPaymentsUsed?a.showViewDetail=!a.cartService.getInCartStatus(n.UnpaidInvoiceIds):a.cartService.getPendingInvoices(n.UnpaidInvoiceIds,function(t){a.invoicesPending=t;t.length>0&&t.length==n.UnpaidInvoiceIds.length?(a.showPayNow=!1,a.showViewDetail=!1):(a.showPayNow=!0,a.showViewDetail=!0)}):a.showPayNow=!0}),l}return __extends(t,n),t.prototype.search=function(t,i){t.IsRemainingFee=!0;var r=this;n.prototype.search.call(this,r.criteria,i,function(n){var t=0;angular.forEach(n,function(n){t=t+n.AmountDue});r.totoalDueAmmount=parseFloat(t.toFixed(2))})},t.prototype.payNow=function(){var i=this,n=this,t;this.selfServiceStateService.parentModel.UnpaidInvoiceIds!=null&&this.selfServiceStateService.parentModel.UnpaidInvoiceIds.length>0&&(t=_.difference(this.selfServiceStateService.parentModel.UnpaidInvoiceIds,this.invoicesPending),this.enerGovMyInvoiceSearchService.getDetailInvoices(t,!1,function(t){t!=null&&t.length>0&&(angular.forEach(t,function(t){var i={ItemName:t.InvoiceDescription,Due:t.InvoiceDueDate,Invoice:t.InvoiceNumber,InvoiceId:t.InvoiceId,BillingContact:t.BillingContact,ContactAddresses:t.ContactAddresses==null||t.ContactAddresses.length==0?[]:t.ContactAddresses,HomePhone:t.HomePhone,BusinessPhone:t.BusinessPhone,OtherPhone:t.OtherPhone,MobilePhone:t.MobilePhone,InvoiceEntityList:t.InvoiceEntities,InvoiceFees:t.InvoiceFees==null||t.InvoiceFees.length==0?[]:t.InvoiceFees},r={CartItemId:-1,CartDirectiveName:"energov-cart",CartData:angular.toJson(i),CartDataId:t.InvoiceId,UserId:-1,TenantId:-1,SoftwarePackageId:-1,SoftwarePackageName:"",Amount:t.TotalDue,IsNew:!0,IsDeleted:!1};n.pendingAddCartItems.push(r)}),n.cartService.addCartItems(i.pendingAddCartItems,function(t){t&&(n.cartService.didCallGetTotalItem=!1,n.cartService.updateTotalNumOfItems(),n.cartService.didCallGetTotalItem=!0,n.$location.url("/mycart"))}))}))},t}(app.Common.Controllers.PagedSearchController);n.EnerGovEntitySummaryFeesCardController=t})(t=n.Summary||(n.Summary={}))}(EnerGov||(EnerGov={}));__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){"use strict";var r=app.Common.Helpers.VersionSupport,i=n.Common.CaseTypeUseEnums.AttentionReasonCode,u=function(n){function t(t,i,r,u,f,e,o,s,h){var c=n.call(this,null)||this,l,a;return c.$routeParams=t,c.$location=i,c.globalService=r,c.enerGovPermitService=u,c.enerGovPlanService=f,c.submittalSearchService=e,c.enerGovEntityInspectionSearchService=o,c.enerGovMyInvoiceSearchService=s,c.eReviewsService=h,c.summarySelectedTab=1,c.showFilesTab=!1,c.isBillingContact=!1,l=c,l.cleanup(),l.eReviewsService.isEnerGovEReviewEnable=!1,a=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(c.$location,c.$routeParams.id),a==app.Common.SelfServiceModules.Permit?c.enerGovPermitService.getPermitDetail(c.$routeParams.id,function(n){l.callback(n)}):a==app.Common.SelfServiceModules.Plan&&c.enerGovPlanService.getById(c.$routeParams.id,function(n){l.callback(n)}),c}return __extends(t,n),t.prototype.back=function(){window.history.back()},t.prototype.cleanup=function(){this.submittalSearchService.isDataPresent=!1;this.enerGovEntityInspectionSearchService.isExistingInspectionsDataPresent=!1;this.enerGovMyInvoiceSearchService.isUnpaidInvoiceDataPresent=!1},t.prototype.callback=function(n){var t=this;if((t.model=n,t.model!=null)&&(t.isBillingContact=n.IsBillingContact,t.eReviewsService.isEnerGovEReviewEnable=n.EReviewEnable,t.eReviewsService.isEReviewCaseType=n.IsEReviewCaseType,r(this.globalService.enerGovAPIVersion,"2017.5.1.45")&&t.eReviewsService.isEnerGovEReviewEnable&&t.eReviewsService.isEReviewCaseType&&(this.showFilesTab=!0,this.summarySelectedTab=0),this.$routeParams.statusReasonCode!==undefined))switch(this.$routeParams.statusReasonCode){case i.FailedEReviewFiles.toString():r(this.globalService.enerGovAPIVersion,"2017.5.1.45")&&t.eReviewsService.isEnerGovEReviewEnable&&t.eReviewsService.isEReviewCaseType&&(this.summarySelectedTab=0);break;case i.FailedSubmittals.toString():this.summarySelectedTab=1;break;case i.UnpaidFees.toString():this.summarySelectedTab=2;break;case i.FailedInspections.toString():this.summarySelectedTab=3}},t}(app.Core.Controllers.CoreController);t.EnerGovViewMyAttentionSummaryController=u})(t=n.Summary||(n.Summary={}))}(EnerGov||(EnerGov={}));__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){"use strict";var i,r;(function(n){n[n.Inspection=0]="Inspection";n[n.Hearing=1]="Hearing";n[n.Meeting=2]="Meeting";n[n.Submittal=3]="Submittal"})(i=t.ActivityTypeName||(t.ActivityTypeName={}));r=function(t){function r(r,u,f){var e=t.call(this,null)||this;return e.$location=r,e.$routeParams=u,e.enerGovWorkflowActivitySummaryService=f,e.workflowActivities=[],e.completedActivities=[],e.activityType=i,e.activityStatus=n.WorkflowSummary.Enums.ActivityStatus,e}return __extends(r,t),r.prototype.init=function(){var n=this,t=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(n.$location,n.$routeParams.id),i=n.$routeParams.id;n.enerGovWorkflowActivitySummaryService.getWorkflowActivitiesSummary(t,i,function(t){t.StatusCode==app.Common.Services.HttpStatusCode.PreconditionFailed?n.errorMessage=t.ErrorMessage:n.workflowActivities=t.Result})},r.prototype.getStatusIcon=function(t){switch(t.Status){case n.WorkflowSummary.Enums.ActivityStatus.LastCompletedWorkflowActivity:return"fas fa-check-circle wf-activity-passed";case n.WorkflowSummary.Enums.ActivityStatus.FailedWorkflowActivitiy:return"fas fa-exclamation-circle wf-activity-failed";case n.WorkflowSummary.Enums.ActivityStatus.PartialPassWorkflowActivitiy:return"fas fa-check-circle wf-activity-passed";case n.WorkflowSummary.Enums.ActivityStatus.ActiveWorkflowActivity:return"fas fa-dot-circle wf-activity-scheduled";case n.WorkflowSummary.Enums.ActivityStatus.UpcomingWorkflowActivity:return"far fa-circle wf-activity-NotStarted"}},r.prototype.getActivityCssClass=function(t){switch(t.Status){case n.WorkflowSummary.Enums.ActivityStatus.LastCompletedWorkflowActivity:return"wf-activity-passed";case n.WorkflowSummary.Enums.ActivityStatus.FailedWorkflowActivitiy:return"wf-activity-failed";case n.WorkflowSummary.Enums.ActivityStatus.PartialPassWorkflowActivitiy:return"wf-activity-passed";case n.WorkflowSummary.Enums.ActivityStatus.ActiveWorkflowActivity:return"wf-activity-started";case n.WorkflowSummary.Enums.ActivityStatus.UpcomingWorkflowActivity:return"wf-activity-NotStarted"}},r}(app.Core.Controllers.CoreController);t.EnerGovWorkflowActivitySummaryController=r})(t=n.Summary||(n.Summary={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/entity/summary/"}return n.prototype.searchByCriteria=function(n,t){this.http.post(this.rootUrl+"search/remainingfeestotoal",n,function(n){t(n)},!0)},n}();n.EnergovEntitySummaryFeesCardService=t})(t=n.Services||(n.Services={}))})(t=n.Summary||(n.Summary={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/workflow/summary/"}return n.prototype.getWorkflowActivitiesSummary=function(n,t,i){this.http.get(this.rootUrl+"activities/"+n+"/"+t,function(n){i(n)},!0)},n.prototype.getActivitiesActionPermission=function(n,t,i){this.http.get(this.rootUrl+"actionPermission/"+n+"/"+t,function(n){i(n)},!0)},n}();n.EnerGovWorkflowActivitySummaryService=t})(t=n.Services||(n.Services={}))})(t=n.Summary||(n.Summary={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){"use strict";var i=n.Summary.EnerGovViewMyAttentionSummaryController,r=n.Summary.EnerGovActionsSummaryController,u=n.Summary.Services.EnergovEntitySummaryFeesCardService,f=n.Summary.Services.EnerGovWorkflowActivitySummaryService;angular.module("enerGov.Summary",["app.globalsModule","app.Common.Services"]).service("energovEntitySummaryFeesCardService",["http",u]).service("enerGovWorkflowActivitySummaryService",["http",f]).controller("enerGovViewMyAttentionSummaryController",["$routeParams","$location","globalsService","enerGovPermitService","enerGovPlanService","enerGovEntitySubmittalSearchService","enerGovEntityInspectionSearchService","enerGovMyInvoiceSearchService","eReviewsService",i]).controller("enerGovEntitySummaryFeesCardController",["$scope","$routeParams","$location","globalsService","energovEntitySummaryFeesCardService","selfServiceStateService",app.Constants.ServiceConstant.CartService,"enerGovMyInvoiceSearchService","tabNavigatorService","tenantService",t.EnerGovEntitySummaryFeesCardController]).controller("energovActionsSummaryController",["$location","$routeParams",app.Constants.ServiceConstant.CartService,"enerGovInvoiceService","enerGovEntityInspectionSearchService","enerGovAttachmentCardsService","eReviewsService","tabNavigatorService","enerGovEntityFeeSearchService","userService","selfServiceStateService","enerGovWorkflowActivitySummaryService","tenantService","$q","globalsService","$window","settingsService","intentsService",r]).controller("enerGovWorkflowActivitySummaryController",["$location","$routeParams","enerGovWorkflowActivitySummaryService",t.EnerGovWorkflowActivitySummaryController])})(t=n.Summary||(n.Summary={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/workflow/summary/"}return n.prototype.getDonutData=function(n,t,i){this.http.get(this.rootUrl+"donut/"+n+"/"+t,function(n){i(n)},!0)},n}();n.DonutService=t})(t=n.Services||(n.Services={}))})(t=n.WorkflowSummary||(n.WorkflowSummary={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r){var u=n.call(this,null)||this,f;return u.$routeParams=t,u.$location=i,u.donutService=r,f=u,u}return __extends(t,n),t.prototype.setPieData=function(n,i,r){return n||i||r||(n=0,i=0,r=100),this.pieData=[],this.pieData.push({color:"#4caf50",percentage:n,name:t.CompletedStatus}),this.pieData.push({color:"#8DB6CD",percentage:i,name:t.InProgressStatus}),this.pieData.push({color:"#D3D3D3",percentage:r,name:t.NotStartedStatus}),this.pieData},t.prototype.init=function(){var n=this,i=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id),r=this.$routeParams.id,u=this;this.donutService.getDonutData(i,r,function(i){var r=i.Result.filter(function(n){return n.Key===t.CompletedStatus})[0].Y,u=i.Result.filter(function(n){return n.Key==t.InProgressStatus})[0].Y,f=i.Result.filter(function(n){return n.Key==t.NotStartedStatus})[0].Y;n.setPieData(r,u,f)})},t.CompletedStatus="Completed",t.InProgressStatus="In Progress",t.NotStartedStatus="Not Started",t}(app.Core.Controllers.CoreController);n.DonutController=t})(t=n.WorkflowSummary||(n.WorkflowSummary={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(){"use strict";var n=EnerGov.WorkflowSummary.Services.DonutService;angular.module("enerGov.WorkflowSummary",["app.globalsModule","app.Common.Services"]).service("donutService",["http",n]).controller("donutController",["$routeParams","$location","donutService",EnerGov.WorkflowSummary.DonutController])})(t=n.WorkflowSummary||(n.WorkflowSummary={}))}(Energov||(Energov={})),function(n){var t;(function(n){var t;(function(n){var t;(function(n){n[n.LastCompletedWorkflowActivity=0]="LastCompletedWorkflowActivity";n[n.UpcomingWorkflowActivity=1]="UpcomingWorkflowActivity";n[n.ActiveWorkflowActivity=2]="ActiveWorkflowActivity";n[n.FailedWorkflowActivitiy=3]="FailedWorkflowActivitiy";n[n.PartialPassWorkflowActivitiy=4]="PartialPassWorkflowActivitiy"})(t=n.ActivityStatus||(n.ActivityStatus={}))})(t=n.Enums||(n.Enums={}))})(t=n.WorkflowSummary||(n.WorkflowSummary={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/ApplicationAssistant/"}return n.prototype.searchCaseTypes=function(n,t){this.http.post(this.rootUrl+"search/",'"'+n+'"',function(n){t(n.Result)},!1)},n.prototype.getApplicationHistory=function(n){this.http.get(this.rootUrl,function(t){t.Success&&n(t)},!1)},n.prototype.getApplicationTrending=function(n,t){this.http.post(this.rootUrl+"trending/",n,function(n){n.Success&&t(n)},!1)},n}();n.EnerGovApplicationAssistantService=t})(t=n.Services||(n.Services={}))})(t=n.ApplicationAssistant||(n.ApplicationAssistant={}))}(EnerGov||(EnerGov={}));__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=n.Common.CaseTypeUseEnums.ApplicationAssistantModules,u=n.Common.CaseTypeUseEnums.MenuActionType,e=function(){function n(){this.Categories=[]}return n}(),r,f;t.ApplyModule=e;r=function(){function n(){this.output=""}return n.prototype.Join=function(n,t){var i='"'+n+'": "'+t+'"';this.output=this.output==""?i:this.output+", "+i},n.prototype.ToString=function(){return this.output="",this.Section&&this.Join("sectionName",this.Section),this.Module&&this.Join("moduleId",this.Module),this.Category&&this.Join("categoryName",this.Category),this.IsShowTemplate!=undefined&&this.Join("showTemplates",this.IsShowTemplate),this.CaseTypes&&this.Join("caseTypes",this.CaseTypes),"{"+this.output+"}"},n.prototype.ToObject=function(){return JSON.parse(this.ToString())},n}();t.RouteParameters=r;f=function(t){function f(n,i,u,f,e,o,s,h,c,l,a,v){var y=t.call(this,null)||this,p;return y.menuService=n,y.tenantSettingService=i,y.tenantService=u,y.resourceService=f,y.enerGovApplicationAssistantService=e,y.location=o,y.$routeParams=s,y.$q=h,y.$window=c,y.userService=l,y.globalService=a,y.enerGovMyTemplatesSearchService=v,y.tileCount=2,y.showTemplateData=!1,y.TemplateData=[],y.applicationAssistantAllSection="All",y.applicationAssistantTrendingSection="Trending",y.applicationAssistantMyHistorySection="MyHistory",y.applyModules=[],y.applicationHistoryMenuItems=[],y.applicationTrendingMenuItems=[],y.applicationAssistantHistory=[],y.applicationAssistantHistoryItem=[],y.applicationAssistantTrending=[],y.caseTypeNames=[],y.caseTypeTags=[],y.allCategoryName="All",y.showMenuItemCount=!1,y.allSectionMenuItem=[],y.searchText="",y.allCategoryId=-1,y.isCollapsed=!0,y.showCategories=!0,y.showApplicationAssistantView=!0,y.isAppNavigatorEnable=!1,y.shouldOpenWithinCSSIframe=!0,y.rightColumnWidth="col-md-12",y.labelColumnWidth="col-md-11",y.applyColumnWidth="col-md-2 col-lg-1",y.menuTabIndex=0,p=y,p.routeParameters=new r,p.routeParameters.Module=p.$routeParams.moduleId?parseInt(p.$routeParams.moduleId):0,p.routeParameters.Category=p.$routeParams.categoryName?p.$routeParams.categoryName:"",p.routeParameters.Section=p.$routeParams.sectionName?p.$routeParams.sectionName:"",p.routeParameters.IsShowTemplate=p.$routeParams.showTemplates?p.$routeParams.showTemplates:p.$routeParams.showTemplates==""?!0:!1,p.routeParameters.CaseTypes=p.$routeParams.caseTypes?p.$routeParams.caseTypes:"",p.menuTabIndex=y.menuService.menuTabIndices.filter(function(n){return n.Key=="Apply"})[0].Value,y}return __extends(f,t),f.prototype.collapsePanel=function(){this.isCollapsed=!this.isCollapsed;this.showTemplateData&&(this.showTemplateData=!1);this.isCollapsed?(this.rightColumnWidth="col-md-12",this.labelColumnWidth="col-md-11",this.applyColumnWidth="col-md-2 col-lg-1"):(this.rightColumnWidth="col-md-9",this.labelColumnWidth="col-md-10 col-sm-9",this.applyColumnWidth="col-md-2 col-lg-2 col-sm-3")},f.prototype.getCategories=function(n){var t=this,i=[],r;return n&&(r={CategoryID:this.allCategoryId,CategoryName:this.allCategoryName,MenuItems:n},angular.forEach(n,function(n){var r=app.Core.Controllers.CoreController.findItemInArray(i,"CategoryID",n.CategoryID),u,f;r===null&&n.CategoryID&&(r={CategoryID:n.CategoryID,CategoryName:n.CategoryName,MenuItems:[]},i.push(r));n.IsHidden=!1;t.routeParameters.CaseTypes&&(u=t.routeParameters.CaseTypes,f=u.split(","),f.indexOf(n.CaseTypeInfo.CaseTypeId.toString())<0&&(n.IsHidden=!0));n.CaseTypeInfo.CaseTypeIconUrl=n.CaseTypeInfo.CaseTypeIconUrl?n.CaseTypeInfo.CaseTypeIconUrl:t.setDefaultIcon(n.CategoryObjectID);r.MenuItems.push(n);t.allSectionMenuItem.push(n);t.caseTypeNames.push(n.Label);n&&n.CaseTypeInfo&&n.CaseTypeInfo.CaseTypeTags&&n.CaseTypeInfo.CaseTypeTags.forEach(function(n){return t.caseTypeTags.push(n)})}),i.length>1&&i.unshift(r)),i},f.prototype.setDefaultIcon=function(t){var i="";if(this.tenantApplicationAssistantIconSetting)switch(t){case n.Common.CaseTypeUseEnums.AgreementType.Permit:i=this.tenantApplicationAssistantIconSetting.DefaultPermitIcon;break;case n.Common.CaseTypeUseEnums.AgreementType.Plan:i=this.tenantApplicationAssistantIconSetting.DefaultPlanIcon;break;case n.Common.CaseTypeUseEnums.AgreementType.ProfessionalLicense:case n.Common.CaseTypeUseEnums.AgreementType.BusinessLicense:i=this.tenantApplicationAssistantIconSetting.DefaultLicenseIcon}return i},f.prototype.selectModule=function(n,t,i){var r,u;i===void 0&&(i=!1);r=this;NProgress.start();r.globalService.showProcessing=!0;r.showMenuItemCount=!1;this.showTemplateData&&!i&&(this.showTemplateData=!1);this.activeSection=n;this.currentModule!==t.ModuleName?(this.currentModule=t.ModuleName,this.currentCategory=t.Categories.indexOf(this.currentCategory)>-1?this.currentCategory:t.Categories[0],u=this.currentCategory?this.currentCategory.CategoryName:"",this.updateUrl(n,t.ModuleId,u,i)):(this.currentModule="",this.currentCategory=null,this.updateUrl(n,0,"",i));this.$timeout(function(){NProgress.done();r.globalService.showProcessing=!1},300);window.scrollTo(0,0)},f.prototype.getMyApplicationHistory=function(){var n=this,t=this.menuService.getApplyMenu();this.applicationAssistantHistory.length===0&&this.userService.isUserLoggedIn&&this.enerGovApplicationAssistantService.getApplicationHistory(function(i){n.applicationAssistantHistory=i.Result;n.applicationAssistantHistory.length>0&&n.applicationHistoryMenuItems.length===0&&n.createApplicationHistoryData(t)})},f.prototype.selectSection=function(n,t){t===void 0&&(t=!1);var i=this;NProgress.start();i.globalService.showProcessing=!0;i.showMenuItemCount=!1;this.showTemplateData&&!t&&(this.showTemplateData=!1);n&&n.toLowerCase().toString()===this.applicationAssistantMyHistorySection.toLowerCase().toString()?(this.getMyApplicationHistory(),this.showMenuItemCount=this.applicationHistoryMenuItems.length>0):n&&n.toLowerCase().toString()!==this.applicationAssistantTrendingSection.toLowerCase().toString()||(n=this.applicationAssistantTrendingSection,this.applicationTrendingMenuItems.length>0||this.getApplicationAssistantTrending());this.activeSection!==n||this.activeSection===this.applicationAssistantAllSection&&this.routeParameters.Module!==0?(this.activeSection=n,this.currentModule="",this.currentCategory=null,this.updateUrl(n,0,"",t)):(this.activeSection="",this.currentModule="",this.currentCategory=null,this.updateUrl("",0,"",t));this.$timeout(function(){NProgress.done();i.globalService.showProcessing=!1},300);window.scrollTo(0,0)},f.prototype.isActiveModule=function(n){return this.currentModule===n.ModuleName},f.prototype.setFilter=function(n,t,i,r){(this.currentModule!==t||this.currentCategory.CategoryID!==r.CategoryID)&&(this.currentModule=t,this.currentCategory=r,this.updateUrl(n,i,r.CategoryName),window.scrollTo(0,0))},f.prototype.isActiveFilter=function(n,t){return this.currentModule==n&&this.currentCategory.CategoryID==t.CategoryID},f.prototype.isActiveSection=function(n){return this.activeSection==n},f.prototype.getMenuItemLabel=function(n){return n.CategoryName!==""?n.CategoryName+" : "+n.Label:n.Label},f.prototype.getNavigationUrl=function(n){var t="",i;if(n.Route&&n.Route!=="")try{i=JSON.parse(n.Route);t=i.NavigationUrl;t=t.replace(":menuId",n.MenuID.toString().trim());t=t.replace(":draftId","0");t=t.replace(":actionTypeId",u.Apply.toString())}catch(r){t=""}return t},f.prototype.create=function(n){var t=this.getNavigationUrl(n);return this.menuService.setSelectedMenuItem(n),t!==""?"#/"+t:void 0},f.prototype.showTemplate=function(){this.showTemplateData||this.activeSection===this.applicationAssistantAllSection&&this.routeParameters.Module===0?this.updateUrl(this.activeSection,0,"",!this.showTemplateData):this.selectSection(this.applicationAssistantAllSection,!0);this.showTemplateData=!this.showTemplateData},f.prototype.createTemplateUrl=function(n,t){var i="/"+u.UseTemplate.valueOf();return n.indexOf("?")>=0?"#/"+n.split("?")[0]+t+i+"?"+n.split("?")[1]:"#/"+n+t+i},f.prototype.init=function(){var n=this;n.showApplicationAssistantView=!0;n.applicationAssistantView()},f.prototype.setApplicationAssistantData=function(){var t=this;if(NProgress.start(),t.globalService.showProcessing=!0,t.applyMenu=this.menuService.getApplyMenu(),t.applyMenu!=null){t.allSectionMenuItem=[];var u=t.getApplicationAssistantSettings(),r=t.getResources(),f=t.getTenantApplicationAssistantIconSetting();t.getTemplateData(r);t.routeParameters.IsShowTemplate===!0&&(t.showTemplateData=!0);t.$q.all([u,r,f]).then(function(){t.createApplyModules(t.applyMenu,t.applicationAssistantHideLicenses,i[i.LICENSES],t.licenseCardDescription,"fas fa-id-card",n.Common.CaseTypeUseEnums.FilterModule.License);t.createApplyModules(t.applyMenu,t.applicationAssistantHidePermits,i[i.PERMITS],t.permitCardDescription,"fas fa-building",n.Common.CaseTypeUseEnums.FilterModule.Permit);t.createApplyModules(t.applyMenu,t.applicationAssistantHidePlans,i[i.PLANS],t.planCardDescription,"fas fa-building",n.Common.CaseTypeUseEnums.FilterModule.Plan);t.routeParameters.Module&&t.routeParameters.Module>0?t.applyModules.forEach(function(n){n.ModuleId===t.routeParameters.Module&&(t.routeParameters.Category&&n.Categories.forEach(function(n){n.CategoryName.toLowerCase()===t.routeParameters.Category.toLowerCase()&&(t.currentCategory=n)}),t.selectModule(t.applicationAssistantAllSection,n,t.showTemplateData),t.currentModule=n.ModuleName)}):t.selectSection(t.routeParameters.Section,t.showTemplateData);t.userService.isUserLoggedIn&&(t.tileCount+=1);NProgress.done();t.globalService.showProcessing=!1;t.setWidth();sessionStorage.setItem("tyler.css.setFocusId","input-applicationAssistantSearchBar")});angular.element(t.$window).bind("resize",function(){t.setWidth()})}},f.prototype.getTemplateData=function(n){var t=this,i;t.userService.isUserLoggedIn&&(i={PackageName:"EnerGov",TemplateType:"ALL",PageNumber:1,SortField:"",IsSortedInAscendingOrder:!0,PageSize:100,TenantId:t.globalService.tenantId},t.enerGovMyTemplatesSearchService.searchByCriteria(i,function(i){angular.forEach(i.Result,function(i){var u=JSON.parse(i.Draft.DraftData),f=t.enerGovMyTemplatesSearchService.getFilteredSubMenuForTemplateSearch(t.applyMenu,i),r=f.SubMenus.filter(function(n){return n.CaseTypeInfo.PackageCaseTypeId==u.TypeId&&(n.CaseTypeInfo.PackageCaseClassId==u.WorkClassId||n.CaseTypeInfo.PackageCaseClassId=="N/A"&&u.WorkClassId==null)})[0];t.$q.all([n]).then(function(){if(r){var n={Template:i,CaseTypeInfo:r.CaseTypeInfo,CategoryName:r.CategoryName,CategoryObjectID:r.CategoryObjectID,Description:r.Description,IsHidden:r.IsHidden,Label:"("+t.applicationAssistantTemplateText+i.TemplateName+") "+i.Draft.DashboardType};n.CaseTypeInfo.CaseTypeIconUrl=n.CaseTypeInfo.CaseTypeIconUrl?n.CaseTypeInfo.CaseTypeIconUrl:t.setDefaultIcon(n.CategoryObjectID);t.TemplateData.push(n)}})})}))},f.prototype.setWidth=function(){var n=this,t=n.$window.innerWidth>0?n.$window.innerWidth:screen.width;n.tileWidth=t>=993?(100/n.tileCount).toString()+"%":"100%"},f.prototype.createApplyModules=function(n,t,i,r,u,f){var e=this;t.SettingValue==="false"&&n.SubMenus.forEach(function(n){var t=n.Label&&n.Label.length>0?n.Label:n.Details;i==n.Details&&(e.tileCount+=1,e.applyModules.push({ModuleName:t,Description:r,Categories:e.getCategories(n.SubMenus),IconClass:u,ModuleId:f}))})},f.prototype.createApplicationHistoryData=function(n){var t=this,r=this;n.SubMenus.forEach(function(n){if(n.SubMenus.length>0){var r=n.Details;angular.forEach(n.SubMenus,function(n){switch(r){case i[i.PERMITS]:t.applicationAssistantHidePermits.SettingValue==="false"&&t.filterMyHistoryCaseTypes(n);break;case i[i.PLANS]:t.applicationAssistantHidePlans.SettingValue==="false"&&t.filterMyHistoryCaseTypes(n);break;case i[i.LICENSES]:t.applicationAssistantHideLicenses.SettingValue==="false"&&t.filterMyHistoryCaseTypes(n)}})}})},f.prototype.filterMyHistoryCaseTypes=function(n){var t=this.applicationAssistantHistory.filter(function(t){return(t.ClassId===n.CaseTypeInfo.PackageCaseClassId||t.ClassId=="")&&t.TypeId===n.CaseTypeInfo.PackageCaseTypeId})[0];t!==undefined&&(n.Count=t.Count,this.applicationHistoryMenuItems.push(n));this.showMenuItemCount=this.applicationHistoryMenuItems.length>0},f.prototype.filterCaseTypeNames=function(n){var t=this.caseTypeNames.filter(function(t){return t.toLowerCase().indexOf(n.toLowerCase())>=0}),i=this.caseTypeTags.filter(function(t){return t.toLowerCase().indexOf(n.toLowerCase())>=0}),r=t?t.concat(i):i;return r.filter(function(n,t,i){return t==i.indexOf(n)})},f.prototype.searchCaseTypesBySearchText=function(){var n=this,t=this.caseTypeNames.filter(function(t){return t.toLowerCase()==n.searchText.toLowerCase()}).length>0||this.caseTypeTags.filter(function(t){return t.toLowerCase()==n.searchText.toLowerCase()}).length>0;n.searchText?t?n.filterCaseTypes([],!1,!0):n.enerGovApplicationAssistantService.searchCaseTypes(n.searchText,function(t){n.filterCaseTypes(t,!1)}):n.filterCaseTypes([],!0)},f.prototype.filterCaseTypes=function(n,t,i){i===void 0&&(i=!1);var r=this;r.applyModules.forEach(function(u){u.Categories.forEach(function(u){u.MenuItems.forEach(function(u){u.IsHidden=!t;i?(u.Label.toLowerCase().indexOf(r.searchText.toLowerCase())>=0||u.CaseTypeInfo&&u.CaseTypeInfo.CaseTypeTags&&u.CaseTypeInfo.CaseTypeTags.filter(function(n){return n.toLowerCase().indexOf(r.searchText.toLowerCase())>=0}).length>0)&&(u.IsHidden=!1):n.forEach(function(n){n.MenuID==u.MenuID&&(u.IsHidden=!1)})})})});r.activeSection=r.applicationAssistantAllSection;r.currentModule="";r.currentCategory=null;r.updateUrl(r.activeSection,0,"")},f.prototype.getApplicationAssistantSettings=function(){var n=this,t=n.$q.defer();return n.tenantSettingService.getSettings(function(i){angular.forEach(i,function(t){t.SettingName==="ApplicationAssistantHideLicenses"?n.applicationAssistantHideLicenses=t:t.SettingName==="ApplicationAssistantHidePermits"?n.applicationAssistantHidePermits=t:t.SettingName==="ApplicationAssistantHidePlans"&&(n.applicationAssistantHidePlans=t)});t.resolve()}),t.promise},f.prototype.getTenantApplicationAssistantIconSetting=function(){var n=this,t=n.$q.defer();return n.tenantService.getTenantApplicationAssistantIconSetting(function(i){i!=null&&(n.tenantApplicationAssistantIconSetting=i);t.resolve()}),t.promise},f.prototype.getApplicationAssistantHistory=function(){var n=this,t=n.$q.defer();return n.userService.isUserLoggedIn?n.enerGovApplicationAssistantService.getApplicationHistory(function(i){n.applicationAssistantHistory=i.Result;t.resolve()}):t.resolve(),t.promise},f.prototype.getTenantAppNavigatorSettingandUserData=function(){var n=this,t=n.$q.defer();return n.tenantService.getTenantAppNavigatorSetting(function(i){i?(n.appNavigatorUrl=i.NavigatorUrl,n.isAppNavigatorEnable=i.IsAppNavigatorEnable,n.shouldOpenWithinCSSIframe=i.ShouldOpenWithinCSSIframe,n.userService.isUserLoggedIn&&i.IsAppNavigatorEnable?n.userService.getUser(function(i){n.userData=i;n.showApplicationAssistantView=n.userData.Visited.valueOf()||n.$location.search()&&JSON.stringify(n.location.search())!="{}";t.resolve()}):(n.showApplicationAssistantView=!i.IsAppNavigatorEnable||n.$location.search()&&JSON.stringify(n.location.search())!="{}",t.resolve())):(n.showApplicationAssistantView=!0,t.resolve())}),t.promise},f.prototype.getApplicationAssistantTrending=function(){var n=this,t={CaseTypeWorkClass:[],NumberOfRecords:10};n.applyMenu.SubMenus.forEach(function(n){n.SubMenus.length>0&&n.SubMenus.forEach(function(n){var i={CaseTypeId:n.CaseTypeInfo.PackageCaseTypeId,WorkClassId:n.CaseTypeInfo.PackageCaseClassId!="N/A"?n.CaseTypeInfo.PackageCaseClassId:null};t.CaseTypeWorkClass.push(i)})});n.enerGovApplicationAssistantService.getApplicationTrending(t,function(t){t.Result&&(n.applicationAssistantTrending=t.Result,n.applicationAssistantTrending.forEach(function(t){n.applyMenu.SubMenus.forEach(function(i){var r=i.SubMenus.filter(function(n){return n.CaseTypeInfo.PackageCaseTypeId===t.TypeId&&(n.CaseTypeInfo.PackageCaseClassId===t.ClassId||n.CaseTypeInfo.PackageCaseClassId==="N/A")})[0];r&&(r.Count=t.Count,n.applicationTrendingMenuItems.push(r))})}))})},f.prototype.getVisibleCaseTypeCountByCategory=function(n){if(n)return n.MenuItems.filter(function(n){return n.IsHidden==null||n.IsHidden===!1}).length},f.prototype.getVisibleCaseTypeCountByModule=function(n){var i=this,t=0;return n&&n.Categories.forEach(function(n){n.CategoryID!=i.allCategoryId&&(t+=n.MenuItems.filter(function(n){return!n.IsHidden}).length)}),t},f.prototype.getResources=function(){var n=this,t=n.$q.defer();return this.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Common.CommonResource",["AllCategoryName","ApplicationAssistantLicenseCardDescription","ApplicationAssistantPermitCardDescription","ApplicationAssistantPlanCardDescription","ApplicationAssistantTemplateText"],function(i){i.AllCategoryName&&(n.allCategoryName=i.AllCategoryName,n.licenseCardDescription=i.ApplicationAssistantLicenseCardDescription,n.permitCardDescription=i.ApplicationAssistantPermitCardDescription,n.planCardDescription=i.ApplicationAssistantPlanCardDescription,n.applicationAssistantTemplateText=i.ApplicationAssistantTemplateText);t.resolve()}),t.promise},f.prototype.applicationAssistantView=function(){var n=this,t=n.getTenantAppNavigatorSettingandUserData();n.$q.all([t]).then(function(){n.routeParameters.CaseTypes&&(n.showApplicationAssistantView=!0);n.showApplicationAssistantView&&n.setApplicationAssistantData()})},f.prototype.redirectToAppNavigator=function(){var n=this;n.shouldOpenWithinCSSIframe?this.location.url("/guidedapplication"):window.location.href=n.appNavigatorUrl},f.prototype.showAppAssistView=function(){var n=this;n.showApplicationAssistantView=!0;n.userService.isUserLoggedIn&&n.userData&&!n.userData.Visited&&n.userService.updateApplicationAssistantCurtainInfo(function(t){n.userData.Visited=t});n.setApplicationAssistantData()},f.prototype.updateUrl=function(n,t,i,r){r===void 0&&(r=!1);this.routeParameters.Section=n;this.routeParameters.Category=i;this.routeParameters.Module=t;this.routeParameters.IsShowTemplate=r;this.location.search(this.routeParameters.ToObject()).replace()},f}(app.Core.Controllers.CoreController);t.EnerGovApplicationAssistantController=f})(i=t.Controllers||(t.Controllers={}))})(t=n.ApplicationAssistant||(n.ApplicationAssistant={}))}(EnerGov||(EnerGov={}));__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,e,o,s,h,c,l,a,v){var p=n.call(this,null)||this,y;p.$location=t;p.$routeParams=i;p.enerGovEntityFeeSearchService=r;p.menuService=u;p.enerGovMyInvoiceSearchService=f;p.cartService=e;p.globalService=o;p.enerGovPermitService=s;p.enerGovPlanService=h;p.enerGovLicenseService=c;p.enerGovApplicationService=l;p.caseTypeService=a;p.pageTitleService=v;p.unpaidInvoiceIds=[];p.totalDueAmount=0;p.successMessage="";p.invoiceId="";p.cartItems=[];p.hideData=!0;p.suggestedCases=[];p.caseNumber="";p.hideFeesCard=!1;y=p;y.module=p.$routeParams.module;switch(y.module){case"permit":y.moduleId=app.Common.SelfServiceModules.Permit;break;case"plan":y.moduleId=app.Common.SelfServiceModules.Plan;break;case"profLicense":y.moduleId=app.Common.SelfServiceModules.ProfLicense;y.module="license";break;case"businessLicense":y.moduleId=app.Common.SelfServiceModules.BusinessLicense;y.module="license";break;case"application":y.moduleId=app.Common.SelfServiceModules.Application;y.module="application";break;case"operationalPermit":y.moduleId=app.Common.SelfServiceModules.OperationalPermit;y.module="operationalPermit";break;default:y.moduleId=0}return p.menuItem=y.menuService.getMenuById(parseInt(y.$routeParams.menuId,10),!0),y.moduleId===0||p.menuItem==null?p.$location.path("/dashboard"):y.moduleId==app.Common.SelfServiceModules.Permit?y.enerGovPermitService.getPermitDetail(p.$routeParams.id,function(n){y.caseNumber=n.PermitNumber;y.callback(n)}):y.moduleId==app.Common.SelfServiceModules.Plan?y.enerGovPlanService.getById(p.$routeParams.id,function(n){y.caseNumber=n.PlanNumber;y.callback(n)}):y.moduleId==app.Common.SelfServiceModules.ProfLicense?y.enerGovLicenseService.getProfessionalLicenseById(p.$routeParams.id,function(n){y.caseNumber=n.LicenseNumber;y.callback(n)}):y.moduleId==app.Common.SelfServiceModules.BusinessLicense||y.moduleId==app.Common.SelfServiceModules.OperationalPermit?y.enerGovLicenseService.getBusinessLicenseById(p.$routeParams.id,function(n){y.caseNumber=n.LicenseNumber;y.callback(n)}):y.moduleId==app.Common.SelfServiceModules.Application&&y.enerGovApplicationService.getApplicationDetail(p.$routeParams.id,function(n){y.caseNumber=n.ApplicationNumber;y.callback(n)}),p}return __extends(t,n),t.prototype.getSuggestedApplications=function(){var n=this;this.caseTypeService.getCaseTypeSuggestionsById(this.menuItem.CaseTypeInfo.CaseTypeId,function(t){t&&(n.suggestedCases=t)})},t.prototype.apply=function(n){var i=this.menuService.getMenuById(n),t="",r;if(i.Route&&i.Route!=="")try{r=JSON.parse(i.Route);t=r.NavigationUrl;t=t.replace(":menuId",i.MenuID.toString().trim());t=t.replace(":draftId","0")}catch(u){t=""}t!==""&&this.$location.url("/"+t)},t.prototype.redirectToRecord=function(){this.moduleId==app.Common.SelfServiceModules.Permit?this.$location.path("/permit/"+this.$routeParams.id):this.moduleId==app.Common.SelfServiceModules.Plan?this.$location.path("/plan/"+this.$routeParams.id):this.moduleId==app.Common.SelfServiceModules.ProfLicense?this.$location.path("/profLicense/"+this.$routeParams.id):this.moduleId==app.Common.SelfServiceModules.BusinessLicense?this.$location.path("/businessLicense/"+this.$routeParams.id):this.moduleId==app.Common.SelfServiceModules.Application?this.$location.path("/application/"+this.$routeParams.id):this.moduleId==app.Common.SelfServiceModules.OperationalPermit&&this.$location.path("/operationalPermit/"+this.$routeParams.id)},t.prototype.getUnpaidFees=function(){var n=this,t={PageNumber:1,PageSize:1e3,SortField:"",IsSortedInAscendingOrder:!0,ModuleId:this.moduleId,EntityId:this.$routeParams.id,IsRemainingFee:!0};this.enerGovEntityFeeSearchService.searchByCriteria(t,function(t){if(t!=null&&t.Result!=null){t.Result.length>0&&(n.invoiceId=t.Result[0].InvoiceId);for(var i=0;i<t.Result.length;i++)n.unpaidInvoiceIds.indexOf(t.Result[i].InvoiceId)<=-1&&n.unpaidInvoiceIds.push(t.Result[i].InvoiceId),n.totalDueAmount+=t.Result[i].AmountDue;n.unpaidInvoiceIds.length>0&&(n.showPayNow=!0)}})},t.prototype.addToCart=function(){var t=this,n=this;this.enerGovMyInvoiceSearchService.getDetailInvoices(this.unpaidInvoiceIds,!1,function(i){i!=null&&i.length>0&&(angular.forEach(i,function(t){var i={ItemName:t.InvoiceDescription,Due:t.InvoiceDueDate,Invoice:t.InvoiceNumber,InvoiceId:t.InvoiceId,BillingContact:t.BillingContact,ContactAddresses:t.ContactAddresses==null||t.ContactAddresses.length==0?[]:t.ContactAddresses,HomePhone:t.HomePhone,BusinessPhone:t.BusinessPhone,OtherPhone:t.OtherPhone,MobilePhone:t.MobilePhone,InvoiceEntityList:t.InvoiceEntities,InvoiceFees:t.InvoiceFees==null||t.InvoiceFees.length==0?[]:t.InvoiceFees},r={CartItemId:-1,CartDirectiveName:"energov-cart",CartData:angular.toJson(i),CartDataId:t.InvoiceId,UserId:-1,TenantId:-1,SoftwarePackageId:-1,SoftwarePackageName:"",Amount:t.TotalDue,IsNew:!0,IsDeleted:!1};n.cartItems.push(r)}),n.cartService.addCartItems(t.cartItems,function(i){i&&(t.cartService.didCallGetTotalItem=!1,n.cartService.updateTotalNumOfItems(),n.cartService.didCallGetTotalItem=!0,n.$location.url("/mycart"))}))})},t.prototype.viewDetails=function(){window.open("#/invoice/"+this.invoiceId,"_blank")},t.prototype.callback=function(n){this.model=n;this.model!=null&&this.model.IsLoggedIn?(this.hideData=!1,this.menuItem.CaseTypeInfo&&(this.successMessage=this.menuItem.CaseTypeInfo.SuccessMessage,this.hideFeesCard=this.menuItem.CaseTypeInfo.HideFeesCard),this.pageTitleService.setPageTitle(this.caseNumber),this.getUnpaidFees(),this.getSuggestedApplications()):this.$location.path("/dashboard")},t}(app.Core.Controllers.CoreController);n.EnerGovApplySuccessController=t})(t=n.Controllers||(n.Controllers={}))})(t=n.ApplicationAssistant||(n.ApplicationAssistant={}))}(EnerGov||(EnerGov={}));__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){var i=n.call(this)||this;return i.tenantService=t,i}return __extends(t,n),t.prototype.init=function(){var n=this;n.tenantService.getTenantAppNavigatorSetting(function(t){t&&(n.url=t.NavigatorUrl)})},t}(app.Core.Controllers.CoreController);n.NavigatorController=t})(t=n.Controllers||(n.Controllers={}))})(t=n.ApplicationAssistant||(n.ApplicationAssistant={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(){"use strict";var t=n.ApplicationAssistant.Controllers.EnerGovApplicationAssistantController,i=n.ApplicationAssistant.Controllers.EnerGovApplySuccessController,r=n.ApplicationAssistant.Services.EnerGovApplicationAssistantService,u=n.ApplicationAssistant.Controllers.NavigatorController;angular.module("enerGov.ApplicationAssistant",["app.globalsModule","app.Common.Services","enerGov.Common","app.Common.Services.TenantSettingsService"]).service("enerGovApplicationAssistantService",["http",r]).controller("enerGovApplicationAssistantController",["menuService","tenantSettingService","tenantService","resourceService","enerGovApplicationAssistantService","$location","$routeParams","$q","$window","userService","globalsService","enerGovMyTemplatesSearchService",t]).controller("enerGovApplySuccessController",["$location","$routeParams","enerGovEntityFeeSearchService","menuService","enerGovMyInvoiceSearchService",app.Constants.ServiceConstant.CartService,"globalsService","enerGovPermitService","enerGovPlanService","enerGovLicenseService","enerGovApplicationService","caseTypeService","pageTitleService",i]).controller("navigatorController",["tenantService",u])})(t=n.ApplicationAssistant||(n.ApplicationAssistant={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.conditions=[];this.relativeUrl="/energov/conditions"}return n.prototype.getConditions=function(n,t,i){var r=this;this.http.get(r.relativeUrl+"/"+n+"/"+t,function(n){n.Success&&(r.conditions=n.Result,i(n.Result))},!1)},n}();n.ConditionService=t})(t=n.Services||(n.Services={}))})(t=n.Condition||(n.Condition={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/entity/conditions"}return n.prototype.getConditions=function(n,t){this.http.post(this.rootUrl+"/search",n,function(n){t(n)},!1)},n.prototype.isEntityConditionsExist=function(n,t,i){return this.http.get(this.rootUrl+"/isentityconditionsexist/"+n+"/"+t,function(n){i(n.Result)},!1)},n}();n.EnerGovEntityConditionSearchService=t})(t=n.Services||(n.Services={}))})(t=n.Condition||(n.Condition={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.conditionService=n;this.isSuccess=!1}return n.prototype.init=function(){var n=this;n.conditionService.conditions.length>0&&(n.conditions=n.conditionService.conditions,n.isSuccess=!0)},n}();n.ConditionController=t})(t=n.Controllers||(n.Controllers={}))})(t=n.Condition||(n.Condition={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r){this.$routeParams=n;this.$location=t;this.enerGovEntityConditionSearchService=i;this.entityTabsService=r;this.isSuccess=!1;this.errorMessage=""}return n.prototype.init=function(){var n=this,t=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(n.$location,n.$routeParams.id);this.criteria={ModuleId:t,EntityId:n.$routeParams.id};n.enerGovEntityConditionSearchService.getConditions(this.criteria,function(t){t&&t!==null&&t.Result!=null&&t.Result.length>0?(n.conditions=t.Result,n.isSuccess=!0):(t.StatusCode===app.Common.Services.HttpStatusCode.NoContent||t.StatusCode===app.Common.Services.HttpStatusCode.Forbidden?n.entityTabsService.isEntityConditionsExist=!1:t.StatusCode===app.Common.Services.HttpStatusCode.PreconditionFailed&&(n.entityTabsService.isEntityConditionsExist=!0),n.$routeParams.tab&&n.$routeParams.tab==app.Constants.TabConstants.Conditions?n.entityTabsService.setAdditionalEntityTabsVisibility(n.$routeParams.tab,n.entityTabsService.isEntityConditionsExist):n.entityTabsService.setFirstTabOnHidingOtherTabs(),n.errorMessage=t.ErrorMessage)})},n}();n.EnerGovEntityConditionSearchController=t})(t=n.Condition||(n.Condition={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){"use strict";angular.module("app.EnerGov.Condition",["app.Common.Services"]).service("conditionService",["http",n.Condition.Services.ConditionService]).service("enerGovEntityConditionSearchService",["http",n.Condition.Services.EnerGovEntityConditionSearchService]).controller("conditionController",["conditionService",n.Condition.Controllers.ConditionController]).controller("enerGovEntityConditionSearchController",["$routeParams","$location","enerGovEntityConditionSearchService","entityTabsService",t.EnerGovEntityConditionSearchController])})(t=n.Condition||(n.Condition={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.relativeUrl="/energov/remittance/";this.cleanUp()}return n.prototype.getEnerGovTaxRemittance=function(n,t){var r=this,i=this;i.http.get(i.relativeUrl+"report/"+n,function(n){n.Success&&(r.taxRemittanceReport=n.Result,t(n.Result.TaxRemittanceList))},!1)},n.prototype.getTaxRemittance=function(n,t){var i=this;i.http.get(i.relativeUrl+n,function(n){n.Success&&t(n.Result)},!1)},n.prototype.getEnerGovTaxRemittanceFees=function(n,t){var i=this;i.http.post(i.relativeUrl+"report/fees",n,function(n){t(n.Result)},!1)},n.prototype.getTaxRemittanceFees=function(n,t){var i=this;i.http.post(i.relativeUrl+"fees",n,function(n){t(n.Result)},!1)},n.prototype.generateEnerGovTaxRemittanceInvoice=function(n,t){var i=this;i.http.post(i.relativeUrl+"report/invoice",n,function(n){t(n.Result)},!1)},n.prototype.generateTaxRemittanceInvoice=function(n,t){var i=this;i.http.post(i.relativeUrl+"invoice",n,function(n){t(n.Result)},!1)},n.prototype.cleanUp=function(){this.allAccountTypes=[];this.selectedAccountTypes=[];this.filteredTaxRemittances=[];this.taxRemittances=[];this.isAllSelected=!1;this.businessId=null},n}();n.TaxRemittanceService=t})(t=n.Services||(n.Services={}))})(t=n.TaxRemittance||(n.TaxRemittance={}))}(EnerGov||(EnerGov={}));__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,e,o,s,h,c){var l=n.call(this,null)||this;return l.$routeParams=t,l.taxRemittanceService=i,l.businessService=r,l.addressSearchService=u,l.pageTitleService=f,l.location=e,l.resourceService=o,l.globalService=s,l.enerGovCustomFieldsService=h,l.customFieldsService=c,l.allOptionValue="All",l.selectAccountTypeLabel="Select Account Type",l}return __extends(t,n),t.prototype.init=function(){var i=this,n=this,t=n.$routeParams.id;this.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Common.CommonResource",["TaxRemittance_SelectAccountType_Label","TaxRemittance_All_Option"],function(n){i.selectAccountTypeLabel=n.TaxRemittance_SelectAccountType_Label;i.allOptionValue=n.TaxRemittance_All_Option});n.businessService.getBusinessById(t,function(i){if(i){n.business={Number:i.BusinessNumber,DBA:i.DBAName,Name:i.CompanyName};n.pageTitleService.setPageTitle(i.BusinessNumber);var r={EntityId:t,ModuleId:app.Common.SelfServiceModules.BusinessEntity,PageNumber:1,PageSize:10};n.addressSearchService.searchMainAddressByCriteria(r,function(t){t&&(n.business.Address=t.Address)})}});n.taxRemittanceService.taxRemittances&&n.taxRemittanceService.taxRemittances.length!=0&&n.taxRemittanceService.businessId==t||(n.taxRemittanceService.cleanUp(),app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2020.0.0.0")?n.taxRemittanceService.getEnerGovTaxRemittance(t,function(i){n.processTaxRemittanceData(i,t)}):n.taxRemittanceService.getTaxRemittance(t,function(i){n.processTaxRemittanceData(i,t)}))},t.prototype.selectAllOptions=function(){var n=this;n.taxRemittanceService.isAllSelected=!1;n.taxRemittanceService.selectedAccountTypes.unshift(n.allOptionValue);n.onSelectionChanged()},t.prototype.checkUncheckAllOption=function(){var n=this,t;if(n.taxRemittanceService.isAllSelected&&n.taxRemittanceService.selectedAccountTypes.indexOf(n.allOptionValue)<0){n.taxRemittanceService.isAllSelected=!1;n.taxRemittanceService.selectedAccountTypes=[];return}if(!n.taxRemittanceService.isAllSelected&&n.taxRemittanceService.selectedAccountTypes.indexOf(n.allOptionValue)>=0){n.taxRemittanceService.isAllSelected=!0;n.taxRemittanceService.selectedAccountTypes=n.taxRemittanceService.allAccountTypes.slice(0);n.taxRemittanceService.selectedAccountTypes.unshift(n.allOptionValue);return}if(n.taxRemittanceService.isAllSelected&&n.taxRemittanceService.allAccountTypes.length>n.taxRemittanceService.selectedAccountTypes.length-1){n.taxRemittanceService.isAllSelected=!1;t=n.taxRemittanceService.selectedAccountTypes.indexOf(n.allOptionValue);n.taxRemittanceService.selectedAccountTypes.splice(t,1);return}if(!n.taxRemittanceService.isAllSelected&&n.taxRemittanceService.allAccountTypes.length==n.taxRemittanceService.selectedAccountTypes.length){n.taxRemittanceService.isAllSelected=!0;n.taxRemittanceService.selectedAccountTypes.unshift(n.allOptionValue);return}},t.prototype.filterTaxRemittancesBySelectedAccountTypes=function(){var n=this,t=n.taxRemittanceService.filteredTaxRemittances.splice(0);n.taxRemittanceService.selectedAccountTypes.forEach(function(i){var r,u;i!=n.allOptionValue&&(r=t.filter(function(n){return n.TaxRemittanceTypeName==i}),r&&r.length>0?n.taxRemittanceService.filteredTaxRemittances=n.taxRemittanceService.filteredTaxRemittances.concat(r):(u=n.taxRemittanceService.taxRemittances.filter(function(n){return n.TaxRemittanceTypeName==i}),n.taxRemittanceService.filteredTaxRemittances=n.taxRemittanceService.filteredTaxRemittances.concat(u.slice(0))))})},t.prototype.onSelectionChanged=function(){this.checkUncheckAllOption();this.filterTaxRemittancesBySelectedAccountTypes()},t.prototype.getDropDownText=function(){var n=this,t;return!n.taxRemittanceService.selectedAccountTypes||n.taxRemittanceService.selectedAccountTypes.length==0?this.selectAccountTypeLabel:n.taxRemittanceService.selectedAccountTypes.indexOf(n.allOptionValue)>=0?n.allOptionValue:(t="",n.taxRemittanceService.selectedAccountTypes.forEach(function(i){i!==n.allOptionValue&&(t==""?t=i:t+=", "+i)}),t)},t.prototype.reportZero=function(n){n.Reporting&&(n.GrossAmount=0,n.ExemptAmount=0,n.AmountReported=0,n.AmountReportedString="0")},t.prototype.amountChanged=function(n){if(n.Reporting&&(n.GrossAmount>0||n.GrossAmount==undefined||n.ExemptAmount>0||n.ExemptAmount==undefined||n.AmountReported>0||n.AmountReported==undefined)&&(n.Reporting=!1),n.EnableExemptions)n.AmountReported=n.GrossAmount-n.ExemptAmount,n.AmountReported=parseFloat(n.AmountReported.toFixed(2)),n.AmountReportedString=n.AmountReported.toFixed(2);else{var t=parseFloat(n.AmountReportedString);n.AmountReported=isNaN(t)?0:t}this.checkValues(n)},t.prototype.getFees=function(n){if(n){var t=this;t.location.url("/business/"+t.$routeParams.id+"/taxremittancefee")}},t.prototype.checkValues=function(n){n.AmountReported!=NaN&&n.AmountReported==null&&n.EnableExemptions&&(n.AmountReported=0);n.AmountReportedString==="0.00"&&(n.AmountReportedString="0");n.AmountReportedString==="NaN"&&(n.AmountReportedString="")},t.prototype.disableNextButton=function(){var n=this;if(!n.taxRemittanceService.filteredTaxRemittances||n.taxRemittanceService.filteredTaxRemittances.length==0)return!0;var t=n.taxRemittanceService.filteredTaxRemittances.filter(function(n){return n.Reporting==!1&&(n.AmountReported==0||n.AmountReported==null)}),i=n.taxRemittanceService.filteredTaxRemittances.filter(function(n){return n.GrossAmount==undefined&&n.EnableExemptions==!0||n.ExemptAmount==undefined&&n.EnableExemptions==!0||n.EnableExemptions==!0&&(n.AmountReported==undefined||n.AmountReported<0)}),r=n.taxRemittanceService.filteredTaxRemittances.filter(function(t){return t.CustomFieldLayoutID&&t.CustomLayout&&(n.customFieldsService.isInvalidRowPresent(t.CustomLayout)||n.customFieldsService.hasInvalidTable(t.CustomLayout))});return t.length>0||i.length>0||r.length>0},t.prototype.processTaxRemittanceData=function(n,t){var i=this;n&&(i.taxRemittanceService.taxRemittances=n,i.taxRemittanceService.businessId=t,n.forEach(function(n,t){i.taxRemittanceService.allAccountTypes.indexOf(n.TaxRemittanceTypeName)<0&&i.taxRemittanceService.allAccountTypes.push(n.TaxRemittanceTypeName);i.setCustomFieldLayout(n,t)}),i.selectAllOptions())},t.prototype.setCustomFieldLayout=function(n,t){var i=this;n.CustomFieldLayoutID&&i.enerGovCustomFieldsService.getCustomLayout(n.CustomFieldLayoutID,n.CustomFieldLayoutID,function(r){n.CustomLayout=i.customFieldsService.setLayout(r,t)})},t}(app.Core.Controllers.CoreController);n.TaxRemittanceController=t})(t=n.Controllers||(n.Controllers={}))})(t=n.TaxRemittance||(n.TaxRemittance={}))}(EnerGov||(EnerGov={}));__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,null)||this,o;return e.$routeParams=t,e.taxRemittanceService=i,e.location=r,e.globalService=u,e.userService=f,e.isProcessing=!1,o=e,o.totalAmount=0,o.taxRemittanceService.filteredTaxRemittances&&o.taxRemittanceService.filteredTaxRemittances.length!=0?o.userService.getUser(function(n){o.user=n;o.getTaxRemittanceFees()}):o.goBack(),e}return __extends(t,n),t.prototype.getTaxRemittanceFees=function(){var n=this,t,i;n.isProcessing=!0;app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2020.0.0.0")?(t=angular.copy(n.taxRemittanceService.taxRemittanceReport),t.TaxRemittanceList=angular.copy(n.taxRemittanceService.filteredTaxRemittances),t.BillingContactId=n.user.OtherData,n.taxRemittanceService.getEnerGovTaxRemittanceFees(t,function(t){n.processTaxRemittanceFees(t);n.isProcessing=!1})):(i={TaxRemittances:n.taxRemittanceService.filteredTaxRemittances,BusinessId:n.$routeParams.id},n.taxRemittanceService.getTaxRemittanceFees(i,function(t){n.processTaxRemittanceFees(t);n.isProcessing=!1}))},t.prototype.generateInvoice=function(){var n=this,t,i;app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2020.0.0.0")?(t=angular.copy(n.taxRemittanceService.taxRemittanceReport),t.TaxRemittanceList=angular.copy(n.taxRemittanceService.filteredTaxRemittances),t.BillingContactId=n.user.OtherData,n.taxRemittanceService.generateEnerGovTaxRemittanceInvoice(t,function(t){n.taxRemittanceService.cleanUp();n.location.url("/invoice/"+t.InvoiceID)})):(i={TaxRemittances:n.taxRemittanceService.filteredTaxRemittances,BusinessId:n.$routeParams.id},n.taxRemittanceService.generateTaxRemittanceInvoice(i,function(t){n.taxRemittanceService.cleanUp();n.location.url("/invoice/"+t.InvoiceID)}))},t.prototype.processTaxRemittanceFees=function(n){var t=this;n&&(t.taxRemittanceFees=[],n.forEach(function(n){n.InvoiceID||(t.taxRemittanceFees.push(n),t.totalAmount+=n.ComputedAmount)}))},t.prototype.goBack=function(){this.location.url("/business/"+this.$routeParams.id+"/taxremittance")},t}(app.Core.Controllers.CoreController);n.TaxRemittanceFeeController=t})(t=n.Controllers||(n.Controllers={}))})(t=n.TaxRemittance||(n.TaxRemittance={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(){"use strict";var t=app.Constants.AppModule;angular.module(t.TaxRemittanceModule,["app.Common.Services","enerGov.business","enerGov.Address","app.CustomFields"]).service("enerGovTaxRemittanceService",["http",n.TaxRemittance.Services.TaxRemittanceService]).controller("taxRemittanceController",["$routeParams","enerGovTaxRemittanceService","enerGovBusinessService","enerGovEntityAddressSearchService","pageTitleService","$location","resourceService","globalsService","enerGovCustomFieldsService","genericModuleCustomFieldsService",n.TaxRemittance.Controllers.TaxRemittanceController]).controller("taxRemittanceFeeController",["$routeParams","enerGovTaxRemittanceService","$location","globalsService","userService",n.TaxRemittance.Controllers.TaxRemittanceFeeController])})(t=n.TaxRemittance||(n.TaxRemittance={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){var i;(function(t){"use strict";var i=n.Common.CaseTypeUseEnums.MenuActionType,r=function(){function n(n,t){this.http=n;this.utilities=t;this.templateName="";this.templateId=0;this.errorMessage="";this.isError=!1}return n.prototype.deleteById=function(n,t,i){this.cleanUpErrorMessage();this.http.delete("/template/"+n,function(n){n.Success?t(n.Result):t(null)},i)},n.prototype.getTemplateById=function(n,t){var i=this;this.cleanUpErrorMessage();this.http.get("/template/"+n,function(n){n.Success?n.Result!==null&&t(n.Result):t(null)})},n.prototype.saveTemplate=function(n,t){var i=this,r=this;this.cleanUpErrorMessage();this.http.post("/template",n,function(n){n.Success&&(n.Result==null&&n.ValidationErrorMessage?(i.isError=!0,i.errorMessage=n.ValidationErrorMessage,t(null)):t(n.Result.Draft.DraftId))},!1)},n.prototype.cleanUpErrorMessage=function(){this.errorMessage="";this.isError=!1},n.prototype.cleanUp=function(){this.menuActionTypeInternal=i.Apply;this.templateName="";this.cleanUpErrorMessage()},n}();t.EnerGovTemplateService=r})(i=t.Services||(t.Services={}))})(t=n.Template||(n.Template={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(){"use strict";var t=app.Constants.AppModule;angular.module(t.TemplateModule,["app.Common.Services","app.Services.Utilities"]).service("enerGovTemplateService",["http","utilities",n.Template.Services.EnerGovTemplateService])})(t=n.Template||(n.Template={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r){var u=n.call(this,null)||this;return u.$routeParams=t,u.$location=i,u.tenantService=r,u.disqusConfig={disqus_shortname:"",disqus_identifier:u.$routeParams.id,disqus_url:u.$location.absUrl().replace("#","#!")},u.tenantService.getTenantCommentsSetting(function(n){n&&n.ShortName&&(u.disqusConfig.disqus_shortname=n.ShortName)}),u}return __extends(t,n),t}(app.Core.Controllers.CoreController);n.EnergovEntityCommentsController=t})(t=n.Comments||(n.Comments={}))}(Energov||(Energov={})),function(n){var t;(function(){var n=Energov.Comments.EnergovEntityCommentsController;angular.module("enerGov.Comments",["app.Services.Tenant"]).controller("enerGovEntityCommentsController",["$routeParams","$location","tenantService",n])})(t=n.Comments||(n.Comments={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/applications/"}return n.prototype.getSecondaryData=function(n,t){this.http.get(this.rootUrl+"setup/"+n,function(n){n.Success&&t(n.Result)},!1)},n}();n.EnerGovApplicationSecondaryDataService=t})(t=n.Services||(n.Services={}))})(t=n.Application||(n.Application={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(t){var i;(function(t){"use strict";var i=function(){function t(n){this.http=n;this.rootUrl="/energov/applications/"}return t.prototype.getApplicationDetail=function(t,i){var r=this.rootUrl+"applicationdetail",u={EntityId:t,ModuleId:n.Search.Controllers.AuthorizationModules.Application};this.http.post(r,u,function(n){i(n.Result)},!1)},t}();t.EnerGovApplicationService=i})(i=t.Services||(t.Services={}))})(t=n.Application||(n.Application={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.estimatedFees=[];this.showWorkClass=!1;this.rootUrl="/energov/applications/";var t=this;t.setDefaultStates()}return n.prototype.totalEstimatedFee=function(){var n=0;return angular.forEach(this.estimatedFees,function(t){n=n+t.ComputedAmount}),n},n.prototype.saveApplication=function(n,t){this.http.post(this.rootUrl+"save",n,function(n){t(n)})},n.prototype.getApplicationEstimateFees=function(n,t){var i=this;this.estimatedFees=[];this.http.post(this.rootUrl+"estimatedfees",n,function(n){n.Success&&(i.estimatedFees=n.Result,t(n.Result))})},n.prototype.setDefaultStates=function(){this.model={ApplicationID:"",ApplicationTypeID:"",ApplicationNumber:"",Description:"",ApplicationStatusID:"",AssignedTo:"",ObjectID:"",DistrictID:"",RowVersion:0,Addresses:[],Contacts:[],Attachments:[],Parcels:[],Projects:[],CustomFields:[],CustomFieldLayoutID:"",CustomLayout:null,ApplicationPLPlanID:"",ApplicationPLPlanNumber:"",ClientId:"",EntityId:null,FeeTemplateId:"",IsDeleted:!1,IsNew:!0,ModuleId:0,IsRenewal:!1,LastChangedBy:"",IsRequiredDescription:!1};this.secondaryData=null;this.selectedType=null;this.selectedWorkClass=null;this.selectedTypeItems=[];this.showMoreInfoStep=!1},n}();n.EnerGovApplyApplicationService=t})(t=n.Services||(n.Services={}))})(t=n.Application||(n.Application={}))}(EnerGov||(EnerGov={}));__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,c,l,a,v,y,p,w,b,k,d,g,nt,tt,it,rt,ut,ft,et,ot,st,ht){var ct=t.call(this,n,i,r,u,f,e,o,s,h,c,l,a,v,p,b,k,nt,w,null,null,null,rt,ut,ft,et,ot,st)||this,lt,at,vt;if(ct.$routeParams=n,ct.$location=i,ct.globalService=r,ct.menuService=u,ct.settingsService=f,ct.enerGovContactCardsService=e,ct.enerGovAddressCardsService=o,ct.enerGovAttachmentCardsService=s,ct.enerGovCustomFieldsService=h,ct.customFieldsService=c,ct.draftService=l,ct.EnerGovApplicationSecondaryDataService=a,ct.enerGovApplyModuleService=v,ct.$filter=y,ct.enerGovSubrecordApplyService=p,ct.locationService=w,ct.userService=b,ct.$q=k,ct.scope=d,ct.mapApplySerivce=g,ct.stepperService=nt,ct.eReviewsService=tt,ct.eReviewAttachmentCardsService=it,ct.caseTypeInstructionService=rt,ct.tylerSignaturePadService=ut,ct.enerGovTemplateService=ft,ct.entitySignatureMetaDataService=et,ct.$timeout=ot,ct.attachmentCommonCardService=st,ct.$sanitize=ht,ct.draftType=app.Constants.DraftType.Application,ct.isApplicationApply=!0,ct.stepperService.module=app.Common.SelfServiceModules.Application,ct.enerGovApplyModuleService.model.ApplicationDate=new Date(y("date")(Date.now(),app.Constants.GlobalConstants.DateFormatForSearch)),ct.enerGovAddressCardsService.locationAddressType==null&&ct.userService.isUserLoggedIn)ct.enerGovAddressCardsService.getSecondaryDataAndSetAddressType();else if(ct.enerGovAddressCardsService.locationAddressType){if(g.mapLocations.length>0&&o.buildLocationCardFromMap(g.mapLocations),g.mapSPCollections.length>0)for(lt=0,at=g.mapSPCollections;lt<at.length;lt++)vt=at[lt],ct.enerGovAddressCardsService.addSpatialCollection(vt);g.resetMapApplyData()}return ct}return __extends(i,t),Object.defineProperty(i.prototype,"fileProgressListCount",{get:function(){return this.enerGovAttachmentCardsService.fileProgressList?this.enerGovAttachmentCardsService.fileProgressList.length:0},enumerable:!0,configurable:!0}),i.prototype.getSelectedWorkClassSecondaryData=function(){var f=null,r,n,u,i,t;if(this.enerGovApplyModuleService==null||!this.enerGovApplyModuleService.secondaryData||this.enerGovApplyModuleService.selectedType==null||(r=this.getTypeId(),r==null))return null;for(n=0;n<this.enerGovApplyModuleService.secondaryData.Types.length;n++)if(this.enerGovApplyModuleService.secondaryData.Types[n].ApplicationTypeID===r){for(u=this.enerGovApplyModuleService.secondaryData.Types[n],this.enerGovApplyModuleService.model.FeeTemplateId=u.FeeTemplateID,this.enerGovApplyModuleService.model.CustomLayout=null,i=0;i<u.ContactTypeList.length;i++){t=this.enerGovApplyModuleService.secondaryData.Types[n].ContactTypeList[i];this.contactType={ContactTypeId:t.LandManagementContactTypeID,Name:t.Name,IsRequired:t.ContactTypeGroup>0?!0:t.IsRequired,GroupId:t.ContactTypeGroup,LandManagementContactSystemTypeID:t.LandManagementContactSystemTypeID,isFilled:!1,IsDefaultOnlineContactType:!1,IsValidateLic:!1,IsValidateBLLicense:!1,IsValidateILLicense:!1,RequiredValidLic:!1};break}f=this.enerGovApplyModuleService.secondaryData.Types[n]}return f},i.prototype.setCustomFieldLayout=function(n,i){var e=this,r,u,f;i===void 0&&(i=null);r=this;n&&n.CustomFieldsLayoutId&&(u=n.CustomFieldsLayoutId,f=n.CustomFieldsLayoutId,r.enerGovCustomFieldsService.getCustomLayout(u,f,function(i){t.prototype.processCustomFieldLayout.call(e,i,n)}))},i.prototype.calculateEstimateFees=function(){var n=this,t;n.enerGovApplyModuleService.model.ApplicationTypeID=n.getTypeId();t=n.getSelectedWorkClassSecondaryData();n.enerGovApplyModuleService.model.FeeTemplateId=t.FeeTemplateID;n.enerGovApplyModuleService.model.CustomLayout=n.customFieldsService.customLayout;n.enerGovApplyModuleService.getApplicationEstimateFees(n.enerGovApplyModuleService.model,function(){})},i.prototype.getTypeIdFromPackageData=function(n){var t=JSON.parse(n);return t.ApplicationTypeID?t.ApplicationTypeID:null},i.prototype.saveModule=function(){var t=this,i,r;t.enerGovApplyModuleService.model.Contacts=t.enerGovContactCardsService.saveContacts();t.enerGovApplyModuleService.model.Addresses=[];t.enerGovApplyModuleService.model.Addresses=$.grep(t.enerGovAddressCardsService.addressCards,function(n){return!n.IsParcel});t.enerGovApplyModuleService.model.Parcels=[];i=$.grep(t.enerGovAddressCardsService.addressCards,function(n){return n.IsParcel});angular.forEach(i,function(n){var i={ParentParcelID:"",ParcelID:"",ParentID:"",ParcelNumber:n.ParcelNumber,Section:n.Section,Range:n.Range,Township:n.Township,Main:n.Main,IsNew:!0,IsDeleted:!1,ClientId:""};t.enerGovApplyModuleService.model.Parcels.push(i)});t.enerGovApplyModuleService.model.ApplicationTypeID=t.getTypeId();r=t.getSelectedWorkClassSecondaryData();t.enerGovApplyModuleService.model.ApplicationStatusID=r.DefaultApplicationStatusID;t.enerGovApplyModuleService.model.CustomFieldLayoutID=t.customFieldsService.customLayout?t.customFieldsService.customLayout.OfflineCustomFieldLyoutId:null;t.enerGovApplyModuleService.model.CustomLayout=t.customFieldsService.customLayout;t.enerGovAttachmentCardsService.showProgressBarDialog();t.enerGovAttachmentCardsService.uploadFileAttachments(function(i){t.enerGovApplyModuleService.model.Attachments=i;t.enerGovApplyModuleService.saveApplication(t.enerGovApplyModuleService.model,function(i){i.Success?(t.utilities.showPleaseWait(),t.saveSignatureToEnergov(n.Common.CaseTypeUseEnums.AgreementType.Application,i,function(){t.utilities.hidePleaseWait();t.afterSaveRedirection(n.Common.CaseTypeUseEnums.FilterModule.Application,i.Result)})):t.enerGovAttachmentCardsService.closeProgressBarDialog()})})},i.prototype.updateDraftPartialFromModel=function(n){return n.Description=this.enerGovApplyModuleService.model.Description,n},i.prototype.updateModelPartialFromFraft=function(n){this.enerGovApplyModuleService.model.Description=n.Description;this.enerGovApplyModuleService.model.ObjectID=n.ObjectID;this.enerGovApplyModuleService.model.Projects=n.Projects;(n.IsSubPlanFromPermit||n.IsSubPlanFromPlan)&&(this.isSubRecordApply=!0)},i.prototype.setStepperSteps=function(){var u=this,r=u.getSelectedWorkClassSecondaryData();if(r!==null)this.enerGovApplyModuleService.showMoreInfoStep=this.showMoreInfo(r);else return;this.stepperService.module=app.Common.SelfServiceModules.Application;var t=this.globalService.baseUrl+this.globalService.tenantUrl+"/energovapply/page?v="+this.globalService.version+"&id=",i=0,n=[];this.isFeeEstimate||this.disableLocationsInTemplates||(!this.selectedType.CaseTypeInfo.HideLocationStep||this.selectedType.CaseTypeInfo.HideLocationStep&&this.enerGovAddressCardsService.addressRequired)&&n.push({Label:"Locations",Order:i++,ViewUrl:t+"location",ShowBackButton:!1,ShowNextButton:!0});n.push({Label:"Type",Order:i++,ViewUrl:t+"applicationtype",ShowBackButton:this.enerGovAddressCardsService.addressRequired||this.selectedType&&!this.selectedType.CaseTypeInfo.HideLocationStep?!this.disableLocationsInTemplates:!1,ShowNextButton:!0});this.isFeeEstimate||n.push({Label:"Contacts",Order:i++,ViewUrl:t+"contacts",ShowBackButton:!0,ShowNextButton:!0});this.enerGovApplyModuleService.showMoreInfoStep&&n.push({Label:"More Info",Order:i++,ViewUrl:t+"customfield",ShowBackButton:!0,ShowNextButton:!0});this.isFeeEstimate||n.push({Label:"Attachments",Order:i++,ViewUrl:t+"attachmentfiles",ShowBackButton:!0,ShowNextButton:!0});this.selectedType.CaseTypeInfo.SignatureRequired?(n.push({Label:"Signature",Order:i++,ViewUrl:t+"signature",ShowBackButton:!0,ShowNextButton:!0}),n.push({Label:"Review and Submit",Order:i++,ViewUrl:t+"summary",ShowBackButton:!0,ShowNextButton:!1})):n.push({Label:"Review and Submit",Order:i++,ViewUrl:t+"summary",ShowBackButton:!0,ShowNextButton:!1});this.stepperService.stepsSetup("Application",n,this.enerGovApplyModuleService.selectedType)},i}(n.Common.Controllers.Apply.EnerGovApplyController);t.EnerGovApplicationApplyController=i})(i=t.Controller||(t.Controller={}))})(t=n.Application||(n.Application={}))}(EnerGov||(EnerGov={}));__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,e,o,s,h,c,l,a,v,y){var w=n.call(this,null)||this,p,b;return w.$routeParams=t,w.$location=i,w.globalService=r,w.enerGovApplicationService=u,w.enerGovCustomFieldsService=f,w.customFieldsService=e,w.cartService=o,w.enerGovSettingsService=s,w.energovReportService=h,w.pageTitleService=c,w.tabNavigatorService=l,w.selfServiceStateService=a,w.entityTabsService=v,w.tenantService=y,w.userLoggedIn=!1,w.pendingAddCartItems=[],w.showPayNow=!1,w.invoicesPending=[],w.isCollapsed=!1,w.isTenantUsesTylerPayments=function(){var n=w;w.tenantService.isTylerPaymentsUsed(function(t){n.isTylerPaymentsUsed=t})},p=w,p.isTenantUsesTylerPayments(),b=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(w.$location,w.$routeParams.id),p.tabNavigatorService.cleanUp(),w.entityTabsService.setEntityTabsVisibility(w.$routeParams.id,b,p.$routeParams.tab),w.enerGovApplicationService.getApplicationDetail(w.$routeParams.id,function(n){(p.model=n,p.selfServiceStateService.setParentModel(n),p.model!=null)&&(p.model.ApplicationId!==null&&p.model.ApplicationId!==""&&w.energovReportService.getReportName("Application",p.model.TypeId,null,function(n){p.reportName=n}),p.pageTitleService.setPageTitle(p.model.ApplicationNumber),p.model.IsLoggedIn&&p.model.IsEntityContact&&p.model.AllowPayNow&&p.model.UnPaidInvoicedFees!=null&&p.model.UnPaidInvoicedFees?p.isTylerPaymentsUsed||p.cartService.getPendingInvoices(p.model.UnpaidInvoiceIds,function(n){p.invoicesPending=n;p.showPayNow=n.length>0&&n.length==p.model.UnpaidInvoiceIds.length?!1:!0}):p.showPayNow=!0,p.model.LayoutId&&p.model.ApplicationId?p.enerGovCustomFieldsService.getCustomLayoutWithData(p.model.LayoutId,null,p.model.ApplicationId,b,function(n){n.Success?n.Result?p.customFieldsService.setLayout(n.Result):p.errorMessage=n.ErrorMessage:(n.StatusCode===app.Common.Services.HttpStatusCode.PreconditionFailed||n.StatusCode===app.Common.Services.HttpStatusCode.NoContent||n.StatusCode===app.Common.Services.HttpStatusCode.Forbidden)&&(p.errorMessage=n.ErrorMessage)}):(p.entityTabsService.showMoreInfoTab=!1,p.$routeParams.tab&&p.$routeParams.tab==app.Constants.TabConstants.Moreinfo?p.entityTabsService.setAdditionalEntityTabsVisibility(p.$routeParams.tab,p.entityTabsService.showMoreInfoTab):p.entityTabsService.setFirstTabOnHidingOtherTabs()),p.model.ApplicationId===""&&(alert("Unable to load the selected application. Please contact your municipality about the application you were attempting to view. Returning to home."),w.$location.path("/dashboard")))}),w}return __extends(t,n),t.prototype.collapsePanel=function(){this.isCollapsed=!this.isCollapsed},t.prototype.printApplication=function(){var n=this.globalService.webApiBaseUrl+"/energov/report/single?value="+this.model.ApplicationId+"&reportName="+this.reportName+"&tenantId="+this.globalService.tenantId;window.open(n,"_new")},t.prototype.isIEVersion=function(){var n=document.documentMode;return n>=11?!0:!1},t}(app.Core.Controllers.CoreController);n.EnerGovApplicationViewController=t})(t=n.Controller||(n.Controller={}))})(t=n.Application||(n.Application={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){"use strict";var t=n.Services.EnerGovApplicationService,i=n.Controller.EnerGovApplicationViewController;angular.module("enerGov.Application",["app.globalsModule","app.Common.Services"]).service("enerGovApplicationService",["http",t]).service("enerGovApplicationSecondaryDataService",["http",n.Services.EnerGovApplicationSecondaryDataService]).service("enerGovApplyApplicationService",["http",n.Services.EnerGovApplyApplicationService]).controller("enerGovApplicationViewController",["$routeParams","$location","globalsService","enerGovApplicationService","enerGovCustomFieldsService","customFieldsService",app.Constants.ServiceConstant.CartService,"enerGovSettingsService","enerGovReportService","pageTitleService","tabNavigatorService","selfServiceStateService","entityTabsService","tenantService",i]).controller("enerGovApplicationApplyController",["$routeParams","$location","globalsService","menuService","enerGovSettingsService","enerGovContactCardsService","enerGovAddressCardsService","enerGovAttachmentCardsService","enerGovCustomFieldsService","customFieldsService","draftService","enerGovApplicationSecondaryDataService","enerGovApplyApplicationService","$filter","enerGovSubrecordApplyService","locationService","userService","$q","$scope","mapApplyService","stepperService","eReviewsService","eReviewAttachmentCardsService","caseTypeInstructionService","tylerSignaturePadService","enerGovTemplateService","entitySignatureMetaDataService","$timeout","attachmentCommonCardService",n.Controller.EnerGovApplicationApplyController])})(t=n.Application||(n.Application={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;var t=this}return n.prototype.getTenantTCPSettings=function(n){var t=this;this.tcpSettings?n(this.tcpSettings):this.http.get("/TcpSetting/gettcpsetting/",function(i){i.Success&&(t.tcpSettings=i.Result,n(i.Result))},!1)},n}();n.TCPSettingService=t})(t=n.Services||(n.Services={}))})(t=n.TCPSettings||(n.TCPSettings={}))}(app||(app={})),function(n){var t;(function(){"use strict";angular.module("app.tcpSettings",[]).service("tcpSettingsService",["http",n.TCPSettings.Services.TCPSettingService])})(t=n.TCPSettings||(n.TCPSettings={}))}(app||(app={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n;this.rootUrl="/energov/projects/"}return n.prototype.getProjectById=function(n,t){var i=this.rootUrl+n;this.http.get(i,function(n){t(n.Result)},!1)},n.prototype.getContactTypeData=function(n){this.http.get(this.rootUrl+"setup/contact/",function(t){t.Success&&n(t.Result)},!1)},n.prototype.getProjectRelatedCaseWorkflow=function(n,t){var i=this.rootUrl+"related-case-workflow/"+n;this.http.get(i,function(n){t(n.Result)},!1)},n.prototype.getProjectFeesDueById=function(n,t){var i=this.rootUrl+"fees-due/"+n;this.http.get(i,function(n){t(n.Result)},!1)},n.prototype.getProjectFeesSummaryById=function(n,t){var i=this.rootUrl+"fees-summary/"+n;this.http.get(i,function(n){t(n.Result)},!1)},n.prototype.getProjectAssociatedInvoicesSummaryById=function(n,t){var i=this.rootUrl+"associated-invoices-total-dues/"+n;this.http.get(i,function(n){t(n.Result)},!1)},n.prototype.getProjectFeesAndInvoicesById=function(n,t){var i=this.rootUrl+"feesAndInvoices/"+n;this.http.get(i,function(n){t(n)},!1)},n.prototype.getProjectFees=function(n,t){return this.http.post(this.rootUrl+"fees",n,function(n){t(n)})},n.prototype.getProjectAssociatedInvoices=function(n,t){return this.http.post(this.rootUrl+"associated-invoices",n,function(n){t(n)})},n}();n.EnerGovProjectService=t})(t=n.Services||(n.Services={}))})(t=n.Project||(n.Project={}))}(EnerGov||(EnerGov={}));__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=app.Common.SelfServiceModules,i=function(n){function i(t,i,r,u,f){var e=n.call(this,null)||this;return e.$routeParams=t,e.enerGovProjectService=i,e.tabNavigatorService=r,e.entityTabsService=u,e.userService=f,e.totalProjectFees=0,e.totalAssociatedInvoicesAmount=0,e.modules=app.Common.SelfServiceModules,e.projectId=t.id,e.getProjectModel(),e.getProjectFeesAndInvoices(),e.getProjectRelatedCaseWorkflow(),e}return __extends(i,n),i.prototype.getProjectFeesAndInvoices=function(){var n=this;n.enerGovProjectService.getProjectFeesDueById(n.projectId,function(t){t!=null&&(n.totalProjectFees=parseFloat(t.UnpaidFees.toFixed(2)))});n.enerGovProjectService.getProjectAssociatedInvoicesSummaryById(n.projectId,function(t){t!=null&&(n.totalAssociatedInvoicesAmount=parseFloat(t.TotalDues.toFixed(2)))})},i.prototype.getProjectRelatedCaseWorkflow=function(){var n=this;n.enerGovProjectService.getProjectRelatedCaseWorkflow(n.projectId,function(t){n.projectRelatedCaseWorkFlowItems=t})},i.prototype.caseLink=function(n){switch(n.Module){case t.Permit:return"#/permit/"+n.EntityId;case t.Plan:return"#/plan/"+n.EntityId;case t.Code:return"#/code/"+n.EntityId}},i.prototype.getProjectModel=function(){var n=this;n.enerGovProjectService.getProjectById(this.$routeParams.id,function(t){n.model=t})},i}(app.Core.Controllers.CoreController);n.EnerGovEntityProjectSummaryController=i})(t=n.Controllers||(n.Controllers={}))})(t=n.Project||(n.Project={}))}(EnerGov||(EnerGov={}));__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=n.Invoice.Enums,r=function(n){function t(t,r,u,f,e,o,s,h,c,l){var a=n.call(this)||this;return a.$scope=t,a.$routeParams=r,a.enerGovMyEntityTelerikService=e,a.enerGovProjectService=o,a.resourceService=s,a.tenantService=h,a.cartService=c,a.selfServiceStateService=l,a.isAssociatedInvoicesGridLoading=!1,a.projectAssociatedInvoices=[],a.selectedInvoiceType=i.InvoiceStatus.Unpaid,a.addToCartInProgress=!1,a.pendingAddInvoiceIds=[],a.currentSelectedItems=[],a.invoiceTypeList=[{Key:i.InvoiceStatus[i.InvoiceStatus.Unpaid],Value:i.InvoiceStatus.Unpaid},{Key:i.InvoiceStatus[i.InvoiceStatus.Paid],Value:i.InvoiceStatus.Paid}],a.isTenantUsesTylerPayments=function(){var n=a;a.tenantService.isTylerPaymentsUsed(function(t){n.isTylerPaymentsUsed=t})},a.pendingAddCartItems=[],a}return __extends(t,n),t.prototype.init=function(){var n=this;n.isTenantUsesTylerPayments();n.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Invoice.InvoiceResource",["MyInvoice_InvoiceNumberColumnHeader","MyInvoice_AmountDueColumnHeader","MyInvoice_StatusColumnHeader","MyInvoice_CaseNumberHeader","MyInvoice_AddressHeader","MyInvoice_DueDateHeader","MyInvoice_SelectAll","MyInvoice_DisplaySort","MyInvoice_AddToCartButton"],function(t){n.invoiceNumberLabel=t.MyInvoice_InvoiceNumberColumnHeader;n.amountDueLabel=t.MyInvoice_AmountDueColumnHeader;n.invoiceStatusLabel=t.MyInvoice_StatusColumnHeader;n.caseNumberLabel=t.MyInvoice_CaseNumberHeader;n.invoiceAddressLabel=t.MyInvoice_AddressHeader;n.dueDateLabel=t.MyInvoice_DueDateHeader;n.myInvoiceDisplayLabel=t.MyInvoice_DisplaySort;n.myInvoiceAddToCartLabel=t.MyInvoice_AddToCartButton;n.loadInvoiceGrid()},!0)},t.prototype.loadInvoiceGrid=function(){var n=this,t;n.projectFeeInvoiceGridOptions=n.enerGovMyEntityTelerikService.getTelerikGridOptions();n.projectFeeInvoiceGridOptions.pageable=n.enerGovMyEntityTelerikService.getPageable();n.projectFeeInvoiceGridOptions.pageable.responsive=!1;n.projectFeeInvoiceGridOptions.columns=n.getProjectFeesInvoiceGridColumns();n.projectFeeInvoiceGridOptions.scrollable={endless:!1};n.projectFeeInvoiceGridOptions.height=0;n.projectFeeInvoiceGridOptions.toolbar=[];n.searchCriteria={PageNumber:1,PageSize:10,SortField:"InvoiceDueDate",IsSortedInAscendingOrder:!0,EntityId:n.$routeParams.id,IsPaidInvoices:n.selectedInvoiceType==i.InvoiceStatus.Paid,ModuleId:app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id)};n.projectFeeInvoiceGridOptions.change=n.onChange;n.projectFeeInvoiceGridOptions.persistSelection=!0;n.isTylerPaymentsUsed&&(n.inTylerCartInvoiceIds=n.cartService.tylerCartItems,n.inTylerCartInvoiceIds&&n.inTylerCartInvoiceIds.length>0&&angular.forEach(n.projectAssociatedInvoices,function(t){var i=n.inTylerCartInvoiceIds!==undefined&&n.inTylerCartInvoiceIds.length>0?n.inTylerCartInvoiceIds.filter(function(n){return n===t.InvoiceId}):[];t.IsPending&&i!==null&&i.length>0&&(t.StatusName="In Cart")}));t=n.projectFeeInvoiceGridOptions.toolbar;n.selectedInvoiceType==i.InvoiceStatus.Unpaid&&t.push({template:'<button id="button-AddToCart" class="k-button k-btn-primary" ng-click="vm.addToCart()" data-ng-disabled="vm.addToCartInProgress || !vm.hasSelectedItems()" ng-if="!vm.isTylerPaymentsUsed">'+this.myInvoiceAddToCartLabel+'<\/button><add-to-tyler-cart ng-if="vm.isTylerPaymentsUsed" use-telerik-class="true" no-need-reload="true" invoice-ids="vm.currentSelectedItems"><\/add-to-tyler-cart>'});t.push({template:'<label class="k-label-margin" for='+n.myInvoiceDisplayLabel+">"+n.myInvoiceDisplayLabel+'<\/label><select aria-invalid="false" aria-label='+n.myInvoiceDisplayLabel+' class="k-form-control" id="invoiceTypeOption" name="invoiceTypeOption" ng-model="vm.selectedInvoiceType" ng-options="item.Value as item.Key for item in vm.invoiceTypeList" ng-change="vm.filterInvoiceGrid()"><\/select>'});n.projectFeeInvoiceGridOptions.dataSource=n.getProjectFeesInvoiceDataSource()},t.prototype.invoicePaidUnPaidChange=function(){var n=this;n.searchCriteria.IsPaidInvoices=n.selectedInvoiceType==i.InvoiceStatus.Paid;n.projectFeeInvoiceGridOptions.dataSource.read()},t.prototype.onChange=function(n){var t=n.sender.$angular_scope.vm,i,r;t.currentSelectedItems=n.sender.selectedKeyNames();t.$scope.$applyAsync();i=n.sender.select();r=n.sender;i.each(function(n,i){var f=r.dataItem(i),e,u;f.AllowPendingInvoicePayment==!1&&f.IsPending==!0&&($(i).removeClass("k-state-selected"),e=$(i).find(".k-checkbox"),$(e).prop("checked",!1),u=t.currentSelectedItems.indexOf(f.InvoiceId,0),u!=null&&u!=-1&&t.currentSelectedItems.splice(u,1))})},t.prototype.filterInvoiceGrid=function(){var n=this;n.isAssociatedInvoicesGridLoading=!0;n.currentSelectedItems=[];n.invoicePaidUnPaidChange();n.isAssociatedInvoicesGridLoading=!1},t.prototype.addToCart=function(){if(this.addToCartInProgress=!0,this.currentSelectedItems.length==0){this.addToCartInProgress=!1;return}var n=this;this.pendingAddInvoiceIds=[];angular.forEach(this.currentSelectedItems,function(t){n.pendingAddInvoiceIds.push(t)});this.pendingAddInvoiceIds.length>0?n.addCartItems():n.addToCartInProgress=!1},t.prototype.addCartItems=function(){var n=this;angular.forEach(this.pendingAddInvoiceIds,function(t){var i={CartItemId:-1,CartDirectiveName:"energov-cart",CartData:null,CartDataId:t,UserId:-1,TenantId:-1,SoftwarePackageId:-1,SoftwarePackageName:"",Amount:0,IsNew:!0,IsDeleted:!1};n.pendingAddCartItems.push(i)});this.cartService.addCartItems(this.pendingAddCartItems,function(t){n.addToCartInProgress=!1;t&&(n.cartService.didCallGetTotalItem=!1,n.cartService.updateTotalNumOfItems(),n.cartService.didCallGetTotalItem=!0,n.$location.url("/mycart"))})},t.prototype.hasSelectedItems=function(){return this.currentSelectedItems.length>0},t.prototype.getProjectFeesInvoiceGridColumns=function(){return[{selectable:!0,width:"33px",attributes:{"class":"#=(AllowPendingInvoicePayment == false && IsPending == true) ? 'k-state-disabled':''#"},hidden:this.selectedInvoiceType!=i.InvoiceStatus.Unpaid},{field:"InvoiceNumber",title:this.invoiceNumberLabel,width:"180px",filterable:!1,attributes:{id:"invoice-number-#=InvoiceNumber#"},template:"<a class='k-grid-anchor' href='\\#/invoice/#=InvoiceId#'><span>#=InvoiceNumber#<\/span><\/a>"},{field:"TotalDue",title:this.amountDueLabel,width:"120px",format:"{0:c}",attributes:{id:"amount-due-#=InvoiceNumber#"},filterable:!1},{field:"InvoiceDueDate",title:this.dueDateLabel,width:"120px",filterable:!1,format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}",attributes:{id:"due-date-#=InvoiceNumber#"}},{field:"StatusName",title:this.invoiceStatusLabel,width:"188px",filterable:!1,attributes:{id:"status-name-#=InvoiceNumber#"}},{field:"EntityNumber",title:this.caseNumberLabel,width:"220px",attributes:{id:"entity-number-#=InvoiceNumber#"},filterable:!1},{field:"FullAddress",title:this.invoiceAddressLabel,width:"200px",attributes:{id:"full-address-#=InvoiceNumber#"},filterable:!1,sortable:!1}]},t.prototype.getProjectFeesInvoiceDataSource=function(){var t,n=this;return new kendo.data.DataSource({transport:{read:{url:n.globals.webApiBaseUrl+"/energov/projects/associated-invoices",data:n.searchCriteria,type:"POST",headers:(t={},t.tenantId=n.globals.tenantId,t.tenantName=n.globals.tenantName,t["Tyler-TenantUrl"]=n.globals.tenantUrl,t["Tyler-Tenant-Culture"]=n.globals.culture,t)},parameterMap:function(t,r){if(r=="read"){if(n.searchCriteria.PageNumber=t.page,n.searchCriteria.PageSize=t.pageSize,n.searchCriteria.IsPaidInvoices=n.selectedInvoiceType==i.InvoiceStatus.Paid,t.sort&&t.sort.length>0){var u=t.sort[t.sort.length-1];n.searchCriteria.SortField=u.field.toUpperCase();n.searchCriteria.IsSortedInAscendingOrder=u.dir=="asc"}return n.searchCriteria}}},pageSize:10,serverPaging:!0,serverSorting:!0,schema:{errors:"ErrorMessage",model:{id:"InvoiceId",fields:{InvoiceNumber:{type:"string"},TotalDue:{type:"number"},InvoiceDueDate:{type:"date"},StatusName:{type:"string"},EntityNumber:{type:"string"},FullAddress:{type:"string"}}},data:function(t){return n.projectAssociatedInvoices=t.Result,t.Result},parse:function(n){return $.map(n,function(n){n&&n.InvoiceDueDate!=null&&(n.InvoiceDueDate=kendo.toString(kendo.parseDate(n.InvoiceDueDate),app.Constants.GlobalConstants.DateFormatForSearch))}),n},total:function(n){return n.Result!=null&&n.Result!=undefined&&n.Result.length>0?n.Result[0].TotalFound:0}},error:function(t){n.errorMessage=t.xhr&&t.xhr.responseJSON&&t.xhr.responseJSON.ErrorMessage?t.xhr.responseJSON.ErrorMessage:t.errors?t.errors:t.errorThrown}})},t}(app.Core.Controllers.CoreController);t.EnerGovProjectAssociatedInvoicesController=r})(i=t.Controllers||(t.Controllers={}))})(t=n.Project||(n.Project={}))}(EnerGov||(EnerGov={}));__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,e,o,s,h,c,l,a){var v=n.call(this)||this;return v.$scope=t,v.$routeParams=i,v.enerGovMyEntityTelerikService=f,v.enerGovProjectService=e,v.resourceService=o,v.tenantService=s,v.cartService=h,v.selfServiceStateService=c,v.entityTabsService=l,v.$q=a,v.isProjectFeeGridLoading=!1,v.projectFees=[],v.isTenantUsesTylerPayments=function(){var n=v;v.tenantService.isTylerPaymentsUsed(function(t){n.isTylerPaymentsUsed=t})},v}return __extends(t,n),t.prototype.init=function(){var n=this;n.isTenantUsesTylerPayments();n.setProjectFeesTabVisibility();n.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Project.ProjectResource",["EnerGovProjectDetails_ProjectFee_Title","EnerGovProjectDetails_ProjectInvoice_Title","EnerGovProjectDetails_Computed_Title","EnerGovProjectDetails_ProjectFeeStatus_Title","EnerGovProjectDetails_AmountDue_Title"],function(t){n.projectFeeLabel=t.EnerGovProjectDetails_ProjectFee_Title;n.projectInvoiceLabel=t.EnerGovProjectDetails_ProjectInvoice_Title;n.projectComputedLabel=t.EnerGovProjectDetails_Computed_Title;n.projectAmountDueLabel=t.EnerGovProjectDetails_AmountDue_Title;n.projectStatusLabel=t.EnerGovProjectDetails_ProjectFeeStatus_Title;n.searchAndFillGrid();n.filltProjectFeeSummary()},!0)},t.prototype.setProjectFeesTabVisibility=function(){var n=this,t={PageNumber:1,PageSize:10,SortField:"FeeName",IsSortedInAscendingOrder:!0,EntityId:n.$routeParams.id,IsPaidInvoices:!1,ModuleId:app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(n.$location,n.$routeParams.id)},i={PageNumber:1,PageSize:10,SortField:"InvoiceDueDate",IsSortedInAscendingOrder:!0,EntityId:n.$routeParams.id,IsPaidInvoices:!0,ModuleId:app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(n.$location,n.$routeParams.id)},r={PageNumber:1,PageSize:10,SortField:"InvoiceDueDate",IsSortedInAscendingOrder:!0,EntityId:n.$routeParams.id,IsPaidInvoices:!1,ModuleId:app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(n.$location,n.$routeParams.id)},u=n.enerGovProjectService.getProjectFees(t,function(t){n.projectFeesResultForTab=t}),f=n.enerGovProjectService.getProjectAssociatedInvoices(i,function(t){n.paidAssociatedInvoicesResultForTab=t}),e=n.enerGovProjectService.getProjectAssociatedInvoices(r,function(t){n.unPaidAssociatedInvoicesResultForTab=t});n.$q.all([u,f,e]).then(function(){n.projectFeesResultForTab.StatusCode==app.Common.Services.HttpStatusCode.PreconditionFailed||n.paidAssociatedInvoicesResultForTab.StatusCode==app.Common.Services.HttpStatusCode.PreconditionFailed||n.unPaidAssociatedInvoicesResultForTab.StatusCode==app.Common.Services.HttpStatusCode.PreconditionFailed?(n.errorMessage=n.projectFeesResultForTab.StatusCode==app.Common.Services.HttpStatusCode.PreconditionFailed?n.projectFeesResultForTab.ErrorMessage:n.paidAssociatedInvoicesResultForTab.StatusCode==app.Common.Services.HttpStatusCode.PreconditionFailed?n.paidAssociatedInvoicesResultForTab.ErrorMessage:n.unPaidAssociatedInvoicesResultForTab.ErrorMessage,n.entityTabsService.showFeesTab=!0,n.$routeParams.tab&&n.$routeParams.tab==app.Constants.TabConstants.Fees?n.entityTabsService.setAdditionalEntityTabsVisibility(n.$routeParams.tab,n.entityTabsService.showFeesTab):n.entityTabsService.setFirstTabOnHidingOtherTabs()):(n.projectFeesResultForTab.StatusCode==app.Common.Services.HttpStatusCode.NoContent||n.projectFeesResultForTab.StatusCode==app.Common.Services.HttpStatusCode.Forbidden)&&(n.paidAssociatedInvoicesResultForTab.StatusCode==app.Common.Services.HttpStatusCode.NoContent||n.paidAssociatedInvoicesResultForTab.StatusCode==app.Common.Services.HttpStatusCode.Forbidden)&&(n.unPaidAssociatedInvoicesResultForTab.StatusCode==app.Common.Services.HttpStatusCode.NoContent||n.unPaidAssociatedInvoicesResultForTab.StatusCode==app.Common.Services.HttpStatusCode.Forbidden)&&(n.entityTabsService.showFeesTab=!1,n.$routeParams.tab&&n.$routeParams.tab==app.Constants.TabConstants.Fees?n.entityTabsService.setAdditionalEntityTabsVisibility(n.$routeParams.tab,n.entityTabsService.showFeesTab):n.entityTabsService.setFirstTabOnHidingOtherTabs())})},t.prototype.searchAndFillGrid=function(){var n=this;n.isProjectFeeGridLoading=!0;n.projectFeeGridOptions=n.enerGovMyEntityTelerikService.getTelerikGridOptions();n.projectFeeGridOptions.pageable=n.enerGovMyEntityTelerikService.getPageable();n.projectFeeGridOptions.columns=n.getProjectFeesGridColumns();n.projectFeeGridOptions.pageable.responsive=!1;n.projectFeeGridOptions.scrollable={endless:!1};n.projectFeeGridOptions.height=0;n.projectFeeGridOptions.toolbar=[];n.searchDataCriteria={PageNumber:1,PageSize:10,SortField:"FeeName",IsSortedInAscendingOrder:!0,EntityId:n.$routeParams.id,IsPaidInvoices:!1,ModuleId:app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id)};n.projectFeeGridOptions.dataSource=n.getProjectFeesDataSource();n.isProjectFeeGridLoading=!1},t.prototype.filltProjectFeeSummary=function(){var n=this;n.enerGovProjectService.getProjectFeesSummaryById(n.$routeParams.id,function(t){t&&(n.entityFeeSummaryInfo={TotalFee:t.PaidFees+t.UnpaidFees,TotalPaidFee:t.PaidFees,TotalUnpaidFee:t.UnpaidFees})})},t.prototype.getProjectFeesGridColumns=function(){var n=this;return[{field:"FeeName",title:n.projectFeeLabel,width:200,filterable:!1,attributes:{id:"project-fee-#=InvoiceNumber#"}},{field:"InvoiceNumber",title:n.projectInvoiceLabel,width:200,attributes:{id:"project-invoice-#=InvoiceNumber#"},template:"<a class='k-grid-anchor' href='\\#/invoice/#=InvoiceId#'><span>#=InvoiceNumber#<\/span><\/a>",filterable:!1},{field:"Computed",title:n.projectComputedLabel,width:200,format:"{0:c}",attributes:{id:"project-computed-#=InvoiceNumber#"},filterable:!1},{field:"AmountDue",title:n.projectAmountDueLabel,width:200,format:"{0:c}",attributes:{id:"project-amountdue-#=InvoiceNumber#"},filterable:!1},{field:"StatusName",title:n.projectStatusLabel,width:200,attributes:{id:"project-status-#=InvoiceNumber#"},filterable:!1}]},t.prototype.getProjectFeesDataSource=function(){var t,n=this;return new kendo.data.DataSource({transport:{read:{url:n.globals.webApiBaseUrl+"/energov/projects/fees",data:n.searchDataCriteria,type:"POST",headers:(t={},t.tenantId=n.globals.tenantId,t.tenantName=n.globals.tenantName,t["Tyler-TenantUrl"]=n.globals.tenantUrl,t["Tyler-Tenant-Culture"]=n.globals.culture,t)},parameterMap:function(t,i){if(i=="read"){if(n.searchDataCriteria.PageNumber=t.page,n.searchDataCriteria.PageSize=t.pageSize,t.sort&&t.sort.length>0){var r=t.sort[t.sort.length-1];n.searchDataCriteria.SortField=r.field.toUpperCase();n.searchDataCriteria.IsSortedInAscendingOrder=r.dir=="asc"}return n.searchDataCriteria}}},pageSize:10,serverPaging:!0,serverSorting:!0,schema:{model:{fields:{FeeName:{type:"string"},InvoiceNumber:{type:"string"},Computed:{type:"number"},AmountDue:{type:"number"},StatusName:{type:"string"}}},data:function(t){return n.projectFees=t.Result,t.Result},total:function(n){return n.Result!=null&&n.Result!=undefined&&n.Result.length>0?n.Result[0].TotalFound:0}}})},t}(app.Core.Controllers.CoreController);n.EnerGovProjectFeesController=t})(t=n.Controllers||(n.Controllers={}))})(t=n.Project||(n.Project={}))}(EnerGov||(EnerGov={}));__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,e,o,s,h,c,l,a,v,y){var p=n.call(this,null)||this;return p.$routeParams=t,p.$location=i,p.globalService=r,p.pageTitleService=u,p.enerGovCustomFieldsService=f,p.customFieldsService=e,p.tabNavigatorService=o,p.entityTabsService=s,p.enerGovProjectService=h,p.resourceService=c,p.selfServiceStateService=l,p.tenantService=a,p.cartService=v,p.userService=y,p.isCollapsed=!1,p.projectTabs=app.Constants.ProjectTabs,p.showPayNow=!1,p.isUpdateContactSupported=!1,p.contactTypeList=[],p.isTenantUsesTylerPayments=function(){var n=p;p.tenantService.isTylerPaymentsUsed(function(t){n.isTylerPaymentsUsed=t})},p.init(),p}return __extends(t,n),t.prototype.collapsePanel=function(){this.isCollapsed=!this.isCollapsed},t.prototype.getContactTypeData=function(){var n=this;this.enerGovProjectService.getContactTypeData(function(t){n.contactTypeList=t})},t.prototype.init=function(){var i=this,n=this,t;n.tabNavigatorService.cleanUp();n.customFieldsService.setLayout(null);n.isUpdateContactSupported=app.Common.Helpers.VersionSupport(this.globalService.enerGovAPIVersion,"2021.3.1.0");n.userService.isUserLoggedIn&&n.isUpdateContactSupported&&n.getContactTypeData();t=app.Common.Helpers.ModuleHelper.getSelfServiceModuleId(this.$location,this.$routeParams.id);n.entityTabsService.setEntityTabsVisibility(n.$routeParams.id,t,n.$routeParams.tab);n.enerGovProjectService.getProjectById(this.$routeParams.id,function(r){n.model=r;n.selfServiceStateService.setParentModel(r);n.model!=null&&n.model.ProjectId?(n.pageTitleService.setPageTitle(n.model.ProjectName),n.model.LayoutId!==null&&n.model.LayoutId!==""&&n.model.ProjectId!==null&&n.model.ProjectId!==""?n.enerGovCustomFieldsService.getCustomLayoutWithData(n.model.LayoutId,null,n.model.ProjectId,t,function(t){t.Success?t.Result!=null?n.customFieldsService.setLayout(t.Result):n.errorMessage=t.ErrorMessage:(t.StatusCode===app.Common.Services.HttpStatusCode.PreconditionFailed||t.StatusCode===app.Common.Services.HttpStatusCode.NoContent||t.StatusCode===app.Common.Services.HttpStatusCode.Forbidden)&&(n.errorMessage=t.ErrorMessage)}):(n.entityTabsService.showMoreInfoTab=!1,n.$routeParams.tab&&n.$routeParams.tab==app.Constants.TabConstants.Moreinfo?n.entityTabsService.setAdditionalEntityTabsVisibility(n.$routeParams.tab,n.entityTabsService.showMoreInfoTab):n.entityTabsService.setFirstTabOnHidingOtherTabs()),n.model.IsLoggedIn&&n.model.HasAuthorizedContact&&n.model.AllowPayNow&&n.model.UnPaidInvoicedFees?n.isTylerPaymentsUsed||n.cartService.getPendingInvoices(n.model.UnpaidInvoiceIds,function(t){n.invoicesPending=t;n.showPayNow=t.length>0&&t.length==n.model.UnpaidInvoiceIds.length?!1:!0}):n.showPayNow=!0):n.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.Project.ProjectResource",["EnerGovProjectView_UnableToLoad"],function(n){alert(n.EnerGovProjectView_UnableToLoad);i.$location.url("/")})})},t}(app.Core.Controllers.CoreController);n.EnerGovProjectViewController=t})(t=n.Controllers||(n.Controllers={}))})(t=n.Project||(n.Project={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){"use strict";var t=n.Controllers.EnerGovProjectViewController,i=n.Controllers.EnerGovEntityProjectSummaryController,r=n.Controllers.EnerGovProjectFeesController,u=n.Controllers.EnerGovProjectAssociatedInvoicesController,f=n.Services.EnerGovProjectService;angular.module("enerGov.project",["app.globalsModule","app.Common.Services"]).service("enerGovProjectService",["http",f]).controller("enerGovEntityProjectSummaryController",["$routeParams","enerGovProjectService","tabNavigatorService","entityTabsService",i]).controller("enerGovProjectViewController",["$routeParams","$location","globalsService","pageTitleService","enerGovCustomFieldsService","customFieldsService","tabNavigatorService","entityTabsService","enerGovProjectService","resourceService","selfServiceStateService","tenantService","cartService","userService",t]).controller("enerGovProjectFeesController",["$scope","$routeParams","$location","globalsService","enerGovMyEntityTelerikService","enerGovProjectService","resourceService","tenantService","cartService","selfServiceStateService","entityTabsService","$q",r]).controller("enerGovProjectAssociatedInvoicesController",["$scope","$routeParams","$location","globalsService","enerGovMyEntityTelerikService","enerGovProjectService","resourceService","tenantService","cartService","selfServiceStateService",u])})(t=n.Project||(n.Project={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){this.http=n;this.escrowAccountsSettingService=t;this.$location=i;this.rootUrl="/energov/my-escrow-accounts/"}return n.prototype.showMyEscrowAccount=function(n){var t=this;t.escrowAccountsSettingService.getTenantEscrowAccountsSettings(function(i){i.AccountsVisible?t.checkEscrowAccountExist(function(t){n(t)}):n(!1)})},n.prototype.checkEscrowAccountExist=function(n){var t=this,i;t.isEscrowAccountExist?n(t.isEscrowAccountExist):(i=!1,t.http.get(t.rootUrl+"is-escrow-account-exist/"+i,function(i){i.Success&&(t.isEscrowAccountExist=i.Result,n(t.isEscrowAccountExist))},!0))},n.prototype.getAccountById=function(n,t){var i=this,r=this.rootUrl+n;this.http.get(r,function(n){n.Success||i.$location.url("/");t(n.Result)},!1)},n.prototype.getEscrowAccountHistory=function(n,t){this.http.post(this.rootUrl+"history/",n,function(n){t(n.Result)},!0)},n}();n.EnerGovMyEscrowAccountsService=t})(t=n.Services||(n.Services={}))})(t=n.EscrowAccount||(n.EscrowAccount={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){var t;(function(n){"use strict";var t=function(){function n(n){this.http=n}return n.prototype.getTenantEscrowAccountsSettings=function(n){var t=this;t.escrowAccountSettings?n(t.escrowAccountSettings):t.http.get("/escrowaccounts/public/tenant",function(i){i.Success&&(t.escrowAccountSettings=i.Result,n(t.escrowAccountSettings))},!0)},n}();n.EscrowAccountsSettingService=t})(t=n.Services||(n.Services={}))})(t=n.EscrowAccount||(n.EscrowAccount={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i){var u=n.call(this)||this,r;return u.enerGovMyEscrowAccountsService=t,u.pageTitleService=i,r=u,r.enerGovMyEscrowAccountsService.getAccountById(r.$routeParams.id,function(n){if(n!=null){r.myEscrowAccount=n;var t=r.myEscrowAccount.AccountName+" ("+r.myEscrowAccount.AccountTypeName+")";r.pageTitleService.setPageTitle(t)}}),u}return __extends(t,n),t.prototype.showAddFundPopup=function(){var n="#addFundModal-"+this.myEscrowAccount.AccountNumber.split(" ").join("-")+".modal.fade";$(n).modal("show")},t}(app.Core.Controllers.CoreController);n.EnerGovEscrowAccountDetailController=t})(t=n.EscrowAccount||(n.EscrowAccount={}))}(EnerGov||(EnerGov={}));__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){"use strict";var i=n.Common.Constant.EscrowAccountHistoryDateRangeConstants,u=n.Common.CaseTypeUseEnums.AccountCaseModules,r=n.Common.CaseTypeUseEnums.AccountAction,f=function(n){function t(t,i,r,u){var f=n.call(this)||this;return f.enerGovMyEscrowAccountsService=t,f.resourceService=i,f.enerGovMyEntityTelerikService=r,f.authUtils=u,f.isEscrowAccountHistoryGridLoading=!1,f.escrowAccountsHistory=[],f.dateRangeOptionsList=[],f.selectedDateRangeOption=null,f.StartDateShow="",f.EndDateShow="",f.isCustomDateRange=!1,f}return __extends(t,n),t.prototype.init=function(){var t=this,n=this;n.accessToken=n.globals.tylerIdEnabled?n.authUtils.getTylerIdToken().access_token:n.authUtils.getToken().access_token;n.datePickerControlSettings={datePickerOptions:{formatYear:"yy",startingDay:0,showWeeks:!1,maxDate:null},disableEnerGovNonWorkDay:null};n.searchDataCriteria={PageNumber:1,PageSize:2e3,SortField:"Date",IsSortedInAscendingOrder:!1,EscrowAccountId:n.$routeParams.id,ModuleId:0,EndDate:new Date(moment(new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate())).local().format(app.Constants.GlobalConstants.DateFormat)),StartDate:new Date(moment(new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()-30)).local().format(app.Constants.GlobalConstants.DateFormat)),EntityId:""};n.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.EscrowAccount.EscrowAccountResource",["EnerGovEscrowAccountHistory_AccountDate_Title","EnerGovEscrowAccount_AccountType_Title","EnerGovEscrowAccountHistory_AccountRecord_Title","EnerGovEscrowAccountHistory_AccountAmount_Title","EnerGovEscrowAccountHistory_AccountInvoice_Title","EnerGovEscrowAccountHistory_DateRange_Last30Days","EnerGovEscrowAccountHistory_DateRange_Last60Days","EnerGovEscrowAccountHistory_DateRange_Last90Days","EnerGovEscrowAccountHistory_DateRange_CustomRange","EnerGovEscrowAccountHistory_Payment_Text","EnerGovEscrowAccountHistory_Deposit_Text"],function(r){n.escrowAccountHistoryDateLabel=r.EnerGovEscrowAccountHistory_AccountDate_Title;n.escrowAccountHistoryAccountTypeLabel=r.EnerGovEscrowAccount_AccountType_Title;n.escrowAccountHistoryRecordLabel=r.EnerGovEscrowAccountHistory_AccountRecord_Title;n.escrowAccountHistoryInvoiceLabel=r.EnerGovEscrowAccountHistory_AccountInvoice_Title;n.escrowAccountHistoryAmountLabel=r.EnerGovEscrowAccountHistory_AccountAmount_Title;n.escrowAccountHistoryPaymentLabel=r.EnerGovEscrowAccountHistory_Payment_Text;n.escrowAccountHistoryDepositLabel=r.EnerGovEscrowAccountHistory_Deposit_Text;n.dateRangeOptionsList=[{Id:i.Last30Days,Name:r.EnerGovEscrowAccountHistory_DateRange_Last30Days},{Id:i.Last60Days,Name:r.EnerGovEscrowAccountHistory_DateRange_Last60Days},{Id:i.Last90Days,Name:r.EnerGovEscrowAccountHistory_DateRange_Last90Days},{Id:0,Name:r.EnerGovEscrowAccountHistory_DateRange_CustomRange}];n.selectedDateRangeOption==null&&(t.selectedDateRangeOption=t.dateRangeOptionsList[0].Id);n.searchAndFillGrid()},!0)},t.prototype.filterDateRange=function(){var n=this;n.isCustomDateRange=n.selectedDateRangeOption==0?!0:!1;n.isCustomDateRange||n.searchHistoryByDateRange()},t.prototype.searchHistoryByDateRange=function(){var n=this;n.isCustomDateRange?(n.searchDataCriteria.StartDate=new Date(n.StartDateShow),n.searchDataCriteria.EndDate=new Date(n.EndDateShow)):(n.searchDataCriteria.EndDate=new Date(moment(new Date).local().format(app.Constants.GlobalConstants.DateFormat)),n.searchDataCriteria.StartDate=new Date(moment(new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()-(n.selectedDateRangeOption==i.Last30Days?i.Last30Days:n.selectedDateRangeOption==i.Last60Days?i.Last60Days:i.Last90Days))).local().format(app.Constants.GlobalConstants.DateFormat)),n.StartDateShow=moment(n.searchDataCriteria.StartDate).local().format(app.Constants.GlobalConstants.DateFormat),n.EndDateShow=moment(n.searchDataCriteria.EndDate).local().format(app.Constants.GlobalConstants.DateFormat));n.searchDataCriteria.PageSize=2e3;n.searchDataCriteria.PageNumber=1;n.searchDataCriteria.IsSortedInAscendingOrder=!1;n.searchDataCriteria.SortField="Date";n.isEscrowAccountHistoryGridLoading=!0;n.searchDataAndBindDataSource()},t.prototype.searchAndFillGrid=function(){var n=this;n.isEscrowAccountHistoryGridLoading=!0;n.escrowAccountHistoryGridOptions=n.enerGovMyEntityTelerikService.getTelerikGridOptions();n.escrowAccountHistoryGridOptions.pageable=n.enerGovMyEntityTelerikService.getPageable();n.escrowAccountHistoryGridOptions.columns=n.getEscrowAccountHistoryGridColumns();n.escrowAccountHistoryGridOptions.scrollable={endless:!1};n.escrowAccountHistoryGridOptions.toolbar=[];n.escrowAccountHistoryGridOptions.toolbar=[{template:"<span class='k-textbox k-grid-search k-display-flex'><input id='search-bar' autocomplete='off' placeholder='Filter...' title='Filter...' class='k-input'><span class='k-input-icon'><span class='k-icon k-i-search'><\/span><\/span><\/span>"},"excel"];n.escrowAccountHistoryGridOptions.height=0;n.isCustomDateRange||(n.StartDateShow=moment(n.searchDataCriteria.StartDate).local().format(app.Constants.GlobalConstants.DateFormat),n.EndDateShow=moment(n.searchDataCriteria.EndDate).local().format(app.Constants.GlobalConstants.DateFormat));n.searchDataCriteria.EndDate=new Date(n.EndDateShow);n.searchDataCriteria.StartDate=new Date(n.StartDateShow);n.searchDataAndBindDataSource()},t.prototype.searchDataAndBindDataSource=function(){var n=this;n.enerGovMyEscrowAccountsService.getEscrowAccountHistory(n.searchDataCriteria,function(t){n.escrowAccountHistoryGridOptions.dataSource=n.getEscrowAccountHistoryGridDataSource(t);n.isEscrowAccountHistoryGridLoading=!1})},t.prototype.getEscrowAccountHistoryGridColumns=function(){var n=this;return[{field:"PaymentDate",title:n.escrowAccountHistoryDateLabel,width:200,format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}",filterable:{ui:function(n){n.kendoDatePicker({format:"{0:"+app.Constants.GlobalConstants.DateFormatForSearch+"}"})}},attributes:{id:"account-history-#=Date#"}},{field:"PaymentType",title:n.escrowAccountHistoryAccountTypeLabel,width:200,attributes:{id:"account-history-#=Date#"},template:function(t){return t.AccountActionId==r.Credit?"<span>"+n.escrowAccountHistoryDepositLabel+"<\/span>":"<span>"+n.escrowAccountHistoryPaymentLabel+"<\/span>"},filterable:{multi:!0,search:!0}},{field:"InvoiceNumber",title:n.escrowAccountHistoryInvoiceLabel,width:200,attributes:{id:"account-history-#=Date#"},filterable:!0,template:function(n){var t,r,i;return t=n.InvoiceId,r=n.InvoiceNumber,i="",t!=null&&(i="<a class='k-grid-anchor' data-ng-href='#/invoice/"+t+"'>"+r+"<\/a>"),i}},{field:"CaseNumber",title:n.escrowAccountHistoryRecordLabel,width:200,attributes:{id:"account-history-#=Date#"},filterable:!0,template:function(t){var o,i,e,f,s;i=t.CaseId;e=t.CaseNumber;f="";s="#/"+o+"/"+i;switch(t.ModuleId){case u.Permit:f=t.AccountActionId==r.Debit?"<a class='k-grid-anchor' data-ng-href='#/permit/"+i+"'>"+e+"<\/a>":"<span>"+n.escrowAccountHistoryDepositLabel+"<\/span>";break;case u.Plan:f=t.AccountActionId==r.Debit?"<a class='k-grid-anchor' data-ng-href='#/plan/"+i+"'>"+e+"<\/a>":"<span>"+n.escrowAccountHistoryDepositLabel+"<\/span>";break;case u.Project:f=t.AccounAccountActionIdtId==r.Debit?"<a class='k-grid-anchor' data-ng-href='#/project/"+i+"'>"+e+"<\/a>":"<span>"+n.escrowAccountHistoryDepositLabel+"<\/span>";break;default:f=t.AccountActionId==r.Credit&&i==""?"<span>"+n.escrowAccountHistoryDepositLabel+"<\/span>":"<span>"+e+"<\/span>"}return f}},{field:"Amount",title:n.escrowAccountHistoryAmountLabel,width:200,attributes:{id:"account-history-#=Date#",style:"text-align:right;"},headerAttributes:{style:"text-align: right !important;"},template:function(n){var t=n.Amount;return n.AccountActionId==r.Credit?"<span style='color: green;'>+{{"+t+"| currency : $ : 2 }}<\/span>":"<span>{{"+t+"| currency : $ : 2 }}<\/span>"},filterable:!0}]},t.prototype.getEscrowAccountHistoryGridDataSource=function(n){return new kendo.data.DataSource({transport:{read:function(t){t.success(n)}},pageSize:10,schema:{model:{fields:{PaymentDate:{type:"date"},PaymentType:{type:"string"},InvoiceId:{type:"string"},InvoiceNumber:{type:"string"},CaseId:{type:"string"},CaseNumber:{type:"string"},Amount:{type:"number"},AccountActionId:{type:"number"}}},parse:function(n){return $.map(n,function(n){n!=null&&n.PaymentDate!=null&&(n.PaymentDate=kendo.toString(kendo.parseDate(n.PaymentDate),app.Constants.GlobalConstants.DateFormatForSearch))}),n}}})},t}(app.Core.Controllers.CoreController);t.EnerGovEscrowAccountHistoryController=f})(t=n.EscrowAccount||(n.EscrowAccount={}))}(EnerGov||(EnerGov={}));__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){"use strict";var t=function(n){function t(t,i,r,u){var f=n.call(this)||this;return f.enerGovMyEscrowAccountsService=t,f.resourceService=i,f.enerGovMyEntityTelerikService=r,f.authUtils=u,f.tabName="Ecsrow Accounts",f.isMyEscrowAccountsGridLoading=!1,f.myEscrowAccounts=[],f}return __extends(t,n),t.prototype.init=function(){var n=this;n.accessToken=n.globals.tylerIdEnabled?n.authUtils.getTylerIdToken().access_token:n.authUtils.getToken().access_token;n.tabName=n.enerGovMyEscrowAccountsService.escrowAccountsSettingService.escrowAccountSettings.AccountTerminology;n.resourceService.getSpecificKeyValues("SelfService.EnerGov.Resources.EscrowAccount.EscrowAccountResource",["EnerGovEscrowAccount_AccountNumber_Title","EnerGovEscrowAccount_AccountName_Title","EnerGovEscrowAccount_AccountType_Title","EnerGovEscrowAccount_AccountBalance_Title","EnerGovEscrowAccount_AddFund_Title"],function(t){n.accountNumberLabel=t.EnerGovEscrowAccount_AccountNumber_Title;n.accountNameLabel=t.EnerGovEscrowAccount_AccountName_Title;n.accountBalanceLabel=t.EnerGovEscrowAccount_AccountBalance_Title;n.accountTypeLabel=t.EnerGovEscrowAccount_AccountType_Title;n.addFundLabel=t.EnerGovEscrowAccount_AddFund_Title;n.searchAndFillGrid()},!0)},t.prototype.searchAndFillGrid=function(){var n=this;n.isMyEscrowAccountsGridLoading=!0;n.myEscrowAccountsGridOptions=n.enerGovMyEntityTelerikService.getTelerikGridOptions();n.myEscrowAccountsGridOptions.pageable=n.enerGovMyEntityTelerikService.getPageable();n.myEscrowAccountsGridOptions.columns=n.getMyEscrowAccountsGridColumns();n.myEscrowAccountsGridOptions.pageable.responsive=!1;n.myEscrowAccountsGridOptions.scrollable={endless:!1};n.myEscrowAccountsGridOptions.height=0;n.myEscrowAccountsGridOptions.toolbar=null;n.searchDataCriteria={PageNumber:1,PageSize:10,SortField:"AccountNumber",IsSortedInAscendingOrder:!0,EntityId:"",ModuleId:0};n.myEscrowAccountsGridOptions.dataSource=n.getMyEscrowAccountsGridDataSource();n.isMyEscrowAccountsGridLoading=!1},t.prototype.getMyEscrowAccountsGridColumns=function(){var n=this,t=[{field:"AccountNumber",title:n.accountNumberLabel,width:200,filterable:!1,attributes:{id:"account-number-#=AccountNumber#"},template:"<a class='k-grid-anchor' href='\\#/account/#=AccountId#'><span>#=AccountNumber#<\/span><\/a>"},{field:"AccountName",title:n.accountNameLabel,width:200,attributes:{id:"account-name-#=AccountNumber#"},filterable:!1},{field:"AccountTypeName",title:n.accountTypeLabel,width:200,attributes:{id:"account-type-#=AccountNumber#"},filterable:!1},{field:"AccountBalance",title:n.accountBalanceLabel,width:200,format:"{0:c}",attributes:{id:"account-balance-#=AccountNumber#"},filterable:!1}];return n.enerGovMyEscrowAccountsService.escrowAccountsSettingService.escrowAccountSettings.ManageAccountsOnline&&t.push({field:"",title:n.addFundLabel,width:100,filterable:!1,attributes:{id:"add-fund-#=AccountNumber#"},template:function(t){return"<button id='btn-add-funds-"+t.AccountNumber+'\' class="k-button k-btn-primary" ng-click="vm.showAddFundPopup(\''+t.AccountNumber+"')\">"+n.addFundLabel+"<\/button>"}}),t},t.prototype.showAddFundPopup=function(n){var t="#addFundModal-"+n.split(" ").join("-")+".modal.fade";$(t).modal("show")},t.prototype.getMyEscrowAccountsGridDataSource=function(){var t,n=this;return new kendo.data.DataSource({transport:{read:{url:n.globals.webApiBaseUrl+"/energov/my-escrow-accounts/search",data:n.searchDataCriteria,type:"POST",headers:(t={},t.tenantId=n.globals.tenantId,t.tenantName=n.globals.tenantName,t["Tyler-TenantUrl"]=n.globals.tenantUrl,t["Tyler-Tenant-Culture"]=n.globals.culture,t.Authorization="Bearer "+n.accessToken,t)},parameterMap:function(t,i){if(i=="read"){if(n.searchDataCriteria.PageNumber=t.page,n.searchDataCriteria.PageSize=t.pageSize,t.sort&&t.sort.length>0){var r=t.sort[t.sort.length-1];n.searchDataCriteria.SortField=r.field.toUpperCase();n.searchDataCriteria.IsSortedInAscendingOrder=r.dir=="asc"}return n.searchDataCriteria}}},pageSize:10,serverPaging:!0,serverSorting:!0,schema:{errors:"ErrorMessage",model:{id:"AccountId",fields:{AccountNumber:{type:"string"},AccountName:{type:"string"},AccountBalance:{type:"number"},AccountType:{type:"string"}}},data:function(t){return n.myEscrowAccounts=t.Result,t.Result},total:function(n){return n.Result!=null&&n.Result!=undefined&&n.Result.length>0?n.Result[0].TotalFound:0}},error:function(t){n.errorMessage=t.xhr&&t.xhr.responseJSON&&t.xhr.responseJSON.ErrorMessage?t.xhr.responseJSON.ErrorMessage:t.errorThrown}})},t}(app.Core.Controllers.CoreController);n.EnerGovMyEscrowAccountsController=t})(t=n.EscrowAccount||(n.EscrowAccount={}))}(EnerGov||(EnerGov={})),function(n){var t;(function(n){"use strict";angular.module("enerGov.EscrowAccount",["app.Common.Services"]).service("escrowAccountsSettingService",["http",n.Services.EscrowAccountsSettingService]).service("enerGovMyEscrowAccountsService",["http","escrowAccountsSettingService","$location",n.Services.EnerGovMyEscrowAccountsService]).controller("enerGovMyEscrowAccountsController",["enerGovMyEscrowAccountsService","resourceService","enerGovMyEntityTelerikService","authUtils",n.EnerGovMyEscrowAccountsController]).controller("enerGovEscrowAccountDetailController",["enerGovMyEscrowAccountsService","pageTitleService",n.EnerGovEscrowAccountDetailController]).controller("enerGovEscrowAccountHistoryController",["enerGovMyEscrowAccountsService","resourceService","enerGovMyEntityTelerikService","authUtils",n.EnerGovEscrowAccountHistoryController])})(t=n.EscrowAccount||(n.EscrowAccount={}))}(EnerGov||(EnerGov={}))