From d391946f57a19567012ee521a63c1d46dc936a57 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 22 Dec 2022 08:04:03 +0100 Subject: [PATCH] refs #4898 Added barcode and changes in structure --- .../assets/css/style.css | 12 ++++++++++-- .../expedition-pallet-label.html | 17 ++++++++++------- .../expedition-pallet-label.js | 16 ++++++++++++++++ .../expedition-pallet-label/options.json | 4 ++-- 4 files changed, 38 insertions(+), 11 deletions(-) diff --git a/print/templates/reports/expedition-pallet-label/assets/css/style.css b/print/templates/reports/expedition-pallet-label/assets/css/style.css index 68e91fb47..bd7366486 100644 --- a/print/templates/reports/expedition-pallet-label/assets/css/style.css +++ b/print/templates/reports/expedition-pallet-label/assets/css/style.css @@ -17,7 +17,6 @@ html { } .mainTable { width: 100%; - height: 100%; border: 10px solid; border-radius: 20px; -moz-border-radius: 20px; @@ -54,8 +53,17 @@ html { } #QR { padding: 25px; - padding-left: 40px; + margin-left: 35px; + float:left; +} +#barcode{ + text-align: center; +} +#right { + float: right; margin-top: 20px; + width: 250; + max-width: 250px; } #additionalInfo { padding-top: 20px; diff --git a/print/templates/reports/expedition-pallet-label/expedition-pallet-label.html b/print/templates/reports/expedition-pallet-label/expedition-pallet-label.html index 45c6ab463..e4360c79d 100644 --- a/print/templates/reports/expedition-pallet-label/expedition-pallet-label.html +++ b/print/templates/reports/expedition-pallet-label/expedition-pallet-label.html @@ -4,10 +4,11 @@ - + -
{{labelData.truck || '---'}}{{labelData.truck || '---'}}
+ +
@@ -25,11 +26,13 @@ - - diff --git a/print/templates/reports/expedition-pallet-label/expedition-pallet-label.js b/print/templates/reports/expedition-pallet-label/expedition-pallet-label.js index 3613da08f..0e8c297e8 100644 --- a/print/templates/reports/expedition-pallet-label/expedition-pallet-label.js +++ b/print/templates/reports/expedition-pallet-label/expedition-pallet-label.js @@ -1,5 +1,7 @@ const Component = require(`vn-print/core/component`); const reportBody = new Component('report-body'); +const jsBarcode = require('jsbarcode'); +const {DOMImplementation, XMLSerializer} = require('xmldom'); const UserError = require('vn-loopback/util/user-error'); const qrcode = require('qrcode'); @@ -39,6 +41,20 @@ module.exports = { const data = String(id); return qrcode.toDataURL(data, {margin: 0}); }, + getBarcode(id) { + const xmlSerializer = new XMLSerializer(); + const document = new DOMImplementation().createDocument('http://www.w3.org/1999/xhtml', 'html', null); + const svgNode = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); + + jsBarcode(svgNode, id, { + xmlDocument: document, + format: 'code128', + displayValue: false, + width: 6, + height: 90, + }); + return xmlSerializer.serializeToString(svgNode); + }, }, components: { 'report-body': reportBody.build() diff --git a/print/templates/reports/expedition-pallet-label/options.json b/print/templates/reports/expedition-pallet-label/options.json index 269e058f0..5814b2c0f 100644 --- a/print/templates/reports/expedition-pallet-label/options.json +++ b/print/templates/reports/expedition-pallet-label/options.json @@ -2,8 +2,8 @@ "width": "10cm", "height": "15cm", "margin": { - "top": "0.5cm", - "right": "0.2cm", + "top": "0.3cm", + "right": "0.07cm", "bottom": "0cm", "left": "0cm" },
-
Pallet: {{id}}
-
User: {{username.name || '---'}}
-
Day: {{labelData.dayName.toUpperCase() || '---'}}
+
+ +