salix/print/templates/reports/claim-pickup-order/claim-pickup-order.js

41 lines
1.0 KiB
JavaScript
Raw Normal View History

2022-09-22 07:17:14 +00:00
const Component = require(`vn-print/core/component`);
2022-11-10 06:48:24 +00:00
const reportBody = new Component('report-body');
2019-10-29 06:46:44 +00:00
const reportFooter = new Component('report-footer');
module.exports = {
2019-10-31 11:43:04 +00:00
name: 'claim-pickup-order',
2019-10-29 06:46:44 +00:00
async serverPrefetch() {
2022-09-22 07:17:14 +00:00
this.client = await this.fetchClient(this.id);
this.sales = await this.fetchSales(this.id);
2019-10-31 11:43:04 +00:00
if (!this.client)
throw new Error('Something went wrong');
},
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');
}
},
methods: {
2022-09-22 07:17:14 +00:00
fetchClient(id) {
return this.findOneFromDef('client', [id]);
},
2022-09-22 07:17:14 +00:00
fetchSales(id) {
return this.rawSqlFromDef('sales', [id]);
}
},
components: {
2022-11-10 06:48:24 +00:00
'report-body': reportBody.build(),
2019-10-29 06:46:44 +00:00
'report-footer': reportFooter.build()
},
2019-10-31 11:43:04 +00:00
props: {
2022-09-22 07:17:14 +00:00
id: {
2022-10-28 13:53:57 +00:00
type: Number,
2022-09-26 11:33:27 +00:00
required: true,
description: 'The claim id'
2019-10-31 11:43:04 +00:00
}
}
};