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

37 lines
1.0 KiB
JavaScript

const Component = require(`vn-print/core/component`);
const reportHeader = new Component('report-header');
const reportFooter = new Component('report-footer');
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-header': reportHeader.build(),
'report-footer': reportFooter.build()
},
props: {
id: {
type: Number,
required: true,
description: 'The receipt id'
}
}
};