48 lines
1.1 KiB
JavaScript
48 lines
1.1 KiB
JavaScript
import ngModule from '../module';
|
|
import Summary from 'salix/components/summary';
|
|
import './style.scss';
|
|
|
|
class Controller extends Summary {
|
|
$onChanges() {
|
|
if (!this.client)
|
|
return;
|
|
|
|
this.$http.get(`Clients/${this.client.id}/summary`).then(res => {
|
|
if (res && res.data) {
|
|
this.summary = res.data;
|
|
|
|
if (res.data.classifications.length)
|
|
this.grade = res.data.classifications[0].insurances[0].grade;
|
|
|
|
this.summary.sumRisk = this.sumRisk();
|
|
}
|
|
});
|
|
}
|
|
|
|
sumRisk() {
|
|
let total = 0;
|
|
this.summary.clientRisks.forEach(risk => {
|
|
total += risk.amount;
|
|
});
|
|
return total;
|
|
}
|
|
|
|
claimRate(priceIncreasing) {
|
|
if (priceIncreasing)
|
|
return priceIncreasing * 100;
|
|
}
|
|
|
|
claimingRate(rate) {
|
|
if (rate)
|
|
return rate * 100;
|
|
}
|
|
}
|
|
|
|
ngModule.vnComponent('vnClientSummary', {
|
|
template: require('./index.html'),
|
|
controller: Controller,
|
|
bindings: {
|
|
client: '<'
|
|
}
|
|
});
|