const Component = require(`vn-print/core/component`); const reportBody = new Component('report-body'); const reportHeader = new Component('report-header'); const reportFooter = new Component('report-footer'); module.exports = { name: 'invoice-incoterms', async serverPrefetch() { this.invoice = await this.fetchInvoice(this.reference); this.client = await this.fetchClient(this.reference); this.incoterms = await this.fetchIncoterms(this.reference); if (!this.invoice) throw new Error('Something went wrong'); }, computed: { }, methods: { fetchInvoice(reference) { return this.findOneFromDef('invoice', [reference]); }, fetchClient(reference) { return this.findOneFromDef('client', [reference]); }, fetchIncoterms(reference) { return this.findOneFromDef('incoterms', [reference, reference, reference]); } }, components: { 'report-body': reportBody.build(), 'report-header': reportHeader.build(), 'report-footer': reportFooter.build() }, props: { reference: { type: Number, required: true, description: 'The invoice ref' } } };