2019-10-29 06:46:44 +00:00
|
|
|
const Component = require(`${appPath}/core/component`);
|
|
|
|
const reportHeader = new Component('report-header');
|
|
|
|
const reportFooter = new Component('report-footer');
|
2019-01-24 14:03:01 +00:00
|
|
|
|
|
|
|
module.exports = {
|
2019-10-31 11:43:04 +00:00
|
|
|
name: 'claim-pickup-order',
|
2019-10-29 06:46:44 +00:00
|
|
|
async serverPrefetch() {
|
2019-10-31 11:43:04 +00:00
|
|
|
this.client = await this.fetchClient(this.claimId);
|
2019-10-29 06:46:44 +00:00
|
|
|
this.sales = await this.fetchSales(this.claimId);
|
2022-03-18 12:22:39 +00:00
|
|
|
this.claimConfig = await this.fetchClaimConfig();
|
2019-10-31 11:43:04 +00:00
|
|
|
|
|
|
|
if (!this.client)
|
|
|
|
throw new Error('Something went wrong');
|
2019-01-24 14:03:01 +00:00
|
|
|
},
|
2019-10-31 11:43:04 +00:00
|
|
|
computed: {
|
2019-11-19 09:32:09 +00:00
|
|
|
dated: function() {
|
2019-10-31 11:43:04 +00:00
|
|
|
const filters = this.$options.filters;
|
|
|
|
|
|
|
|
return filters.date(new Date(), '%d-%m-%Y');
|
|
|
|
}
|
2019-01-24 14:03:01 +00:00
|
|
|
},
|
|
|
|
methods: {
|
2019-10-31 11:43:04 +00:00
|
|
|
fetchClient(claimId) {
|
2020-09-28 11:54:02 +00:00
|
|
|
return this.findOneFromDef('client', [claimId]);
|
2019-01-24 14:03:01 +00:00
|
|
|
},
|
2019-10-29 06:46:44 +00:00
|
|
|
fetchSales(claimId) {
|
2020-09-28 11:54:02 +00:00
|
|
|
return this.rawSqlFromDef('sales', [claimId]);
|
2019-01-24 14:03:01 +00:00
|
|
|
},
|
2022-03-18 12:22:39 +00:00
|
|
|
fetchClaimConfig() {
|
|
|
|
return this.findOneFromDef('claimConfig');
|
|
|
|
},
|
2019-01-24 14:03:01 +00:00
|
|
|
},
|
|
|
|
components: {
|
2019-10-29 06:46:44 +00:00
|
|
|
'report-header': reportHeader.build(),
|
|
|
|
'report-footer': reportFooter.build()
|
2019-01-24 14:03:01 +00:00
|
|
|
},
|
2019-10-31 11:43:04 +00:00
|
|
|
props: {
|
|
|
|
claimId: {
|
2022-01-17 11:44:43 +00:00
|
|
|
type: [Number, String],
|
2019-10-31 11:43:04 +00:00
|
|
|
required: true
|
|
|
|
}
|
|
|
|
}
|
2019-01-24 14:03:01 +00:00
|
|
|
};
|