diff --git a/db/dump/.dump/data.sql b/db/dump/.dump/data.sql index 315bfe7c5..5f464c5e2 100644 --- a/db/dump/.dump/data.sql +++ b/db/dump/.dump/data.sql @@ -1723,7 +1723,6 @@ INSERT INTO `ACL` VALUES (378,'OsTicket','osTicketReportEmail','WRITE','ALLOW',' INSERT INTO `ACL` VALUES (379,'Item','buyerWasteEmail','WRITE','ALLOW','ROLE','system',NULL); INSERT INTO `ACL` VALUES (380,'Claim','claimPickupPdf','READ','ALLOW','ROLE','employee',NULL); INSERT INTO `ACL` VALUES (381,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','claimManager',NULL); -INSERT INTO `ACL` VALUES (382,'Item','itemLabelQr','READ','ALLOW','ROLE','employee',NULL); INSERT INTO `ACL` VALUES (383,'Sector','*','READ','ALLOW','ROLE','employee',NULL); INSERT INTO `ACL` VALUES (384,'Sector','*','WRITE','ALLOW','ROLE','employee',NULL); INSERT INTO `ACL` VALUES (385,'Route','driverRoutePdf','READ','ALLOW','ROLE','employee',NULL); diff --git a/db/versions/11315-grayCamellia/00-firstScript.sql b/db/versions/11315-grayCamellia/00-firstScript.sql new file mode 100644 index 000000000..60eea0e01 --- /dev/null +++ b/db/versions/11315-grayCamellia/00-firstScript.sql @@ -0,0 +1,3 @@ +DELETE FROM salix.ACL + WHERE property = 'labelPdf' + AND model = 'Item'; diff --git a/modules/item/back/methods/item/labelBarcodePdf.js b/modules/item/back/methods/item/labelBarcodePdf.js new file mode 100644 index 000000000..3325e3da1 --- /dev/null +++ b/modules/item/back/methods/item/labelBarcodePdf.js @@ -0,0 +1,55 @@ +module.exports = Self => { + Self.remoteMethodCtx('labelBarcodePdf', { + description: 'Returns the item label pdf with barcode', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The item id', + http: {source: 'path'} + }, { + arg: 'warehouseId', + type: 'number', + required: true + }, { + arg: 'packing', + type: 'number', + required: false + }, { + arg: 'copies', + type: 'number', + required: false + }, { + arg: 'userId', + type: 'number', + description: 'The user id from accessToken', + http: ctx => ctx.req.accessToken.userId, + required: true + } + ], + 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/label-barcode-pdf', + verb: 'GET' + }, + accessScopes: ['DEFAULT', 'read:multimedia'] + }); + + Self.labelBarcodePdf = (ctx, id) => Self.printReport(ctx, id, 'item-label-barcode'); +}; diff --git a/modules/item/back/methods/item/itemLabelQr.js b/modules/item/back/methods/item/labelQrPdf.js similarity index 86% rename from modules/item/back/methods/item/itemLabelQr.js rename to modules/item/back/methods/item/labelQrPdf.js index 88d8ce950..4d0e34528 100644 --- a/modules/item/back/methods/item/itemLabelQr.js +++ b/modules/item/back/methods/item/labelQrPdf.js @@ -1,6 +1,6 @@ module.exports = Self => { - Self.remoteMethodCtx('itemLabelQr', { - description: 'Returns the item label pdf', + Self.remoteMethodCtx('labelQrPdf', { + description: 'Returns the item label pdf with qr', accessType: 'READ', accepts: [ { @@ -45,11 +45,11 @@ module.exports = Self => { } ], http: { - path: '/:id/item-label-qr', + path: '/:id/label-qr-pdf', verb: 'GET' }, accessScopes: ['DEFAULT', 'read:multimedia'] }); - Self.itemLabelQr = (ctx, id) => Self.printReport(ctx, id, 'item-label-qr'); + Self.labelQrPdf = (ctx, id) => Self.printReport(ctx, id, 'item-label-qr'); }; diff --git a/modules/item/back/models/item.js b/modules/item/back/models/item.js index 4fb9af8fa..d39586a90 100644 --- a/modules/item/back/models/item.js +++ b/modules/item/back/models/item.js @@ -15,7 +15,8 @@ module.exports = Self => { require('../methods/item/getWasteByItem')(Self); require('../methods/item/createIntrastat')(Self); require('../methods/item/buyerWasteEmail')(Self); - require('../methods/item/itemLabelQr')(Self); + require('../methods/item/labelBarcodePdf')(Self); + require('../methods/item/labelQrPdf')(Self); require('../methods/item/setVisibleDiscard')(Self); require('../methods/item/get')(Self); diff --git a/print/templates/reports/item-label-barcode/assets/css/import.js b/print/templates/reports/item-label-barcode/assets/css/import.js new file mode 100644 index 000000000..37a98dfdd --- /dev/null +++ b/print/templates/reports/item-label-barcode/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/item-label-barcode/assets/css/style.css b/print/templates/reports/item-label-barcode/assets/css/style.css new file mode 100644 index 000000000..48b881986 --- /dev/null +++ b/print/templates/reports/item-label-barcode/assets/css/style.css @@ -0,0 +1,83 @@ +html { + font-family: "Roboto", "Helvetica", "Arial", sans-serif; + margin-top: -7px; +} +table { + width: 100%; + font-size: 14px; +} +td { + border: 6px solid white; +} +.center { + text-align: center; +} +.right { + text-align: right; +} +.cursive { + font-style: italic; +} +.bold { + font-weight: bold; +} +.black-bg { + background-color: black; + color: white; +} +.xs-txt { + font-size: 18px; +} +.md-txt { + font-size: 26px; +} +.xl-txt { + font-size: 50px; +} +.cell { + border: 2px solid black; + box-sizing: content-box; + width: 100%; + height: 30px; + display: flex; + justify-content: center; + align-items: center; +} +.padding { + padding: 7px; +} +.xs-height { + height: 50px; + max-height: 50px; +} +.md-height { + height: 60px; + max-height: 60px; +} +.sm-width { + width: 60px; + max-width: 60px; +} +.md-width { + width: 120px; + max-width: 120px; +} +.lg-width { + width: 400px; + max-width: 400px; +} +.overflow-multiline { + max-height: inherit; + display: -webkit-box; + overflow: hidden; + word-wrap: break-word; + line-clamp: 2; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; +} +.overflow-line { + width: inherit; + max-width: inherit; + overflow: hidden; + white-space: nowrap; +} \ No newline at end of file diff --git a/print/templates/reports/item-label-barcode/item-label-barcode.html b/print/templates/reports/item-label-barcode/item-label-barcode.html new file mode 100644 index 000000000..79de49411 --- /dev/null +++ b/print/templates/reports/item-label-barcode/item-label-barcode.html @@ -0,0 +1,87 @@ + + +
+
+
+ {{item.item}}
+
+ |
+
+
+ {{item.size}}
+
+ |
+ |
+
+ {{item.comment}}
+
+ |
+
+
+ {{item.producer}}
+
+ |
+
+
+ {{item.inkFk}}
+
+ |
+
+
+ {{item.itemFk}}
+
+ |
+
+
+ {{`${(packing || item.packing)} x ${item.stems || ''}`}}
+
+ |
+ |
+ + | +
+
+ {{item.entryFk}}
+
+ |
+ |
+
+ {{item.buyerName}}
+
+ |
+
+
+ {{item.origin}}
+
+ |
+ |
+
+ {{item.buyFk}}
+
+ |
+
+
+ {{date}}
+
+ |
+
+
+ {{`${item.labelNum}/${item.quantity / (packing || item.packing)}`}}
+
+ |
+