/** Angular Imports */ import { Component , OnInit } from '@angular/core' ; import { FormBuilder , FormGroup , Validators } from '@angular/forms' ; import { Router , ActivatedRoute } from '@angular/router' ; /** Custom Services */ import { SystemService } from '../../system.service' ; /**
 * Add Role Component.
 */ @ Component ( { selector : 'mifosx-add-role' , templateUrl : './add-role.component.html' , styleUrls : [ './add-role.component.scss' ] } ) export class AddRoleComponent implements OnInit { /** Role form. */ roleForm : FormGroup ; param { FormBuilder } formBuilder param { SystemService } systemService param { ActivatedRoute } route param { Router } router constructor ( private formBuilder , private systemService , private route , private router ) { } /**
     * Creates the role form.
     */ ngOnInit ( ) { this . createRoleForm ( ) ; } /**
     * Creates the create role form.
     */ createRoleForm ( ) { this . roleForm = this . formBuilder . group ( { 'name' : [ '' , Validators . required ] , 'description' : [ '' , Validators . required ] } ) ; } /**
     * Submits the role form and creates a role,
     * if successful redirects back to roles and permission.
     */ submit ( ) { this . systemService . createRole ( this . roleForm . value ) . subscribe ( ( response ) => { this . router . navigate ( [ '../' ] , { relativeTo : this . route } ) ; } ) ; } }