/** 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 SMS Configuration Component.
 */ @ Component ( { selector : 'mifosx-edit-sms' , templateUrl : './edit-sms.component.html' , styleUrls : [ './edit-sms.component.scss' ] } ) export class EditSMSComponent implements OnInit { /** SMS Configuration data */ smsConfigurationData : any ; /** SMS Configuration Form */ smsConfigurationForm : 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 . smsConfigurationData = data . smsConfiguration ; } ) ; } /**
     * Creates SMS configuration form.
     */ ngOnInit ( ) { this . setSMSConfigurationForm ( ) ; } /**
     * Creates SMS configuration form.
     */ setSMSConfigurationForm ( ) { this . smsConfigurationForm = this . formBuilder . group ( { 'host_name' : [ this . smsConfigurationData [ 0 ] . value , Validators . required ] , 'port_number' : [ this . smsConfigurationData [ 1 ] . value , Validators . required ] , 'end_point' : [ this . smsConfigurationData [ 2 ] . value , Validators . required ] , 'tenant_app_key' : [ this . smsConfigurationData [ 3 ] . value , Validators . required ] } ) ; } /**
     * Submits the SMS configuration and updates the SMS configuration,
     * if successful redirects to view SMS configuration.
     */ submit ( ) { this . systemService . updateExternalConfiguration ( 'SMS' , this . smsConfigurationForm . value ) . subscribe ( ( response ) => { this . router . navigate ( [ '../' ] , { relativeTo : this . route } ) ; } ) ; } }