67 lines
1.7 KiB
JavaScript
67 lines
1.7 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;
|
|
}
|
|
|
|
openPdf(id, event) {
|
|
let url = `api/InvoiceOuts/${id}/download?access_token=${this.accessToken}`;
|
|
window.open(url, '_blank');
|
|
event.preventDefault();
|
|
event.stopImmediatePropagation();
|
|
}
|
|
|
|
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();
|
|
event.stopImmediatePropagation();
|
|
}
|
|
|
|
showTicketDescriptor(event, ticketFk) {
|
|
this.$.ticketDescriptor.ticketFk = ticketFk;
|
|
this.$.ticketDescriptor.parent = event.target;
|
|
this.$.ticketDescriptor.show();
|
|
event.preventDefault();
|
|
event.stopImmediatePropagation();
|
|
}
|
|
|
|
preview(event, invoiceOut) {
|
|
this.selectedInvoiceOut = invoiceOut;
|
|
this.$.invoiceOutSummaryDialog.show();
|
|
event.preventDefault();
|
|
event.stopImmediatePropagation();
|
|
}
|
|
}
|
|
|
|
Controller.$inject = ['$scope', '$http', 'vnToken'];
|
|
|
|
ngModule.component('vnInvoiceOutSummary', {
|
|
template: require('./index.html'),
|
|
controller: Controller,
|
|
bindings: {
|
|
invoiceOut: '<'
|
|
}
|
|
});
|