/** Angular Imports */ import { Component , OnInit } from '@angular/core' ; import { FormGroup , FormBuilder } from '@angular/forms' ; import { ActivatedRoute , Router } from '@angular/router' ; /** Custom Services */ import { ClientsService } from 'app/clients/clients.service' ; /**
 * Clients Assign Staff Component
 */ @ Component ( { selector : 'mifosx-client-assign-staff' , templateUrl : './client-assign-staff.component.html' , styleUrls : [ './client-assign-staff.component.scss' ] } ) export class ClientAssignStaffComponent implements OnInit { /** Client Assign Staff form. */ clientAssignStaffForm : FormGroup ; /** Staff Data */ staffData : any ; /** Client Data */ clientData : any ; param { FormBuilder } formBuilder param { SavingsService } savingsService param { ActivatedRoute } route param { Router } router constructor ( private formBuilder , private clientsService , private route , private router ) { this . route . data . subscribe ( ( data ) => { this . clientData = data . clientActionData ; } ) ; } /**
     * Creates the client assign staff form.
     */ ngOnInit ( ) { this . staffData = this . clientData . staffOptions ; this . createClientAssignStaffForm ( ) ; } /**
     * Creates the client assign staff form.
     */ createClientAssignStaffForm ( ) { this . clientAssignStaffForm = this . formBuilder . group ( { 'staffId' : [ '' ] } ) ; } /**
     * Submits the form and assigns staff for the client.
     */ submit ( ) { this . clientsService . executeClientCommand ( this . clientData . id , 'assignStaff' , this . clientAssignStaffForm . value ) . subscribe ( ( ) => { this . router . navigate ( [ '../../' ] , { relativeTo : this . route } ) ; } ) ; } }