diff --git a/apps/red-ui/src/app/modules/admin/screens/reports/reports-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/reports/reports-screen.component.html index ec8249b0d..117d96e9d 100644 --- a/apps/red-ui/src/app/modules/admin/screens/reports/reports-screen.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/reports/reports-screen.component.html @@ -61,7 +61,9 @@ >
-
{{ template.fileName }}
+
+ {{ template.fileName }} {{ template.multiFileReport ? ('reports-screen.multi-file-report' | translate) : '' }} +
{ + if (result) { + await this._reportTemplateService + .uploadTemplateForm(this._appStateService.activeDossierTemplateId, result > 1, file) + .toPromise(); + await this._loadReportTemplates(); + } + }); + } else { + await this._reportTemplateService + .uploadTemplateForm(this._appStateService.activeDossierTemplateId, false, file) + .toPromise(); + await this._loadReportTemplates(); } this._fileInput.nativeElement.value = null; - await this._loadReportTemplates(); } else { this._toaster.error(_('reports-screen.invalid-upload')); } diff --git a/apps/red-ui/src/app/modules/shared/dialogs/confirmation-dialog/confirmation-dialog.component.html b/apps/red-ui/src/app/modules/shared/dialogs/confirmation-dialog/confirmation-dialog.component.html index ec15cfdac..d1bc2137c 100644 --- a/apps/red-ui/src/app/modules/shared/dialogs/confirmation-dialog/confirmation-dialog.component.html +++ b/apps/red-ui/src/app/modules/shared/dialogs/confirmation-dialog/confirmation-dialog.component.html @@ -14,9 +14,20 @@
- + + +
{{ config.denyText }}
diff --git a/apps/red-ui/src/app/modules/shared/dialogs/confirmation-dialog/confirmation-dialog.component.ts b/apps/red-ui/src/app/modules/shared/dialogs/confirmation-dialog/confirmation-dialog.component.ts index c7ce504b3..e64004ec1 100644 --- a/apps/red-ui/src/app/modules/shared/dialogs/confirmation-dialog/confirmation-dialog.component.ts +++ b/apps/red-ui/src/app/modules/shared/dialogs/confirmation-dialog/confirmation-dialog.component.ts @@ -16,6 +16,7 @@ export class ConfirmationDialogInput { question?: string; details?: string; confirmationText?: string; + alternativeConfirmationText?: string; requireInput?: boolean; denyText?: string; translateParams?: Record; @@ -26,6 +27,7 @@ export class ConfirmationDialogInput { this.question = options?.question || _('common.confirmation-dialog.description'); this.details = options?.details || ''; this.confirmationText = options?.confirmationText || _('common.confirmation-dialog.confirm'); + this.alternativeConfirmationText = options?.alternativeConfirmationText; this.requireInput = options?.requireInput || false; this.denyText = options?.denyText || _('common.confirmation-dialog.deny'); this.translateParams = options?.translateParams || {}; @@ -58,7 +60,7 @@ export class ConfirmationDialogComponent { @HostListener('window:keyup.enter') onKeyupEnter() { if (this.config.requireInput && !this.confirmationDoesNotMatch()) { - this.confirm(); + this.confirm(1); } } @@ -70,12 +72,12 @@ export class ConfirmationDialogComponent { this._dialogRef.close(); } - confirm(): void { - this._dialogRef.close(true); + confirm(option: number): void { + this._dialogRef.close(option); } translate(obj: T): T { - const translateKeys = ['title', 'question', 'details', 'confirmationText', 'denyText']; + const translateKeys = ['title', 'question', 'details', 'confirmationText', 'alternativeConfirmationText', 'denyText']; if (typeof obj === 'string') return this._translateService.instant(obj, this.config.translateParams); diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index e298184fb..137125493 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -360,6 +360,13 @@ "warning": "Warning: this cannot be undone!" }, "confirmation-dialog": { + "upload-report-template": { + "question": "Please choose if {fileName} is a single or multi-file report template", + "title": "Report Template Upload", + "deny-text": "Cancel Upload", + "confirmation-text": "Upload as single-file report", + "alternate-confirmation-text": "Upload as multi-file report" + }, "assign-file-to-me": { "question": "This document is currently reviewed by someone else. Do you want to become the reviewer and assign yourself to this document?", "title": "Re-assign reviewer" @@ -1248,6 +1255,7 @@ }, "reports": "Reports", "reports-screen": { + "multi-file-report": "(Multi-file)", "description": "A short text explaining how to create report documents. It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.", "descriptions": { "dossier-attributes": "This placeholder gets replaced with the value of the dossier attribute {attribute}.", diff --git a/libs/red-ui-http/src/lib/api/reportTemplateController.service.ts b/libs/red-ui-http/src/lib/api/reportTemplateController.service.ts index 89726077f..02331bb5a 100644 --- a/libs/red-ui-http/src/lib/api/reportTemplateController.service.ts +++ b/libs/red-ui-http/src/lib/api/reportTemplateController.service.ts @@ -175,10 +175,11 @@ export class ReportTemplateControllerService { headers = headers.set('Accept', httpHeaderAcceptSelected); } - return this.httpClient.request( + return this.httpClient.request( 'get', `${this.basePath}/templateUpload/${encodeURIComponent(String(dossierTemplateId))}/${encodeURIComponent(String(templateId))}`, { + responseType: 'blob', withCredentials: this.configuration.withCredentials, headers: headers, observe: observe,