diff --git a/apps/red-ui/src/app/modules/dossier-overview/components/table-item/file-attribute/file-attribute.component.html b/apps/red-ui/src/app/modules/dossier-overview/components/table-item/file-attribute/file-attribute.component.html index 602e751e4..ec156f82e 100644 --- a/apps/red-ui/src/app/modules/dossier-overview/components/table-item/file-attribute/file-attribute.component.html +++ b/apps/red-ui/src/app/modules/dossier-overview/components/table-item/file-attribute/file-attribute.component.html @@ -4,7 +4,7 @@ {{ fileAttributeValue ? (fileAttributeValue | date : 'd MMM yyyy') : '-' }} - +
{ this.#toggleEdit(); } @@ -111,7 +98,11 @@ export class FileAttributeComponent extends BaseFormComponent implements OnInit, #initFileAttributes() { const configs = this.fileAttributesService.getFileAttributeConfig(this.file.dossierTemplateId).fileAttributeConfigs; - configs.forEach(config => (this.file.fileAttributes.attributeIdToValue[config.id] = null)); + configs.forEach(config => { + if (!this.file.fileAttributes.attributeIdToValue[config.id]) { + this.file.fileAttributes.attributeIdToValue[config.id] = null; + } + }); } #getForm(): UntypedFormGroup { @@ -129,6 +120,12 @@ export class FileAttributeComponent extends BaseFormComponent implements OnInit, } #toggleEdit(): void { + if (!this.isInEditMode) { + this.#initFileAttributes(); + this.form = this.#getForm(); + this.initialFormValue = this.form.getRawValue(); + } + this.isInEditMode = !this.isInEditMode; this.fileAttributesService.isEditingFileAttribute$.next(this.isInEditMode);