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

39 lines
968 B
JavaScript

import ngModule from '../../../module';
class Controller {
constructor($stateParams, $http) {
this.$stateParams = $stateParams;
this.$http = $http;
this.isClosed = true;
this.filter = {
include: [
{relation: 'classification'}
]
};
}
$onInit() {
let filter = {
fields: ['finished'],
where: {id: this.$stateParams.classificationId}
};
filter = encodeURIComponent(JSON.stringify(filter));
let query = `CreditClassifications?filter=${filter}`;
this.$http.get(query).then(res => {
if (res.data)
this.isClosed = res.data[0].finished != null;
});
}
}
Controller.$inject = ['$stateParams', '$http'];
ngModule.component('vnClientCreditInsuranceInsuranceIndex', {
template: require('./index.html'),
controller: Controller,
bindings: {
client: '<'
}
});