2019-03-26 13:27:08 +00:00
|
|
|
import ngModule from '../module';
|
|
|
|
|
|
|
|
class Controller {
|
2019-04-18 09:47:31 +00:00
|
|
|
constructor(vnToken) {
|
|
|
|
this.accessToken = vnToken.token;
|
|
|
|
this.moreOptions = [
|
|
|
|
{callback: this.showInvoiceOutPdf, name: 'Show invoice out PDF'}
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
onMoreChange(callback) {
|
|
|
|
callback.call(this);
|
|
|
|
}
|
|
|
|
|
2019-03-26 13:27:08 +00:00
|
|
|
set invoiceOut(value) {
|
|
|
|
this._invoiceOut = value;
|
|
|
|
|
|
|
|
if (value) {
|
|
|
|
this._quicklinks = {
|
|
|
|
btnOne: {
|
|
|
|
icon: 'icon-person',
|
|
|
|
state: `client.card.summary({id: ${value.clientFk}})`,
|
|
|
|
tooltip: 'Client card'
|
|
|
|
},
|
|
|
|
btnTwo: {
|
|
|
|
icon: 'icon-ticket',
|
|
|
|
state: `ticket.index({q: '{"refFk": "${value.ref}"}'})`,
|
|
|
|
tooltip: 'Invoice ticket list'
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
get invoiceOut() {
|
|
|
|
return this._invoiceOut;
|
|
|
|
}
|
|
|
|
|
2019-04-18 09:47:31 +00:00
|
|
|
showInvoiceOutPdf() {
|
|
|
|
let url = `api/InvoiceOuts/${this.invoiceOut.id}/download?access_token=${this.accessToken}`;
|
|
|
|
window.open(url, '_blank');
|
|
|
|
}
|
|
|
|
|
2019-03-26 13:27:08 +00:00
|
|
|
set quicklinks(value = {}) {
|
|
|
|
this._quicklinks = Object.assign(value, this._quicklinks);
|
|
|
|
}
|
|
|
|
|
|
|
|
get quicklinks() {
|
|
|
|
return this._quicklinks;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-18 09:47:31 +00:00
|
|
|
Controller.$inject = ['vnToken'];
|
2019-03-26 13:27:08 +00:00
|
|
|
|
|
|
|
ngModule.component('vnInvoiceOutDescriptor', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
bindings: {
|
|
|
|
invoiceOut: '<',
|
|
|
|
quicklinks: '<'
|
|
|
|
},
|
|
|
|
controller: Controller
|
|
|
|
});
|