diff --git a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html index 5a7884bcd..6656327bf 100644 --- a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html +++ b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html @@ -26,31 +26,77 @@ [small]="true" > -
{{ appStateService.activeFile.status.toLowerCase().replace('_', '-') | translate }}
- -
+
+ {{ appStateService.activeFile.status.toLowerCase().replace('_', '-') | translate }} + {{ 'by' | translate }}: +
+ + + +
+
+ + +
+
+ + + + + + + + +
+
+
+ + + + + + ; public fullScreen = false; + public editingReviewer = false; + public reviewerForm: FormGroup; @ViewChild(PdfViewerComponent) private _viewerComponent: PdfViewerComponent; @ViewChild('annotationsElement') private _annotationsElement: ElementRef; @@ -61,6 +66,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy { public readonly appStateService: AppStateService, public readonly permissionsService: PermissionsService, public readonly userPreferenceService: UserPreferenceService, + public readonly userService: UserService, private readonly _changeDetectorRef: ChangeDetectorRef, private readonly _activatedRoute: ActivatedRoute, private readonly _dialogService: DialogService, @@ -72,12 +78,18 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy { private readonly _fileActionService: FileActionService, private readonly _manualAnnotationService: ManualAnnotationService, private readonly _fileDownloadService: FileDownloadService, + private readonly _formBuilder: FormBuilder, + private readonly _statusControllerService: StatusControllerService, private ngZone: NgZone ) { this._activatedRoute.params.subscribe((params) => { this.projectId = params.projectId; this.fileId = params.fileId; this.appStateService.activateFile(this.projectId, this.fileId); + + this.reviewerForm = this._formBuilder.group({ + reviewer: [this.appStateService.activeFile.currentReviewer] + }); }); } @@ -499,16 +511,31 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy { return this.fileData ? (this.redactedView ? this.fileData.redactedFileData : this.fileData.annotatedFileData) : null; } - public assignReviewer() { - this._fileActionService.assignProjectReviewer(this.fileData.fileStatus, async () => { + public async assignToMe() { + await this._fileActionService.assignToMe(this.fileData.fileStatus, async () => { + await this.appStateService.reloadActiveFile(); + this.resetReviewerForm(); this._updateCanPerformActions(); }); } - public async assignToMe() { - await this._fileActionService.assignToMe(this.fileData.fileStatus, async () => { - this._updateCanPerformActions(); - }); + public assignReviewer() { + const reviewerId = this.reviewerForm.get('reviewer').value; + + this._statusControllerService + .assignProjectOwner(this.fileData.fileStatus.projectId, this.fileData.fileStatus.fileId, reviewerId) + .subscribe(async () => { + this._notificationService.showToastNotification( + 'Successfully assigned ' + this.userService.getNameForId(reviewerId) + ' to file: ' + this.fileData.fileStatus.filename + ); + await this.appStateService.reloadActiveFile(); + this._updateCanPerformActions(); + this.editingReviewer = false; + }); + } + + public resetReviewerForm() { + this.reviewerForm.setValue({ reviewer: this.appStateService.activeFile.currentReviewer }); } pageSelectedByClick($event: number) { diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index e34ab389a..14a8a516b 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -274,6 +274,8 @@ "reviewer": "Assigned to", "unassigned": "Unassigned", "assign-reviewer": "Assign Reviewer", + "cancel-assign-reviewer": "Cancel", + "save-assign-reviewer": "Save", "assign-me": "Assign to me", "last-reviewer": "Last Reviewed by:", "fullscreen": "Full Screen (F)", @@ -402,6 +404,7 @@ "unassigned": "Unassigned", "under-review": "Under Review", "under-approval": "Under Approval", + "by": "by", "efsa": "EFSA Approval", "finished": "Finished", "approved": "Approved",