Prototyped the barcode idea; Added a basic production system.
This commit is contained in:
32
imports/ui/PrintLabel.js
Normal file
32
imports/ui/PrintLabel.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import './PrintLabel.html';
|
||||
import JsBarcode from 'JsBarcode';
|
||||
//import QRCode from "../util/qrcode/qrcode";
|
||||
import QRCode from '/imports/util/qrcode/qrcode';
|
||||
|
||||
//let {qrcode, svg2url} = require('pure-svg-code');
|
||||
|
||||
Template.PrintLabel.onCreated(function() {
|
||||
function getUrlVars() {
|
||||
let vars = {};
|
||||
let parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
|
||||
vars[key] = decodeURIComponent(value);
|
||||
});
|
||||
return vars;
|
||||
}
|
||||
|
||||
this.vars = getUrlVars();
|
||||
});
|
||||
|
||||
Template.PrintLabel.onRendered(function() {
|
||||
let vars = this.vars;
|
||||
$('.title1').html(vars['title1']);
|
||||
$('.title2').html(vars['title2'] === undefined ? "" : vars['title2']);
|
||||
$('.ingredients').append(vars['ingredients']);
|
||||
$('.date').html(vars['date']);
|
||||
$('.size').html(vars['size']);
|
||||
//JsBarcode(".barcode").init();
|
||||
|
||||
//const svgString = qrcode({content: "1234567890", padding: 0, width: 50, height: 50, color: "#000000", background: "#FFFFFF", ecl: "L"});
|
||||
//this.$('.qrcode').attr('src', svg2url(svgString));
|
||||
new QRCode(document.getElementById("qrcode"), {text: "1234567890", width: 60, height: 60});
|
||||
});
|
||||
Reference in New Issue
Block a user