40 lines
1.1 KiB
JavaScript
Executable File
40 lines
1.1 KiB
JavaScript
Executable File
const Component = require(`${appPath}/core/component`);
|
|
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.refFk);
|
|
this.client = await this.fetchClient(this.refFk);
|
|
this.incoterms = await this.fetchIncoterms(this.refFk);
|
|
|
|
if (!this.invoice)
|
|
throw new Error('Something went wrong');
|
|
},
|
|
computed: {
|
|
|
|
},
|
|
methods: {
|
|
fetchInvoice(refFk) {
|
|
return this.findOneFromDef('invoice', [refFk]);
|
|
},
|
|
fetchClient(refFk) {
|
|
return this.findOneFromDef('client', [refFk]);
|
|
},
|
|
fetchIncoterms(refFk) {
|
|
return this.findOneFromDef('incoterms', [refFk, refFk, refFk]);
|
|
}
|
|
},
|
|
components: {
|
|
'report-header': reportHeader.build(),
|
|
'report-footer': reportFooter.build()
|
|
},
|
|
props: {
|
|
refFk: {
|
|
type: [Number, String],
|
|
required: true
|
|
}
|
|
}
|
|
};
|