Fixed changed fn in edit dossier template; update common-ui

This commit is contained in:
Adina Țeudan 2021-08-27 17:14:18 +03:00
parent efb58166be
commit b6b8763a55
2 changed files with 13 additions and 14 deletions

View File

@ -71,27 +71,26 @@ export class AddEditDossierTemplateDialogComponent implements OnInit {
} }
for (const key of Object.keys(this.dossierTemplateForm.getRawValue())) { for (const key of Object.keys(this.dossierTemplateForm.getRawValue())) {
const formValue = this.dossierTemplateForm.get(key).value;
const objectValue = this.dossierTemplate[key];
if (key === 'validFrom') { if (key === 'validFrom') {
if (this.hasValidFrom !== !!this.dossierTemplate.validFrom) { if (this.hasValidFrom !== !!objectValue || (this.hasValidFrom && !moment(objectValue).isSame(moment(formValue)))) {
return true;
}
if (
this.hasValidFrom &&
!moment(this.dossierTemplate.validFrom).isSame(moment(this.dossierTemplateForm.get('validFrom').value))
) {
return true; return true;
} }
} else if (key === 'validTo') { } else if (key === 'validTo') {
if (this.hasValidTo !== !!this.dossierTemplate.validTo) { if (this.hasValidTo !== !!objectValue || (this.hasValidTo && !moment(objectValue).isSame(moment(formValue)))) {
return true; return true;
} }
if ( } else if (formValue instanceof Array) {
this.hasValidTo && if (objectValue.length !== formValue.length) {
!moment(this.dossierTemplate.validTo).isSame(moment(this.dossierTemplateForm.get('validTo').value))
) {
return true; return true;
} }
} else if (this.dossierTemplate[key] !== this.dossierTemplateForm.get(key).value) { for (const item of objectValue) {
if (!formValue.includes(item)) {
return true;
}
}
} else if (objectValue !== formValue) {
return true; return true;
} }
} }

@ -1 +1 @@
Subproject commit 1afafe0e28239da365d9f1e663763b210b9a9b6f Subproject commit 7029f2942d154e7910bb55ec7f7d44e9986f1abc