Added pristineWarning if no changes has been made to edit employee form

This commit is contained in:
Erik Tiekstra
2021-09-09 05:41:48 +02:00
parent b06436adee
commit 1e45fb5da5
4 changed files with 23 additions and 6 deletions

View File

@@ -5,6 +5,5 @@ export interface EmployeeEditRequest {
roles: RoleEnum[];
tjanstIds: number[];
allaUtforandeVerksamheter: boolean;
utforandeVerksamhetIds?: number[];
adressIds: number[];
}

View File

@@ -4,14 +4,15 @@ import { TreeNode } from '@msfa-shared/components/tree-nodes-selector/services/t
export class TreeNodeValidator {
static IsValidTreeNode(
validationFn: (treeNode: TreeNode | null | undefined) => boolean,
nameOfError: string
nameOfError: string,
allUtforandeVerksamheterFormControl: AbstractControl
): ValidatorFn {
return (control: AbstractControl): { [key: string]: unknown } => {
const isValid = validationFn(control.value);
const validationObj = {};
if (isValid) {
if (isValid || allUtforandeVerksamheterFormControl?.value) {
return null;
}