/** Angular Imports */ import { Component , OnInit } from '@angular/core' ; import { ActivatedRoute , Router } from '@angular/router' ; import { MatDialog } from '@angular/material/dialog' ; /** Custom Components */ import { DeleteDialogComponent } from '../../../shared/delete-dialog/delete-dialog.component' ; /** Custom Services */ import { SystemService } from '../../system.service' ; /**
 * View Hook Component.
 */ @ Component ( { selector : 'mifosx-view-hook' , templateUrl : './view-hook.component.html' , styleUrls : [ './view-hook.component.scss' ] } ) export class ViewHookComponent implements OnInit { /** Hook Data. */ hookData : any ; param { ActivatedRoute } route param { MatDialog } dialog param { SystemService } systemService param { Router } router constructor ( private route , private dialog , private systemService , private router ) { this . route . data . subscribe ( ( data ) => { this . hookData = data . hook ; } ) ; } ngOnInit ( ) { } /**
     * Deletes the current hook.
     */ delete ( ) { const deleteHookDialogRef = this . dialog . open ( DeleteDialogComponent , { data : { deleteContext : `hook ${ this . hookData . id }` } } ) ; deleteHookDialogRef . afterClosed ( ) . subscribe ( ( response ) => { if ( response . delete ) { this . systemService . deleteHook ( this . hookData . id ) . subscribe ( ( ) => { this . router . navigate ( [ '/system/hooks' ] ) ; } ) ; } } ) ; } }