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