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

57 lines
1.4 KiB
JavaScript

import ngModule from '../module';
import './style.scss';
class Controller {
constructor($scope, $http, vnToken) {
this.accessToken = vnToken.token;
this.$http = $http;
this.$ = $scope;
}
set invoiceOut(value) {
this._invoiceOut = value;
if (value && value.id)
this.getSummary();
}
get invoiceOut() {
return this._invoiceOut;
}
getSummary() {
this.$http.get(`/api/InvoiceOuts/${this.invoiceOut.id}/summary`).then(response => {
this.summary = response.data;
});
}
showClientDescriptor(event, clientFk) {
this.$.clientDescriptor.clientFk = clientFk;
this.$.clientDescriptor.parent = event.target;
this.$.clientDescriptor.show();
event.preventDefault();
}
showTicketDescriptor(event, ticketFk) {
this.$.ticketDescriptor.ticketFk = ticketFk;
this.$.ticketDescriptor.parent = event.target;
this.$.ticketDescriptor.show();
event.preventDefault();
}
preview(event, invoiceOut) {
this.selectedInvoiceOut = invoiceOut;
this.$.invoiceOutSummaryDialog.show();
event.preventDefault();
}
}
Controller.$inject = ['$scope', '$http', 'vnToken'];
ngModule.component('vnInvoiceOutSummary', {
template: require('./index.html'),
controller: Controller,
bindings: {
invoiceOut: '<'
}
});