var app;(function(n){var t;(function(n){"use strict";var t,i;(function(n){n[n.SearchStart=0]="SearchStart";n[n.PageLoadCompleted=1]="PageLoadCompleted";n[n.SearchCompleted=2]="SearchCompleted";n[n.SortCompleted=3]="SortCompleted"})(t=n.SearchEvents||(n.SearchEvents={})),function(n){n[n.Reload=0]="Reload"}(i=n.GridEvents||(n.GridEvents={}))})(t=n.Events||(n.Events={}))})(app||(app={})),function(n){var t;(function(n){var t;(function(n){var t;(function(n){n[n.RequestTimeout=408]="RequestTimeout";n[n.PreconditionFailed=412]="PreconditionFailed";n[n.NoContent=204]="NoContent";n[n.Forbidden=403]="Forbidden"})(t=n.HttpStatusCode||(n.HttpStatusCode={}))})(t=n.Services||(n.Services={}))})(t=n.Common||(n.Common={}))}(app||(app={})),function(n){var t;(function(n){var t,i,r,u,f,e,o,s,h,c;(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"})(t=n.SearchModule||(n.SearchModule={})),function(n){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";n[n.Project=14]="Project";n[n.OperationalPermit=15]="OperationalPermit"}(i=n.SelfServiceModules||(n.SelfServiceModules={})),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"}(r=n.SelfServicePermitGroupType||(n.SelfServicePermitGroupType={})),function(n){n[n.GroupBox=0]="GroupBox";n[n.TextBox=1]="TextBox";n[n.ComboBox=2]="ComboBox";n[n.CheckBox=3]="CheckBox";n[n.TabControl=4]="TabControl";n[n.TabItem=5]="TabItem";n[n.Label=6]="Label";n[n.Image=7]="Image";n[n.Hyperlink=8]="Hyperlink";n[n.Worksheet=9]="Worksheet";n[n.Table=10]="Table"}(u=n.CustomFieldsControlTypes||(n.CustomFieldsControlTypes={})),function(n){n[n.Number=1]="Number";n[n.Currency=2]="Currency";n[n.Date=3]="Date";n[n.WholeNumber=4]="WholeNumber";n[n.Text=5]="Text";n[n.Memo=6]="Memo";n[n.Bln=7]="Bln";n[n.GID=8]="GID"}(f=n.CustomFieldCellTypes||(n.CustomFieldCellTypes={})),function(n){n[n.Apply=0]="Apply";n[n.ResumeDraft=1]="ResumeDraft";n[n.CreateTemplate=2]="CreateTemplate";n[n.UpdateTemplate=3]="UpdateTemplate";n[n.UseTemplate=4]="UseTemplate"}(e=n.MenuActionType||(n.MenuActionType={})),function(n){n[n.Permit=2]="Permit";n[n.Plan=3]="Plan"}(o=n.TwilioRequestEnerGovModules||(n.TwilioRequestEnerGovModules={})),function(n){n[n.UseDefault=0]="UseDefault";n[n.No=1]="No";n[n.Yes=2]="Yes"}(s=n.CommonOptions||(n.CommonOptions={})),function(n){n[n.UseDefault=0]="UseDefault";n[n.Both=1]="Both";n[n.Neither=2]="Neither";n[n.Applicant=3]="Applicant";n[n.Parent=4]="Parent"}(h=n.SubContactTypeOptions||(n.SubContactTypeOptions={})),function(n){n[n.AlertMessageOnly=1]="AlertMessageOnly";n[n.StopActionAndAlert=2]="StopActionAndAlert"}(c=n.HoldType||(n.HoldType={}))})(t=n.Common||(n.Common={}))}(app||(app={})),function(n){var t;(function(t){"use strict";var i=function(){function n(){this.data={opened:!1};var n=this;n.open=function(t){t.preventDefault();t.stopPropagation();n.data.opened=!0}}return n}(),r;t.DateController=i;r=function(){function t(){this.dateFormat=n.Constants.GlobalConstants.DateFormat}return t.prototype.isInvalidRowPresent=function(){var t=this,n=!1;return angular.forEach(t.customLayout.CustomGroups,function(t){angular.forEach(t.CustomFields,function(t){t.IsTable&&!t.HideField&&t.IsRequired&&t.CustomFieldTableRows.length===0&&(n=!0)})}),n},t.prototype.hasInvalidTable=function(){var t=this,n=!1;return angular.forEach(t.customLayout.CustomGroups,function(t){angular.forEach(t.CustomFields,function(t){t.IsTable&&!t.HideField&&t.IsRequired&&t.CustomFieldTableRows.length===0&&(n=!0)})}),n},t.prototype.setupLicenseRenewalRequiredFields=function(n){var t=this;t.isLicenseRenewal=!0;t.showMoreInfoStep=!1;angular.forEach(t.customLayout.CustomGroups,function(i){angular.forEach(i.CustomFields,function(i){i.HideField!=!0&&(i.HideField=!0,angular.forEach(n,function(n){if(i.FieldTypeId==9&&n.Name==i.Label)i.HideField=!1;else if(n.Name==i.FieldName)if(i.HideField=!1,i.Value=i.DefaultValue,i.IsTable)i.IsRequired&&t.checkForRequiredTable(i),i.CustomFieldTableRows=[],t.formatDateForExistingRows(i),i.tableData.rows=i.CustomFieldTableRows;else if(i.typeData.elementType==="many")angular.forEach(i.CustomPickListItems,function(n){n.IsSelected=!1});else if(i.typeData.elementType==="select"){i.ShowValueComboBox=i.DefaultValue;var r=i.CustomPickListItems.filter(function(n){return n.Value===i.DefaultValue})[0];r&&(i.Value=r.PackageId)}}),i.HideField||(t.showMoreInfoStep=!0))})})},t.prototype.checkForRequiredTable=function(n){var i=this,t=!1;n.CustomFieldTableRows.length>0&&angular.forEach(n.CustomFieldTableColumnRefItems,function(i,r){var u=n.CustomFieldTableRows[0]["Column"+r];u.IsRequired&&(u.Value==null||u.Value=="")&&(t=!0)});t&&(n.HideField=!1,n.CustomFieldTableRows=[],i.formatDateForExistingRows(n),n.tableData.rows=n.CustomFieldTableRows)},t.prototype.setLayout=function(n,t,i){var r=this;t===void 0&&(t=!1);i===void 0&&(i=!1);this.isLicenseRenewal=!1;n&&n.CustomGroups&&angular.forEach(n.CustomGroups,function(n,u){n.hasValue=!1;var f="g_"+u,e=$.grep(n.CustomFields,function(n){return n.IsFooter});angular.forEach(n.CustomFields,function(u,o){u.Value!==undefined&&u.Value!==null&&u.Value!==""&&(n.hasValue=!0);var s=f+"_f_"+o;u.typeData=r.getTypeData(u,e,s,t,i)})});this.customLayout=n},t.prototype.getTypeData=function(n,t,r,u,f){var h=this,e={id:r,elementType:"text",isMulti:!1,maxLength:"50"},s,o;switch(n.FieldTypeId){case 0:n.FieldName==="SolarAppApprovalID"&&(e.pattern=/^SA[0-9a-zA-Z]+-[0-9a-zA-Z]+-[0-9a-zA-Z]+-[0-9a-zA-Z]+-[a-zA-Z]$/);break;case 1:e.isMulti=!0;break;case 2:e.pattern=/^(-?)\d*(?:\.\d+)?$/;e.maxLength="15";break;case 3:e.pattern=/^(-?)[1]{0,1}[0-9]{0,9}$/;e.maxLength="10";break;case 4:e.elementType="checkbox";n.Value=n.Value&&(n.Value.toString().toUpperCase()==="TRUE"||n.Value==="1")?!0:!1;break;case 5:e.elementType="date";e.controller=new i;break;case 6:n.IsReadOnly?angular.forEach(n.CustomPickListItems,function(t){t.Value===n.Value&&(e.altValue=t.Value)}):n.Value&&(n.ShowValueComboBox=n.Value,s=n.CustomPickListItems.filter(function(t){return t.Value===n.Value})[0],s&&(n.Value=s.PackageId));e.elementType="select";break;case 7:e.elementType="many";break;case 8:e.elementType="currency";e.pattern=/^(-?)(\$?)(\d*)(?:\.[0-9]{1,2})?$/;e.inputGroup={pre:"$"};e.maxLength="18";break;case 10:e.elementType="table";o={};o.label=n.Label;o.headers=[];o.rows=[];angular.forEach(n.CustomFieldTableColumnRefItems,function(n,i){u&&(n.Value=n.DefaultValue);n.typeData=h.getTypeDataForCustomTableColumn(n,r+"_"+i);n.Label=n.DisplayName;var f={};f.footer={};f.displayName=n.DisplayName;n.HasFooter&&angular.forEach(t,function(t){t.FieldName==n.FooterFieldName&&(f.footer.label=t.Label,f.footer.value=t.Value)});o.headers.push(f)});u||f&&!n.CustomFieldTableRows?n.CustomFieldTableRows=[]:this.formatDateForExistingRows(n);f&&angular.forEach(n.CustomFieldTableRows,function(t,i){n.CustomFieldTableRows[i].CustomFieldTableRowColumnCount=n.CustomFieldTableColumnRefItems.length;n.CustomFieldTableRows[i].CustomFieldTableRowNumber=i;n.CustomFieldTableRows[i].RowID=i+1;n.CustomFieldTableRows[i].IsValidRow=!0;angular.forEach(n.CustomFieldTableColumnRefItems,function(t,r){n.CustomFieldTableRows[i]["Column"+r].Retire||h.isColumnValid(n.CustomFieldTableRows[i]["Column"+r],t)||(n.CustomFieldTableRows[i].IsValidRow=!1)})});n.retiredColumns=this.getRetiredColumnIndexes(n,u);n.tableData=o;n.tableData.rows=n.CustomFieldTableRows;break;case 11:e.elementType="hyperlink"}return e},t.prototype.getTypeDataForCustomTableColumn=function(n,t){var u=this,r={id:t,elementType:"text",isMulti:!1,maxLength:"50"};if(n.ControlTypeID==2)r.elementType="select",n.CustomPickListItems=[],angular.forEach(n.PickListItems,function(t){t.Retire||(n.CustomPickListItems.push({Label:t.Value,Value:t.Value,PackageId:t.CustomFieldPickListItemID}),t.CustomFieldPickListItemID===n.Value&&(r.altValue=t.Value))});else if(n.ControlTypeID==3)r.elementType="checkbox",n.Value=n.Value&&(n.Value.toString().toUpperCase()==="TRUE"||n.Value==="1")?!0:!1;else if(n.ControlTypeID==1)switch(n.CustomFieldTypeID){case 1:r.pattern=/^(-?)\d*(?:\.\d+)?$/;r.maxLength="15";break;case 2:r.elementType="currency";r.pattern=/^(-?)(\$?)(\d*)(?:\.[0-9]{1,2})?$/;r.inputGroup={pre:"$"};r.maxLength="18";break;case 3:r.elementType="date";r.controller=new i;break;case 4:r.pattern=/^(-?)[1]{0,1}[0-9]{0,9}$/;r.maxLength="10";break;case 6:r.isMulti=!0}return r},t.prototype.addDefaultRows=function(n){var i=this,t;if(n.CustomFieldTableRows==null&&(n.CustomFieldTableRows=[]),n.IsRequired&&n.DefaultTableRows==0&&(n.DefaultTableRows=1),n.DefaultTableRows>n.CustomFieldTableRows.length)while(n.DefaultTableRows>n.CustomFieldTableRows.length)t=n.CustomFieldTableRows.length,n.CustomFieldTableRows[t]=this.getNewCustomFieldTableRow(),n.CustomFieldTableRows[t].CustomFieldTableRowColumnCount=n.CustomFieldTableColumnRefItems.length,n.CustomFieldTableRows[t].CustomFieldTableRowNumber=t,n.CustomFieldTableRows[t].RowID=t+1,angular.forEach(n.CustomFieldTableColumnRefItems,function(r,u){n.CustomFieldTableRows[t]["Column"+u]=i.getCustomFieldTableCell(r,u,t);i.isColumnValid(n.CustomFieldTableRows[t]["Column"+u],r)||(n.CustomFieldTableRows[t].IsValidRow=!1)})},t.prototype.formatDateForExistingRows=function(n){var t=this;n.CustomFieldTableRows!=null&&angular.forEach(n.CustomFieldTableRows,function(i){angular.forEach(n.CustomFieldTableColumnRefItems,function(n,r){n.CustomFieldTypeID==3&&(i["Column"+r].Value==null||i["Column"+r].Value==""?i["Column"+r].Value="":moment(i["Column"+r].Value).isValid()&&(i["Column"+r].Value=moment(new Date(i["Column"+r].Value)).format(t.dateFormat)))})})},t.prototype.getRetiredColumnIndexes=function(n,t){var r=this,i=[];return angular.forEach(n.CustomFieldTableColumnRefItems,function(r,u){var f=!0;r.Retire&&(t?f=!1:(f=!1,angular.forEach(n.CustomFieldTableRows,function(n){n["Column"+u].Value!=null&&(f=!0)})));f||i.push(u)}),i},t.prototype.isColumnValid=function(n,t){if(t.IsRequired&&(n.Value==null||n.Value==""))return!1;if(t.typeData.pattern!=undefined){var i=t.typeData.pattern;if(n.Value!=null&&n.Value!=""&&!i.test(n.Value))return!1}return t.typeData.elementType=="date"&&n.Value!=null&&n.Value!=""&&!moment(n.Value,[this.dateFormat]).isValid()?!1:n.Value!=null&&n.Value.length>t.typeData.maxLength?!1:!0},t.prototype.getCustomFieldTableCell=function(t,i,r){var u={CustomField:t.FieldName,CustomFieldLayoutControlType:t.ControlTypeID,CustomFieldTableCellColumnRefID:t.CustomFieldTableColumnRefID,CustomFieldTableCellType:t.ControlTypeID===n.Common.CustomFieldsControlTypes.ComboBox?n.Common.CustomFieldCellTypes.GID:t.CustomFieldTypeID,CustomFieldTableRowNumber:r,CustomFieldType:t.CustomFieldTypeID,Defaultvalue:t.DefaultValue,FieldName:"Column"+i,Formula:t.Formula,IsReadOnly:t.HasFormula,IsRequired:t.IsRequired,Label:t.DisplayName,Value:t.Value,PickListItems:t.PickListItems,Retire:t.Retire};return t.CustomFieldTypeID==3&&(u.Value==null||u.Value==""?u.Value="":moment(u.Value).isValid()&&(u.Value=moment(new Date(u.Value)).format(this.dateFormat))),t.ControlTypeID==3&&(u.CustomFieldTableCellType=7,u.Value=u.Value==!0),u},t.prototype.getNewCustomFieldTableRow=function(){return{CustomFieldTableObjectID:null,CustomFieldTableRowNumber:0,CustomFieldTableRowColumnCount:0,IsValidRow:!0,RowID:0,Column0:null,Column1:null,Column2:null,Column3:null,Column4:null,Column5:null,Column6:null,Column7:null,Column8:null,Column9:null,Column10:null,Column11:null,Column12:null,Column13:null,Column14:null,Column15:null,Column16:null,Column17:null,Column18:null,Column19:null,Column20:null,Column21:null,Column22:null,Column23:null,Column24:null,Column25:null,Column26:null,Column27:null,Column28:null,Column29:null,Column30:null,Column31:null,Column32:null,Column33:null,Column34:null,Column35:null,Column36:null,Column37:null,Column38:null,Column39:null,Column40:null,Column41:null,Column42:null,Column43:null,Column44:null,Column45:null,Column46:null,Column47:null,Column48:null,Column49:null,Column50:null}},t}();t.CustomFieldsService=r})(t=n.CustomFields||(n.CustomFields={}))}(app||(app={})),function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i){this.$location=n;this.$route=t;this.userService=i;this.attemptUrl="";this.withUrl=!1}return n.prototype.path=function(n){this.userService.isUserLoggedIn?this.$location.path(n):(this.attemptUrl=n,this.$route.reload(),this.$location.path("/login"))},n.prototype.handleRedirection=function(){var n=this;n.attemptUrl!==""?n.returnBack():n.$location.search().redirectUrl?(n.attemptUrl=n.$location.search().redirectUrl,n.withUrl=!0):n.$location.path("/")},n.prototype.returnBack=function(){this.attemptUrl?this.$location.path(this.attemptUrl):this.$location.path("/")},n}();n.LocationService=t;angular.module("app.Common.Services.Location",[]).service("locationService",["$location","$route","userService",t])})(t=n.location||(n.location={}))}(app||(app={})),function(n){var t;(function(n){"use strict";var t=function(){function n(n,t,i,r,u,f,e){this.$rootScope=n;this.$window=t;this.utilities=i;this.globalService=e;var o=this;n.$on("$routeChangeSuccess",function(n,i){var u,e;i.$$route===undefined||i.$$route.pageTitle===undefined?r.getTenants(function(n){if(n){var i=n.filter(function(n){return n.TenantID==o.globalService.tenantId})[0];t.document.title=i.FriendlyTenantName?i.FriendlyTenantName:o.utilities.getResourceMessage("PageTitle_CSSWebsite")}else t.document.title=o.utilities.getResourceMessage("PageTitle_CSSWebsite")}):(u=t.document.title=o.utilities.getResourceMessage(i.$$route.pageTitle),(u===undefined||u===""||u===null)&&(e=f.getMenuByDetails(i.$$route.pageTitle),t.document.title=e!==null&&e!==undefined?e.Label:o.utilities.getResourceMessage(i.$$route.pageTitle)))})}return n.prototype.setPageTitle=function(n){n!==undefined&&(this.$window.document.title=n)},n.prototype.getPageTitle=function(){return this.$window.document.title},n}();n.PageTitleService=t;angular.module("app.pageTitle",[]).service("pageTitleService",["$rootScope","$window","utilities","tenantService","$route","menuService","globalsService",t])})(t=n.PageTitle||(n.PageTitle={}))}(app||(app={}))