feat(avvikelserapport): fixed validation for dayOrPartOfDay TV-407-fix
Squashed commit of the following: commit 985d76a5b0876a1ececd46c9538144b6121070ee Author: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se> Date: Fri Sep 17 10:37:57 2021 +0200 TV-407: fixed validation for dayOrPartOfDay
This commit is contained in:
@@ -35,6 +35,19 @@ export class OrsakerIsRequiredCheck {
|
||||
}
|
||||
}
|
||||
|
||||
export class DayOrPartOfDayIsRequiredCheck {
|
||||
static CheckIfRequired(
|
||||
controlToValidateName: string,
|
||||
): ValidatorFn {
|
||||
return (fg: AbstractControl): { [key: string]: boolean } => {
|
||||
const valueOfControlToValidate = fg?.get(controlToValidateName)?.value as string;
|
||||
const isRequired = valueOfControlToValidate === null && fg?.get('alternative').value === Alternative.FRANVARO;
|
||||
|
||||
return isRequired ? { dayOrPartOfDayIsRequired: true } : null;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export class AnnanKandOrsakeIsRequiredCheck {
|
||||
static CheckIfRequired(
|
||||
nestedFormGroupName: string,
|
||||
|
||||
Reference in New Issue
Block a user