43 lines
1.1 KiB
JavaScript
Executable File
43 lines
1.1 KiB
JavaScript
Executable File
const Component = require(`vn-print/core/component`);
|
|
const reportBody = new Component('report-body');
|
|
const reportHeader = new Component('report-header');
|
|
const reportFooter = new Component('report-footer');
|
|
|
|
module.exports = {
|
|
name: 'claim-pickup-order',
|
|
async serverPrefetch() {
|
|
this.client = await this.fetchClient(this.id);
|
|
this.sales = await this.fetchSales(this.id);
|
|
|
|
if (!this.client)
|
|
throw new Error('Something went wrong');
|
|
},
|
|
computed: {
|
|
dated: function() {
|
|
const filters = this.$options.filters;
|
|
|
|
return filters.date(new Date(), '%d-%m-%Y');
|
|
}
|
|
},
|
|
methods: {
|
|
fetchClient(id) {
|
|
return this.findOneFromDef('client', [id]);
|
|
},
|
|
fetchSales(id) {
|
|
return this.rawSqlFromDef('sales', [id]);
|
|
}
|
|
},
|
|
components: {
|
|
'report-body': reportBody.build(),
|
|
'report-header': reportHeader.build(),
|
|
'report-footer': reportFooter.build()
|
|
},
|
|
props: {
|
|
id: {
|
|
type: Number,
|
|
required: true,
|
|
description: 'The claim id'
|
|
}
|
|
}
|
|
};
|