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>
|
||||
</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-select [(ngModel)]="dossier" [disabled]="!compare">
|
||||
<mat-option [value]="selectDossier">{{ selectDossier.dossierName | translate }}</mat-option>
|
||||
|
||||
@ -8,6 +8,7 @@ import {
|
||||
DictionaryType,
|
||||
Dossier,
|
||||
DossierTemplate,
|
||||
IDictionary,
|
||||
} from '@red/domain';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { DictionaryService } from '@services/entity-services/dictionary.service';
|
||||
@ -50,6 +51,7 @@ export class DictionaryManagerComponent implements OnChanges {
|
||||
@Output() readonly saveDictionary = new EventEmitter<string[]>();
|
||||
@ViewChild(EditorComponent) readonly editor: EditorComponent;
|
||||
readonly iconButtonTypes = IconButtonTypes;
|
||||
readonly dossiers: Dossier[];
|
||||
currentMatch = 0;
|
||||
findMatches: FindMatch[] = [];
|
||||
diffEditorText = '';
|
||||
@ -71,7 +73,16 @@ export class DictionaryManagerComponent implements OnChanges {
|
||||
private readonly _changeRef: ChangeDetectorRef,
|
||||
readonly activeDossiersService: ActiveDossiersService,
|
||||
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;
|
||||
|
||||
@ -242,11 +253,16 @@ export class DictionaryManagerComponent implements OnChanges {
|
||||
}
|
||||
|
||||
async #onDossierChanged(dossierTemplateId: string, dossierId?: string) {
|
||||
const dictionary = (
|
||||
await firstValueFrom(
|
||||
this._dictionaryService.loadDictionaryEntriesByType([this.selectedDictionaryType], dossierTemplateId, dossierId),
|
||||
)
|
||||
)[0];
|
||||
let dictionary: IDictionary;
|
||||
if (dossierId === 'template') {
|
||||
dictionary = await this._dictionaryService.getForType(dossierTemplateId, this.selectedDictionaryType);
|
||||
} else {
|
||||
dictionary = (
|
||||
await firstValueFrom(
|
||||
this._dictionaryService.loadDictionaryEntriesByType([this.selectedDictionaryType], dossierTemplateId, dossierId),
|
||||
)
|
||||
)[0];
|
||||
}
|
||||
const activeEntries =
|
||||
this.activeEntryType === DictionaryEntryTypes.ENTRY || this.hint
|
||||
? [...dictionary.entries]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user