added conditionals for actions
This commit is contained in:
parent
d88ba3e9e3
commit
2f00e568e4
@ -99,7 +99,7 @@
|
||||
<div class="flex red-content-inner">
|
||||
<div class="left-container">
|
||||
<redaction-pdf-viewer
|
||||
[isReviewer]="appStateService.isActiveFileDocumentReviewer"
|
||||
[canPerformActions]="canPerformAnnotationActions"
|
||||
(annotationSelected)="handleAnnotationSelected($event)"
|
||||
(keyUp)="handleKeyEvent($event)"
|
||||
(manualAnnotationRequested)="openManualRedactionDialog($event)"
|
||||
@ -189,6 +189,7 @@
|
||||
|
||||
<div
|
||||
[class.visible]="isAnnotationMenuOpen(annotation)"
|
||||
*ngIf="canPerformAnnotationActions"
|
||||
class="annotation-actions"
|
||||
>
|
||||
<button
|
||||
@ -243,7 +244,7 @@
|
||||
"
|
||||
mat-icon-button
|
||||
>
|
||||
<mat-icon svgIcon="red:trash"></mat-icon>
|
||||
<mat-icon svgIcon="red:close"></mat-icon>
|
||||
</button>
|
||||
<button
|
||||
(click)="suggestRemoveAnnotation($event, annotation)"
|
||||
|
||||
@ -95,6 +95,10 @@ export class FilePreviewScreenComponent implements OnInit {
|
||||
return this.instance?.docViewer?.getCurrentPage();
|
||||
}
|
||||
|
||||
get canPerformAnnotationActions() {
|
||||
return this.appStateService.canPerformAnnotationActionsOnCurrentFile();
|
||||
}
|
||||
|
||||
private projectId: string;
|
||||
private _activeViewer: 'ANNOTATED' | 'REDACTED' = 'ANNOTATED';
|
||||
private instance: WebViewerInstance;
|
||||
|
||||
@ -42,7 +42,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
|
||||
|
||||
@Input() fileData: Blob;
|
||||
@Input() fileStatus: FileStatusWrapper;
|
||||
@Input() isReviewer = false;
|
||||
@Input() canPerformActions = false;
|
||||
|
||||
@Output() fileReady = new EventEmitter();
|
||||
@Output() annotationSelected = new EventEmitter<string>();
|
||||
@ -72,7 +72,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
|
||||
if (changes.fileData && !changes.fileData.firstChange) {
|
||||
this._changeDocument();
|
||||
}
|
||||
if (changes.isReviewer) {
|
||||
if (changes.canPerformActions) {
|
||||
this._handleCustomActions();
|
||||
}
|
||||
}
|
||||
@ -208,7 +208,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
|
||||
|
||||
private _handleCustomActions() {
|
||||
if (this.instance) {
|
||||
if (this.isReviewer) {
|
||||
if (this.canPerformActions) {
|
||||
this.instance.enableElements(['add-redaction', 'add-dictionary']);
|
||||
} else {
|
||||
this.instance.disableElements(['add-redaction', 'add-dictionary']);
|
||||
|
||||
@ -507,4 +507,15 @@ export class AppStateService {
|
||||
fileStatus.dictionaryVersion !== this.dictionaryVersion
|
||||
);
|
||||
}
|
||||
|
||||
canPerformAnnotationActionsOnCurrentFile() {
|
||||
const status = this.activeFile.status;
|
||||
if (status === 'UNDER_REVIEW') {
|
||||
return this.isActiveProjectOwnerAndManager || this.isActiveFileDocumentReviewer;
|
||||
}
|
||||
if (status === 'UNDER_APPROVAL') {
|
||||
return this.isActiveProjectOwnerAndManager;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user