[angular-16-irish-monitor]: Add method to get the label of an option in stakeholder-base component

This commit is contained in:
Konstantinos Triantafyllou 2023-11-16 11:45:07 +02:00
parent 16b6a34d25
commit fc58721e2a
3 changed files with 9 additions and 1 deletions

View File

@ -83,6 +83,11 @@ export class StakeholderUtils {
return options.length > 1; return options.length > 1;
} }
getLabel(options: Option[], value) {
let option = options.find(option => option.value === value);
return option?option.label:null;
}
getTypesByUserRoles(user, id: string = null): Option[] { getTypesByUserRoles(user, id: string = null): Option[] {
let types = []; let types = [];
for (let type of this.types) { for (let type of this.types) {

View File

@ -23,6 +23,10 @@ export abstract class StakeholderBaseComponent extends BaseComponent {
return this.stakeholderUtils.showField(this.stakeholderUtils.funderTypes); return this.stakeholderUtils.showField(this.stakeholderUtils.funderTypes);
} }
getFunderTypeLabel(value: any) {
return this.stakeholderUtils.getLabel(this.stakeholderUtils.funderTypes, value);
}
get showLocale() { get showLocale() {
return this.stakeholderUtils.showField(this.stakeholderUtils.locales); return this.stakeholderUtils.showField(this.stakeholderUtils.locales);
} }

View File

@ -204,7 +204,6 @@ export abstract class MonitorIndicatorStakeholderBaseComponent extends Indicator
//clear numbers when filters change //clear numbers when filters change
this.numberResults.clear(); this.numberResults.clear();
let urls: Map<string, [number, number][]> = new Map<string, [number, number][]>(); let urls: Map<string, [number, number][]> = new Map<string, [number, number][]>();
console.log(this.activeSubCategory.numbers);
this.activeSubCategory.numbers.forEach((section, i) => { this.activeSubCategory.numbers.forEach((section, i) => {
section.indicators.forEach((number, j) => { section.indicators.forEach((number, j) => {
if (this.hasPermission(number.visibility)) { if (this.hasPermission(number.visibility)) {