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

39 lines
930 B
JavaScript

import ngModule from '../module';
import Summary from 'salix/components/summary';
import './style.scss';
class Controller extends Summary {
set invoiceOut(value) {
this._invoiceOut = value;
if (value && value.id) {
this.getSummary();
this.getTickets();
}
}
get invoiceOut() {
return this._invoiceOut;
}
getSummary() {
return this.$http.get(`InvoiceOuts/${this.invoiceOut.id}/summary`)
.then(res => this.summary = res.data);
}
getTickets() {
this.$.$applyAsync(() => {
const query = `InvoiceOuts/${this.invoiceOut.id}/getTickets`;
this.$.ticketsModel.url = query;
this.$.ticketsModel.refresh();
});
}
}
ngModule.vnComponent('vnInvoiceOutSummary', {
template: require('./index.html'),
controller: Controller,
bindings: {
invoiceOut: '<'
}
});