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

31 lines
799 B
JavaScript
Executable File

const Component = require(`vn-print/core/component`);
const emailHeader = new Component('email-header');
const emailFooter = new Component('email-footer');
module.exports = {
name: 'claim-pickup-order',
components: {
'email-header': emailHeader.build(),
'email-footer': emailFooter.build()
},
async serverPrefetch() {
this.ticket = await this.fetchTicket(this.id);
if (!this.ticket)
throw new Error('Something went wrong');
this.instructions = this.$t('description.instructions', [this.id, this.ticket.id]);
},
methods: {
fetchTicket(id) {
return this.findOneFromDef('ticket', [id]);
}
},
props: {
id: {
type: Number,
required: true
}
}
};