confirmation dialog for template upload with the same name
This commit is contained in:
parent
77d93e1874
commit
ee6e3c6b2a
@ -92,6 +92,28 @@ export class ReportsScreenComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const dossierTemplateId = this._dossierTemplatesService.activeDossierTemplateId;
|
const dossierTemplateId = this._dossierTemplatesService.activeDossierTemplateId;
|
||||||
|
|
||||||
|
if (!!this.availableTemplates.find(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)) {
|
if (this._isExcelFile(file)) {
|
||||||
const data = new ConfirmationDialogInput({
|
const data = new ConfirmationDialogInput({
|
||||||
title: _('confirmation-dialog.upload-report-template.title'),
|
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._reportTemplateService.uploadTemplateForm(dossierTemplateId, false, file).toPromise();
|
||||||
await this._loadReportTemplates();
|
await this._loadReportTemplates();
|
||||||
}
|
}
|
||||||
this._fileInput.nativeElement.value = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _deleteTemplate(template: IReportTemplate) {
|
private async _deleteTemplate(template: IReportTemplate) {
|
||||||
|
|||||||
@ -454,6 +454,12 @@
|
|||||||
"deny-text": "Cancel Upload",
|
"deny-text": "Cancel Upload",
|
||||||
"question": "Please choose if <b>{fileName}</b> is a single or multi-file report template",
|
"question": "Please choose if <b>{fileName}</b> is a single or multi-file report template",
|
||||||
"title": "Report Template Upload"
|
"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",
|
"content": "Reason",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user