salix/print/templates/reports/balance-compensation/balance-compensation.js

35 lines
924 B
JavaScript

const Component = require(`vn-print/core/component`);
const reportBody = new Component('report-body');
module.exports = {
name: 'balance-compensation',
async serverPrefetch() {
this.client = await this.fetchClient(this.id);
this.company = await this.fetchCompany(this.id);
},
methods: {
fetchClient(id) {
return this.findOneFromDef('client', [id]);
},
fetchCompany(id) {
return this.findOneFromDef('company', [id]);
},
currentDate() {
const current = new Date();
const date = `${current.getDate()}/${current.getMonth() + 1}/${current.getFullYear()}`;
return date;
}
},
components: {
'report-body': reportBody.build()
},
props: {
id: {
type: Number,
required: true,
description: 'The receipt id'
}
}
};