salix/print/templates/email/claim-pickup-order/claim-pickup-order.js

40 lines
1.1 KiB
JavaScript
Executable File

const Component = require(`${appPath}/core/component`);
const emailHeader = new Component('email-header');
const emailFooter = new Component('email-footer');
const attachments = require('./attachments.json');
const db = require(`${appPath}/core/database`);
module.exports = {
name: 'claim-pickup-order',
/* async serverPrefetch() {
this.client = await this.fetchClient(this.clientId);
},*/
created() {
if (this.locale)
this.$i18n.locale = this.locale;
},
data() {
return {
attachments
};
},
methods: {
fetchClient(claimId) {
return db.findOne(`
SELECT
c.id,
u.lang locale,
c.email recipient
FROM claim cl
JOIN client c ON c.id = cl.clientFk
JOIN account.user u ON u.id = c.id
WHERE cl.id = ?`, [claimId]);
},
},
components: {
'email-header': emailHeader.build(),
'email-footer': emailFooter.build()
},
props: ['clientId', 'claimId', 'isPreview']
};