RED-7619 little cleanup
This commit is contained in:
parent
c94ef48844
commit
94ba0e5470
@ -215,18 +215,10 @@ export class AnnotationWrapper implements IListable {
|
||||
return !!SuggestionAddSuperTypes[this.superType];
|
||||
}
|
||||
|
||||
get isSuggestionAddDictionary() {
|
||||
return this.superType === SuperTypes.SuggestionAddDictionary;
|
||||
}
|
||||
|
||||
get isSuggestionRemove() {
|
||||
return !!SuggestionRemoveSuperTypes[this.superType];
|
||||
}
|
||||
|
||||
get isSuggestionRemoveDictionary() {
|
||||
return this.superType === SuperTypes.SuggestionRemoveDictionary;
|
||||
}
|
||||
|
||||
get isSuggestionLegalBasisChange() {
|
||||
return this.superType === SuperTypes.SuggestionChangeLegalBasis;
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<div class="details">
|
||||
<redaction-annotation-icon
|
||||
[color]="annotation.color"
|
||||
[label]="annotation.isEarmark ? '' : ((annotationTypesTranslations[annotation.superType] | translate)[0] | uppercase)"
|
||||
[label]="annotation.isEarmark ? '' : ((annotationTypesTranslations[annotation.superType] | translate)?.[0] | uppercase)"
|
||||
[type]="annotation.iconShape"
|
||||
class="mt-6 mr-10"
|
||||
></redaction-annotation-icon>
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { UntypedFormGroup, Validators } from '@angular/forms';
|
||||
import { Component, inject, Inject, OnInit } from '@angular/core';
|
||||
import { Validators } from '@angular/forms';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { Dictionary, Dossier } from '@red/domain';
|
||||
import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service';
|
||||
import { BaseDialogComponent } from '@iqser/common-ui';
|
||||
import { DictionaryService } from '@services/entity-services/dictionary.service';
|
||||
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 {
|
||||
@ -23,22 +23,18 @@ export interface AcceptRecommendationReturnType {
|
||||
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[] = [];
|
||||
|
||||
private readonly _dossier: Dossier;
|
||||
|
||||
constructor(
|
||||
permissionsService: PermissionsService,
|
||||
activeDossiersService: ActiveDossiersService,
|
||||
private readonly _dictionaryService: DictionaryService,
|
||||
protected readonly _dialogRef: MatDialogRef<AcceptRecommendationDialogComponent, AcceptRecommendationReturnType>,
|
||||
@Inject(MAT_DIALOG_DATA) readonly data: AcceptRecommendationData,
|
||||
) {
|
||||
super(_dialogRef);
|
||||
this._dossier = activeDossiersService.find(this.data.dossierId);
|
||||
const isDocumentAdmin = permissionsService.isApprover(this._dossier);
|
||||
const isDocumentAdmin = permissionsService.isApprover(this.#dossier);
|
||||
this.dialogHeader = isDocumentAdmin
|
||||
? acceptRecommendationTranslations.addToDictionary
|
||||
: acceptRecommendationTranslations.requestAddToDictionary;
|
||||
@ -55,7 +51,7 @@ export class AcceptRecommendationDialogComponent extends BaseDialogComponent imp
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
this.possibleDictionaries = await this._dictionaryService.getDictionariesOptions(this._dossier.dossierTemplateId, this._dossier.id);
|
||||
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,
|
||||
});
|
||||
@ -78,7 +74,7 @@ export class AcceptRecommendationDialogComponent extends BaseDialogComponent imp
|
||||
);
|
||||
}
|
||||
|
||||
private _getForm(): UntypedFormGroup {
|
||||
private _getForm() {
|
||||
return this._formBuilder.group({
|
||||
dictionary: [Validators.required],
|
||||
comment: [null],
|
||||
|
||||
@ -7,7 +7,6 @@ import { type AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { type ManualRedactionEntryType } from '@models/file/manual-redaction-entry.wrapper';
|
||||
import type {
|
||||
DictionaryActions,
|
||||
Dossier,
|
||||
IAddRedactionRequest,
|
||||
ILegalBasisChangeRequest,
|
||||
IManualAddResponse,
|
||||
@ -16,8 +15,6 @@ import type {
|
||||
IResizeRequest,
|
||||
ManualRedactionActions,
|
||||
} from '@red/domain';
|
||||
import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { dictionaryActionsTranslations, manualRedactionActionsTranslations } from '@translations/annotation-actions-translations';
|
||||
import { Roles } from '@users/roles';
|
||||
import { NGXLogger } from 'ngx-logger';
|
||||
@ -41,15 +38,12 @@ function getMessage(action: ManualRedactionActions, isDictionary = false, error
|
||||
@Injectable()
|
||||
export class ManualRedactionService extends GenericService<IManualAddResponse> {
|
||||
protected readonly _defaultModelPath = 'manualRedaction';
|
||||
readonly #bulkRequest = `${this._defaultModelPath}/bulk/request`;
|
||||
readonly #bulkRedaction = `${this._defaultModelPath}/bulk/redaction`;
|
||||
|
||||
constructor(
|
||||
private readonly _toaster: Toaster,
|
||||
private readonly _logger: NGXLogger,
|
||||
private readonly _permissionsService: PermissionsService,
|
||||
private readonly _iqaerPermissionsService: IqserPermissionsService,
|
||||
private readonly _activeDossiersService: ActiveDossiersService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
@ -112,14 +106,6 @@ export class ManualRedactionService extends GenericService<IManualAddResponse> {
|
||||
return this.undo(annotationIds, dossierId, fileId).pipe(this.#showToast('undo', modifyDictionary));
|
||||
}
|
||||
|
||||
declineOrRemove(annotationIds: List, dossierId: string, fileId: string, modifyDictionary = false) {
|
||||
if (this._permissionsService.isApprover(this.#dossier(dossierId))) {
|
||||
return this.decline(annotationIds, dossierId, fileId).pipe(this.#showToast('decline', modifyDictionary));
|
||||
}
|
||||
|
||||
return this.undo(annotationIds, dossierId, fileId).pipe(this.#showToast('undo', modifyDictionary));
|
||||
}
|
||||
|
||||
removeRedaction(body: List<IRemoveRedactionRequest>, dossierId: string, fileId: string, removeFromDictionary = false, isHint = false) {
|
||||
return this.remove(body, dossierId, fileId).pipe(this.#showToast(!isHint ? 'remove' : 'remove-hint', removeFromDictionary));
|
||||
}
|
||||
@ -151,12 +137,6 @@ export class ManualRedactionService extends GenericService<IManualAddResponse> {
|
||||
);
|
||||
}
|
||||
|
||||
requestLegalBasisChange(body: List<ILegalBasisChangeRequest>, dossierId: string, fileId: string) {
|
||||
return this._post(body, `${this.#bulkRequest}/legalBasis/${dossierId}/${fileId}`).pipe(
|
||||
this.#log('Request legal basis change', body),
|
||||
);
|
||||
}
|
||||
|
||||
approve(annotationIds: List, dossierId: string, fileId: string) {
|
||||
return this._post(annotationIds, `${this._defaultModelPath}/bulk/approve/${dossierId}/${fileId}`).pipe(
|
||||
this.#log('Approve', annotationIds),
|
||||
@ -222,8 +202,4 @@ export class ManualRedactionService extends GenericService<IManualAddResponse> {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
#dossier(dossierId: string): Dossier {
|
||||
return this._activeDossiersService.find(dossierId);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user