Refactor dossiers dialog service: change legal basis

This commit is contained in:
Adina Țeudan 2021-08-09 20:47:44 +03:00
parent 40a361a689
commit dc810ae491
2 changed files with 5 additions and 20 deletions

View File

@ -59,7 +59,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),

View File

@ -28,7 +28,7 @@ const dialogConfig = {
// TODO: Continue refactor
type DialogType = 'confirm' | 'documentInfo' | 'editDossier' | 'addDossier' | 'assignFile' | 'recategorizeImage';
type DialogType = 'confirm' | 'documentInfo' | 'editDossier' | 'addDossier' | 'assignFile' | 'recategorizeImage' | 'changeLegalBasis';
type DossiersDialogConfig = {
[key in DialogType]: {
@ -64,6 +64,9 @@ export class DossiersDialogService extends DialogService<DialogType> {
},
recategorizeImage: {
component: RecategorizeImageDialogComponent
},
changeLegalBasis: {
component: ChangeLegalBasisDialogComponent
}
};
@ -105,24 +108,6 @@ export class DossiersDialogService extends DialogService<DialogType> {
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;
}
openRemoveFromDictionaryDialog(
$event: MouseEvent,
annotations: AnnotationWrapper[],