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

39 lines
976 B
JavaScript

import ngModule from '../../../module';
import Section from 'salix/components/section';
class Controller extends Section {
constructor($element, $) {
super($element, $);
this.isClosed = true;
this.filter = {
include: [
{relation: 'classification'}
]
};
}
$onInit() {
let filter = {
fields: ['finished'],
where: {id: this.$params.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 = ['$element', '$scope'];
ngModule.vnComponent('vnClientCreditInsuranceInsuranceIndex', {
template: require('./index.html'),
controller: Controller,
bindings: {
client: '<'
}
});