/** Angular Imports */ import { Component } from '@angular/core' ; import { ActivatedRoute , Router } from '@angular/router' ; import { MatDialog } from '@angular/material/dialog' ; /** Custom Services */ import { TemplatesService } from '../templates.service' ; /** Custom Components */ import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component' ; /**
 * View Template Component.
 */ @ Component ( { selector : 'mifosx-view-template' , templateUrl : './view-template.component.html' , styleUrls : [ './view-template.component.scss' ] } ) export class ViewTemplateComponent { /** Template Data */ templateData : any ; param { TemplateService } templateService param { ActivatedRoute } route param { Router } router param { MatDialog } dialog constructor ( private route , private templatesService , private router , private dialog ) { this . route . data . subscribe ( ( data ) => { this . templateData = data . template ; } ) ; } /**
     * Deletes the template and redirects to templates.
     */ delete ( ) { const deleteTemplateDialogRef = this . dialog . open ( DeleteDialogComponent , { data : { deleteContext : `template ${ this . templateData . id }` } } ) ; deleteTemplateDialogRef . afterClosed ( ) . subscribe ( ( response ) => { if ( response . delete ) { this . templatesService . deleteTemplate ( this . templateData . id ) . subscribe ( ( ) => { this . router . navigate ( [ '/templates' ] ) ; } ) ; } } ) ; } }