Pull request #288: VM/WarningOnApprove

Merge in RED/ui from VM/WarningOnApprove to master

* commit '2d6831365266b9ced5ff24c6867b7086e25de8f9':
  added modal to confirm the approval of the documents if there are unseen changes
This commit is contained in:
Valentin-Gabriel Mihai 2021-09-22 13:30:47 +02:00
commit 3582cc555c
3 changed files with 48 additions and 7 deletions

View File

@ -177,7 +177,22 @@ export class DossierOverviewBulkActionsComponent {
}
approveDocuments() {
this._performBulkAction(this._fileActionService.setFileApproved(this.selectedFiles));
const foundUpdatedFile = this.selectedFiles.find(file => file.hasUpdates);
if (foundUpdatedFile) {
this._dialogService.openDialog(
'confirm',
null,
new ConfirmationDialogInput({
title: _('confirmation-dialog.approve-multiple-files.title'),
question: _('confirmation-dialog.approve-multiple-files.question')
}),
() => {
this._performBulkAction(this._fileActionService.setFileApproved(this.selectedFiles));
}
);
} else {
this._performBulkAction(this._fileActionService.setFileApproved(this.selectedFiles));
}
}
assignToMe() {

View File

@ -154,9 +154,21 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnInit, OnD
setFileApproved($event: MouseEvent) {
$event.stopPropagation();
this.addSubscription = this._fileActionService.setFileApproved(this.fileStatus).subscribe(() => {
this.reloadDossiers('set-approved');
});
if (this.fileStatus.hasUpdates) {
this._dialogService.openDialog(
'confirm',
$event,
new ConfirmationDialogInput({
title: _('confirmation-dialog.approve-file.title'),
question: _('confirmation-dialog.approve-file.question')
}),
() => {
this._setFileApproved();
}
);
} else {
this._setFileApproved();
}
}
ocrFile($event: MouseEvent) {
@ -194,6 +206,12 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnInit, OnD
}
}
private _setFileApproved() {
this.addSubscription = this._fileActionService.setFileApproved(this.fileStatus).subscribe(() => {
this.reloadDossiers('set-approved');
});
}
private _setup() {
this.statusBarConfig = [{ color: this.fileStatus.status, length: 1 }];
this.tooltipPosition = this.screen === 'file-preview' ? 'below' : 'above';

View File

@ -363,6 +363,14 @@
"warning": "Warning: this cannot be undone!"
},
"confirmation-dialog": {
"approve-file": {
"question": "This document has unseen changes, do you wish to approve it anyway?",
"title": "Warning!"
},
"approve-multiple-files": {
"question": "At least one of the files you selected has unseen changes, do you wish to approve them anyway?",
"title": "Warning!"
},
"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"
@ -861,13 +869,13 @@
"unsaved-changes": "You have unsaved changes. Save or revert before changing the tab."
},
"error": {
"close": "Close",
"http": {
"generic": "Action failed with code {status}"
},
"reload": "Reload",
"title": "Oops! Something went wrong...",
"offline": "You're offline",
"close": "Close"
"reload": "Reload",
"title": "Oops! Something went wrong..."
},
"exact-date": "{day} {month} {year} at {hour}:{minute}",
"file": "File",