import {Component} from '@angular/core';
import {PluginBaseFormComponent, PluginEditEvent} from "../../utils/base-plugin.form.component";
import {PluginStats} from "./plugin-stats.component";
@Component({
selector: 'plugin-stats-form',
template: `
External Link
Chart indicators
{{indicator.indicatorPaths[0].name?indicator.name:(indicator.indicatorPaths[0].parameters['title'] )}}
{{ indicator.indicatorPaths[0].parameters['subtitle']? ' ' + indicator.indicatorPaths[0].parameters['subtitle']:''}}
`,
})
export class PluginStatsFormComponent extends PluginBaseFormComponent {
stakeholder = PluginStats.getMockStakeholder();
constructor() {
super()
}
indicatorsChanged(id,$event:PluginEditEvent ){
console.log("before", id,this.pluginObject.disabledIndicators)
let index = this.pluginObject.disabledIndicators.indexOf(id);
if(index !=-1){
this.pluginObject.disabledIndicators.splice(index,1);
}else{
this.pluginObject.disabledIndicators.push(id);
}
$event.value =this.pluginObject.disabledIndicators;
console.log("after",this.pluginObject.disabledIndicators)
this.valuesChanged.emit({field:$event.field, value: $event.value, type: 'parent'})
}
urlValueChanged($event:PluginEditEvent){
console.log($event.field,$event.value)
this.pluginObject['url'][$event.field]=$event.value;
$event.field = "url";
$event.value = this.pluginObject['url'];
this.valuesChanged.emit($event)
}
}