salix/print/templates/reports/invoiceIn/invoiceIn.js

34 lines
919 B
JavaScript
Raw Normal View History

2022-10-17 13:13:27 +00:00
const Component = require(`vn-print/core/component`);
const Report = require(`vn-print/core/report`);
const reportHeader = new Component('report-header');
const reportFooter = new Component('report-footer');
const invoiceIncoterms = new Report('invoice-incoterms');
module.exports = {
name: 'invoiceIn',
async serverPrefetch() {
this.invoice = await this.fetchInvoice(this.id);
if (!this.invoice)
throw new Error('Something went wrong');
},
computed: {
},
methods: {
fetchInvoice(id) {
return this.findOneFromDef('invoice', [id]);
}
},
components: {
'report-header': reportHeader.build(),
'report-footer': reportFooter.build(),
'invoice-incoterms': invoiceIncoterms.build()
},
props: {
id: {
type: [Number, String],
description: 'The invoice id'
}
}
};