This repository has been archived on 2022-10-05. You can view files and clone it, but cannot push or open issues or pull requests.
assetLabelGen/computerLabel.js

27 lines
711 B
JavaScript

import QRCode from "qrcode";
import JsBarcode from "jsbarcode";
async function renderLabels() {
const template = document.querySelector("#labelTemplate");
const URL_BASE = "https://inv.claremontmakerspace.org/";
const assetTag = "TSMS00001";
const assetName = "Laptop1";
let clone = document.importNode(template.content, true);
let qrcode = await QRCode.toDataURL(URL_BASE + assetTag, { margin: 0 });
clone.querySelector(".qrcode").src = qrcode;
JsBarcode(clone.querySelector(".barcode"), assetTag, {
displayValue: false,
margin: 0
});
clone.querySelector(".name").textContent = assetName;
document.body.appendChild(clone);
}
window.addEventListener("load", renderLabels);