2019-03-13 13:10:45 +00:00
|
|
|
import ngModule from '../module';
|
2020-03-17 13:43:46 +00:00
|
|
|
import Section from 'salix/components/section';
|
2019-03-13 13:10:45 +00:00
|
|
|
|
2020-03-17 13:43:46 +00:00
|
|
|
export default class Controller extends Section {
|
2022-10-24 12:20:09 +00:00
|
|
|
get checked() {
|
|
|
|
const rows = this.$.model.data || [];
|
|
|
|
const checkedRows = [];
|
|
|
|
for (let row of rows) {
|
|
|
|
if (row.checked)
|
|
|
|
checkedRows.push(row.id);
|
|
|
|
}
|
|
|
|
|
|
|
|
return checkedRows;
|
|
|
|
}
|
|
|
|
|
|
|
|
get totalChecked() {
|
|
|
|
return this.checked.length;
|
|
|
|
}
|
|
|
|
|
2020-04-25 09:50:04 +00:00
|
|
|
preview(invoiceOut) {
|
2019-03-28 10:55:23 +00:00
|
|
|
this.selectedInvoiceOut = invoiceOut;
|
|
|
|
this.$.summary.show();
|
2019-03-13 13:10:45 +00:00
|
|
|
}
|
|
|
|
|
2022-10-24 12:20:09 +00:00
|
|
|
openPdf() {
|
2024-03-28 06:22:28 +00:00
|
|
|
const access_token = this.vnToken.tokenMultimedia;
|
2022-10-24 12:20:09 +00:00
|
|
|
if (this.checked.length <= 1) {
|
|
|
|
const [invoiceOutId] = this.checked;
|
2024-03-28 06:22:28 +00:00
|
|
|
const url = `api/InvoiceOuts/${invoiceOutId}/download?access_token=${access_token}`;
|
2022-10-24 12:20:09 +00:00
|
|
|
window.open(url, '_blank');
|
|
|
|
} else {
|
|
|
|
const invoiceOutIds = this.checked;
|
2022-12-20 08:48:58 +00:00
|
|
|
const invoicesIds = invoiceOutIds.join(',');
|
|
|
|
const serializedParams = this.$httpParamSerializer({
|
2024-03-28 06:22:28 +00:00
|
|
|
access_token,
|
2022-12-20 08:48:58 +00:00
|
|
|
ids: invoicesIds
|
|
|
|
});
|
|
|
|
const url = `api/InvoiceOuts/downloadZip?${serializedParams}`;
|
|
|
|
window.open(url, '_blank');
|
2022-10-24 12:20:09 +00:00
|
|
|
}
|
2019-03-13 13:10:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-24 12:22:30 +00:00
|
|
|
ngModule.vnComponent('vnInvoiceOutIndex', {
|
2019-03-13 13:10:45 +00:00
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller
|
|
|
|
});
|