RED-7619 remove unused dialog

This commit is contained in:
Dan Percic 2023-10-27 21:27:50 +03:00
parent d31d57a2ca
commit e40a975ac3
3 changed files with 1 additions and 138 deletions

View File

@ -1,52 +0,0 @@
<section class="dialog">
<form (submit)="save()" [formGroup]="form">
<div [translate]="dialogHeader" class="dialog-header heading-l"></div>
<div class="dialog-content">
<div class="iqser-input-group">
<label *ngIf="data.annotations.length === 1" translate="manual-annotation.dialog.content.text"></label>
</div>
{{
data.annotations.length === 1
? format(data.annotations[0].value)
: ('accept-recommendation-dialog.multiple-values' | translate)
}}
<div class="iqser-input-group required w-400">
<label translate="manual-annotation.dialog.content.dictionary"></label>
<mat-form-field>
<mat-select formControlName="dictionary">
<mat-select-trigger>{{ displayedDictionaryLabel }}</mat-select-trigger>
<mat-option
*ngFor="let dictionary of possibleDictionaries"
[matTooltip]="dictionary.description"
[value]="dictionary.type"
matTooltipPosition="after"
>
<span>
{{ dictionary.label }}
</span>
</mat-option>
</mat-select>
</mat-form-field>
</div>
<div class="iqser-input-group w-300">
<label translate="manual-annotation.dialog.content.comment"></label>
<textarea formControlName="comment" iqserHasScrollbar name="comment" rows="4" type="text"></textarea>
</div>
</div>
<div class="dialog-actions">
<iqser-icon-button
[disabled]="form.invalid"
[label]="'manual-annotation.dialog.actions.save' | translate"
[submit]="true"
[type]="iconButtonTypes.primary"
></iqser-icon-button>
</div>
</form>
<iqser-circle-button (action)="close()" class="dialog-close" icon="iqser:close"></iqser-circle-button>
</section>

View File

@ -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<AcceptRecommendationDialogComponent, AcceptRecommendationReturnType>,
@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],
});
}
}

View File

@ -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,