44 lines
945 B
TypeScript
44 lines
945 B
TypeScript
|
|
import {Component, Input, OnInit} from '@angular/core';
|
||
|
|
import {InfoBoxComponent} from "../info-box/info-box.component";
|
||
|
|
import {PrioValues} from "../shared/prio-values.model";
|
||
|
|
|
||
|
|
@Component({
|
||
|
|
selector: 'app-pra-goals',
|
||
|
|
templateUrl: './pra-goals.component.html',
|
||
|
|
styleUrls: [
|
||
|
|
'../info-box/info-box.component.css',
|
||
|
|
'./pra-goals.component.css'
|
||
|
|
]
|
||
|
|
})
|
||
|
|
export class PraGoalsComponent extends InfoBoxComponent implements OnInit {
|
||
|
|
|
||
|
|
@Input() data: {
|
||
|
|
core: PrioValues,
|
||
|
|
sig: PrioValues,
|
||
|
|
tade: PrioValues
|
||
|
|
};
|
||
|
|
|
||
|
|
constructor() {
|
||
|
|
super();
|
||
|
|
}
|
||
|
|
|
||
|
|
ngOnInit() {
|
||
|
|
}
|
||
|
|
|
||
|
|
get sumA(): number {
|
||
|
|
return this.sum('A');
|
||
|
|
}
|
||
|
|
|
||
|
|
get sumB(): number {
|
||
|
|
return this.sum('B');
|
||
|
|
}
|
||
|
|
|
||
|
|
get sumC(): number {
|
||
|
|
return this.sum('C');
|
||
|
|
}
|
||
|
|
|
||
|
|
public sum(prio: string) {
|
||
|
|
return ['core', 'sig', 'tade'].reduce((sum,unit) => sum + this.data[unit][prio], 0);
|
||
|
|
}
|
||
|
|
}
|