RED-6801 - Effective dossier dictionary in Dossier Settings
This commit is contained in:
parent
2e42d491b3
commit
b2b1129590
@ -104,7 +104,8 @@ export class EditDossierDictionaryComponent implements OnInit {
|
|||||||
|
|
||||||
async #updateDossierDictionary() {
|
async #updateDossierDictionary() {
|
||||||
const { dossierId, dossierTemplateId } = this.dossier;
|
const { dossierId, dossierTemplateId } = this.dossier;
|
||||||
const dictionaryTypes = this._dictionaryService.getPossibleDictionaries(dossierTemplateId, false, true).map(d => d.type);
|
let dictionaryTypes = this._dictionaryService.getRedactTextDictionaries(dossierTemplateId, true).map(d => d.type);
|
||||||
|
dictionaryTypes = [...new Set(dictionaryTypes)];
|
||||||
this.dictionaries = await firstValueFrom(
|
this.dictionaries = await firstValueFrom(
|
||||||
this._dictionaryService.loadDictionaryEntriesByType(dictionaryTypes, dossierTemplateId, dossierId),
|
this._dictionaryService.loadDictionaryEntriesByType(dictionaryTypes, dossierTemplateId, dossierId),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -211,6 +211,9 @@ export class DictionaryManagerComponent implements OnChanges {
|
|||||||
this.showDiffEditor = true;
|
this.showDiffEditor = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (changes.selectedDictionaryType) {
|
||||||
|
this.searchText = '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _applySearchDecorations() {
|
private _applySearchDecorations() {
|
||||||
|
|||||||
@ -203,39 +203,6 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
|
|||||||
return dictionaries.sort((a, b) => a.label.localeCompare(b.label));
|
return dictionaries.sort((a, b) => a.label.localeCompare(b.label));
|
||||||
}
|
}
|
||||||
|
|
||||||
getPossibleDictionaries(
|
|
||||||
dossierTemplateId: string,
|
|
||||||
hintTypes: boolean,
|
|
||||||
dossierDictionaryOnly = false,
|
|
||||||
dictionaryRequest = false,
|
|
||||||
): Dictionary[] {
|
|
||||||
const possibleDictionaries: Dictionary[] = [];
|
|
||||||
|
|
||||||
this._dictionariesMapService.get(dossierTemplateId).forEach((d: Dictionary) => {
|
|
||||||
if (!hintTypes) {
|
|
||||||
if (
|
|
||||||
(!d.virtual && !d.hint && !d.systemManaged && d.hasDictionary && d.addToDictionaryAction) ||
|
|
||||||
(dossierDictionaryOnly && d.dossierDictionaryOnly)
|
|
||||||
) {
|
|
||||||
possibleDictionaries.push(d);
|
|
||||||
}
|
|
||||||
} else if (
|
|
||||||
(d.hint && d.hasDictionary && d.addToDictionaryAction && d.type) ||
|
|
||||||
(dictionaryRequest && dossierDictionaryOnly && d.dossierDictionaryOnly)
|
|
||||||
) {
|
|
||||||
if (!dictionaryRequest) {
|
|
||||||
if (!IMAGE_TYPES.includes(d.type)) {
|
|
||||||
possibleDictionaries.push(d);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
possibleDictionaries.push(d);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return possibleDictionaries.sort((a, b) => a.label.localeCompare(b.label));
|
|
||||||
}
|
|
||||||
|
|
||||||
getRedactionTypes(dossierTemplateId: string): Dictionary[] {
|
getRedactionTypes(dossierTemplateId: string): Dictionary[] {
|
||||||
const possibleDictionaries: Dictionary[] = [];
|
const possibleDictionaries: Dictionary[] = [];
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user