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

55 lines
1.3 KiB
JavaScript
Raw Normal View History

2019-03-26 13:27:08 +00:00
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']
}
2019-03-28 10:55:23 +00:00
}, {
2019-03-26 13:27:08 +00:00
relation: 'client',
scope: {
2019-04-08 14:53:37 +00:00
fields: ['id', 'socialName', 'name']
2019-03-26 13:27:08 +00:00
}
}
]
};
}
$onInit() {
this.getCard();
}
getCard() {
2019-03-28 10:55:23 +00:00
const params = {filter: this.filter};
this.$http.get(`/api/InvoiceOuts/${this.$stateParams.id}`, {params}).then(response => {
this.invoiceOut = response.data;
2019-03-26 13:27:08 +00:00
});
}
reload() {
this.getCard();
}
}
Controller.$inject = ['$stateParams', '$http'];
ngModule.component('vnInvoiceOutCard', {
template: require('./index.html'),
controller: Controller
});