import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { RegisterService } from './register.service'; import { User } from '../../_models/user.class'; @Component({ selector: 'app-dashboard', templateUrl: 'register.component.html', styles: [] }) export class RegisterComponent implements OnInit { public user: any = {}; public EMAIL: number = 1; public MOBILE: number = 2; public PINCODE: number = 3; public CONFIRMPASSWORD: number = 4; public pinCodeFromServer: number = 0; public showPin: boolean = false; public mobileExist: boolean = false; public emailExist: boolean = false; public codeVerificationFailed: boolean = false; public passwordNotMatched: boolean = false; public step: number = 1; public nextText: string = 'Verify'; public loadingClass: string = 'register-hr'; public mask: string = "0-0-0-0-0-0"; public pin: string = ''; constructor(private router: Router, private _registerService: RegisterService) { let element = document.getElementsByTagName("body")[0]; element.classList.remove("sidebar-lg-show"); } ngOnInit() { } public getPmisUsers() { } public register() { this.loading(true); /* this._registerService.registerMongo(this.user).subscribe( data => { this.loading(false); this.router.navigate(['/account/login']); }, err => { this.loading(false); } ) */ } public inputChanged(inputRef: number, value?: any) { switch (inputRef) { case this.MOBILE: this.mobileExist = false; break; case this.EMAIL: this.emailExist = false; case this.PINCODE: this.codeVerificationFailed = false; break; case this.CONFIRMPASSWORD: if (this.user.password !== this.user.confirmPassword) { this.passwordNotMatched = true; } else if (this.user.password === this.user.confirmPassword) { this.passwordNotMatched = false; } break; default: break; } } //Loading Helper Function public loading(start: boolean) { if (start) { this.mobileExist = false; this.emailExist = false; this.codeVerificationFailed = false; this.loadingClass = 'register-hr-anime'; } else { this.loadingClass = 'register-hr'; } } }