RED-10275: differentiate available types by applyToAll flag state.

This commit is contained in:
Nicoleta Panaghiu 2024-10-29 15:22:48 +02:00
parent 0ba173b4b9
commit 6a9f440b8a
3 changed files with 13 additions and 4 deletions

View File

@ -162,7 +162,11 @@ export class RedactRecommendationDialogComponent
}
#setDictionaries() {
this.dictionaries = this._dictionaryService.getRedactTextDictionaries(this.#dossier.dossierId, !this.#applyToAllDossiers);
this.dictionaries = this._dictionaryService.getRedactTextDictionaries(
this.#dossier.dossierId,
!this.#applyToAllDossiers,
this.#dossier.dossierTemplateId,
);
}
#selectReason() {

View File

@ -219,7 +219,11 @@ export class RedactTextDialogComponent
}
#setDictionaries() {
this.dictionaries = this._dictionaryService.getRedactTextDictionaries(this.#dossier.dossierId, !this.#applyToAllDossiers);
this.dictionaries = this._dictionaryService.getRedactTextDictionaries(
this.#dossier.dossierId,
!this.#applyToAllDossiers,
this.#dossier.dossierTemplateId,
);
}
#getForm(): FormGroup {

View File

@ -152,8 +152,9 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
.filter(d => d.model['typeId'] && (d.hasDictionary || d.addToDictionaryAction));
}
getRedactTextDictionaries(dossierId: string, dossierDictionaryOnly: boolean): Dictionary[] {
return this.#extractDossierLevelTypes(dossierId)
getRedactTextDictionaries(dossierId: string, dossierDictionaryOnly: boolean, dossierTemplateId: string): Dictionary[] {
const types = dossierDictionaryOnly ? this.#extractDossierLevelTypes(dossierId) : this.getDictionariesOptions(dossierTemplateId);
return types
.filter(d => d.model['typeId'] && !d.hint && d.addToDictionaryAction && (dossierDictionaryOnly || !d.dossierDictionaryOnly))
.sort((a, b) => a.label.localeCompare(b.label));
}