Merge branch 'VM/RED-7023' into 'master'

RED-7023 - Option to compare (effective) dossier dictionary with template dictionary

Closes RED-7023

See merge request redactmanager/red-ui!157
This commit is contained in:
Dan Percic 2023-10-24 11:24:43 +02:00
commit c58752d001
3 changed files with 20 additions and 12 deletions

View File

@ -130,6 +130,6 @@ export class EditDossierDictionaryComponent implements OnInit {
}
#toString(entries: string[]) {
return entries.sort((a, b) => a.localeCompare(b, undefined, { sensitivity: 'accent' }));
return entries.sort((a, b) => a.localeCompare(b));
}
}

View File

@ -66,13 +66,18 @@
<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>
<mat-select
[(ngModel)]="selectedDossier"
[disabled]="!compare"
[placeholder]="selectedDossier.dossierId ? selectedDossier.dossierName : (selectDictionary.label | translate)"
>
<ng-container *ngFor="let dossier of dossiers; let index = index">
<mat-option [value]="dossier">
<mat-option *ngIf="dossier.dossierId !== selectedDossier.dossierId" [value]="dossier">
{{ dossier.dossierName }}
</mat-option>
<mat-divider *ngIf="index === dossiers.length - 2"></mat-divider>
<mat-divider
*ngIf="index === dossiers.length - 2 && !selectedDossier.dossierId?.includes('template')"
></mat-divider>
</ng-container>
</mat-select>
</mat-form-field>

View File

@ -63,7 +63,7 @@ export class DictionaryManagerComponent implements OnChanges {
} as Dictionary;
#compareDictionary = this.selectDictionary;
selectDossierTemplate = { name: _('dictionary-overview.compare.select-dossier-template') } as DossierTemplate;
compare: false;
compare = false;
dictionaries: List<Dictionary> = this.#dictionaries;
constructor(
@ -99,11 +99,11 @@ export class DictionaryManagerComponent implements OnChanges {
private _dossier = this.selectDossier;
get dossier() {
get selectedDossier() {
return this._dossier;
}
set dossier(dossier: Dossier) {
set selectedDossier(dossier: Dossier) {
this._dossier = dossier;
if (dossier.dossierName === this.selectDossier.dossierName) {
@ -161,7 +161,7 @@ export class DictionaryManagerComponent implements OnChanges {
if (this.filterByDossierTemplate) {
return this.selectDictionary.label === this.#compareDictionary.label;
}
return this.dossier.dossierName === this.selectDossier.dossierName;
return this.selectedDossier.dossierName === this.selectDossier.dossierName;
}
get helpModeKey(): string {
@ -217,7 +217,11 @@ export class DictionaryManagerComponent implements OnChanges {
}
ngOnChanges(changes: SimpleChanges): void {
if ((changes.selectedDictionaryType || changes.activeEntryType) && this._dossier?.dossierTemplateId && this.dossier?.dossierId) {
if (
(changes.selectedDictionaryType || changes.activeEntryType) &&
this._dossier?.dossierTemplateId &&
this.selectedDossier?.dossierId
) {
this.#onDossierChanged(this._dossier.dossierTemplateId, this._dossier.dossierId).then(entries => {
this.diffEditorText = entries;
this.showDiffEditor = true;
@ -273,7 +277,6 @@ export class DictionaryManagerComponent implements OnChanges {
}
#toString(entries: string[]): string {
entries.sort((a, b) => a.localeCompare(b, undefined, { sensitivity: 'accent' }));
return entries.join('\n');
return entries.sort((a, b) => a.localeCompare(b)).join('\n');
}
}