diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/accept-recommendation-dialog/accept-recommendation-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/accept-recommendation-dialog/accept-recommendation-dialog.component.html deleted file mode 100644 index 2c2099576..000000000 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/accept-recommendation-dialog/accept-recommendation-dialog.component.html +++ /dev/null @@ -1,52 +0,0 @@ -
-
-
- -
-
- -
- {{ - data.annotations.length === 1 - ? format(data.annotations[0].value) - : ('accept-recommendation-dialog.multiple-values' | translate) - }} - -
- - - - - {{ displayedDictionaryLabel }} - - - {{ dictionary.label }} - - - - -
- -
- - -
-
- -
- -
-
- - -
diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/accept-recommendation-dialog/accept-recommendation-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/accept-recommendation-dialog/accept-recommendation-dialog.component.ts deleted file mode 100644 index c5b7a91a6..000000000 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/accept-recommendation-dialog/accept-recommendation-dialog.component.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { Component, inject, Inject, OnInit } from '@angular/core'; -import { Validators } from '@angular/forms'; -import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; -import { BaseDialogComponent } from '@iqser/common-ui'; -import { AnnotationWrapper } from '@models/file/annotation.wrapper'; -import { Dictionary } from '@red/domain'; -import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service'; -import { DictionaryService } from '@services/entity-services/dictionary.service'; -import { PermissionsService } from '@services/permissions.service'; -import { acceptRecommendationTranslations } from '@translations/accept-recommendation-translations'; - -export interface AcceptRecommendationData { - readonly annotations: AnnotationWrapper[]; - readonly dossierId: string; -} - -export interface AcceptRecommendationReturnType { - readonly annotations: AnnotationWrapper[]; - readonly comment: string; -} - -@Component({ - templateUrl: './accept-recommendation-dialog.component.html', -}) -export class AcceptRecommendationDialogComponent extends BaseDialogComponent implements OnInit { - readonly #dossier = inject(ActiveDossiersService).find(this.data.dossierId); - readonly dialogHeader: string; - possibleDictionaries: Dictionary[] = []; - - constructor( - permissionsService: PermissionsService, - private readonly _dictionaryService: DictionaryService, - protected readonly _dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) readonly data: AcceptRecommendationData, - ) { - super(_dialogRef); - const isDocumentAdmin = permissionsService.isApprover(this.#dossier); - this.dialogHeader = isDocumentAdmin - ? acceptRecommendationTranslations.addToDictionary - : acceptRecommendationTranslations.requestAddToDictionary; - this.form = this._getForm(); - this.initialFormValue = this.form.getRawValue(); - } - - get displayedDictionaryLabel() { - const dictType = this.form.get('dictionary').value as string; - if (dictType && this.possibleDictionaries.length) { - return this.possibleDictionaries.find(d => d.type === dictType)?.label; - } - return null; - } - - async ngOnInit() { - this.possibleDictionaries = await this._dictionaryService.getDictionariesOptions(this.#dossier.dossierTemplateId, this.#dossier.id); - this.form.patchValue({ - dictionary: this.possibleDictionaries.find(dict => dict.type === this.data.annotations[0].recommendationType)?.type, - }); - } - - save() { - const recommendationType = this.form.get('dictionary').value; - this.data.annotations.forEach(a => (a.recommendationType = recommendationType)); - this._dialogRef.close({ - annotations: this.data.annotations, - comment: this.form.get('comment').value as string, - }); - } - - format(value: string) { - return value.replace( - // eslint-disable-next-line no-control-regex,max-len - /([^\s\d-]{2,})[-\u00AD]\u000D\u000A|[\u000A\u000B\u000C\u000D\u0085\u2028\u2029]/gi, - '$1', - ); - } - - private _getForm() { - return this._formBuilder.group({ - dictionary: [Validators.required], - comment: [null], - }); - } -} diff --git a/apps/red-ui/src/app/modules/file-preview/file-preview.module.ts b/apps/red-ui/src/app/modules/file-preview/file-preview.module.ts index d5201841e..611fdc5c7 100644 --- a/apps/red-ui/src/app/modules/file-preview/file-preview.module.ts +++ b/apps/red-ui/src/app/modules/file-preview/file-preview.module.ts @@ -2,6 +2,7 @@ import { OverlayModule } from '@angular/cdk/overlay'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; +import { ReplaceNbspPipe } from '@common-ui/pipes/replace-nbsp.pipe'; import { PendingChangesGuard } from '@guards/can-deactivate.guard'; import { CapitalizePipe, @@ -49,7 +50,6 @@ import { ReadonlyBannerComponent } from './components/readonly-banner/readonly-b import { FilePreviewRightContainerComponent } from './components/right-container/file-preview-right-container.component'; import { UserManagementComponent } from './components/user-management/user-management.component'; import { ViewSwitchComponent } from './components/view-switch/view-switch.component'; -import { AcceptRecommendationDialogComponent } from './dialogs/accept-recommendation-dialog/accept-recommendation-dialog.component'; import { AddHintDialogComponent } from './dialogs/add-hint-dialog/add-hint-dialog.component'; import { ChangeLegalBasisDialogComponent } from './dialogs/change-legal-basis-dialog/change-legal-basis-dialog.component'; import { AddAnnotationDialogComponent } from './dialogs/docu-mine/add-annotation-dialog/add-annotation-dialog.component'; @@ -71,7 +71,6 @@ import { DocumentUnloadedGuard } from './services/document-unloaded.guard'; import { FilePreviewDialogService } from './services/file-preview-dialog.service'; import { ManualRedactionService } from './services/manual-redaction.service'; import { TablesService } from './services/tables.service'; -import { ReplaceNbspPipe } from '@common-ui/pipes/replace-nbsp.pipe'; const routes: IqserRoutes = [ { @@ -88,7 +87,6 @@ const dialogs = [ ResizeRedactionDialogComponent, ChangeLegalBasisDialogComponent, HighlightActionDialogComponent, - AcceptRecommendationDialogComponent, DocumentInfoDialogComponent, ImportRedactionsDialogComponent, RedactTextDialogComponent,