diff --git a/apps/red-ui/src/app/modules/admin/dialogs/confirm-delete-attribute-dialog/confirm-delete-attribute-dialog.component.html b/apps/red-ui/src/app/modules/admin/dialogs/confirm-delete-attribute-dialog/confirm-delete-attribute-dialog.component.html
index ad958d2ae..a6ac8607a 100644
--- a/apps/red-ui/src/app/modules/admin/dialogs/confirm-delete-attribute-dialog/confirm-delete-attribute-dialog.component.html
+++ b/apps/red-ui/src/app/modules/admin/dialogs/confirm-delete-attribute-dialog/confirm-delete-attribute-dialog.component.html
@@ -5,7 +5,7 @@
| translate
: {
type: type,
- name: attribute?.label
+ name: data.attribute?.label
}
}}
@@ -20,14 +20,11 @@
-
- {{ checkbox.label | translate: { type: type } }}
-
+
+
+ {{ checkbox.label }}
+
+
diff --git a/apps/red-ui/src/app/modules/admin/dialogs/confirm-delete-attribute-dialog/confirm-delete-attribute-dialog.component.ts b/apps/red-ui/src/app/modules/admin/dialogs/confirm-delete-attribute-dialog/confirm-delete-attribute-dialog.component.ts
index f6a7db47d..bbc92d62c 100644
--- a/apps/red-ui/src/app/modules/admin/dialogs/confirm-delete-attribute-dialog/confirm-delete-attribute-dialog.component.ts
+++ b/apps/red-ui/src/app/modules/admin/dialogs/confirm-delete-attribute-dialog/confirm-delete-attribute-dialog.component.ts
@@ -1,17 +1,21 @@
import { Component, Inject } from '@angular/core';
import { DossierAttributeConfig, FileAttributeConfig } from '@red/domain';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
-import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
+import { TranslateService } from '@ngx-translate/core';
-const isFileAttributeConfig = (value: DossierAttributeConfig | FileAttributeConfig): value is FileAttributeConfig => {
- return value instanceof FileAttributeConfig;
-};
+const isFileAttributeConfig = (value: DossierAttributeConfig | FileAttributeConfig): value is FileAttributeConfig =>
+ value instanceof FileAttributeConfig;
interface CheckBox {
value: boolean;
label: string;
}
+interface DialogData {
+ attribute: FileAttributeConfig | DossierAttributeConfig;
+ count: number;
+}
+
@Component({
selector: 'redaction-confirm-delete-attribute-dialog',
templateUrl: './confirm-delete-attribute-dialog.component.html',
@@ -22,32 +26,42 @@ export class ConfirmDeleteAttributeDialogComponent {
showToast = false;
constructor(
+ private readonly _translateService: TranslateService,
public dialogRef: MatDialogRef,
- @Inject(MAT_DIALOG_DATA) public attribute: FileAttributeConfig | DossierAttributeConfig,
+ @Inject(MAT_DIALOG_DATA) public data: DialogData,
) {
this.checkboxes = this.checkBoxConfig;
}
get checkBoxConfig(): CheckBox[] {
- return isFileAttributeConfig(this.attribute)
+ const checkBoxes = isFileAttributeConfig(this.data.attribute)
? [
- { value: false, label: _('confirm-delete-file-attribute.file-impacted-documents') },
- { value: false, label: _('confirm-delete-file-attribute.file-lost-details') },
- { value: false, label: _('confirm-delete-file-attribute.impacted-report') },
+ {
+ value: false,
+ label: this._translateService.instant('confirm-delete-file-attribute.file-impacted-documents', { type: this.type }),
+ },
+ { value: false, label: this._translateService.instant('confirm-delete-file-attribute.file-lost-details') },
]
: [
- { value: false, label: _('confirm-delete-file-attribute.dossier-impacted-documents') },
- { value: false, label: _('confirm-delete-file-attribute.dossier-lost-details') },
- { value: false, label: _('confirm-delete-file-attribute.impacted-report') },
+ { value: false, label: this._translateService.instant('confirm-delete-file-attribute.dossier-impacted-documents') },
+ { value: false, label: this._translateService.instant('confirm-delete-file-attribute.dossier-lost-details') },
];
+ if (this.data.count !== 0) {
+ checkBoxes.push({
+ value: false,
+ label: this._translateService.instant('confirm-delete-file-attribute.impacted-report', { count: this.data.count }),
+ });
+ }
+
+ return checkBoxes;
}
get valid() {
- return this.checkboxes[0].value && this.checkboxes[1].value;
+ return this.checkboxes.reduce((initialValue, currentValue) => initialValue && currentValue.value, true);
}
get type(): 'bulk' | 'single' {
- return this.attribute ? 'single' : 'bulk';
+ return this.data.attribute ? 'single' : 'bulk';
}
deleteFileAttribute() {
diff --git a/apps/red-ui/src/app/modules/admin/screens/dossier-attributes-listing/dossier-attributes-listing-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/dossier-attributes-listing/dossier-attributes-listing-screen.component.ts
index a9e2ddd5e..50f43dc35 100644
--- a/apps/red-ui/src/app/modules/admin/screens/dossier-attributes-listing/dossier-attributes-listing-screen.component.ts
+++ b/apps/red-ui/src/app/modules/admin/screens/dossier-attributes-listing/dossier-attributes-listing-screen.component.ts
@@ -57,10 +57,11 @@ export class DossierAttributesListingScreenComponent extends ListingComponent {
+ this._dialogService.openDialog('deleteAttribute', $event, { attribute: dossierAttribute, count: resp.length }, async () => {
this._loadingService.start();
const ids = dossierAttribute ? [dossierAttribute.id] : this.listingService.selected.map(item => item.id);
await firstValueFrom(this._dossierAttributesService.delete(ids));
diff --git a/apps/red-ui/src/app/modules/admin/screens/file-attributes-listing/file-attributes-listing-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/file-attributes-listing/file-attributes-listing-screen.component.ts
index a1b0a7d20..74774974a 100644
--- a/apps/red-ui/src/app/modules/admin/screens/file-attributes-listing/file-attributes-listing-screen.component.ts
+++ b/apps/red-ui/src/app/modules/admin/screens/file-attributes-listing/file-attributes-listing-screen.component.ts
@@ -18,6 +18,7 @@ import { FileAttributesService } from '@services/entity-services/file-attributes
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
import { HttpStatusCode } from '@angular/common/http';
import { firstValueFrom } from 'rxjs';
+import { ReportTemplateService } from '../../../../services/report-template.service';
@Component({
templateUrl: './file-attributes-listing-screen.component.html',
@@ -60,6 +61,7 @@ export class FileAttributesListingScreenComponent extends ListingComponent {
+ async openConfirmDeleteAttributeDialog($event: MouseEvent, fileAttribute?: FileAttributeConfig) {
+ const dossierTemplateId = this._dossierTemplatesService.activeDossierTemplateId;
+ const resp = await firstValueFrom(
+ this._reportTemplateService.getTemplatesByPlaceholder(dossierTemplateId, fileAttribute.placeholder),
+ );
+
+ this._dialogService.openDialog('deleteAttribute', $event, { attribute: fileAttribute, count: resp.length }, async () => {
this._loadingService.start();
- const dossierTemplateId = this._dossierTemplatesService.activeDossierTemplateId;
if (fileAttribute) {
await firstValueFrom(this._fileAttributesService.deleteFileAttributes([fileAttribute.id], dossierTemplateId));
} else {
diff --git a/apps/red-ui/src/app/services/report-template.service.ts b/apps/red-ui/src/app/services/report-template.service.ts
index ac9418e1d..585f4c36a 100644
--- a/apps/red-ui/src/app/services/report-template.service.ts
+++ b/apps/red-ui/src/app/services/report-template.service.ts
@@ -45,7 +45,7 @@ export class ReportTemplateService extends GenericService {
@Validate()
getTemplatesByPlaceholder(@RequiredParam() dossierTemplateId: string, @RequiredParam() attributeId: string) {
- return this._post({ value: attributeId }, `/templates/${dossierTemplateId}`);
+ return this._post({ value: attributeId }, `templates/${dossierTemplateId}`);
}
downloadReportTemplate(dossierTemplateId: string, templateId: string, observe: 'response'): Observable>;
diff --git a/apps/red-ui/src/assets/i18n/de.json b/apps/red-ui/src/assets/i18n/de.json
index 262c2d514..7dd9ec900 100644
--- a/apps/red-ui/src/assets/i18n/de.json
+++ b/apps/red-ui/src/assets/i18n/de.json
@@ -395,11 +395,14 @@
"confirm-delete-file-attribute": {
"cancel": "{type, select, single{Attribut} bulk{Attribute} other{}} behalten",
"delete": "{type, select, single{Attribut} bulk{Attribute} other{}} löschen",
- "impacted-documents": "Alle Dokumente {type, select, single{ist} bulk{sind} other{}} betroffen",
- "lost-details": "Alle in die Dokumente eingegebenen Daten gehen verloren",
+ "file-impacted-documents": "Alle Dokumente {type, select, single{ist} bulk{sind} other{}} betroffen",
+ "dossier-impacted-documents": "",
+ "file-lost-details": "Alle in die Dokumente eingegebenen Daten gehen verloren",
+ "dossier-lost-details": "",
"title": "{type, select, single{{name}} bulk{Datei-Attribute} other{}} löschen",
"toast-error": "Bitte bestätigen Sie, dass Ihnen die Konsequenzen dieser Aktion bewusst sind!",
- "warning": "Achtung: Diese Aktion kann nicht rückgängig gemacht werden!"
+ "warning": "Achtung: Diese Aktion kann nicht rückgängig gemacht werden!",
+ "impacted-report": "{count}"
},
"confirm-delete-users": {
"cancel": "{usersCount, plural, one{Benutzer} other{Benutzer}} behalten",
diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json
index a11542768..5df64f861 100644
--- a/apps/red-ui/src/assets/i18n/en.json
+++ b/apps/red-ui/src/assets/i18n/en.json
@@ -402,7 +402,7 @@
"title": "Delete {type, select, single{{name}} bulk{File Attributes} other{}}",
"toast-error": "Please confirm that you understand the ramifications of your action!",
"warning": "Warning: this cannot be undone!",
- "impacted-report": "<#reports> reports use the placeholder for this attribute and need to be adjusted"
+ "impacted-report": "{count} reports use the placeholder for this attribute and need to be adjusted"
},
"confirm-delete-users": {
"cancel": "Keep {usersCount, plural, one{User} other{Users}}",