RED-7023 - Option to compare (effective) dossier dictionary with template dictionary
This commit is contained in:
parent
44de3b09dd
commit
1a21dcd286
@ -64,7 +64,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<div *ngIf="!filterByDossierTemplate && activeDossiersService.all$ | async as dossiers" class="iqser-input-group w-200 mt-0">
|
<div *ngIf="!filterByDossierTemplate && !!dossiers.length" class="iqser-input-group w-200 mt-0">
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select [(ngModel)]="dossier" [disabled]="!compare">
|
<mat-select [(ngModel)]="dossier" [disabled]="!compare">
|
||||||
<mat-option [value]="selectDossier">{{ selectDossier.dossierName | translate }}</mat-option>
|
<mat-option [value]="selectDossier">{{ selectDossier.dossierName | translate }}</mat-option>
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import {
|
|||||||
DictionaryType,
|
DictionaryType,
|
||||||
Dossier,
|
Dossier,
|
||||||
DossierTemplate,
|
DossierTemplate,
|
||||||
|
IDictionary,
|
||||||
} from '@red/domain';
|
} from '@red/domain';
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
import { DictionaryService } from '@services/entity-services/dictionary.service';
|
import { DictionaryService } from '@services/entity-services/dictionary.service';
|
||||||
@ -50,6 +51,7 @@ export class DictionaryManagerComponent implements OnChanges {
|
|||||||
@Output() readonly saveDictionary = new EventEmitter<string[]>();
|
@Output() readonly saveDictionary = new EventEmitter<string[]>();
|
||||||
@ViewChild(EditorComponent) readonly editor: EditorComponent;
|
@ViewChild(EditorComponent) readonly editor: EditorComponent;
|
||||||
readonly iconButtonTypes = IconButtonTypes;
|
readonly iconButtonTypes = IconButtonTypes;
|
||||||
|
readonly dossiers: Dossier[];
|
||||||
currentMatch = 0;
|
currentMatch = 0;
|
||||||
findMatches: FindMatch[] = [];
|
findMatches: FindMatch[] = [];
|
||||||
diffEditorText = '';
|
diffEditorText = '';
|
||||||
@ -71,7 +73,16 @@ export class DictionaryManagerComponent implements OnChanges {
|
|||||||
private readonly _changeRef: ChangeDetectorRef,
|
private readonly _changeRef: ChangeDetectorRef,
|
||||||
readonly activeDossiersService: ActiveDossiersService,
|
readonly activeDossiersService: ActiveDossiersService,
|
||||||
readonly dossierTemplatesService: DossierTemplatesService,
|
readonly dossierTemplatesService: DossierTemplatesService,
|
||||||
) {}
|
) {
|
||||||
|
this.dossiers = activeDossiersService.all;
|
||||||
|
const templateDictionary = {
|
||||||
|
id: 'template',
|
||||||
|
dossierId: 'template',
|
||||||
|
dossierName: 'Template Dictionary',
|
||||||
|
dossierTemplateId: this.dossiers[0]?.dossierTemplateId,
|
||||||
|
} as Dossier;
|
||||||
|
this.dossiers.push(templateDictionary);
|
||||||
|
}
|
||||||
|
|
||||||
private _dossierTemplate = this.selectDossierTemplate;
|
private _dossierTemplate = this.selectDossierTemplate;
|
||||||
|
|
||||||
@ -242,11 +253,16 @@ export class DictionaryManagerComponent implements OnChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async #onDossierChanged(dossierTemplateId: string, dossierId?: string) {
|
async #onDossierChanged(dossierTemplateId: string, dossierId?: string) {
|
||||||
const dictionary = (
|
let dictionary: IDictionary;
|
||||||
await firstValueFrom(
|
if (dossierId === 'template') {
|
||||||
this._dictionaryService.loadDictionaryEntriesByType([this.selectedDictionaryType], dossierTemplateId, dossierId),
|
dictionary = await this._dictionaryService.getForType(dossierTemplateId, this.selectedDictionaryType);
|
||||||
)
|
} else {
|
||||||
)[0];
|
dictionary = (
|
||||||
|
await firstValueFrom(
|
||||||
|
this._dictionaryService.loadDictionaryEntriesByType([this.selectedDictionaryType], dossierTemplateId, dossierId),
|
||||||
|
)
|
||||||
|
)[0];
|
||||||
|
}
|
||||||
const activeEntries =
|
const activeEntries =
|
||||||
this.activeEntryType === DictionaryEntryTypes.ENTRY || this.hint
|
this.activeEntryType === DictionaryEntryTypes.ENTRY || this.hint
|
||||||
? [...dictionary.entries]
|
? [...dictionary.entries]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user