import { Component, Input } from '@angular/core';
-import { FormArray, FormControl, Validators } from '@angular/forms';
+import { FormArray, FormControl, NgForm, Validators } from '@angular/forms';
import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { NfsService } from '../../../shared/api/nfs.service';
+import { Icons } from '../../../shared/enum/icons.enum';
import { CdFormGroup } from '../../../shared/forms/cd-form-group';
@Component({
nfsSquash: any[] = this.nfsService.nfsSquash;
nfsAccessType: any[] = this.nfsService.nfsAccessType;
+ icons = Icons;
constructor(private nfsService: NfsService, private i18n: I18n) {}
return this.i18n('-- Select the access type --');
}
- getAccessTypeHelp(index) {
+ getAccessTypeHelp(index: number) {
const accessTypeItem = this.nfsAccessType.find((currentAccessTypeItem) => {
return this.getValue(index, 'access_type') === currentAccessTypeItem.value;
});
return fg;
}
- removeClient(index) {
+ removeClient(index: number) {
const clients = this.form.get('clients') as FormArray;
clients.removeAt(index);
}
- showError(index, control, formDir, x) {
+ showError(index: number, control: string, formDir: NgForm, x: string) {
return (<any>this.form.controls.clients).controls[index].showError(control, formDir, x);
}
- getValue(index, control) {
+ getValue(index: number, control: string) {
const clients = this.form.get('clients') as FormArray;
const client = clients.at(index) as CdFormGroup;
return client.getValue(control);
});
}
- trackByFn(index) {
+ trackByFn(index: number) {
return index;
}
}