2022-09-26 11:33:27 +00:00
|
|
|
const Component = require(`vn-print/core/component`);
|
2022-11-10 07:57:42 +00:00
|
|
|
const reportBody = new Component('report-body');
|
2019-10-29 06:46:44 +00:00
|
|
|
const reportFooter = new Component('report-footer');
|
2019-03-05 13:59:18 +00:00
|
|
|
|
|
|
|
module.exports = {
|
2019-10-24 05:41:54 +00:00
|
|
|
name: 'receipt',
|
|
|
|
async serverPrefetch() {
|
2022-09-26 11:33:27 +00:00
|
|
|
this.client = await this.fetchClient(this.id);
|
|
|
|
this.receipt = await this.fetchReceipt(this.id);
|
2019-03-05 13:59:18 +00:00
|
|
|
|
2019-10-31 11:43:04 +00:00
|
|
|
if (!this.receipt)
|
|
|
|
throw new Error('Something went wrong');
|
2019-03-05 13:59:18 +00:00
|
|
|
},
|
|
|
|
methods: {
|
2022-09-26 11:33:27 +00:00
|
|
|
fetchClient(id) {
|
|
|
|
return this.findOneFromDef('client', [id]);
|
2019-03-05 13:59:18 +00:00
|
|
|
},
|
2022-09-26 11:33:27 +00:00
|
|
|
fetchReceipt(id) {
|
|
|
|
return this.findOneFromDef('receipt', [id]);
|
2019-10-31 11:43:04 +00:00
|
|
|
}
|
2019-10-29 06:46:44 +00:00
|
|
|
},
|
|
|
|
components: {
|
2022-11-10 07:57:42 +00:00
|
|
|
'report-body': reportBody.build(),
|
2019-10-29 06:46:44 +00:00
|
|
|
'report-footer': reportFooter.build()
|
2019-03-05 13:59:18 +00:00
|
|
|
},
|
2019-10-31 11:43:04 +00:00
|
|
|
props: {
|
2022-09-26 11:33:27 +00:00
|
|
|
id: {
|
2022-10-28 13:53:57 +00:00
|
|
|
type: Number,
|
2022-09-26 11:33:27 +00:00
|
|
|
required: true,
|
|
|
|
description: 'Receipt id'
|
2019-10-31 11:43:04 +00:00
|
|
|
}
|
|
|
|
}
|
2019-03-05 13:59:18 +00:00
|
|
|
};
|