/** Angular Imports */ import { Component , OnInit } from '@angular/core' ; import { FormGroup , FormBuilder } from '@angular/forms' ; import { ActivatedRoute , Router } from '@angular/router' ; /** Custom Services */ import { CentersService } from 'app/centers/centers.service' ; /**
 * Centers Assign Staff Component
 */ @ Component ( { selector : 'mifosx-center-assign-staff' , templateUrl : './center-assign-staff.component.html' , styleUrls : [ './center-assign-staff.component.scss' ] } ) export class CenterAssignStaffComponent implements OnInit { /** Center Assign Staff form. */ centerAssignStaffForm : FormGroup ; /** Field Officer Data */ staffData : any ; /** Center Data */ centerData : any ; param { FormBuilder } formBuilder param { SavingsService } savingsService param { ActivatedRoute } route param { Router } router constructor ( private formBuilder , private centersService , private route , private router ) { this . route . data . subscribe ( ( data ) => { this . centerData = data . centersActionData ; } ) ; } /**
     * Creates the center assign staff form.
     */ ngOnInit ( ) { this . staffData = this . centerData . staffOptions ; this . createCenterAssignStaffForm ( ) ; } /**
     * Creates the center assign staff form.
     */ createCenterAssignStaffForm ( ) { this . centerAssignStaffForm = this . formBuilder . group ( { 'staffId' : [ '' ] } ) ; } /**
     * Submits the form and assigns staff for the center.
     */ submit ( ) { this . centersService . executeGroupActionCommand ( this . centerData . id , 'assignStaff' , this . centerAssignStaffForm . value ) . subscribe ( ( ) => { this . router . navigate ( [ '../../' ] , { relativeTo : this . route } ) ; } ) ; } }