\r\n","import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';\r\nimport { SortEvent } from 'primeng/api';\r\nimport { OwnerModel } from 'src/app/model/ownerModel.model';\r\nimport { ParcelModel } from 'src/app/model/parcelModel.model';\r\nimport { RefAddressModel } from 'src/app/model/refAddressModel.model';\r\nimport { ApoQueryable } from 'src/app/modules/apo/models/apoRecord.model';\r\n\r\nimport {\r\n getAddressDescription,\r\n getOwnerAddressDescription,\r\n getOwnerDescription,\r\n getOwnerNameDescription,\r\n getParcelDescription,\r\n getRefAddressStreetDescription\r\n} from 'src/app/modules/apo/util/apo.util';\r\nimport { AddressModel } from 'src/app/modules/shared/model/addressModel.model';\r\nimport { HTML_ELEMENT } from 'src/app/modules/shared/model/htmlElements.const';\r\nimport { isStringNullOrWhiteSpace } from 'src/app/util/StringUtil';\r\nimport { Column } from '../../../shared/model/column.model';\r\nimport { ConditionType } from '../../models/apo.const';\r\nimport { getConditionTooltip } from '../../util/condition.util';\r\n\r\n@Component({\r\n selector: 'apo-search-results-panel',\r\n templateUrl: './apo-search-results-panel.component.html',\r\n styleUrls: ['./apo-search-results-panel.component.css']\r\n})\r\nexport class SearchResultsPanelComponent implements OnInit {\r\n\r\n @Input() sectionTitle: string;\r\n\r\n @Input() searchResults: any[];\r\n\r\n @Input() columnData: Column[];\r\n\r\n @Input() addStreetDescriptionColumn = false;\r\n\r\n @Input() addOwnerNameColumn = false;\r\n\r\n @Input() addOwnerAddressColumn = false;\r\n\r\n @Input() alternateActionLabel = '';\r\n\r\n @Input() showAddButton = true;\r\n\r\n @Output() cancelAction: EventEmitter = new EventEmitter();\r\n\r\n @Output() submitAction: EventEmitter = new EventEmitter();\r\n\r\n @Output() altAction: EventEmitter = new EventEmitter();\r\n\r\n selectedData: any[];\r\n\r\n conditionType = ConditionType;\r\n\r\n constructor() { }\r\n\r\n ngOnInit(): void {\r\n }\r\n\r\n getRefAddressDescription(rowData: RefAddressModel) {\r\n return getRefAddressStreetDescription(rowData);\r\n }\r\n\r\n getOwnerNameDescription(rowData: OwnerModel) {\r\n return getOwnerNameDescription(rowData);\r\n }\r\n\r\n getOwnerAddressDescription(rowData: OwnerModel){\r\n return getOwnerAddressDescription(rowData).split(HTML_ELEMENT.lineBreak).join(' ');\r\n }\r\n\r\n sortColumn(event: SortEvent) {\r\n event.data.sort((data1, data2) => {\r\n let result = 0; //by default, two null values will be equal\r\n\r\n if (event.field === 'description') { //special sort for the description column\r\n const val1 = getRefAddressStreetDescription(data1);\r\n const val2 = getRefAddressStreetDescription(data2);\r\n result = val1.localeCompare(val2);\r\n } else if (event.field === 'OwnerName') { //special sort for the description column\r\n const val1 = getOwnerNameDescription(data1);\r\n const val2 = getOwnerNameDescription(data2);\r\n result = val1.localeCompare(val2);\r\n } else if (event.field === 'OwnerAddress') { //special sort for the OwnerAddress column\r\n const val1 = getOwnerAddressDescription(data1);\r\n const val2 = getOwnerAddressDescription(data2);\r\n result = val1.localeCompare(val2);\r\n } else {\r\n\r\n const value1 = data1[event.field];\r\n const value2 = data2[event.field];\r\n\r\n if (value1 == null && value2 != null) {\r\n result = -1;\r\n } else if (value1 != null && value2 == null) {\r\n result = 1;\r\n } else if (value1 == null && value2 == null) {\r\n result = 0;\r\n } else if (typeof value1 === 'string' && typeof value2 === 'string') {\r\n result = value1.localeCompare(value2);\r\n } else {\r\n result = (value1 < value2) ? -1 : (value1 > value2) ? 1 : 0;\r\n }\r\n }\r\n return (event.order * result);\r\n });\r\n }\r\n\r\n hasCondition(col: ApoQueryable, condType: ConditionType): boolean {\r\n let flag = false;\r\n\r\n if (col && col.hasOwnProperty('hightestCondition')) {\r\n flag = col.hightestCondition?.impactCode.toUpperCase() === condType;\r\n }\r\n\r\n return flag;\r\n }\r\n\r\n cancelClick(event) {\r\n this.cancelAction.emit();\r\n }\r\n\r\n //special bindable click for navigation\r\n altClick(event: Event) {\r\n this.altAction.emit();\r\n }\r\n\r\n submitRows() {\r\n this.submitAction.emit(this.selectedData);\r\n this.selectedData = [];\r\n }\r\n\r\n getTooltip(apoRecord: ApoQueryable): string {\r\n if (apoRecord.hightestCondition) {\r\n return getConditionTooltip(apoRecord);\r\n } else if (Object.getPrototypeOf(apoRecord) === AddressModel.prototype){\r\n return getAddressDescription(apoRecord as AddressModel);\r\n } else if (Object.getPrototypeOf(apoRecord) === ParcelModel.prototype){\r\n return getParcelDescription(apoRecord as ParcelModel);\r\n } else if (Object.getPrototypeOf(apoRecord) === OwnerModel.prototype){\r\n return getOwnerDescription(apoRecord as OwnerModel);\r\n }\r\n return $localize`Select a Record Column`;\r\n }\r\n}\r\n","import { OwnerModel } from 'src/app/model/ownerModel.model';\r\nimport { ParcelModel } from 'src/app/model/parcelModel.model';\r\nimport { AddressModel } from '../../shared/model/addressModel.model';\r\nimport { ApoQueryable } from '../models/apoRecord.model';\r\nimport { APOSearchData } from '../models/APOSearchResult.model';\r\nimport { getApoDescriptor } from './apo.util';\r\n\r\nexport const getConditionTooltip = (data: ApoQueryable): string => `
\r\n ${$localize`There is a `}${data.hightestCondition.impactCode} on ${getApoDescriptor(data)}\r\n as of ${data.hightestCondition.issuedDate}\r\n ${data.hightestCondition.conditionStatus}\r\n ${data.hightestCondition.conditionComment}\r\n
\r\n ${$localize`There is a `}${data.HighestCondition.impactCode} on ${data.Name}\r\n as of ${data.HighestCondition.issuedDate}\r\n ${data.HighestCondition.conditionStatus}\r\n ${data.HighestCondition.conditionComment}\r\n
\r\n Note: \r\n When you add an address, parcel, or owner (APO), we will look for any associated items and suggest them. Multiple APOs can be added to a single application.\r\n
\r\n
\r\n
\r\n Project Location\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n Addresses(Required)\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n Parcels(Required)\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n Owners(Required)\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n\r\n \r\n\r\n\r\n \r\n\r\n\r\n \r\n\r\n \r\n
\r\n Enter Address Information\r\n \r\n Enter Parcel Information\r\n \r\n Enter Owner Information\r\n \r\n
\r\n\r\n","import { Routes, RouterModule } from '@angular/router';\r\nimport { MultiApoScreenComponent } from './screens/multi-apo-screen/multi-apo-screen.component';\r\n\r\nexport const APORoutes: Routes = [\r\n { path: 'multi-search', component: MultiApoScreenComponent },\r\n { path: '', redirectTo: 'new', pathMatch: 'full' },\r\n { path: '**', redirectTo: '/404' }\r\n\r\n];\r\n\r\nexport const APORoutingModule = RouterModule.forChild(\r\n APORoutes\r\n);\r\n","import { AfterViewInit, Component, OnDestroy, OnInit, ViewChild } from '@angular/core';\r\nimport { ActivatedRoute } from '@angular/router';\r\nimport { Store } from '@ngrx/store';\r\nimport { MessageService } from 'primeng/api';\r\nimport { Subject } from 'rxjs';\r\nimport { takeUntil } from 'rxjs/operators';\r\nimport { AppState } from 'src/app/app.state';\r\nimport { OwnerModel } from 'src/app/model/ownerModel.model';\r\nimport { ParcelModel } from 'src/app/model/parcelModel.model';\r\nimport { AddressModel } from 'src/app/modules/shared/model/addressModel.model';\r\nimport { SessionCapModelService } from 'src/app/modules/shared/services/session-cap-model.service';\r\nimport { SettingService } from 'src/app/modules/shared/services/setting.service';\r\nimport { DataSourceFlag, FlagEnum, PageLayoutMode } from 'src/app/repo/enum.repo';\r\nimport { selectAppSettings } from 'src/app/state/selectors/app-settings.selectors';\r\nimport { sortByProperty } from 'src/app/util/sortUtil';\r\nimport { RefAddressModel } from '../../../../model/refAddressModel.model';\r\nimport { APOEntityType } from '../../../../repo/contact-process-type.repo';\r\nimport { isStringNullOrWhiteSpace } from '../../../../util/StringUtil';\r\nimport { Column } from '../../../shared/model/column.model';\r\nimport { EditAddressFormComponent } from '../../components/edit-address-form/edit-address-form.component';\r\nimport { EditOwnerFormComponent } from '../../components/edit-owner-form/edit-owner-form.component';\r\nimport { EditParcelFormComponent } from '../../components/edit-parcel-form/edit-parcel-form.component';\r\nimport { ApoQueryable } from '../../models/apoRecord.model';\r\nimport { APOSearchOutputList } from '../../models/APOSearchResult.model';\r\nimport { ApoSuggestion } from '../../models/apoSuggestion.model';\r\nimport { APOSuggestionData } from '../../models/ApoSuggestionData.model';\r\nimport { APOSearchService } from '../../services/aposearch-service.service';\r\n\r\n@Component({\r\n selector: 'multi-apo-screen',\r\n templateUrl: './multi-apo-screen.component.html',\r\n styleUrls: ['./multi-apo-screen.component.less']\r\n})\r\nexport class MultiApoScreenComponent implements OnInit, OnDestroy, AfterViewInit {\r\n\r\n @ViewChild('addressLayout') addressFormLayout: EditAddressFormComponent;\r\n @ViewChild('parcelLayout') parcelFormLayout: EditParcelFormComponent;\r\n @ViewChild('ownerLayout') ownerFormLayout: EditOwnerFormComponent;\r\n\r\n module: string;\r\n compOrder = ['A', 'P', 'O'];\r\n xapoMode: boolean;\r\n adminMode: boolean;\r\n processing = false;\r\n pageLayoutModes = PageLayoutMode;\r\n sourceType: string; \r\n\r\n addressCards = new Array();\r\n selectedAddress: AddressModel;\r\n addressMode: PageLayoutMode;\r\n addressRequired: boolean;\r\n showAddressForm: boolean;\r\n addressType: string;\r\n addressMax: number;\r\n\r\n parcelCards = new Array();\r\n selectedParcel: ParcelModel;\r\n parcelMode: PageLayoutMode;\r\n parcelRequired: boolean;\r\n showParcelForm: boolean;\r\n parcelType: string;\r\n parcelMax: number;\r\n\r\n ownerCards = new Array();\r\n selectedOwner: OwnerModel;\r\n ownerMode: PageLayoutMode;\r\n ownerRequired: boolean;\r\n showOwnerForm: boolean;\r\n ownerType: string;\r\n ownerMax: number;\r\n\r\n protected destroyActions = new Subject();\r\n constructor(private store: Store, private route: ActivatedRoute, private capModelService: SessionCapModelService,\r\n private messageService: MessageService, private settingsService: SettingService) {\r\n this.route.queryParams.subscribe(params => {\r\n this.module = params['Module'];\r\n this.addressMax = params['addressMax'] ?? 1;\r\n this.parcelMax = params['parcelMax'] ?? 1;\r\n this.ownerMax = params['ownerMax'] ?? 1;\r\n this.addressType = params['addressType'];\r\n this.parcelType = params['parcelType'];\r\n this.ownerType = params['ownerType'];\r\n this.addressRequired = (params['addressRequired'] === 'Y');\r\n this.parcelRequired = (params['parcelRequired'] === 'Y');\r\n this.ownerRequired = (params['ownerRequired'] === 'Y');\r\n\r\n this.compOrder = [...params['compOrder']];\r\n \r\n });\r\n }\r\n\r\n ngOnInit(): void {\r\n this.store.select(selectAppSettings)\r\n .pipe(takeUntil(this.destroyActions))\r\n .subscribe({\r\n next: state => {\r\n this.adminMode = state.AdminMode;\r\n this.addressMode = PageLayoutMode.ADMIN;\r\n this.ownerMode = PageLayoutMode.ADMIN;\r\n this.parcelMode = PageLayoutMode.ADMIN;\r\n }\r\n });\r\n\r\n this.settingsService.isXAPOAgency()\r\n .pipe(takeUntil(this.destroyActions))\r\n .subscribe(isXapo => {\r\n this.xapoMode = isXapo;\r\n\r\n this.capModelService.getAddressesFromCapModel(this.module)\r\n .pipe(takeUntil(this.destroyActions))\r\n .subscribe((res: AddressModel[]) => {\r\n if (res && res.length > 0) {\r\n //reset addresses to match Cap Model in session\r\n sortByProperty(res, 'primaryFlag', 'DESC');\r\n this.addressCards = res;\r\n //Set a primary record if none already provided\r\n this.setPrimaryAddressIfNeeded();\r\n }\r\n }, error => {\r\n this.handleError(error);\r\n });\r\n\r\n this.capModelService.getParcelsFromCapModel(this.module)\r\n .pipe(takeUntil(this.destroyActions))\r\n .subscribe((res: ParcelModel[]) => {\r\n if (res && res.length > 0) {\r\n //reset parcels to match Cap Model in Session\r\n sortByProperty(res, 'primaryParcelFlag', 'DESC');\r\n this.parcelCards = res;\r\n //Set a primary record if none already provided\r\n this.setPrimaryParcelIfNeeded();\r\n }\r\n }, error => {\r\n this.handleError(error);\r\n });\r\n\r\n this.capModelService.getOwnersFromCapModel(this.module)\r\n .pipe(takeUntil(this.destroyActions))\r\n .subscribe((res: OwnerModel[]) => {\r\n if (res && res.length > 0) {\r\n //reset owners to match Cap Model in Session\r\n sortByProperty(res, 'isPrimary', 'DESC');\r\n this.ownerCards = res;\r\n //Set a primary record if none already provided\r\n this.setPrimaryOwnerIfNeeded();\r\n }\r\n }, error => {\r\n this.handleError(error);\r\n });\r\n });\r\n\r\n }\r\n\r\n ngAfterViewInit(): void {\r\n window.parent.postMessage('CommunityView:Resize', '*');\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.destroyActions.next(null);\r\n this.destroyActions.complete();\r\n }\r\n\r\n handleError(error: any) {\r\n if (typeof error !== 'string') {\r\n error = error.error;\r\n }\r\n this.messageService.clear();\r\n this.messageService.add({\r\n severity: 'error',\r\n summary: error,\r\n closable: false\r\n });\r\n }\r\n\r\n /* Primary Record Handling */\r\n\r\n setPrimaryAddressIfNeeded() {\r\n if (this.addressCards.length > 0) {\r\n if (!(this.addressCards.find((addr) => addr.primaryFlag === FlagEnum.Y))) {\r\n this.addressCards[0].primaryFlag = FlagEnum.Y;\r\n }\r\n }\r\n }\r\n\r\n setPrimaryParcelIfNeeded() {\r\n if (this.parcelCards.length > 0) {\r\n if (!(this.parcelCards.find((parcel) => parcel.primaryParcelFlag === FlagEnum.Y))) {\r\n this.parcelCards[0].primaryParcelFlag = FlagEnum.Y;\r\n }\r\n }\r\n }\r\n\r\n setPrimaryOwnerIfNeeded() {\r\n if (this.ownerCards.length > 0) {\r\n if (!(this.ownerCards.find((owner) => owner.isPrimary === FlagEnum.Y))) {\r\n this.ownerCards[0].isPrimary = FlagEnum.Y;\r\n }\r\n }\r\n }\r\n\r\n setPrimaryAddress(primaryRecord: AddressModel) {\r\n //Setting PrimaryFlag as 'N' to all addresses\r\n this.addressCards.forEach((card) => {\r\n card.primaryFlag = FlagEnum.N;\r\n });\r\n //Setting PrimaryFlag as 'Y' to current Address\r\n primaryRecord.primaryFlag = FlagEnum.Y;\r\n\r\n //Saving Address Data to capModel\r\n this.saveChanges(APOEntityType.Address);\r\n }\r\n\r\n suggestionsFoundClick(suggestionRecord: ApoSuggestion) {\r\n if (suggestionRecord?.addresses.length === 1) {\r\n this.addAddresses(suggestionRecord.addresses);\r\n }\r\n if (suggestionRecord?.parcels.length === 1) {\r\n this.addParcels(suggestionRecord.parcels);\r\n }\r\n if (suggestionRecord?.owners.length === 1) {\r\n this.addOwners(suggestionRecord.owners);\r\n }\r\n }\r\n\r\n setPrimaryParcel(primaryRecord: ParcelModel) {\r\n //Setting PrimaryFlag as 'N' to all addresses\r\n this.parcelCards.forEach((card) => {\r\n card.primaryParcelFlag = FlagEnum.N;\r\n });\r\n\r\n //Setting PrimaryFlag as 'Y' to current Address\r\n primaryRecord.primaryParcelFlag = FlagEnum.Y;\r\n\r\n //Saving Address Data to capModel\r\n this.saveChanges(APOEntityType.Address);\r\n }\r\n\r\n setPrimaryOwner(primaryRecord: OwnerModel) {\r\n //Setting PrimaryFlag as 'N' to all addresses\r\n this.ownerCards.forEach((card) => {\r\n card.isPrimary = FlagEnum.N;\r\n });\r\n //Setting PrimaryFlag as 'Y' to current Address\r\n primaryRecord.isPrimary = FlagEnum.Y;\r\n\r\n //Saving Address Data to capModel\r\n this.saveChanges(APOEntityType.Owner);\r\n }\r\n\r\n /* Add,Search launch links */\r\n addAddressClick(event: Event) {\r\n if (this.adminMode || this.processing) {\r\n return;\r\n }\r\n this.processing = true;\r\n if (this.addressMax > this.addressCards.length) {\r\n \r\n this.addressMode = PageLayoutMode.EDIT;\r\n const addressModel = new AddressModel();\r\n this.addressCards.push(addressModel);\r\n this.selectedAddress = addressModel;\r\n this.addressFormLayout.updateAddressFormInstance(addressModel);\r\n this.showAddressForm = true;\r\n } else {\r\n this.messageService.clear();\r\n this.messageService.add({\r\n severity: 'error',\r\n summary: $localize`A maximum of ${this.addressMax} address(es) can be added to this record.`,\r\n closable: false\r\n });\r\n }\r\n this.processing = false;\r\n }\r\n\r\n searchAddressClick(event: Event) {\r\n if (this.adminMode || this.processing) {\r\n return;\r\n }\r\n\r\n this.processing = true;\r\n if (this.addressMax > this.addressCards.length) {\r\n this.sourceType = APOEntityType.Address;\r\n this.addressMode = PageLayoutMode.SEARCH;\r\n this.addressFormLayout.updateAddressFormInstance(new AddressModel());\r\n this.showAddressForm = true;\r\n } else {\r\n this.messageService.clear();\r\n this.messageService.add({\r\n severity: 'error',\r\n summary: $localize`A maximum of ${this.addressMax} address(es) can be added to this record.`,\r\n closable: false\r\n });\r\n }\r\n this.processing = false;\r\n }\r\n\r\n viewAddressClick(addressModel: AddressModel) {\r\n if (this.adminMode) {\r\n return;\r\n }\r\n\r\n this.processing = true;\r\n this.selectedAddress = addressModel;\r\n this.addressFormLayout.updateAddressFormInstance(addressModel);\r\n this.addressMode = PageLayoutMode.VIEW;\r\n this.showAddressForm = true;\r\n this.processing = false;\r\n }\r\n\r\n\r\n addParcelClick(event: Event) {\r\n if (this.adminMode || this.processing) {\r\n return;\r\n }\r\n \r\n const parcelModel = new ParcelModel();\r\n this.parcelCards.push(parcelModel);\r\n this.selectedParcel = parcelModel;\r\n this.parcelFormLayout.updateFormInstance(parcelModel);\r\n this.showParcelForm = true;\r\n }\r\n\r\n searchParcelClick(event: Event) {\r\n if (this.adminMode || this.processing) {\r\n return;\r\n }\r\n\r\n this.processing = true;\r\n if (this.parcelMax > this.parcelCards.length) {\r\n this.sourceType = APOEntityType.Parcel;\r\n this.parcelMode = PageLayoutMode.SEARCH;\r\n this.parcelFormLayout.updateFormInstance(new ParcelModel());\r\n this.showParcelForm = true;\r\n } else {\r\n this.messageService.clear();\r\n this.messageService.add({\r\n severity: 'error',\r\n summary: $localize`A maximum of ${this.parcelMax} parcel(s) can be added to this record.`,\r\n closable: false\r\n });\r\n }\r\n this.processing = false;\r\n }\r\n\r\n viewParcelClick(parcelModel: ParcelModel) {\r\n\r\n if (this.adminMode) {\r\n return;\r\n }\r\n\r\n this.processing = true;\r\n this.selectedParcel = parcelModel;\r\n this.parcelFormLayout.updateFormInstance(parcelModel);\r\n this.parcelMode = PageLayoutMode.VIEW;\r\n this.showParcelForm = true;\r\n this.processing = false;\r\n }\r\n\r\n\r\n addOwnerClick(event: Event) {\r\n if (this.adminMode || this.processing) {\r\n return;\r\n }\r\n \r\n const ownerModel = new OwnerModel();\r\n this.ownerCards.push(ownerModel);\r\n this.selectedOwner = ownerModel;\r\n this.ownerFormLayout.updateFormInstance(ownerModel);\r\n this.showOwnerForm = true;\r\n }\r\n\r\n searchOwnerClick(event: Event) {\r\n if (this.adminMode || this.processing) {\r\n return;\r\n }\r\n\r\n this.processing = true;\r\n if (this.ownerMax > this.ownerCards.length) {\r\n this.sourceType = APOEntityType.Owner;\r\n this.ownerMode = PageLayoutMode.SEARCH;\r\n this.ownerFormLayout.updateFormInstance(new OwnerModel());\r\n this.showOwnerForm = true;\r\n } else {\r\n this.messageService.clear();\r\n this.messageService.add({\r\n severity: 'error',\r\n summary: $localize`A maximum of ${this.ownerMax} owner(s) can be added to this record.`,\r\n closable: false\r\n });\r\n }\r\n this.processing = false;\r\n }\r\n\r\n viewOwnerClick(ownerModel: OwnerModel) {\r\n\r\n if (this.adminMode) {\r\n return;\r\n }\r\n\r\n this.processing = true;\r\n this.selectedOwner = ownerModel;\r\n this.ownerFormLayout.updateFormInstance(ownerModel);\r\n this.ownerMode = PageLayoutMode.VIEW;\r\n this.showOwnerForm = true;\r\n this.processing = false;\r\n }\r\n\r\n editRecordClick(record: ApoQueryable) {\r\n if (this.adminMode || this.processing) {\r\n return;\r\n }\r\n\r\n if (record.hasOwnProperty('addressId')) {\r\n this.selectedAddress = record as AddressModel;\r\n this.showAddressForm = true;\r\n } else if (record.hasOwnProperty('parcelNumber')) {\r\n this.selectedParcel = record as ParcelModel;\r\n this.showParcelForm = true;\r\n } else if (record.hasOwnProperty('ownerNumber')) {\r\n this.selectedOwner = record as OwnerModel;\r\n this.showOwnerForm = true;\r\n }\r\n }\r\n\r\n /* Add Methods */\r\n addAddress(addr: AddressModel) {\r\n if (this.adminMode || this.processing) {\r\n return;\r\n }\r\n let idx = -1;\r\n if (this.xapoMode) {\r\n idx = this.addressCards.findIndex((address) => address.UID === addr.UID);\r\n\r\n } else {\r\n idx = this.addressCards.findIndex((address) => address.addressId === addr.addressId);\r\n }\r\n \r\n if (idx >= 0) {\r\n this.addressCards[idx] = addr; //replace records\r\n } else {\r\n this.addressCards.push(addr);\r\n }\r\n this.setPrimaryAddressIfNeeded();\r\n }\r\n\r\n addParcel(prcl: ParcelModel) {\r\n if (this.adminMode || this.processing) {\r\n return;\r\n }\r\n \r\n let idx = -1;\r\n if (this.xapoMode) {\r\n idx = this.parcelCards.findIndex((parcel) => parcel.UID === prcl.UID);\r\n } else {\r\n idx = this.parcelCards.findIndex((parcel) => parcel.parcelNumber === prcl.parcelNumber);\r\n }\r\n\r\n if (idx >= 0) {\r\n this.parcelCards[idx] = prcl; //replace records\r\n } else {\r\n this.parcelCards.push(prcl);\r\n }\r\n this.setPrimaryParcelIfNeeded();\r\n\r\n }\r\n\r\n addOwner(ownr: OwnerModel) {\r\n if (this.adminMode || this.processing) {\r\n return;\r\n }\r\n\r\n let idx = -1;\r\n if (this.xapoMode) {\r\n idx = this.ownerCards.findIndex((owner) => owner.UID === ownr.UID);\r\n } else {\r\n idx = this.ownerCards.findIndex((owner) => owner.ownerNumber === ownr.ownerNumber);\r\n }\r\n\r\n if (idx >= 0) {\r\n this.ownerCards[idx] = ownr; //replace records\r\n } else {\r\n this.ownerCards.push(ownr);\r\n }\r\n this.setPrimaryOwnerIfNeeded();\r\n }\r\n\r\n /* Delete / Remove methods */\r\n deleteRecordClick(record: ApoQueryable) {\r\n if (this.adminMode || this.processing) {\r\n return;\r\n }\r\n\r\n let isRecordDeleted = false;\r\n let apoEntityType;\r\n\r\n if (record.hasOwnProperty('addressId') || record.hasOwnProperty('refAddressId')) {\r\n apoEntityType = APOEntityType.Address;\r\n this.selectedAddress = null;\r\n this.showAddressForm = false;\r\n const addr = record as AddressModel;\r\n let idx = -1;\r\n if (this.xapoMode) {\r\n idx = this.addressCards.findIndex((address) => address.UID === addr.UID);\r\n } else {\r\n idx = this.addressCards.findIndex((address) => address.addressId === addr.addressId);\r\n }\r\n const primaryRecordDeleted = addr.primaryFlag === FlagEnum.Y;\r\n if (idx >= 0) {\r\n this.addressCards.splice(idx, 1);\r\n isRecordDeleted = true;\r\n }\r\n //set primary when detlete the primary address\r\n if (primaryRecordDeleted && this.addressCards.length > 0) {\r\n this.setPrimaryAddressIfNeeded();\r\n }\r\n } else if (record.hasOwnProperty('parcelNumber')) {\r\n apoEntityType = APOEntityType.Parcel;\r\n this.selectedParcel = null;\r\n this.showParcelForm = false;\r\n const prcl = record as ParcelModel;\r\n let idx = -1;\r\n if (this.xapoMode) {\r\n idx = this.parcelCards.findIndex((parcel) => parcel.UID === prcl.UID);\r\n } else {\r\n idx = this.parcelCards.findIndex((parcel) => parcel.parcelNumber === prcl.parcelNumber);\r\n }\r\n const primaryRecordDeleted = prcl.primaryParcelFlag === FlagEnum.Y;\r\n if (idx >= 0) {\r\n this.parcelCards.splice(idx, 1);\r\n isRecordDeleted = true;\r\n }\r\n //set primary when detlete the primary address\r\n if (primaryRecordDeleted && this.parcelCards.length > 0) {\r\n this.setPrimaryParcelIfNeeded();\r\n }\r\n\r\n } else if (record.hasOwnProperty('ownerNumber')) {\r\n apoEntityType = APOEntityType.Owner;\r\n this.selectedOwner = null;\r\n this.showOwnerForm = false;\r\n\r\n const ownr = record as OwnerModel;\r\n let idx = -1;\r\n if (this.xapoMode) {\r\n idx = this.ownerCards.findIndex((owner) => owner.UID === ownr.UID);\r\n } else {\r\n idx = this.ownerCards.findIndex((owner) => owner.ownerNumber === ownr.ownerNumber);\r\n }\r\n const primaryRecordDeleted = ownr.isPrimary === FlagEnum.Y;\r\n if (idx >= 0) {\r\n this.ownerCards.splice(idx, 1);\r\n isRecordDeleted = true;\r\n }\r\n //set primary when detlete the primary address\r\n if (primaryRecordDeleted && this.ownerCards.length > 0) {\r\n this.setPrimaryOwnerIfNeeded();\r\n }\r\n\r\n } else {\r\n console.log('Error: Unable to identify record for deletion');\r\n console.log(record);\r\n }\r\n //Saving Data to capModel when APO is deleted\r\n if (isRecordDeleted) {\r\n this.saveChanges(apoEntityType);\r\n }\r\n }\r\n\r\n /* Record Filtering */\r\n //if APO, check to see if addressId present and compare - else compare refAddressId\r\n filterAddress =\r\n (addr: AddressModel, index: number, arry: Array): boolean =>\r\n this.xapoMode\r\n ? arry.findIndex(s => s.UID === addr.UID) < 0\r\n : (addr.addressId\r\n ? arry.findIndex(s => (s.addressId === addr.addressId)) < 0\r\n : arry.findIndex(s => s.refAddressId === addr.refAddressId) < 0);\r\n\r\n //if APO, compare parcelNumber\r\n filterParcels =\r\n (prcl: ParcelModel, index: number, arry: Array): boolean =>\r\n this.xapoMode\r\n ? arry.findIndex(s => s.UID === prcl.UID) < 0\r\n : arry.findIndex(s => s.parcelNumber === prcl.parcelNumber) < 0;\r\n\r\n //if APO, compare ownerNumber\r\n filterOwners =\r\n (ownr: OwnerModel, index: number, arry: Array): boolean =>\r\n this.xapoMode\r\n ? arry.findIndex(s => s.UID === ownr.UID) < 0\r\n : arry.findIndex(s => s.ownerNumber === ownr.ownerNumber) < 0;\r\n\r\n /* Cross Page Messaging */\r\n resize(event) {\r\n window.parent.postMessage('CommunityView:ResizeDialog', '*');\r\n }\r\n\r\n collapseSize(event) {\r\n window.parent.postMessage('CommunityView:RemoveMin', '*');\r\n }\r\n\r\n /* UI Operations */\r\n closeAddressDialog(event: boolean) {\r\n this.showAddressForm = false;\r\n }\r\n\r\n closeParcelDialog(event: boolean) {\r\n this.showParcelForm = false;\r\n }\r\n\r\n closeOwnerDialog(event: boolean) {\r\n this.showOwnerForm = false;\r\n }\r\n\r\n /* Save Operations */\r\n addAddresses(newAddresses: AddressModel[]) {\r\n newAddresses.forEach(addr => {\r\n let idx = -1;\r\n if (this.xapoMode) {\r\n idx = this.addressCards.findIndex((a) => a.UID === addr.UID);\r\n }\r\n else {\r\n if (addr.refAddressId) {\r\n idx = this.addressCards.findIndex((a) => a.refAddressId === addr.refAddressId);\r\n }\r\n else if(addr.addressId){\r\n idx = this.addressCards.findIndex((a) => a.addressId === addr.addressId);\r\n }\r\n }\r\n if (idx >= 0) {\r\n this.addressCards.splice(idx, 1);\r\n }\r\n this.addressCards.push(addr);\r\n });\r\n this.showAddressForm = false;\r\n this.setPrimaryAddressIfNeeded();\r\n this.saveChanges(APOEntityType.Address);\r\n }\r\n\r\n addParcels(newparcels: ParcelModel[]) {\r\n newparcels.forEach(prcl => {\r\n let idx = -1;\r\n if (this.xapoMode) {\r\n idx = this.parcelCards.findIndex((p) => p.UID === prcl.UID);\r\n } else {\r\n idx = this.parcelCards.findIndex((p) => p.parcelNumber === prcl.parcelNumber);\r\n }\r\n if (idx >= 0) {\r\n this.parcelCards.splice(idx, 1);\r\n }\r\n this.parcelCards.push(prcl);\r\n });\r\n this.showParcelForm = false;\r\n this.setPrimaryParcelIfNeeded();\r\n this.saveChanges(APOEntityType.Parcel);\r\n }\r\n\r\n addOwners(newOwners: OwnerModel[]) {\r\n newOwners.forEach(own => {\r\n let idx = -1;\r\n if (this.xapoMode) {\r\n idx = this.ownerCards.findIndex(o => o.UID === own.UID);\r\n } else {\r\n idx = this.ownerCards.findIndex(o => o.ownerNumber === own.ownerNumber);\r\n }\r\n if (idx >= 0) {\r\n this.ownerCards.splice(idx, 1);\r\n }\r\n this.ownerCards.push(own);\r\n });\r\n this.showOwnerForm = false;\r\n this.setPrimaryOwnerIfNeeded();\r\n this.saveChanges(APOEntityType.Owner);\r\n }\r\n\r\n saveChanges(apoEntityType) {\r\n if (this.adminMode || this.processing) {\r\n return;\r\n }\r\n let result = true;\r\n if (apoEntityType === APOEntityType.Address) {\r\n this.capModelService.saveAddressesToCapModel(this.addressCards, this.module)\r\n .pipe(takeUntil(this.destroyActions))\r\n .subscribe(res => {\r\n if (res !== 'success') {\r\n result = false;\r\n }\r\n }, error => {\r\n this.handleError(error);\r\n });\r\n }\r\n\r\n if (apoEntityType === APOEntityType.Parcel) {\r\n this.capModelService.saveParcelsToCapModel(this.parcelCards, this.module)\r\n .pipe(takeUntil(this.destroyActions))\r\n .subscribe(res => {\r\n if (res !== 'success') {\r\n result = false;\r\n }\r\n });\r\n }\r\n\r\n if (apoEntityType === APOEntityType.Owner) {\r\n this.capModelService.saveOwnersToCapModel(this.ownerCards, this.module)\r\n .pipe(takeUntil(this.destroyActions))\r\n .subscribe(res => {\r\n if (res !== 'success') {\r\n result = false;\r\n }\r\n }, error => {\r\n this.handleError(error);\r\n });\r\n }\r\n this.messageService.clear();\r\n\r\n if (result) {\r\n this.messageService.add({\r\n severity: 'success',\r\n summary: $localize`Your changes were applied successfully.`,\r\n closable: false\r\n });\r\n } else {\r\n this.messageService.add({\r\n severity: 'error',\r\n summary: $localize`An Error occured while applying your changes. Please try again.`,\r\n closable: false\r\n });\r\n }\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule, DatePipe } from '@angular/common';\r\nimport { ButtonModule } from 'primeng/button';\r\nimport { CardModule } from 'primeng/card';\r\nimport {DialogModule} from 'primeng/dialog';\r\nimport {TableModule} from 'primeng/table';\r\nimport { ToastModule } from 'primeng/toast';\r\nimport {TooltipModule} from 'primeng/tooltip';\r\n\r\nimport { SharedModule } from '../shared/shared.module';\r\nimport { APORoutingModule } from './apo.routes';\r\n\r\nimport { AddressListComponent } from './components/address-list/address-list.component';\r\n\r\nimport { OwnerListComponent } from './components/owner-list/owner-list.component';\r\nimport { ParcelListComponent } from './components/parcel-list/parcel-list.component';\r\nimport { SearchResultsPanelComponent } from './components/apo-search-results-panel/apo-search-results-panel.component';\r\nimport { MultiApoScreenComponent } from './screens/multi-apo-screen/multi-apo-screen.component';\r\nimport { AddressCardComponent } from './components/address-card/address-card.component';\r\nimport { ParcelCardComponent } from './components/parcel-card/parcel-card.component';\r\nimport { OwnerCardComponent } from './components/owner-card/owner-card.component';\r\nimport { EditAddressFormComponent } from './components/edit-address-form/edit-address-form.component';\r\nimport { EditParcelFormComponent } from './components/edit-parcel-form/edit-parcel-form.component';\r\nimport { EditOwnerFormComponent } from './components/edit-owner-form/edit-owner-form.component';\r\n\r\n\r\n@NgModule({\r\n declarations: [\r\n AddressListComponent,\r\n OwnerListComponent,\r\n ParcelListComponent,\r\n SearchResultsPanelComponent,\r\n MultiApoScreenComponent,\r\n AddressCardComponent,\r\n ParcelCardComponent,\r\n OwnerCardComponent,\r\n EditAddressFormComponent,\r\n EditParcelFormComponent,\r\n EditOwnerFormComponent\r\n ],\r\n imports: [\r\n APORoutingModule,\r\n ButtonModule,\r\n CardModule,\r\n DialogModule,\r\n CommonModule,\r\n SharedModule,\r\n TableModule,\r\n ToastModule,\r\n TooltipModule\r\n ],\r\n exports: [\r\n\r\n ],\r\n providers: [\r\n DatePipe\r\n ]\r\n})\r\nexport class APOModule {}\r\n","import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'accela-button-primary',\r\n templateUrl: './accela-button-primary.component.html',\r\n styleUrls: ['./accela-button-primary.component.css']\r\n})\r\nexport class AccelaButtonPrimaryComponent implements OnInit {\r\n\r\n @Output('onClicked') clickEmitter = new EventEmitter(true);\r\n\r\n @Input('icon') iconName: string;\r\n @Input('iconPos') iconPosition: string;\r\n @Input('label') labelContent: string;\r\n @Input('disabled') processing: boolean;\r\n @Input() accessButton: string = null;\r\n \r\n constructor() { }\r\n\r\n ngOnInit(): void {\r\n }\r\n\r\n click(event: any){\r\n this.clickEmitter.emit(event);\r\n }\r\n}\r\n","