diff --git a/modules/ticket/back/methods/ticket/expeditionPalletLabel.js b/modules/ticket/back/methods/ticket/expeditionPalletLabel.js new file mode 100644 index 000000000..2215263dd --- /dev/null +++ b/modules/ticket/back/methods/ticket/expeditionPalletLabel.js @@ -0,0 +1,55 @@ +const {Report} = require('vn-print'); + +module.exports = Self => { + Self.remoteMethodCtx('expeditionPalletLabel', { + description: 'Returns the expedition pallet label', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The pallet id', + http: {source: 'path'} + }, { + arg: 'userFk', + type: 'number', + required: true, + description: 'The user id' + } + ], + 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/expedition-pallet-label', + verb: 'GET' + } + }); + + Self.expeditionPalletLabel = 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('expedition-pallet-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 82a1ac862..8fd74d35c 100644 --- a/modules/ticket/back/models/ticket-methods.js +++ b/modules/ticket/back/models/ticket-methods.js @@ -37,4 +37,5 @@ module.exports = function(Self) { require('../methods/ticket/merge')(Self); require('../methods/ticket/isRoleAdvanced')(Self); require('../methods/ticket/collectionLabel')(Self); + require('../methods/ticket/expeditionPalletLabel')(Self); }; diff --git a/print/templates/reports/expedition-pallet-label/assets/css/import.js b/print/templates/reports/expedition-pallet-label/assets/css/import.js new file mode 100644 index 000000000..37a98dfdd --- /dev/null +++ b/print/templates/reports/expedition-pallet-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/expedition-pallet-label/assets/css/style.css b/print/templates/reports/expedition-pallet-label/assets/css/style.css new file mode 100644 index 000000000..68e91fb47 --- /dev/null +++ b/print/templates/reports/expedition-pallet-label/assets/css/style.css @@ -0,0 +1,62 @@ +html { + font-family: Arial, Helvetica, sans-serif; +} +* { + box-sizing: border-box; + font-size: 25px; +} +#truck { + width: 100%; + max-width: 150px; + height: 90px; + background-color: black; + color: white; + font-size: 50px; + font-weight: bold; + text-align: center; +} +.mainTable { + width: 100%; + height: 100%; + border: 10px solid; + border-radius: 20px; + -moz-border-radius: 20px; + -webkit-border-radius: 10px; + border-collapse: separate; + border-spacing: 0px; +} +.zoneTable{ + width: 100%; + margin: 0 auto; + border-collapse: collapse; +} +#routeFk, #zone, #labels{ + font-size: 30px; +} +#routeFk{ + width: 120px; + padding-top: 5px; + padding-bottom: 5px; + max-width: 120px; + text-align: center; +} +#zone{ + width: 305px; + max-width: 305px; + text-align: center; +} +#labels{ + text-align: center; +} +#black { + background-color: rgb(102, 102, 102); + color: white; +} +#QR { + padding: 25px; + padding-left: 40px; + margin-top: 20px; +} +#additionalInfo { + padding-top: 20px; +} \ No newline at end of file diff --git a/print/templates/reports/expedition-pallet-label/expedition-pallet-label.html b/print/templates/reports/expedition-pallet-label/expedition-pallet-label.html new file mode 100644 index 000000000..45c6ab463 --- /dev/null +++ b/print/templates/reports/expedition-pallet-label/expedition-pallet-label.html @@ -0,0 +1,38 @@ + + +
+{{labelData.truck || '---'}} | +|||||||
+
|
+ |||||||
+ |
+ Pallet: {{id}}
+ User: {{username.name || '---'}}
+ Day: {{labelData.dayName.toUpperCase() || '---'}}
+ |
+