diff --git a/db/docker.js b/db/docker.js index 3eb262a822..05217d659a 100644 --- a/db/docker.js +++ b/db/docker.js @@ -47,12 +47,8 @@ module.exports = class Docker { if (ci) network = `--network="${networkName}"`; log('Starting container...'); - const container = await this.execP(` - docker run \ - ${network} \ - --env RUN_CHOWN=${runChown} \ - -d ${dockerArgs} salix-db - `); + const container = await this.execP( + `docker run ${network} --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`); this.id = container.stdout.trim(); try { diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 8c6f2cac83..36595c51bb 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -239,5 +239,6 @@ "This route does not exists": "Esta ruta no existe", "Claim pickup order sent": "Reclamación Orden de recogida enviada [({{claimId}})]({{{claimUrl}}}) al cliente *{{clientName}}*", "You don't have grant privilege": "No tienes privilegios para dar privilegios", - "You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario" + "You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario", + "Empty data source": "Origen de datos vacio" } diff --git a/modules/ticket/back/methods/ticket/collectionLabel.js b/modules/ticket/back/methods/ticket/collectionLabel.js new file mode 100644 index 0000000000..064ca0210b --- /dev/null +++ b/modules/ticket/back/methods/ticket/collectionLabel.js @@ -0,0 +1,50 @@ +const {Report} = require('vn-print'); + +module.exports = Self => { + Self.remoteMethodCtx('collectionLabel', { + description: 'Returns the collection label', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The ticket id', + http: {source: 'path'} + }, + ], + returns: [ + { + arg: 'body', + type: 'file', + root: true + }, { + arg: 'Content-Type', + type: 'String', + http: {target: 'header'} + }, { + arg: 'Content-Disposition', + type: 'String', + http: {target: 'header'} + } + ], + http: { + path: '/:id/collection-label', + verb: 'GET' + } + }); + + Self.collectionLabel = async(ctx, id) => { + const args = Object.assign({}, ctx.args); + const params = {lang: ctx.req.getLocale()}; + + delete args.ctx; + for (const param in args) + params[param] = args[param]; + + const report = new Report('collection-label', params); + const stream = await report.toPdfStream(); + + return [stream, 'application/pdf', `filename="doc-${id}.pdf"`]; + }; +}; diff --git a/modules/ticket/back/models/ticket-methods.js b/modules/ticket/back/models/ticket-methods.js index 9255e52e62..f265709e73 100644 --- a/modules/ticket/back/models/ticket-methods.js +++ b/modules/ticket/back/models/ticket-methods.js @@ -33,4 +33,5 @@ module.exports = function(Self) { require('../methods/ticket/closeByTicket')(Self); require('../methods/ticket/closeByAgency')(Self); require('../methods/ticket/closeByRoute')(Self); + require('../methods/ticket/collectionLabel')(Self); }; diff --git a/print/templates/reports/collection-label/assets/css/import.js b/print/templates/reports/collection-label/assets/css/import.js new file mode 100644 index 0000000000..37a98dfddb --- /dev/null +++ b/print/templates/reports/collection-label/assets/css/import.js @@ -0,0 +1,12 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, + `${__dirname}/style.css`]) + .mergeStyles(); diff --git a/print/templates/reports/collection-label/assets/css/style.css b/print/templates/reports/collection-label/assets/css/style.css new file mode 100644 index 0000000000..fe1975445d --- /dev/null +++ b/print/templates/reports/collection-label/assets/css/style.css @@ -0,0 +1,37 @@ +html { + font-family: "Roboto"; + margin-top: -7px; +} +* { + box-sizing: border-box; + text-align: center; + font-size: 26px; +} +#vertical { + writing-mode: vertical-rl; + height: 226px; + margin-left: -13px; +} +.outline { + border: 1px solid black; + padding: 5px; +} +#nickname { + font-size: 22px; +} +#agencyDescripton { + font-size: 32px; + font-weight: bold; +} +#bold { + font-weight: bold; +} +#barcode{ + width: 390px; +} +#shipped { + font-weight: bold; +} +#ticketFk, #vertical { + font-size: 34px; +} \ No newline at end of file diff --git a/print/templates/reports/collection-label/collection-label.html b/print/templates/reports/collection-label/collection-label.html new file mode 100644 index 0000000000..5ae375786a --- /dev/null +++ b/print/templates/reports/collection-label/collection-label.html @@ -0,0 +1,32 @@ + + +
+{{labelData.levelV}} | +{{labelData.ticketFk}} ⬸ {{labelData.clientFk}} | +{{labelData.shipped}} | +|
+ | {{labelData.workerCode}} | +||
{{labelData.labelCount}} | +|||
{{labelData.size}} | +|||
{{labelData.agencyDescription}} |
+ {{labelData.lineCount}} | +||
{{labelData.nickName}} | +{{labelData.agencyHour}} | +