diff --git a/smp-angular/src/app/common/panels/document-edit-panel/document-edit-panel.component.ts b/smp-angular/src/app/common/panels/document-edit-panel/document-edit-panel.component.ts index 8da41fff058061022d6cc6a4a3be9f2315da13fd..121058383b02a6aef1c8e2897d8937aa9253fd02 100644 --- a/smp-angular/src/app/common/panels/document-edit-panel/document-edit-panel.component.ts +++ b/smp-angular/src/app/common/panels/document-edit-panel/document-edit-panel.component.ts @@ -323,7 +323,7 @@ export class DocumentEditPanelComponent implements BeforeLeaveGuard, OnInit { if (this.documentVersionsExists && this.isNotReviewMode && !this.isNewDocumentVersion) { this.documentForm.controls['payloadVersion'].enable(); } - if (!this.documentEditable && !this.isNewDocumentVersion ) { + if (!this.documentEditable && !this.isNewDocumentVersion) { this.documentForm.controls['selectDocumentSource'].enable(); } this.updateTextToEditor() @@ -471,6 +471,7 @@ export class DocumentEditPanelComponent implements BeforeLeaveGuard, OnInit { } onReviewRequestButtonClicked(): void { + // create lightweight document object let docRequest: DocumentRo = { documentId: this._document.documentId, @@ -484,7 +485,21 @@ export class DocumentEditPanelComponent implements BeforeLeaveGuard, OnInit { onReviewRequestObservable.subscribe(this.loadDocumentObserver); } - onApproveButtonClicked(): void { + + async onApproveButtonClicked() { + this.dialog.open(ConfirmationDialogComponent, { + data: { + title: await lastValueFrom(this.translateService.get("document.edit.panel.review.dialog.confirmation.title")), + description: await lastValueFrom(this.translateService.get("document.edit.panel.review.dialog.confirmation.approve.description")) + } + }).afterClosed().subscribe(result => { + if (result) { + this.submitReviewApproveAction() + } + }); + } + + private submitReviewApproveAction() { // create lightweight document object let docRequest: DocumentRo = { documentId: this._document.documentId, @@ -497,12 +512,26 @@ export class DocumentEditPanelComponent implements BeforeLeaveGuard, OnInit { // request review onReviewRequestObservable.subscribe(this.reviewActionDocumentObserver); - if (!this.isNotReviewMode){ + if (!this.isNotReviewMode) { this.onBackButtonClicked(); } } - onRejectButtonClicked(): void { + + async onRejectButtonClicked() { + this.dialog.open(ConfirmationDialogComponent, { + data: { + title: await lastValueFrom(this.translateService.get("document.edit.panel.review.dialog.confirmation.title")), + description: await lastValueFrom(this.translateService.get("document.edit.panel.review.dialog.confirmation.reject.description")) + } + }).afterClosed().subscribe(result => { + if (result) { + this.submitReviewRejectAction() + } + }); + } + + private submitReviewRejectAction() { // create lightweight document object let docRequest: DocumentRo = { documentId: this._document.documentId, @@ -514,7 +543,7 @@ export class DocumentEditPanelComponent implements BeforeLeaveGuard, OnInit { this.editResourceService.reviewRejectSubresourceDocumentObservable(this.subresource, this.resource, docRequest); // request review onReviewRequestObservable.subscribe(this.reviewActionDocumentObserver); - if (!this.isNotReviewMode){ + if (!this.isNotReviewMode) { this.onBackButtonClicked(); } } @@ -523,7 +552,21 @@ export class DocumentEditPanelComponent implements BeforeLeaveGuard, OnInit { * Publish the current document version * */ - onPublishButtonClicked(): void { + + async onPublishButtonClicked() { + this.dialog.open(ConfirmationDialogComponent, { + data: { + title: await lastValueFrom(this.translateService.get("document.edit.panel.dialog.confirmation.publish.title")), + description: await lastValueFrom(this.translateService.get("document.edit.panel.dialog.confirmation.publish.description")) + } + }).afterClosed().subscribe(result => { + if (result) { + this.submitPublishAction() + } + }); + } + + private submitPublishAction() { // create lightweight document object let docRequest: DocumentRo = { documentId: this._document.documentId, diff --git a/smp-angular/src/assets/i18n/en.json b/smp-angular/src/assets/i18n/en.json index cf3fc495fde3ef289162c6cb85c9a0bd03d5c199..b938a8a7ff714151d9eceac7aa6b39ef8b2912b2 100644 --- a/smp-angular/src/assets/i18n/en.json +++ b/smp-angular/src/assets/i18n/en.json @@ -355,6 +355,7 @@ "resource.details.panel.button.save": "Save", "resource.details.panel.review.disabled.confirmation.dialog.title": "Review disabled?", "resource.details.panel.review.disabled.confirmation.dialog.description": "All document versions with review statuses (UNDER_REVIEW, APPROVED, REJECTED) will be set to DRAFT\nDo you want to continue?", + "document.edit.panel.button.back": "Back", "document.edit.panel.button.cancel": "Cancel", "document.edit.panel.button.document.wizard": "Document wizard", @@ -380,7 +381,6 @@ "document.edit.panel.select.item.reference": "Reference document", "document.edit.panel.select.item.current": "Current document", "document.edit.panel.label.show.document.type": "View document", - "document.edit.panel.error.document.null": "Can not show document because it is not selected.", "document.edit.panel.title": "Resources", "document.edit.panel.tooltip.document.wizard": "Show document wizard dialog", @@ -391,9 +391,15 @@ "document.edit.panel.tooltip.version.new": "Create new document version for the resource", "document.edit.panel.tooltip.version.publish": "Publish selected document version", "document.edit.panel.tooltip.version.request.review": "Submit selected document version for the review", - "document.edit.panel.tooltip.version.review.approve": "Approve document version", - "document.edit.panel.tooltip.version.review.reject": "Reject document version", + "document.edit.panel.tooltip.version.review.approve.description": "Approve document version", + "document.edit.panel.tooltip.version.review.reject.description": "Reject document version", "document.edit.panel.note.editable": "Note: Only document payloads in following status can be edited: [{{editableDocStatusList}}]", + "document.edit.panel.dialog.confirmation.publish.title": "Document publish action confirmation", + "document.edit.panel.dialog.confirmation.publish.description": "Do you want to publish the document version?", + + "document.edit.panel.review.dialog.confirmation.title": "Review action confirmation", + "document.edit.panel.review.dialog.confirmation.approve.description": "Do you want to <b>approve</b> the document version?", + "document.edit.panel.review.dialog.confirmation.reject.description": "Do you want to <b>reject</b> the document version?", "document.configuration.panel.tab.title": "Document configuration", "document.configuration.panel.tab.button.metadata": "Metadata",