From a54d61ee29013ca52b9f14963f0737362a2d29da Mon Sep 17 00:00:00 2001 From: Nicoleta Panaghiu Date: Thu, 20 Jul 2023 15:55:52 +0300 Subject: [PATCH] RED-6382 & RED-6973 --- .../file-attribute.component.ts | 19 +++++++++++-------- .../workflow-item.component.html | 6 +++++- .../workflow-item/workflow-item.component.ts | 7 ++++++- .../file-attributes.service.ts | 5 +++++ 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/apps/red-ui/src/app/modules/dossier-overview/components/file-attribute/file-attribute.component.ts b/apps/red-ui/src/app/modules/dossier-overview/components/file-attribute/file-attribute.component.ts index c259f285d..49eb46755 100644 --- a/apps/red-ui/src/app/modules/dossier-overview/components/file-attribute/file-attribute.component.ts +++ b/apps/red-ui/src/app/modules/dossier-overview/components/file-attribute/file-attribute.component.ts @@ -28,11 +28,12 @@ export class FileAttributeComponent extends BaseFormComponent implements OnDestr readonly #subscriptions = new Subscription(); readonly #shouldClose = computed( () => - this.fileAttributesService.isEditingFileAttribute() && - !!this.file && - !!this.fileAttribute && - (this.fileAttribute.id !== this.fileAttributesService.openAttributeEdit() || - this.file.fileId !== this.fileAttributesService.fileEdit()), + (this.fileAttributesService.isEditingFileAttribute() && + this.file && + this.fileAttribute && + (this.fileAttribute.id !== this.fileAttributesService.openAttributeEdit() || + this.file.fileId !== this.fileAttributesService.fileEdit())) || + !this.fileAttributesService.openAttributeEdits().length, ); constructor( @@ -95,7 +96,9 @@ export class FileAttributeComponent extends BaseFormComponent implements OnDestr async editFileAttribute($event: MouseEvent): Promise { if (!this.file.isInitialProcessing && this.permissionsService.canEditFileAttributes(this.file, this.dossier)) { $event.stopPropagation(); - this.fileAttributesService.openAttributeEdits.mutate(value => value.push(this.fileAttribute.id)); + this.fileAttributesService.openAttributeEdits.mutate(value => + value.push({ attribute: this.fileAttribute.id, file: this.file.id }), + ); this.#toggleEdit(); this.fileAttributesService.setFileEdit(this.file.fileId); this.fileAttributesService.setOpenAttributeEdit(this.fileAttribute.id); @@ -129,7 +132,7 @@ export class FileAttributeComponent extends BaseFormComponent implements OnDestr this.#toggleEdit(); this.fileAttributesService.openAttributeEdits.mutate(value => { for (let index = 0; index < value.length; index++) { - if (value[index] === this.fileAttribute.id) { + if (JSON.stringify(value[index]) === JSON.stringify({ attribute: this.fileAttribute.id, file: this.file.id })) { value.splice(index, 1); } } @@ -155,7 +158,7 @@ export class FileAttributeComponent extends BaseFormComponent implements OnDestr }); return this._formBuilder.group(config, { validators: control => - !control.get(this.fileAttribute.id).value?.trim().length && !this.fileAttributeValue ? { emptyString: true } : null, + !control.get(this.fileAttribute.id)?.value?.trim().length && !this.fileAttributeValue ? { emptyString: true } : null, }); } diff --git a/apps/red-ui/src/app/modules/dossier-overview/components/workflow-item/workflow-item.component.html b/apps/red-ui/src/app/modules/dossier-overview/components/workflow-item/workflow-item.component.html index 2c0632a24..729718d36 100644 --- a/apps/red-ui/src/app/modules/dossier-overview/components/workflow-item/workflow-item.component.html +++ b/apps/red-ui/src/app/modules/dossier-overview/components/workflow-item/workflow-item.component.html @@ -1,4 +1,8 @@ -
+
{ diff --git a/apps/red-ui/src/app/services/entity-services/file-attributes.service.ts b/apps/red-ui/src/app/services/entity-services/file-attributes.service.ts index 356328cf4..ff7015dd1 100644 --- a/apps/red-ui/src/app/services/entity-services/file-attributes.service.ts +++ b/apps/red-ui/src/app/services/entity-services/file-attributes.service.ts @@ -29,6 +29,11 @@ export class FileAttributesService extends EntitiesService