salix/print/templates/reports/incoterms-authorization/incoterms-authorization.js

36 lines
1010 B
JavaScript
Executable File

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: 'incoterms-authorization',
async serverPrefetch() {
this.client = await this.findOneFromDef('client', [this.id]);
this.company = await this.findOneFromDef('company', [this.companyId]);
if (!this.client)
throw new Error('Something went wrong');
},
computed: {
issued: function() {
return new Date();
}
},
components: {
'report-body': reportBody.build(),
'report-header': reportHeader.build(),
'report-footer': reportFooter.build()
},
props: {
id: {
type: Number,
required: true,
description: 'The client id'
},
companyId: {
type: Number,
required: true
}
}
};