salix/modules/client/front/credit-insurance/insurance/index/index.js

39 lines
968 B
JavaScript
Raw Normal View History

2018-05-23 12:26:51 +00:00
import ngModule from '../../../module';
2018-07-16 06:00:04 +00:00
class Controller {
constructor($stateParams, $http) {
this.$stateParams = $stateParams;
2018-03-28 13:07:48 +00:00
this.$http = $http;
2018-07-16 06:00:04 +00:00
this.isClosed = true;
this.filter = {
include: [
{relation: 'classification'}
]
};
2018-03-28 13:07:48 +00:00
}
$onInit() {
let filter = {
fields: ['finished'],
2018-07-16 06:00:04 +00:00
where: {id: this.$stateParams.classificationId}
2018-03-28 13:07:48 +00:00
};
filter = encodeURIComponent(JSON.stringify(filter));
let query = `CreditClassifications?filter=${filter}`;
2018-03-28 13:07:48 +00:00
this.$http.get(query).then(res => {
if (res.data)
this.isClosed = res.data[0].finished != null;
});
}
}
2018-07-16 06:00:04 +00:00
Controller.$inject = ['$stateParams', '$http'];
2018-05-23 12:26:51 +00:00
ngModule.component('vnClientCreditInsuranceInsuranceIndex', {
template: require('./index.html'),
controller: Controller,
bindings: {
client: '<'
}
});