Merge branch 'master' into VM/RED-8748
This commit is contained in:
commit
1d2485db3c
@ -47,7 +47,7 @@ export class DossierFilesGuard implements CanActivate {
|
|||||||
const promises = [];
|
const promises = [];
|
||||||
|
|
||||||
if (!this._dictionaryMapService.has(dossierId) && !this.isDocumine) {
|
if (!this._dictionaryMapService.has(dossierId) && !this.isDocumine) {
|
||||||
const dictionaryPromise = this._dictionaryService.loadDossierRedaction(dossierTemplateId, dossierId);
|
const dictionaryPromise = firstValueFrom(this._dictionaryService.loadDictionaryDataForDossier(dossierTemplateId, dossierId));
|
||||||
promises.push(dictionaryPromise);
|
promises.push(dictionaryPromise);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -108,7 +108,7 @@ export class AddHintDialogComponent extends IqserDialogComponent<AddHintDialogCo
|
|||||||
|
|
||||||
#setDictionaries() {
|
#setDictionaries() {
|
||||||
this.dictionaries = this._dictionaryService.getAddHintDictionaries(
|
this.dictionaries = this._dictionaryService.getAddHintDictionaries(
|
||||||
this.#dossier.dossierTemplateId,
|
this.#dossier.dossierId,
|
||||||
!this.#applyToAllDossiers,
|
!this.#applyToAllDossiers,
|
||||||
this.dictionaryRequest,
|
this.dictionaryRequest,
|
||||||
);
|
);
|
||||||
|
|||||||
@ -79,9 +79,7 @@ export class EditRedactionDialogComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
get redactBasedTypes() {
|
get redactBasedTypes() {
|
||||||
return this._dictionaryService
|
return this._dictionaryService.getRedactionTypes(this.#dossier.dossierTemplateId).map(dictionary => dictionary.type);
|
||||||
.getRedactTextDictionaries(this.#dossier.dossierTemplateId, !this.#applyToAllDossiers)
|
|
||||||
.map(dictionary => dictionary.type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get isRedactBasedType() {
|
get isRedactBasedType() {
|
||||||
|
|||||||
@ -78,7 +78,7 @@ export class ManualAnnotationDialogComponent extends BaseDialogComponent impleme
|
|||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.possibleDictionaries = this.isDictionaryRequest
|
this.possibleDictionaries = this.isDictionaryRequest
|
||||||
? await this._dictionaryService.getDictionariesOptions(this.#dossier.dossierTemplateId, this.#dossier.id)
|
? this._dictionaryService.getDictionariesOptions(this.#dossier.dossierTemplateId)
|
||||||
: this._dictionaryService.getRedactionTypes(this.#dossier.dossierTemplateId);
|
: this._dictionaryService.getRedactionTypes(this.#dossier.dossierTemplateId);
|
||||||
|
|
||||||
const data = await firstValueFrom(this._justificationsService.getForDossierTemplate(this.#dossier.dossierTemplateId));
|
const data = await firstValueFrom(this._justificationsService.getForDossierTemplate(this.#dossier.dossierTemplateId));
|
||||||
|
|||||||
@ -115,7 +115,7 @@ export class RedactRecommendationDialogComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
#setDictionaries() {
|
#setDictionaries() {
|
||||||
this.dictionaries = this._dictionaryService.getRedactTextDictionaries(this.#dossier.dossierTemplateId, !this.#applyToAllDossiers);
|
this.dictionaries = this._dictionaryService.getRedactTextDictionaries(this.#dossier.dossierId, !this.#applyToAllDossiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
#selectReason() {
|
#selectReason() {
|
||||||
|
|||||||
@ -157,7 +157,7 @@ export class RedactTextDialogComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
#setDictionaries() {
|
#setDictionaries() {
|
||||||
this.dictionaries = this._dictionaryService.getRedactTextDictionaries(this.#dossier.dossierTemplateId, !this.#applyToAllDossiers);
|
this.dictionaries = this._dictionaryService.getRedactTextDictionaries(this.#dossier.dossierId, !this.#applyToAllDossiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
#getForm(): FormGroup {
|
#getForm(): FormGroup {
|
||||||
|
|||||||
@ -0,0 +1,33 @@
|
|||||||
|
<section class="dialog">
|
||||||
|
<div
|
||||||
|
[innerHTML]="'edit-dossier-dialog.dictionary.edit-dialog.title' | translate: { label: data.label }"
|
||||||
|
class="dialog-header heading-l"
|
||||||
|
></div>
|
||||||
|
|
||||||
|
<form (submit)="save()" [formGroup]="form">
|
||||||
|
<div class="dialog-content">
|
||||||
|
<div class="iqser-input-group w-300">
|
||||||
|
<mat-checkbox formControlName="addToDictionaryAction">
|
||||||
|
{{ 'edit-dossier-dialog.dictionary.edit-dialog.add-to-dictionary-action' | translate }}
|
||||||
|
</mat-checkbox>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="dialog-actions" *ngIf="data.canEdit">
|
||||||
|
<iqser-icon-button
|
||||||
|
[disabled]="!form.valid || !changed"
|
||||||
|
[label]="'edit-dossier-dialog.dictionary.edit-dialog.save' | translate"
|
||||||
|
[submit]="true"
|
||||||
|
[type]="iconButtonTypes.primary"
|
||||||
|
></iqser-icon-button>
|
||||||
|
|
||||||
|
<div
|
||||||
|
[translate]="'edit-dossier-dialog.dictionary.edit-dialog.cancel'"
|
||||||
|
class="all-caps-label pointer cancel"
|
||||||
|
mat-dialog-close
|
||||||
|
></div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<iqser-circle-button class="dialog-close" icon="iqser:close" mat-dialog-close></iqser-circle-button>
|
||||||
|
</section>
|
||||||
@ -0,0 +1,81 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import {
|
||||||
|
CircleButtonComponent,
|
||||||
|
IconButtonComponent,
|
||||||
|
IconButtonTypes,
|
||||||
|
IqserDialogComponent,
|
||||||
|
LoadingService,
|
||||||
|
Toaster,
|
||||||
|
} from '@iqser/common-ui';
|
||||||
|
import { MatDialogClose } from '@angular/material/dialog';
|
||||||
|
import { MatFormField } from '@angular/material/form-field';
|
||||||
|
import { NgIf } from '@angular/common';
|
||||||
|
import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { MatCheckbox } from '@angular/material/checkbox';
|
||||||
|
import { DictionaryService } from '@services/entity-services/dictionary.service';
|
||||||
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
|
|
||||||
|
interface DialogData {
|
||||||
|
addToDictionaryAction: boolean;
|
||||||
|
label: string;
|
||||||
|
type: string;
|
||||||
|
dossierTemplateId: string;
|
||||||
|
dossierId: string;
|
||||||
|
canEdit: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ReturnType {
|
||||||
|
addToDictionaryAction: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'redaction-edit-dictionary-dialog',
|
||||||
|
standalone: true,
|
||||||
|
imports: [
|
||||||
|
CircleButtonComponent,
|
||||||
|
IconButtonComponent,
|
||||||
|
MatDialogClose,
|
||||||
|
MatFormField,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
TranslateModule,
|
||||||
|
MatCheckbox,
|
||||||
|
NgIf,
|
||||||
|
],
|
||||||
|
templateUrl: './edit-dictionary-dialog.component.html',
|
||||||
|
})
|
||||||
|
export class EditDictionaryDialogComponent extends IqserDialogComponent<EditDictionaryDialogComponent, DialogData, ReturnType> {
|
||||||
|
readonly form = this._formBuilder.group({
|
||||||
|
addToDictionaryAction: [{ value: this.data.addToDictionaryAction, disabled: !this.data.canEdit }],
|
||||||
|
});
|
||||||
|
readonly initialFormValue = this.form.getRawValue();
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private _formBuilder: FormBuilder,
|
||||||
|
private _dictionaryService: DictionaryService,
|
||||||
|
private _loadingService: LoadingService,
|
||||||
|
private _toaster: Toaster,
|
||||||
|
) {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
async save() {
|
||||||
|
this._loadingService.start();
|
||||||
|
try {
|
||||||
|
await this._dictionaryService.updateFlag(
|
||||||
|
this.data.dossierTemplateId,
|
||||||
|
this.data.type,
|
||||||
|
this.data.dossierId,
|
||||||
|
this.form.controls.addToDictionaryAction.value,
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
this._toaster.error(_('edit-dossier-dialog.dictionary.edit-dialog.error.generic'));
|
||||||
|
}
|
||||||
|
|
||||||
|
this._loadingService.stop();
|
||||||
|
this.close(this.form.value as ReturnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected readonly iconButtonTypes = IconButtonTypes;
|
||||||
|
}
|
||||||
@ -35,6 +35,13 @@
|
|||||||
<div class="heading">
|
<div class="heading">
|
||||||
<div class="flex-align-items-center">
|
<div class="flex-align-items-center">
|
||||||
{{ selectedDictionary?.label }}
|
{{ selectedDictionary?.label }}
|
||||||
|
<iqser-circle-button
|
||||||
|
*ngIf="selectedDictionary.dossierDictionaryOnly && selectedDictionary.hasDictionary"
|
||||||
|
(action)="openEditDictionaryModal()"
|
||||||
|
[size]="20"
|
||||||
|
icon="iqser:edit"
|
||||||
|
class="p-left-8"
|
||||||
|
></iqser-circle-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="small-label stats-subtitle">
|
<div class="small-label stats-subtitle">
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@ -72,3 +72,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.p-left-8 {
|
||||||
|
padding-left: 8px;
|
||||||
|
}
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
import { Component, Input, OnInit, ViewChild } from '@angular/core';
|
import { Component, Input, OnInit, ViewChild } from '@angular/core';
|
||||||
import { LoadingService } from '@iqser/common-ui';
|
import { IqserDialog, LoadingService } from '@iqser/common-ui';
|
||||||
import { List } from '@iqser/common-ui/lib/utils';
|
import { List } from '@iqser/common-ui/lib/utils';
|
||||||
import { Dictionary, DictionaryEntryType, DictionaryEntryTypes, Dossier } from '@red/domain';
|
import { Dictionary, DictionaryEntryType, DictionaryEntryTypes, Dossier } from '@red/domain';
|
||||||
import { DictionaryService } from '@services/entity-services/dictionary.service';
|
import { DictionaryService } from '@services/entity-services/dictionary.service';
|
||||||
import { PermissionsService } from '@services/permissions.service';
|
import { PermissionsService } from '@services/permissions.service';
|
||||||
import { DictionaryManagerComponent } from '@shared/components/dictionary-manager/dictionary-manager.component';
|
import { DictionaryManagerComponent } from '@shared/components/dictionary-manager/dictionary-manager.component';
|
||||||
import { firstValueFrom } from 'rxjs';
|
import { firstValueFrom } from 'rxjs';
|
||||||
import { DossiersDialogService } from '../../../services/dossiers-dialog.service';
|
|
||||||
import { EditDossierSaveResult } from '../edit-dossier-section.interface';
|
import { EditDossierSaveResult } from '../edit-dossier-section.interface';
|
||||||
|
import { EditDictionaryDialogComponent } from '../../edit-dictionary-dialog/edit-dictionary-dialog.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-edit-dossier-dictionary',
|
selector: 'redaction-edit-dossier-dictionary',
|
||||||
@ -17,6 +17,7 @@ import { EditDossierSaveResult } from '../edit-dossier-section.interface';
|
|||||||
export class EditDossierDictionaryComponent implements OnInit {
|
export class EditDossierDictionaryComponent implements OnInit {
|
||||||
@Input() dossier: Dossier;
|
@Input() dossier: Dossier;
|
||||||
canEdit = false;
|
canEdit = false;
|
||||||
|
canEditDictionaryFlag = false;
|
||||||
dictionaries: Dictionary[];
|
dictionaries: Dictionary[];
|
||||||
selectedDictionary: Dictionary;
|
selectedDictionary: Dictionary;
|
||||||
activeEntryType = DictionaryEntryTypes.ENTRY;
|
activeEntryType = DictionaryEntryTypes.ENTRY;
|
||||||
@ -40,12 +41,13 @@ export class EditDossierDictionaryComponent implements OnInit {
|
|||||||
private readonly _dictionaryService: DictionaryService,
|
private readonly _dictionaryService: DictionaryService,
|
||||||
private readonly _permissionsService: PermissionsService,
|
private readonly _permissionsService: PermissionsService,
|
||||||
private readonly _loadingService: LoadingService,
|
private readonly _loadingService: LoadingService,
|
||||||
private readonly _dialogService: DossiersDialogService,
|
private readonly _iqserDialog: IqserDialog,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
this.canEdit = this._permissionsService.canEditDossierDictionary(this.dossier);
|
this.canEdit = this._permissionsService.canEditDossierDictionary(this.dossier);
|
||||||
|
this.canEditDictionaryFlag = this._permissionsService.isOwner(this.dossier);
|
||||||
await this.#updateDossierDictionary();
|
await this.#updateDossierDictionary();
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
}
|
}
|
||||||
@ -101,19 +103,27 @@ export class EditDossierDictionaryComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async #updateDossierDictionary() {
|
async openEditDictionaryModal() {
|
||||||
const { dossierId, dossierTemplateId } = this.dossier;
|
const { dossierId, dossierTemplateId } = this.dossier;
|
||||||
let dictionaryTypes = [
|
const result = await this._iqserDialog
|
||||||
...this._dictionaryService.getRedactTextDictionaries(dossierTemplateId, true),
|
.openDefault(EditDictionaryDialogComponent, {
|
||||||
...this._dictionaryService.getAddHintDictionaries(dossierTemplateId, false, true),
|
data: {
|
||||||
].map(d => d.type);
|
addToDictionaryAction: this.selectedDictionary.addToDictionaryAction,
|
||||||
dictionaryTypes = [...new Set(dictionaryTypes)];
|
label: this.selectedDictionary.label,
|
||||||
this.dictionaries = await firstValueFrom(
|
type: this.selectedDictionary.type,
|
||||||
this._dictionaryService.loadDictionaryEntriesByType(dictionaryTypes, dossierTemplateId, dossierId),
|
dossierId,
|
||||||
);
|
dossierTemplateId,
|
||||||
//TODO remove this when backend will send also the type
|
canEdit: this.canEditDictionaryFlag,
|
||||||
this.#setType(dictionaryTypes);
|
},
|
||||||
this.dictionaries = this.dictionaries.sort((a, b) => a.label.localeCompare(b.label));
|
})
|
||||||
|
.result();
|
||||||
|
|
||||||
|
this.selectedDictionary = { ...this.selectedDictionary, addToDictionaryAction: result.addToDictionaryAction } as Dictionary;
|
||||||
|
await this.#retrieveDictionaries();
|
||||||
|
}
|
||||||
|
|
||||||
|
async #updateDossierDictionary() {
|
||||||
|
await this.#retrieveDictionaries();
|
||||||
let dictionaryToSelect = this.dictionaries[0];
|
let dictionaryToSelect = this.dictionaries[0];
|
||||||
if (this.selectedDictionary) {
|
if (this.selectedDictionary) {
|
||||||
dictionaryToSelect = this.dictionaries.find(d => d.type === this.selectedDictionary.type);
|
dictionaryToSelect = this.dictionaries.find(d => d.type === this.selectedDictionary.type);
|
||||||
@ -121,6 +131,17 @@ export class EditDossierDictionaryComponent implements OnInit {
|
|||||||
this.selectDictionary(dictionaryToSelect, this.activeEntryType);
|
this.selectDictionary(dictionaryToSelect, this.activeEntryType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async #retrieveDictionaries() {
|
||||||
|
const { dossierId, dossierTemplateId } = this.dossier;
|
||||||
|
const dictionaryTypes = [...new Set(this._dictionaryService.getDictionaries(dossierTemplateId).map(d => d.type))];
|
||||||
|
this.dictionaries = await firstValueFrom(
|
||||||
|
this._dictionaryService.loadDictionaryEntriesByType(dictionaryTypes, dossierTemplateId, dossierId),
|
||||||
|
);
|
||||||
|
//TODO remove this when backend will send also the type
|
||||||
|
this.#setType(dictionaryTypes);
|
||||||
|
this.dictionaries.sort((a, b) => a.label.localeCompare(b.label));
|
||||||
|
}
|
||||||
|
|
||||||
//TODO remove this when backend will send also the type
|
//TODO remove this when backend will send also the type
|
||||||
#setType(dictionaryTypes: string[]) {
|
#setType(dictionaryTypes: string[]) {
|
||||||
for (let i = 0; i < this.dictionaries.length; i++) {
|
for (let i = 0; i < this.dictionaries.length; i++) {
|
||||||
|
|||||||
@ -30,6 +30,7 @@ import { IqserUsersModule } from '@iqser/common-ui/lib/users';
|
|||||||
import { SideNavComponent, SmallChipComponent, StatusBarComponent } from '@iqser/common-ui/lib/shared';
|
import { SideNavComponent, SmallChipComponent, StatusBarComponent } from '@iqser/common-ui/lib/shared';
|
||||||
import { SelectComponent } from '@shared/components/select/select.component';
|
import { SelectComponent } from '@shared/components/select/select.component';
|
||||||
import { SnakeCasePipe } from '@common-ui/pipes/snake-case.pipe';
|
import { SnakeCasePipe } from '@common-ui/pipes/snake-case.pipe';
|
||||||
|
import { EditDictionaryDialogComponent } from './dialogs/edit-dictionary-dialog/edit-dictionary-dialog.component';
|
||||||
|
|
||||||
const components = [
|
const components = [
|
||||||
FileActionsComponent,
|
FileActionsComponent,
|
||||||
@ -69,6 +70,7 @@ const dialogs = [EditDossierDialogComponent, AssignReviewerApproverDialogCompone
|
|||||||
IqserDenyDirective,
|
IqserDenyDirective,
|
||||||
SelectComponent,
|
SelectComponent,
|
||||||
SnakeCasePipe,
|
SnakeCasePipe,
|
||||||
|
EditDictionaryDialogComponent,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class SharedDossiersModule {}
|
export class SharedDossiersModule {}
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
|||||||
import { EntitiesService, QueryParam, Toaster } from '@iqser/common-ui';
|
import { EntitiesService, QueryParam, Toaster } from '@iqser/common-ui';
|
||||||
import { List } from '@iqser/common-ui/lib/utils';
|
import { List } from '@iqser/common-ui/lib/utils';
|
||||||
import { Dictionary, DictionaryEntryType, DictionaryEntryTypes, IDictionary, IUpdateDictionary, SuperTypes } from '@red/domain';
|
import { Dictionary, DictionaryEntryType, DictionaryEntryTypes, IDictionary, IUpdateDictionary, SuperTypes } from '@red/domain';
|
||||||
import { DossierDictionariesMapService } from '@services/entity-services/dossier-dictionaries-map.service';
|
|
||||||
import { firstValueFrom, forkJoin, Observable } from 'rxjs';
|
import { firstValueFrom, forkJoin, Observable } from 'rxjs';
|
||||||
import { map, switchMap, tap } from 'rxjs/operators';
|
import { map, switchMap, tap } from 'rxjs/operators';
|
||||||
import { IMAGE_CATEGORIES } from '../../modules/file-preview/utils/constants';
|
import { IMAGE_CATEGORIES } from '../../modules/file-preview/utils/constants';
|
||||||
@ -24,7 +23,6 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
|
|||||||
private readonly _toaster: Toaster,
|
private readonly _toaster: Toaster,
|
||||||
private readonly _dossierTemplateStatsService: DossierTemplateStatsService,
|
private readonly _dossierTemplateStatsService: DossierTemplateStatsService,
|
||||||
private readonly _dictionariesMapService: DictionariesMapService,
|
private readonly _dictionariesMapService: DictionariesMapService,
|
||||||
private readonly _dossierDictionariesMapService: DossierDictionariesMapService,
|
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
@ -75,6 +73,16 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
|
|||||||
return await firstValueFrom(request);
|
return await firstValueFrom(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async updateFlag(dossierTemplateId: string, type: string, dossierId: string, addToDictionary: boolean): Promise<unknown> {
|
||||||
|
const url = `${this._defaultModelPath}/updateFlag/${type}/${dossierTemplateId}/${dossierId}`;
|
||||||
|
const queryParams = [{ key: 'addToDictionary', value: addToDictionary }];
|
||||||
|
const request = this._post(null, url, queryParams).pipe(
|
||||||
|
switchMap(() => this.loadDictionaryDataForDossier(dossierTemplateId, dossierId)),
|
||||||
|
);
|
||||||
|
|
||||||
|
return await firstValueFrom(request);
|
||||||
|
}
|
||||||
|
|
||||||
async add(dictionary: IDictionary, dossierId?: string): Promise<unknown> {
|
async add(dictionary: IDictionary, dossierId?: string): Promise<unknown> {
|
||||||
const queryParams = dossierId ? [{ key: 'dossierId', value: dossierId }] : undefined;
|
const queryParams = dossierId ? [{ key: 'dossierId', value: dossierId }] : undefined;
|
||||||
const request = this._post(dictionary, `${this._defaultModelPath}/type`, queryParams).pipe(
|
const request = this._post(dictionary, `${this._defaultModelPath}/type`, queryParams).pipe(
|
||||||
@ -142,9 +150,14 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
|
|||||||
return !!this._dictionariesMapService.get(dossierTemplateId).find(e => e.type === type && !e.virtual);
|
return !!this._dictionariesMapService.get(dossierTemplateId).find(e => e.type === type && !e.virtual);
|
||||||
}
|
}
|
||||||
|
|
||||||
getRedactTextDictionaries(dossierTemplateId: string, dossierDictionaryOnly: boolean): Dictionary[] {
|
getDictionaries(dossierTemplateId: string) {
|
||||||
return this._dictionariesMapService
|
return this._dictionariesMapService
|
||||||
.get(dossierTemplateId)
|
.get(dossierTemplateId)
|
||||||
|
.filter(d => d.model['typeId'] && (d.dossierDictionaryOnly || d.addToDictionaryAction));
|
||||||
|
}
|
||||||
|
|
||||||
|
getRedactTextDictionaries(dossierId: string, dossierDictionaryOnly: boolean): Dictionary[] {
|
||||||
|
return this.#extractDossierLevelTypes(dossierId)
|
||||||
.filter(d => d.model['typeId'] && !d.hint && d.addToDictionaryAction && (dossierDictionaryOnly || !d.dossierDictionaryOnly))
|
.filter(d => d.model['typeId'] && !d.hint && d.addToDictionaryAction && (dossierDictionaryOnly || !d.dossierDictionaryOnly))
|
||||||
.sort((a, b) => a.label.localeCompare(b.label));
|
.sort((a, b) => a.label.localeCompare(b.label));
|
||||||
}
|
}
|
||||||
@ -162,10 +175,9 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
|
|||||||
.sort((a, b) => a.label.localeCompare(b.label));
|
.sort((a, b) => a.label.localeCompare(b.label));
|
||||||
}
|
}
|
||||||
|
|
||||||
getAddHintDictionaries(dossierTemplateId: string, dossierDictionaryOnly: boolean, dictionaryRequest: boolean): Dictionary[] {
|
getAddHintDictionaries(dossierId: string, dossierDictionaryOnly: boolean, dictionaryRequest: boolean): Dictionary[] {
|
||||||
const dictionaries: Dictionary[] = [];
|
const dictionaries: Dictionary[] = [];
|
||||||
|
this.#extractDossierLevelTypes(dossierId).forEach((d: Dictionary) => {
|
||||||
this._dictionariesMapService.get(dossierTemplateId).forEach((d: Dictionary) => {
|
|
||||||
if (d.hint) {
|
if (d.hint) {
|
||||||
if (dictionaryRequest) {
|
if (dictionaryRequest) {
|
||||||
if (d.hasDictionary && d.addToDictionaryAction) {
|
if (d.hasDictionary && d.addToDictionaryAction) {
|
||||||
@ -187,59 +199,17 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
|
|||||||
}
|
}
|
||||||
|
|
||||||
getRedactionTypes(dossierTemplateId: string): Dictionary[] {
|
getRedactionTypes(dossierTemplateId: string): Dictionary[] {
|
||||||
const possibleDictionaries: Dictionary[] = [];
|
return this._dictionariesMapService
|
||||||
|
.get(dossierTemplateId)
|
||||||
for (const dictionary of this._dictionariesMapService.get(dossierTemplateId)) {
|
.filter(dictionary => !dictionary.virtual && !dictionary.hint && !dictionary.systemManaged)
|
||||||
if (!dictionary.virtual && !dictionary.hint && !dictionary.systemManaged) {
|
.sort((a, b) => a.label.localeCompare(b.label));
|
||||||
possibleDictionaries.push(dictionary);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return possibleDictionaries.sort((a, b) => a.label.localeCompare(b.label));
|
getDictionariesOptions(dossierTemplateId: string): Dictionary[] {
|
||||||
}
|
return this._dictionariesMapService
|
||||||
|
.get(dossierTemplateId)
|
||||||
async getDictionariesOptions(dossierTemplateId: string, dossierId: string): Promise<Dictionary[]> {
|
.filter(dictionary => !dictionary.virtual && dictionary.addToDictionaryAction)
|
||||||
const possibleDictionaries: Dictionary[] = [];
|
.sort((a, b) => a.label.localeCompare(b.label));
|
||||||
|
|
||||||
const dossierDictionary: Dictionary = this._dossierDictionariesMapService.get(dossierId, 'dossier_redaction');
|
|
||||||
|
|
||||||
for (const dictionary of this._dictionariesMapService.get(dossierTemplateId)) {
|
|
||||||
if (!dictionary.virtual && dictionary.addToDictionaryAction) {
|
|
||||||
possibleDictionaries.push(dictionary);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dossierDictionary?.addToDictionaryAction) {
|
|
||||||
possibleDictionaries.push(dossierDictionary);
|
|
||||||
}
|
|
||||||
|
|
||||||
possibleDictionaries.sort((a, b) => a.label.localeCompare(b.label));
|
|
||||||
|
|
||||||
return possibleDictionaries;
|
|
||||||
}
|
|
||||||
|
|
||||||
async loadDossierRedaction(dossierTemplateId: string, dossierId: string): Promise<Dictionary> {
|
|
||||||
const promise = this.getForType(dossierTemplateId, 'dossier_redaction', dossierId);
|
|
||||||
const dict = await promise.catch(() => undefined);
|
|
||||||
if (dict) {
|
|
||||||
const dictionary = new Dictionary({
|
|
||||||
...dict,
|
|
||||||
type: 'dossier_redaction',
|
|
||||||
});
|
|
||||||
this._dossierDictionariesMapService.set(dossierId, [dictionary]);
|
|
||||||
return dictionary;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._dossierDictionariesMapService.set(dossierId, []);
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
loadDictionaryData(dossierTemplatesIds: string[]): Observable<Dictionary[][]> {
|
|
||||||
const observables: Observable<Dictionary[]>[] = [];
|
|
||||||
for (const dossierTemplateId of dossierTemplatesIds) {
|
|
||||||
observables.push(this.loadDictionaryDataForDossierTemplate(dossierTemplateId));
|
|
||||||
}
|
|
||||||
return forkJoin(observables);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
loadDictionaryDataForDossierTemplate(dossierTemplateId: string): Observable<Dictionary[]> {
|
loadDictionaryDataForDossierTemplate(dossierTemplateId: string): Observable<Dictionary[]> {
|
||||||
@ -248,6 +218,12 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadDictionaryDataForDossier(dossierTemplateId: string, dossierId: string): Observable<Dictionary[]> {
|
||||||
|
return this.getAllDictionaries(dossierTemplateId, false, dossierId).pipe(
|
||||||
|
tap(dictionaries => this._dictionariesMapService.set(dossierId, dictionaries)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
loadTemporaryDictionaryData(dossierTemplateId: string, readOnlyFile = true): Observable<Dictionary[]> {
|
loadTemporaryDictionaryData(dossierTemplateId: string, readOnlyFile = true): Observable<Dictionary[]> {
|
||||||
return this.getAllDictionaries(dossierTemplateId, readOnlyFile);
|
return this.getAllDictionaries(dossierTemplateId, readOnlyFile);
|
||||||
}
|
}
|
||||||
@ -288,4 +264,8 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
|
|||||||
const url = `${this._defaultModelPath}/delete/${type}/${dossierTemplateId}`;
|
const url = `${this._defaultModelPath}/delete/${type}/${dossierTemplateId}`;
|
||||||
return firstValueFrom(this._post(entries, url, queryParams));
|
return firstValueFrom(this._post(entries, url, queryParams));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#extractDossierLevelTypes(dossierId: string) {
|
||||||
|
return this._dictionariesMapService.get(dossierId).filter(dictionary => dictionary.model['typeId']?.includes(dossierId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,7 +16,7 @@ export class FileManagementService extends GenericService<unknown> {
|
|||||||
|
|
||||||
delete(files: List<File>, dossierId: string) {
|
delete(files: List<File>, dossierId: string) {
|
||||||
const fileIds = files.map(f => f.id);
|
const fileIds = files.map(f => f.id);
|
||||||
return super._post(fileIds, `delete/${dossierId}`).pipe(switchMap(() => this.#filesService.loadAll(dossierId)));
|
return super._post(fileIds, `delete/hard-delete/${dossierId}`).pipe(switchMap(() => this.#filesService.loadAll(dossierId)));
|
||||||
}
|
}
|
||||||
|
|
||||||
rotatePage(body: IPageRotationRequest, dossierId: string, fileId: string) {
|
rotatePage(body: IPageRotationRequest, dossierId: string, fileId: string) {
|
||||||
|
|||||||
@ -1142,6 +1142,15 @@
|
|||||||
"change-successful": "Dossier wurde aktualisiert.",
|
"change-successful": "Dossier wurde aktualisiert.",
|
||||||
"delete-successful": "Dossier wurde gelöscht.",
|
"delete-successful": "Dossier wurde gelöscht.",
|
||||||
"dictionary": {
|
"dictionary": {
|
||||||
|
"edit-dialog": {
|
||||||
|
"add-to-dictionary-action": "Available in add/edit dialogs in this dossier",
|
||||||
|
"cancel": "Cancel",
|
||||||
|
"error": {
|
||||||
|
"generic": "Failed to update flag."
|
||||||
|
},
|
||||||
|
"save": "Save",
|
||||||
|
"title": "Edit {label}"
|
||||||
|
},
|
||||||
"entries": "{length} {length, plural, one{entry} other{entries}}",
|
"entries": "{length} {length, plural, one{entry} other{entries}}",
|
||||||
"false-positive-entries": "{length} false positive {length, plural, one{entry} other{entries}}",
|
"false-positive-entries": "{length} false positive {length, plural, one{entry} other{entries}}",
|
||||||
"false-positives": "False positives",
|
"false-positives": "False positives",
|
||||||
|
|||||||
@ -1142,6 +1142,15 @@
|
|||||||
"change-successful": "Dossier {dossierName} was updated.",
|
"change-successful": "Dossier {dossierName} was updated.",
|
||||||
"delete-successful": "Dossier {dossierName} was deleted.",
|
"delete-successful": "Dossier {dossierName} was deleted.",
|
||||||
"dictionary": {
|
"dictionary": {
|
||||||
|
"edit-dialog": {
|
||||||
|
"add-to-dictionary-action": "Available in add/edit dialogs in this dossier",
|
||||||
|
"cancel": "Cancel",
|
||||||
|
"error": {
|
||||||
|
"generic": "Failed to update flag."
|
||||||
|
},
|
||||||
|
"save": "Save",
|
||||||
|
"title": "Edit {label}"
|
||||||
|
},
|
||||||
"entries": "{length} {length, plural, one{entry} other{entries}} to redact",
|
"entries": "{length} {length, plural, one{entry} other{entries}} to redact",
|
||||||
"false-positive-entries": "{length} false positive {length, plural, one{entry} other{entries}}",
|
"false-positive-entries": "{length} false positive {length, plural, one{entry} other{entries}}",
|
||||||
"false-positives": "False positives",
|
"false-positives": "False positives",
|
||||||
|
|||||||
@ -1142,6 +1142,15 @@
|
|||||||
"change-successful": "Dossier wurde aktualisiert.",
|
"change-successful": "Dossier wurde aktualisiert.",
|
||||||
"delete-successful": "Dossier wurde gelöscht.",
|
"delete-successful": "Dossier wurde gelöscht.",
|
||||||
"dictionary": {
|
"dictionary": {
|
||||||
|
"edit-dialog": {
|
||||||
|
"add-to-dictionary-action": "",
|
||||||
|
"cancel": "",
|
||||||
|
"error": {
|
||||||
|
"generic": ""
|
||||||
|
},
|
||||||
|
"save": "",
|
||||||
|
"title": ""
|
||||||
|
},
|
||||||
"entries": "{length} {length, plural, one{entry} other{entries}} to {hint, select, true{annotate} other{redact}}",
|
"entries": "{length} {length, plural, one{entry} other{entries}} to {hint, select, true{annotate} other{redact}}",
|
||||||
"false-positive-entries": "{length} false positive {length, plural, one{entry} other{entries}}",
|
"false-positive-entries": "{length} false positive {length, plural, one{entry} other{entries}}",
|
||||||
"false-positives": "False positives",
|
"false-positives": "False positives",
|
||||||
|
|||||||
@ -1142,6 +1142,15 @@
|
|||||||
"change-successful": "Dossier {dossierName} was updated.",
|
"change-successful": "Dossier {dossierName} was updated.",
|
||||||
"delete-successful": "Dossier {dossierName} was deleted.",
|
"delete-successful": "Dossier {dossierName} was deleted.",
|
||||||
"dictionary": {
|
"dictionary": {
|
||||||
|
"edit-dialog": {
|
||||||
|
"add-to-dictionary-action": "",
|
||||||
|
"cancel": "",
|
||||||
|
"error": {
|
||||||
|
"generic": ""
|
||||||
|
},
|
||||||
|
"save": "",
|
||||||
|
"title": ""
|
||||||
|
},
|
||||||
"entries": "{length} {length, plural, one{entry} other{entries}} to {hint, select, true{annotate} other{redact}}",
|
"entries": "{length} {length, plural, one{entry} other{entries}} to {hint, select, true{annotate} other{redact}}",
|
||||||
"false-positive-entries": "{length} false positive {length, plural, one{entry} other{entries}}",
|
"false-positive-entries": "{length} false positive {length, plural, one{entry} other{entries}}",
|
||||||
"false-positives": "False positives",
|
"false-positives": "False positives",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user