fix rebase
This commit is contained in:
parent
10798dd934
commit
e09358a4c0
@ -97,7 +97,7 @@
|
||||
<iqser-circle-button
|
||||
(action)="setFileApproved($event)"
|
||||
*ngIf="showApprove"
|
||||
[disabled]="!fileStatus.canBeApproved"
|
||||
[disabled]="!file.canBeApproved"
|
||||
[tooltipPosition]="tooltipPosition"
|
||||
[tooltip]="file.canBeApproved ? ('dossier-overview.approve' | translate) : ('dossier-overview.approve-disabled' | translate)"
|
||||
[type]="buttonType"
|
||||
|
||||
@ -88,8 +88,8 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnInit, OnD
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
if (!this.fileStatus) {
|
||||
this.fileStatus = this.appStateService.activeFile;
|
||||
if (!this.file) {
|
||||
this.file = this.appStateService.activeFile;
|
||||
}
|
||||
this._setup();
|
||||
this.addSubscription = this.appStateService.fileChanged$.pipe(filter(file => file.fileId === this.file?.fileId)).subscribe(file => {
|
||||
@ -240,30 +240,28 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnInit, OnD
|
||||
}
|
||||
|
||||
private _setup() {
|
||||
this.statusBarConfig = [{ color: this.fileStatus.status, length: 1 }];
|
||||
this.statusBarConfig = [{ color: this.file.status, length: 1 }];
|
||||
this.tooltipPosition = this.isFilePreview ? 'below' : 'above';
|
||||
this.assignTooltip = this.fileStatus.isUnderApproval
|
||||
? _('dossier-overview.assign-approver')
|
||||
: _('dossier-overview.assign-reviewer');
|
||||
this.assignTooltip = this.file.isUnderApproval ? _('dossier-overview.assign-approver') : _('dossier-overview.assign-reviewer');
|
||||
this.buttonType = this.isFilePreview ? CircleButtonTypes.default : CircleButtonTypes.dark;
|
||||
this.toggleTooltip = this._toggleTooltip;
|
||||
|
||||
this.showUndoApproval = this.permissionsService.canUndoApproval(this.fileStatus) && !this.isDossierOverviewWorkflow;
|
||||
this.showUnderReview = this.permissionsService.canSetUnderReview(this.fileStatus) && !this.isDossierOverviewWorkflow;
|
||||
this.showUnderApproval = this.permissionsService.canSetUnderApproval(this.fileStatus) && !this.isDossierOverviewWorkflow;
|
||||
this.showApprove = this.permissionsService.isReadyForApproval(this.fileStatus) && !this.isDossierOverviewWorkflow;
|
||||
this.showUndoApproval = this.permissionsService.canUndoApproval(this.file) && !this.isDossierOverviewWorkflow;
|
||||
this.showUnderReview = this.permissionsService.canSetUnderReview(this.file) && !this.isDossierOverviewWorkflow;
|
||||
this.showUnderApproval = this.permissionsService.canSetUnderApproval(this.file) && !this.isDossierOverviewWorkflow;
|
||||
this.showApprove = this.permissionsService.isReadyForApproval(this.file) && !this.isDossierOverviewWorkflow;
|
||||
|
||||
this.canToggleAnalysis = this.permissionsService.canToggleAnalysis(this.fileStatus);
|
||||
this.showDelete = this.permissionsService.canDeleteFile(this.fileStatus);
|
||||
this.showOCR = this.fileStatus.canBeOCRed;
|
||||
this.canReanalyse = this.permissionsService.canReanalyseFile(this.fileStatus);
|
||||
this.canToggleAnalysis = this.permissionsService.canToggleAnalysis(this.file);
|
||||
this.showDelete = this.permissionsService.canDeleteFile(this.file);
|
||||
this.showOCR = this.file.canBeOCRed;
|
||||
this.canReanalyse = this.permissionsService.canReanalyseFile(this.file);
|
||||
|
||||
this.showStatusBar = this.fileStatus.isWorkable && this.isDossierOverviewList;
|
||||
this.showStatusBar = this.file.isWorkable && this.isDossierOverviewList;
|
||||
|
||||
this.showAssignToSelf = this.permissionsService.canAssignToSelf(this.fileStatus) && this.isDossierOverview;
|
||||
this.showAssign = this.permissionsService.canAssignUser(this.fileStatus) && this.isDossierOverview;
|
||||
this.showAssignToSelf = this.permissionsService.canAssignToSelf(this.file) && this.isDossierOverview;
|
||||
this.showAssign = this.permissionsService.canAssignUser(this.file) && this.isDossierOverview;
|
||||
|
||||
this.showOpenDocument = this.fileStatus.canBeOpened && this.isDossierOverviewWorkflow;
|
||||
this.showOpenDocument = this.file.canBeOpened && this.isDossierOverviewWorkflow;
|
||||
|
||||
this.showExcludePages = this.isFilePreview;
|
||||
this.showDocumentInfo = this.isFilePreview;
|
||||
|
||||
@ -94,18 +94,18 @@
|
||||
<ng-template #filenameTemplate let-file="entity">
|
||||
<div class="cell">
|
||||
<div>
|
||||
<div [class.error]="fileStatus.isError" [matTooltip]="fileStatus.filename" class="table-item-title" matTooltipPosition="above">
|
||||
{{ fileStatus.filename }}
|
||||
<div [class.error]="file.isError" [matTooltip]="file.filename" class="table-item-title" matTooltipPosition="above">
|
||||
{{ file.filename }}
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="fileStatus.primaryAttribute" class="small-label">
|
||||
<div *ngIf="file.primaryAttribute" class="small-label">
|
||||
<div class="primary-attribute">
|
||||
<span [matTooltip]="fileStatus.primaryAttribute" matTooltipPosition="above">
|
||||
{{ fileStatus.primaryAttribute }}
|
||||
<span [matTooltip]="file.primaryAttribute" matTooltipPosition="above">
|
||||
{{ file.primaryAttribute }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<ng-container *ngTemplateOutlet="statsTemplate; context: { entity: fileStatus }"></ng-container>
|
||||
<ng-container *ngTemplateOutlet="statsTemplate; context: { entity: file }"></ng-container>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
@ -199,41 +199,41 @@
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #workflowItemTemplate let-fileStatus="entity">
|
||||
<ng-template #workflowItemTemplate let-file="entity">
|
||||
<div class="workflow-item">
|
||||
<div>
|
||||
<div class="details">
|
||||
<div [matTooltip]="fileStatus.filename" class="filename" matTooltipPosition="above">
|
||||
{{ fileStatus.filename }}
|
||||
<div [matTooltip]="file.filename" class="filename" matTooltipPosition="above">
|
||||
{{ file.filename }}
|
||||
</div>
|
||||
<ng-container *ngTemplateOutlet="statsTemplate; context: { entity: fileStatus }"></ng-container>
|
||||
<ng-container *ngTemplateOutlet="statsTemplate; context: { entity: file }"></ng-container>
|
||||
</div>
|
||||
<div class="user">
|
||||
<redaction-initials-avatar [userId]="fileStatus.currentReviewer"></redaction-initials-avatar>
|
||||
<redaction-initials-avatar [userId]="file.currentReviewer"></redaction-initials-avatar>
|
||||
</div>
|
||||
</div>
|
||||
<redaction-file-actions
|
||||
(actionPerformed)="actionPerformed($event, fileStatus)"
|
||||
*ngIf="!fileStatus.isProcessing"
|
||||
[fileStatus]="fileStatus"
|
||||
(actionPerformed)="actionPerformed($event, file)"
|
||||
*ngIf="!file.isProcessing"
|
||||
[file]="file"
|
||||
type="dossier-overview-workflow"
|
||||
></redaction-file-actions>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #statsTemplate let-fileStatus="entity">
|
||||
<ng-template #statsTemplate let-file="entity">
|
||||
<div class="small-label stats-subtitle">
|
||||
<div>
|
||||
<mat-icon svgIcon="red:pages"></mat-icon>
|
||||
{{ fileStatus.numberOfPages }}
|
||||
{{ file.numberOfPages }}
|
||||
</div>
|
||||
<div>
|
||||
<mat-icon svgIcon="red:exclude-pages"></mat-icon>
|
||||
{{ fileStatus.excludedPagesCount }}
|
||||
{{ file.excludedPagesCount }}
|
||||
</div>
|
||||
<div *ngIf="fileStatus.lastOCRTime" [matTooltipPosition]="'above'" [matTooltip]="'dossier-overview.ocr-performed' | translate">
|
||||
<div *ngIf="file.lastOCRTime" [matTooltipPosition]="'above'" [matTooltip]="'dossier-overview.ocr-performed' | translate">
|
||||
<mat-icon svgIcon="red:ocr"></mat-icon>
|
||||
{{ fileStatus.lastOCRTime | date: 'mediumDate' }}
|
||||
{{ file.lastOCRTime | date: 'mediumDate' }}
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
@ -10,7 +10,7 @@ import {
|
||||
TemplateRef,
|
||||
ViewChild
|
||||
} from '@angular/core';
|
||||
import { FileAttributeConfig, FileStatus } from '@redaction/red-ui-http';
|
||||
import { FileStatus, FileStatuses, IFileAttributeConfig } from '@redaction/red-ui-http';
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
import { FileDropOverlayService } from '@upload-download/services/file-drop-overlay.service';
|
||||
import { FileUploadModel } from '@upload-download/model/file-upload.model';
|
||||
@ -52,11 +52,9 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { annotationFilterChecker } from '@utils/filter-utils';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { RouterHistoryService } from '@services/router-history.service';
|
||||
import { IFileAttributeConfig } from '@redaction/red-ui-http';
|
||||
import { Dossier } from '@state/model/dossier';
|
||||
import { Router } from '@angular/router';
|
||||
import { FileActionService } from '../../services/file-action.service';
|
||||
import StatusEnum = FileStatus.StatusEnum;
|
||||
|
||||
@Component({
|
||||
templateUrl: './dossier-overview-screen.component.html',
|
||||
@ -88,7 +86,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
|
||||
@ViewChild('reviewerTemplate', { static: true }) reviewerTemplate: TemplateRef<unknown>;
|
||||
@ViewChild('pagesTemplate', { static: true }) pagesTemplate: TemplateRef<unknown>;
|
||||
@ViewChild('statusTemplate', { static: true }) statusTemplate: TemplateRef<unknown>;
|
||||
readonly workflowConfig: WorkflowConfig<FileStatusWrapper, StatusEnum>;
|
||||
readonly workflowConfig: WorkflowConfig<File, FileStatus>;
|
||||
@ViewChild(DossierDetailsComponent, { static: false })
|
||||
private readonly _dossierDetailsComponent: DossierDetailsComponent;
|
||||
private _lastScrolledIndex: number;
|
||||
@ -123,38 +121,38 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
|
||||
).fileAttributeConfigs;
|
||||
this.workflowConfig = {
|
||||
columnIdentifierFn: entity => entity.status,
|
||||
itemVersionFn: (entity: FileStatusWrapper) => `${entity.lastUpdated}-${entity.numberOfAnalyses}`,
|
||||
itemVersionFn: (entity: File) => `${entity.lastUpdated}-${entity.numberOfAnalyses}`,
|
||||
columns: [
|
||||
{
|
||||
label: fileStatusTranslations[StatusEnum.UNASSIGNED],
|
||||
key: StatusEnum.UNASSIGNED,
|
||||
label: fileStatusTranslations[FileStatuses.UNASSIGNED],
|
||||
key: FileStatuses.UNASSIGNED,
|
||||
enterFn: this.unassignFn,
|
||||
enterPredicate: (entity: FileStatusWrapper) => false,
|
||||
enterPredicate: (entity: File) => false,
|
||||
color: '#D3D5DA'
|
||||
},
|
||||
{
|
||||
label: fileStatusTranslations[StatusEnum.UNDERREVIEW],
|
||||
label: fileStatusTranslations[FileStatuses.UNDER_REVIEW],
|
||||
enterFn: this.underReviewFn,
|
||||
enterPredicate: (file: FileStatusWrapper) =>
|
||||
enterPredicate: (file: File) =>
|
||||
this.permissionsService.canSetUnderReview(file) ||
|
||||
this.permissionsService.canAssignToSelf(file) ||
|
||||
this.permissionsService.canAssignUser(file),
|
||||
key: StatusEnum.UNDERREVIEW,
|
||||
key: FileStatuses.UNDER_REVIEW,
|
||||
color: '#FDBD00'
|
||||
},
|
||||
{
|
||||
label: fileStatusTranslations[StatusEnum.UNDERAPPROVAL],
|
||||
label: fileStatusTranslations[FileStatuses.UNDER_APPROVAL],
|
||||
enterFn: this.underApprovalFn,
|
||||
enterPredicate: (file: FileStatusWrapper) =>
|
||||
enterPredicate: (file: File) =>
|
||||
this.permissionsService.canSetUnderApproval(file) || this.permissionsService.canUndoApproval(file),
|
||||
key: StatusEnum.UNDERAPPROVAL,
|
||||
key: FileStatuses.UNDER_APPROVAL,
|
||||
color: '#374C81'
|
||||
},
|
||||
{
|
||||
label: fileStatusTranslations[StatusEnum.APPROVED],
|
||||
label: fileStatusTranslations[FileStatuses.APPROVED],
|
||||
enterFn: this.approveFn,
|
||||
enterPredicate: (file: FileStatusWrapper) => this.permissionsService.isReadyForApproval(file),
|
||||
key: StatusEnum.APPROVED,
|
||||
enterPredicate: (file: File) => this.permissionsService.isReadyForApproval(file),
|
||||
key: FileStatuses.APPROVED,
|
||||
color: '#48C9F7'
|
||||
}
|
||||
]
|
||||
@ -173,47 +171,47 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
|
||||
return this.fileAttributeConfigs.filter(config => config.displayedInFileList);
|
||||
}
|
||||
|
||||
unassignFn = async (file: FileStatusWrapper) => {
|
||||
unassignFn = async (file: File) => {
|
||||
// TODO
|
||||
console.log('unassign', file);
|
||||
};
|
||||
|
||||
underReviewFn = (file: FileStatusWrapper) => {
|
||||
underReviewFn = (file: File) => {
|
||||
this._fileActionService.assignFile('reviewer', null, file, () => this._loadingService.loadWhile(this.reloadDossiers()), true);
|
||||
};
|
||||
|
||||
underApprovalFn = async (file: FileStatusWrapper) => {
|
||||
underApprovalFn = async (file: File) => {
|
||||
if (this._appStateService.activeDossier.approverIds.length > 1) {
|
||||
this._fileActionService.assignFile('approver', null, file, () => this._loadingService.loadWhile(this.reloadDossiers()), true);
|
||||
} else {
|
||||
this._loadingService.start();
|
||||
await this._fileActionService.setFileUnderApproval(file).toPromise();
|
||||
await this._fileActionService.setFilesUnderApproval([file]).toPromise();
|
||||
await this.reloadDossiers();
|
||||
this._loadingService.stop();
|
||||
}
|
||||
};
|
||||
|
||||
approveFn = async (file: FileStatusWrapper) => {
|
||||
approveFn = async (file: File) => {
|
||||
this._loadingService.start();
|
||||
await this._fileActionService.setFileApproved(file).toPromise();
|
||||
await this._fileActionService.setFilesApproved([file]).toPromise();
|
||||
await this.reloadDossiers();
|
||||
this._loadingService.stop();
|
||||
};
|
||||
|
||||
actionPerformed(action?: string, fileStatus?: FileStatusWrapper) {
|
||||
this._calculateData();
|
||||
actionPerformed(action?: string, fileStatus?: File) {
|
||||
this.calculateData();
|
||||
|
||||
if (action === 'navigate') {
|
||||
this._router.navigate(this.routerLinkFn(fileStatus));
|
||||
}
|
||||
}
|
||||
|
||||
routerLinkFn = (fileStatus: FileStatusWrapper) =>
|
||||
routerLinkFn = (fileStatus: File) =>
|
||||
fileStatus.canBeOpened ? [`/main/dossiers/${this.currentDossier.id}/file/${fileStatus.fileId}`] : [];
|
||||
|
||||
disabledFn = (fileStatus: FileStatusWrapper) => fileStatus.excluded;
|
||||
disabledFn = (fileStatus: File) => fileStatus.excluded;
|
||||
|
||||
lastOpenedFn = (fileStatus: FileStatusWrapper) => fileStatus.lastOpened;
|
||||
lastOpenedFn = (fileStatus: File) => fileStatus.lastOpened;
|
||||
|
||||
async ngOnInit(): Promise<void> {
|
||||
this._configureTableColumns();
|
||||
@ -221,7 +219,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
|
||||
try {
|
||||
this._fileDropOverlayService.initFileDropHandling();
|
||||
|
||||
this._calculateData();
|
||||
this.calculateData();
|
||||
|
||||
this.addSubscription = timer(0, 7500).subscribe(async () => {
|
||||
await this._appStateService.reloadActiveDossierFilesIfNecessary();
|
||||
@ -229,7 +227,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
|
||||
});
|
||||
|
||||
this.addSubscription = this._appStateService.fileChanged$.subscribe(() => {
|
||||
this._calculateData();
|
||||
this.calculateData();
|
||||
});
|
||||
|
||||
this.addSubscription = this._appStateService.dossierTemplateChanged$.subscribe(() => {
|
||||
@ -277,10 +275,10 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
|
||||
|
||||
async reloadDossiers() {
|
||||
await this._appStateService.getFiles(this.currentDossier, false);
|
||||
this._calculateData();
|
||||
this.calculateData();
|
||||
}
|
||||
|
||||
_calculateData(): void {
|
||||
calculateData(): void {
|
||||
if (!this._appStateService.activeDossierId) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -8,7 +8,6 @@ import { DossiersDialogService } from './dossiers-dialog.service';
|
||||
import { ConfirmationDialogInput } from '@shared/dialogs/confirmation-dialog/confirmation-dialog.component';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { FilesService } from './files.service';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@Injectable()
|
||||
export class FileActionService {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Component, EventEmitter, Input, Optional, Output, TemplateRef } from '@angular/core';
|
||||
import { ActionConfig } from '@shared/components/page-header/models/action-config.model';
|
||||
import { ButtonConfig } from '@shared/components/page-header/models/button-config.model';
|
||||
import { FilterService, IListable, SearchService } from '@iqser/common-ui';
|
||||
import { FilterService, IconButtonTypes, IListable, SearchService } from '@iqser/common-ui';
|
||||
import { distinctUntilChanged, map } from 'rxjs/operators';
|
||||
import { combineLatest, Observable, of } from 'rxjs';
|
||||
import { SearchPosition, SearchPositions } from '@shared/components/page-header/models/search-positions.type';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user