Pull request #331: confirmation dialog for template upload with the same name

Merge in RED/ui from RED-3123 to master

* commit 'efa924f3bf7fdf96923f6b25fc68420ba6edf44c':
  some instead of find
  confirmation dialog for template upload with the same name
This commit is contained in:
Eduard Cziszter 2022-01-17 13:30:09 +01:00 committed by Dan Percic
commit 10f82a9ca1
3 changed files with 34 additions and 1 deletions

View File

@ -92,6 +92,28 @@ export class ReportsScreenComponent implements OnInit {
}
const dossierTemplateId = this._dossierTemplatesService.activeDossierTemplateId;
if (this.availableTemplates.some(template => template.fileName === file.name)) {
const data = new ConfirmationDialogInput({
title: _('confirmation-dialog.report-template-same-name.title'),
question: _('confirmation-dialog.report-template-same-name.question'),
confirmationText: _('confirmation-dialog.report-template-same-name.confirmation-text'),
denyText: _('confirmation-dialog.report-template-same-name.deny-text'),
});
this._dialogService.openDialog('confirm', null, data, null, async result => {
if (result) {
await this._openConfirmationDialog(file, dossierTemplateId);
}
});
} else {
await this._openConfirmationDialog(file, dossierTemplateId);
}
this._fileInput.nativeElement.value = null;
}
private async _openConfirmationDialog(file: File, dossierTemplateId: string) {
if (this._isExcelFile(file)) {
const data = new ConfirmationDialogInput({
title: _('confirmation-dialog.upload-report-template.title'),
@ -113,7 +135,6 @@ export class ReportsScreenComponent implements OnInit {
await this._reportTemplateService.uploadTemplateForm(dossierTemplateId, false, file).toPromise();
await this._loadReportTemplates();
}
this._fileInput.nativeElement.value = null;
}
private async _deleteTemplate(template: IReportTemplate) {

View File

@ -449,6 +449,12 @@
"deny-text": "Uploads abbrechen",
"question": "Wählen Sie bitte aus, ob <b>{fileName}</b> eine Berichtsvorlage für eine oder für mehrere Dateien ist",
"title": "Upload der Berichtsvorlage"
},
"report-template-same-name": {
"confirmation-text": "",
"deny-text": "",
"question": "<b>{fileName}</b>",
"title": ""
}
},
"content": "Begründung",

View File

@ -454,6 +454,12 @@
"deny-text": "Cancel Upload",
"question": "Please choose if <b>{fileName}</b> is a single or multi-file report template",
"title": "Report Template Upload"
},
"report-template-same-name": {
"confirmation-text": "Yes. Continue upload",
"deny-text": "No. Cancel Upload",
"question": "There is already a Report Template with the name: <b>{fileName}</b>. Do you wish to continue?",
"title": "Report Template Upload"
}
},
"content": "Reason",