fix disable redaction for approved files

This commit is contained in:
Dan Percic 2021-06-09 19:56:12 +03:00
parent d045d81608
commit 821cfe4871
2 changed files with 29 additions and 55 deletions

View File

@ -2,12 +2,7 @@
<ng-container *ngTemplateOutlet="actions"></ng-container>
<redaction-status-bar
*ngIf="fileStatus.isWorkable"
[config]="[
{
color: fileStatus.status,
length: 1
}
]"
[config]="statusBarConfig"
></redaction-status-bar>
</div>
@ -25,8 +20,7 @@
[type]="buttonType"
icon="red:trash"
tooltip="dossier-overview.delete.action"
>
</redaction-circle-button>
></redaction-circle-button>
<redaction-circle-button
(action)="assign($event)"
@ -44,8 +38,7 @@
[type]="buttonType"
icon="red:assign-me"
tooltip="dossier-overview.assign-me"
>
</redaction-circle-button>
></redaction-circle-button>
<!-- download redacted file-->
<redaction-file-download-btn
@ -54,8 +47,7 @@
[tooltipClass]="'small'"
[tooltipPosition]="tooltipPosition"
[type]="buttonType"
>
</redaction-file-download-btn>
></redaction-file-download-btn>
<redaction-circle-button
(action)="toggleViewDocumentInfo()"
@ -74,8 +66,7 @@
[type]="buttonType"
icon="red:ready-for-approval"
tooltip="dossier-overview.under-approval"
>
</redaction-circle-button>
></redaction-circle-button>
<!-- Back to review -->
<redaction-circle-button
@ -85,8 +76,7 @@
[type]="buttonType"
icon="red:undo"
tooltip="dossier-overview.under-review"
>
</redaction-circle-button>
></redaction-circle-button>
<!-- Approved-->
<redaction-circle-button
@ -101,8 +91,7 @@
"
[type]="buttonType"
icon="red:approved"
>
</redaction-circle-button>
></redaction-circle-button>
<!-- Back to approval -->
<redaction-circle-button
@ -112,8 +101,7 @@
[type]="buttonType"
icon="red:undo"
tooltip="dossier-overview.under-approval"
>
</redaction-circle-button>
></redaction-circle-button>
<redaction-circle-button
(action)="ocrFile($event)"
@ -122,8 +110,7 @@
[type]="buttonType"
icon="red:ocr"
tooltip="dossier-overview.ocr-file"
>
</redaction-circle-button>
></redaction-circle-button>
<!-- reanalyse file preview -->
<redaction-circle-button
@ -134,8 +121,7 @@
tooltipClass="warn small"
tooltipPosition="below"
type="warn"
>
</redaction-circle-button>
></redaction-circle-button>
<!-- reanalyse file listing -->
<redaction-circle-button
@ -145,21 +131,19 @@
icon="red:refresh"
tooltip="dossier-overview.reanalyse.action"
type="dark-bg"
>
</redaction-circle-button>
></redaction-circle-button>
<!-- exclude from redaction -->
<div class="red-input-group">
<mat-slide-toggle
(click)="toggleAnalysis($event)"
(change)="toggleAnalysis()"
[checked]="!fileStatus?.isExcluded"
[class.mr-24]="screen === 'dossier-overview'"
[disabled]="!permissionsService.canToggleAnalysis(fileStatus)"
[matTooltipPosition]="tooltipPosition"
[matTooltip]="toggleTooltip | translate"
color="primary"
>
</mat-slide-toggle>
></mat-slide-toggle>
</div>
</div>
</ng-template>

View File

@ -25,6 +25,10 @@ export class FileActionsComponent implements OnInit {
private readonly _fileActionService: FileActionService
) {}
get statusBarConfig() {
return [{ color: this.fileStatus.status, length: 1 }];
}
get tooltipPosition() {
return this.screen === 'file-preview' ? 'below' : 'above';
}
@ -63,26 +67,14 @@ export class FileActionsComponent implements OnInit {
return this.permissionsService.canOcrFile(this.fileStatus);
}
// Under review
get canSetToUnderReview() {
return this.permissionsService.canSetUnderReview(this.fileStatus);
}
// Under approval
get canSetToUnderApproval() {
return this.permissionsService.canSetUnderApproval(this.fileStatus);
}
// Approve
get isReadyForApproval() {
return this.permissionsService.isReadyForApproval(this.fileStatus);
}
get canApprove() {
return this.permissionsService.canApprove(this.fileStatus);
}
// Undo approval
get canUndoApproval() {
return this.permissionsService.canUndoApproval(this.fileStatus);
}
@ -94,17 +86,18 @@ export class FileActionsComponent implements OnInit {
}
ngOnInit(): void {
if (!this.fileStatus) {
this.fileStatus = this.appStateService.activeFile;
this.screen = 'file-preview';
this.appStateService.fileChanged.subscribe((fileStatus: FileStatusWrapper) => {
if (fileStatus.fileId === this.fileStatus?.fileId) {
this.fileStatus = this.appStateService.activeFile;
}
});
} else {
if (this.fileStatus) {
this.screen = 'dossier-overview';
return;
}
this.fileStatus = this.appStateService.activeFile;
this.screen = 'file-preview';
this.appStateService.fileChanged.subscribe(fileStatus => {
if (fileStatus.fileId === this.fileStatus?.fileId) {
this.fileStatus = this.appStateService.activeFile;
}
});
}
toggleViewDocumentInfo() {
@ -116,9 +109,7 @@ export class FileActionsComponent implements OnInit {
$event,
this.fileStatus.dossierId,
[this.fileStatus.fileId],
() => {
this.actionPerformed.emit('delete');
}
() => this.actionPerformed.emit('delete')
);
}
@ -191,8 +182,7 @@ export class FileActionsComponent implements OnInit {
});
}
async toggleAnalysis($event: MouseEvent) {
$event.stopPropagation();
async toggleAnalysis() {
await this._fileActionService.toggleAnalysis(this.fileStatus).toPromise();
await this.appStateService.getFiles();
this.actionPerformed.emit(