From 8fd133c5e8a10edb4b35b3796887be898d6ff442 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 27 Nov 2024 12:51:09 +0100 Subject: [PATCH 1/5] feat: refs #6818 define prefix model --- back/model-config.json | 3 +++ back/models/prefix.json | 27 +++++++++++++++++++ modules/client/back/methods/client/summary.js | 2 +- 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 back/models/prefix.json diff --git a/back/model-config.json b/back/model-config.json index b543071c9..e0bc92200 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -133,6 +133,9 @@ "Postcode": { "dataSource": "vn" }, + "Prefix": { + "dataSource": "vn" + }, "ReferenceRate": { "dataSource": "vn" }, diff --git a/back/models/prefix.json b/back/models/prefix.json new file mode 100644 index 000000000..762354caa --- /dev/null +++ b/back/models/prefix.json @@ -0,0 +1,27 @@ +{ + "name": "Prefix", + "base": "VnModel", + "options": { + "mysql": { + "table": "pbx.prefix" + } + }, + "properties": { + "country": { + "type": "string", + "id": true + }, + "prefix": { + "type": "string" + } + }, + "acls": [ + { + "property": "*", + "accessType": "READ", + "principalType": "ROLE", + "principalId": "employee", + "permission": "ALLOW" + } + ] +} \ No newline at end of file diff --git a/modules/client/back/methods/client/summary.js b/modules/client/back/methods/client/summary.js index 9242fbd44..9c1420b61 100644 --- a/modules/client/back/methods/client/summary.js +++ b/modules/client/back/methods/client/summary.js @@ -54,7 +54,7 @@ module.exports = Self => { { relation: 'country', scope: { - fields: ['id', 'name'], + fields: ['id', 'name', 'code'], include: { relation: 'saySimpleCountry', } From d872f164fda67e1803c538863014c3fc3b6261de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Wed, 27 Nov 2024 14:55:30 +0000 Subject: [PATCH 2/5] Actualizar modules/entry/back/models/entry.js --- modules/entry/back/models/entry.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/entry/back/models/entry.js b/modules/entry/back/models/entry.js index 8ca79f531..49c3d2ec3 100644 --- a/modules/entry/back/models/entry.js +++ b/modules/entry/back/models/entry.js @@ -12,6 +12,7 @@ module.exports = Self => { require('../methods/entry/addFromBuy')(Self); require('../methods/entry/buyLabel')(Self); require('../methods/entry/print')(Self); + require('../methods/entry/buyLabelSupplier')(Self); Self.observe('before save', async function(ctx, options) { if (ctx.isNewInstance) return; From 30cc7a49a0f859e9c1d254a3a12d654a9dca045e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Wed, 27 Nov 2024 15:38:50 +0000 Subject: [PATCH 3/5] Actualizar modules/entry/back/methods/entry/print.js --- modules/entry/back/methods/entry/print.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/entry/back/methods/entry/print.js b/modules/entry/back/methods/entry/print.js index 5b9de9a69..b604adce6 100644 --- a/modules/entry/back/methods/entry/print.js +++ b/modules/entry/back/methods/entry/print.js @@ -48,6 +48,7 @@ module.exports = Self => { for (const buy of buys) { if (buy.stickers < 1) continue; ctx.args.id = buy.id; + ctx.args.copies = buy.stickers; const pdfBuffer = await models.Entry.buyLabel(ctx, myOptions); await merger.add(new Uint8Array(pdfBuffer[0])); } From 93388461d184de74a0fe01df4083c48b79fc37ae Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 28 Nov 2024 08:59:08 +0100 Subject: [PATCH 4/5] fix: refs #7266 Changed method name and corrections --- .../back/methods/entry/{print.js => labelSupplier.js} | 8 ++++---- modules/entry/back/models/entry.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) rename modules/entry/back/methods/entry/{print.js => labelSupplier.js} (89%) diff --git a/modules/entry/back/methods/entry/print.js b/modules/entry/back/methods/entry/labelSupplier.js similarity index 89% rename from modules/entry/back/methods/entry/print.js rename to modules/entry/back/methods/entry/labelSupplier.js index b604adce6..32d80c427 100644 --- a/modules/entry/back/methods/entry/print.js +++ b/modules/entry/back/methods/entry/labelSupplier.js @@ -1,6 +1,6 @@ const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { - Self.remoteMethodCtx('print', { + Self.remoteMethodCtx('labelSupplier', { description: 'Print stickers of all entries', accessType: 'READ', accepts: [ @@ -28,13 +28,13 @@ module.exports = Self => { } ], http: { - path: '/:id/print', + path: '/:id/labelSupplier', verb: 'GET' }, accessScopes: ['DEFAULT', 'read:multimedia'] }); - Self.print = async function(ctx, id, options) { + Self.labelSupplier = async function(ctx, id, options) { const models = Self.app.models; const myOptions = {}; if (typeof options == 'object') @@ -49,7 +49,7 @@ module.exports = Self => { if (buy.stickers < 1) continue; ctx.args.id = buy.id; ctx.args.copies = buy.stickers; - const pdfBuffer = await models.Entry.buyLabel(ctx, myOptions); + const pdfBuffer = await models.Entry.buyLabelSupplier(ctx, myOptions); await merger.add(new Uint8Array(pdfBuffer[0])); } diff --git a/modules/entry/back/models/entry.js b/modules/entry/back/models/entry.js index 49c3d2ec3..dc5022ada 100644 --- a/modules/entry/back/models/entry.js +++ b/modules/entry/back/models/entry.js @@ -11,7 +11,7 @@ module.exports = Self => { require('../methods/entry/addFromPackaging')(Self); require('../methods/entry/addFromBuy')(Self); require('../methods/entry/buyLabel')(Self); - require('../methods/entry/print')(Self); + require('../methods/entry/labelSupplier')(Self); require('../methods/entry/buyLabelSupplier')(Self); Self.observe('before save', async function(ctx, options) { From 51d96a89c590ecd93ee41f3f589ca67a8f10b902 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 28 Nov 2024 11:15:58 +0100 Subject: [PATCH 5/5] fix: refs #7266 Increased size item id buy-label --- .../templates/reports/buy-label-barcode/assets/css/style.css | 4 +++- .../reports/buy-label-barcode/buy-label-barcode.html | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/print/templates/reports/buy-label-barcode/assets/css/style.css b/print/templates/reports/buy-label-barcode/assets/css/style.css index eece20acb..ce1924878 100644 --- a/print/templates/reports/buy-label-barcode/assets/css/style.css +++ b/print/templates/reports/buy-label-barcode/assets/css/style.css @@ -33,7 +33,9 @@ td { font-size: 26px; } .lg-txt { - font-size: 32px; + font-size: 40px; + padding: 0px; + line-height: 1; } .xl-txt { font-size: 50px; diff --git a/print/templates/reports/buy-label-barcode/buy-label-barcode.html b/print/templates/reports/buy-label-barcode/buy-label-barcode.html index c1725f5c0..ebddb60ec 100644 --- a/print/templates/reports/buy-label-barcode/buy-label-barcode.html +++ b/print/templates/reports/buy-label-barcode/buy-label-barcode.html @@ -36,12 +36,12 @@ - +
{{formatNumber(buy.itemFk)}}
- +
{{`${(packing || buy.packing)} x ${buy.stems || ''}`}}