requested changes refs #4732 @1h

This commit is contained in:
Pau 2022-12-22 08:00:18 +01:00
parent f652e86c78
commit f6f6d0866d
8 changed files with 20 additions and 16 deletions

View File

@ -1,7 +1,7 @@
const {Report} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('previaLabelPdf', {
Self.remoteMethodCtx('previousLabel', {
description: 'Returns the previa label pdf',
accessType: 'READ',
accepts: [
@ -28,12 +28,12 @@ module.exports = Self => {
}
],
http: {
path: '/:id/previa-label-pdf',
path: '/:id/previousLabel',
verb: 'GET'
}
});
Self.previaLabelPdf = async(ctx, id) => {
Self.previousLabel = async(ctx, id) => {
const args = Object.assign({}, ctx.args);
const params = {lang: ctx.req.getLocale()};

View File

@ -3,5 +3,5 @@ module.exports = Self => {
require('../methods/collection/newCollection')(Self);
require('../methods/collection/getSectors')(Self);
require('../methods/collection/setSaleQuantity')(Self);
require('../methods/collection/previaLabelPdf')(Self);
require('../methods/collection/previousLabel')(Self);
};

View File

@ -1,3 +1,3 @@
UPDATE vn.collection
UPDATE `vn`.`collection`
SET sectorFk=1
WHERE id=1;

View File

@ -247,7 +247,8 @@
"Empty data source": "Origen de datos vacio",
"Email verify": "Correo de verificación",
"Landing cannot be lesser than shipment": "Landing cannot be lesser than shipment",
"Receipt's bank was not found": "No se encontró el banco del recibo",
"This receipt was not compensated": "Este recibo no ha sido compensado",
"Client's email was not found": "No se encontró el email del cliente"
"Receipt's bank was not found": "No se encontró el banco del recibo",
"This receipt was not compensated": "Este recibo no ha sido compensado",
"Client's email was not found": "No se encontró el email del cliente",
"Something went wrong - no sector found": "Something went wrong - no sector found"
}

View File

@ -0,0 +1,2 @@
previous: PREVIOUS
report: Report

View File

@ -1 +1,2 @@
reportName: Etiqueta
previous: PREVIA
report: Ticket

View File

@ -10,12 +10,12 @@
</div>
</div>
<div class="data">
<div class="header">PREVIA</div>
<div class="header">{{ $t('previous') }}</div>
<div v-if="sector.description.length > 16" class="sector-sm">
{{sector.description}}
</div>
<div v-else class="sector">{{sector.description}}</div>
<div class="producer">Ticket #{{previa.ticketFk}}</div>
<div class="producer">{{ $t('report') }}#{{previa.ticketFk}}</div>
<div class="details">
<div class="package">
<div class="packing">{{previa.itemPackingTypeFk}}</div>

View File

@ -1,20 +1,20 @@
const Component = require(`vn-print/core/component`);
const reportBody = new Component('report-body');
const qrcode = require('qrcode');
const UserError = require('vn-loopback/util/user-error');
module.exports = {
name: 'previa-label',
async serverPrefetch() {
this.previa = await this.fetchPrevia(this.id);
this.sector = await this.fetchSector(this.id);
this.previa = this.previa[0];
this.barcode = await this.getBarcodeBase64(this.id);
if (!this.previa)
throw new Error('Something went wrong - previa');
if (this.previa)
this.previa = this.previa[0];
if (!this.sector)
throw new Error('Something went wrong - sector');
throw new UserError('Something went wrong - no sector found');
},
methods: {
fetchPrevia(id) {