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

40 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-10-29 06:46:44 +00:00
const db = require(`${appPath}/core/database`);
const Component = require(`${appPath}/core/component`);
const emailHeader = new Component('email-header');
const emailFooter = new Component('email-footer');
const attachments = require('./attachments.json');
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: ['claimId', 'isPreview']
};