salix/print/templates/email/payment-update/payment-update.js

35 lines
890 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: 'payment-update',
async serverPrefetch() {
this.payMethod = await this.fetchPayMethod(this.id);
if (!this.payMethod)
throw new Error('Something went wrong');
},
computed: {
accountAddress: function() {
return this.payMethod.iban.slice(-4);
},
},
methods: {
fetchPayMethod(id) {
return this.findOneFromDef('payMethod', [id]);
}
},
components: {
'email-header': emailHeader.build(),
'email-footer': emailFooter.build()
},
props: {
id: {
type: [Number, String],
required: true,
description: 'The client id'
}
}
};