WEB-252: Buy Down fee adjustment template pop up window - Adjustment button active / not active

This commit is contained in:
Jose Alberto Hernandez
2025-07-11 16:09:39 -05:00
parent b9d8bd2b64
commit 85d28acb65
9 changed files with 48 additions and 18 deletions
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';
import { UntypedFormControl, UntypedFormGroup, ValidatorFn, Validators } from '@angular/forms';
import { FormfieldBase } from './formfield/model/formfield-base';
@@ -14,10 +14,21 @@ export class FormGroupService {
formfields.forEach((formfield) => {
group[formfield.controlName] = formfield.required
? new UntypedFormControl(formfield.value, Validators.required)
: new UntypedFormControl(formfield.value);
? new UntypedFormControl(formfield.value, this.buildValidators(formfield))
: new UntypedFormControl(formfield.value, this.buildValidators(formfield));
});
return new UntypedFormGroup(group);
}
buildValidators(formfield: FormfieldBase): ValidatorFn[] {
let validators: ValidatorFn[] = [];
if (formfield.required) {
validators.push(Validators.required);
}
if (formfield.validators) {
formfield.validators.forEach((validator: ValidatorFn) => validators.push(validator));
}
return validators;
}
}