Skip to content

Commit

Permalink
fix: added return types for update mobile number component (#2982)
Browse files Browse the repository at this point in the history
  • Loading branch information
suyashpatil78 authored May 16, 2024
1 parent 1fe2697 commit 86f9772
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { OrgUserService } from 'src/app/core/services/org-user.service';
styleUrls: ['./update-mobile-number.component.scss'],
})
export class UpdateMobileNumberComponent implements OnInit, AfterViewInit {
@ViewChild('input') inputEl: ElementRef;
@ViewChild('input') inputEl: ElementRef<HTMLInputElement>;

@Input() title: string;

Expand Down Expand Up @@ -39,27 +39,27 @@ export class UpdateMobileNumberComponent implements OnInit, AfterViewInit {
this.inputValue = this.extendedOrgUser.ou.mobile || '';
}

ngAfterViewInit() {
ngAfterViewInit(): void {
setTimeout(() => this.inputEl.nativeElement.focus(), 400);
}

closePopover() {
closePopover(): void {
this.popoverController.dismiss();
}

validateInput() {
validateInput(): void {
if (!this.inputValue?.length) {
this.error = 'Please enter a Mobile Number';
} else if (!this.inputValue.match(/[+]\d{7,}$/)) {
this.error = 'Please enter a valid mobile number with country code. e.g. +12025559975';
}
}

onFocus() {
onFocus(): void {
this.error = null;
}

saveValue() {
saveValue(): void {
//If user has not changed the verified mobile number, close the popover
if (this.inputValue === this.extendedOrgUser.ou.mobile && this.extendedOrgUser.ou.mobile_verified) {
this.popoverController.dismiss();
Expand Down

0 comments on commit 86f9772

Please sign in to comment.