diff --git a/changelog/60_3.0.0_2020-12-22.md b/changelog/60_3.0.0_2020-12-22.md index 774b41fa..55eb56b4 100644 --- a/changelog/60_3.0.0_2020-12-22.md +++ b/changelog/60_3.0.0_2020-12-22.md @@ -149,7 +149,7 @@ - There are also new columns on some pages, hidden by default - Stock overview: Value, Product group, Calories, Last purchased, Last price, Min. stock amount - Products list: Default store - - Shopping list: Last price (Unit), Last price (Total), Default store + - Shopping list: Last price (Unit), Last price (Total), Default store, Barcodes (as scannable code-image) - Row grouping can be customized to use any available column (thanks @edenhaus) - Table states (visible columns, sorting, column order and so on) are now saved server side (in user settings) means that this stays the same when using different browsers - Dialogs are now used everywhere where appropriate instead of jumping between pages (for example when adding/editing shopping list items) diff --git a/package.json b/package.json index 7b7683cb..38d2c306 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "bootstrap": "^4.5.2", "bootstrap-select": "^1.13.18", "bootstrap-v4-rtl": "^4.5.2-1", + "bwip-js": "^2.0.11", "chart.js": "^2.8.0", "datatables.net": "^1.10.22", "datatables.net-bs4": "^1.10.22", diff --git a/public/viewjs/shoppinglist.js b/public/viewjs/shoppinglist.js index ec3ec452..0bdbfd60 100644 --- a/public/viewjs/shoppinglist.js +++ b/public/viewjs/shoppinglist.js @@ -8,6 +8,7 @@ { 'visible': false, 'targets': 5 }, { 'visible': false, 'targets': 6 }, { 'visible': false, 'targets': 7 }, + { 'visible': false, 'targets': 8 }, { "type": "num", "targets": 2 }, { "type": "html-num-fmt", "targets": 5 }, { "type": "html-num-fmt", "targets": 6 } @@ -529,3 +530,18 @@ $(window).on("message", function(e) window.location.href = U('/shoppinglist?list=' + data.Payload); } }); + +var dummyCanvas = document.createElement("canvas"); +$("img.barcode").each(function() +{ + var img = $(this); + + bwipjs.toCanvas(dummyCanvas, { + bcid: "ean8", + text: img.attr("data-barcode"), + height: 5, + includetext: false + }); + + img.attr("src", dummyCanvas.toDataURL("image/png")); +}); diff --git a/views/shoppinglist.blade.php b/views/shoppinglist.blade.php index 49ecaf43..9ede82c9 100644 --- a/views/shoppinglist.blade.php +++ b/views/shoppinglist.blade.php @@ -5,6 +5,7 @@ @section('viewJsName', 'shoppinglist') @push('pageScripts') + @endpush @@ -165,6 +166,7 @@