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

30 lines
814 B
JavaScript
Executable File

const Component = require(`${appPath}/core/component`);
const reportHeader = new Component('report-header');
const reportFooter = new Component('report-footer');
module.exports = {
name: 'cmr-authorization',
async serverPrefetch() {
this.ticket = await this.findOneFromDef('ticket', [this.ticketId]);
if (!this.ticket)
throw new Error('Something went wrong');
this.client = await this.findOneFromDef('client', [this.ticket.clientFk]);
},
computed: {
issued: function() {
return new Date();
}
},
components: {
'report-header': reportHeader.build(),
'report-footer': reportFooter.build()
},
props: {
ticketId: {
type: [Number, String],
required: true
}
}
};