salix/print/templates/reports/credit-request/credit-request.js

25 lines
680 B
JavaScript
Raw Normal View History

2021-07-19 08:16:15 +00:00
const Component = require(`${appPath}/core/component`);
const reportHeader = new Component('report-header');
2021-07-19 08:42:12 +00:00
const reportFooter = new Component('report-footer');
2021-07-19 08:16:15 +00:00
const rptCreditRequest = {
name: 'credit-request',
2021-07-19 08:42:12 +00:00
async serverPrefetch() {
this.client = await this.fetchClient(this.recipientId);
if (!this.client)
throw new Error('Something went wrong');
},
methods: {
fetchClient(clientId) {
return this.findOneFromDef('client', [clientId]);
}
},
2021-07-19 08:16:15 +00:00
components: {
2021-07-19 08:42:12 +00:00
'report-header': reportHeader.build(),
'report-footer': reportFooter.build()
2021-07-19 08:16:15 +00:00
}
};
module.exports = rptCreditRequest;