diff --git a/resident-ui/src/app/feature/booking/center-selection/center-selection.component.ts b/resident-ui/src/app/feature/booking/center-selection/center-selection.component.ts index 1e64ea8e..6a862423 100644 --- a/resident-ui/src/app/feature/booking/center-selection/center-selection.component.ts +++ b/resident-ui/src/app/feature/booking/center-selection/center-selection.component.ts @@ -73,6 +73,7 @@ export class CenterSelectionComponent implements OnInit, OnDestroy { isMobileView:boolean = false; showLocationDetails:boolean = true; showBackBtn:boolean = false; + positions:any; private keyboardRef: MatKeyboardRef; @@ -265,12 +266,12 @@ export class CenterSelectionComponent implements OnInit, OnDestroy { } searchInput(){ - if(this.searchText.length > 2 && this.searchText.match(/[\p{Letter}\p{Number}\p{Mark}\s]+/gu)){ + if(this.searchText.length > 2 && this.searchText.match(/^[a-zA-Z0-9 ]*$/)){ this.isBlankSpace = false; }else{ this.isBlankSpace = true; } - if(!this.searchText.match(/[\p{Letter}\p{Number}\p{Mark}\s]+/gu)){ + if(!this.searchText.match(/^[a-zA-Z0-9 ]*$/)){ this.showWarningMsg = true; }else{ this.showWarningMsg = false; @@ -376,9 +377,10 @@ export class CenterSelectionComponent implements OnInit, OnDestroy { getLocation() { this.REGISTRATION_CENTRES = []; this.nearbyClicked = true; - if (navigator.geolocation) { + if ("geolocation" in navigator) { this.showMap = false; - navigator.geolocation.getCurrentPosition((position) => { + this.positions = navigator.geolocation; + this.positions.getCurrentPosition((position) => { const subs = this.dataService .getNearbyRegistrationCenters(position.coords) .subscribe( @@ -402,8 +404,7 @@ export class CenterSelectionComponent implements OnInit, OnDestroy { //this.showErrorMessage(error); }); this.subscriptions.push(subs); - }); - } else { + }) } } @@ -564,26 +565,26 @@ export class CenterSelectionComponent implements OnInit, OnDestroy { }) } else { if (navigator.geolocation) { - navigator.geolocation.getCurrentPosition((position) => { + this.positions.getCurrentPosition((position) => { this.dataService.nearByRegistrationCentersList(this.langCode, position.coords) - .subscribe(response =>{ - if (response.headers.get('Content-Type') === 'application/pdf') { - var fileName = ""; - const contentDisposition = response.headers.get('Content-Disposition'); - if (contentDisposition) { - const fileNameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/; - const matches = fileNameRegex.exec(contentDisposition); - if (matches != null && matches[1]) { - fileName = matches[1].replace(/['"]/g, ''); + .subscribe(response =>{ + if (response.headers.get('Content-Type') === 'application/pdf') { + var fileName = ""; + const contentDisposition = response.headers.get('Content-Disposition'); + if (contentDisposition) { + const fileNameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/; + const matches = fileNameRegex.exec(contentDisposition); + if (matches != null && matches[1]) { + fileName = matches[1].replace(/['"]/g, ''); + } + } + saveAs(response.body, fileName); + } else { + console.log(""); } - } - saveAs(response.body, fileName); - } else { - console.log(""); - } - }, error =>{ + }, error =>{ console.log(error); - }) + }) }) } } diff --git a/resident-ui/src/index.html b/resident-ui/src/index.html index 2facf202..4b59e459 100644 --- a/resident-ui/src/index.html +++ b/resident-ui/src/index.html @@ -8,7 +8,7 @@ - +