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' } } };