salix/print/templates/email/printer-setup/printer-setup.js

32 lines
875 B
JavaScript
Executable File

const Component = require(`${appPath}/core/component`);
const db = require(`${appPath}/core/database`);
const emailHeader = new Component('email-header');
const emailFooter = new Component('email-footer');
const attachment = new Component('attachment');
const attachments = require('./attachments.json');
module.exports = {
name: 'printer-setup',
async serverPrefetch() {
this.client = await this.fetchClient(this.recipientId);
},
data() {
return {attachments};
},
methods: {
fetchClient(clientId) {
return db.findOneFromDef('client', [clientId], __dirname);
}
},
components: {
'email-header': emailHeader.build(),
'email-footer': emailFooter.build(),
'attachment': attachment.build()
},
props: {
recipientId: {
required: true
}
}
};