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

35 lines
924 B
JavaScript
Raw Normal View History

2022-10-28 12:49:22 +00:00
const Component = require(`vn-print/core/component`);
2022-11-10 06:48:24 +00:00
const reportBody = new Component('report-body');
2022-10-28 12:49:22 +00:00
module.exports = {
2022-11-02 14:54:23 +00:00
name: 'balance-compensation',
2022-10-28 12:49:22 +00:00
async serverPrefetch() {
this.client = await this.fetchClient(this.id);
2022-11-03 07:08:24 +00:00
this.company = await this.fetchCompany(this.id);
2022-11-10 06:48:24 +00:00
},
2022-10-28 12:49:22 +00:00
methods: {
fetchClient(id) {
return this.findOneFromDef('client', [id]);
},
2022-11-03 07:08:24 +00:00
fetchCompany(id) {
return this.findOneFromDef('company', [id]);
2022-11-02 14:54:23 +00:00
},
2022-11-10 06:48:24 +00:00
2022-10-28 12:49:22 +00:00
currentDate() {
const current = new Date();
2022-11-10 06:48:24 +00:00
const date = `${current.getDate()}/${current.getMonth() + 1}/${current.getFullYear()}`;
2022-10-28 12:49:22 +00:00
return date;
2022-11-10 06:48:24 +00:00
}
2022-10-28 12:49:22 +00:00
},
components: {
2022-11-10 12:34:23 +00:00
'report-body': reportBody.build()
2022-10-28 12:49:22 +00:00
},
props: {
id: {
2022-11-02 14:54:23 +00:00
type: Number,
2022-10-28 12:49:22 +00:00
required: true,
description: 'The receipt id'
}
}
};