diff --git a/apps/red-ui/src/app/modules/admin/screens/trash/trash-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/trash/trash-screen.component.ts index 93e074a6b..f8d283271 100644 --- a/apps/red-ui/src/app/modules/admin/screens/trash/trash-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/trash/trash-screen.component.ts @@ -27,11 +27,9 @@ interface DossierListItem extends Dossier { }) export class TrashScreenComponent extends BaseListingComponent 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[] = [ { label: _('trash.table-col-names.name'), @@ -53,6 +51,8 @@ export class TrashScreenComponent extends BaseListingComponent 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 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 this._loadingService.loadWhile(this._restore(dossiers)); } + private _getRestoreDate(softDeletedTime: string): string { + return moment(softDeletedTime).add(this._deleteRetentionHours, 'hours').toISOString(); + } + private async _loadDossiersData(): Promise { this.entitiesService.setEntities(this._toListItems(await this._dossiersService.getDeleted())); } diff --git a/apps/red-ui/src/app/modules/dossier/components/annotation-actions/annotation-actions.component.html b/apps/red-ui/src/app/modules/dossier/components/annotation-actions/annotation-actions.component.html index 34385181d..1be35c2eb 100644 --- a/apps/red-ui/src/app/modules/dossier/components/annotation-actions/annotation-actions.component.html +++ b/apps/red-ui/src/app/modules/dossier/components/annotation-actions/annotation-actions.component.html @@ -45,7 +45,7 @@ > 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(); diff --git a/apps/red-ui/src/app/modules/dossier/components/dossier-details/dossier-details.component.ts b/apps/red-ui/src/app/modules/dossier/components/dossier-details/dossier-details.component.ts index 70d4f0b6e..eb2ab0ab2 100644 --- a/apps/red-ui/src/app/modules/dossier/components/dossier-details/dossier-details.component.ts +++ b/apps/red-ui/src/app/modules/dossier/components/dossier-details/dossier-details.component.ts @@ -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 } }); } } diff --git a/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.ts b/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.ts index e8396a9fa..7e1657a6b 100644 --- a/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.ts +++ b/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.ts @@ -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 diff --git a/apps/red-ui/src/app/modules/dossier/dialogs/assign-reviewer-approver-dialog/assign-reviewer-approver-dialog.component.ts b/apps/red-ui/src/app/modules/dossier/dialogs/assign-reviewer-approver-dialog/assign-reviewer-approver-dialog.component.ts index 22a8c241b..3eeb90183 100644 --- a/apps/red-ui/src/app/modules/dossier/dialogs/assign-reviewer-approver-dialog/assign-reviewer-approver-dialog.component.ts +++ b/apps/red-ui/src/app/modules/dossier/dialogs/assign-reviewer-approver-dialog/assign-reviewer-approver-dialog.component.ts @@ -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() { diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.ts b/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.ts index d270095ce..da559d2f5 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.ts @@ -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; @@ -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, { diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts index 7d85260a9..bb2517e42 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts @@ -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(); }); } diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts index 670215425..d19f81fe7 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts @@ -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; diff --git a/apps/red-ui/src/app/modules/dossier/services/annotation-actions.service.ts b/apps/red-ui/src/app/modules/dossier/services/annotation-actions.service.ts index 862159e56..538be18ea 100644 --- a/apps/red-ui/src/app/modules/dossier/services/annotation-actions.service.ts +++ b/apps/red-ui/src/app/modules/dossier/services/annotation-actions.service.ts @@ -43,8 +43,7 @@ export class AnnotationActionsService { } forceRedaction($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter) { - $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) { - 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 ) { - 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) { - this._dialogService.openRecategorizeImageDialog($event, annotations, (data: { type: string; comment: string }) => { + recategorizeImages($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter) { + 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); }); } }); diff --git a/apps/red-ui/src/app/modules/dossier/services/dossiers-dialog.service.ts b/apps/red-ui/src/app/modules/dossier/services/dossiers-dialog.service.ts index ac926d292..33e1eb7a8 100644 --- a/apps/red-ui/src/app/modules/dossier/services/dossiers-dialog.service.ts +++ b/apps/red-ui/src/app/modules/dossier/services/dossiers-dialog.service.ts @@ -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 { 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 { ) { super(_dialog); } - - openManualAnnotationDialog($event: ManualRedactionEntryWrapper, cb?: Function): MatDialogRef { - 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 { - $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 { - $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 { - $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 { - $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 { - $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 { - 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 { - const ref = this._dialog.open(AddDossierDialogComponent, { - ...dialogConfig, - width: '900px', - autoFocus: true - }); - - ref.afterClosed().subscribe(result => { - if (result && cb) cb(result); - }); - - return ref; - } } diff --git a/apps/red-ui/src/app/modules/dossier/services/file-action.service.ts b/apps/red-ui/src/app/modules/dossier/services/file-action.service.ts index 438182380..cde315c4a 100644 --- a/apps/red-ui/src/app/modules/dossier/services/file-action.service.ts +++ b/apps/red-ui/src/app/modules/dossier/services/file-action.service.ts @@ -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(); diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 371e05607..6f12c9bcd 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -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", diff --git a/apps/red-ui/src/assets/styles/red-text-styles.scss b/apps/red-ui/src/assets/styles/red-text-styles.scss index 52c509f6a..554f5a160 100644 --- a/apps/red-ui/src/assets/styles/red-text-styles.scss +++ b/apps/red-ui/src/assets/styles/red-text-styles.scss @@ -94,11 +94,6 @@ pre { white-space: nowrap; } -.primary { - color: $primary; - opacity: 1; -} - .no-wrap { white-space: nowrap; } diff --git a/libs/common-ui b/libs/common-ui index 98ae1d569..f1e8d9011 160000 --- a/libs/common-ui +++ b/libs/common-ui @@ -1 +1 @@ -Subproject commit 98ae1d5698a838ed1e3febf0b30dfa81f44b2c16 +Subproject commit f1e8d9011cff19f684d4681ee2cce3e3e980c3c3