45 lines
1.2 KiB
JavaScript
Executable File
45 lines
1.2 KiB
JavaScript
Executable File
const Component = require(`vn-print/core/component`);
|
|
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);
|
|
this.claimConfig = await this.fetchClaimConfig();
|
|
|
|
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]);
|
|
},
|
|
fetchClaimConfig() {
|
|
return this.findOneFromDef('claimConfig');
|
|
},
|
|
},
|
|
components: {
|
|
'report-header': reportHeader.build(),
|
|
'report-footer': reportFooter.build()
|
|
},
|
|
props: {
|
|
id: {
|
|
type: [Number, String],
|
|
required: true,
|
|
description: 'The claim id'
|
|
}
|
|
}
|
|
};
|