salix/modules/invoiceOut/front/card/index.js

55 lines
1.3 KiB
JavaScript

import ngModule from '../module';
export default class Controller {
constructor($stateParams, $http) {
this.$http = $http;
this.$stateParams = $stateParams;
this.route = null;
this.filter = {
fields: [
'id',
'ref',
'issued',
'amount',
'clientFk',
'companyFk'
],
include: [
{
relation: 'company',
scope: {
fields: ['id', 'code']
}
}, {
relation: 'client',
scope: {
fields: ['id', 'socialName', 'name']
}
}
]
};
}
$onInit() {
this.getCard();
}
getCard() {
const params = {filter: this.filter};
this.$http.get(`/api/InvoiceOuts/${this.$stateParams.id}`, {params}).then(response => {
this.invoiceOut = response.data;
});
}
reload() {
this.getCard();
}
}
Controller.$inject = ['$stateParams', '$http'];
ngModule.component('vnInvoiceOutCard', {
template: require('./index.html'),
controller: Controller
});