/** Angular Imports */ import { Component , OnInit } from '@angular/core' ; import { ActivatedRoute , Router } from '@angular/router' ; import { FormGroup , FormBuilder , Validators } from '@angular/forms' ; /** Custom Services */ import { SystemService } from 'app/system/system.service' ; /**
 * Edit Notification Configuration Component.
 */ @ Component ( { selector : 'mifosx-edit-notification' , templateUrl : './edit-notification.component.html' , styleUrls : [ './edit-notification.component.scss' ] } ) export class EditNotificationComponent implements OnInit { /** Notification Configuration data */ notificationConfigurationData : any ; /** Notification Configuration Form */ notificationConfigurationForm : FormGroup ; param { FormBuilder } formBuilder param { SystemService } systemService param { ActivatedRoute } route param { Router } router constructor ( private formBuilder , private systemService , private route , private router ) { this . route . data . subscribe ( ( data ) => { this . notificationConfigurationData = data . notificationConfiguration ; } ) ; } /**
     * Creates Notification configuration form.
     */ ngOnInit ( ) { this . setNotificationConfigurationForm ( ) ; } /**
     * Creates Notification configuration form.
     */ setNotificationConfigurationForm ( ) { this . notificationConfigurationForm = this . formBuilder . group ( { 'server_key' : [ this . notificationConfigurationData [ 0 ] . value , Validators . required ] , 'gcm_end_point' : [ this . notificationConfigurationData [ 1 ] . value , Validators . required ] , 'fcm_end_point' : [ this . notificationConfigurationData [ 2 ] . value , Validators . required ] } ) ; } /**
     * Submits the Notification configuration and updates the Notification configuration,
     * if successful redirects to view Notification configuration.
     */ submit ( ) { this . systemService . updateExternalConfiguration ( 'NOTIFICATION' , this . notificationConfigurationForm . value ) . subscribe ( ( response ) => { this . router . navigate ( [ '../' ] , { relativeTo : this . route } ) ; } ) ; } }