/** Angular Imports */ import { Component , OnInit } from '@angular/core' ; import { ActivatedRoute , Router } from '@angular/router' ; import { ChangePasswordDialogComponent } from 'app/shared/change-password-dialog/change-password-dialog.component' ; import { MatDialog } from '@angular/material/dialog' ; /** Custom Services. */ import { UserService } from '../user.service' ; /**
 * View self service user component.
 *
 * TODO: Complete functionality once API is available.
 */ @ Component ( { selector : 'mifosx-view-user' , templateUrl : './view-user.component.html' , styleUrls : [ './view-user.component.scss' ] } ) export class ViewUserComponent implements OnInit { /** Self service user. */ user : any ; param { ActivatedRoute } route param { UserService } userService param { ActivatedRoute } route param { Router } router param { MatDialog } dialog constructor ( private route , private userService , private router , private dialog ) { this . route . data . subscribe ( ( data ) => { this . user = data . user ; } ) ; } ngOnInit ( ) { } /**
     * Open Dialog to Change Password
     */ changeUserPassword ( ) { const changeUserPasswordDialogRef = this . dialog . open ( ChangePasswordDialogComponent , { width : '400px' , height : '300px' } ) ; changeUserPasswordDialogRef . afterClosed ( ) . subscribe ( ( response ) => { if ( response . password && response . repeatPassword ) { const password = response . password ; const repeatPassword = response . repeatPassword ; const data = { password : password , repeatPassword : repeatPassword } ; this . userService . changePassword ( this . user . id , data ) . subscribe ( ( ) => { this . router . navigate ( [ '/..' ] ) ; } ) ; } } ) ; } }