39 lines
1.0 KiB
JavaScript
Executable File
39 lines
1.0 KiB
JavaScript
Executable File
const Component = require(`${appPath}/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.claimId);
|
|
this.sales = await this.fetchSales(this.claimId);
|
|
|
|
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(claimId) {
|
|
return this.findOneFromDef('client', [claimId]);
|
|
},
|
|
fetchSales(claimId) {
|
|
return this.rawSqlFromDef('sales', [claimId]);
|
|
},
|
|
},
|
|
components: {
|
|
'report-header': reportHeader.build(),
|
|
'report-footer': reportFooter.build()
|
|
},
|
|
props: {
|
|
claimId: {
|
|
required: true
|
|
}
|
|
}
|
|
};
|