Pull request #263: RED-1894
Merge in RED/ui from RED-1894 to master * commit 'cd5a39407b2a99f34a8ac50f74b65ec4ccfdabc0': Styles fix chore(release) Refactor dossiers dialog service: manual annotation Refactor dossiers dialog service: remove annotations, force redaction Refactor dossiers dialog service: dossier dictionary Refactor dossiers dialog service: change legal basis Refactor dossiers dialog service: recategorize image Refactor dossiers dialog service: assign file to user Refactor dossiers dialog service: assign file to me Refactor dossiers dialog service: add dossier
This commit is contained in:
commit
f1ec4956e4
@ -27,11 +27,9 @@ interface DossierListItem extends Dossier {
|
||||
})
|
||||
export class TrashScreenComponent extends BaseListingComponent<DossierListItem> implements OnInit {
|
||||
readonly itemSize = 80;
|
||||
protected readonly _primaryKey = 'dossierName';
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
readonly tableHeaderLabel = 'trash.table-header.title';
|
||||
readonly tableHeaderLabel = _('trash.table-header.title');
|
||||
readonly canRestoreSelected$ = this._canRestoreSelected$;
|
||||
private readonly _deleteRetentionHours = this._appConfigService.getConfig(AppConfigKey.DELETE_RETENTION_HOURS);
|
||||
readonly tableColumnConfigs: TableColumnConfig<DossierListItem>[] = [
|
||||
{
|
||||
label: _('trash.table-col-names.name'),
|
||||
@ -53,6 +51,8 @@ export class TrashScreenComponent extends BaseListingComponent<DossierListItem>
|
||||
column: 'softDeletedTime'
|
||||
}
|
||||
];
|
||||
protected readonly _primaryKey = 'dossierName';
|
||||
private readonly _deleteRetentionHours = this._appConfigService.getConfig(AppConfigKey.DELETE_RETENTION_HOURS);
|
||||
|
||||
constructor(
|
||||
readonly permissionsService: PermissionsService,
|
||||
@ -78,10 +78,6 @@ export class TrashScreenComponent extends BaseListingComponent<DossierListItem>
|
||||
this._loadingService.stop();
|
||||
}
|
||||
|
||||
private _getRestoreDate(softDeletedTime: string): string {
|
||||
return moment(softDeletedTime).add(this._deleteRetentionHours, 'hours').toISOString();
|
||||
}
|
||||
|
||||
hardDelete(dossiers = this.entitiesService.selected) {
|
||||
const data = new ConfirmationDialogInput({
|
||||
title: dossiers.length > 1 ? _('confirmation-dialog.delete-dossier.title-alt') : _('confirmation-dialog.delete-dossier.title'),
|
||||
@ -105,6 +101,10 @@ export class TrashScreenComponent extends BaseListingComponent<DossierListItem>
|
||||
this._loadingService.loadWhile(this._restore(dossiers));
|
||||
}
|
||||
|
||||
private _getRestoreDate(softDeletedTime: string): string {
|
||||
return moment(softDeletedTime).add(this._deleteRetentionHours, 'hours').toISOString();
|
||||
}
|
||||
|
||||
private async _loadDossiersData(): Promise<void> {
|
||||
this.entitiesService.setEntities(this._toListItems(await this._dossiersService.getDeleted()));
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
></iqser-circle-button>
|
||||
|
||||
<iqser-circle-button
|
||||
(action)="annotationActionsService.recategorizeImage($event, annotations, annotationsChanged)"
|
||||
(action)="annotationActionsService.recategorizeImages($event, annotations, annotationsChanged)"
|
||||
*ngIf="annotationPermissions.canRecategorizeImage"
|
||||
[tooltipPosition]="tooltipPosition"
|
||||
[tooltip]="'annotation-actions.recategorize-image' | translate"
|
||||
|
||||
@ -154,16 +154,7 @@ export class DossierOverviewBulkActionsComponent {
|
||||
setToUnderApproval() {
|
||||
// If more than 1 approver - show dialog and ask who to assign
|
||||
if (this._appStateService.activeDossier.approverIds.length > 1) {
|
||||
this._dialogService.openAssignFileToUserDialog(
|
||||
this.selectedFiles,
|
||||
'approver',
|
||||
() => {
|
||||
this._loadingService.start();
|
||||
this.reload.emit();
|
||||
this._loadingService.stop();
|
||||
},
|
||||
true
|
||||
);
|
||||
this._assignFiles('approver', true);
|
||||
} else {
|
||||
this._performBulkAction(
|
||||
this._fileActionService.setFileUnderApproval(this.selectedFiles, this._appStateService.activeDossier.approverIds[0])
|
||||
@ -196,8 +187,12 @@ export class DossierOverviewBulkActionsComponent {
|
||||
|
||||
assign() {
|
||||
const mode = this.selectedFiles[0].isUnderApproval ? 'approver' : 'reviewer';
|
||||
this._assignFiles(mode);
|
||||
}
|
||||
|
||||
this._dialogService.openAssignFileToUserDialog(this.selectedFiles, mode, () => {
|
||||
private _assignFiles(mode: 'reviewer' | 'approver', ignoreChanged = false) {
|
||||
const data = { mode, files: this.selectedFiles, ignoreChanged };
|
||||
this._dialogService.openDialog('assignFile', null, data, () => {
|
||||
this._loadingService.start();
|
||||
this.reload.emit();
|
||||
this._loadingService.stop();
|
||||
|
||||
@ -87,7 +87,6 @@ export class DossierDetailsComponent implements OnInit {
|
||||
|
||||
const ownerName = this._userService.getNameForId(this.owner.id);
|
||||
const dossierName = this.appStateService.activeDossier.name;
|
||||
const msg = 'Successfully assigned ' + ownerName + ' to dossier: ' + dossierName;
|
||||
this._toaster.info(msg);
|
||||
this._toaster.info(_('assignment.owner'), { params: { ownerName, dossierName } });
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,11 +139,9 @@ export class FileActionsComponent implements OnInit {
|
||||
}
|
||||
|
||||
assign($event: MouseEvent) {
|
||||
$event.stopPropagation();
|
||||
|
||||
const mode = this.fileStatus.isUnderApproval ? 'approver' : 'reviewer';
|
||||
|
||||
this._dialogService.openAssignFileToUserDialog([this.fileStatus], mode, () => {
|
||||
const files = [this.fileStatus];
|
||||
this._dialogService.openDialog('assignFile', $event, { mode, files }, () => {
|
||||
this.actionPerformed.emit('assign-reviewer');
|
||||
});
|
||||
}
|
||||
@ -164,9 +162,14 @@ export class FileActionsComponent implements OnInit {
|
||||
}
|
||||
|
||||
setFileUnderApproval($event: MouseEvent) {
|
||||
$event.stopPropagation();
|
||||
if (this.appStateService.activeDossier.approverIds.length > 1) {
|
||||
this._fileActionService.assignDossierApprover(this.fileStatus, () => this.actionPerformed.emit('assign-reviewer'), true);
|
||||
this._fileActionService.assignFile(
|
||||
'approver',
|
||||
$event,
|
||||
this.fileStatus,
|
||||
() => this.actionPerformed.emit('assign-reviewer'),
|
||||
true
|
||||
);
|
||||
} else {
|
||||
this._fileActionService.setFileUnderApproval(this.fileStatus).subscribe(() => {
|
||||
this.reloadDossiers('set-under-approval');
|
||||
@ -189,8 +192,9 @@ export class FileActionsComponent implements OnInit {
|
||||
}
|
||||
|
||||
setFileUnderReview($event: MouseEvent, ignoreDialogChanges = false) {
|
||||
$event.stopPropagation();
|
||||
this._fileActionService.assignDossierReviewer(
|
||||
this._fileActionService.assignFile(
|
||||
'reviewer',
|
||||
$event,
|
||||
this.fileStatus,
|
||||
() => this.actionPerformed.emit('assign-reviewer'),
|
||||
ignoreDialogChanges
|
||||
|
||||
@ -93,7 +93,7 @@ export class AssignReviewerApproverDialogComponent {
|
||||
this._toaster.error('Failed: ' + error.error ? error.error.message : error);
|
||||
}
|
||||
|
||||
this._dialogRef.close();
|
||||
this._dialogRef.close(true);
|
||||
}
|
||||
|
||||
private _loadData() {
|
||||
|
||||
@ -42,7 +42,6 @@ export class DossierListingScreenComponent
|
||||
implements OnInit, AfterViewInit, OnDestroy, OnAttach, OnDetach
|
||||
{
|
||||
readonly itemSize = 85;
|
||||
protected readonly _primaryKey = 'dossierName';
|
||||
readonly currentUser = this._userService.currentUser;
|
||||
readonly tableHeaderLabel = _('dossier-listing.table-header.title');
|
||||
readonly buttonConfigs: ButtonConfig[] = [
|
||||
@ -74,6 +73,7 @@ export class DossierListingScreenComponent
|
||||
];
|
||||
dossiersChartData: DoughnutChartConfig[] = [];
|
||||
documentsChartData: DoughnutChartConfig[] = [];
|
||||
protected readonly _primaryKey = 'dossierName';
|
||||
private _lastScrollPosition: number;
|
||||
@ViewChild('needsWorkTemplate', { read: TemplateRef, static: true })
|
||||
private readonly _needsWorkTemplate: TemplateRef<any>;
|
||||
@ -147,7 +147,7 @@ export class DossierListingScreenComponent
|
||||
}
|
||||
|
||||
openAddDossierDialog(): void {
|
||||
this._dialogService.openAddDossierDialog(async addResponse => {
|
||||
this._dialogService.openDialog('addDossier', null, null, async addResponse => {
|
||||
await this._router.navigate([`/main/dossiers/${addResponse.dossier.dossierId}`]);
|
||||
if (addResponse.addMembers) {
|
||||
this._dialogService.openDialog('editDossier', null, {
|
||||
|
||||
@ -44,12 +44,9 @@ export class DossierOverviewScreenComponent
|
||||
implements OnInit, OnDestroy, OnDetach, OnAttach
|
||||
{
|
||||
readonly itemSize = 80;
|
||||
protected readonly _primaryKey = 'filename';
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
readonly currentUser = this._userService.currentUser;
|
||||
readonly tableHeaderLabel = _('dossier-overview.table-header.title');
|
||||
private readonly _lastOpenedFileKey = 'Dossier-Recent-' + this.activeDossier.dossierId;
|
||||
|
||||
readonly actionConfigs: ActionConfig[] = [
|
||||
{
|
||||
label: this._translateService.instant('dossier-overview.header-actions.edit'),
|
||||
@ -90,9 +87,10 @@ export class DossierOverviewScreenComponent
|
||||
column: 'statusSort'
|
||||
}
|
||||
];
|
||||
|
||||
collapsedDetails = false;
|
||||
dossierAttributes: DossierAttributeWithValue[] = [];
|
||||
protected readonly _primaryKey = 'filename';
|
||||
private readonly _lastOpenedFileKey = 'Dossier-Recent-' + this.activeDossier.dossierId;
|
||||
@ViewChild(DossierDetailsComponent, { static: false })
|
||||
private readonly _dossierDetailsComponent: DossierDetailsComponent;
|
||||
private _lastScrollPosition: number;
|
||||
@ -260,7 +258,7 @@ export class DossierOverviewScreenComponent
|
||||
}
|
||||
|
||||
openDossierDictionaryDialog() {
|
||||
this._dialogService.openDossierDictionaryDialog(null, this.activeDossier, () => {
|
||||
this._dialogService.openDialog('dossierDictionary', null, this.activeDossier, () => {
|
||||
this.reloadDossiers();
|
||||
});
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@ import { TranslateService } from '@ngx-translate/core';
|
||||
import { AutoUnsubscribeComponent, CircleButtonTypes, NestedFilter, processFilters } from '@iqser/common-ui';
|
||||
import { fileStatusTranslations } from '../../translations/file-status-translations';
|
||||
import { handleFilterDelta } from '@shared/components/filters/popup-filter/utils/filter-utils';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
|
||||
const ALL_HOTKEY_ARRAY = ['Escape', 'F', 'f'];
|
||||
|
||||
@ -322,21 +323,27 @@ export class FilePreviewScreenComponent extends AutoUnsubscribeComponent impleme
|
||||
this._workloadComponent?.scrollAnnotationsToPage(pageNumber, 'always');
|
||||
}
|
||||
|
||||
openManualAnnotationDialog($event: ManualRedactionEntryWrapper) {
|
||||
openManualAnnotationDialog(entryWrapper: ManualRedactionEntryWrapper) {
|
||||
this._ngZone.run(() => {
|
||||
this.dialogRef = this._dialogService.openManualAnnotationDialog($event, async (response: ManualAnnotationResponse) => {
|
||||
if (response?.annotationId) {
|
||||
const annotation = this._instance.annotManager.getAnnotationById(response.manualRedactionEntryWrapper.rectId);
|
||||
this._instance.annotManager.deleteAnnotation(annotation);
|
||||
this.fileData.fileStatus = await this.appStateService.reloadActiveFile();
|
||||
const distinctPages = $event.manualRedactionEntry.positions
|
||||
.map(p => p.page)
|
||||
.filter((item, pos, self) => self.indexOf(item) === pos);
|
||||
distinctPages.forEach(page => {
|
||||
this._cleanupAndRedrawManualAnnotationsForEntirePage(page);
|
||||
});
|
||||
console.log({ entryWrapper });
|
||||
this.dialogRef = this._dialogService.openDialog(
|
||||
'manualAnnotation',
|
||||
null,
|
||||
entryWrapper,
|
||||
async (response: ManualAnnotationResponse) => {
|
||||
if (response?.annotationId) {
|
||||
const annotation = this._instance.annotManager.getAnnotationById(response.manualRedactionEntryWrapper.rectId);
|
||||
this._instance.annotManager.deleteAnnotation(annotation);
|
||||
this.fileData.fileStatus = await this.appStateService.reloadActiveFile();
|
||||
const distinctPages = entryWrapper.manualRedactionEntry.positions
|
||||
.map(p => p.page)
|
||||
.filter((item, pos, self) => self.indexOf(item) === pos);
|
||||
distinctPages.forEach(page => {
|
||||
this._cleanupAndRedrawManualAnnotationsForEntirePage(page);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@ -471,8 +478,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribeComponent impleme
|
||||
const { dossierId, fileId, filename } = this.fileData.fileStatus;
|
||||
await this._statusControllerService.setFileReviewer(dossierId, fileId, reviewerId).toPromise();
|
||||
|
||||
const msg = `Successfully assigned ${reviewerName} to file: ${filename}`;
|
||||
this._toaster.info(msg);
|
||||
this._toaster.info(_('assignment.reviewer'), { params: { reviewerName, filename } });
|
||||
await this.appStateService.reloadActiveFile();
|
||||
this._updateCanPerformActions();
|
||||
this.editingReviewer = false;
|
||||
|
||||
@ -43,8 +43,7 @@ export class AnnotationActionsService {
|
||||
}
|
||||
|
||||
forceRedaction($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) {
|
||||
$event?.stopPropagation();
|
||||
this._dialogService.openForceRedactionDialog($event, request => {
|
||||
this._dialogService.openDialog('forceRedaction', $event, null, request => {
|
||||
annotations.forEach(annotation => {
|
||||
this._processObsAndEmit(
|
||||
this._manualAnnotationService.forceRedaction({
|
||||
@ -59,7 +58,7 @@ export class AnnotationActionsService {
|
||||
}
|
||||
|
||||
changeLegalBasis($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) {
|
||||
this._dialogService.openChangeLegalBasisDialog($event, annotations, (data: { comment: string; legalBasis: string }) => {
|
||||
this._dialogService.openDialog('changeLegalBasis', $event, annotations, (data: { comment: string; legalBasis: string }) => {
|
||||
annotations.forEach(annotation => {
|
||||
this._processObsAndEmit(
|
||||
this._manualAnnotationService.changeLegalBasis(annotation.annotationId, data.legalBasis, data.comment),
|
||||
@ -76,7 +75,8 @@ export class AnnotationActionsService {
|
||||
removeFromDictionary: boolean,
|
||||
annotationsChanged: EventEmitter<AnnotationWrapper>
|
||||
) {
|
||||
this._dialogService.openRemoveFromDictionaryDialog($event, annotations, removeFromDictionary, result => {
|
||||
const data = { annotationsToRemove: annotations, removeFromDictionary };
|
||||
this._dialogService.openDialog('removeAnnotations', $event, data, result => {
|
||||
annotations.forEach(annotation => {
|
||||
this._processObsAndEmit(
|
||||
this._manualAnnotationService.removeOrSuggestRemoveAnnotation(annotation, removeFromDictionary, result.comment),
|
||||
@ -100,8 +100,8 @@ export class AnnotationActionsService {
|
||||
});
|
||||
}
|
||||
|
||||
recategorizeImage($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) {
|
||||
this._dialogService.openRecategorizeImageDialog($event, annotations, (data: { type: string; comment: string }) => {
|
||||
recategorizeImages($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) {
|
||||
this._dialogService.openDialog('recategorizeImage', $event, annotations, (data: { type: string; comment: string }) => {
|
||||
annotations.forEach(annotation => {
|
||||
this._processObsAndEmit(
|
||||
this._manualAnnotationService.recategorizeImage(annotation.annotationId, data.type, data.comment),
|
||||
@ -147,7 +147,7 @@ export class AnnotationActionsService {
|
||||
title: this._translateService.instant('annotation-actions.recategorize-image'),
|
||||
onClick: () => {
|
||||
this._ngZone.run(() => {
|
||||
this.recategorizeImage(null, annotations, annotationsChanged);
|
||||
this.recategorizeImages(null, annotations, annotationsChanged);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -1,36 +1,34 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { MatDialog, MatDialogConfig, MatDialogRef } from '@angular/material/dialog';
|
||||
import { MatDialog, MatDialogConfig } from '@angular/material/dialog';
|
||||
import { AddDossierDialogComponent } from '../dialogs/add-dossier-dialog/add-dossier-dialog.component';
|
||||
import { RemoveAnnotationsDialogComponent } from '../dialogs/remove-annotations-dialog/remove-annotations-dialog.component';
|
||||
import { ForceRedactionDialogComponent } from '../dialogs/force-redaction-dialog/force-redaction-dialog.component';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { ConfirmationDialogComponent, ConfirmationDialogInput } from '@shared/dialogs/confirmation-dialog/confirmation-dialog.component';
|
||||
import { DossierWrapper } from '@state/model/dossier.wrapper';
|
||||
import { ConfirmationDialogComponent } from '@shared/dialogs/confirmation-dialog/confirmation-dialog.component';
|
||||
import { DocumentInfoDialogComponent } from '../dialogs/document-info-dialog/document-info-dialog.component';
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
import { ManualRedactionEntryWrapper } from '@models/file/manual-redaction-entry.wrapper';
|
||||
import { ManualAnnotationService } from './manual-annotation.service';
|
||||
import { ManualAnnotationDialogComponent } from '../dialogs/manual-redaction-dialog/manual-annotation-dialog.component';
|
||||
import { DossierDictionaryDialogComponent } from '../dialogs/dossier-dictionary-dialog/dossier-dictionary-dialog.component';
|
||||
import { EditDossierDialogComponent } from '../dialogs/edit-dossier-dialog/edit-dossier-dialog.component';
|
||||
import { FileStatusWrapper } from '@models/file/file-status.wrapper';
|
||||
import { AssignReviewerApproverDialogComponent } from '../dialogs/assign-reviewer-approver-dialog/assign-reviewer-approver-dialog.component';
|
||||
import { AppConfigService } from '@app-config/app-config.service';
|
||||
import { ChangeLegalBasisDialogComponent } from '../dialogs/change-legal-basis-dialog/change-legal-basis-dialog.component';
|
||||
import { RecategorizeImageDialogComponent } from '../dialogs/recategorize-image-dialog/recategorize-image-dialog.component';
|
||||
import { DialogService, largeDialogConfig } from '@shared/services/dialog.service';
|
||||
import { ComponentType } from '@angular/cdk/portal';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
|
||||
const dialogConfig = {
|
||||
width: '662px',
|
||||
maxWidth: '90vw',
|
||||
autoFocus: false
|
||||
} as const;
|
||||
|
||||
// TODO: Continue refactor
|
||||
|
||||
type DialogType = 'confirm' | 'documentInfo' | 'editDossier';
|
||||
type DialogType =
|
||||
| 'confirm'
|
||||
| 'documentInfo'
|
||||
| 'editDossier'
|
||||
| 'addDossier'
|
||||
| 'assignFile'
|
||||
| 'recategorizeImage'
|
||||
| 'changeLegalBasis'
|
||||
| 'dossierDictionary'
|
||||
| 'removeAnnotations'
|
||||
| 'forceRedaction'
|
||||
| 'manualAnnotation';
|
||||
|
||||
type DossiersDialogConfig = {
|
||||
[key in DialogType]: {
|
||||
@ -52,6 +50,33 @@ export class DossiersDialogService extends DialogService<DialogType> {
|
||||
editDossier: {
|
||||
component: EditDossierDialogComponent,
|
||||
dialogConfig: { ...largeDialogConfig }
|
||||
},
|
||||
addDossier: {
|
||||
component: AddDossierDialogComponent,
|
||||
dialogConfig: { width: '900px', autoFocus: true }
|
||||
},
|
||||
assignFile: {
|
||||
component: AssignReviewerApproverDialogComponent
|
||||
},
|
||||
recategorizeImage: {
|
||||
component: RecategorizeImageDialogComponent
|
||||
},
|
||||
changeLegalBasis: {
|
||||
component: ChangeLegalBasisDialogComponent
|
||||
},
|
||||
dossierDictionary: {
|
||||
component: DossierDictionaryDialogComponent,
|
||||
dialogConfig: { width: '90vw', height: '90vh' }
|
||||
},
|
||||
removeAnnotations: {
|
||||
component: RemoveAnnotationsDialogComponent
|
||||
},
|
||||
forceRedaction: {
|
||||
component: ForceRedactionDialogComponent
|
||||
},
|
||||
manualAnnotation: {
|
||||
component: ManualAnnotationDialogComponent,
|
||||
dialogConfig: { autoFocus: true }
|
||||
}
|
||||
};
|
||||
|
||||
@ -63,154 +88,4 @@ export class DossiersDialogService extends DialogService<DialogType> {
|
||||
) {
|
||||
super(_dialog);
|
||||
}
|
||||
|
||||
openManualAnnotationDialog($event: ManualRedactionEntryWrapper, cb?: Function): MatDialogRef<ManualAnnotationDialogComponent> {
|
||||
const ref = this._dialog.open(ManualAnnotationDialogComponent, {
|
||||
...dialogConfig,
|
||||
autoFocus: true,
|
||||
data: $event
|
||||
});
|
||||
|
||||
ref.afterClosed().subscribe(result => {
|
||||
if (cb) {
|
||||
cb(result);
|
||||
}
|
||||
});
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
openForceRedactionDialog($event: MouseEvent, cb?: Function): MatDialogRef<ForceRedactionDialogComponent> {
|
||||
$event?.stopPropagation();
|
||||
const ref = this._dialog.open(ForceRedactionDialogComponent, {
|
||||
...dialogConfig
|
||||
});
|
||||
ref.afterClosed().subscribe(async result => {
|
||||
if (result && cb) {
|
||||
cb(result);
|
||||
}
|
||||
});
|
||||
return ref;
|
||||
}
|
||||
|
||||
openChangeLegalBasisDialog(
|
||||
$event: MouseEvent,
|
||||
annotations: AnnotationWrapper[],
|
||||
cb?: Function
|
||||
): MatDialogRef<ChangeLegalBasisDialogComponent> {
|
||||
$event?.stopPropagation();
|
||||
const ref = this._dialog.open(ChangeLegalBasisDialogComponent, {
|
||||
...dialogConfig,
|
||||
data: annotations
|
||||
});
|
||||
ref.afterClosed().subscribe(async result => {
|
||||
if (result && cb) {
|
||||
cb(result);
|
||||
}
|
||||
});
|
||||
return ref;
|
||||
}
|
||||
|
||||
openRecategorizeImageDialog(
|
||||
$event: MouseEvent,
|
||||
annotations: AnnotationWrapper[],
|
||||
cb?: Function
|
||||
): MatDialogRef<RecategorizeImageDialogComponent> {
|
||||
$event?.stopPropagation();
|
||||
const ref = this._dialog.open(RecategorizeImageDialogComponent, {
|
||||
...dialogConfig,
|
||||
data: annotations
|
||||
});
|
||||
ref.afterClosed().subscribe(async result => {
|
||||
if (result && cb) {
|
||||
cb(result);
|
||||
}
|
||||
});
|
||||
return ref;
|
||||
}
|
||||
|
||||
openRemoveFromDictionaryDialog(
|
||||
$event: MouseEvent,
|
||||
annotations: AnnotationWrapper[],
|
||||
removeFromDictionary: boolean,
|
||||
cb?: Function
|
||||
): MatDialogRef<RemoveAnnotationsDialogComponent> {
|
||||
$event?.stopPropagation();
|
||||
const ref = this._dialog.open(RemoveAnnotationsDialogComponent, {
|
||||
...dialogConfig,
|
||||
data: { annotationsToRemove: annotations, removeFromDictionary: removeFromDictionary }
|
||||
});
|
||||
ref.afterClosed().subscribe(async result => {
|
||||
if (result) {
|
||||
if (cb) cb(result);
|
||||
}
|
||||
});
|
||||
return ref;
|
||||
}
|
||||
|
||||
openDossierDictionaryDialog(
|
||||
$event: MouseEvent,
|
||||
dossier: DossierWrapper,
|
||||
cb?: Function
|
||||
): MatDialogRef<DossierDictionaryDialogComponent> {
|
||||
$event?.stopPropagation();
|
||||
const ref = this._dialog.open(DossierDictionaryDialogComponent, {
|
||||
...dialogConfig,
|
||||
width: '90vw',
|
||||
height: '90vh',
|
||||
autoFocus: false,
|
||||
data: dossier
|
||||
});
|
||||
ref.afterClosed().subscribe(result => {
|
||||
if (cb) {
|
||||
cb(result);
|
||||
}
|
||||
});
|
||||
return ref;
|
||||
}
|
||||
|
||||
openAssignFileToMeDialog(cb?: Function) {
|
||||
const ref = this._dialog.open(ConfirmationDialogComponent, {
|
||||
...dialogConfig,
|
||||
data: new ConfirmationDialogInput({
|
||||
title: _('confirmation-dialog.assign-file-to-me.title'),
|
||||
question: _('confirmation-dialog.assign-file-to-me.question')
|
||||
})
|
||||
});
|
||||
ref.afterClosed().subscribe(result => {
|
||||
if (result && cb) cb(result);
|
||||
});
|
||||
}
|
||||
|
||||
openAssignFileToUserDialog(
|
||||
files: FileStatusWrapper[],
|
||||
mode: 'reviewer' | 'approver',
|
||||
cb?: Function,
|
||||
ignoreDialogChanges = false
|
||||
): MatDialogRef<AssignReviewerApproverDialogComponent> {
|
||||
const ref = this._dialog.open(AssignReviewerApproverDialogComponent, {
|
||||
...dialogConfig,
|
||||
data: { mode: mode, files: files, ignoreChanged: ignoreDialogChanges }
|
||||
});
|
||||
|
||||
ref.afterClosed().subscribe(() => {
|
||||
if (cb) cb();
|
||||
});
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
openAddDossierDialog(cb?: Function): MatDialogRef<AddDossierDialogComponent> {
|
||||
const ref = this._dialog.open(AddDossierDialogComponent, {
|
||||
...dialogConfig,
|
||||
width: '900px',
|
||||
autoFocus: true
|
||||
});
|
||||
|
||||
ref.afterClosed().subscribe(result => {
|
||||
if (result && cb) cb(result);
|
||||
});
|
||||
|
||||
return ref;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,8 @@ import { FileStatusWrapper } from '@models/file/file-status.wrapper';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { isArray } from 'rxjs/internal-compatibility';
|
||||
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';
|
||||
|
||||
@Injectable()
|
||||
export class FileActionService {
|
||||
@ -40,42 +42,6 @@ export class FileActionService {
|
||||
);
|
||||
}
|
||||
|
||||
async assignDossierReviewerFromOverview(file?: FileStatusWrapper, callback?: Function) {
|
||||
if (this._permissionsService.isOwner()) {
|
||||
this._openAssignReviewerDialog(file, callback);
|
||||
} else {
|
||||
await this.assignToMe(file, callback);
|
||||
}
|
||||
}
|
||||
|
||||
assignDossierApprover(file?: FileStatusWrapper, callback?: Function, ignoreDialogChanges = false) {
|
||||
this._dialogService.openAssignFileToUserDialog(
|
||||
file ? [file] : [this._appStateService.activeFile],
|
||||
'approver',
|
||||
async () => {
|
||||
await this._appStateService.reloadActiveDossierFiles();
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
ignoreDialogChanges
|
||||
);
|
||||
}
|
||||
|
||||
assignDossierReviewer(file?: FileStatusWrapper, callback?: Function, ignoreDialogChanges = false) {
|
||||
this._dialogService.openAssignFileToUserDialog(
|
||||
file ? [file] : [this._appStateService.activeFile],
|
||||
'reviewer',
|
||||
async () => {
|
||||
await this._appStateService.reloadActiveDossierFiles();
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
ignoreDialogChanges
|
||||
);
|
||||
}
|
||||
|
||||
async assignToMe(fileStatus?: FileStatusWrapper | FileStatusWrapper[], callback?: Function) {
|
||||
if (!isArray(fileStatus)) {
|
||||
fileStatus = [fileStatus];
|
||||
@ -83,7 +49,11 @@ export class FileActionService {
|
||||
|
||||
const atLeastOneFileHasReviewer = fileStatus.reduce((acc, fs) => acc || !!fs.currentReviewer, false);
|
||||
if (atLeastOneFileHasReviewer) {
|
||||
this._dialogService.openAssignFileToMeDialog(async () => {
|
||||
const data = new ConfirmationDialogInput({
|
||||
title: _('confirmation-dialog.assign-file-to-me.title'),
|
||||
question: _('confirmation-dialog.assign-file-to-me.question')
|
||||
});
|
||||
this._dialogService.openDialog('confirm', null, data, async () => {
|
||||
await this._assignReviewerToCurrentUser(fileStatus, callback);
|
||||
});
|
||||
} else {
|
||||
@ -137,8 +107,10 @@ export class FileActionService {
|
||||
);
|
||||
}
|
||||
|
||||
private _openAssignReviewerDialog(file?: FileStatusWrapper, callback?: Function) {
|
||||
this._dialogService.openAssignFileToUserDialog(file ? [file] : [this._appStateService.activeFile], 'reviewer', async () => {
|
||||
assignFile(mode: 'reviewer' | 'approver', $event: MouseEvent, file?: FileStatusWrapper, callback?: Function, ignoreChanged = false) {
|
||||
const files = file ? [file] : [this._appStateService.activeFile];
|
||||
const data = { mode, files, ignoreChanged };
|
||||
this._dialogService.openDialog('assignFile', $event, data, async () => {
|
||||
await this._appStateService.reloadActiveDossierFiles();
|
||||
if (callback) {
|
||||
callback();
|
||||
|
||||
@ -266,6 +266,10 @@
|
||||
"cancel": "Cancel",
|
||||
"save": "Save"
|
||||
},
|
||||
"assignment": {
|
||||
"owner": "Successfully assigned {ownerName} to dossier: {dossierName}.",
|
||||
"reviewer": "Successfully assigned {reviewerName} to file: {filename}."
|
||||
},
|
||||
"audit": "Audit",
|
||||
"audit-screen": {
|
||||
"all-users": "All Users",
|
||||
|
||||
@ -94,11 +94,6 @@ pre {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.primary {
|
||||
color: $primary;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.no-wrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 98ae1d5698a838ed1e3febf0b30dfa81f44b2c16
|
||||
Subproject commit f1e8d9011cff19f684d4681ee2cce3e3e980c3c3
|
||||
Loading…
x
Reference in New Issue
Block a user