salix/print/templates/email/buyer-week-waste/buyer-week-waste.js

29 lines
677 B
JavaScript
Executable File

const Component = require(`vn-print/core/component`);
const emailBody = new Component('email-body');
module.exports = {
name: 'buyer-week-waste',
async serverPrefetch() {
this.wastes = await this.fetchWastes();
if (!this.wastes)
throw new Error('Something went wrong');
},
computed: {
dated: function() {
const filters = this.$options.filters;
return filters.date(new Date(), '%d-%m-%Y');
}
},
methods: {
fetchWastes() {
return this.rawSqlFromDef('wasteWeekly');
}
},
components: {
'email-body': emailBody.build()
},
props: {}
};