2021-03-01 10:25:37 +00:00
|
|
|
const Component = require(`${appPath}/core/component`);
|
|
|
|
const reportHeader = new Component('report-header');
|
|
|
|
const reportFooter = new Component('report-footer');
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
name: 'invoice-incoterms',
|
|
|
|
async serverPrefetch() {
|
|
|
|
this.invoice = await this.fetchInvoice(this.invoiceId);
|
|
|
|
this.client = await this.fetchClient(this.invoiceId);
|
|
|
|
this.incoterms = await this.fetchIncoterms(this.invoiceId);
|
|
|
|
|
|
|
|
if (!this.invoice)
|
|
|
|
throw new Error('Something went wrong');
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
fetchInvoice(invoiceId) {
|
|
|
|
return this.findOneFromDef('invoice', [invoiceId]);
|
|
|
|
},
|
|
|
|
fetchClient(invoiceId) {
|
|
|
|
return this.findOneFromDef('client', [invoiceId]);
|
|
|
|
},
|
|
|
|
fetchIncoterms(invoiceId) {
|
2021-10-22 08:26:40 +00:00
|
|
|
return this.findOneFromDef('incoterms', [invoiceId, invoiceId, invoiceId]);
|
2021-03-01 10:25:37 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
'report-header': reportHeader.build(),
|
|
|
|
'report-footer': reportFooter.build()
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
invoiceId: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|