2019-10-31 11:43:04 +00:00
|
|
|
const Component = require(`${appPath}/core/component`);
|
2019-10-29 06:46:44 +00:00
|
|
|
const emailHeader = new Component('email-header');
|
|
|
|
const emailFooter = new Component('email-footer');
|
2019-10-31 11:43:04 +00:00
|
|
|
const db = require(`${appPath}/core/database`);
|
2019-09-06 09:06:44 +00:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
name: 'delivery-note',
|
|
|
|
methods: {
|
2019-10-29 06:46:44 +00:00
|
|
|
fetchTicket(ticketId) {
|
|
|
|
return db.findOne(`
|
2019-09-06 09:06:44 +00:00
|
|
|
SELECT
|
|
|
|
t.id,
|
|
|
|
u.lang locale,
|
|
|
|
c.email recipient
|
|
|
|
FROM ticket t
|
|
|
|
JOIN client c ON c.id = t.clientFk
|
|
|
|
JOIN account.user u ON u.id = c.id
|
2019-10-29 06:46:44 +00:00
|
|
|
WHERE t.id = ?`, [ticketId]);
|
2019-09-06 09:06:44 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
components: {
|
2019-10-29 06:46:44 +00:00
|
|
|
'email-header': emailHeader.build(),
|
|
|
|
'email-footer': emailFooter.build()
|
2019-09-06 09:06:44 +00:00
|
|
|
},
|
2019-10-31 11:43:04 +00:00
|
|
|
props: {
|
|
|
|
ticketId: {
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
}
|
2019-09-06 09:06:44 +00:00
|
|
|
};
|