salix/print/templates/reports/scan-expedition-pallet-label/scan-expedition-pallet-labe...

26 lines
799 B
JavaScript
Raw Normal View History

const UserError = require('vn-loopback/util/user-error');
const moment = require('moment');
module.exports = {
name: 'scan-expedition-pallet-label',
async serverPrefetch() {
this.date = Date.vnNew();
this.buys = await this.rawSqlFromDef('buy', [this.copies || 1, this.id]);
if (!this.buys.length) throw new UserError(`Empty data source`);
this.qr = await this.getQr(this.buys[0].buyFk);
this.date = moment(this.date).format('WW/DD');
},
methods: {
formatNumber(number) {
return new Intl.NumberFormat('es-ES', {maximumFractionDigits: 0}).format(number);
}
},
props: {
id: {
type: Number,
required: true,
2025-01-09 13:19:07 +00:00
description: 'The expedition pallet id'
}
}
};