RED-6801 - Effective dossier dictionary in Dossier Settings

This commit is contained in:
Valentin Mihai 2023-08-19 13:24:19 +03:00
parent 2e42d491b3
commit b2b1129590
3 changed files with 5 additions and 34 deletions

View File

@ -104,7 +104,8 @@ export class EditDossierDictionaryComponent implements OnInit {
async #updateDossierDictionary() {
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._dictionaryService.loadDictionaryEntriesByType(dictionaryTypes, dossierTemplateId, dossierId),
);

View File

@ -211,6 +211,9 @@ export class DictionaryManagerComponent implements OnChanges {
this.showDiffEditor = true;
});
}
if (changes.selectedDictionaryType) {
this.searchText = '';
}
}
private _applySearchDecorations() {

View File

@ -203,39 +203,6 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
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[] {
const possibleDictionaries: Dictionary[] = [];